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.
package/dist/cli.js CHANGED
@@ -9212,12 +9212,13 @@ function getArcheometerRenderModel(options = {}) {
9212
9212
  };
9213
9213
  const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
9214
9214
  const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
9215
- return {
9215
+ const rings = buildRings(outerRadius, frameRadius);
9216
+ const modelBase = {
9216
9217
  viewBox,
9217
9218
  center,
9218
9219
  outerRadius,
9219
9220
  scale,
9220
- rings: buildRings(outerRadius, frameRadius),
9221
+ rings,
9221
9222
  palette: resolvePalette(options.palette),
9222
9223
  rotationDegrees: options.rotationDegrees ?? 0,
9223
9224
  layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
@@ -9229,6 +9230,10 @@ function getArcheometerRenderModel(options = {}) {
9229
9230
  zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
9230
9231
  planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
9231
9232
  };
9233
+ return {
9234
+ ...modelBase,
9235
+ geometry: buildArcheometerGeometry(modelBase)
9236
+ };
9232
9237
  }
9233
9238
  function generateArcheometerSvg(options = {}) {
9234
9239
  const model = getArcheometerRenderModel(options);
@@ -9339,7 +9344,6 @@ function renderDegreeCrown(push, model) {
9339
9344
  function renderZodiacUtterance(push, model) {
9340
9345
  const { center, rings, palette, scale } = model;
9341
9346
  const ring = rings.zodiacUtterance;
9342
- const sorted = sortedByDegree(model.utterance);
9343
9347
  push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
9344
9348
  for (let i = 0; i < 12; i++) {
9345
9349
  const degree = i * 30;
@@ -9357,9 +9361,9 @@ function renderZodiacUtterance(push, model) {
9357
9361
  )}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
9358
9362
  );
9359
9363
  }
9360
- for (const point of sorted) {
9361
- const a = angleOf(model, point.degree);
9362
- const p = polarToXY(center, ring.r1 + (ring.r2 - ring.r1) * 0.58, a);
9364
+ for (const geometry of model.geometry.utterancePoints) {
9365
+ const point = geometry.data;
9366
+ const p = geometry.anchor;
9363
9367
  const shieldR = (ring.r2 - ring.r1) * 0.22;
9364
9368
  const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
9365
9369
  const isStacked = letterParts.length > 1;
@@ -9388,11 +9392,11 @@ function renderPlanetaryUtterance(push, model) {
9388
9392
  const { center, rings, palette, scale } = model;
9389
9393
  const ring = rings.planetaryUtterance;
9390
9394
  const clipOuter = planetaryTriangleClipOuterRadius(rings);
9391
- const vertexRadius = clipOuter;
9392
9395
  push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
9393
9396
  push(`<g clip-path="url(#archeometer-planetary-clip)">`);
9394
- for (const triangle of model.triangles) {
9395
- const vertices = triangle.vertices.map((degree) => polarToXY(center, vertexRadius, angleOf(model, degree)));
9397
+ for (const triangleGeometry of model.geometry.triangles) {
9398
+ const triangle = triangleGeometry.data;
9399
+ const vertices = triangleGeometry.vertices;
9396
9400
  if (triangle.vertexFills) {
9397
9401
  const centroid = polygonCentroid(vertices);
9398
9402
  const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
@@ -9401,17 +9405,18 @@ function renderPlanetaryUtterance(push, model) {
9401
9405
  const nextMidpoint = midpoints[index];
9402
9406
  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"/>`);
9403
9407
  }
9404
- 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)}"/>`);
9408
+ 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)}"/>`);
9405
9409
  } else {
9406
- 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)}"/>`);
9410
+ 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)}"/>`);
9407
9411
  }
9408
9412
  }
9409
9413
  push(`</g>`);
9410
- for (const label of sortedByDegree(model.triangleLabels)) {
9414
+ for (const labelGeometry of model.geometry.triangleLabels) {
9415
+ const label = labelGeometry.data;
9411
9416
  if (!label.label)
9412
9417
  continue;
9413
9418
  const a = angleOf(model, label.degree);
9414
- const labelPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.56, a);
9419
+ const labelPoint = labelGeometry.anchor;
9415
9420
  push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
9416
9421
  if (label.number !== void 0) {
9417
9422
  const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
@@ -9441,10 +9446,11 @@ function renderCosmologicalMusic(push, model) {
9441
9446
  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"/>`);
9442
9447
  }
9443
9448
  }
9444
- for (const note of notes) {
9449
+ for (const noteGeometry of model.geometry.musicalNotes) {
9450
+ const note = noteGeometry.data;
9445
9451
  if (!note.note)
9446
9452
  continue;
9447
- const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, note.degree));
9453
+ const p = noteGeometry.anchor;
9448
9454
  push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
9449
9455
  }
9450
9456
  push(`</g>`);
