kaabalah 6.6.4 → 6.7.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/{chunk-3TBUVMHV.mjs → chunk-SFUCT6I2.mjs} +1181 -249
- package/dist/chunk-SFUCT6I2.mjs.map +1 -0
- package/dist/{chunk-NRAAMI6I.js → chunk-WCOGJKT7.js} +1195 -248
- package/dist/chunk-WCOGJKT7.js.map +1 -0
- package/dist/cli.js +1211 -256
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +170 -110
- package/dist/index.mjs +2 -2
- package/dist/visual/index.d.mts +175 -1
- package/dist/visual/index.d.ts +175 -1
- package/dist/visual/index.js +87 -27
- package/dist/visual/index.mjs +1 -1
- package/package.json +3 -2
- package/dist/chunk-3TBUVMHV.mjs.map +0 -1
- package/dist/chunk-NRAAMI6I.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -8926,10 +8926,826 @@ var init_astrology = __esm({
|
|
|
8926
8926
|
}
|
|
8927
8927
|
});
|
|
8928
8928
|
|
|
8929
|
-
// src/visual/
|
|
8930
|
-
|
|
8931
|
-
|
|
8929
|
+
// src/visual/archeometer.ts
|
|
8930
|
+
function getArcheometerRenderModel(options = {}) {
|
|
8931
|
+
const viewBox = normalizeViewBox(options.viewBox);
|
|
8932
|
+
const scale = Math.min(viewBox.width / ARCHEOMETER_DEFAULT_VIEWBOX.width, viewBox.height / ARCHEOMETER_DEFAULT_VIEWBOX.height);
|
|
8933
|
+
const padding = options.padding ?? 0;
|
|
8934
|
+
const center = {
|
|
8935
|
+
x: round(viewBox.minX + viewBox.width / 2),
|
|
8936
|
+
y: round(viewBox.minY + viewBox.height / 2)
|
|
8937
|
+
};
|
|
8938
|
+
const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
8939
|
+
const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
|
|
8940
|
+
return {
|
|
8941
|
+
viewBox,
|
|
8942
|
+
center,
|
|
8943
|
+
outerRadius,
|
|
8944
|
+
scale,
|
|
8945
|
+
rings: buildRings(outerRadius, frameRadius),
|
|
8946
|
+
palette: resolvePalette(options.palette),
|
|
8947
|
+
rotationDegrees: options.rotationDegrees ?? 0,
|
|
8948
|
+
layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
|
|
8949
|
+
degreeLabelEvery: options.degreeLabelEvery ?? 15,
|
|
8950
|
+
utterance: options.utterance ?? DEFAULT_ARCHEOMETER_UTTERANCE,
|
|
8951
|
+
triangles: options.triangles ?? DEFAULT_ARCHEOMETER_TRIANGLES,
|
|
8952
|
+
triangleLabels: options.triangleLabels ?? DEFAULT_ARCHEOMETER_TRIANGLE_LABELS,
|
|
8953
|
+
musicalNotes: options.musicalNotes ?? DEFAULT_ARCHEOMETER_MUSICAL_NOTES,
|
|
8954
|
+
zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
|
|
8955
|
+
planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
|
|
8956
|
+
};
|
|
8957
|
+
}
|
|
8958
|
+
function generateArcheometerSvg(options = {}) {
|
|
8959
|
+
const model = getArcheometerRenderModel(options);
|
|
8960
|
+
const { viewBox, center, outerRadius, palette } = model;
|
|
8961
|
+
const background = options.background ?? "transparent";
|
|
8962
|
+
const lines = [];
|
|
8963
|
+
const push = (line) => lines.push(line);
|
|
8964
|
+
const title = options.title ?? "The Cosmological Archeometer";
|
|
8965
|
+
const attrs = [
|
|
8966
|
+
`xmlns="http://www.w3.org/2000/svg"`,
|
|
8967
|
+
options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
|
|
8968
|
+
options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
|
|
8969
|
+
`viewBox="${fmt(viewBox.minX)} ${fmt(viewBox.minY)} ${fmt(viewBox.width)} ${fmt(viewBox.height)}"`,
|
|
8970
|
+
`preserveAspectRatio="xMidYMid meet"`,
|
|
8971
|
+
`role="img"`,
|
|
8972
|
+
`aria-label="${escapeAttr(title)}"`
|
|
8973
|
+
].filter(Boolean);
|
|
8974
|
+
push(`<svg ${attrs.join(" ")}>`);
|
|
8975
|
+
push(`<title>${escapeText(title)}</title>`);
|
|
8976
|
+
if (background !== "transparent") {
|
|
8977
|
+
push(`<rect x="${fmt(viewBox.minX)}" y="${fmt(viewBox.minY)}" width="${fmt(viewBox.width)}" height="${fmt(viewBox.height)}" fill="${escapeAttr(background)}"/>`);
|
|
8978
|
+
}
|
|
8979
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(outerRadius)}" fill="${escapeAttr(palette.paper)}"/>`);
|
|
8980
|
+
renderDefs(push, model);
|
|
8981
|
+
renderRingGrounds(push, model);
|
|
8982
|
+
if (model.layers.chromicRays) renderChromicRays(push, model);
|
|
8983
|
+
if (model.layers.planetaryUtterance) renderPlanetaryUtterance(push, model);
|
|
8984
|
+
if (model.layers.zodiacUtterance) renderZodiacUtterance(push, model);
|
|
8985
|
+
if (model.layers.cosmologicalMusic) renderCosmologicalMusic(push, model);
|
|
8986
|
+
if (model.layers.astralZodiac) renderAstralZodiac(push, model);
|
|
8987
|
+
if (model.layers.astralPlanetary) renderAstralPlanetary(push, model);
|
|
8988
|
+
if (model.layers.solarCenter) renderSolarCenter(push, model);
|
|
8989
|
+
if (model.layers.whiteRays) renderWhiteRays(push, model);
|
|
8990
|
+
if (model.layers.degreeCrown) renderDegreeCrown(push, model);
|
|
8991
|
+
renderFrame(push, model);
|
|
8992
|
+
push(`</svg>`);
|
|
8993
|
+
return lines.join("\n");
|
|
8994
|
+
}
|
|
8995
|
+
function renderDefs(push, model) {
|
|
8996
|
+
const { rings, center } = model;
|
|
8997
|
+
const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
8998
|
+
const planetaryClipInner = planetaryTriangleClipInnerRadius(rings);
|
|
8999
|
+
const chromicClipOuter = chromicCoreOuterRadius(rings);
|
|
9000
|
+
const chromicClipInner = chromicCoreInnerRadius(rings);
|
|
9001
|
+
push(`<defs>`);
|
|
9002
|
+
push(
|
|
9003
|
+
`<clipPath id="archeometer-planetary-clip"><path d="${annulusPath(
|
|
9004
|
+
center,
|
|
9005
|
+
planetaryClipInner,
|
|
9006
|
+
planetaryClipOuter
|
|
9007
|
+
)}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
|
|
9008
|
+
);
|
|
9009
|
+
push(
|
|
9010
|
+
`<clipPath id="archeometer-chromic-clip"><path d="${annulusPath(
|
|
9011
|
+
center,
|
|
9012
|
+
chromicClipInner,
|
|
9013
|
+
chromicClipOuter
|
|
9014
|
+
)}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
|
|
9015
|
+
);
|
|
9016
|
+
push(`</defs>`);
|
|
9017
|
+
}
|
|
9018
|
+
function renderRingGrounds(push, model) {
|
|
9019
|
+
const { rings, center, palette } = model;
|
|
9020
|
+
const order = [
|
|
9021
|
+
"degreeOuter",
|
|
9022
|
+
"degreeInner",
|
|
9023
|
+
"zodiacUtterance",
|
|
9024
|
+
"planetaryUtterance",
|
|
9025
|
+
"cosmologicalMusic",
|
|
9026
|
+
"astralZodiac",
|
|
9027
|
+
"astralPlanetary",
|
|
9028
|
+
"chromicRays",
|
|
9029
|
+
"whiteRays"
|
|
9030
|
+
];
|
|
9031
|
+
push(`<g id="archeometer-ring-grounds">`);
|
|
9032
|
+
for (const id2 of order) {
|
|
9033
|
+
const ring = rings[id2];
|
|
9034
|
+
push(`<path id="archeometer-ring-${id2}" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.ringFills[id2])}" fill-rule="evenodd" stroke="none"/>`);
|
|
9035
|
+
}
|
|
9036
|
+
push(`</g>`);
|
|
9037
|
+
}
|
|
9038
|
+
function renderDegreeCrown(push, model) {
|
|
9039
|
+
const { center, rings, palette, scale } = model;
|
|
9040
|
+
const outer = rings.degreeOuter;
|
|
9041
|
+
const inner = rings.degreeInner;
|
|
9042
|
+
push(`<g id="archeometer-degree-crown" aria-label="dual 360 degree differential numerical protractor">`);
|
|
9043
|
+
for (let degree = 0; degree < 360; degree += 30) {
|
|
9044
|
+
const angle = angleOf(model, degree);
|
|
9045
|
+
const pOuter = polarToXY(center, (outer.r1 + outer.r2) / 2, angle);
|
|
9046
|
+
const pInner = polarToXY(center, (inner.r1 + inner.r2) / 2, angle);
|
|
9047
|
+
const rot = tangentRotation(angle);
|
|
9048
|
+
const outerText = String(normalizeDegrees(345 + degree) || 360);
|
|
9049
|
+
const innerText = String(normalizeDegrees(15 - degree) || 360);
|
|
9050
|
+
push(textSvg(outerText, pOuter, 8.4 * scale, palette.degreeLabel, rot, "middle"));
|
|
9051
|
+
push(textSvg(innerText, pInner, 7.6 * scale, palette.degreeLabel, rot, "middle"));
|
|
9052
|
+
}
|
|
9053
|
+
push(`</g>`);
|
|
9054
|
+
}
|
|
9055
|
+
function renderZodiacUtterance(push, model) {
|
|
9056
|
+
const { center, rings, palette, scale } = model;
|
|
9057
|
+
const ring = rings.zodiacUtterance;
|
|
9058
|
+
const sorted = sortedByDegree(model.utterance);
|
|
9059
|
+
push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
|
|
9060
|
+
for (let i = 0; i < 12; i++) {
|
|
9061
|
+
const degree = i * 30;
|
|
9062
|
+
const sector = annularSectorPath(
|
|
9063
|
+
center,
|
|
9064
|
+
ring.r1,
|
|
9065
|
+
ring.r2,
|
|
9066
|
+
angleOf(model, degree - 15),
|
|
9067
|
+
angleOf(model, degree + 15),
|
|
9068
|
+
30
|
|
9069
|
+
);
|
|
9070
|
+
push(
|
|
9071
|
+
`<path d="${sector}" fill="${escapeAttr(palette.ringFills.zodiacUtterance)}" fill-opacity="1" stroke="${escapeAttr(
|
|
9072
|
+
palette.ringStroke
|
|
9073
|
+
)}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
|
|
9074
|
+
);
|
|
9075
|
+
}
|
|
9076
|
+
for (const point of sorted) {
|
|
9077
|
+
const a = angleOf(model, point.degree);
|
|
9078
|
+
const p = polarToXY(center, ring.r1 + (ring.r2 - ring.r1) * 0.58, a);
|
|
9079
|
+
const shieldR = (ring.r2 - ring.r1) * 0.22;
|
|
9080
|
+
const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
|
|
9081
|
+
const isStacked = letterParts.length > 1;
|
|
9082
|
+
const letterFontSize = (isStacked ? letterParts.length > 2 ? 8.3 : 10.6 : 14) * scale;
|
|
9083
|
+
const letterLineHeight = letterFontSize * (isStacked ? 1.02 : 1);
|
|
9084
|
+
const numberFontSize = (isStacked ? 6.6 : 7.1) * scale;
|
|
9085
|
+
const numberGap = (isStacked ? 4.8 : 0) * scale;
|
|
9086
|
+
const stackedNumberY = p.y + (letterParts.length - 1) * letterLineHeight / 2 + numberGap + numberFontSize * 0.42;
|
|
9087
|
+
const singleLetterY = p.y - shieldR * 0.48;
|
|
9088
|
+
const firstLineY = isStacked ? p.y - (letterParts.length - 1) * letterLineHeight / 2 - numberFontSize * 0.42 : singleLetterY;
|
|
9089
|
+
const numberY = isStacked ? stackedNumberY : p.y + shieldR * 0.72;
|
|
9090
|
+
push(
|
|
9091
|
+
`<g class="archeometer-utterance-point" data-degree="${fmt(normalizeDegrees(point.degree))}" data-letter="${escapeAttr(
|
|
9092
|
+
point.letter
|
|
9093
|
+
)}">`
|
|
9094
|
+
);
|
|
9095
|
+
for (const [index, part] of letterParts.entries()) {
|
|
9096
|
+
push(textSvg(part, { x: p.x, y: firstLineY + index * letterLineHeight }, letterFontSize, palette.ink, 0, "middle", 700));
|
|
9097
|
+
}
|
|
9098
|
+
push(textSvg(String(point.number), { x: p.x, y: numberY }, numberFontSize, palette.ink, 0, "middle"));
|
|
9099
|
+
push(`</g>`);
|
|
9100
|
+
}
|
|
9101
|
+
push(`</g>`);
|
|
9102
|
+
}
|
|
9103
|
+
function renderPlanetaryUtterance(push, model) {
|
|
9104
|
+
const { center, rings, palette, scale } = model;
|
|
9105
|
+
const ring = rings.planetaryUtterance;
|
|
9106
|
+
const clipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
9107
|
+
const vertexRadius = clipOuter;
|
|
9108
|
+
push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
|
|
9109
|
+
push(`<g clip-path="url(#archeometer-planetary-clip)">`);
|
|
9110
|
+
for (const triangle of model.triangles) {
|
|
9111
|
+
const vertices = triangle.vertices.map((degree) => polarToXY(center, vertexRadius, angleOf(model, degree)));
|
|
9112
|
+
if (triangle.vertexFills) {
|
|
9113
|
+
const centroid = polygonCentroid(vertices);
|
|
9114
|
+
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
9115
|
+
for (const [index, vertex] of vertices.entries()) {
|
|
9116
|
+
const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
|
|
9117
|
+
const nextMidpoint = midpoints[index];
|
|
9118
|
+
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"/>`);
|
|
9119
|
+
}
|
|
9120
|
+
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)}"/>`);
|
|
9121
|
+
} else {
|
|
9122
|
+
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)}"/>`);
|
|
9123
|
+
}
|
|
9124
|
+
}
|
|
9125
|
+
push(`</g>`);
|
|
9126
|
+
for (const label of sortedByDegree(model.triangleLabels)) {
|
|
9127
|
+
if (!label.label) continue;
|
|
9128
|
+
const a = angleOf(model, label.degree);
|
|
9129
|
+
const labelPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.56, a);
|
|
9130
|
+
push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
|
|
9131
|
+
if (label.number !== void 0) {
|
|
9132
|
+
const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
|
|
9133
|
+
push(textSvg(String(label.number), numberPoint, 7.5 * scale, palette.ink, 0, "middle", 600));
|
|
9134
|
+
}
|
|
9135
|
+
}
|
|
9136
|
+
push(`</g>`);
|
|
9137
|
+
}
|
|
9138
|
+
function renderCosmologicalMusic(push, model) {
|
|
9139
|
+
const { center, rings, palette, scale } = model;
|
|
9140
|
+
const ring = rings.cosmologicalMusic;
|
|
9141
|
+
const notes = sortedByDegree(model.musicalNotes);
|
|
9142
|
+
push(`<g id="archeometer-cosmological-music" aria-label="cosmological musical crown">`);
|
|
9143
|
+
push(`<path id="archeometer-music-backing" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.paper)}" stroke="${escapeAttr(palette.ringStroke)}" stroke-opacity="0.58" stroke-width="${fmt(0.8 * scale)}" fill-rule="evenodd"/>`);
|
|
9144
|
+
for (const note of notes) {
|
|
9145
|
+
const point = nearestUtterance(note.degree, model.utterance);
|
|
9146
|
+
const start = angleOf(model, note.degree - 15);
|
|
9147
|
+
const end = angleOf(model, note.degree + 15);
|
|
9148
|
+
const sector = annularSectorPath(center, ring.r1, ring.r2, start, end, 30);
|
|
9149
|
+
push(`<path d="${sector}" fill="${escapeAttr(note.color ?? point?.color ?? palette.ringFills.cosmologicalMusic)}" fill-opacity="0.24" stroke="${escapeAttr(palette.ringStroke)}" stroke-opacity="0.3" stroke-width="${fmt(0.55 * scale)}"/>`);
|
|
9150
|
+
}
|
|
9151
|
+
for (const note of notes) {
|
|
9152
|
+
const start = angleOf(model, note.degree - 5.5);
|
|
9153
|
+
const end = angleOf(model, note.degree + 5.5);
|
|
9154
|
+
for (let i = 1; i <= 5; i++) {
|
|
9155
|
+
const r = ring.r1 + (ring.r2 - ring.r1) * i / 6;
|
|
9156
|
+
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"/>`);
|
|
9157
|
+
}
|
|
9158
|
+
}
|
|
9159
|
+
for (const note of notes) {
|
|
9160
|
+
if (!note.note) continue;
|
|
9161
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, note.degree));
|
|
9162
|
+
push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
|
|
9163
|
+
}
|
|
9164
|
+
push(`</g>`);
|
|
9165
|
+
}
|
|
9166
|
+
function renderAstralZodiac(push, model) {
|
|
9167
|
+
const { center, rings, palette, scale } = model;
|
|
9168
|
+
const ring = rings.astralZodiac;
|
|
9169
|
+
const ringWidth = ring.r2 - ring.r1;
|
|
9170
|
+
push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
|
|
9171
|
+
for (const sign of sortedByDegree(model.zodiacSigns)) {
|
|
9172
|
+
const sector = annularSectorPath(
|
|
9173
|
+
center,
|
|
9174
|
+
ring.r1,
|
|
9175
|
+
ring.r2,
|
|
9176
|
+
angleOf(model, sign.degree - 15),
|
|
9177
|
+
angleOf(model, sign.degree + 15),
|
|
9178
|
+
30
|
|
9179
|
+
);
|
|
9180
|
+
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
9181
|
+
push(
|
|
9182
|
+
`<path d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.40" stroke="${escapeAttr(
|
|
9183
|
+
palette.ringStroke
|
|
9184
|
+
)}" stroke-opacity="0.32" stroke-width="${fmt(0.6 * scale)}"/>`
|
|
9185
|
+
);
|
|
9186
|
+
}
|
|
9187
|
+
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
9188
|
+
const glyphSize = 17.5 * scale;
|
|
9189
|
+
for (const sign of sortedByDegree(model.zodiacSigns)) {
|
|
9190
|
+
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
9191
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, sign.degree));
|
|
9192
|
+
push(
|
|
9193
|
+
`<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
|
|
9194
|
+
normalizeDegrees(sign.degree)
|
|
9195
|
+
)}">`
|
|
9196
|
+
);
|
|
9197
|
+
push(
|
|
9198
|
+
`<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
|
|
9199
|
+
pointColor
|
|
9200
|
+
)}" fill-opacity="0.48" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.75 * scale)}"/>`
|
|
9201
|
+
);
|
|
9202
|
+
push(textSvg(sign.glyph, p, glyphSize, palette.ink, 0, "middle"));
|
|
9203
|
+
push(`</g>`);
|
|
9204
|
+
}
|
|
9205
|
+
push(`</g>`);
|
|
9206
|
+
}
|
|
9207
|
+
function renderAstralPlanetary(push, model) {
|
|
9208
|
+
const { center, rings, palette, scale } = model;
|
|
9209
|
+
const ring = rings.astralPlanetary;
|
|
9210
|
+
const ringWidth = ring.r2 - ring.r1;
|
|
9211
|
+
push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
|
|
9212
|
+
for (const planet of sortedByDegree(model.planetaryPoints)) {
|
|
9213
|
+
const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
|
|
9214
|
+
const sector = annularSectorPath(
|
|
9215
|
+
center,
|
|
9216
|
+
ring.r1,
|
|
9217
|
+
ring.r2,
|
|
9218
|
+
angleOf(model, planet.degree - 15),
|
|
9219
|
+
angleOf(model, planet.degree + 15),
|
|
9220
|
+
30
|
|
9221
|
+
);
|
|
9222
|
+
push(
|
|
9223
|
+
`<path class="archeometer-astral-planetary-sector" data-degree="${fmt(
|
|
9224
|
+
normalizeDegrees(planet.degree)
|
|
9225
|
+
)}" d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.36" stroke="none"/>`
|
|
9226
|
+
);
|
|
9227
|
+
}
|
|
9228
|
+
for (let degree = 15; degree < 360; degree += 30) {
|
|
9229
|
+
const line = lineFromPolar(center, ring.r1, ring.r2, angleOf(model, degree));
|
|
9230
|
+
push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
|
|
9231
|
+
}
|
|
9232
|
+
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
9233
|
+
for (const planet of sortedByDegree(model.planetaryPoints)) {
|
|
9234
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, planet.degree));
|
|
9235
|
+
const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
|
|
9236
|
+
const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
|
|
9237
|
+
push(
|
|
9238
|
+
`<g class="archeometer-planet" data-planet="${escapeAttr(planet.name)}" data-degree="${fmt(
|
|
9239
|
+
normalizeDegrees(planet.degree)
|
|
9240
|
+
)}">`
|
|
9241
|
+
);
|
|
9242
|
+
push(
|
|
9243
|
+
`<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
|
|
9244
|
+
color
|
|
9245
|
+
)}" fill-opacity="0.44" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.8 * scale)}"/>`
|
|
9246
|
+
);
|
|
9247
|
+
push(textSvg(planet.glyph, p, glyphSize, palette.ink, 0, "middle"));
|
|
9248
|
+
push(`</g>`);
|
|
9249
|
+
}
|
|
9250
|
+
push(`</g>`);
|
|
9251
|
+
}
|
|
9252
|
+
function renderChromicRays(push, model) {
|
|
9253
|
+
push(`<g id="archeometer-chromic-rays" aria-label="dodecagonal crown of chromic circum-solar rays">`);
|
|
9254
|
+
push(`<g clip-path="url(#archeometer-chromic-clip)">`);
|
|
9255
|
+
renderChromicTriangleCore(push, model);
|
|
9256
|
+
push(`</g>`);
|
|
9257
|
+
push(`</g>`);
|
|
9258
|
+
}
|
|
9259
|
+
function renderChromicTriangleCore(push, model) {
|
|
9260
|
+
const { center, rings, palette, scale } = model;
|
|
9261
|
+
const trianglesById = new Map(model.triangles.map((triangle) => [triangle.id, triangle]));
|
|
9262
|
+
const wordJesus = trianglesById.get("wordJesus");
|
|
9263
|
+
const mary = trianglesById.get("mary");
|
|
9264
|
+
const ether = trianglesById.get("ether");
|
|
9265
|
+
const divineFire = trianglesById.get("divineFire");
|
|
9266
|
+
const chromicOuter = chromicCoreOuterRadius(rings);
|
|
9267
|
+
const chromic = (x, y) => scaleArcheometerReferencePoint(center, chromicOuter, x, y);
|
|
9268
|
+
const path = (...commands) => commands.join(" ");
|
|
9269
|
+
const move = (x, y) => {
|
|
9270
|
+
const p = chromic(x, y);
|
|
9271
|
+
return `M ${fmt(p.x)} ${fmt(p.y)}`;
|
|
9272
|
+
};
|
|
9273
|
+
const line = (x, y) => {
|
|
9274
|
+
const p = chromic(x, y);
|
|
9275
|
+
return `L ${fmt(p.x)} ${fmt(p.y)}`;
|
|
9276
|
+
};
|
|
9277
|
+
const cubic = (x1, y1, x2, y2, x, y) => {
|
|
9278
|
+
const c1 = chromic(x1, y1);
|
|
9279
|
+
const c2 = chromic(x2, y2);
|
|
9280
|
+
const p = chromic(x, y);
|
|
9281
|
+
return `C ${fmt(c1.x)} ${fmt(c1.y)} ${fmt(c2.x)} ${fmt(c2.y)} ${fmt(p.x)} ${fmt(p.y)}`;
|
|
9282
|
+
};
|
|
9283
|
+
const strokeWidth = fmt(1.4 * scale);
|
|
9284
|
+
const facetStrokeWidth = fmt(0.85 * scale);
|
|
9285
|
+
const primaryFacetStrokeWidth = fmt(0.95 * scale);
|
|
9286
|
+
const primaryStroke = wordJesus?.stroke ?? palette.ink;
|
|
9287
|
+
push(`<g id="archeometer-chromic-triangle-core" aria-label="inner chromic primary triangle core">`);
|
|
9288
|
+
push(`<path class="archeometer-chromic-foundation" data-triangle="ether" d="${path(move(1.3999, 137.047), line(204.875, 19.5703), line(204.875, 254.523), "Z")}" fill="${escapeAttr(ether?.fill ?? "#78BD79")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
|
|
9289
|
+
push(`<path class="archeometer-chromic-foundation" data-triangle="divineFire" d="${path(move(272.7, 137.047), line(69.2251, 254.523), line(69.2251, 19.5703), "Z")}" fill="${escapeAttr(divineFire?.fill ?? "#CC58A1")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
|
|
9290
|
+
push(`<path class="archeometer-chromic-foundation" data-triangle="mary" d="${path(move(137.05, 272.702), line(19.5737, 69.2266), line(254.527, 69.2266), "Z")}" fill="${escapeAttr(mary?.fill ?? "#E25B61")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
|
|
9291
|
+
for (const triangle of [ether, divineFire, mary]) {
|
|
9292
|
+
if (!triangle?.vertexFills) continue;
|
|
9293
|
+
const vertices = triangle.vertices.map((degree) => polarToXY(center, chromicOuter, angleOf(model, degree)));
|
|
9294
|
+
const centroid = polygonCentroid(vertices);
|
|
9295
|
+
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
9296
|
+
for (const [index, vertex] of vertices.entries()) {
|
|
9297
|
+
const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
|
|
9298
|
+
const nextMidpoint = midpoints[index];
|
|
9299
|
+
push(`<path class="archeometer-chromic-trigone-facet" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.72" stroke-width="${facetStrokeWidth}"/>`);
|
|
9300
|
+
}
|
|
9301
|
+
}
|
|
9302
|
+
push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="120" d="${path(move(137.05, 204.874), line(254.527, 204.874), line(195.789, 103.136), cubic(195.789, 103.136, 215.377, 136.525, 195.789, 170.699), cubic(176.2, 204.874, 137.05, 204.874, 137.05, 204.874), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[1] ?? "#5470A5")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
|
|
9303
|
+
push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="240" d="${path(move(19.5737, 204.874), line(137.05, 204.874), cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699), cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136), line(19.5737, 204.874), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[2] ?? "#DD3E38")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
|
|
9304
|
+
push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="0" fill-rule="evenodd" clip-rule="evenodd" d="${path(move(195.789, 103.136), line(137.05, 1.39844), line(78.312, 103.136), cubic(78.312, 103.136, 100.9, 71.1992, 137.05, 71.1992), cubic(173.2, 71.1992, 195.789, 103.136, 195.789, 103.136), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[0] ?? "#F2CF45")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
|
|
9305
|
+
push(`<path class="archeometer-chromic-primary-outline" data-triangle="wordJesus" d="${path(
|
|
9306
|
+
move(137.05, 204.874),
|
|
9307
|
+
line(254.527, 204.874),
|
|
9308
|
+
line(195.789, 103.136),
|
|
9309
|
+
move(137.05, 204.874),
|
|
9310
|
+
line(19.5737, 204.874),
|
|
9311
|
+
line(78.312, 103.136),
|
|
9312
|
+
move(137.05, 204.874),
|
|
9313
|
+
cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699),
|
|
9314
|
+
cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136),
|
|
9315
|
+
move(137.05, 204.874),
|
|
9316
|
+
cubic(137.05, 204.874, 176.2, 204.874, 195.789, 170.699),
|
|
9317
|
+
cubic(215.377, 136.525, 195.789, 103.136, 195.789, 103.136),
|
|
9318
|
+
move(195.789, 103.136),
|
|
9319
|
+
line(137.05, 1.39844),
|
|
9320
|
+
line(78.312, 103.136),
|
|
9321
|
+
move(195.789, 103.136),
|
|
9322
|
+
cubic(195.789, 103.136, 173.2, 71.1992, 137.05, 71.1992),
|
|
9323
|
+
cubic(100.9, 71.1992, 78.312, 103.136, 78.312, 103.136)
|
|
9324
|
+
)}" fill="none" stroke="${escapeAttr(primaryStroke)}" stroke-width="${strokeWidth}"/>`);
|
|
9325
|
+
push(`</g>`);
|
|
9326
|
+
}
|
|
9327
|
+
function renderWhiteRays(push, model) {
|
|
9328
|
+
const { center, rings, palette, scale } = model;
|
|
9329
|
+
const solarRadius = rings.solarCenter.r2;
|
|
9330
|
+
const sunCenterCircleRadiusWithPadding = 3 + 0.3;
|
|
9331
|
+
push(`<g id="archeometer-white-rays" aria-label="crown of white rays and musical staff">`);
|
|
9332
|
+
for (let degree = 0; degree < 180; degree += 30) {
|
|
9333
|
+
if (degree === 90 || degree === 270) continue;
|
|
9334
|
+
push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree)), palette.whiteRay, 1.55 * scale, 0.92));
|
|
9335
|
+
push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree + 180)), palette.whiteRay, 1.55 * scale, 0.92));
|
|
9336
|
+
}
|
|
9337
|
+
push(`</g>`);
|
|
9338
|
+
}
|
|
9339
|
+
function renderSolarCenter(push, model) {
|
|
9340
|
+
const { center, rings, palette, scale } = model;
|
|
9341
|
+
const r = rings.solarCenter.r2;
|
|
9342
|
+
const innerR = r * 0.68;
|
|
9343
|
+
const arcStart = polarToXY(center, innerR * 0.72, deg2rad(240));
|
|
9344
|
+
const arcEnd = polarToXY(center, innerR * 0.72, deg2rad(300));
|
|
9345
|
+
const paddingTop = 22;
|
|
9346
|
+
const sunCenterCircleRadius = 3;
|
|
9347
|
+
push(`<g id="archeometer-solar-center" aria-label="solar center Mi">`);
|
|
9348
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(r)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.2 * scale)}"/>`);
|
|
9349
|
+
push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y - 1.5, y2: center.y - 1.5 }, palette.whiteRay, 1.55 * scale, 0.92));
|
|
9350
|
+
push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y, y2: center.y }, palette.whiteRay, 1.55 * scale, 0.92));
|
|
9351
|
+
push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y + 1.5, y2: center.y + 1.5 }, palette.whiteRay, 1.55 * scale, 0.92));
|
|
9352
|
+
push(`<line x1="${fmt(center.x - innerR - 2.5)}" y1="${fmt(center.y + 8 + paddingTop)}" x2="${fmt(center.x + innerR + 2.5)}" y2="${fmt(center.y + 8 + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
9353
|
+
push(`<line x1="${fmt(center.x - innerR - 7.5)}" y1="${fmt(center.y + paddingTop)}" x2="${fmt(center.x + innerR + 7.5)}" y2="${fmt(center.y + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
9354
|
+
push(`<line x1="${fmt(center.x - innerR - 11)}" y1="${fmt(center.y - 8 + paddingTop)}" x2="${fmt(center.x + innerR + 11)}" y2="${fmt(center.y - 8 + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
9355
|
+
push(`<path d="M ${fmt(arcStart.x)} ${fmt(arcStart.y)} A ${fmt(innerR * 0.72)} ${fmt(innerR * 0.72)} 0 0 1 ${fmt(arcEnd.x)} ${fmt(arcEnd.y)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
9356
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(sunCenterCircleRadius)}" fill="${escapeAttr(palette.paper)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.5 * scale)}"/>`);
|
|
9357
|
+
push(`</g>`);
|
|
9358
|
+
}
|
|
9359
|
+
function renderFrame(push, model) {
|
|
9360
|
+
const { center, rings, palette, scale } = model;
|
|
9361
|
+
const radii = Array.from(
|
|
9362
|
+
new Map(
|
|
9363
|
+
[
|
|
9364
|
+
rings.degreeOuter.r2,
|
|
9365
|
+
rings.degreeOuter.r1,
|
|
9366
|
+
rings.degreeInner.r1,
|
|
9367
|
+
rings.zodiacUtterance.r1,
|
|
9368
|
+
rings.planetaryUtterance.r1,
|
|
9369
|
+
rings.cosmologicalMusic.r1,
|
|
9370
|
+
rings.astralZodiac.r1,
|
|
9371
|
+
rings.astralPlanetary.r1,
|
|
9372
|
+
rings.chromicRays.r1,
|
|
9373
|
+
rings.solarCenter.r2
|
|
9374
|
+
].map((radius) => [fmt(radius), radius])
|
|
9375
|
+
).values()
|
|
9376
|
+
);
|
|
9377
|
+
push(`<g id="archeometer-frame" aria-hidden="true">`);
|
|
9378
|
+
for (const radius of radii) {
|
|
9379
|
+
if (radius <= 0) continue;
|
|
9380
|
+
push(
|
|
9381
|
+
`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(radius)}" fill="none" stroke="${escapeAttr(
|
|
9382
|
+
palette.ringStroke
|
|
9383
|
+
)}" stroke-opacity="0.82" stroke-width="${fmt(0.85 * scale)}"/>`
|
|
9384
|
+
);
|
|
9385
|
+
}
|
|
9386
|
+
push(
|
|
9387
|
+
`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(
|
|
9388
|
+
rings.degreeOuter.r2
|
|
9389
|
+
)}" fill="none" stroke="${escapeAttr(palette.ringStroke)}" stroke-width="${fmt(2.2 * scale)}"/>`
|
|
9390
|
+
);
|
|
9391
|
+
push(`</g>`);
|
|
9392
|
+
}
|
|
9393
|
+
function buildRings(contentRadius, frameRadius = contentRadius) {
|
|
9394
|
+
const ring = (id2, r1, r2, radius = contentRadius) => ({
|
|
9395
|
+
id: id2,
|
|
9396
|
+
r1: round(radius * r1),
|
|
9397
|
+
r2: round(radius * r2)
|
|
9398
|
+
});
|
|
9399
|
+
return {
|
|
9400
|
+
degreeOuter: ring("degreeOuter", 0.955, 1, frameRadius),
|
|
9401
|
+
degreeInner: {
|
|
9402
|
+
id: "degreeInner",
|
|
9403
|
+
r1: round(contentRadius * 0.955),
|
|
9404
|
+
r2: round(frameRadius * 0.955)
|
|
9405
|
+
},
|
|
9406
|
+
zodiacUtterance: ring("zodiacUtterance", 0.8, 0.955),
|
|
9407
|
+
planetaryUtterance: ring("planetaryUtterance", 0.461, 0.8),
|
|
9408
|
+
cosmologicalMusic: ring("cosmologicalMusic", 0.395, 0.461),
|
|
9409
|
+
astralZodiac: ring("astralZodiac", 0.297, 0.395),
|
|
9410
|
+
astralPlanetary: ring("astralPlanetary", 0.198, 0.297),
|
|
9411
|
+
chromicRays: ring("chromicRays", 0.198, 0.395),
|
|
9412
|
+
whiteRays: ring("whiteRays", 0.12, 0.198),
|
|
9413
|
+
solarCenter: ring("solarCenter", 0, 0.099)
|
|
9414
|
+
};
|
|
9415
|
+
}
|
|
9416
|
+
function planetaryTriangleClipInnerRadius(rings) {
|
|
9417
|
+
return rings.planetaryUtterance.r1;
|
|
9418
|
+
}
|
|
9419
|
+
function planetaryTriangleClipOuterRadius(rings) {
|
|
9420
|
+
return rings.planetaryUtterance.r2;
|
|
9421
|
+
}
|
|
9422
|
+
function chromicCoreInnerRadius(rings) {
|
|
9423
|
+
return rings.solarCenter.r2;
|
|
9424
|
+
}
|
|
9425
|
+
function chromicCoreOuterRadius(rings) {
|
|
9426
|
+
return rings.whiteRays.r2;
|
|
9427
|
+
}
|
|
9428
|
+
function resolvePalette(palette) {
|
|
9429
|
+
const base = COLOR_PALETTE;
|
|
9430
|
+
const overrides = typeof palette === "object" ? palette : {};
|
|
9431
|
+
return {
|
|
9432
|
+
paper: overrides.paper ?? base.paper,
|
|
9433
|
+
ink: overrides.ink ?? base.ink,
|
|
9434
|
+
subtleInk: overrides.subtleInk ?? base.subtleInk,
|
|
9435
|
+
ringStroke: overrides.ringStroke ?? base.ringStroke,
|
|
9436
|
+
degreeTick: overrides.degreeTick ?? base.degreeTick,
|
|
9437
|
+
degreeLabel: overrides.degreeLabel ?? base.degreeLabel,
|
|
9438
|
+
whiteRay: overrides.whiteRay ?? base.whiteRay,
|
|
9439
|
+
ringFills: { ...base.ringFills, ...overrides.ringFills ?? {} }
|
|
9440
|
+
};
|
|
9441
|
+
}
|
|
9442
|
+
function normalizeViewBox(viewBox) {
|
|
9443
|
+
return {
|
|
9444
|
+
minX: viewBox?.minX ?? ARCHEOMETER_DEFAULT_VIEWBOX.minX,
|
|
9445
|
+
minY: viewBox?.minY ?? ARCHEOMETER_DEFAULT_VIEWBOX.minY,
|
|
9446
|
+
width: viewBox?.width ?? ARCHEOMETER_DEFAULT_VIEWBOX.width,
|
|
9447
|
+
height: viewBox?.height ?? ARCHEOMETER_DEFAULT_VIEWBOX.height
|
|
9448
|
+
};
|
|
9449
|
+
}
|
|
9450
|
+
function angleOf(model, degree) {
|
|
9451
|
+
return deg2rad(degree + model.rotationDegrees - 90);
|
|
9452
|
+
}
|
|
9453
|
+
function polarToXY(center, radius, angleRad) {
|
|
9454
|
+
return {
|
|
9455
|
+
x: round(center.x + Math.cos(angleRad) * radius),
|
|
9456
|
+
y: round(center.y + Math.sin(angleRad) * radius)
|
|
9457
|
+
};
|
|
9458
|
+
}
|
|
9459
|
+
function scaleArcheometerReferencePoint(center, radius, x, y) {
|
|
9460
|
+
const referenceCenter = 137.05;
|
|
9461
|
+
const referenceRadius = 135.652;
|
|
9462
|
+
const scale = radius / referenceRadius;
|
|
9463
|
+
return {
|
|
9464
|
+
x: round(center.x + (x - referenceCenter) * scale),
|
|
9465
|
+
y: round(center.y + (y - referenceCenter) * scale)
|
|
9466
|
+
};
|
|
9467
|
+
}
|
|
9468
|
+
function lineFromPolar(center, r1, r2, angleRad) {
|
|
9469
|
+
const p1 = polarToXY(center, r1, angleRad);
|
|
9470
|
+
const p2 = polarToXY(center, r2, angleRad);
|
|
9471
|
+
return { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };
|
|
9472
|
+
}
|
|
9473
|
+
function lineSvg(line, color, strokeWidth, opacity = 1, className, attributes = "") {
|
|
9474
|
+
const classAttr = className ? ` class="${escapeAttr(className)}"` : "";
|
|
9475
|
+
return `<line${classAttr}${attributes} x1="${fmt(line.x1)}" y1="${fmt(line.y1)}" x2="${fmt(line.x2)}" y2="${fmt(line.y2)}" stroke="${escapeAttr(color)}" stroke-opacity="${fmt(opacity)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round"/>`;
|
|
9476
|
+
}
|
|
9477
|
+
function textSvg(value, p, fontSize, color, rotation = 0, anchor = "middle", weight, className, attributes = "") {
|
|
9478
|
+
const transform = rotation ? ` transform="rotate(${fmt(rotation)} ${fmt(p.x)} ${fmt(p.y)})"` : "";
|
|
9479
|
+
const weightAttr = weight ? ` font-weight="${weight}"` : "";
|
|
9480
|
+
const classAttr = className ? ` class="${escapeAttr(className)}"` : "";
|
|
9481
|
+
return `<text${classAttr}${attributes} x="${fmt(p.x)}" y="${fmt(p.y)}"${transform} font-family="${textFontFamily()}" font-size="${fmt(fontSize)}" text-anchor="${anchor}" dominant-baseline="middle" fill="${escapeAttr(color)}"${weightAttr}>${escapeText(value)}</text>`;
|
|
9482
|
+
}
|
|
9483
|
+
function annulusPath(center, r1, r2) {
|
|
9484
|
+
return [
|
|
9485
|
+
`M ${fmt(center.x)} ${fmt(center.y - r2)}`,
|
|
9486
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y + r2)}`,
|
|
9487
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y - r2)}`,
|
|
9488
|
+
`M ${fmt(center.x)} ${fmt(center.y - r1)}`,
|
|
9489
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y + r1)}`,
|
|
9490
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y - r1)}`,
|
|
9491
|
+
`Z`
|
|
9492
|
+
].join(" ");
|
|
9493
|
+
}
|
|
9494
|
+
function annularSectorPath(center, r1, r2, startAngle, endAngle, spanDegrees) {
|
|
9495
|
+
const outerStart = polarToXY(center, r2, startAngle);
|
|
9496
|
+
const outerEnd = polarToXY(center, r2, endAngle);
|
|
9497
|
+
const innerEnd = polarToXY(center, r1, endAngle);
|
|
9498
|
+
const innerStart = polarToXY(center, r1, startAngle);
|
|
9499
|
+
const largeArc = Math.abs(spanDegrees) > 180 ? 1 : 0;
|
|
9500
|
+
const sweep = spanDegrees >= 0 ? 1 : 0;
|
|
9501
|
+
const inverseSweep = sweep ? 0 : 1;
|
|
9502
|
+
return [
|
|
9503
|
+
`M ${fmt(outerStart.x)} ${fmt(outerStart.y)}`,
|
|
9504
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 ${largeArc} ${sweep} ${fmt(outerEnd.x)} ${fmt(outerEnd.y)}`,
|
|
9505
|
+
`L ${fmt(innerEnd.x)} ${fmt(innerEnd.y)}`,
|
|
9506
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 ${largeArc} ${inverseSweep} ${fmt(innerStart.x)} ${fmt(innerStart.y)}`,
|
|
9507
|
+
`Z`
|
|
9508
|
+
].join(" ");
|
|
9509
|
+
}
|
|
9510
|
+
function arcSegmentPath(center, radius, startAngle, endAngle) {
|
|
9511
|
+
const start = polarToXY(center, radius, startAngle);
|
|
9512
|
+
const end = polarToXY(center, radius, endAngle);
|
|
9513
|
+
return `M ${fmt(start.x)} ${fmt(start.y)} A ${fmt(radius)} ${fmt(radius)} 0 0 1 ${fmt(end.x)} ${fmt(end.y)}`;
|
|
9514
|
+
}
|
|
9515
|
+
function polygonPath(points) {
|
|
9516
|
+
if (points.length === 0) return "";
|
|
9517
|
+
const [first, ...rest] = points;
|
|
9518
|
+
return [`M ${fmt(first.x)} ${fmt(first.y)}`, ...rest.map((p) => `L ${fmt(p.x)} ${fmt(p.y)}`), "Z"].join(" ");
|
|
9519
|
+
}
|
|
9520
|
+
function midpoint(a, b) {
|
|
9521
|
+
return { x: round((a.x + b.x) / 2), y: round((a.y + b.y) / 2) };
|
|
9522
|
+
}
|
|
9523
|
+
function polygonCentroid(points) {
|
|
9524
|
+
const total = points.reduce(
|
|
9525
|
+
(sum, point) => ({ x: sum.x + point.x, y: sum.y + point.y }),
|
|
9526
|
+
{ x: 0, y: 0 }
|
|
9527
|
+
);
|
|
9528
|
+
return { x: round(total.x / points.length), y: round(total.y / points.length) };
|
|
9529
|
+
}
|
|
9530
|
+
function sortedByDegree(items) {
|
|
9531
|
+
return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
|
|
9532
|
+
}
|
|
9533
|
+
function nearestUtterance(degree, utterance) {
|
|
9534
|
+
let best;
|
|
9535
|
+
let bestDelta = Number.POSITIVE_INFINITY;
|
|
9536
|
+
for (const point of utterance) {
|
|
9537
|
+
const delta = Math.abs(shortestAngularDistance(degree, point.degree));
|
|
9538
|
+
if (delta < bestDelta) {
|
|
9539
|
+
best = point;
|
|
9540
|
+
bestDelta = delta;
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9543
|
+
return best;
|
|
9544
|
+
}
|
|
9545
|
+
function triangleVertexFillForDegree(model, degree) {
|
|
9546
|
+
for (const triangle of model.triangles) {
|
|
9547
|
+
if (!triangle.vertexFills) continue;
|
|
9548
|
+
for (const [index, vertexDegree] of triangle.vertices.entries()) {
|
|
9549
|
+
if (Math.abs(shortestAngularDistance(degree, vertexDegree)) < 1e-3) {
|
|
9550
|
+
return triangle.vertexFills[index];
|
|
9551
|
+
}
|
|
9552
|
+
}
|
|
9553
|
+
}
|
|
9554
|
+
return void 0;
|
|
9555
|
+
}
|
|
9556
|
+
function tangentRotation(angleRad) {
|
|
9557
|
+
let degrees = rad2deg(angleRad) + 90;
|
|
9558
|
+
degrees = (degrees % 360 + 360) % 360;
|
|
9559
|
+
if (degrees > 90 && degrees < 270) degrees += 180;
|
|
9560
|
+
return (degrees % 360 + 360) % 360;
|
|
9561
|
+
}
|
|
9562
|
+
function shortestAngularDistance(a, b) {
|
|
9563
|
+
return (normalizeDegrees(a) - normalizeDegrees(b) + 540) % 360 - 180;
|
|
9564
|
+
}
|
|
9565
|
+
function normalizeDegrees(value) {
|
|
9566
|
+
return (value % 360 + 360) % 360;
|
|
9567
|
+
}
|
|
9568
|
+
function deg2rad(degrees) {
|
|
9569
|
+
return degrees * (TAU / 360);
|
|
9570
|
+
}
|
|
9571
|
+
function rad2deg(radians) {
|
|
9572
|
+
return radians * (360 / TAU);
|
|
9573
|
+
}
|
|
9574
|
+
function round(value) {
|
|
9575
|
+
return Math.round(value * 1e3) / 1e3;
|
|
9576
|
+
}
|
|
9577
|
+
function fmt(value) {
|
|
9578
|
+
if (!Number.isFinite(value)) return "0";
|
|
9579
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3).replace(/0+$/, "").replace(/\.$/, "");
|
|
9580
|
+
}
|
|
9581
|
+
function escapeAttr(value) {
|
|
9582
|
+
return escapeText(value).replace(/"/g, """);
|
|
9583
|
+
}
|
|
9584
|
+
function escapeText(value) {
|
|
9585
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
9586
|
+
}
|
|
9587
|
+
function textFontFamily() {
|
|
9588
|
+
return "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', 'Apple Symbols', sans-serif";
|
|
9589
|
+
}
|
|
9590
|
+
var TAU, ARCHEOMETER_DEFAULT_VIEWBOX, ARCHEOMETER_OUTER_CROWN_BLEED, DEFAULT_LAYERS, COLOR_RING_FILLS, COLOR_PALETTE, DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES, DEFAULT_ARCHEOMETER_UTTERANCE, DEFAULT_ARCHEOMETER_TRIANGLE_LABELS, DEFAULT_ARCHEOMETER_TRIANGLES, DEFAULT_ARCHEOMETER_MUSICAL_NOTES, DEFAULT_ARCHEOMETER_ZODIAC, DEFAULT_ARCHEOMETER_PLANETS, DEFAULT_ARCHETYPE_UTTERANCE, DEFAULT_ARCHETYPE_TRIANGLES, DEFAULT_ARCHETYPE_MUSICAL_NOTES, DEFAULT_ARCHETYPE_ZODIAC, DEFAULT_ARCHETYPE_PLANETS;
|
|
9591
|
+
var init_archeometer = __esm({
|
|
9592
|
+
"src/visual/archeometer.ts"() {
|
|
8932
9593
|
"use strict";
|
|
9594
|
+
TAU = Math.PI * 2;
|
|
9595
|
+
ARCHEOMETER_DEFAULT_VIEWBOX = {
|
|
9596
|
+
minX: 0,
|
|
9597
|
+
minY: 0,
|
|
9598
|
+
width: 912,
|
|
9599
|
+
height: 912
|
|
9600
|
+
};
|
|
9601
|
+
ARCHEOMETER_OUTER_CROWN_BLEED = 22;
|
|
9602
|
+
DEFAULT_LAYERS = {
|
|
9603
|
+
degreeCrown: true,
|
|
9604
|
+
zodiacUtterance: true,
|
|
9605
|
+
planetaryUtterance: true,
|
|
9606
|
+
cosmologicalMusic: true,
|
|
9607
|
+
astralZodiac: true,
|
|
9608
|
+
astralPlanetary: true,
|
|
9609
|
+
chromicRays: true,
|
|
9610
|
+
whiteRays: true,
|
|
9611
|
+
solarCenter: true
|
|
9612
|
+
};
|
|
9613
|
+
COLOR_RING_FILLS = {
|
|
9614
|
+
degreeOuter: "#fff8ef",
|
|
9615
|
+
degreeInner: "#fff2e1",
|
|
9616
|
+
zodiacUtterance: "#eba0be",
|
|
9617
|
+
planetaryUtterance: "#fffaf1",
|
|
9618
|
+
cosmologicalMusic: "#fffaf0",
|
|
9619
|
+
astralZodiac: "#efc0bc",
|
|
9620
|
+
astralPlanetary: "#d2e8df",
|
|
9621
|
+
chromicRays: "#fff3d4",
|
|
9622
|
+
whiteRays: "#eef1ec",
|
|
9623
|
+
solarCenter: "#f7d65b"
|
|
9624
|
+
};
|
|
9625
|
+
COLOR_PALETTE = {
|
|
9626
|
+
paper: "#fffaf1",
|
|
9627
|
+
ink: "#151515",
|
|
9628
|
+
subtleInk: "#605a54",
|
|
9629
|
+
ringStroke: "#171717",
|
|
9630
|
+
degreeTick: "#171717",
|
|
9631
|
+
degreeLabel: "#171717",
|
|
9632
|
+
whiteRay: "#25395a",
|
|
9633
|
+
ringFills: COLOR_RING_FILLS
|
|
9634
|
+
};
|
|
9635
|
+
DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES = [
|
|
9636
|
+
{
|
|
9637
|
+
degree: 0,
|
|
9638
|
+
utterance: { id: "ph", degree: 0, letter: "P, Ph", number: 80, color: "#f2d54c", triangleId: "wordJesus", gloss: "Utterance / light" },
|
|
9639
|
+
triangleLabel: { degree: 0, label: "S, Sh", number: 300 },
|
|
9640
|
+
musicalNote: { degree: 0, note: "Si" },
|
|
9641
|
+
zodiacSign: { degree: 0, name: "Capricorn", glyph: "\u2651" },
|
|
9642
|
+
planetaryPoint: { degree: 0, name: "Saturn", glyph: "\u2644", phase: "diurnal" }
|
|
9643
|
+
},
|
|
9644
|
+
{
|
|
9645
|
+
degree: 30,
|
|
9646
|
+
utterance: { id: "za", degree: 30, letter: "W, OU", number: 70, color: "#b7d56a", triangleId: "ether", gloss: "Ether" },
|
|
9647
|
+
triangleLabel: { degree: 30, label: "D", number: 4 },
|
|
9648
|
+
musicalNote: { degree: 30, note: "Do" },
|
|
9649
|
+
zodiacSign: { degree: 30, name: "Sagittarius", glyph: "\u2650" },
|
|
9650
|
+
planetaryPoint: { degree: 30, name: "Jupiter", glyph: "\u2643", phase: "diurnal" }
|
|
9651
|
+
},
|
|
9652
|
+
{
|
|
9653
|
+
degree: 60,
|
|
9654
|
+
utterance: { id: "ma", degree: 60, letter: "M", number: 40, color: "#79bf6a", triangleId: "mary", gloss: "Mary" },
|
|
9655
|
+
triangleLabel: { degree: 60, label: "C", number: 20 },
|
|
9656
|
+
musicalNote: { degree: 60, note: "R\xE9" },
|
|
9657
|
+
zodiacSign: { degree: 60, name: "Scorpio", glyph: "\u264F" },
|
|
9658
|
+
planetaryPoint: { degree: 60, name: "Mars", glyph: "\u2642", phase: "diurnal" }
|
|
9659
|
+
},
|
|
9660
|
+
{
|
|
9661
|
+
degree: 90,
|
|
9662
|
+
utterance: { id: "u", degree: 90, letter: "L", number: 30, color: "#69ad74", triangleId: "divineFire", gloss: "Fire" },
|
|
9663
|
+
triangleLabel: { degree: 90, label: "" },
|
|
9664
|
+
musicalNote: { degree: 90, note: "Mi" },
|
|
9665
|
+
zodiacSign: { degree: 90, name: "Libra", glyph: "\u264E" },
|
|
9666
|
+
planetaryPoint: { degree: 90, name: "Venus", glyph: "\u2640", phase: "diurnal" }
|
|
9667
|
+
},
|
|
9668
|
+
{
|
|
9669
|
+
degree: 120,
|
|
9670
|
+
utterance: { id: "o", degree: 120, letter: "I, Y, J", number: 10, color: "#efb83e", triangleId: "wordJesus", gloss: "Voice / sound" },
|
|
9671
|
+
triangleLabel: { degree: 120, label: "Ts", number: 90 },
|
|
9672
|
+
musicalNote: { degree: 120, note: "Fa" },
|
|
9673
|
+
zodiacSign: { degree: 120, name: "Virgo", glyph: "\u264D" },
|
|
9674
|
+
planetaryPoint: { degree: 120, name: "Mercury", glyph: "\u263F", phase: "diurnal" }
|
|
9675
|
+
},
|
|
9676
|
+
{
|
|
9677
|
+
degree: 150,
|
|
9678
|
+
utterance: { id: "la", degree: 150, letter: "T", number: 9, color: "#ec8d3f", triangleId: "ether", gloss: "Ether" },
|
|
9679
|
+
triangleLabel: { degree: 150, label: "N", number: 50 },
|
|
9680
|
+
musicalNote: { degree: 150, note: "Sol" },
|
|
9681
|
+
zodiacSign: { degree: 150, name: "Leo", glyph: "\u264C" },
|
|
9682
|
+
planetaryPoint: { degree: 150, name: "Sun", glyph: "\u2609", phase: "diurnal" }
|
|
9683
|
+
},
|
|
9684
|
+
{
|
|
9685
|
+
degree: 180,
|
|
9686
|
+
utterance: { id: "ri", degree: 180, letter: "E, H", number: 8, color: "#df4d43", triangleId: "mary", gloss: "Descending R" },
|
|
9687
|
+
triangleLabel: { degree: 180, label: "B", number: 2 },
|
|
9688
|
+
musicalNote: { degree: 180, note: "La" },
|
|
9689
|
+
zodiacSign: { degree: 180, name: "Cancer", glyph: "\u264B" },
|
|
9690
|
+
planetaryPoint: { degree: 180, name: "Moon", glyph: "\u263E", phase: "nocturnal" }
|
|
9691
|
+
},
|
|
9692
|
+
{
|
|
9693
|
+
degree: 210,
|
|
9694
|
+
utterance: { id: "t", degree: 210, letter: "Z", number: 7, color: "#8b54ad", triangleId: "divineFire", gloss: "Divine fire" },
|
|
9695
|
+
triangleLabel: { degree: 210, label: "Ts", number: 90 },
|
|
9696
|
+
musicalNote: { degree: 210, note: "Si" },
|
|
9697
|
+
zodiacSign: { degree: 210, name: "Gemini", glyph: "\u264A" },
|
|
9698
|
+
planetaryPoint: { degree: 210, name: "Mercury", glyph: "\u263F", phase: "nocturnal" }
|
|
9699
|
+
},
|
|
9700
|
+
{
|
|
9701
|
+
degree: 240,
|
|
9702
|
+
utterance: { id: "y", degree: 240, letter: "V, OU", number: 6, color: "#d85c43", triangleId: "wordJesus", gloss: "Word / JeShU" },
|
|
9703
|
+
triangleLabel: { degree: 240, label: "G", number: 3 },
|
|
9704
|
+
musicalNote: { degree: 240, note: "Do" },
|
|
9705
|
+
zodiacSign: { degree: 240, name: "Taurus", glyph: "\u2649" },
|
|
9706
|
+
planetaryPoint: { degree: 240, name: "Venus", glyph: "\u2640", phase: "nocturnal" }
|
|
9707
|
+
},
|
|
9708
|
+
{
|
|
9709
|
+
degree: 270,
|
|
9710
|
+
utterance: { id: "ka", degree: 270, letter: "H, E", number: 5, color: "#3c82c2", triangleId: "ether", gloss: "Etheric power" },
|
|
9711
|
+
triangleLabel: { degree: 270, label: "C", number: 20 },
|
|
9712
|
+
musicalNote: { degree: 270, note: "R\xE9" },
|
|
9713
|
+
zodiacSign: { degree: 270, name: "Aries", glyph: "\u2648" },
|
|
9714
|
+
planetaryPoint: { degree: 270, name: "Mars", glyph: "\u2642", phase: "nocturnal" }
|
|
9715
|
+
},
|
|
9716
|
+
{
|
|
9717
|
+
degree: 300,
|
|
9718
|
+
utterance: { id: "h", degree: 300, letter: "R", number: 200, color: "#d4579c", triangleId: "mary", gloss: "Living waters" },
|
|
9719
|
+
triangleLabel: { degree: 300, label: "D", number: 4 },
|
|
9720
|
+
musicalNote: { degree: 300, note: "Mi" },
|
|
9721
|
+
zodiacSign: { degree: 300, name: "Pisces", glyph: "\u2653" },
|
|
9722
|
+
planetaryPoint: { degree: 300, name: "Jupiter", glyph: "\u2643", phase: "nocturnal" }
|
|
9723
|
+
},
|
|
9724
|
+
{
|
|
9725
|
+
degree: 330,
|
|
9726
|
+
utterance: { id: "hou", degree: 330, letter: "K", number: 100, color: "#7963b8", triangleId: "divineFire", gloss: "Divine fire" },
|
|
9727
|
+
triangleLabel: { degree: 330, label: "S, Sh", number: 300 },
|
|
9728
|
+
musicalNote: { degree: 330, note: "Fa" },
|
|
9729
|
+
zodiacSign: { degree: 330, name: "Aquarius", glyph: "\u2652" },
|
|
9730
|
+
planetaryPoint: { degree: 330, name: "Saturn", glyph: "\u2644", phase: "nocturnal" }
|
|
9731
|
+
}
|
|
9732
|
+
];
|
|
9733
|
+
DEFAULT_ARCHEOMETER_UTTERANCE = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.utterance);
|
|
9734
|
+
DEFAULT_ARCHEOMETER_TRIANGLE_LABELS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.triangleLabel);
|
|
9735
|
+
DEFAULT_ARCHEOMETER_TRIANGLES = [
|
|
9736
|
+
{ id: "wordJesus", title: "Triangle of the Word / JeShU", phrase: "Y-PhO", apex: "north", vertices: [0, 120, 240], fill: "#f2cf45", vertexFills: ["#f2cf45", "#5470a5", "#dd3e38"], stroke: "#171717" },
|
|
9737
|
+
{ id: "mary", title: "Triangle of Mary / Living Waters", phrase: "Ma-Ri-H", apex: "south", vertices: [180, 300, 60], fill: "#e25b61", vertexFills: ["#cc58a1", "#f28a32", "#78bd79"], stroke: "#171717" },
|
|
9738
|
+
{ id: "ether", title: "Triangle of the Ether", phrase: "La-Ka-Za", apex: "west", vertices: [270, 30, 150], fill: "#78bd79", vertexFills: ["#e96836", "#b7bd58", "#8f69a3"], stroke: "#171717" },
|
|
9739
|
+
{ id: "divineFire", title: "Triangle of Divine Fire", phrase: "Hou-U-T", apex: "east", vertices: [90, 210, 330], fill: "#cc58a1", vertexFills: ["#63a890", "#d45375", "#f0b33f"], stroke: "#171717" }
|
|
9740
|
+
];
|
|
9741
|
+
DEFAULT_ARCHEOMETER_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.musicalNote);
|
|
9742
|
+
DEFAULT_ARCHEOMETER_ZODIAC = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.zodiacSign);
|
|
9743
|
+
DEFAULT_ARCHEOMETER_PLANETS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.planetaryPoint);
|
|
9744
|
+
DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
|
|
9745
|
+
DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
|
|
9746
|
+
DEFAULT_ARCHETYPE_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_MUSICAL_NOTES;
|
|
9747
|
+
DEFAULT_ARCHETYPE_ZODIAC = DEFAULT_ARCHEOMETER_ZODIAC;
|
|
9748
|
+
DEFAULT_ARCHETYPE_PLANETS = DEFAULT_ARCHEOMETER_PLANETS;
|
|
8933
9749
|
}
|
|
8934
9750
|
});
|
|
8935
9751
|
|
|
@@ -9193,6 +10009,13 @@ var init_astro_glyph_registry = __esm({
|
|
|
9193
10009
|
}
|
|
9194
10010
|
});
|
|
9195
10011
|
|
|
10012
|
+
// src/visual/astro-glyph-types.ts
|
|
10013
|
+
var init_astro_glyph_types = __esm({
|
|
10014
|
+
"src/visual/astro-glyph-types.ts"() {
|
|
10015
|
+
"use strict";
|
|
10016
|
+
}
|
|
10017
|
+
});
|
|
10018
|
+
|
|
9196
10019
|
// src/visual/astro-wheel.ts
|
|
9197
10020
|
function generateGlyphSvg(primitives, options = {}) {
|
|
9198
10021
|
const size = options.size ?? 48;
|
|
@@ -9207,10 +10030,10 @@ function generateGlyphSvg(primitives, options = {}) {
|
|
|
9207
10030
|
const push = (s) => lines.push(s);
|
|
9208
10031
|
push(`<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">`);
|
|
9209
10032
|
if (bg !== "transparent") {
|
|
9210
|
-
push(`<rect width="${size}" height="${size}" fill="${
|
|
10033
|
+
push(`<rect width="${size}" height="${size}" fill="${escapeAttr2(bg)}"/>`);
|
|
9211
10034
|
}
|
|
9212
10035
|
const glyphFill = bg === "transparent" ? "#fff" : bg;
|
|
9213
|
-
push(`<g transform="translate(${cx} ${cy}) scale(${
|
|
10036
|
+
push(`<g transform="translate(${cx} ${cy}) scale(${fmt2(scale)})" color="${escapeAttr2(color)}" fill="${escapeAttr2(fillVal)}" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(sw)}" stroke-linecap="round" stroke-linejoin="round">`);
|
|
9214
10037
|
renderGlyphPrimitives(push, primitives, { color, fill: fillVal, glyphFill });
|
|
9215
10038
|
push(`</g>`);
|
|
9216
10039
|
push(`</svg>`);
|
|
@@ -9222,39 +10045,41 @@ function generateAstroGlyphSvg(keyOrGlyph, options = {}) {
|
|
|
9222
10045
|
throw new Error(`Unknown astrology glyph: ${String(keyOrGlyph)}`);
|
|
9223
10046
|
}
|
|
9224
10047
|
const svg = generateGlyphSvg(glyph.primitives, options);
|
|
9225
|
-
return svg.replace("<svg ", `<svg data-astro-glyph="${
|
|
10048
|
+
return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
|
|
9226
10049
|
}
|
|
9227
10050
|
function getAstroWheelRenderModel(chart, options = {}) {
|
|
9228
|
-
const viewBox =
|
|
9229
|
-
const palette =
|
|
10051
|
+
const viewBox = normalizeViewBox2(options.viewBox);
|
|
10052
|
+
const palette = resolvePalette2(options.palette, options.background ?? "transparent");
|
|
9230
10053
|
const excludedBodies = resolveExcludedBodies(options.excludeBodies);
|
|
9231
10054
|
const scale = Math.min(
|
|
9232
10055
|
viewBox.width / ASTRO_WHEEL_DEFAULT_VIEWBOX.width,
|
|
9233
10056
|
viewBox.height / ASTRO_WHEEL_DEFAULT_VIEWBOX.height
|
|
9234
10057
|
);
|
|
9235
|
-
const padding = options.padding ??
|
|
10058
|
+
const padding = options.padding ?? round2(18 * scale + getExternalPointPadding(options, scale));
|
|
9236
10059
|
const center = {
|
|
9237
|
-
x:
|
|
9238
|
-
y:
|
|
10060
|
+
x: round2(viewBox.minX + viewBox.width / 2),
|
|
10061
|
+
y: round2(viewBox.minY + viewBox.height / 2)
|
|
9239
10062
|
};
|
|
9240
|
-
const outerRadius =
|
|
9241
|
-
const
|
|
9242
|
-
const rings =
|
|
10063
|
+
const outerRadius = round2(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
10064
|
+
const angleOf2 = (longitude) => deg2rad2(clamp360(180 + chart.houses.ascendant.longitude - longitude));
|
|
10065
|
+
const rings = buildRings2(outerRadius, options.layout?.rings);
|
|
10066
|
+
const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
|
|
10067
|
+
const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
|
|
9243
10068
|
const resolvedPoints = resolvePointOptions(options.points);
|
|
9244
10069
|
const resolvedHouses = resolveHouseOptions(options.houses);
|
|
9245
10070
|
const resolvedAspects = resolveAspectOptions(options.aspects);
|
|
9246
|
-
const zodiacSegments = buildZodiacSegments({ center, angleOf, rings, scale, palette });
|
|
10071
|
+
const zodiacSegments = buildZodiacSegments({ center, angleOf: angleOf2, rings, scale, palette });
|
|
9247
10072
|
const houseCusps = resolvedHouses.cuspLines || resolvedHouses.labels ? buildHouseCusps({
|
|
9248
10073
|
houses: chart.houses.houses,
|
|
9249
10074
|
center,
|
|
9250
|
-
angleOf,
|
|
10075
|
+
angleOf: angleOf2,
|
|
9251
10076
|
rings,
|
|
9252
10077
|
scale
|
|
9253
10078
|
}) : [];
|
|
9254
10079
|
const angleMarkers = resolvedHouses.angles ? buildAngleMarkers({
|
|
9255
10080
|
chart,
|
|
9256
10081
|
center,
|
|
9257
|
-
angleOf,
|
|
10082
|
+
angleOf: angleOf2,
|
|
9258
10083
|
rings,
|
|
9259
10084
|
scale
|
|
9260
10085
|
}) : [];
|
|
@@ -9271,21 +10096,25 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
9271
10096
|
collisionThresholdDegrees: resolvedPoints.collisionThresholdDegrees
|
|
9272
10097
|
},
|
|
9273
10098
|
center,
|
|
9274
|
-
angleOf,
|
|
10099
|
+
angleOf: angleOf2,
|
|
9275
10100
|
rings,
|
|
9276
10101
|
scale,
|
|
9277
10102
|
palette,
|
|
9278
|
-
excludedBodies
|
|
10103
|
+
excludedBodies,
|
|
10104
|
+
pointConnectorMode,
|
|
10105
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
9279
10106
|
});
|
|
9280
10107
|
const extraPointLayers = (options.pointLayers ?? []).map(
|
|
9281
10108
|
(layer) => buildPointLayer({
|
|
9282
10109
|
layer,
|
|
9283
10110
|
center,
|
|
9284
|
-
angleOf,
|
|
10111
|
+
angleOf: angleOf2,
|
|
9285
10112
|
rings,
|
|
9286
10113
|
scale,
|
|
9287
10114
|
palette,
|
|
9288
|
-
excludedBodies
|
|
10115
|
+
excludedBodies,
|
|
10116
|
+
pointConnectorMode,
|
|
10117
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
9289
10118
|
})
|
|
9290
10119
|
);
|
|
9291
10120
|
const pointLayers = [
|
|
@@ -9305,7 +10134,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
9305
10134
|
chart,
|
|
9306
10135
|
pointByKey,
|
|
9307
10136
|
center,
|
|
9308
|
-
angleOf,
|
|
10137
|
+
angleOf: angleOf2,
|
|
9309
10138
|
rings,
|
|
9310
10139
|
palette,
|
|
9311
10140
|
excludedBodies
|
|
@@ -9316,7 +10145,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
9316
10145
|
chart: layer.chart ?? chart,
|
|
9317
10146
|
pointByKey,
|
|
9318
10147
|
center,
|
|
9319
|
-
angleOf,
|
|
10148
|
+
angleOf: angleOf2,
|
|
9320
10149
|
rings,
|
|
9321
10150
|
palette,
|
|
9322
10151
|
excludedBodies
|
|
@@ -9355,19 +10184,19 @@ function generateAstroWheelSvg(chart, options = {}) {
|
|
|
9355
10184
|
const push = (line) => lines.push(line);
|
|
9356
10185
|
const svgAttributes = [
|
|
9357
10186
|
`xmlns="http://www.w3.org/2000/svg"`,
|
|
9358
|
-
options.width !== void 0 ? `width="${
|
|
9359
|
-
options.height !== void 0 ? `height="${
|
|
9360
|
-
`viewBox="${
|
|
10187
|
+
options.width !== void 0 ? `width="${escapeAttr2(String(options.width))}"` : "",
|
|
10188
|
+
options.height !== void 0 ? `height="${escapeAttr2(String(options.height))}"` : "",
|
|
10189
|
+
`viewBox="${fmt2(viewBox.minX)} ${fmt2(viewBox.minY)} ${fmt2(viewBox.width)} ${fmt2(viewBox.height)}"`,
|
|
9361
10190
|
`preserveAspectRatio="xMidYMid meet"`,
|
|
9362
10191
|
`role="img"`,
|
|
9363
|
-
`aria-label="${
|
|
10192
|
+
`aria-label="${escapeAttr2(options.title ?? "Astrological birth chart wheel")}"`
|
|
9364
10193
|
].filter(Boolean);
|
|
9365
10194
|
push(`<svg ${svgAttributes.join(" ")}>`);
|
|
9366
|
-
push(`<title>${
|
|
10195
|
+
push(`<title>${escapeText2(options.title ?? "Astrological birth chart wheel")}</title>`);
|
|
9367
10196
|
renderSvgDefs(push, model);
|
|
9368
10197
|
if (background !== "transparent") {
|
|
9369
10198
|
push(
|
|
9370
|
-
`<rect x="${
|
|
10199
|
+
`<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
|
|
9371
10200
|
);
|
|
9372
10201
|
}
|
|
9373
10202
|
renderAspects(push, model);
|
|
@@ -9384,10 +10213,10 @@ function renderSvgDefs(push, model) {
|
|
|
9384
10213
|
`<filter id="${GLYPH_OUTLINE_FILTER_ID}" x="-45%" y="-45%" width="190%" height="190%">`
|
|
9385
10214
|
);
|
|
9386
10215
|
push(
|
|
9387
|
-
`<feMorphology in="SourceAlpha" operator="dilate" radius="${
|
|
10216
|
+
`<feMorphology in="SourceAlpha" operator="dilate" radius="${fmt2(1.75 * model.scale)}" result="dilated"/>`
|
|
9388
10217
|
);
|
|
9389
10218
|
push(
|
|
9390
|
-
`<feFlood flood-color="${
|
|
10219
|
+
`<feFlood flood-color="${escapeAttr2(model.palette.glyphHalo)}" result="haloColor"/>`
|
|
9391
10220
|
);
|
|
9392
10221
|
push(
|
|
9393
10222
|
`<feComposite in="haloColor" in2="dilated" operator="in" result="outline"/>`
|
|
@@ -9407,22 +10236,22 @@ function renderAspects(push, model) {
|
|
|
9407
10236
|
const innerGuideRadius = guideRadius * 0.52;
|
|
9408
10237
|
push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
|
|
9409
10238
|
push(
|
|
9410
|
-
`<circle cx="${
|
|
10239
|
+
`<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)}"/>`
|
|
9411
10240
|
);
|
|
9412
10241
|
push(
|
|
9413
|
-
`<circle cx="${
|
|
10242
|
+
`<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)}"/>`
|
|
9414
10243
|
);
|
|
9415
10244
|
for (const layer of model.aspectLayers) {
|
|
9416
|
-
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${
|
|
10245
|
+
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
9417
10246
|
for (const aspect of layer.aspectLines) {
|
|
9418
10247
|
push(
|
|
9419
|
-
`<line data-aspect-layer="${
|
|
10248
|
+
`<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"/>`
|
|
9420
10249
|
);
|
|
9421
10250
|
}
|
|
9422
10251
|
push(`</g>`);
|
|
9423
10252
|
}
|
|
9424
10253
|
push(
|
|
9425
|
-
`<circle cx="${
|
|
10254
|
+
`<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(4 * model.scale)}" fill="${escapeAttr2(model.palette.aspectGuide)}" fill-opacity="0.75" stroke="none"/>`
|
|
9426
10255
|
);
|
|
9427
10256
|
push(`</g>`);
|
|
9428
10257
|
}
|
|
@@ -9433,12 +10262,12 @@ function renderZodiac(push, model, options) {
|
|
|
9433
10262
|
const tickEvery = 1;
|
|
9434
10263
|
const { center, rings, palette, scale } = model;
|
|
9435
10264
|
const thickness = rings.zodiac.r2 - rings.zodiac.r1;
|
|
9436
|
-
const
|
|
10265
|
+
const angleOf2 = (longitude) => deg2rad2(clamp360(180 + model.ascendantLongitude - longitude));
|
|
9437
10266
|
push(`<g id="astro-wheel-zodiac" aria-label="zodiac">`);
|
|
9438
10267
|
if (options.segments) {
|
|
9439
10268
|
for (const segment of model.zodiacSegments) {
|
|
9440
10269
|
push(
|
|
9441
|
-
`<path data-zodiac-sign="${
|
|
10270
|
+
`<path data-zodiac-sign="${escapeAttr2(segment.sign)}" data-zodiac-element="${escapeAttr2(segment.element)}" d="${segment.path}" fill="${escapeAttr2(segment.fill)}" fill-opacity="0.82" stroke="${escapeAttr2(palette.zodiacStroke)}" stroke-width="${fmt2(model.scale)}"/>`
|
|
9442
10271
|
);
|
|
9443
10272
|
}
|
|
9444
10273
|
}
|
|
@@ -9451,17 +10280,17 @@ function renderZodiac(push, model, options) {
|
|
|
9451
10280
|
for (let index = 0; index < 360 / tickEvery; index++) {
|
|
9452
10281
|
const longitude = index * tickEvery;
|
|
9453
10282
|
const signDegree = longitude % 30;
|
|
9454
|
-
const angle =
|
|
10283
|
+
const angle = angleOf2(longitude);
|
|
9455
10284
|
const isSignBoundary = signDegree === 0;
|
|
9456
10285
|
const isTen = signDegree % 10 === 0;
|
|
9457
10286
|
const isFive = signDegree % 5 === 0;
|
|
9458
10287
|
const length = isSignBoundary ? thickness * 0.58 : isTen ? thickness * 0.42 : isFive ? thickness * 0.29 : thickness * 0.18;
|
|
9459
10288
|
const strokeWidth = isSignBoundary ? 2.2 * scale : isTen ? 1.55 * scale : isFive ? 1.1 * scale : 0.75 * scale;
|
|
9460
10289
|
const opacity = isSignBoundary ? 0.95 : isFive ? 0.82 : 0.62;
|
|
9461
|
-
const inner =
|
|
9462
|
-
const outer =
|
|
10290
|
+
const inner = polarToXY2(center.x, center.y, rings.zodiac.r2 - length, angle);
|
|
10291
|
+
const outer = polarToXY2(center.x, center.y, rings.zodiac.r2, angle);
|
|
9463
10292
|
push(
|
|
9464
|
-
`<line data-zodiac-tick="${longitude}" x1="${
|
|
10293
|
+
`<line data-zodiac-tick="${longitude}" x1="${fmt2(inner.x)}" y1="${fmt2(inner.y)}" x2="${fmt2(outer.x)}" y2="${fmt2(outer.y)}" stroke="${escapeAttr2(palette.zodiacStroke)}" stroke-opacity="${fmt2(opacity)}" stroke-width="${fmt2(strokeWidth)}"/>`
|
|
9465
10294
|
);
|
|
9466
10295
|
}
|
|
9467
10296
|
}
|
|
@@ -9472,9 +10301,9 @@ function renderZodiacGlyph(push, segment, palette) {
|
|
|
9472
10301
|
const glyphScale = segment.labelFontSize * 0.72;
|
|
9473
10302
|
const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
|
|
9474
10303
|
push(
|
|
9475
|
-
`<g class="astro-wheel-glyph" data-astro-glyph="${
|
|
10304
|
+
`<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr2(segment.sign)}" data-zodiac-symbol="${escapeAttr2(segment.glyph)}" transform="translate(${fmt2(segment.labelPosition.x)} ${fmt2(segment.labelPosition.y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(palette.zodiacGlyph)}" fill="none" stroke="${escapeAttr2(palette.zodiacGlyph)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
9476
10305
|
);
|
|
9477
|
-
push(`<title>${
|
|
10306
|
+
push(`<title>${escapeText2(`${segment.sign} ${segment.glyph}`)}</title>`);
|
|
9478
10307
|
renderGlyphPrimitives(push, glyph.primitives, { color: palette.zodiacGlyph });
|
|
9479
10308
|
push(`</g>`);
|
|
9480
10309
|
}
|
|
@@ -9487,14 +10316,14 @@ function renderHouses(push, model, options) {
|
|
|
9487
10316
|
for (const cusp of model.houseCusps) {
|
|
9488
10317
|
const isAngleHouse = cusp.house === 1 || cusp.house === 4 || cusp.house === 7 || cusp.house === 10;
|
|
9489
10318
|
push(
|
|
9490
|
-
`<line data-house-cusp="${cusp.house}" x1="${
|
|
10319
|
+
`<line data-house-cusp="${cusp.house}" x1="${fmt2(cusp.line.x1)}" y1="${fmt2(cusp.line.y1)}" x2="${fmt2(cusp.line.x2)}" y2="${fmt2(cusp.line.y2)}" stroke="${escapeAttr2(model.palette.houseLine)}" stroke-opacity="${fmt2(isAngleHouse ? 0.72 : 0.42)}" stroke-width="${fmt2(isAngleHouse ? 1.8 * model.scale : 0.95 * model.scale)}"/>`
|
|
9491
10320
|
);
|
|
9492
10321
|
}
|
|
9493
10322
|
}
|
|
9494
10323
|
if (options.labels) {
|
|
9495
10324
|
for (const cusp of model.houseCusps) {
|
|
9496
10325
|
push(
|
|
9497
|
-
`<text data-house-label="${cusp.house}" x="${
|
|
10326
|
+
`<text data-house-label="${cusp.house}" x="${fmt2(cusp.labelPosition.x)}" y="${fmt2(cusp.labelPosition.y)}" font-family="${textFontFamily2()}" font-size="${fmt2(cusp.labelFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(model.palette.houseLabel)}">${cusp.house}</text>`
|
|
9498
10327
|
);
|
|
9499
10328
|
}
|
|
9500
10329
|
}
|
|
@@ -9502,7 +10331,7 @@ function renderHouses(push, model, options) {
|
|
|
9502
10331
|
for (const marker of model.angleMarkers) {
|
|
9503
10332
|
push(`<g data-angle-marker="${marker.key}">`);
|
|
9504
10333
|
push(
|
|
9505
|
-
`<line x1="${
|
|
10334
|
+
`<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)}"/>`
|
|
9506
10335
|
);
|
|
9507
10336
|
push(`</g>`);
|
|
9508
10337
|
}
|
|
@@ -9518,18 +10347,22 @@ function renderPlanets(push, model) {
|
|
|
9518
10347
|
renderPointLayerGuide(push, layer, model);
|
|
9519
10348
|
}
|
|
9520
10349
|
for (const layer of model.pointLayers) {
|
|
9521
|
-
push(`<g class="astro-wheel-point-layer" data-point-layer="${
|
|
10350
|
+
push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
9522
10351
|
for (const point of layer.points) {
|
|
9523
10352
|
push(
|
|
9524
|
-
`<g class="astro-wheel-point" data-point-layer="${
|
|
10353
|
+
`<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)}">`
|
|
9525
10354
|
);
|
|
9526
|
-
push(`<title>${
|
|
10355
|
+
push(`<title>${escapeText2(point.name)} ${fmt2(point.longitude)}\xB0</title>`);
|
|
9527
10356
|
push(
|
|
9528
|
-
`<line x1="${
|
|
10357
|
+
`<line x1="${fmt2(point.tickLine.x1)}" y1="${fmt2(point.tickLine.y1)}" x2="${fmt2(point.tickLine.x2)}" y2="${fmt2(point.tickLine.y2)}" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.82" stroke-width="${fmt2(model.scale)}" stroke-linecap="round"/>`
|
|
9529
10358
|
);
|
|
9530
|
-
if (point.
|
|
10359
|
+
if (point.leaderArc) {
|
|
10360
|
+
push(
|
|
10361
|
+
`<path class="astro-wheel-point-leader" d="${escapeAttr2(point.leaderArc.path)}" fill="none" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt2(0.9 * model.scale)}" stroke-linecap="round" stroke-linejoin="round"/>`
|
|
10362
|
+
);
|
|
10363
|
+
} else if (point.leaderLine) {
|
|
9531
10364
|
push(
|
|
9532
|
-
`<line class="astro-wheel-point-leader" x1="${
|
|
10365
|
+
`<line class="astro-wheel-point-leader" x1="${fmt2(point.leaderLine.x1)}" y1="${fmt2(point.leaderLine.y1)}" x2="${fmt2(point.leaderLine.x2)}" y2="${fmt2(point.leaderLine.y2)}" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt2(0.9 * model.scale)}" stroke-linecap="round"/>`
|
|
9533
10366
|
);
|
|
9534
10367
|
}
|
|
9535
10368
|
push(`</g>`);
|
|
@@ -9544,7 +10377,7 @@ function renderPointLayerGuide(push, layer, model) {
|
|
|
9544
10377
|
return;
|
|
9545
10378
|
}
|
|
9546
10379
|
push(
|
|
9547
|
-
`<circle class="astro-wheel-external-point-ring" data-point-layer="${
|
|
10380
|
+
`<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)}"/>`
|
|
9548
10381
|
);
|
|
9549
10382
|
}
|
|
9550
10383
|
function renderGlyphOverlay(push, model) {
|
|
@@ -9562,7 +10395,7 @@ function renderGlyphOverlay(push, model) {
|
|
|
9562
10395
|
if (model.pointLayers.length > 0) {
|
|
9563
10396
|
push(`<g id="astro-wheel-point-glyphs" aria-label="planet glyphs">`);
|
|
9564
10397
|
for (const layer of model.pointLayers) {
|
|
9565
|
-
push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${
|
|
10398
|
+
push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
|
|
9566
10399
|
for (const point of layer.points) {
|
|
9567
10400
|
renderPointLabelGroup(push, point, model);
|
|
9568
10401
|
}
|
|
@@ -9589,14 +10422,14 @@ function renderAngleGlyph(push, marker, model) {
|
|
|
9589
10422
|
const signX = degreeX + degreeWidth + gap + signScale / 2;
|
|
9590
10423
|
const minutesX = signX + signScale / 2 + gap;
|
|
9591
10424
|
push(
|
|
9592
|
-
`<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${
|
|
10425
|
+
`<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})">`
|
|
9593
10426
|
);
|
|
9594
|
-
push(`<title>${
|
|
10427
|
+
push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
|
|
9595
10428
|
push(
|
|
9596
|
-
`<text class="astro-wheel-angle-label" x="${
|
|
10429
|
+
`<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>`
|
|
9597
10430
|
);
|
|
9598
10431
|
push(
|
|
9599
|
-
`<text class="astro-wheel-angle-degree" x="${
|
|
10432
|
+
`<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>`
|
|
9600
10433
|
);
|
|
9601
10434
|
renderInlineSignGlyph(
|
|
9602
10435
|
push,
|
|
@@ -9607,7 +10440,7 @@ function renderAngleGlyph(push, marker, model) {
|
|
|
9607
10440
|
model.palette.angleLabel
|
|
9608
10441
|
);
|
|
9609
10442
|
push(
|
|
9610
|
-
`<text class="astro-wheel-angle-minutes" x="${
|
|
10443
|
+
`<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>`
|
|
9611
10444
|
);
|
|
9612
10445
|
push(`</g>`);
|
|
9613
10446
|
}
|
|
@@ -9618,11 +10451,11 @@ function angleDisplayLabel(key) {
|
|
|
9618
10451
|
}
|
|
9619
10452
|
function renderPointLabelGroup(push, point, model) {
|
|
9620
10453
|
const layout = getPointLabelLayout(point, model.scale);
|
|
9621
|
-
const boundsAttr = point.labelBounds ? ` data-label-bounds="${
|
|
10454
|
+
const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
|
|
9622
10455
|
push(
|
|
9623
|
-
`<g class="astro-wheel-point-label" data-point-layer="${
|
|
10456
|
+
`<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})">`
|
|
9624
10457
|
);
|
|
9625
|
-
push(`<title>${
|
|
10458
|
+
push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
|
|
9626
10459
|
renderPointGlyph(push, point, layout.glyphX, layout.glyphY, layout.glyphScale, model.palette.glyphHalo);
|
|
9627
10460
|
if (point.retrograde) {
|
|
9628
10461
|
renderRetrogradeMarker(
|
|
@@ -9641,13 +10474,13 @@ function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
|
|
|
9641
10474
|
if (glyph) {
|
|
9642
10475
|
const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
|
|
9643
10476
|
push(
|
|
9644
|
-
`<g class="astro-wheel-glyph" data-astro-glyph="${
|
|
10477
|
+
`<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-point-glyph="${escapeAttr2(point.name)}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(point.color)}" fill="none" stroke="${escapeAttr2(point.color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
9645
10478
|
);
|
|
9646
10479
|
renderGlyphPrimitives(push, glyph.primitives, { color: point.color, glyphFill });
|
|
9647
10480
|
push(`</g>`);
|
|
9648
10481
|
} else {
|
|
9649
10482
|
push(
|
|
9650
|
-
`<text class="astro-wheel-glyph" data-point-glyph="${
|
|
10483
|
+
`<text class="astro-wheel-glyph" data-point-glyph="${escapeAttr2(point.name)}" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(point.glyphFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(point.color)}">${escapeText2(point.glyph)}</text>`
|
|
9651
10484
|
);
|
|
9652
10485
|
}
|
|
9653
10486
|
}
|
|
@@ -9657,14 +10490,14 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
|
|
|
9657
10490
|
const glyphScale = fontSize * 0.62;
|
|
9658
10491
|
const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
|
|
9659
10492
|
push(
|
|
9660
|
-
`<g class="astro-wheel-point-retrograde" data-astro-glyph="${
|
|
10493
|
+
`<g class="astro-wheel-point-retrograde" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(color)}" fill="none" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
9661
10494
|
);
|
|
9662
10495
|
renderGlyphPrimitives(push, glyph.primitives, { color });
|
|
9663
10496
|
push(`</g>`);
|
|
9664
10497
|
return;
|
|
9665
10498
|
}
|
|
9666
10499
|
push(
|
|
9667
|
-
`<text class="astro-wheel-point-retrograde" x="${
|
|
10500
|
+
`<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>`
|
|
9668
10501
|
);
|
|
9669
10502
|
}
|
|
9670
10503
|
function renderPointInlineDegreeLabel(push, point, layout) {
|
|
@@ -9672,11 +10505,11 @@ function renderPointInlineDegreeLabel(push, point, layout) {
|
|
|
9672
10505
|
return;
|
|
9673
10506
|
}
|
|
9674
10507
|
push(
|
|
9675
|
-
`<text class="astro-wheel-point-degree" x="${
|
|
10508
|
+
`<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>`
|
|
9676
10509
|
);
|
|
9677
10510
|
renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
|
|
9678
10511
|
push(
|
|
9679
|
-
`<text class="astro-wheel-point-minutes" x="${
|
|
10512
|
+
`<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>`
|
|
9680
10513
|
);
|
|
9681
10514
|
}
|
|
9682
10515
|
function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
@@ -9684,14 +10517,14 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
|
9684
10517
|
if (glyph) {
|
|
9685
10518
|
const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
|
|
9686
10519
|
push(
|
|
9687
|
-
`<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${
|
|
10520
|
+
`<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr2(sign)}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(color)}" fill="none" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
9688
10521
|
);
|
|
9689
10522
|
renderGlyphPrimitives(push, glyph.primitives, { color });
|
|
9690
10523
|
push(`</g>`);
|
|
9691
10524
|
return;
|
|
9692
10525
|
}
|
|
9693
10526
|
push(
|
|
9694
|
-
`<text class="astro-wheel-point-sign-glyph" x="${
|
|
10527
|
+
`<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>`
|
|
9695
10528
|
);
|
|
9696
10529
|
}
|
|
9697
10530
|
function getPointLabelLayout(point, scale) {
|
|
@@ -9793,7 +10626,7 @@ function formatInlinePosition(position) {
|
|
|
9793
10626
|
function pointLabelTitle(point) {
|
|
9794
10627
|
const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
|
|
9795
10628
|
if (!position) {
|
|
9796
|
-
return `${point.name} ${
|
|
10629
|
+
return `${point.name} ${fmt2(point.longitude)}\xB0`;
|
|
9797
10630
|
}
|
|
9798
10631
|
const retrograde = point.retrograde ? " Rx" : "";
|
|
9799
10632
|
return `${point.name} ${position.degreesText} ${position.sign} ${position.minutesText}${retrograde}`;
|
|
@@ -9805,10 +10638,10 @@ function labelBoundsFor(position, layout, padding) {
|
|
|
9805
10638
|
const width = layout.width + padding * 2;
|
|
9806
10639
|
const height = layout.height + padding * 2;
|
|
9807
10640
|
return {
|
|
9808
|
-
x:
|
|
9809
|
-
y:
|
|
9810
|
-
width:
|
|
9811
|
-
height:
|
|
10641
|
+
x: round2(position.x + layout.boundsX - padding),
|
|
10642
|
+
y: round2(position.y + layout.boundsY - padding),
|
|
10643
|
+
width: round2(width),
|
|
10644
|
+
height: round2(height)
|
|
9812
10645
|
};
|
|
9813
10646
|
}
|
|
9814
10647
|
function constrainLabelInsideCircle(params) {
|
|
@@ -9832,8 +10665,8 @@ function constrainLabelInsideCircle(params) {
|
|
|
9832
10665
|
const dy = position.y - center.y;
|
|
9833
10666
|
const distance = Math.max(Math.hypot(dx, dy), 1);
|
|
9834
10667
|
position = {
|
|
9835
|
-
x:
|
|
9836
|
-
y:
|
|
10668
|
+
x: round2(position.x - dx / distance * (overflow + 0.75)),
|
|
10669
|
+
y: round2(position.y - dy / distance * (overflow + 0.75))
|
|
9837
10670
|
};
|
|
9838
10671
|
moved = true;
|
|
9839
10672
|
}
|
|
@@ -9858,7 +10691,7 @@ function labelBoundsCircleOverflow(center, bounds, maxRadius) {
|
|
|
9858
10691
|
return farthestCorner - maxRadius;
|
|
9859
10692
|
}
|
|
9860
10693
|
function formatLabelBounds(bounds) {
|
|
9861
|
-
return `${
|
|
10694
|
+
return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
|
|
9862
10695
|
}
|
|
9863
10696
|
function projectedLabelWidthAlongTangent(angleRad, bounds) {
|
|
9864
10697
|
const tangentX = -Math.sin(angleRad);
|
|
@@ -9880,11 +10713,11 @@ function getExternalPointPadding(options, scale) {
|
|
|
9880
10713
|
);
|
|
9881
10714
|
}
|
|
9882
10715
|
function buildZodiacSegments(params) {
|
|
9883
|
-
const { center, angleOf, rings, scale, palette } = params;
|
|
10716
|
+
const { center, angleOf: angleOf2, rings, scale, palette } = params;
|
|
9884
10717
|
const boundaries = unwrapAngles(
|
|
9885
10718
|
Array.from(
|
|
9886
10719
|
{ length: ASTRO_WHEEL_ZODIAC_SIGNS.length + 1 },
|
|
9887
|
-
(_, index) =>
|
|
10720
|
+
(_, index) => angleOf2(index * 30)
|
|
9888
10721
|
),
|
|
9889
10722
|
"dec"
|
|
9890
10723
|
);
|
|
@@ -9893,11 +10726,11 @@ function buildZodiacSegments(params) {
|
|
|
9893
10726
|
return ASTRO_WHEEL_ZODIAC_SIGNS.map((entry, index) => {
|
|
9894
10727
|
const angleStart = boundaries[index];
|
|
9895
10728
|
const angleEnd = boundaries[index + 1];
|
|
9896
|
-
const labelPosition =
|
|
10729
|
+
const labelPosition = polarToXY2(
|
|
9897
10730
|
center.x,
|
|
9898
10731
|
center.y,
|
|
9899
10732
|
(rings.zodiac.r1 + rings.zodiac.r2) / 2,
|
|
9900
|
-
|
|
10733
|
+
angleOf2(index * 30 + 15)
|
|
9901
10734
|
);
|
|
9902
10735
|
return {
|
|
9903
10736
|
sign: entry.sign,
|
|
@@ -9915,14 +10748,14 @@ function buildZodiacSegments(params) {
|
|
|
9915
10748
|
});
|
|
9916
10749
|
}
|
|
9917
10750
|
function buildHouseCusps(params) {
|
|
9918
|
-
const { houses, center, angleOf, rings, scale } = params;
|
|
10751
|
+
const { houses, center, angleOf: angleOf2, rings, scale } = params;
|
|
9919
10752
|
const ring = rings.houses;
|
|
9920
10753
|
const spokeInnerRadius = rings.aspects.r2;
|
|
9921
10754
|
const spokeOuterRadius = ring.r2 + 4 * scale;
|
|
9922
10755
|
const labelRadius = ring.r2 + 12 * scale;
|
|
9923
10756
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
|
|
9924
10757
|
return houses.map((house, index) => {
|
|
9925
|
-
const angle =
|
|
10758
|
+
const angle = angleOf2(house.longitude);
|
|
9926
10759
|
const next = houses[(index + 1) % houses.length];
|
|
9927
10760
|
const span = clamp360(next.longitude - house.longitude);
|
|
9928
10761
|
const labelLongitude = clamp360(house.longitude + span / 2);
|
|
@@ -9930,16 +10763,20 @@ function buildHouseCusps(params) {
|
|
|
9930
10763
|
house: index + 1,
|
|
9931
10764
|
longitude: normalizeAngle2(house.longitude),
|
|
9932
10765
|
sign: house.sign,
|
|
9933
|
-
line:
|
|
9934
|
-
labelPosition:
|
|
10766
|
+
line: lineFromPolar2(center, spokeInnerRadius, spokeOuterRadius, angle),
|
|
10767
|
+
labelPosition: polarToXY2(center.x, center.y, labelRadius, angleOf2(labelLongitude)),
|
|
9935
10768
|
labelFontSize
|
|
9936
10769
|
};
|
|
9937
10770
|
});
|
|
9938
10771
|
}
|
|
9939
10772
|
function buildAngleMarkers(params) {
|
|
9940
|
-
const { chart, center, angleOf, rings, scale } = params;
|
|
10773
|
+
const { chart, center, angleOf: angleOf2, rings, scale } = params;
|
|
9941
10774
|
const ring = rings.houses;
|
|
9942
10775
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
|
|
10776
|
+
const labelRadius = Math.min(
|
|
10777
|
+
ring.r2 + 9 * scale,
|
|
10778
|
+
ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
|
|
10779
|
+
);
|
|
9943
10780
|
const markers = [
|
|
9944
10781
|
{ key: "ASC", position: chart.houses.ascendant },
|
|
9945
10782
|
{ key: "MC", position: chart.houses.mc },
|
|
@@ -9947,7 +10784,7 @@ function buildAngleMarkers(params) {
|
|
|
9947
10784
|
{ key: "IC", position: chart.houses.ic }
|
|
9948
10785
|
];
|
|
9949
10786
|
return markers.map((marker) => {
|
|
9950
|
-
const angle =
|
|
10787
|
+
const angle = angleOf2(marker.position.longitude);
|
|
9951
10788
|
const angleDeg = clamp360(angle * (180 / Math.PI));
|
|
9952
10789
|
let labelRotation = angleDeg;
|
|
9953
10790
|
if (labelRotation > 90 && labelRotation < 270) {
|
|
@@ -9957,11 +10794,11 @@ function buildAngleMarkers(params) {
|
|
|
9957
10794
|
key: marker.key,
|
|
9958
10795
|
longitude: normalizeAngle2(marker.position.longitude),
|
|
9959
10796
|
zodiacPosition: marker.position,
|
|
9960
|
-
line:
|
|
10797
|
+
line: lineFromPolar2(center, ring.r1 + 4 * scale, ring.r2 - 4 * scale, angle),
|
|
9961
10798
|
labelPosition: polarWithNudge(
|
|
9962
10799
|
center.x,
|
|
9963
10800
|
center.y,
|
|
9964
|
-
|
|
10801
|
+
labelRadius,
|
|
9965
10802
|
angle,
|
|
9966
10803
|
0,
|
|
9967
10804
|
0
|
|
@@ -9972,7 +10809,17 @@ function buildAngleMarkers(params) {
|
|
|
9972
10809
|
});
|
|
9973
10810
|
}
|
|
9974
10811
|
function buildPointLayer(params) {
|
|
9975
|
-
const {
|
|
10812
|
+
const {
|
|
10813
|
+
layer,
|
|
10814
|
+
center,
|
|
10815
|
+
angleOf: angleOf2,
|
|
10816
|
+
rings,
|
|
10817
|
+
scale,
|
|
10818
|
+
palette,
|
|
10819
|
+
excludedBodies,
|
|
10820
|
+
pointConnectorMode,
|
|
10821
|
+
maxDisplacementDegrees
|
|
10822
|
+
} = params;
|
|
9976
10823
|
const ring = rings.planets;
|
|
9977
10824
|
const requestedRadius = resolvePointLayerRadius(layer, rings);
|
|
9978
10825
|
const requestedExternalLayer = requestedRadius > rings.houses.r2 + scale;
|
|
@@ -9993,7 +10840,7 @@ function buildPointLayer(params) {
|
|
|
9993
10840
|
const color = layer.color ?? palette.planetGlyph;
|
|
9994
10841
|
const tickColor = layer.tickColor ?? color;
|
|
9995
10842
|
const pointIntents = seeds.map((seed) => {
|
|
9996
|
-
const tickAngle =
|
|
10843
|
+
const tickAngle = angleOf2(seed.longitude);
|
|
9997
10844
|
const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
|
|
9998
10845
|
const rawGlyphRadius = radius;
|
|
9999
10846
|
const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
|
|
@@ -10001,21 +10848,23 @@ function buildPointLayer(params) {
|
|
|
10001
10848
|
rings.aspects.r2 + pointGlyphFontSize * 0.65,
|
|
10002
10849
|
labelMaxRadius - pointGlyphFontSize * 0.5
|
|
10003
10850
|
);
|
|
10004
|
-
const
|
|
10851
|
+
const connectorRadius = glyphRadius;
|
|
10852
|
+
const tickLine = isExternalLayer ? lineFromPolar2(
|
|
10005
10853
|
center,
|
|
10006
10854
|
rings.houses.r2 + 2 * scale,
|
|
10007
|
-
|
|
10855
|
+
connectorRadius,
|
|
10856
|
+
tickAngle
|
|
10857
|
+
) : lineFromPolar2(
|
|
10858
|
+
center,
|
|
10859
|
+
Math.min(ring.r2, connectorRadius + tickLength),
|
|
10860
|
+
connectorRadius,
|
|
10008
10861
|
tickAngle
|
|
10009
|
-
)
|
|
10010
|
-
const
|
|
10011
|
-
const leaderStart = polarToXY(center.x, center.y, leaderStartRadius, tickAngle);
|
|
10012
|
-
const idealPosition = polarToXY(center.x, center.y, glyphRadius, tickAngle);
|
|
10862
|
+
);
|
|
10863
|
+
const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
|
|
10013
10864
|
const point = makeAstroWheelPoint({
|
|
10014
10865
|
layer,
|
|
10015
10866
|
seed,
|
|
10016
10867
|
tickLine,
|
|
10017
|
-
leaderStart,
|
|
10018
|
-
tickAngle,
|
|
10019
10868
|
labelAngle: tickAngle,
|
|
10020
10869
|
glyphPosition: idealPosition,
|
|
10021
10870
|
glyphFontSize: pointGlyphFontSize,
|
|
@@ -10025,13 +10874,13 @@ function buildPointLayer(params) {
|
|
|
10025
10874
|
const layout = getPointLabelLayout(point, scale);
|
|
10026
10875
|
const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
|
|
10027
10876
|
const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
|
|
10028
|
-
const configuredTangentDemandPx = layer.collisionThresholdDegrees ?
|
|
10877
|
+
const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
|
|
10029
10878
|
const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
|
|
10030
10879
|
return {
|
|
10031
10880
|
seed,
|
|
10032
10881
|
tickAngle,
|
|
10033
10882
|
tickLine,
|
|
10034
|
-
|
|
10883
|
+
connectorRadius,
|
|
10035
10884
|
glyphRadius,
|
|
10036
10885
|
pointGlyphFontSize,
|
|
10037
10886
|
tangentDemandPx
|
|
@@ -10044,20 +10893,21 @@ function buildPointLayer(params) {
|
|
|
10044
10893
|
radius: intent.glyphRadius,
|
|
10045
10894
|
tangentDemandPx: intent.tangentDemandPx
|
|
10046
10895
|
})),
|
|
10047
|
-
|
|
10896
|
+
{
|
|
10897
|
+
paddingPx: collisionPadding,
|
|
10898
|
+
maxDisplacementRad: deg2rad2(clamp(maxDisplacementDegrees, 0, 180))
|
|
10899
|
+
}
|
|
10048
10900
|
);
|
|
10049
10901
|
const visualAngleByKey = Object.fromEntries(
|
|
10050
10902
|
solvedLabels.map(({ item, visualAngle }) => [item.seed.key, visualAngle])
|
|
10051
10903
|
);
|
|
10052
10904
|
const points = pointIntents.map((intent) => {
|
|
10053
10905
|
const visualAngle = visualAngleByKey[intent.seed.key] ?? intent.tickAngle;
|
|
10054
|
-
let glyphPosition =
|
|
10906
|
+
let glyphPosition = polarToXY2(center.x, center.y, intent.glyphRadius, visualAngle);
|
|
10055
10907
|
let point = makeAstroWheelPoint({
|
|
10056
10908
|
layer,
|
|
10057
10909
|
seed: intent.seed,
|
|
10058
10910
|
tickLine: intent.tickLine,
|
|
10059
|
-
leaderStart: intent.leaderStart,
|
|
10060
|
-
tickAngle: intent.tickAngle,
|
|
10061
10911
|
labelAngle: visualAngle,
|
|
10062
10912
|
glyphPosition,
|
|
10063
10913
|
glyphFontSize: intent.pointGlyphFontSize,
|
|
@@ -10077,14 +10927,20 @@ function buildPointLayer(params) {
|
|
|
10077
10927
|
point = {
|
|
10078
10928
|
...point,
|
|
10079
10929
|
glyphPosition,
|
|
10080
|
-
leaderLine:
|
|
10081
|
-
x1: intent.leaderStart.x,
|
|
10082
|
-
y1: intent.leaderStart.y,
|
|
10083
|
-
x2: glyphPosition.x,
|
|
10084
|
-
y2: glyphPosition.y
|
|
10085
|
-
}
|
|
10930
|
+
leaderLine: void 0
|
|
10086
10931
|
};
|
|
10087
10932
|
}
|
|
10933
|
+
point = {
|
|
10934
|
+
...point,
|
|
10935
|
+
leaderArc: buildPointConnector({
|
|
10936
|
+
center,
|
|
10937
|
+
tickAngle: intent.tickAngle,
|
|
10938
|
+
labelAngle: visualAngle,
|
|
10939
|
+
connectorRadius: intent.connectorRadius,
|
|
10940
|
+
glyphPosition,
|
|
10941
|
+
mode: pointConnectorMode
|
|
10942
|
+
})
|
|
10943
|
+
};
|
|
10088
10944
|
return {
|
|
10089
10945
|
...point,
|
|
10090
10946
|
labelBounds: constrainedLabel.bounds
|
|
@@ -10104,15 +10960,12 @@ function makeAstroWheelPoint(params) {
|
|
|
10104
10960
|
layer,
|
|
10105
10961
|
seed,
|
|
10106
10962
|
tickLine,
|
|
10107
|
-
leaderStart,
|
|
10108
|
-
tickAngle,
|
|
10109
10963
|
labelAngle,
|
|
10110
10964
|
glyphPosition,
|
|
10111
10965
|
glyphFontSize,
|
|
10112
10966
|
color,
|
|
10113
10967
|
tickColor
|
|
10114
10968
|
} = params;
|
|
10115
|
-
const labelDisplaced = circularAngleDistance(labelAngle, tickAngle) > 1e-4;
|
|
10116
10969
|
return {
|
|
10117
10970
|
layerId: layer.id,
|
|
10118
10971
|
key: seed.key,
|
|
@@ -10125,12 +10978,8 @@ function makeAstroWheelPoint(params) {
|
|
|
10125
10978
|
zodiacPosition: seed.zodiacPosition,
|
|
10126
10979
|
tickLine,
|
|
10127
10980
|
labelAngle,
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
y1: leaderStart.y,
|
|
10131
|
-
x2: glyphPosition.x,
|
|
10132
|
-
y2: glyphPosition.y
|
|
10133
|
-
} : void 0,
|
|
10981
|
+
leaderArc: void 0,
|
|
10982
|
+
leaderLine: void 0,
|
|
10134
10983
|
glyphPosition,
|
|
10135
10984
|
glyphFontSize,
|
|
10136
10985
|
retrograde: seed.retrograde,
|
|
@@ -10139,7 +10988,7 @@ function makeAstroWheelPoint(params) {
|
|
|
10139
10988
|
};
|
|
10140
10989
|
}
|
|
10141
10990
|
function buildAspectLayer(params) {
|
|
10142
|
-
const { layer, chart, pointByKey, center, angleOf, rings, palette, excludedBodies } = params;
|
|
10991
|
+
const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
|
|
10143
10992
|
const sourceEdges = getSourceAspectEdges(chart, {
|
|
10144
10993
|
enabled: true,
|
|
10145
10994
|
edges: layer.edges,
|
|
@@ -10163,8 +11012,8 @@ function buildAspectLayer(params) {
|
|
|
10163
11012
|
const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
|
|
10164
11013
|
const maxOrb = spec?.orb ?? 8;
|
|
10165
11014
|
const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
|
|
10166
|
-
const a =
|
|
10167
|
-
const b =
|
|
11015
|
+
const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
|
|
11016
|
+
const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
|
|
10168
11017
|
return [{
|
|
10169
11018
|
layerId: layer.id,
|
|
10170
11019
|
planetA: planetA.name,
|
|
@@ -10260,7 +11109,8 @@ function pointSeed(point, layerId) {
|
|
|
10260
11109
|
zodiacPosition: point.zodiacPosition
|
|
10261
11110
|
};
|
|
10262
11111
|
}
|
|
10263
|
-
function solveCircularLabelAngles(items,
|
|
11112
|
+
function solveCircularLabelAngles(items, options) {
|
|
11113
|
+
const { paddingPx, maxDisplacementRad } = options;
|
|
10264
11114
|
if (items.length === 0) {
|
|
10265
11115
|
return [];
|
|
10266
11116
|
}
|
|
@@ -10276,7 +11126,7 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
10276
11126
|
for (let i = 0; i < normalized.length; i++) {
|
|
10277
11127
|
const current = normalized[i];
|
|
10278
11128
|
const next = normalized[(i + 1) % normalized.length];
|
|
10279
|
-
const nextAngle = i === normalized.length - 1 ? next.idealAngle +
|
|
11129
|
+
const nextAngle = i === normalized.length - 1 ? next.idealAngle + TAU2 : next.idealAngle;
|
|
10280
11130
|
const gap = nextAngle - current.idealAngle;
|
|
10281
11131
|
if (gap > largestGap) {
|
|
10282
11132
|
largestGap = gap;
|
|
@@ -10290,14 +11140,14 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
10290
11140
|
const wrapped = seamIndex > 0 && index >= normalized.length - seamIndex;
|
|
10291
11141
|
return {
|
|
10292
11142
|
...item,
|
|
10293
|
-
idealAngle: item.idealAngle + (wrapped ?
|
|
11143
|
+
idealAngle: item.idealAngle + (wrapped ? TAU2 : 0)
|
|
10294
11144
|
};
|
|
10295
11145
|
});
|
|
10296
11146
|
for (let i = 1; i < linear.length; i++) {
|
|
10297
11147
|
while (linear[i].idealAngle <= linear[i - 1].idealAngle) {
|
|
10298
11148
|
linear[i] = {
|
|
10299
11149
|
...linear[i],
|
|
10300
|
-
idealAngle: linear[i].idealAngle +
|
|
11150
|
+
idealAngle: linear[i].idealAngle + TAU2
|
|
10301
11151
|
};
|
|
10302
11152
|
}
|
|
10303
11153
|
}
|
|
@@ -10305,20 +11155,41 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
10305
11155
|
...item,
|
|
10306
11156
|
visualAngle: item.idealAngle
|
|
10307
11157
|
}));
|
|
10308
|
-
for (let
|
|
10309
|
-
const
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
current
|
|
11158
|
+
for (let iteration = 0; iteration < 50; iteration++) {
|
|
11159
|
+
const forces = new Array(solved.length).fill(0);
|
|
11160
|
+
let maxForce = 0;
|
|
11161
|
+
for (let i = 0; i < solved.length; i++) {
|
|
11162
|
+
const j = (i + 1) % solved.length;
|
|
11163
|
+
const current = solved[i];
|
|
11164
|
+
const next = solved[j];
|
|
11165
|
+
const nextAngle = j === 0 ? next.visualAngle + TAU2 : next.visualAngle;
|
|
11166
|
+
const gap = nextAngle - current.visualAngle;
|
|
11167
|
+
const minGap = labelAngularHalfDemand(current, paddingPx) + labelAngularHalfDemand(next, paddingPx);
|
|
11168
|
+
if (gap >= minGap) {
|
|
11169
|
+
continue;
|
|
11170
|
+
}
|
|
11171
|
+
const push = (minGap - gap) / 2;
|
|
11172
|
+
forces[i] -= push;
|
|
11173
|
+
forces[j] += push;
|
|
11174
|
+
maxForce = Math.max(maxForce, push);
|
|
10314
11175
|
}
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
11176
|
+
if (maxForce < 1e-4) {
|
|
11177
|
+
break;
|
|
11178
|
+
}
|
|
11179
|
+
for (let i = 0; i < solved.length; i++) {
|
|
11180
|
+
const movement = clamp(forces[i], -deg2rad2(2), deg2rad2(2));
|
|
11181
|
+
const moved = solved[i].visualAngle + movement;
|
|
11182
|
+
solved[i].visualAngle = clampAngleAroundIdeal(
|
|
11183
|
+
moved,
|
|
11184
|
+
solved[i].idealAngle,
|
|
11185
|
+
maxDisplacementRad
|
|
11186
|
+
);
|
|
11187
|
+
}
|
|
11188
|
+
solved.sort((a, b) => a.visualAngle - b.visualAngle);
|
|
11189
|
+
for (let i = 1; i < solved.length; i++) {
|
|
11190
|
+
while (solved[i].visualAngle <= solved[i - 1].visualAngle) {
|
|
11191
|
+
solved[i].visualAngle += TAU2;
|
|
11192
|
+
}
|
|
10322
11193
|
}
|
|
10323
11194
|
}
|
|
10324
11195
|
return solved.map((item) => ({
|
|
@@ -10326,15 +11197,51 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
10326
11197
|
visualAngle: clampRad(item.visualAngle)
|
|
10327
11198
|
}));
|
|
10328
11199
|
}
|
|
11200
|
+
function clampAngleAroundIdeal(value, ideal, maxDistance) {
|
|
11201
|
+
if (!Number.isFinite(maxDistance) || maxDistance >= Math.PI) {
|
|
11202
|
+
return value;
|
|
11203
|
+
}
|
|
11204
|
+
const delta = signedAngleDelta(ideal, value);
|
|
11205
|
+
return ideal + clamp(delta, -maxDistance, maxDistance);
|
|
11206
|
+
}
|
|
11207
|
+
function signedAngleDelta(from, to) {
|
|
11208
|
+
let delta = clampRad(to) - clampRad(from);
|
|
11209
|
+
if (delta > Math.PI) {
|
|
11210
|
+
delta -= TAU2;
|
|
11211
|
+
} else if (delta < -Math.PI) {
|
|
11212
|
+
delta += TAU2;
|
|
11213
|
+
}
|
|
11214
|
+
return delta;
|
|
11215
|
+
}
|
|
10329
11216
|
function labelAngularHalfDemand(item, paddingPx) {
|
|
10330
11217
|
return (item.tangentDemandPx / 2 + paddingPx) / Math.max(item.radius, 1);
|
|
10331
11218
|
}
|
|
10332
11219
|
function clampRad(value) {
|
|
10333
|
-
return (value %
|
|
11220
|
+
return (value % TAU2 + TAU2) % TAU2;
|
|
10334
11221
|
}
|
|
10335
11222
|
function circularAngleDistance(a, b) {
|
|
10336
11223
|
const delta = Math.abs(clampRad(a) - clampRad(b));
|
|
10337
|
-
return Math.min(delta,
|
|
11224
|
+
return Math.min(delta, TAU2 - delta);
|
|
11225
|
+
}
|
|
11226
|
+
function buildPointConnector(params) {
|
|
11227
|
+
const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
|
|
11228
|
+
const displacement = circularAngleDistance(tickAngle, labelAngle);
|
|
11229
|
+
if (mode === "never" || mode === "auto" && displacement < deg2rad2(0.35)) {
|
|
11230
|
+
return void 0;
|
|
11231
|
+
}
|
|
11232
|
+
const path = arcConnectorPath({
|
|
11233
|
+
center,
|
|
11234
|
+
startAngle: tickAngle,
|
|
11235
|
+
endAngle: labelAngle,
|
|
11236
|
+
radius: connectorRadius,
|
|
11237
|
+
end: glyphPosition
|
|
11238
|
+
});
|
|
11239
|
+
return {
|
|
11240
|
+
startAngle: tickAngle,
|
|
11241
|
+
endAngle: labelAngle,
|
|
11242
|
+
radius: connectorRadius,
|
|
11243
|
+
path
|
|
11244
|
+
};
|
|
10338
11245
|
}
|
|
10339
11246
|
function getSourceAspectEdges(chart, options) {
|
|
10340
11247
|
if (options.edges) {
|
|
@@ -10386,12 +11293,16 @@ function getAspectMatch2(lonA, lonB, specs) {
|
|
|
10386
11293
|
function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
|
|
10387
11294
|
return specs.find((spec) => spec.name === aspect);
|
|
10388
11295
|
}
|
|
10389
|
-
function
|
|
11296
|
+
function buildRings2(outerRadius, ringFractions = {}) {
|
|
11297
|
+
const fractions = {
|
|
11298
|
+
...DEFAULT_ASTRO_WHEEL_RING_FRACTIONS,
|
|
11299
|
+
...ringFractions
|
|
11300
|
+
};
|
|
10390
11301
|
const ringMap = buildRingMap(outerRadius, [
|
|
10391
|
-
{ id: "houses", fr:
|
|
10392
|
-
{ id: "zodiac", fr:
|
|
10393
|
-
{ id: "planets", fr:
|
|
10394
|
-
{ id: "aspects", fr:
|
|
11302
|
+
{ id: "houses", fr: fractions.houses },
|
|
11303
|
+
{ id: "zodiac", fr: fractions.zodiac },
|
|
11304
|
+
{ id: "planets", fr: fractions.planets },
|
|
11305
|
+
{ id: "aspects", fr: fractions.aspects }
|
|
10395
11306
|
]);
|
|
10396
11307
|
return {
|
|
10397
11308
|
aspects: ringMap.aspects,
|
|
@@ -10401,23 +11312,27 @@ function buildRings(outerRadius) {
|
|
|
10401
11312
|
};
|
|
10402
11313
|
}
|
|
10403
11314
|
function buildRingMap(radius, defs) {
|
|
10404
|
-
const
|
|
11315
|
+
const normalizedDefs = defs.map((def) => ({
|
|
11316
|
+
...def,
|
|
11317
|
+
fr: Number.isFinite(def.fr) && def.fr > 0 ? def.fr : DEFAULT_ASTRO_WHEEL_RING_FRACTIONS[def.id]
|
|
11318
|
+
}));
|
|
11319
|
+
const frTotal = normalizedDefs.reduce((sum, def) => sum + def.fr, 0);
|
|
10405
11320
|
let cursor = radius;
|
|
10406
11321
|
const result = {};
|
|
10407
|
-
for (const def of
|
|
11322
|
+
for (const def of normalizedDefs) {
|
|
10408
11323
|
const thickness = radius * def.fr / frTotal;
|
|
10409
11324
|
const r2 = cursor;
|
|
10410
11325
|
const r1 = cursor - thickness;
|
|
10411
11326
|
result[def.id] = {
|
|
10412
11327
|
id: def.id,
|
|
10413
|
-
r1:
|
|
10414
|
-
r2:
|
|
11328
|
+
r1: round2(r1),
|
|
11329
|
+
r2: round2(r2)
|
|
10415
11330
|
};
|
|
10416
11331
|
cursor = r1;
|
|
10417
11332
|
}
|
|
10418
11333
|
return result;
|
|
10419
11334
|
}
|
|
10420
|
-
function
|
|
11335
|
+
function resolvePalette2(palette = "default", background = "transparent") {
|
|
10421
11336
|
const base = palette === "monochrome" ? MONOCHROME_PALETTE : DEFAULT_PALETTE;
|
|
10422
11337
|
if (palette === "default" || palette === "monochrome") {
|
|
10423
11338
|
return {
|
|
@@ -10516,7 +11431,7 @@ function resolvePointLayerRadius(layer, rings) {
|
|
|
10516
11431
|
const radius = layer.radius === "inner" ? ring.r1 : layer.radius === "outer" ? ring.r2 : typeof layer.radius === "number" ? layer.radius : base;
|
|
10517
11432
|
return radius + (layer.radiusOffset ?? 0);
|
|
10518
11433
|
}
|
|
10519
|
-
function
|
|
11434
|
+
function normalizeViewBox2(viewBox) {
|
|
10520
11435
|
return {
|
|
10521
11436
|
minX: viewBox?.minX ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minX,
|
|
10522
11437
|
minY: viewBox?.minY ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minY,
|
|
@@ -10550,16 +11465,16 @@ function pointKeyPrefix(layerId) {
|
|
|
10550
11465
|
function renderGlyphPrimitives(push, primitives, options) {
|
|
10551
11466
|
for (const p of primitives) {
|
|
10552
11467
|
if (p.kind === "path") {
|
|
10553
|
-
push(`<path d="${
|
|
11468
|
+
push(`<path d="${escapeAttr2(p.d)}"/>`);
|
|
10554
11469
|
} else if (p.kind === "circle") {
|
|
10555
|
-
push(`<circle cx="${
|
|
11470
|
+
push(`<circle cx="${fmt2(p.cx)}" cy="${fmt2(p.cy)}" r="${fmt2(p.r)}"/>`);
|
|
10556
11471
|
} else if (p.kind === "line") {
|
|
10557
|
-
push(`<line x1="${
|
|
11472
|
+
push(`<line x1="${fmt2(p.x1)}" y1="${fmt2(p.y1)}" x2="${fmt2(p.x2)}" y2="${fmt2(p.y2)}"/>`);
|
|
10558
11473
|
} else if (p.kind === "polyline") {
|
|
10559
|
-
push(`<polyline points="${
|
|
11474
|
+
push(`<polyline points="${escapeAttr2(p.points)}"/>`);
|
|
10560
11475
|
} else if (p.kind === "text") {
|
|
10561
11476
|
push(
|
|
10562
|
-
`<text x="${
|
|
11477
|
+
`<text x="${fmt2(p.x ?? 0)}" y="${fmt2(p.y ?? 0)}" font-family="${textFontFamily2()}" font-size="${fmt2(p.fontSize ?? 0.72)}" font-weight="${escapeAttr2(String(p.fontWeight ?? 500))}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(options.color)}" stroke="none">${escapeText2(p.text)}</text>`
|
|
10563
11478
|
);
|
|
10564
11479
|
} else {
|
|
10565
11480
|
let markup = p.markup;
|
|
@@ -10576,16 +11491,16 @@ function normalizeAngle2(value) {
|
|
|
10576
11491
|
function clamp360(value) {
|
|
10577
11492
|
return (value % 360 + 360) % 360;
|
|
10578
11493
|
}
|
|
10579
|
-
function
|
|
11494
|
+
function deg2rad2(degrees) {
|
|
10580
11495
|
return degrees * Math.PI / 180;
|
|
10581
11496
|
}
|
|
10582
11497
|
function clamp(value, min, max) {
|
|
10583
11498
|
return Math.max(min, Math.min(max, value));
|
|
10584
11499
|
}
|
|
10585
|
-
function
|
|
11500
|
+
function polarToXY2(cx, cy, radius, angleRad) {
|
|
10586
11501
|
return {
|
|
10587
|
-
x:
|
|
10588
|
-
y:
|
|
11502
|
+
x: round2(cx + radius * Math.cos(angleRad)),
|
|
11503
|
+
y: round2(cy + radius * Math.sin(angleRad))
|
|
10589
11504
|
};
|
|
10590
11505
|
}
|
|
10591
11506
|
function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffset = 0) {
|
|
@@ -10594,13 +11509,13 @@ function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffse
|
|
|
10594
11509
|
const tangentX = -Math.sin(angleRad);
|
|
10595
11510
|
const tangentY = Math.cos(angleRad);
|
|
10596
11511
|
return {
|
|
10597
|
-
x:
|
|
10598
|
-
y:
|
|
11512
|
+
x: round2(x + tangentX * tangentOffset),
|
|
11513
|
+
y: round2(y + tangentY * tangentOffset)
|
|
10599
11514
|
};
|
|
10600
11515
|
}
|
|
10601
|
-
function
|
|
10602
|
-
const p1 =
|
|
10603
|
-
const p2 =
|
|
11516
|
+
function lineFromPolar2(center, r1, r2, angleRad) {
|
|
11517
|
+
const p1 = polarToXY2(center.x, center.y, r1, angleRad);
|
|
11518
|
+
const p2 = polarToXY2(center.x, center.y, r2, angleRad);
|
|
10604
11519
|
return {
|
|
10605
11520
|
x1: p1.x,
|
|
10606
11521
|
y1: p1.y,
|
|
@@ -10609,20 +11524,36 @@ function lineFromPolar(center, r1, r2, angleRad) {
|
|
|
10609
11524
|
};
|
|
10610
11525
|
}
|
|
10611
11526
|
function arcPath(cx, cy, innerRadius, outerRadius, angleStart, angleEnd) {
|
|
10612
|
-
const p0 =
|
|
10613
|
-
const p1 =
|
|
10614
|
-
const p2 =
|
|
10615
|
-
const p3 =
|
|
10616
|
-
const large = Math.abs(angleEnd - angleStart) %
|
|
11527
|
+
const p0 = polarToXY2(cx, cy, outerRadius, angleStart);
|
|
11528
|
+
const p1 = polarToXY2(cx, cy, outerRadius, angleEnd);
|
|
11529
|
+
const p2 = polarToXY2(cx, cy, innerRadius, angleEnd);
|
|
11530
|
+
const p3 = polarToXY2(cx, cy, innerRadius, angleStart);
|
|
11531
|
+
const large = Math.abs(angleEnd - angleStart) % TAU2 > Math.PI ? 1 : 0;
|
|
10617
11532
|
const sweep = angleEnd > angleStart ? 1 : 0;
|
|
10618
11533
|
return [
|
|
10619
|
-
`M ${
|
|
10620
|
-
`A ${
|
|
10621
|
-
`L ${
|
|
10622
|
-
`A ${
|
|
11534
|
+
`M ${fmt2(p0.x)},${fmt2(p0.y)}`,
|
|
11535
|
+
`A ${fmt2(outerRadius)},${fmt2(outerRadius)} 0 ${large} ${sweep} ${fmt2(p1.x)},${fmt2(p1.y)}`,
|
|
11536
|
+
`L ${fmt2(p2.x)},${fmt2(p2.y)}`,
|
|
11537
|
+
`A ${fmt2(innerRadius)},${fmt2(innerRadius)} 0 ${large} ${sweep ? 0 : 1} ${fmt2(p3.x)},${fmt2(p3.y)}`,
|
|
10623
11538
|
"Z"
|
|
10624
11539
|
].join(" ");
|
|
10625
11540
|
}
|
|
11541
|
+
function arcConnectorPath(params) {
|
|
11542
|
+
const { center, startAngle, endAngle, radius, end } = params;
|
|
11543
|
+
const start = polarToXY2(center.x, center.y, radius, startAngle);
|
|
11544
|
+
const arcEnd = polarToXY2(center.x, center.y, radius, endAngle);
|
|
11545
|
+
const delta = signedAngleDelta(startAngle, endAngle);
|
|
11546
|
+
const large = Math.abs(delta) > Math.PI ? 1 : 0;
|
|
11547
|
+
const sweep = delta >= 0 ? 1 : 0;
|
|
11548
|
+
const commands = [
|
|
11549
|
+
`M ${fmt2(start.x)},${fmt2(start.y)}`,
|
|
11550
|
+
`A ${fmt2(radius)},${fmt2(radius)} 0 ${large} ${sweep} ${fmt2(arcEnd.x)},${fmt2(arcEnd.y)}`
|
|
11551
|
+
];
|
|
11552
|
+
if (Math.hypot(arcEnd.x - end.x, arcEnd.y - end.y) > 0.5) {
|
|
11553
|
+
commands.push(`L ${fmt2(end.x)},${fmt2(end.y)}`);
|
|
11554
|
+
}
|
|
11555
|
+
return commands.join(" ");
|
|
11556
|
+
}
|
|
10626
11557
|
function unwrapAngles(angles, direction = "inc") {
|
|
10627
11558
|
const unwrapped = [];
|
|
10628
11559
|
if (angles.length === 0) {
|
|
@@ -10633,47 +11564,54 @@ function unwrapAngles(angles, direction = "inc") {
|
|
|
10633
11564
|
let angle = angles[index];
|
|
10634
11565
|
if (direction === "inc") {
|
|
10635
11566
|
while (angle <= unwrapped[index - 1]) {
|
|
10636
|
-
angle +=
|
|
11567
|
+
angle += TAU2;
|
|
10637
11568
|
}
|
|
10638
11569
|
} else {
|
|
10639
11570
|
while (angle >= unwrapped[index - 1]) {
|
|
10640
|
-
angle -=
|
|
11571
|
+
angle -= TAU2;
|
|
10641
11572
|
}
|
|
10642
11573
|
}
|
|
10643
11574
|
unwrapped.push(angle);
|
|
10644
11575
|
}
|
|
10645
11576
|
return unwrapped;
|
|
10646
11577
|
}
|
|
10647
|
-
function
|
|
11578
|
+
function round2(value) {
|
|
10648
11579
|
return Math.round((value + Number.EPSILON) * 100) / 100;
|
|
10649
11580
|
}
|
|
10650
|
-
function
|
|
10651
|
-
const rounded =
|
|
11581
|
+
function fmt2(value) {
|
|
11582
|
+
const rounded = round2(value);
|
|
10652
11583
|
if (Object.is(rounded, -0)) {
|
|
10653
11584
|
return "0";
|
|
10654
11585
|
}
|
|
10655
11586
|
return String(rounded);
|
|
10656
11587
|
}
|
|
10657
|
-
function
|
|
11588
|
+
function escapeAttr2(value) {
|
|
10658
11589
|
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
10659
11590
|
}
|
|
10660
|
-
function
|
|
11591
|
+
function escapeText2(value) {
|
|
10661
11592
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
10662
11593
|
}
|
|
10663
11594
|
function symbolFontFamily() {
|
|
10664
|
-
return
|
|
11595
|
+
return escapeAttr2("'Apple Symbols', 'Arial Unicode MS', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', serif, sans-serif");
|
|
10665
11596
|
}
|
|
10666
|
-
function
|
|
10667
|
-
return
|
|
11597
|
+
function textFontFamily2() {
|
|
11598
|
+
return escapeAttr2("Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif");
|
|
10668
11599
|
}
|
|
10669
|
-
var
|
|
11600
|
+
var TAU2, GLYPH_OUTLINE_FILTER_ID, DEFAULT_ASTRO_WHEEL_RING_FRACTIONS, DEFAULT_POINT_DISPLACEMENT_DEGREES, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_ZODIAC_SIGNS, ASTRO_WHEEL_POINT_GLYPHS, DEFAULT_PALETTE, MONOCHROME_PALETTE, POINT_GLYPH_ALIASES;
|
|
10670
11601
|
var init_astro_wheel = __esm({
|
|
10671
11602
|
"src/visual/astro-wheel.ts"() {
|
|
10672
11603
|
"use strict";
|
|
10673
11604
|
init_astro_glyph_assets();
|
|
10674
11605
|
init_astro_glyph_registry();
|
|
10675
|
-
|
|
11606
|
+
TAU2 = Math.PI * 2;
|
|
10676
11607
|
GLYPH_OUTLINE_FILTER_ID = "astro-wheel-glyph-outline";
|
|
11608
|
+
DEFAULT_ASTRO_WHEEL_RING_FRACTIONS = {
|
|
11609
|
+
houses: 7,
|
|
11610
|
+
zodiac: 13,
|
|
11611
|
+
planets: 27,
|
|
11612
|
+
aspects: 53
|
|
11613
|
+
};
|
|
11614
|
+
DEFAULT_POINT_DISPLACEMENT_DEGREES = 20;
|
|
10677
11615
|
ASTRO_WHEEL_DEFAULT_VIEWBOX = {
|
|
10678
11616
|
minX: 0,
|
|
10679
11617
|
minY: 0,
|
|
@@ -18735,7 +19673,7 @@ var init_core = __esm({
|
|
|
18735
19673
|
}
|
|
18736
19674
|
});
|
|
18737
19675
|
|
|
18738
|
-
// src/visual/tree
|
|
19676
|
+
// src/visual/tree.ts
|
|
18739
19677
|
function getTreeLayout(system = "kaabalah") {
|
|
18740
19678
|
const tree = createTree({ system });
|
|
18741
19679
|
const percentages = buildLayoutMap(tree, CANONICAL_SPHERE_PERCENTAGES);
|
|
@@ -18755,8 +19693,8 @@ function getTreeLayout(system = "kaabalah") {
|
|
|
18755
19693
|
function getTreeRenderModel(options = {}) {
|
|
18756
19694
|
const system = options.system ?? "kaabalah";
|
|
18757
19695
|
const tree = createTree({ system, parts: ["colors"] });
|
|
18758
|
-
const viewBox =
|
|
18759
|
-
const palette =
|
|
19696
|
+
const viewBox = normalizeViewBox3(options.viewBox);
|
|
19697
|
+
const palette = resolvePalette3(options.palette);
|
|
18760
19698
|
const highlights = resolveHighlights(options.highlights);
|
|
18761
19699
|
const activationMap = resolveActivationMap(options.activations);
|
|
18762
19700
|
const layout = getTreeLayout(system);
|
|
@@ -18766,12 +19704,12 @@ function getTreeRenderModel(options = {}) {
|
|
|
18766
19704
|
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
18767
19705
|
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
18768
19706
|
);
|
|
18769
|
-
const radius =
|
|
18770
|
-
const pathEdgeWidth =
|
|
18771
|
-
const pathMainWidth =
|
|
18772
|
-
const pathHighlightWidth =
|
|
18773
|
-
const sphereHitRadius =
|
|
18774
|
-
const pathHitStrokeWidth =
|
|
19707
|
+
const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
|
|
19708
|
+
const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
19709
|
+
const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
19710
|
+
const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
19711
|
+
const sphereHitRadius = round3(DEFAULT_SPHERE_HIT_RADIUS * scale);
|
|
19712
|
+
const pathHitStrokeWidth = round3(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
|
|
18775
19713
|
const layers = [
|
|
18776
19714
|
{ name: "background", order: 0, description: "Background rectangle when requested." },
|
|
18777
19715
|
...options.daathLayer === "back" ? [{ name: "spheres-behind-paths", order: 1, description: "Daath behind the paths." }] : [],
|
|
@@ -18905,8 +19843,8 @@ function generateTreeSvg(options = {}) {
|
|
|
18905
19843
|
const system = options.system ?? "kaabalah";
|
|
18906
19844
|
const daathLayer = options.daathLayer ?? "front";
|
|
18907
19845
|
const tree = createTree({ system, parts: ["colors"] });
|
|
18908
|
-
const viewBox =
|
|
18909
|
-
const palette =
|
|
19846
|
+
const viewBox = normalizeViewBox3(options.viewBox);
|
|
19847
|
+
const palette = resolvePalette3(options.palette);
|
|
18910
19848
|
const highlights = resolveHighlights(options.highlights);
|
|
18911
19849
|
const activationMap = resolveActivationMap(options.activations);
|
|
18912
19850
|
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
@@ -18915,17 +19853,17 @@ function generateTreeSvg(options = {}) {
|
|
|
18915
19853
|
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
18916
19854
|
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
18917
19855
|
);
|
|
18918
|
-
const radius =
|
|
18919
|
-
const pathEdgeWidth =
|
|
18920
|
-
const pathMainWidth =
|
|
18921
|
-
const pathHighlightWidth =
|
|
18922
|
-
const sphereStrokeWidth = palette.sphereStrokeWidth ?
|
|
19856
|
+
const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
|
|
19857
|
+
const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
19858
|
+
const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
19859
|
+
const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
19860
|
+
const sphereStrokeWidth = palette.sphereStrokeWidth ? round3(palette.sphereStrokeWidth * scale) : void 0;
|
|
18923
19861
|
const lines = [];
|
|
18924
19862
|
const push = (line) => lines.push(line);
|
|
18925
19863
|
const svgAttributes = [
|
|
18926
19864
|
`xmlns="http://www.w3.org/2000/svg"`,
|
|
18927
|
-
options.width !== void 0 ? `width="${
|
|
18928
|
-
options.height !== void 0 ? `height="${
|
|
19865
|
+
options.width !== void 0 ? `width="${escapeAttr3(String(options.width))}"` : "",
|
|
19866
|
+
options.height !== void 0 ? `height="${escapeAttr3(String(options.height))}"` : "",
|
|
18929
19867
|
`viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
|
|
18930
19868
|
`preserveAspectRatio="xMidYMid meet"`
|
|
18931
19869
|
].filter(Boolean);
|
|
@@ -18979,7 +19917,7 @@ function generateTreeSvg(options = {}) {
|
|
|
18979
19917
|
const background = options.background ?? "white";
|
|
18980
19918
|
if (background !== "transparent") {
|
|
18981
19919
|
push(
|
|
18982
|
-
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${
|
|
19920
|
+
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr3(background)}"/>`
|
|
18983
19921
|
);
|
|
18984
19922
|
}
|
|
18985
19923
|
if (daathLayer === "back") {
|
|
@@ -19029,18 +19967,18 @@ function generateTreeSvg(options = {}) {
|
|
|
19029
19967
|
pathColor: color
|
|
19030
19968
|
});
|
|
19031
19969
|
push(
|
|
19032
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
19970
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
|
|
19033
19971
|
);
|
|
19034
19972
|
if (activation?.visible && activation.emphasis > 0) {
|
|
19035
19973
|
push(
|
|
19036
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
19974
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-opacity="${round3(0.18 + activation.emphasis * 0.28)}" stroke-width="${round3(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
|
|
19037
19975
|
);
|
|
19038
19976
|
}
|
|
19039
19977
|
push(
|
|
19040
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
19978
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
|
|
19041
19979
|
);
|
|
19042
19980
|
push(
|
|
19043
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
19981
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(palette.pathHighlightColor)}" stroke-opacity="${palette.pathHighlightOpacity}" stroke-width="${pathHighlightWidth}" stroke-linecap="round"/>`
|
|
19044
19982
|
);
|
|
19045
19983
|
}
|
|
19046
19984
|
push(`</g>`);
|
|
@@ -19097,11 +20035,11 @@ function renderSphere(push, params) {
|
|
|
19097
20035
|
activation: params.activation
|
|
19098
20036
|
});
|
|
19099
20037
|
if (params.activation?.visible && params.activation.emphasis > 0) {
|
|
19100
|
-
const haloStrokeWidth =
|
|
19101
|
-
const haloRadius =
|
|
20038
|
+
const haloStrokeWidth = round3(3.2 + params.activation.emphasis * 4.8);
|
|
20039
|
+
const haloRadius = round3(params.radius + haloStrokeWidth / 2 + 0.7);
|
|
19102
20040
|
const haloColor = params.activation.displayColor;
|
|
19103
20041
|
push(
|
|
19104
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${
|
|
20042
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${escapeAttr3(haloColor)}" stroke-opacity="${round3(0.24 + params.activation.emphasis * 0.28)}" stroke-width="${haloStrokeWidth}"/>`
|
|
19105
20043
|
);
|
|
19106
20044
|
}
|
|
19107
20045
|
push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
|
|
@@ -19129,12 +20067,12 @@ function renderSphere(push, params) {
|
|
|
19129
20067
|
renderSlicedSphere(push, point, params.radius, slicedColors, -135);
|
|
19130
20068
|
} else {
|
|
19131
20069
|
push(
|
|
19132
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${
|
|
20070
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
19133
20071
|
);
|
|
19134
20072
|
}
|
|
19135
20073
|
} else {
|
|
19136
20074
|
push(
|
|
19137
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${
|
|
20075
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
19138
20076
|
);
|
|
19139
20077
|
}
|
|
19140
20078
|
push(
|
|
@@ -19148,7 +20086,7 @@ function renderSphere(push, params) {
|
|
|
19148
20086
|
push(`</g>`);
|
|
19149
20087
|
if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
|
|
19150
20088
|
push(
|
|
19151
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${
|
|
20089
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr3(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
|
|
19152
20090
|
);
|
|
19153
20091
|
}
|
|
19154
20092
|
}
|
|
@@ -19193,13 +20131,13 @@ function scaleCoordinates(coordinates, viewBox) {
|
|
|
19193
20131
|
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
19194
20132
|
const point = coordinates[currentSphereId];
|
|
19195
20133
|
scaled[currentSphereId] = {
|
|
19196
|
-
x:
|
|
19197
|
-
y:
|
|
20134
|
+
x: round3(viewBox.minX + point.x / 100 * viewBox.width),
|
|
20135
|
+
y: round3(viewBox.minY + point.y / 100 * viewBox.height)
|
|
19198
20136
|
};
|
|
19199
20137
|
}
|
|
19200
20138
|
return scaled;
|
|
19201
20139
|
}
|
|
19202
|
-
function
|
|
20140
|
+
function normalizeViewBox3(viewBox) {
|
|
19203
20141
|
return {
|
|
19204
20142
|
minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
|
|
19205
20143
|
minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
|
|
@@ -19300,17 +20238,17 @@ function getViewBoxAnchor(point, viewBox) {
|
|
|
19300
20238
|
};
|
|
19301
20239
|
}
|
|
19302
20240
|
function getPercentagePathAnchor(path) {
|
|
19303
|
-
const y =
|
|
20241
|
+
const y = round3((path.from.y + path.to.y) / 2);
|
|
19304
20242
|
return {
|
|
19305
|
-
x:
|
|
20243
|
+
x: round3((path.from.x + path.to.x) / 2),
|
|
19306
20244
|
y,
|
|
19307
20245
|
vertical: y < 18 ? "below" : "above"
|
|
19308
20246
|
};
|
|
19309
20247
|
}
|
|
19310
20248
|
function getViewBoxPathAnchor(path, viewBox) {
|
|
19311
|
-
const y =
|
|
20249
|
+
const y = round3((path.from.y + path.to.y) / 2);
|
|
19312
20250
|
return {
|
|
19313
|
-
x:
|
|
20251
|
+
x: round3((path.from.x + path.to.x) / 2),
|
|
19314
20252
|
y,
|
|
19315
20253
|
vertical: y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
19316
20254
|
};
|
|
@@ -19361,7 +20299,7 @@ function getSphereMaterial(params) {
|
|
|
19361
20299
|
function clamp01(value) {
|
|
19362
20300
|
return Math.max(0, Math.min(1, value));
|
|
19363
20301
|
}
|
|
19364
|
-
function
|
|
20302
|
+
function resolvePalette3(palette) {
|
|
19365
20303
|
if (palette === void 0 || palette === "color") {
|
|
19366
20304
|
return {
|
|
19367
20305
|
mode: "color",
|
|
@@ -19467,14 +20405,14 @@ function expandColors(fill, count, fallbackColors) {
|
|
|
19467
20405
|
}
|
|
19468
20406
|
return Array.from({ length: count }, () => fill);
|
|
19469
20407
|
}
|
|
19470
|
-
function
|
|
20408
|
+
function round3(value) {
|
|
19471
20409
|
return Math.round(value * 100) / 100;
|
|
19472
20410
|
}
|
|
19473
20411
|
function polarToCartesian(cx, cy, radius, degrees) {
|
|
19474
20412
|
const radians = Math.PI / 180 * degrees;
|
|
19475
20413
|
return {
|
|
19476
|
-
x:
|
|
19477
|
-
y:
|
|
20414
|
+
x: round3(cx + radius * Math.cos(radians)),
|
|
20415
|
+
y: round3(cy + radius * Math.sin(radians))
|
|
19478
20416
|
};
|
|
19479
20417
|
}
|
|
19480
20418
|
function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
|
|
@@ -19485,24 +20423,24 @@ function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
|
|
|
19485
20423
|
}
|
|
19486
20424
|
function renderKether(push, point, radius, baseFill = "#e0e0e0") {
|
|
19487
20425
|
push(
|
|
19488
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${
|
|
20426
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(baseFill)}"/>`
|
|
19489
20427
|
);
|
|
19490
20428
|
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
|
|
19491
20429
|
const spokes = 16;
|
|
19492
|
-
const innerRadius =
|
|
19493
|
-
const outerRadius =
|
|
19494
|
-
const innerWidth =
|
|
20430
|
+
const innerRadius = round3(radius * 0.18);
|
|
20431
|
+
const outerRadius = round3(radius * 0.92);
|
|
20432
|
+
const innerWidth = round3(radius * 0.04);
|
|
19495
20433
|
const angleStep = 360 / spokes;
|
|
19496
20434
|
push(`<g opacity="0.85">`);
|
|
19497
20435
|
for (let index = 0; index < spokes; index++) {
|
|
19498
20436
|
const angle = index * angleStep;
|
|
19499
20437
|
push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
|
|
19500
|
-
const x0 =
|
|
19501
|
-
const y0 =
|
|
20438
|
+
const x0 = round3(point.x - innerWidth);
|
|
20439
|
+
const y0 = round3(point.y - innerRadius);
|
|
19502
20440
|
const x1 = point.x;
|
|
19503
|
-
const y1 =
|
|
19504
|
-
const x2 =
|
|
19505
|
-
const y2 =
|
|
20441
|
+
const y1 = round3(point.y - outerRadius);
|
|
20442
|
+
const x2 = round3(point.x + innerWidth);
|
|
20443
|
+
const y2 = round3(point.y - innerRadius);
|
|
19506
20444
|
push(
|
|
19507
20445
|
`<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
|
|
19508
20446
|
);
|
|
@@ -19517,7 +20455,7 @@ function renderSlicedSphere(push, point, radius, colors, startAngle) {
|
|
|
19517
20455
|
let currentAngle = startAngle;
|
|
19518
20456
|
for (let index = 0; index < segmentCount; index++) {
|
|
19519
20457
|
const path = arcPath2(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
|
|
19520
|
-
push(`<path d="${path}" fill="${
|
|
20458
|
+
push(`<path d="${path}" fill="${escapeAttr3(colors[index])}" stroke="none"/>`);
|
|
19521
20459
|
currentAngle += step;
|
|
19522
20460
|
}
|
|
19523
20461
|
}
|
|
@@ -19534,7 +20472,7 @@ function renderIridescent(push, point, radius) {
|
|
|
19534
20472
|
[1, "#F0E8EE"]
|
|
19535
20473
|
];
|
|
19536
20474
|
const slices = 72;
|
|
19537
|
-
const sphereRadius =
|
|
20475
|
+
const sphereRadius = round3(radius * 0.96);
|
|
19538
20476
|
for (let index = 0; index < slices; index++) {
|
|
19539
20477
|
const t = index / slices;
|
|
19540
20478
|
const color = interpolateColorStops(stops, t);
|
|
@@ -19573,28 +20511,28 @@ function interpolateColor(start, end, factor) {
|
|
|
19573
20511
|
}
|
|
19574
20512
|
function renderYinYang(push, point, radius, fill) {
|
|
19575
20513
|
const scale = radius / 50;
|
|
19576
|
-
const circleRadius =
|
|
19577
|
-
const halfRadius =
|
|
19578
|
-
const dotRadius =
|
|
20514
|
+
const circleRadius = round3(48 * scale);
|
|
20515
|
+
const halfRadius = round3(24 * scale);
|
|
20516
|
+
const dotRadius = round3(6 * scale);
|
|
19579
20517
|
const [lightFill, darkFill] = resolveDualToneFill(fill);
|
|
19580
20518
|
push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
|
|
19581
20519
|
push(
|
|
19582
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${
|
|
20520
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${escapeAttr3(lightFill)}"/>`
|
|
19583
20521
|
);
|
|
19584
20522
|
push(
|
|
19585
|
-
`<path d="M${point.x},${
|
|
20523
|
+
`<path d="M${point.x},${round3(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round3(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round3(point.y - circleRadius)}" fill="${escapeAttr3(darkFill)}"/>`
|
|
19586
20524
|
);
|
|
19587
20525
|
push(
|
|
19588
|
-
`<circle cx="${point.x}" cy="${
|
|
20526
|
+
`<circle cx="${point.x}" cy="${round3(point.y - halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(lightFill)}"/>`
|
|
19589
20527
|
);
|
|
19590
20528
|
push(
|
|
19591
|
-
`<circle cx="${point.x}" cy="${
|
|
20529
|
+
`<circle cx="${point.x}" cy="${round3(point.y + halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(darkFill)}"/>`
|
|
19592
20530
|
);
|
|
19593
20531
|
push(`</g>`);
|
|
19594
20532
|
}
|
|
19595
20533
|
function renderSphereTintOverlay(push, point, radius, fill, opacity) {
|
|
19596
20534
|
push(
|
|
19597
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${
|
|
20535
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(toPrimaryFill(fill, "#ffffff"))}" fill-opacity="${opacity}"/>`
|
|
19598
20536
|
);
|
|
19599
20537
|
}
|
|
19600
20538
|
function resolveDualToneFill(fill) {
|
|
@@ -19606,12 +20544,12 @@ function resolveDualToneFill(fill) {
|
|
|
19606
20544
|
}
|
|
19607
20545
|
return ["white", "black"];
|
|
19608
20546
|
}
|
|
19609
|
-
function
|
|
20547
|
+
function escapeAttr3(value) {
|
|
19610
20548
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
19611
20549
|
}
|
|
19612
20550
|
var TREE_SVG_DEFAULT_VIEWBOX, TREE_SPHERE_NAMES, TREE_PATH_NUMBERS, CANONICAL_X_PERCENTAGES, CANONICAL_ROW_Y_PERCENTAGES, DEFAULT_SPHERE_RADIUS, DEFAULT_PATH_EDGE_WIDTH, DEFAULT_PATH_MAIN_WIDTH, DEFAULT_PATH_HIGHLIGHT_WIDTH, DEFAULT_SPHERE_HIT_RADIUS, DEFAULT_PATH_HIT_STROKE_WIDTH, MUTED_TARGET_COLOR, sphereId, pathId, TREE_SPHERE_IDS, TREE_PATH_IDS, CANONICAL_SPHERE_PERCENTAGES;
|
|
19613
|
-
var
|
|
19614
|
-
"src/visual/tree
|
|
20551
|
+
var init_tree = __esm({
|
|
20552
|
+
"src/visual/tree.ts"() {
|
|
19615
20553
|
"use strict";
|
|
19616
20554
|
init_core();
|
|
19617
20555
|
TREE_SVG_DEFAULT_VIEWBOX = {
|
|
@@ -19681,6 +20619,7 @@ var visual_exports = {};
|
|
|
19681
20619
|
__export(visual_exports, {
|
|
19682
20620
|
ANGLE_GLYPHS: () => ANGLE_GLYPHS,
|
|
19683
20621
|
ANGLE_GLYPH_PRIMITIVES: () => ANGLE_GLYPH_PRIMITIVES,
|
|
20622
|
+
ARCHEOMETER_DEFAULT_VIEWBOX: () => ARCHEOMETER_DEFAULT_VIEWBOX,
|
|
19684
20623
|
ASPECT_GLYPHS: () => ASPECT_GLYPHS,
|
|
19685
20624
|
ASPECT_GLYPH_PRIMITIVES: () => ASPECT_GLYPH_PRIMITIVES,
|
|
19686
20625
|
ASTRO_GLYPHS: () => ASTRO_GLYPHS,
|
|
@@ -19688,6 +20627,18 @@ __export(visual_exports, {
|
|
|
19688
20627
|
ASTRO_WHEEL_DEFAULT_VIEWBOX: () => ASTRO_WHEEL_DEFAULT_VIEWBOX,
|
|
19689
20628
|
ASTRO_WHEEL_POINT_GLYPHS: () => ASTRO_WHEEL_POINT_GLYPHS,
|
|
19690
20629
|
ASTRO_WHEEL_ZODIAC_SIGNS: () => ASTRO_WHEEL_ZODIAC_SIGNS,
|
|
20630
|
+
DEFAULT_ARCHEOMETER_MUSICAL_NOTES: () => DEFAULT_ARCHEOMETER_MUSICAL_NOTES,
|
|
20631
|
+
DEFAULT_ARCHEOMETER_PLANETS: () => DEFAULT_ARCHEOMETER_PLANETS,
|
|
20632
|
+
DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES: () => DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES,
|
|
20633
|
+
DEFAULT_ARCHEOMETER_TRIANGLES: () => DEFAULT_ARCHEOMETER_TRIANGLES,
|
|
20634
|
+
DEFAULT_ARCHEOMETER_TRIANGLE_LABELS: () => DEFAULT_ARCHEOMETER_TRIANGLE_LABELS,
|
|
20635
|
+
DEFAULT_ARCHEOMETER_UTTERANCE: () => DEFAULT_ARCHEOMETER_UTTERANCE,
|
|
20636
|
+
DEFAULT_ARCHEOMETER_ZODIAC: () => DEFAULT_ARCHEOMETER_ZODIAC,
|
|
20637
|
+
DEFAULT_ARCHETYPE_MUSICAL_NOTES: () => DEFAULT_ARCHETYPE_MUSICAL_NOTES,
|
|
20638
|
+
DEFAULT_ARCHETYPE_PLANETS: () => DEFAULT_ARCHETYPE_PLANETS,
|
|
20639
|
+
DEFAULT_ARCHETYPE_TRIANGLES: () => DEFAULT_ARCHETYPE_TRIANGLES,
|
|
20640
|
+
DEFAULT_ARCHETYPE_UTTERANCE: () => DEFAULT_ARCHETYPE_UTTERANCE,
|
|
20641
|
+
DEFAULT_ARCHETYPE_ZODIAC: () => DEFAULT_ARCHETYPE_ZODIAC,
|
|
19691
20642
|
PLANET_GLYPHS: () => PLANET_GLYPHS,
|
|
19692
20643
|
PLANET_GLYPH_PRIMITIVES: () => PLANET_GLYPH_PRIMITIVES,
|
|
19693
20644
|
TREE_PATH_IDS: () => TREE_PATH_IDS,
|
|
@@ -19696,10 +20647,12 @@ __export(visual_exports, {
|
|
|
19696
20647
|
TREE_SVG_DEFAULT_VIEWBOX: () => TREE_SVG_DEFAULT_VIEWBOX,
|
|
19697
20648
|
ZODIAC_GLYPHS: () => ZODIAC_GLYPHS,
|
|
19698
20649
|
ZODIAC_GLYPH_PRIMITIVES: () => ZODIAC_GLYPH_PRIMITIVES,
|
|
20650
|
+
generateArcheometerSvg: () => generateArcheometerSvg,
|
|
19699
20651
|
generateAstroGlyphSvg: () => generateAstroGlyphSvg,
|
|
19700
20652
|
generateAstroWheelSvg: () => generateAstroWheelSvg,
|
|
19701
20653
|
generateGlyphSvg: () => generateGlyphSvg,
|
|
19702
20654
|
generateTreeSvg: () => generateTreeSvg,
|
|
20655
|
+
getArcheometerRenderModel: () => getArcheometerRenderModel,
|
|
19703
20656
|
getAstroGlyph: () => getAstroGlyph,
|
|
19704
20657
|
getAstroWheelRenderModel: () => getAstroWheelRenderModel,
|
|
19705
20658
|
getTreeLayout: () => getTreeLayout,
|
|
@@ -19709,10 +20662,11 @@ __export(visual_exports, {
|
|
|
19709
20662
|
var init_visual = __esm({
|
|
19710
20663
|
"src/visual/index.ts"() {
|
|
19711
20664
|
"use strict";
|
|
19712
|
-
|
|
20665
|
+
init_archeometer();
|
|
19713
20666
|
init_astro_glyph_registry();
|
|
20667
|
+
init_astro_glyph_types();
|
|
19714
20668
|
init_astro_wheel();
|
|
19715
|
-
|
|
20669
|
+
init_tree();
|
|
19716
20670
|
}
|
|
19717
20671
|
});
|
|
19718
20672
|
|
|
@@ -19722,7 +20676,7 @@ var import_config3 = require("dotenv/config");
|
|
|
19722
20676
|
// package.json
|
|
19723
20677
|
var package_default = {
|
|
19724
20678
|
name: "kaabalah",
|
|
19725
|
-
version: "6.
|
|
20679
|
+
version: "6.7.0",
|
|
19726
20680
|
description: "The de-facto library for any esoteric calculations and tooling",
|
|
19727
20681
|
engines: {
|
|
19728
20682
|
node: ">=18.18.0"
|
|
@@ -19808,7 +20762,8 @@ var package_default = {
|
|
|
19808
20762
|
"prepare-browser-test": "cp wasm/build/swisseph.wasm examples/ && cp -r ephe examples/",
|
|
19809
20763
|
"generate:trees": "npx tsx examples/generate-tree-svg.ts",
|
|
19810
20764
|
"generate:wheels": "npx tsx examples/generate-astro-wheel-svgs.ts",
|
|
19811
|
-
"generate:
|
|
20765
|
+
"generate:archeometer": "npx tsx examples/generate-archeometer-svg.ts",
|
|
20766
|
+
"generate:svgs": "npm run generate:trees && npm run generate:wheels && npm run generate:archeometer",
|
|
19812
20767
|
prepublishOnly: "npm run build && mkdir -p dist/wasm/build/ && cp dist/swisseph* dist/wasm/build/ && npm run generate:svgs"
|
|
19813
20768
|
},
|
|
19814
20769
|
keywords: [
|