kaabalah 6.9.0 → 6.11.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;
@@ -10341,7 +10432,7 @@ function generateAstroGlyphSvg(keyOrGlyph, options = {}) {
10341
10432
  const svg = generateGlyphSvg(glyph.primitives, options);
10342
10433
  return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
10343
10434
  }
10344
- function getAstroWheelRenderModel(chart, options = {}) {
10435
+ function buildAstroWheelSvgModel(chart, options = {}) {
10345
10436
  const viewBox = normalizeViewBox2(options.viewBox);
10346
10437
  const palette = resolvePalette2(options.palette, options.background ?? "transparent");
10347
10438
  const excludedBodies = resolveExcludedBodies(options.excludeBodies);
@@ -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);
@@ -10377,7 +10469,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
10377
10469
  rings,
10378
10470
  scale
10379
10471
  }) : [];
10380
- const basePointLayer = buildPointLayer({
10472
+ const basePointGroup = buildPointGroup({
10381
10473
  layer: {
10382
10474
  id: "birth",
10383
10475
  label: "Birth",
@@ -10396,28 +10488,15 @@ function getAstroWheelRenderModel(chart, options = {}) {
10396
10488
  palette,
10397
10489
  excludedBodies,
10398
10490
  pointConnectorMode,
10399
- maxDisplacementDegrees: maxPointDisplacementDegrees
10491
+ maxDisplacementDegrees: maxPointDisplacementDegrees,
10492
+ railVisibility
10400
10493
  });
10401
- const extraPointLayers = (options.pointLayers ?? []).map(
10402
- (layer) => buildPointLayer({
10403
- layer,
10404
- center,
10405
- angleOf: angleOf2,
10406
- rings,
10407
- scale,
10408
- palette,
10409
- excludedBodies,
10410
- pointConnectorMode,
10411
- maxDisplacementDegrees: maxPointDisplacementDegrees
10412
- })
10413
- );
10414
- const pointLayers = [
10415
- ...resolvedPoints.enabled ? [basePointLayer] : [],
10416
- ...extraPointLayers
10494
+ const pointGroups = [
10495
+ ...resolvedPoints.enabled ? [basePointGroup] : []
10417
10496
  ];
10418
- const points = pointLayers.flatMap((layer) => [...layer.points]);
10497
+ const points = pointGroups.flatMap((layer) => [...layer.points]);
10419
10498
  const pointByKey = Object.fromEntries(points.map((point) => [point.key, point]));
10420
- const baseAspectLayer = resolvedAspects.enabled ? buildAspectLayer({
10499
+ const baseAspectGroup = resolvedAspects.enabled ? buildAspectGroup({
10421
10500
  layer: {
10422
10501
  id: "birth",
10423
10502
  label: "Birth aspects",
@@ -10433,23 +10512,11 @@ function getAstroWheelRenderModel(chart, options = {}) {
10433
10512
  palette,
10434
10513
  excludedBodies
10435
10514
  }) : null;
10436
- const extraAspectLayers = (options.aspectLayers ?? []).map(
10437
- (layer) => buildAspectLayer({
10438
- layer,
10439
- chart: layer.chart ?? chart,
10440
- pointByKey,
10441
- center,
10442
- angleOf: angleOf2,
10443
- rings,
10444
- palette,
10445
- excludedBodies
10446
- })
10447
- );
10448
- const aspectLayers = [
10449
- ...baseAspectLayer ? [baseAspectLayer] : [],
10450
- ...extraAspectLayers
10515
+ const aspectGroups = [
10516
+ ...baseAspectGroup ? [baseAspectGroup] : []
10451
10517
  ];
10452
- const aspectLines = aspectLayers.flatMap((layer) => [...layer.aspectLines]);
10518
+ const aspectLines = aspectGroups.flatMap((layer) => [...layer.aspectLines]);
10519
+ const positionRails = basePointGroup.rails;
10453
10520
  return {
10454
10521
  viewBox,
10455
10522
  center,
@@ -10463,13 +10530,14 @@ function getAstroWheelRenderModel(chart, options = {}) {
10463
10530
  points,
10464
10531
  pointByKey,
10465
10532
  aspectLines,
10466
- pointLayers,
10467
- aspectLayers,
10533
+ pointGroups,
10534
+ aspectGroups,
10535
+ positionRails,
10468
10536
  palette
10469
10537
  };
10470
10538
  }
10471
10539
  function generateAstroWheelSvg(chart, options = {}) {
10472
- const model = getAstroWheelRenderModel(chart, options);
10540
+ const model = buildAstroWheelSvgModel(chart, options);
10473
10541
  const viewBox = model.viewBox;
10474
10542
  const zodiacOptions = resolveZodiacOptions(options.zodiac);
10475
10543
  const houseOptions = resolveHouseOptions(options.houses);
@@ -10493,6 +10561,7 @@ function generateAstroWheelSvg(chart, options = {}) {
10493
10561
  `<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
10494
10562
  );
10495
10563
  }
10564
+ renderAspectBoundary(push, model);
10496
10565
  renderAspects(push, model);
10497
10566
  renderZodiac(push, model, zodiacOptions);
10498
10567
  renderHouses(push, model, houseOptions);
@@ -10523,23 +10592,15 @@ function renderSvgDefs(push, model) {
10523
10592
  push(`</defs>`);
10524
10593
  }
10525
10594
  function renderAspects(push, model) {
10526
- if (model.aspectLayers.length === 0) {
10595
+ if (model.aspectGroups.length === 0) {
10527
10596
  return;
10528
10597
  }
10529
- const guideRadius = model.rings.aspects.r2 * 0.96;
10530
- const innerGuideRadius = guideRadius * 0.52;
10531
10598
  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
- for (const layer of model.aspectLayers) {
10539
- push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
10599
+ for (const layer of model.aspectGroups) {
10600
+ push(`<g class="astro-wheel-aspect-group" data-aspect-group="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
10540
10601
  for (const aspect of layer.aspectLines) {
10541
10602
  push(
10542
- `<line data-aspect-layer="${escapeAttr2(aspect.layerId)}" data-aspect="${escapeAttr2(aspect.aspect)}" data-planet-a="${escapeAttr2(aspect.planetA)}" data-planet-b="${escapeAttr2(aspect.planetB)}" x1="${fmt2(aspect.line.x1)}" y1="${fmt2(aspect.line.y1)}" x2="${fmt2(aspect.line.x2)}" y2="${fmt2(aspect.line.y2)}" stroke="${escapeAttr2(aspect.color)}" stroke-opacity="${fmt2(aspect.opacity)}" stroke-width="${fmt2(aspect.strokeWidth * model.scale)}" stroke-linecap="round"/>`
10603
+ `<line data-aspect-group="${escapeAttr2(aspect.groupId)}" data-aspect="${escapeAttr2(aspect.aspect)}" data-planet-a="${escapeAttr2(aspect.planetA)}" data-planet-b="${escapeAttr2(aspect.planetB)}" x1="${fmt2(aspect.line.x1)}" y1="${fmt2(aspect.line.y1)}" x2="${fmt2(aspect.line.x2)}" y2="${fmt2(aspect.line.y2)}" stroke="${escapeAttr2(aspect.color)}" stroke-opacity="${fmt2(aspect.opacity)}" stroke-width="${fmt2(aspect.strokeWidth * model.scale)}" stroke-linecap="round"/>`
10543
10604
  );
10544
10605
  }
10545
10606
  push(`</g>`);
@@ -10549,6 +10610,11 @@ function renderAspects(push, model) {
10549
10610
  );
10550
10611
  push(`</g>`);
10551
10612
  }
10613
+ function renderAspectBoundary(push, model) {
10614
+ push(
10615
+ `<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)}"/>`
10616
+ );
10617
+ }
10552
10618
  function renderZodiac(push, model, options) {
10553
10619
  if (!options.segments && !options.glyphs && !options.ticks) {
10554
10620
  return;
@@ -10621,30 +10687,21 @@ function renderHouses(push, model, options) {
10621
10687
  );
10622
10688
  }
10623
10689
  }
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
10690
  push(`</g>`);
10634
10691
  }
10635
10692
  function renderPlanets(push, model) {
10636
- if (model.pointLayers.length === 0) {
10693
+ if (model.pointGroups.length === 0) {
10637
10694
  return;
10638
10695
  }
10639
10696
  push(`<g id="astro-wheel-planets" aria-label="planets">`);
10640
- for (const layer of model.pointLayers) {
10641
- renderPointLayerGuide(push, layer, model);
10697
+ for (const layer of model.pointGroups) {
10698
+ renderPointGroupGuide(push, layer, model);
10642
10699
  }
10643
- for (const layer of model.pointLayers) {
10644
- push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
10700
+ for (const layer of model.pointGroups) {
10701
+ push(`<g class="astro-wheel-point-group" data-point-group="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
10645
10702
  for (const point of layer.points) {
10646
10703
  push(
10647
- `<g class="astro-wheel-point" 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)}">`
10704
+ `<g class="astro-wheel-point" data-point-group="${escapeAttr2(point.groupId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}">`
10648
10705
  );
10649
10706
  push(`<title>${escapeText2(point.name)} ${fmt2(point.longitude)}\xB0</title>`);
10650
10707
  push(
@@ -10665,17 +10722,17 @@ function renderPlanets(push, model) {
10665
10722
  }
10666
10723
  push(`</g>`);
10667
10724
  }
10668
- function renderPointLayerGuide(push, layer, model) {
10725
+ function renderPointGroupGuide(push, layer, model) {
10669
10726
  const isExternal = layer.radius > model.rings.houses.r2 + model.scale;
10670
10727
  if (!isExternal) {
10671
10728
  return;
10672
10729
  }
10673
10730
  push(
10674
- `<circle class="astro-wheel-external-point-ring" data-point-layer="${escapeAttr2(layer.id)}" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(layer.radius)}" fill="none" stroke="${escapeAttr2(layer.tickColor)}" stroke-opacity="0.32" stroke-width="${fmt2(1.15 * model.scale)}"/>`
10731
+ `<circle class="astro-wheel-external-point-ring" data-point-group="${escapeAttr2(layer.id)}" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(layer.radius)}" fill="none" stroke="${escapeAttr2(layer.tickColor)}" stroke-opacity="0.32" stroke-width="${fmt2(1.15 * model.scale)}"/>`
10675
10732
  );
10676
10733
  }
10677
10734
  function renderGlyphOverlay(push, model) {
10678
- if (model.angleMarkers.length === 0 && model.pointLayers.length === 0) {
10735
+ if (model.angleMarkers.length === 0 && model.pointGroups.length === 0) {
10679
10736
  return;
10680
10737
  }
10681
10738
  push(`<g id="astro-wheel-glyph-layer" aria-label="chart glyphs">`);
@@ -10686,10 +10743,10 @@ function renderGlyphOverlay(push, model) {
10686
10743
  }
10687
10744
  push(`</g>`);
10688
10745
  }
10689
- if (model.pointLayers.length > 0) {
10746
+ if (model.pointGroups.length > 0) {
10690
10747
  push(`<g id="astro-wheel-point-glyphs" aria-label="planet glyphs">`);
10691
- for (const layer of model.pointLayers) {
10692
- push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
10748
+ for (const layer of model.pointGroups) {
10749
+ push(`<g class="astro-wheel-point-glyph-layer" data-point-group="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
10693
10750
  for (const point of layer.points) {
10694
10751
  renderPointLabelGroup(push, point, model);
10695
10752
  }
@@ -10702,37 +10759,21 @@ function renderGlyphOverlay(push, model) {
10702
10759
  function renderAngleGlyph(push, marker, model) {
10703
10760
  const label = angleDisplayLabel(marker.key);
10704
10761
  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);
10762
+ const positionFontSize = clamp(marker.labelFontSize * 0.62, 6 * model.scale, 10 * model.scale);
10763
+ const gap = clamp(3 * model.scale, 2, 5);
10710
10764
  const degreeWidth = estimateTextWidth(position.degreesText, positionFontSize);
10711
10765
  const minutesWidth = estimateTextWidth(position.minutesText, positionFontSize);
10712
- const totalWidth = labelWidth + gap + degreeWidth + gap + signScale + gap + minutesWidth;
10766
+ const totalWidth = degreeWidth + gap + minutesWidth;
10713
10767
  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;
10768
+ const degreeX = startX;
10769
+ const minutesX = degreeX + degreeWidth + gap;
10718
10770
  push(
10719
10771
  `<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
10772
  );
10721
10773
  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
10774
  push(
10726
10775
  `<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
10776
  );
10728
- renderInlineSignGlyph(
10729
- push,
10730
- position.sign,
10731
- signX,
10732
- 0,
10733
- signScale,
10734
- model.palette.angleLabel
10735
- );
10736
10777
  push(
10737
10778
  `<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
10779
  );
@@ -10746,24 +10787,29 @@ function angleDisplayLabel(key) {
10746
10787
  return key;
10747
10788
  }
10748
10789
  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
10790
  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})">`
10791
+ `<g class="astro-wheel-point-label" data-point-group="${escapeAttr2(point.groupId)}" 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
10792
  );
10754
10793
  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
10794
+ renderPointGlyph(push, point, 0, 0, point.glyphScale, model.palette.glyphHalo);
10795
+ push(`</g>`);
10796
+ for (const label of point.railLabels) {
10797
+ if (!label.visible)
10798
+ continue;
10799
+ push(
10800
+ `<g class="astro-wheel-position-rail-label" data-point-group="${escapeAttr2(point.groupId)}" 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
10801
  );
10802
+ if (label.railId === "sign" && label.sign) {
10803
+ renderInlineSignGlyph(push, label.sign, 0, 0, label.glyphScale ?? label.fontSize, point.color);
10804
+ } else if (label.railId === "retrograde") {
10805
+ renderRetrogradeMarker(push, 0, 0, label.fontSize, point.color);
10806
+ } else {
10807
+ push(
10808
+ `<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>`
10809
+ );
10810
+ }
10811
+ push(`</g>`);
10764
10812
  }
10765
- renderPointInlineDegreeLabel(push, point, layout);
10766
- push(`</g>`);
10767
10813
  }
10768
10814
  function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
10769
10815
  const glyph = point.glyphKey ? getAstroGlyph(point.glyphKey) : resolvePointGlyph(point.name);
@@ -10796,18 +10842,6 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
10796
10842
  `<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
10843
  );
10798
10844
  }
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
10845
  function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
10812
10846
  const glyph = ZODIAC_GLYPHS[sign];
10813
10847
  if (glyph) {
@@ -10823,89 +10857,6 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
10823
10857
  `<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
10858
  );
10825
10859
  }
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
10860
  function formatInlinePosition(position) {
10910
10861
  let degrees = Math.floor(position.decimalDegrees);
10911
10862
  let minutes = Math.round((position.decimalDegrees - degrees) * 60);
@@ -10930,83 +10881,13 @@ function pointLabelTitle(point) {
10930
10881
  function estimateTextWidth(value, fontSize) {
10931
10882
  return value.length * fontSize * 0.56;
10932
10883
  }
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
10884
  function resolvePointGlyph(name) {
10998
10885
  const key = name.trim().toLocaleLowerCase().replace(/[_-]+/g, " ").replace(/\s+/g, " ");
10999
10886
  const resolved = POINT_GLYPH_ALIASES[key] ?? key;
11000
10887
  return PLANET_GLYPHS[resolved] ?? ANGLE_GLYPHS[resolved] ?? null;
11001
10888
  }
11002
10889
  function getExternalPointPadding(options, scale) {
11003
- const externalLayers = options.pointLayers?.filter((layer) => layer.radius === "external") ?? [];
11004
- if (externalLayers.length === 0) {
11005
- return 0;
11006
- }
11007
- return Math.max(
11008
- ...externalLayers.map((layer) => (layer.radiusOffset ?? 18) + 36 * scale)
11009
- );
10890
+ return 0;
11010
10891
  }
11011
10892
  function buildZodiacSegments(params) {
11012
10893
  const { center, angleOf: angleOf2, rings, scale, palette } = params;
@@ -11048,7 +10929,7 @@ function buildHouseCusps(params) {
11048
10929
  const ring = rings.houses;
11049
10930
  const spokeInnerRadius = rings.aspects.r2;
11050
10931
  const spokeOuterRadius = ring.r2 + 4 * scale;
11051
- const labelRadius = ring.r2 + 12 * scale;
10932
+ const labelRadius = (ring.r1 + ring.r2) / 2;
11052
10933
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
11053
10934
  return houses.map((house, index) => {
11054
10935
  const angle = angleOf2(house.longitude);
@@ -11069,10 +10950,7 @@ function buildAngleMarkers(params) {
11069
10950
  const { chart, center, angleOf: angleOf2, rings, scale } = params;
11070
10951
  const ring = rings.houses;
11071
10952
  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
- );
10953
+ const labelRadius = rings.zodiac.r1 + (rings.zodiac.r2 - rings.zodiac.r1) * 0.32;
11076
10954
  const markers = [
11077
10955
  { key: "ASC", position: chart.houses.ascendant },
11078
10956
  { key: "MC", position: chart.houses.mc },
@@ -11104,7 +10982,7 @@ function buildAngleMarkers(params) {
11104
10982
  };
11105
10983
  });
11106
10984
  }
11107
- function buildPointLayer(params) {
10985
+ function buildPointGroup(params) {
11108
10986
  const {
11109
10987
  layer,
11110
10988
  center,
@@ -11114,10 +10992,11 @@ function buildPointLayer(params) {
11114
10992
  palette,
11115
10993
  excludedBodies,
11116
10994
  pointConnectorMode,
11117
- maxDisplacementDegrees
10995
+ maxDisplacementDegrees,
10996
+ railVisibility
11118
10997
  } = params;
11119
10998
  const ring = rings.planets;
11120
- const requestedRadius = resolvePointLayerRadius(layer, rings);
10999
+ const requestedRadius = resolvePointGroupRadius(layer, rings);
11121
11000
  const requestedExternalLayer = requestedRadius > rings.houses.r2 + scale;
11122
11001
  const thickness = ring.r2 - ring.r1;
11123
11002
  const glyphFontSize = clamp(thickness * 0.68, 14 * scale, 30 * scale) * (layer.glyphScale ?? 1);
@@ -11129,6 +11008,19 @@ function buildPointLayer(params) {
11129
11008
  ) : requestedRadius;
11130
11009
  const isExternalLayer = radius > rings.houses.r2 + scale;
11131
11010
  const tickLength = Math.min(14 * scale, thickness * 0.34);
11011
+ const layerRailVisibility = resolveLayerRailVisibility({
11012
+ layer,
11013
+ fallback: railVisibility,
11014
+ external: isExternalLayer
11015
+ });
11016
+ const rails = buildPositionRails({
11017
+ ring,
11018
+ scale,
11019
+ visibility: layerRailVisibility,
11020
+ layerRadius: radius,
11021
+ external: isExternalLayer,
11022
+ glyphFontSize
11023
+ });
11132
11024
  const collisionPadding = Math.max(2 * scale, 1.5);
11133
11025
  const zodiacKeepOutGap = Math.max(5 * scale, 4);
11134
11026
  const labelMaxRadius = isExternalLayer ? Number.POSITIVE_INFINITY : rings.zodiac.r1 - zodiacKeepOutGap;
@@ -11137,6 +11029,7 @@ function buildPointLayer(params) {
11137
11029
  const tickColor = layer.tickColor ?? color;
11138
11030
  const pointIntents = seeds.map((seed) => {
11139
11031
  const tickAngle = angleOf2(seed.longitude);
11032
+ const trueAnchor = polarToXY2(center.x, center.y, rings.aspects.r2, tickAngle);
11140
11033
  const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
11141
11034
  const rawGlyphRadius = radius;
11142
11035
  const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
@@ -11145,15 +11038,16 @@ function buildPointLayer(params) {
11145
11038
  labelMaxRadius - pointGlyphFontSize * 0.5
11146
11039
  );
11147
11040
  const connectorRadius = glyphRadius;
11041
+ const glyphClearance = pointGlyphFontSize * 0.34;
11148
11042
  const tickLine = isExternalLayer ? lineFromPolar2(
11149
11043
  center,
11150
- rings.houses.r2 + 2 * scale,
11151
- connectorRadius,
11044
+ Math.max(rings.aspects.r1, rings.aspects.r2 - tickLength * 0.5),
11045
+ rings.aspects.r2 + tickLength * 0.5,
11152
11046
  tickAngle
11153
11047
  ) : lineFromPolar2(
11154
11048
  center,
11155
11049
  Math.min(ring.r2, connectorRadius + tickLength),
11156
- connectorRadius,
11050
+ Math.min(ring.r2, connectorRadius + glyphClearance),
11157
11051
  tickAngle
11158
11052
  );
11159
11053
  const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
@@ -11161,21 +11055,26 @@ function buildPointLayer(params) {
11161
11055
  layer,
11162
11056
  seed,
11163
11057
  tickLine,
11058
+ trueAngle: tickAngle,
11059
+ displayAngle: tickAngle,
11060
+ trueAnchor,
11164
11061
  labelAngle: tickAngle,
11165
11062
  glyphPosition: idealPosition,
11166
11063
  glyphFontSize: pointGlyphFontSize,
11064
+ rails,
11065
+ houses: layer.chart?.houses.houses,
11066
+ center,
11167
11067
  color,
11168
11068
  tickColor
11169
11069
  });
11170
- const layout = getPointLabelLayout(point, scale);
11171
- const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
11172
- const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
11070
+ const labelTangentDemandPx = pointGlyphFontSize * 0.72;
11173
11071
  const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
11174
11072
  const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
11175
11073
  return {
11176
11074
  seed,
11177
11075
  tickAngle,
11178
11076
  tickLine,
11077
+ trueAnchor,
11179
11078
  connectorRadius,
11180
11079
  glyphRadius,
11181
11080
  pointGlyphFontSize,
@@ -11204,42 +11103,37 @@ function buildPointLayer(params) {
11204
11103
  layer,
11205
11104
  seed: intent.seed,
11206
11105
  tickLine: intent.tickLine,
11106
+ trueAngle: intent.tickAngle,
11107
+ displayAngle: visualAngle,
11108
+ trueAnchor: intent.trueAnchor,
11207
11109
  labelAngle: visualAngle,
11208
11110
  glyphPosition,
11209
11111
  glyphFontSize: intent.pointGlyphFontSize,
11112
+ rails,
11113
+ houses: layer.chart?.houses.houses,
11114
+ center,
11210
11115
  color,
11211
11116
  tickColor
11212
11117
  });
11213
- const layout = getPointLabelLayout(point, scale);
11214
- const constrainedLabel = constrainLabelInsideCircle({
11118
+ const leaderArc = buildPointConnector({
11215
11119
  center,
11216
- position: glyphPosition,
11217
- layout,
11218
- padding: collisionPadding,
11219
- maxRadius: labelMaxRadius
11120
+ tickAngle: intent.tickAngle,
11121
+ labelAngle: visualAngle,
11122
+ connectorRadius: intent.connectorRadius,
11123
+ glyphPosition,
11124
+ mode: pointConnectorMode
11125
+ });
11126
+ const connector = buildPointLineConnector({
11127
+ trueAnchor: point.trueAnchor,
11128
+ glyphPosition,
11129
+ mode: pointConnectorMode,
11130
+ tickAngle: intent.tickAngle,
11131
+ displayAngle: visualAngle
11220
11132
  });
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
11133
  return {
11241
11134
  ...point,
11242
- labelBounds: constrainedLabel.bounds
11135
+ leaderArc,
11136
+ connector
11243
11137
  };
11244
11138
  });
11245
11139
  return {
@@ -11248,6 +11142,7 @@ function buildPointLayer(params) {
11248
11142
  color,
11249
11143
  tickColor,
11250
11144
  radius,
11145
+ rails,
11251
11146
  points
11252
11147
  };
11253
11148
  }
@@ -11256,21 +11151,43 @@ function makeAstroWheelPoint(params) {
11256
11151
  layer,
11257
11152
  seed,
11258
11153
  tickLine,
11154
+ trueAngle,
11155
+ displayAngle,
11156
+ trueAnchor,
11259
11157
  labelAngle,
11260
11158
  glyphPosition,
11261
11159
  glyphFontSize,
11160
+ rails,
11161
+ houses,
11162
+ center,
11262
11163
  color,
11263
11164
  tickColor
11264
11165
  } = params;
11166
+ const houseContext = houses ? getHouseContext(seed.longitude, houses) : {};
11167
+ const railLabels = buildPointRailLabels({
11168
+ seed,
11169
+ rails,
11170
+ center,
11171
+ displayAngle,
11172
+ color,
11173
+ glyphFontSize
11174
+ });
11175
+ const glyphScale = glyphFontSize * 0.66;
11265
11176
  return {
11266
- layerId: layer.id,
11177
+ groupId: layer.id,
11267
11178
  key: seed.key,
11268
11179
  name: seed.name,
11269
11180
  kind: seed.kind,
11270
11181
  glyph: seed.glyph,
11271
11182
  glyphKey: seed.glyphKey,
11272
11183
  longitude: normalizeAngle2(seed.longitude),
11273
- displayLongitude: normalizeAngle2(seed.longitude),
11184
+ displayLongitude: normalizeAngle2(seed.longitude + rad2deg2(signedAngleDelta(displayAngle, trueAngle))),
11185
+ trueAnchor,
11186
+ trueAngle,
11187
+ displayAngle,
11188
+ house: houseContext.house,
11189
+ nearestCuspHouse: houseContext.nearestCuspHouse,
11190
+ nearestCuspDistanceDegrees: houseContext.nearestCuspDistanceDegrees,
11274
11191
  zodiacPosition: seed.zodiacPosition,
11275
11192
  tickLine,
11276
11193
  labelAngle,
@@ -11278,28 +11195,159 @@ function makeAstroWheelPoint(params) {
11278
11195
  leaderLine: void 0,
11279
11196
  glyphPosition,
11280
11197
  glyphFontSize,
11198
+ glyphScale,
11199
+ railLabels,
11200
+ hitTarget: {
11201
+ kind: "circle",
11202
+ cx: glyphPosition.x,
11203
+ cy: glyphPosition.y,
11204
+ r: round2(glyphScale * 0.72)
11205
+ },
11281
11206
  retrograde: seed.retrograde,
11282
11207
  color,
11283
11208
  tickColor
11284
11209
  };
11285
11210
  }
11286
- function buildAspectLayer(params) {
11211
+ function resolveRailVisibility(input) {
11212
+ if (!input || input === "glyph-only") {
11213
+ return { degree: false, sign: false, minutes: false, retrograde: false };
11214
+ }
11215
+ if (input === "compact") {
11216
+ return { degree: true, sign: true, minutes: false, retrograde: true };
11217
+ }
11218
+ if (input === "full") {
11219
+ return { degree: true, sign: true, minutes: true, retrograde: true };
11220
+ }
11221
+ return {
11222
+ degree: input.degree ?? true,
11223
+ sign: input.sign ?? true,
11224
+ minutes: input.minutes ?? true,
11225
+ retrograde: input.retrograde ?? true
11226
+ };
11227
+ }
11228
+ function resolveLayerRailVisibility(params) {
11229
+ if (params.layer.rails) {
11230
+ return resolveRailVisibility(params.layer.rails);
11231
+ }
11232
+ if (params.external) {
11233
+ return {
11234
+ degree: params.fallback.degree,
11235
+ sign: false,
11236
+ minutes: false,
11237
+ retrograde: false
11238
+ };
11239
+ }
11240
+ return params.fallback;
11241
+ }
11242
+ function buildPositionRails(params) {
11243
+ const { ring, scale, visibility, layerRadius, external, glyphFontSize } = params;
11244
+ if (external) {
11245
+ const gap = Math.max(2.4 * scale, 2);
11246
+ const step = Math.max(glyphFontSize * 0.22, 4.2 * scale);
11247
+ const firstRailRadius = layerRadius + glyphFontSize * 0.42 + gap;
11248
+ return [
11249
+ { id: "degree", label: "Degree", radius: round2(firstRailRadius), visible: visibility.degree },
11250
+ { id: "minutes", label: "Minutes", radius: round2(firstRailRadius + step * 2), visible: visibility.minutes },
11251
+ { id: "sign", label: "Sign", radius: round2(firstRailRadius + step), visible: visibility.sign },
11252
+ { id: "retrograde", label: "Retrograde", radius: round2(firstRailRadius + step * 3), visible: visibility.retrograde }
11253
+ ];
11254
+ }
11255
+ const thickness = ring.r2 - ring.r1;
11256
+ const inset = Math.max(2 * scale, 1.5);
11257
+ return [
11258
+ { id: "degree", label: "Degree", radius: round2(ring.r1 + thickness * 0.52 + inset), visible: visibility.degree },
11259
+ { id: "minutes", label: "Minutes", radius: round2(ring.r1 + thickness * 0.24 + inset), visible: visibility.minutes },
11260
+ { id: "sign", label: "Sign", radius: round2(ring.r1 + thickness * 0.38 + inset), visible: visibility.sign },
11261
+ { id: "retrograde", label: "Retrograde", radius: round2(ring.r1 + thickness * 0.1 + inset), visible: visibility.retrograde }
11262
+ ];
11263
+ }
11264
+ function buildPointRailLabels(params) {
11265
+ const position = params.seed.zodiacPosition ? formatInlinePosition(params.seed.zodiacPosition) : null;
11266
+ const fontSize = clamp(params.glyphFontSize * 0.25, 5, 8);
11267
+ return params.rails.flatMap((rail) => {
11268
+ let text = "";
11269
+ let sign;
11270
+ let glyphScale;
11271
+ if (rail.id === "degree")
11272
+ text = position?.degreesText ?? "";
11273
+ if (rail.id === "sign") {
11274
+ sign = position?.sign;
11275
+ text = sign ? ASTRO_WHEEL_ZODIAC_SIGNS.find((entry) => entry.sign === sign)?.glyph ?? sign : "";
11276
+ glyphScale = fontSize * 0.78;
11277
+ }
11278
+ if (rail.id === "minutes")
11279
+ text = position?.minutesText ?? "";
11280
+ if (rail.id === "retrograde")
11281
+ text = params.seed.retrograde ? "R" : "";
11282
+ if (!text)
11283
+ return [];
11284
+ return [{
11285
+ railId: rail.id,
11286
+ text,
11287
+ sign,
11288
+ position: polarToXY2(params.center.x, params.center.y, rail.radius, params.displayAngle),
11289
+ angle: params.displayAngle,
11290
+ fontSize,
11291
+ glyphScale,
11292
+ visible: rail.visible
11293
+ }];
11294
+ });
11295
+ }
11296
+ function getHouseContext(longitude, houses) {
11297
+ if (houses.length === 0) {
11298
+ return {};
11299
+ }
11300
+ const lon = normalizeAngle2(longitude);
11301
+ let house = houses.length;
11302
+ let nearestCuspHouse = 1;
11303
+ let nearestCuspDistanceDegrees = Number.POSITIVE_INFINITY;
11304
+ for (let index = 0; index < houses.length; index++) {
11305
+ const cusp = normalizeAngle2(houses[index].longitude);
11306
+ const next = normalizeAngle2(houses[(index + 1) % houses.length].longitude);
11307
+ const span = clamp360(next - cusp);
11308
+ const offset = clamp360(lon - cusp);
11309
+ const distance = Math.abs(shortestLongitudeDistance(lon, cusp));
11310
+ if (offset < span || Math.abs(offset - span) < 1e-4) {
11311
+ house = index + 1;
11312
+ }
11313
+ if (distance < nearestCuspDistanceDegrees) {
11314
+ nearestCuspDistanceDegrees = distance;
11315
+ nearestCuspHouse = index + 1;
11316
+ }
11317
+ }
11318
+ return {
11319
+ house,
11320
+ nearestCuspHouse,
11321
+ nearestCuspDistanceDegrees: round2(nearestCuspDistanceDegrees)
11322
+ };
11323
+ }
11324
+ function buildPointLineConnector(params) {
11325
+ if (params.mode === "never")
11326
+ return void 0;
11327
+ if (params.mode === "auto" && circularAngleDistance(params.tickAngle, params.displayAngle) < deg2rad2(0.35)) {
11328
+ return void 0;
11329
+ }
11330
+ return {
11331
+ x1: params.trueAnchor.x,
11332
+ y1: params.trueAnchor.y,
11333
+ x2: params.glyphPosition.x,
11334
+ y2: params.glyphPosition.y
11335
+ };
11336
+ }
11337
+ function buildAspectGroup(params) {
11287
11338
  const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
11288
- const sourceEdges = getSourceAspectEdges(chart, {
11339
+ const sourceEdges = layer.edges ? layer.edges : getSourceAspectEdges(chart, {
11289
11340
  enabled: true,
11290
11341
  edges: layer.edges,
11291
11342
  aspectSpecs: layer.aspectSpecs
11292
11343
  });
11293
11344
  const aspectRadius = layer.radius ?? rings.aspects.r2 * (layer.radiusScale ?? 0.96);
11294
- const layerPointPrefix = pointKeyPrefix(layer.pointLayerId);
11295
- const layerPointPrefixA = layer.pointLayerIdA ? pointKeyPrefix(layer.pointLayerIdA) : layerPointPrefix;
11296
- const layerPointPrefixB = layer.pointLayerIdB ? pointKeyPrefix(layer.pointLayerIdB) : layerPointPrefix;
11297
11345
  const aspectLines = sourceEdges.flatMap((edge) => {
11298
11346
  if (isExcludedBody(edge.planetA, excludedBodies) || isExcludedBody(edge.planetB, excludedBodies)) {
11299
11347
  return [];
11300
11348
  }
11301
- const planetAKey = layerPointPrefixA + normalizePointKey(edge.planetA);
11302
- const planetBKey = layerPointPrefixB + normalizePointKey(edge.planetB);
11349
+ const planetAKey = normalizePointKey(edge.planetA);
11350
+ const planetBKey = normalizePointKey(edge.planetB);
11303
11351
  const planetA = pointByKey[planetAKey];
11304
11352
  const planetB = pointByKey[planetBKey];
11305
11353
  if (!planetA || !planetB) {
@@ -11308,10 +11356,10 @@ function buildAspectLayer(params) {
11308
11356
  const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
11309
11357
  const maxOrb = spec?.orb ?? 8;
11310
11358
  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));
11359
+ const a = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude)) : planetA.trueAnchor;
11360
+ const b = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude)) : planetB.trueAnchor;
11313
11361
  return [{
11314
- layerId: layer.id,
11362
+ groupId: layer.id,
11315
11363
  planetA: planetA.name,
11316
11364
  planetB: planetB.name,
11317
11365
  planetAKey,
@@ -11370,9 +11418,9 @@ function getPointSeeds(layer, excludedBodies) {
11370
11418
  }
11371
11419
  return seeds.filter((seed) => !isExcludedBody(seed.name, excludedBodies)).sort((a, b) => normalizeAngle2(a.longitude) - normalizeAngle2(b.longitude));
11372
11420
  }
11373
- function planetSeed(key, planet, layerId) {
11421
+ function planetSeed(key, planet, groupId) {
11374
11422
  return {
11375
- key: layerPointKey(layerId, key || planet.name),
11423
+ key: layerPointKey(groupId, key || planet.name),
11376
11424
  name: planet.name,
11377
11425
  kind: "planet",
11378
11426
  glyph: pointGlyph(planet.name),
@@ -11382,9 +11430,9 @@ function planetSeed(key, planet, layerId) {
11382
11430
  zodiacPosition: planet.zodiacPosition
11383
11431
  };
11384
11432
  }
11385
- function nodeSeed(key, node, layerId) {
11433
+ function nodeSeed(key, node, groupId) {
11386
11434
  return {
11387
- key: layerPointKey(layerId, node.name || key),
11435
+ key: layerPointKey(groupId, node.name || key),
11388
11436
  name: node.name,
11389
11437
  kind: "node",
11390
11438
  glyph: pointGlyph(node.name),
@@ -11393,9 +11441,9 @@ function nodeSeed(key, node, layerId) {
11393
11441
  zodiacPosition: node
11394
11442
  };
11395
11443
  }
11396
- function pointSeed(point, layerId) {
11444
+ function pointSeed(point, groupId) {
11397
11445
  return {
11398
- key: layerPointKey(layerId, point.key ?? point.name),
11446
+ key: layerPointKey(groupId, point.key ?? point.name),
11399
11447
  name: point.name,
11400
11448
  kind: point.kind ?? "planet",
11401
11449
  glyph: point.glyph ?? pointGlyph(point.name),
@@ -11410,7 +11458,7 @@ function solveCircularLabelAngles(items, options) {
11410
11458
  if (items.length === 0) {
11411
11459
  return [];
11412
11460
  }
11413
- const normalized = items.map((item) => ({
11461
+ const normalized = seedExactAngleClusters(items, { paddingPx, maxDisplacementRad }).map((item) => ({
11414
11462
  ...item,
11415
11463
  idealAngle: clampRad(item.idealAngle)
11416
11464
  })).sort((a, b) => a.idealAngle - b.idealAngle);
@@ -11449,8 +11497,8 @@ function solveCircularLabelAngles(items, options) {
11449
11497
  }
11450
11498
  const solved = linear.map((item) => ({
11451
11499
  ...item,
11452
- visualAngle: item.idealAngle
11453
- }));
11500
+ visualAngle: item.visualAngleSeed ?? item.idealAngle
11501
+ })).sort((a, b) => a.visualAngle - b.visualAngle);
11454
11502
  for (let iteration = 0; iteration < 50; iteration++) {
11455
11503
  const forces = new Array(solved.length).fill(0);
11456
11504
  let maxForce = 0;
@@ -11493,6 +11541,38 @@ function solveCircularLabelAngles(items, options) {
11493
11541
  visualAngle: clampRad(item.visualAngle)
11494
11542
  }));
11495
11543
  }
11544
+ function seedExactAngleClusters(items, options) {
11545
+ const seeded = items.map((item) => ({
11546
+ ...item,
11547
+ idealAngle: clampRad(item.idealAngle)
11548
+ }));
11549
+ const groups = /* @__PURE__ */ new Map();
11550
+ for (const item of seeded) {
11551
+ const key = item.idealAngle.toFixed(6);
11552
+ const group = groups.get(key);
11553
+ if (group) {
11554
+ group.push(item);
11555
+ } else {
11556
+ groups.set(key, [item]);
11557
+ }
11558
+ }
11559
+ for (const group of groups.values()) {
11560
+ if (group.length < 2) {
11561
+ continue;
11562
+ }
11563
+ const center = group[0].idealAngle;
11564
+ const largestDemand = Math.max(
11565
+ ...group.map((item) => labelAngularHalfDemand(item, options.paddingPx) * 2)
11566
+ );
11567
+ const maxStep = group.length > 1 ? options.maxDisplacementRad * 2 / (group.length - 1) : largestDemand;
11568
+ const step = Math.min(largestDemand, maxStep);
11569
+ const midpoint2 = (group.length - 1) / 2;
11570
+ group.forEach((item, index) => {
11571
+ item.visualAngleSeed = center + (index - midpoint2) * step;
11572
+ });
11573
+ }
11574
+ return seeded;
11575
+ }
11496
11576
  function clampAngleAroundIdeal(value, ideal, maxDistance) {
11497
11577
  if (!Number.isFinite(maxDistance) || maxDistance >= Math.PI) {
11498
11578
  return value;
@@ -11519,6 +11599,9 @@ function circularAngleDistance(a, b) {
11519
11599
  const delta = Math.abs(clampRad(a) - clampRad(b));
11520
11600
  return Math.min(delta, TAU2 - delta);
11521
11601
  }
11602
+ function rad2deg2(radians) {
11603
+ return radians * (360 / TAU2);
11604
+ }
11522
11605
  function buildPointConnector(params) {
11523
11606
  const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
11524
11607
  const displacement = circularAngleDistance(tickAngle, labelAngle);
@@ -11586,6 +11669,9 @@ function getAspectMatch2(lonA, lonB, specs) {
11586
11669
  }
11587
11670
  return null;
11588
11671
  }
11672
+ function shortestLongitudeDistance(a, b) {
11673
+ return (normalizeAngle2(a) - normalizeAngle2(b) + 540) % 360 - 180;
11674
+ }
11589
11675
  function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
11590
11676
  return specs.find((spec) => spec.name === aspect);
11591
11677
  }
@@ -11718,7 +11804,7 @@ function resolveAspectOptions(options) {
11718
11804
  aspectSpecs: options.aspectSpecs
11719
11805
  };
11720
11806
  }
11721
- function resolvePointLayerRadius(layer, rings) {
11807
+ function resolvePointGroupRadius(layer, rings) {
11722
11808
  const ring = rings.planets;
11723
11809
  if (layer.radius === "external") {
11724
11810
  return rings.houses.r2 + (layer.radiusOffset ?? 18);
@@ -11751,12 +11837,9 @@ function isExcludedBody(name, excludedBodies) {
11751
11837
  function normalizePointKey(value) {
11752
11838
  return value.trim().toLocaleLowerCase().replace(/[_-]+/g, " ").replace(/\s+/g, " ");
11753
11839
  }
11754
- function layerPointKey(layerId, value) {
11840
+ function layerPointKey(groupId, value) {
11755
11841
  const key = normalizePointKey(value);
11756
- return layerId === "birth" ? key : `${layerId}:${key}`;
11757
- }
11758
- function pointKeyPrefix(layerId) {
11759
- return !layerId || layerId === "birth" ? "" : `${layerId}:`;
11842
+ return groupId === "birth" ? key : `${groupId}:${key}`;
11760
11843
  }
11761
11844
  function renderGlyphPrimitives(push, primitives, options) {
11762
11845
  for (const p of primitives) {
@@ -21269,7 +21352,6 @@ __export(visual_exports, {
21269
21352
  generateTreeSvg: () => generateTreeSvg,
21270
21353
  getArcheometerRenderModel: () => getArcheometerRenderModel,
21271
21354
  getAstroGlyph: () => getAstroGlyph,
21272
- getAstroWheelRenderModel: () => getAstroWheelRenderModel,
21273
21355
  getRouteActivations: () => getRouteActivations,
21274
21356
  getTreeLayout: () => getTreeLayout,
21275
21357
  getTreeRenderModel: () => getTreeRenderModel,
@@ -26865,7 +26947,7 @@ var import_config3 = require("dotenv/config");
26865
26947
  // package.json
26866
26948
  var package_default = {
26867
26949
  name: "kaabalah",
26868
- version: "6.9.0",
26950
+ version: "6.11.0",
26869
26951
  description: "The de-facto library for any esoteric calculations and tooling",
26870
26952
  engines: {
26871
26953
  node: ">=18.18.0"
@@ -26951,6 +27033,7 @@ var package_default = {
26951
27033
  "test:ui": "vitest --ui --silent",
26952
27034
  "prepare-browser-test": "cp wasm/build/swisseph.wasm examples/ && cp -r ephe examples/",
26953
27035
  "generate:trees": "npx tsx examples/generate-tree-svg.ts",
27036
+ "generate:wheel": "npx tsx examples/generate-astro-wheel-svgs.ts",
26954
27037
  "generate:wheels": "npx tsx examples/generate-astro-wheel-svgs.ts",
26955
27038
  "generate:archeometer": "npx tsx examples/generate-archeometer-svg.ts",
26956
27039
  "generate:svgs": "npm run generate:trees && npm run generate:wheels && npm run generate:archeometer",
@@ -27293,7 +27376,6 @@ var COMMANDS = [
27293
27376
  { name: "no-houses", type: "boolean", default: false, description: "Hide house cusps, labels, and angle markers" },
27294
27377
  { name: "no-points", type: "boolean", default: false, description: "Hide birth planets, nodes, and vertex" },
27295
27378
  { name: "no-aspects", type: "boolean", default: false, description: "Hide aspect lines" },
27296
- { name: "render-model", type: "boolean", default: false, description: "Return wheel geometry JSON instead of SVG" },
27297
27379
  { name: "output", type: "string", description: "Write the SVG to a file instead of stdout" },
27298
27380
  { name: "viewbox-width", type: "number", description: "Override SVG viewBox width" },
27299
27381
  { name: "viewbox-height", type: "number", description: "Override SVG viewBox height" },
@@ -27305,8 +27387,7 @@ var COMMANDS = [
27305
27387
  examples: [
27306
27388
  "kaabalah astrology:wheel 1990-01-15 14:30 --lat=40.7128 --lon=-74.006 --json --compact --fields=svg",
27307
27389
  "kaabalah astrology:wheel 1990-01-15 14:30 --lat=40.7128 --lon=-74.006 --background=transparent --output=chart.svg --json",
27308
- "kaabalah astrology:wheel --input-json=- --json --compact --fields=svg < chart-wheel.json",
27309
- "kaabalah astrology:wheel 1990-01-15 14:30 --lat=40.7128 --lon=-74.006 --render-model --json --compact"
27390
+ "kaabalah astrology:wheel --input-json=- --json --compact --fields=svg < chart-wheel.json"
27310
27391
  ]
27311
27392
  },
27312
27393
  {
@@ -28654,7 +28735,6 @@ function buildAstroWheelSvgOptions(flags, inputPayload) {
28654
28735
  }
28655
28736
  if (getInputBoolean(inputPayload, "noAspects") === true || getFlagBool(flags, "no-aspects")) {
28656
28737
  options.aspects = false;
28657
- options.aspectLayers = [];
28658
28738
  }
28659
28739
  if (options.aspects !== false && inputPayload?.aspectSpecs != null && Array.isArray(inputPayload.aspectSpecs)) {
28660
28740
  options.aspects = {
@@ -29473,14 +29553,6 @@ async function cmdAstrologyWheel(args, flags, inputPayload, executionContext) {
29473
29553
  const aspectFilter = parseAspectTypeFilter(flags, inputPayload);
29474
29554
  const wheelOptions = buildAstroWheelSvgOptions(flags, inputPayload);
29475
29555
  const outputPathFlag = getFlagString(flags, "output") ?? getInputString(inputPayload, "output");
29476
- const renderModel = getFlagBool(flags, "render-model") || getInputBoolean(inputPayload, "renderModel") === true;
29477
- if (renderModel && outputPathFlag) {
29478
- exitWithError(
29479
- "INVALID_ARGUMENT",
29480
- "--output is only supported when generating an astrology wheel SVG. Omit --render-model to write an SVG file.",
29481
- flags
29482
- );
29483
- }
29484
29556
  try {
29485
29557
  await initWasm(runtimePaths, executionContext);
29486
29558
  } catch (err) {
@@ -29496,7 +29568,6 @@ async function cmdAstrologyWheel(args, flags, inputPayload, executionContext) {
29496
29568
  latitude: input.latitude,
29497
29569
  longitude: input.longitude,
29498
29570
  houseSystem: input.houseSystem,
29499
- renderModel,
29500
29571
  output: outputPathFlag
29501
29572
  });
29502
29573
  const chart = await getBirthChart2({
@@ -29507,37 +29578,10 @@ async function cmdAstrologyWheel(args, flags, inputPayload, executionContext) {
29507
29578
  timeZoneSettings: input.timeZoneSettings
29508
29579
  });
29509
29580
  const filteredChart = filterChartAspects(chart, { maxOrb, aspectFilter });
29510
- const { generateAstroWheelSvg: generateAstroWheelSvg2, getAstroWheelRenderModel: getAstroWheelRenderModel2 } = await Promise.resolve().then(() => (init_visual(), visual_exports));
29581
+ const { generateAstroWheelSvg: generateAstroWheelSvg2 } = await Promise.resolve().then(() => (init_visual(), visual_exports));
29511
29582
  executionContext.throwIfInterrupted();
29512
29583
  const inputEcho = formatSingleChartInputEcho(input);
29513
29584
  const serializedOptions = serializeAstroWheelOptions(wheelOptions);
29514
- if (renderModel) {
29515
- const model = getAstroWheelRenderModel2(filteredChart, wheelOptions);
29516
- executionContext.throwIfInterrupted();
29517
- if (isJsonMode(flags)) {
29518
- outputJson(
29519
- {
29520
- ...model,
29521
- input: inputEcho,
29522
- options: serializedOptions
29523
- },
29524
- flags
29525
- );
29526
- return;
29527
- }
29528
- console.log(`
29529
- Astrology Wheel Render Model: ${input.dateStr} ${input.timeStr}
29530
- `);
29531
- console.log(
29532
- ` ViewBox: ${model.viewBox.minX} ${model.viewBox.minY} ${model.viewBox.width} ${model.viewBox.height}`
29533
- );
29534
- console.log(` Points: ${model.points.length}`);
29535
- console.log(` Houses: ${model.houseCusps.length}`);
29536
- console.log(` Aspects: ${model.aspectLines.length}`);
29537
- console.log(` Point layers: ${model.pointLayers.map((layer) => layer.id).join(", ") || "none"}`);
29538
- console.log();
29539
- return;
29540
- }
29541
29585
  const svg = generateAstroWheelSvg2(filteredChart, wheelOptions);
29542
29586
  executionContext.throwIfInterrupted();
29543
29587
  const bytes = Buffer.byteLength(svg, "utf8");