@@ -9454,7 +9460,8 @@ function renderAstralZodiac(push, model) {
9454
9460
  const ring = rings.astralZodiac;
9455
9461
  const ringWidth = ring.r2 - ring.r1;
9456
9462
  push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
9457
- for (const sign of sortedByDegree(model.zodiacSigns)) {
9463
+ for (const signGeometry of model.geometry.zodiacSigns) {
9464
+ const sign = signGeometry.data;
9458
9465
  const sector = annularSectorPath(
9459
9466
  center,
9460
9467
  ring.r1,
@@ -9472,9 +9479,10 @@ function renderAstralZodiac(push, model) {
9472
9479
  }
9473
9480
  const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
9474
9481
  const glyphSize = 17.5 * scale;
9475
- for (const sign of sortedByDegree(model.zodiacSigns)) {
9482
+ for (const signGeometry of model.geometry.zodiacSigns) {
9483
+ const sign = signGeometry.data;
9476
9484
  const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
9477
- const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, sign.degree));
9485
+ const p = signGeometry.anchor;
9478
9486
  push(
9479
9487
  `<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
9480
9488
  normalizeDegrees(sign.degree)
@@ -9495,7 +9503,8 @@ function renderAstralPlanetary(push, model) {
9495
9503
  const ring = rings.astralPlanetary;
9496
9504
  const ringWidth = ring.r2 - ring.r1;
9497
9505
  push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
9498
- for (const planet of sortedByDegree(model.planetaryPoints)) {
9506
+ for (const planetGeometry of model.geometry.planetaryPoints) {
9507
+ const planet = planetGeometry.data;
9499
9508
  const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
9500
9509
  const sector = annularSectorPath(
9501
9510
  center,
@@ -9516,8 +9525,9 @@ function renderAstralPlanetary(push, model) {
9516
9525
  push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
9517
9526
  }
9518
9527
  const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
9519
- for (const planet of sortedByDegree(model.planetaryPoints)) {
9520
- const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, planet.degree));
9528
+ for (const planetGeometry of model.geometry.planetaryPoints) {
9529
+ const planet = planetGeometry.data;
9530
+ const p = planetGeometry.anchor;
9521
9531
  const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
9522
9532
  const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
9523
9533
  push(
@@ -9679,6 +9689,84 @@ function renderFrame(push, model) {
9679
9689
  );
9680
9690
  push(`</g>`);
9681
9691
  }
9692
+ function buildArcheometerGeometry(model) {
9693
+ const { center, rings, scale } = model;
9694
+ const utteranceRing = rings.zodiacUtterance;
9695
+ const triangleLabelRing = rings.planetaryUtterance;
9696
+ const musicRing = rings.cosmologicalMusic;
9697
+ const zodiacRing = rings.astralZodiac;
9698
+ const planetRing = rings.astralPlanetary;
9699
+ const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
9700
+ const whiteRaySolarRadius = rings.solarCenter.r2;
9701
+ const pointHitRadius = Math.max(11 * scale, 8);
9702
+ const element = (layerId, idPrefix, item, radius, hitRadius = pointHitRadius) => {
9703
+ const anchor = polarToXY(center, radius, angleOf(model, item.degree));
9704
+ return {
9705
+ id: `${idPrefix}-${slugForGeometry(item.id ?? item.name ?? item.note ?? item.label ?? item.degree)}`,
9706
+ layerId,
9707
+ data: item,
9708
+ degree: normalizeDegrees(item.degree),
9709
+ anchor,
9710
+ hitTarget: { kind: "circle", cx: anchor.x, cy: anchor.y, r: hitRadius }
9711
+ };
9712
+ };
9713
+ const triangles = model.triangles.map((triangle) => {
9714
+ const vertices = triangle.vertices.map(
9715
+ (degree) => polarToXY(center, planetaryClipOuter, angleOf(model, degree))
9716
+ );
9717
+ const centroid = polygonCentroid(vertices);
9718
+ return {
9719
+ id: `triangle-${slugForGeometry(triangle.id)}`,
9720
+ layerId: "planetaryUtterance",
9721
+ data: triangle,
9722
+ vertices,
9723
+ centroid,
9724
+ path: polygonPath(vertices),
9725
+ hitTarget: { kind: "polygon", points: vertices }
9726
+ };
9727
+ });
9728
+ const degreeTicks = Array.from({ length: 12 }, (_, index) => {
9729
+ const degree = index * 30;
9730
+ const angle = angleOf(model, degree);
9731
+ return {
9732
+ id: `degree-${degree}`,
9733
+ degree,
9734
+ outerAnchor: polarToXY(center, (rings.degreeOuter.r1 + rings.degreeOuter.r2) / 2, angle),
9735
+ innerAnchor: polarToXY(center, (rings.degreeInner.r1 + rings.degreeInner.r2) / 2, angle)
9736
+ };
9737
+ });
9738
+ const rays = Array.from({ length: 12 }, (_, index) => index * 30).filter((degree) => degree !== 90 && degree !== 270).map((degree) => ({
9739
+ id: `white-ray-${degree}`,
9740
+ degree,
9741
+ layerId: "whiteRays",
9742
+ line: lineFromPolar(center, whiteRaySolarRadius, 3.3, angleOf(model, degree))
9743
+ }));
9744
+ return {
9745
+ utterancePoints: sortedByDegree(model.utterance).map(
9746
+ (point) => element("zodiacUtterance", "utterance", point, utteranceRing.r1 + (utteranceRing.r2 - utteranceRing.r1) * 0.58)
9747
+ ),
9748
+ triangles,
9749
+ triangleLabels: sortedByDegree(model.triangleLabels).map(
9750
+ (label) => element("triangleLabels", "triangle-label", label, triangleLabelRing.r1 + (planetaryClipOuter - triangleLabelRing.r1) * 0.56)
9751
+ ),
9752
+ musicalNotes: sortedByDegree(model.musicalNotes).map(
9753
+ (note) => element("cosmologicalMusic", "music", note, (musicRing.r1 + musicRing.r2) / 2)
9754
+ ),
9755
+ zodiacSigns: sortedByDegree(model.zodiacSigns).map(
9756
+ (sign) => element("astralZodiac", "zodiac", sign, (zodiacRing.r1 + zodiacRing.r2) / 2, Math.min((zodiacRing.r2 - zodiacRing.r1) * 0.33, 13 * scale))
9757
+ ),
9758
+ planetaryPoints: sortedByDegree(model.planetaryPoints).map(
9759
+ (planet) => element("astralPlanetary", "planet", planet, (planetRing.r1 + planetRing.r2) / 2, Math.min((planetRing.r2 - planetRing.r1) * 0.33, 13 * scale))
9760
+ ),
9761
+ degreeTicks,
9762
+ rays,
9763
+ center: {
9764
+ id: "solar-center",
9765
+ anchor: center,
9766
+ hitTarget: { kind: "circle", cx: center.x, cy: center.y, r: rings.solarCenter.r2 }
9767
+ }
9768
+ };
9769
+ }
9682
9770
  function buildRings(contentRadius, frameRadius = contentRadius) {
9683
9771
  const ring = (id2, r1, r2, radius = contentRadius) => ({
9684
9772
  id: id2,
@@ -9820,6 +9908,9 @@ function polygonCentroid(points) {
9820
9908
  function sortedByDegree(items) {
9821
9909
  return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
9822
9910
  }
9911
+ function slugForGeometry(value) {
9912
+ return String(value).trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item";
9913
+ }
9823
9914
  function nearestUtterance(degree, utterance) {
9824
9915
  let best;
9825
9916
  let bestDelta = Number.POSITIVE_INFINITY;
@@ -10359,6 +10450,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
10359
10450
  const rings = buildRings2(outerRadius, options.layout?.rings);
10360
10451
  const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
10361
10452
  const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
10453
+ const railVisibility = resolveRailVisibility(options.layout?.rails);
10362
10454
  const resolvedPoints = resolvePointOptions(options.points);
10363
10455
  const resolvedHouses = resolveHouseOptions(options.houses);
10364
10456
  const resolvedAspects = resolveAspectOptions(options.aspects);
@@ -10396,7 +10488,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
10396
10488
  palette,
10397
10489
  excludedBodies,
10398
10490
  pointConnectorMode,
10399
- maxDisplacementDegrees: maxPointDisplacementDegrees
10491
+ maxDisplacementDegrees: maxPointDisplacementDegrees,
10492
+ railVisibility
10400
10493
  });
10401
10494
  const extraPointLayers = (options.pointLayers ?? []).map(
10402
10495
  (layer) => buildPointLayer({
@@ -10408,7 +10501,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
10408
10501
  palette,
10409
10502
  excludedBodies,
10410
10503
  pointConnectorMode,
10411
- maxDisplacementDegrees: maxPointDisplacementDegrees
10504
+ maxDisplacementDegrees: maxPointDisplacementDegrees,
10505
+ railVisibility
10412
10506
  })
10413
10507
  );
10414
10508
  const pointLayers = [
@@ -10450,6 +10544,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
10450
10544
  ...extraAspectLayers
10451
10545
  ];
10452
10546
  const aspectLines = aspectLayers.flatMap((layer) => [...layer.aspectLines]);
10547
+ const positionRails = basePointLayer.rails;
10548
+ const boundaryNotches = pointLayers.flatMap((layer) => [...layer.notches]);
10453
10549
  return {
10454
10550
  viewBox,
10455
10551
  center,
@@ -10465,6 +10561,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
10465
10561
  aspectLines,
10466
10562
  pointLayers,
10467
10563
  aspectLayers,
10564
+ positionRails,
10565
+ boundaryNotches,
10468
10566
  palette
10469
10567
  };
10470
10568
  }
@@ -10493,6 +10591,7 @@ function generateAstroWheelSvg(chart, options = {}) {
10493
10591
  `<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
10494
10592
  );
10495
10593
  }
10594
+ renderAspectBoundary(push, model);
10496
10595
  renderAspects(push, model);
10497
10596
  renderZodiac(push, model, zodiacOptions);
10498
10597
  renderHouses(push, model, houseOptions);
@@ -10526,15 +10625,7 @@ function renderAspects(push, model) {
10526
10625
  if (model.aspectLayers.length === 0) {
10527
10626
  return;
10528
10627
  }
10529
- const guideRadius = model.rings.aspects.r2 * 0.96;
10530
- const innerGuideRadius = guideRadius * 0.52;
10531
10628
  push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
10532
- push(
10533
- `<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)}"/>`
10534
- );
10535
- push(
10536
- `<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)}"/>`
10537
- );
10538
10629
  for (const layer of model.aspectLayers) {
10539
10630
  push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
10540
10631
  for (const aspect of layer.aspectLines) {
@@ -10549,6 +10640,11 @@ function renderAspects(push, model) {
10549
10640
  );
10550
10641
  push(`</g>`);
10551
10642
  }
10643
+ function renderAspectBoundary(push, model) {
10644
+ push(
10645
+ `<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)}"/>`
10646
+ );
10647
+ }
10552
10648
  function renderZodiac(push, model, options) {
10553
10649
  if (!options.segments && !options.glyphs && !options.ticks) {
10554
10650
  return;
@@ -10621,15 +10717,6 @@ function renderHouses(push, model, options) {
10621
10717
  );
10622
10718
  }
10623
10719
  }
10624
- if (options.angles) {
10625
- for (const marker of model.angleMarkers) {
10626
- push(`<g data-angle-marker="${marker.key}">`);
10627
- push(
10628
- `<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)}"/>`
10629
- );
10630
- push(`</g>`);
10631
- }
10632
- }
10633
10720
  push(`</g>`);
10634
10721
  }
10635
10722
  function renderPlanets(push, model) {
@@ -10640,6 +10727,11 @@ function renderPlanets(push, model) {
10640
10727
  for (const layer of model.pointLayers) {
10641
10728
  renderPointLayerGuide(push, layer, model);
10642
10729
  }
10730
+ for (const notch of model.boundaryNotches) {
10731
+ push(
10732
+ `<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"/>`
10733
+ );
10734
+ }
10643
10735
  for (const layer of model.pointLayers) {
10644
10736
  push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
10645
10737
  for (const point of layer.points) {
@@ -10702,37 +10794,21 @@ function renderGlyphOverlay(push, model) {
10702
10794
  function renderAngleGlyph(push, marker, model) {
10703
10795
  const label = angleDisplayLabel(marker.key);
10704
10796
  const position = formatInlinePosition(marker.zodiacPosition);
10705
- const labelFontSize = marker.labelFontSize;
10706
- const positionFontSize = clamp(marker.labelFontSize * 0.52, 5.5 * model.scale, 9 * model.scale);
10707
- const signScale = positionFontSize * 0.88;
10708
- const gap = clamp(3.2 * model.scale, 2.5, 5);
10709
- const labelWidth = estimateTextWidth(label, labelFontSize);
10797
+ const positionFontSize = clamp(marker.labelFontSize * 0.62, 6 * model.scale, 10 * model.scale);
10798
+ const gap = clamp(3 * model.scale, 2, 5);
10710
10799
  const degreeWidth = estimateTextWidth(position.degreesText, positionFontSize);
10711
10800
  const minutesWidth = estimateTextWidth(position.minutesText, positionFontSize);
10712
- const totalWidth = labelWidth + gap + degreeWidth + gap + signScale + gap + minutesWidth;
10801
+ const totalWidth = degreeWidth + gap + minutesWidth;
10713
10802
  const startX = -totalWidth / 2;
10714
- const labelX = startX;
10715
- const degreeX = labelX + labelWidth + gap;
10716
- const signX = degreeX + degreeWidth + gap + signScale / 2;
10717
- const minutesX = signX + signScale / 2 + gap;
10803
+ const degreeX = startX;
10804
+ const minutesX = degreeX + degreeWidth + gap;
10718
10805
  push(
10719
10806
  `<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})">`
10720
10807
  );
10721
10808
  push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
10722
- push(
10723
- `<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>`
10724
- );
10725
10809
  push(
10726
10810
  `<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>`
10727
10811
  );
10728
- renderInlineSignGlyph(
10729
- push,
10730
- position.sign,
10731
- signX,
10732
- 0,
10733
- signScale,
10734
- model.palette.angleLabel
10735
- );
10736
10812
  push(
10737
10813
  `<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>`
10738
10814
  );
@@ -10746,24 +10822,29 @@ function angleDisplayLabel(key) {
10746
10822
  return key;
10747
10823
  }
10748
10824
  function renderPointLabelGroup(push, point, model) {
10749
- const layout = getPointLabelLayout(point, model.scale);
10750
- const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
10751
10825
  push(
10752
- `<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})">`
10826
+ `<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})">`
10753
10827
  );
10754
10828
  push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
10755
- renderPointGlyph(push, point, layout.glyphX, layout.glyphY, layout.glyphScale, model.palette.glyphHalo);
10756
- if (point.retrograde) {
10757
- renderRetrogradeMarker(
10758
- push,
10759
- layout.retrogradeX,
10760
- layout.retrogradeY,
10761
- layout.retrogradeFontSize,
10762
- point.color
10829
+ renderPointGlyph(push, point, 0, 0, point.glyphScale, model.palette.glyphHalo);
10830
+ push(`</g>`);
10831
+ for (const label of point.railLabels) {
10832
+ if (!label.visible)
10833
+ continue;
10834
+ push(
10835
+ `<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})">`
10763
10836
  );
10837
+ if (label.railId === "sign" && label.sign) {
10838
+ renderInlineSignGlyph(push, label.sign, 0, 0, label.glyphScale ?? label.fontSize, point.color);
10839
+ } else if (label.railId === "retrograde") {
10840
+ renderRetrogradeMarker(push, 0, 0, label.fontSize, point.color);
10841
+ } else {
10842
+ push(
10843
+ `<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>`
10844
+ );
10845
+ }
10846
+ push(`</g>`);
10764
10847
  }
10765
- renderPointInlineDegreeLabel(push, point, layout);
10766
- push(`</g>`);
10767
10848
  }
10768
10849
  function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
10769
10850
  const glyph = point.glyphKey ? getAstroGlyph(point.glyphKey) : resolvePointGlyph(point.name);
@@ -10796,18 +10877,6 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
10796
10877
  `<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>`
10797
10878
  );
10798
10879
  }
10799
- function renderPointInlineDegreeLabel(push, point, layout) {
10800
- if (!layout.position) {
10801
- return;
10802
- }
10803
- push(
10804
- `<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>`
10805
- );
10806
- renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
10807
- push(
10808
- `<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>`
10809
- );
10810
- }
10811
10880
  function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
10812
10881
  const glyph = ZODIAC_GLYPHS[sign];
10813
10882
  if (glyph) {
@@ -10823,89 +10892,6 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
10823
10892
  `<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>`
10824
10893
  );
10825
10894
  }
10826
- function getPointLabelLayout(point, scale) {
10827
- const glyphScale = point.glyphFontSize * 0.66;
10828
- const fontSize = clamp(point.glyphFontSize * 0.31, 5.5 * scale, 9 * scale);
10829
- const signScale = fontSize * 0.82;
10830
- const gap = clamp(3.2 * scale, 2.4, 5);
10831
- const railGap = clamp(4.4 * scale, 3.2, 7);
10832
- const retrogradeFontSize = clamp(fontSize * 0.74, 4.4 * scale, 7.2 * scale);
10833
- const retrogradeTextWidth = point.retrograde ? estimateTextWidth("Rx", retrogradeFontSize) : 0;
10834
- const retrogradeGap = point.retrograde ? clamp(1.7 * scale, 1.2, 3) : 0;
10835
- const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
10836
- const degreeWidth = position ? estimateTextWidth(position.degreesText, fontSize) : 0;
10837
- const minutesWidth = position ? estimateTextWidth(position.minutesText, fontSize) : 0;
10838
- const positionWidth = position ? degreeWidth + gap + signScale + gap + minutesWidth : 0;
10839
- const positionHeight = position ? Math.max(fontSize, signScale) : 0;
10840
- const inwardX = -Math.cos(point.labelAngle);
10841
- const inwardY = -Math.sin(point.labelAngle);
10842
- const glyphHalf = glyphScale / 2;
10843
- const retrogradeCenterDistance = point.retrograde ? glyphHalf + retrogradeGap + retrogradeTextWidth / 2 : 0;
10844
- const retrogradeRailWidth = point.retrograde ? retrogradeGap + retrogradeTextWidth : 0;
10845
- const positionCenterDistance = position ? glyphHalf + retrogradeRailWidth + railGap + positionWidth / 2 : 0;
10846
- const positionCenterX = inwardX * positionCenterDistance;
10847
- const positionCenterY = inwardY * positionCenterDistance;
10848
- const positionLeftX = positionCenterX - positionWidth / 2;
10849
- const glyphX = 0;
10850
- const glyphY = 0;
10851
- const retrogradeX = inwardX * retrogradeCenterDistance;
10852
- const retrogradeY = inwardY * retrogradeCenterDistance;
10853
- const degreeX = positionLeftX;
10854
- const degreeY = positionCenterY;
10855
- const signX = degreeX + degreeWidth + gap + signScale / 2;
10856
- const signY = positionCenterY;
10857
- const minutesX = signX + signScale / 2 + gap;
10858
- const minutesY = positionCenterY;
10859
- const boxes = [
10860
- {
10861
- x: -glyphHalf,
10862
- y: -glyphHalf,
10863
- width: glyphScale,
10864
- height: glyphScale
10865
- }
10866
- ];
10867
- if (point.retrograde) {
10868
- boxes.push({
10869
- x: retrogradeX - retrogradeTextWidth / 2,
10870
- y: retrogradeY - retrogradeFontSize / 2,
10871
- width: retrogradeTextWidth,
10872
- height: retrogradeFontSize
10873
- });
10874
- }
10875
- if (position) {
10876
- boxes.push({
10877
- x: positionLeftX,
10878
- y: positionCenterY - positionHeight / 2,
10879
- width: positionWidth,
10880
- height: positionHeight
10881
- });
10882
- }
10883
- const boundsX = Math.min(...boxes.map((box) => box.x));
10884
- const boundsY = Math.min(...boxes.map((box) => box.y));
10885
- const boundsMaxX = Math.max(...boxes.map((box) => box.x + box.width));
10886
- const boundsMaxY = Math.max(...boxes.map((box) => box.y + box.height));
10887
- return {
10888
- glyphScale,
10889
- glyphX,
10890
- glyphY,
10891
- fontSize,
10892
- degreeX,
10893
- degreeY,
10894
- signX,
10895
- signScale,
10896
- signY,
10897
- minutesX,
10898
- minutesY,
10899
- retrogradeX,
10900
- retrogradeY,
10901
- retrogradeFontSize,
10902
- boundsX,
10903
- boundsY,
10904
- width: boundsMaxX - boundsX,
10905
- height: boundsMaxY - boundsY,
10906
- position
10907
- };
10908
- }
10909
10895
  function formatInlinePosition(position) {
10910
10896
  let degrees = Math.floor(position.decimalDegrees);
10911
10897
  let minutes = Math.round((position.decimalDegrees - degrees) * 60);
@@ -10930,70 +10916,6 @@ function pointLabelTitle(point) {
10930
10916
  function estimateTextWidth(value, fontSize) {
10931
10917
  return value.length * fontSize * 0.56;
10932
10918
  }
10933
- function labelBoundsFor(position, layout, padding) {
10934
- const width = layout.width + padding * 2;
10935
- const height = layout.height + padding * 2;
10936
- return {
10937
- x: round2(position.x + layout.boundsX - padding),
10938
- y: round2(position.y + layout.boundsY - padding),
10939
- width: round2(width),
10940
- height: round2(height)
10941
- };
10942
- }
10943
- function constrainLabelInsideCircle(params) {
10944
- const { center, layout, padding, maxRadius } = params;
10945
- if (!Number.isFinite(maxRadius)) {
10946
- return {
10947
- position: params.position,
10948
- bounds: labelBoundsFor(params.position, layout, padding),
10949
- moved: false
10950
- };
10951
- }
10952
- let position = params.position;
10953
- let moved = false;
10954
- for (let attempt = 0; attempt < 6; attempt++) {
10955
- const bounds = labelBoundsFor(position, layout, padding);
10956
- const overflow = labelBoundsCircleOverflow(center, bounds, maxRadius);
10957
- if (overflow <= 0) {
10958
- return { position, bounds, moved };
10959
- }
10960
- const dx = position.x - center.x;
10961
- const dy = position.y - center.y;
10962
- const distance = Math.max(Math.hypot(dx, dy), 1);
10963
- position = {
10964
- x: round2(position.x - dx / distance * (overflow + 0.75)),
10965
- y: round2(position.y - dy / distance * (overflow + 0.75))
10966
- };
10967
- moved = true;
10968
- }
10969
- return {
10970
- position,
10971
- bounds: labelBoundsFor(position, layout, padding),
10972
- moved
10973
- };
10974
- }
10975
- function labelBoundsCircleOverflow(center, bounds, maxRadius) {
10976
- const corners = [
10977
- { x: bounds.x, y: bounds.y },
10978
- { x: bounds.x + bounds.width, y: bounds.y },
10979
- { x: bounds.x, y: bounds.y + bounds.height },
10980
- { x: bounds.x + bounds.width, y: bounds.y + bounds.height }
10981
- ];
10982
- const farthestCorner = Math.max(
10983
- ...corners.map(
10984
- (corner) => Math.hypot(corner.x - center.x, corner.y - center.y)
10985
- )
10986
- );
10987
- return farthestCorner - maxRadius;
10988
- }
10989
- function formatLabelBounds(bounds) {
10990
- return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
10991
- }
10992
- function projectedLabelWidthAlongTangent(angleRad, bounds) {
10993
- const tangentX = -Math.sin(angleRad);
10994
- const tangentY = Math.cos(angleRad);
10995
- return Math.abs(tangentX) * bounds.width + Math.abs(tangentY) * bounds.height;
10996
- }
10997
10919
  function resolvePointGlyph(name) {
10998
10920
  const key = name.trim().toLocaleLowerCase().replace(/[_-]+/g, " ").replace(/\s+/g, " ");
10999
10921
  const resolved = POINT_GLYPH_ALIASES[key] ?? key;
@@ -11048,7 +10970,7 @@ function buildHouseCusps(params) {
11048
10970
  const ring = rings.houses;
11049
10971
  const spokeInnerRadius = rings.aspects.r2;
11050
10972
  const spokeOuterRadius = ring.r2 + 4 * scale;
11051
- const labelRadius = ring.r2 + 12 * scale;
10973
+ const labelRadius = (ring.r1 + ring.r2) / 2;
11052
10974
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
11053
10975
  return houses.map((house, index) => {
11054
10976
  const angle = angleOf2(house.longitude);
@@ -11069,10 +10991,7 @@ function buildAngleMarkers(params) {
11069
10991
  const { chart, center, angleOf: angleOf2, rings, scale } = params;
11070
10992
  const ring = rings.houses;
11071
10993
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
11072
- const labelRadius = Math.min(
11073
- ring.r2 + 9 * scale,
11074
- ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
11075
- );
10994
+ const labelRadius = rings.zodiac.r1 + (rings.zodiac.r2 - rings.zodiac.r1) * 0.32;
11076
10995
  const markers = [
11077
10996
  { key: "ASC", position: chart.houses.ascendant },
11078
10997
  { key: "MC", position: chart.houses.mc },
@@ -11114,7 +11033,8 @@ function buildPointLayer(params) {
11114
11033
  palette,
11115
11034
  excludedBodies,
11116
11035
  pointConnectorMode,
11117
- maxDisplacementDegrees
11036
+ maxDisplacementDegrees,
11037
+ railVisibility
11118
11038
  } = params;
11119
11039
  const ring = rings.planets;
11120
11040
  const requestedRadius = resolvePointLayerRadius(layer, rings);
@@ -11129,6 +11049,19 @@ function buildPointLayer(params) {
11129
11049
  ) : requestedRadius;
11130
11050
  const isExternalLayer = radius > rings.houses.r2 + scale;
11131
11051
  const tickLength = Math.min(14 * scale, thickness * 0.34);
11052
+ const layerRailVisibility = resolveLayerRailVisibility({
11053
+ layer,
11054
+ fallback: railVisibility,
11055
+ external: isExternalLayer
11056
+ });
11057
+ const rails = buildPositionRails({
11058
+ ring,
11059
+ scale,
11060
+ visibility: layerRailVisibility,
11061
+ layerRadius: radius,
11062
+ external: isExternalLayer,
11063
+ glyphFontSize
11064
+ });
11132
11065
  const collisionPadding = Math.max(2 * scale, 1.5);
11133
11066
  const zodiacKeepOutGap = Math.max(5 * scale, 4);
11134
11067
  const labelMaxRadius = isExternalLayer ? Number.POSITIVE_INFINITY : rings.zodiac.r1 - zodiacKeepOutGap;
@@ -11137,6 +11070,7 @@ function buildPointLayer(params) {
11137
11070
  const tickColor = layer.tickColor ?? color;
11138
11071
  const pointIntents = seeds.map((seed) => {
11139
11072
  const tickAngle = angleOf2(seed.longitude);
11073
+ const trueAnchor = polarToXY2(center.x, center.y, rings.aspects.r2, tickAngle);
11140
11074
  const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
11141
11075
  const rawGlyphRadius = radius;
11142
11076
  const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
@@ -11145,15 +11079,16 @@ function buildPointLayer(params) {
11145
11079
  labelMaxRadius - pointGlyphFontSize * 0.5
11146
11080
  );
11147
11081
  const connectorRadius = glyphRadius;
11082
+ const glyphClearance = pointGlyphFontSize * 0.34;
11148
11083
  const tickLine = isExternalLayer ? lineFromPolar2(
11149
11084
  center,
11150
- rings.houses.r2 + 2 * scale,
11151
- connectorRadius,
11085
+ Math.max(rings.aspects.r1, rings.aspects.r2 - tickLength * 0.5),
11086
+ rings.aspects.r2 + tickLength * 0.5,
11152
11087
  tickAngle
11153
11088
  ) : lineFromPolar2(
11154
11089
  center,
11155
11090
  Math.min(ring.r2, connectorRadius + tickLength),
11156
- connectorRadius,
11091
+ Math.min(ring.r2, connectorRadius + glyphClearance),
11157
11092
  tickAngle
11158
11093
  );
11159
11094
  const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
@@ -11161,21 +11096,26 @@ function buildPointLayer(params) {
11161
11096
  layer,
11162
11097
  seed,
11163
11098
  tickLine,
11099
+ trueAngle: tickAngle,
11100
+ displayAngle: tickAngle,
11101
+ trueAnchor,
11164
11102
  labelAngle: tickAngle,
11165
11103
  glyphPosition: idealPosition,
11166
11104
  glyphFontSize: pointGlyphFontSize,
11105
+ rails,
11106
+ houses: layer.chart?.houses.houses,
11107
+ center,
11167
11108
  color,
11168
11109
  tickColor
11169
11110
  });
11170
- const layout = getPointLabelLayout(point, scale);
11171
- const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
11172
- const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
11111
+ const labelTangentDemandPx = pointGlyphFontSize * 0.72;
11173
11112
  const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
11174
11113
  const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
11175
11114
  return {
11176
11115
  seed,
11177
11116
  tickAngle,
11178
11117
  tickLine,
11118
+ trueAnchor,
11179
11119
  connectorRadius,
11180
11120
  glyphRadius,
11181
11121
  pointGlyphFontSize,
@@ -11204,50 +11144,56 @@ function buildPointLayer(params) {
11204
11144
  layer,
11205
11145
  seed: intent.seed,
11206
11146
  tickLine: intent.tickLine,
11147
+ trueAngle: intent.tickAngle,
11148
+ displayAngle: visualAngle,
11149
+ trueAnchor: intent.trueAnchor,
11207
11150
  labelAngle: visualAngle,
11208
11151
  glyphPosition,
11209
11152
  glyphFontSize: intent.pointGlyphFontSize,
11153
+ rails,
11154
+ houses: layer.chart?.houses.houses,
11155
+ center,
11210
11156
  color,
11211
11157
  tickColor
11212
11158
  });
11213
- const layout = getPointLabelLayout(point, scale);
11214
- const constrainedLabel = constrainLabelInsideCircle({
11159
+ const leaderArc = buildPointConnector({
11215
11160
  center,
11216
- position: glyphPosition,
11217
- layout,
11218
- padding: collisionPadding,
11219
- maxRadius: labelMaxRadius
11161
+ tickAngle: intent.tickAngle,
11162
+ labelAngle: visualAngle,
11163
+ connectorRadius: intent.connectorRadius,
11164
+ glyphPosition,
11165
+ mode: pointConnectorMode
11166
+ });
11167
+ const connector = buildPointLineConnector({
11168
+ trueAnchor: point.trueAnchor,
11169
+ glyphPosition,
11170
+ mode: pointConnectorMode,
11171
+ tickAngle: intent.tickAngle,
11172
+ displayAngle: visualAngle
11220
11173
  });
11221
- if (constrainedLabel.moved) {
11222
- glyphPosition = constrainedLabel.position;
11223
- point = {
11224
- ...point,
11225
- glyphPosition,
11226
- leaderLine: void 0
11227
- };
11228
- }
11229
- point = {
11230
- ...point,
11231
- leaderArc: buildPointConnector({
11232
- center,
11233
- tickAngle: intent.tickAngle,
11234
- labelAngle: visualAngle,
11235
- connectorRadius: intent.connectorRadius,
11236
- glyphPosition,
11237
- mode: pointConnectorMode
11238
- })
11239
- };
11240
11174
  return {
11241
11175
  ...point,
11242
- labelBounds: constrainedLabel.bounds
11176
+ leaderArc,
11177
+ connector
11243
11178
  };
11244
11179
  });
11180
+ const notches = buildBoundaryNotches({
11181
+ layerId: layer.id,
11182
+ points,
11183
+ houses: layer.chart?.houses.houses ?? [],
11184
+ center,
11185
+ radius,
11186
+ ring,
11187
+ scale
11188
+ });
11245
11189
  return {
11246
11190
  id: layer.id,
11247
11191
  label: layer.label,
11248
11192
  color,
11249
11193
  tickColor,
11250
11194
  radius,
11195
+ rails,
11196
+ notches,
11251
11197
  points
11252
11198
  };
11253
11199
  }
@@ -11256,12 +11202,28 @@ function makeAstroWheelPoint(params) {
11256
11202
  layer,
11257
11203
  seed,
11258
11204
  tickLine,
11205
+ trueAngle,
11206
+ displayAngle,
11207
+ trueAnchor,
11259
11208
  labelAngle,
11260
11209
  glyphPosition,
11261
11210
  glyphFontSize,
11211
+ rails,
11212
+ houses,
11213
+ center,
11262
11214
  color,
11263
11215
  tickColor
11264
11216
  } = params;
11217
+ const houseContext = houses ? getHouseContext(seed.longitude, houses) : {};
11218
+ const railLabels = buildPointRailLabels({
11219
+ seed,
11220
+ rails,
11221
+ center,
11222
+ displayAngle,
11223
+ color,
11224
+ glyphFontSize
11225
+ });
11226
+ const glyphScale = glyphFontSize * 0.66;
11265
11227
  return {
11266
11228
  layerId: layer.id,
11267
11229
  key: seed.key,
@@ -11270,7 +11232,13 @@ function makeAstroWheelPoint(params) {
11270
11232
  glyph: seed.glyph,
11271
11233
  glyphKey: seed.glyphKey,
11272
11234
  longitude: normalizeAngle2(seed.longitude),
11273
- displayLongitude: normalizeAngle2(seed.longitude),
11235
+ displayLongitude: normalizeAngle2(seed.longitude + rad2deg2(signedAngleDelta(displayAngle, trueAngle))),
11236
+ trueAnchor,
11237
+ trueAngle,
11238
+ displayAngle,
11239
+ house: houseContext.house,
11240
+ nearestCuspHouse: houseContext.nearestCuspHouse,
11241
+ nearestCuspDistanceDegrees: houseContext.nearestCuspDistanceDegrees,
11274
11242
  zodiacPosition: seed.zodiacPosition,
11275
11243
  tickLine,
11276
11244
  labelAngle,
@@ -11278,14 +11246,209 @@ function makeAstroWheelPoint(params) {
11278
11246
  leaderLine: void 0,
11279
11247
  glyphPosition,
11280
11248
  glyphFontSize,
11249
+ glyphScale,
11250
+ railLabels,
11251
+ hitTarget: {
11252
+ kind: "circle",
11253
+ cx: glyphPosition.x,
11254
+ cy: glyphPosition.y,
11255
+ r: round2(glyphScale * 0.72)
11256
+ },
11281
11257
  retrograde: seed.retrograde,
11282
11258
  color,
11283
11259
  tickColor
11284
11260
  };
11285
11261
  }
11262
+ function resolveRailVisibility(input) {
11263
+ if (input === "glyph-only") {
11264
+ return { degree: false, sign: false, minutes: false, retrograde: false };
11265
+ }
11266
+ if (input === "compact") {
11267
+ return { degree: true, sign: true, minutes: false, retrograde: true };
11268
+ }
11269
+ if (!input || input === "full") {
11270
+ return { degree: true, sign: true, minutes: true, retrograde: true };
11271
+ }
11272
+ return {
11273
+ degree: input.degree ?? true,
11274
+ sign: input.sign ?? true,
11275
+ minutes: input.minutes ?? true,
11276
+ retrograde: input.retrograde ?? true
11277
+ };
11278
+ }
11279
+ function resolveLayerRailVisibility(params) {
11280
+ if (params.layer.rails) {
11281
+ return resolveRailVisibility(params.layer.rails);
11282
+ }
11283
+ if (params.external) {
11284
+ return {
11285
+ degree: params.fallback.degree,
11286
+ sign: false,
11287
+ minutes: false,
11288
+ retrograde: false
11289
+ };
11290
+ }
11291
+ return params.fallback;
11292
+ }
11293
+ function buildPositionRails(params) {
11294
+ const { ring, scale, visibility, layerRadius, external, glyphFontSize } = params;
11295
+ if (external) {
11296
+ const gap = Math.max(2.4 * scale, 2);
11297
+ const step = Math.max(glyphFontSize * 0.22, 4.2 * scale);
11298
+ const firstRailRadius = layerRadius + glyphFontSize * 0.42 + gap;
11299
+ return [
11300
+ { id: "degree", label: "Degree", radius: round2(firstRailRadius), visible: visibility.degree },
11301
+ { id: "minutes", label: "Minutes", radius: round2(firstRailRadius + step * 2), visible: visibility.minutes },
11302
+ { id: "sign", label: "Sign", radius: round2(firstRailRadius + step), visible: visibility.sign },
11303
+ { id: "retrograde", label: "Retrograde", radius: round2(firstRailRadius + step * 3), visible: visibility.retrograde }
11304
+ ];
11305
+ }
11306
+ const thickness = ring.r2 - ring.r1;
11307
+ const inset = Math.max(2 * scale, 1.5);
11308
+ return [
11309
+ { id: "degree", label: "Degree", radius: round2(ring.r1 + thickness * 0.52 + inset), visible: visibility.degree },
11310
+ { id: "minutes", label: "Minutes", radius: round2(ring.r1 + thickness * 0.24 + inset), visible: visibility.minutes },
11311
+ { id: "sign", label: "Sign", radius: round2(ring.r1 + thickness * 0.38 + inset), visible: visibility.sign },
11312
+ { id: "retrograde", label: "Retrograde", radius: round2(ring.r1 + thickness * 0.1 + inset), visible: visibility.retrograde }
11313
+ ];
11314
+ }
11315
+ function buildPointRailLabels(params) {
11316
+ const position = params.seed.zodiacPosition ? formatInlinePosition(params.seed.zodiacPosition) : null;
11317
+ const fontSize = clamp(params.glyphFontSize * 0.25, 5, 8);
11318
+ return params.rails.flatMap((rail) => {
11319
+ let text = "";
11320
+ let sign;
11321
+ let glyphScale;
11322
+ if (rail.id === "degree")
11323
+ text = position?.degreesText ?? "";
11324
+ if (rail.id === "sign") {
11325
+ sign = position?.sign;
11326
+ text = sign ? ASTRO_WHEEL_ZODIAC_SIGNS.find((entry) => entry.sign === sign)?.glyph ?? sign : "";
11327
+ glyphScale = fontSize * 0.78;
11328
+ }
11329
+ if (rail.id === "minutes")
11330
+ text = position?.minutesText ?? "";
11331
+ if (rail.id === "retrograde")
11332
+ text = params.seed.retrograde ? "R" : "";
11333
+ if (!text)
11334
+ return [];
11335
+ return [{
11336
+ railId: rail.id,
11337
+ text,
11338
+ sign,
11339
+ position: polarToXY2(params.center.x, params.center.y, rail.radius, params.displayAngle),
11340
+ angle: params.displayAngle,
11341
+ fontSize,
11342
+ glyphScale,
11343
+ visible: rail.visible
11344
+ }];
11345
+ });
11346
+ }
11347
+ function getHouseContext(longitude, houses) {
11348
+ if (houses.length === 0) {
11349
+ return {};
11350
+ }
11351
+ const lon = normalizeAngle2(longitude);
11352
+ let house = houses.length;
11353
+ let nearestCuspHouse = 1;
11354
+ let nearestCuspDistanceDegrees = Number.POSITIVE_INFINITY;
11355
+ for (let index = 0; index < houses.length; index++) {
11356
+ const cusp = normalizeAngle2(houses[index].longitude);
11357
+ const next = normalizeAngle2(houses[(index + 1) % houses.length].longitude);
11358
+ const span = clamp360(next - cusp);
11359
+ const offset = clamp360(lon - cusp);
11360
+ const distance = Math.abs(shortestLongitudeDistance(lon, cusp));
11361
+ if (offset < span || Math.abs(offset - span) < 1e-4) {
11362
+ house = index + 1;
11363
+ }
11364
+ if (distance < nearestCuspDistanceDegrees) {
11365
+ nearestCuspDistanceDegrees = distance;
11366
+ nearestCuspHouse = index + 1;
11367
+ }
11368
+ }
11369
+ return {
11370
+ house,
11371
+ nearestCuspHouse,
11372
+ nearestCuspDistanceDegrees: round2(nearestCuspDistanceDegrees)
11373
+ };
11374
+ }
11375
+ function buildPointLineConnector(params) {
11376
+ if (params.mode === "never")
11377
+ return void 0;
11378
+ if (params.mode === "auto" && circularAngleDistance(params.tickAngle, params.displayAngle) < deg2rad2(0.35)) {
11379
+ return void 0;
11380
+ }
11381
+ return {
11382
+ x1: params.trueAnchor.x,
11383
+ y1: params.trueAnchor.y,
11384
+ x2: params.glyphPosition.x,
11385
+ y2: params.glyphPosition.y
11386
+ };
11387
+ }
11388
+ function buildBoundaryNotches(params) {
11389
+ if (params.houses.length === 0)
11390
+ return [];
11391
+ const { center, ring, radius, scale } = params;
11392
+ return params.points.flatMap((point) => {
11393
+ if (!point.nearestCuspHouse || point.nearestCuspDistanceDegrees === void 0)
11394
+ return [];
11395
+ const displaced = circularAngleDistance(point.trueAngle, point.displayAngle) > deg2rad2(0.35);
11396
+ if (!displaced)
11397
+ return [];
11398
+ const cusp = params.houses[point.nearestCuspHouse - 1];
11399
+ const cuspAngle = point.trueAngle + deg2rad2(shortestLongitudeDistance(point.longitude, cusp.longitude));
11400
+ const trueDelta = signedAngleDelta(cuspAngle, point.trueAngle);
11401
+ const displayDelta = signedAngleDelta(cuspAngle, point.displayAngle);
11402
+ const crossed = Math.sign(trueDelta) !== Math.sign(displayDelta) && displayDelta !== 0;
11403
+ const crowds = point.nearestCuspDistanceDegrees <= 2;
11404
+ if (!crossed && !crowds)
11405
+ return [];
11406
+ const glyphHalfAngle = Math.max(point.glyphScale * 0.62, 4 * scale) / Math.max(radius, 1);
11407
+ const directed = displayDelta === 0 ? trueDelta : displayDelta;
11408
+ const direction = directed >= 0 ? 1 : -1;
11409
+ const endAngle = cuspAngle + directed + direction * glyphHalfAngle;
11410
+ const halfThickness = Math.max(point.glyphScale * 0.9, 7 * scale);
11411
+ const innerRadius = clamp(radius - halfThickness, ring.r1, ring.r2);
11412
+ const outerRadius = clamp(radius + halfThickness, ring.r1, ring.r2);
11413
+ return [{
11414
+ id: `${params.layerId}-${point.key}-notch`,
11415
+ layerId: params.layerId,
11416
+ pointKey: point.key,
11417
+ house: point.house ?? 0,
11418
+ cuspHouse: point.nearestCuspHouse,
11419
+ cuspLongitude: normalizeAngle2(cusp.longitude),
11420
+ radius: outerRadius,
11421
+ innerRadius,
11422
+ outerRadius,
11423
+ startAngle: cuspAngle,
11424
+ endAngle,
11425
+ path: boundaryNotchPath(center, innerRadius, outerRadius, cuspAngle, endAngle)
11426
+ }];
11427
+ });
11428
+ }
11429
+ function boundaryNotchPath(center, innerRadius, outerRadius, cuspAngle, endAngle) {
11430
+ const outerCusp = polarToXY2(center.x, center.y, outerRadius, cuspAngle);
11431
+ const outerEnd = polarToXY2(center.x, center.y, outerRadius, endAngle);
11432
+ const innerEnd = polarToXY2(center.x, center.y, innerRadius, endAngle);
11433
+ const innerCusp = polarToXY2(center.x, center.y, innerRadius, cuspAngle);
11434
+ const delta = signedAngleDelta(cuspAngle, endAngle);
11435
+ const sweepOuter = delta >= 0 ? 1 : 0;
11436
+ const sweepInner = delta >= 0 ? 0 : 1;
11437
+ return [
11438
+ `M ${fmt2(outerCusp.x)} ${fmt2(outerCusp.y)}`,
11439
+ `A ${fmt2(outerRadius)} ${fmt2(outerRadius)} 0 0 ${sweepOuter} ${fmt2(outerEnd.x)} ${fmt2(outerEnd.y)}`,
11440
+ `L ${fmt2(innerEnd.x)} ${fmt2(innerEnd.y)}`,
11441
+ `A ${fmt2(innerRadius)} ${fmt2(innerRadius)} 0 0 ${sweepInner} ${fmt2(innerCusp.x)} ${fmt2(innerCusp.y)}`,
11442
+ "Z"
11443
+ ].join(" ");
11444
+ }
11286
11445
  function buildAspectLayer(params) {
11287
11446
  const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
11288
- const sourceEdges = getSourceAspectEdges(chart, {
11447
+ const sourceEdges = layer.edges ? layer.edges : layer.chartB ? computeCrossAspectEdges(
11448
+ chart.planets,
11449
+ layer.chartB.planets,
11450
+ layer.aspectSpecs ?? ASTRO_WHEEL_DEFAULT_ASPECT_SPECS
11451
+ ) : getSourceAspectEdges(chart, {
11289
11452
  enabled: true,
11290
11453
  edges: layer.edges,
11291
11454
  aspectSpecs: layer.aspectSpecs
@@ -11308,8 +11471,8 @@ function buildAspectLayer(params) {
11308
11471
  const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
11309
11472
  const maxOrb = spec?.orb ?? 8;
11310
11473
  const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
11311
- const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
11312
- const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
11474
+ const a = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude)) : planetA.trueAnchor;
11475
+ const b = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude)) : planetB.trueAnchor;
11313
11476
  return [{
11314
11477
  layerId: layer.id,
11315
11478
  planetA: planetA.name,
@@ -11519,6 +11682,9 @@ function circularAngleDistance(a, b) {
11519
11682
  const delta = Math.abs(clampRad(a) - clampRad(b));
11520
11683
  return Math.min(delta, TAU2 - delta);
11521
11684
  }
11685
+ function rad2deg2(radians) {
11686
+ return radians * (360 / TAU2);
11687
+ }
11522
11688
  function buildPointConnector(params) {
11523
11689
  const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
11524
11690
  const displacement = circularAngleDistance(tickAngle, labelAngle);
@@ -11573,6 +11739,32 @@ function computeAspectEdges(planets, specs) {
11573
11739
  }
11574
11740
  return edges;
11575
11741
  }
11742
+ function computeCrossAspectEdges(planetsA, planetsB, specs) {
11743
+ const keysA = Object.keys(planetsA);
11744
+ const keysB = Object.keys(planetsB);
11745
+ const edges = [];
11746
+ for (const keyA of keysA) {
11747
+ for (const keyB of keysB) {
11748
+ const planetA = planetsA[keyA];
11749
+ const planetB = planetsB[keyB];
11750
+ const match = getAspectMatch2(planetA.longitude, planetB.longitude, specs);
11751
+ if (!match) {
11752
+ continue;
11753
+ }
11754
+ edges.push({
11755
+ planetA: keyA,
11756
+ planetB: keyB,
11757
+ longitudeA: normalizeAngle2(planetA.longitude),
11758
+ longitudeB: normalizeAngle2(planetB.longitude),
11759
+ aspect: match.spec.name,
11760
+ aspectAngle: match.spec.angle,
11761
+ delta: match.delta,
11762
+ orb: match.orb
11763
+ });
11764
+ }
11765
+ }
11766
+ return edges;
11767
+ }
11576
11768
  function getAspectMatch2(lonA, lonB, specs) {
11577
11769
  const delta = Math.min(
11578
11770
  normalizeAngle2(lonB - lonA),
@@ -11586,6 +11778,9 @@ function getAspectMatch2(lonA, lonB, specs) {
11586
11778
  }
11587
11779
  return null;
11588
11780
  }
11781
+ function shortestLongitudeDistance(a, b) {
11782
+ return (normalizeAngle2(a) - normalizeAngle2(b) + 540) % 360 - 180;
11783
+ }
11589
11784
  function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
11590
11785
  return specs.find((spec) => spec.name === aspect);
11591
11786
  }
@@ -26865,7 +27060,7 @@ var import_config3 = require("dotenv/config");
26865
27060
  // package.json
26866
27061
  var package_default = {
26867
27062
  name: "kaabalah",
26868
- version: "6.9.0",
27063
+ version: "6.10.0",
26869
27064
  description: "The de-facto library for any esoteric calculations and tooling",
26870
27065
  engines: {
26871
27066
  node: ">=18.18.0"