kaabalah 6.6.2 → 6.6.4
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-2FRLTA5B.mjs → chunk-3TBUVMHV.mjs} +210 -127
- package/dist/chunk-3TBUVMHV.mjs.map +1 -0
- package/dist/{chunk-RVMZBPNZ.js → chunk-NRAAMI6I.js} +210 -127
- package/dist/chunk-NRAAMI6I.js.map +1 -0
- package/dist/cli.js +210 -127
- package/dist/cli.js.map +1 -1
- package/dist/index.js +27 -27
- package/dist/index.mjs +1 -1
- package/dist/visual/index.js +27 -27
- package/dist/visual/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2FRLTA5B.mjs.map +0 -1
- package/dist/chunk-RVMZBPNZ.js.map +0 -1
|
@@ -1044,15 +1044,14 @@ function labelBoundsCircleOverflow(center, bounds, maxRadius) {
|
|
|
1044
1044
|
);
|
|
1045
1045
|
return farthestCorner - maxRadius;
|
|
1046
1046
|
}
|
|
1047
|
-
function hasLabelBoundsCollision(bounds, placed) {
|
|
1048
|
-
return placed.some((other) => labelBoundsOverlap(bounds, other));
|
|
1049
|
-
}
|
|
1050
|
-
function labelBoundsOverlap(a, b) {
|
|
1051
|
-
return !(a.x + a.width <= b.x || b.x + b.width <= a.x || a.y + a.height <= b.y || b.y + b.height <= a.y);
|
|
1052
|
-
}
|
|
1053
1047
|
function formatLabelBounds(bounds) {
|
|
1054
1048
|
return `${fmt(bounds.x)} ${fmt(bounds.y)} ${fmt(bounds.width)} ${fmt(bounds.height)}`;
|
|
1055
1049
|
}
|
|
1050
|
+
function projectedLabelWidthAlongTangent(angleRad, bounds) {
|
|
1051
|
+
const tangentX = -Math.sin(angleRad);
|
|
1052
|
+
const tangentY = Math.cos(angleRad);
|
|
1053
|
+
return Math.abs(tangentX) * bounds.width + Math.abs(tangentY) * bounds.height;
|
|
1054
|
+
}
|
|
1056
1055
|
var POINT_GLYPH_ALIASES = {
|
|
1057
1056
|
"mean node": "north node",
|
|
1058
1057
|
"true node": "north node",
|
|
@@ -1202,108 +1201,109 @@ function buildPointLayer(params) {
|
|
|
1202
1201
|
) : requestedRadius;
|
|
1203
1202
|
const isExternalLayer = radius > rings.houses.r2 + scale;
|
|
1204
1203
|
const tickLength = Math.min(14 * scale, thickness * 0.34);
|
|
1205
|
-
const glyphMinSepDeg = glyphFontSize * 0.9 / Math.max(radius, 1) * (180 / Math.PI);
|
|
1206
|
-
const collisionThresholdDegrees = clamp(
|
|
1207
|
-
layer.collisionThresholdDegrees ?? Math.max(2, Math.min(8, glyphMinSepDeg)),
|
|
1208
|
-
0,
|
|
1209
|
-
30
|
|
1210
|
-
);
|
|
1211
|
-
const tangentStep = glyphFontSize * (isExternalLayer ? 0.68 : 0.74);
|
|
1212
1204
|
const collisionPadding = Math.max(2 * scale, 1.5);
|
|
1213
1205
|
const zodiacKeepOutGap = Math.max(5 * scale, 4);
|
|
1214
1206
|
const labelMaxRadius = isExternalLayer ? Number.POSITIVE_INFINITY : rings.zodiac.r1 - zodiacKeepOutGap;
|
|
1215
1207
|
const seeds = getPointSeeds(layer, excludedBodies);
|
|
1216
|
-
const clusters = clusterPointSeeds(seeds, collisionThresholdDegrees);
|
|
1217
1208
|
const color = layer.color ?? palette.planetGlyph;
|
|
1218
1209
|
const tickColor = layer.tickColor ?? color;
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1210
|
+
const pointIntents = seeds.map((seed) => {
|
|
1211
|
+
const tickAngle = angleOf(seed.longitude);
|
|
1212
|
+
const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
|
|
1213
|
+
const rawGlyphRadius = radius;
|
|
1214
|
+
const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
|
|
1215
|
+
rawGlyphRadius,
|
|
1216
|
+
rings.aspects.r2 + pointGlyphFontSize * 0.65,
|
|
1217
|
+
labelMaxRadius - pointGlyphFontSize * 0.5
|
|
1218
|
+
);
|
|
1219
|
+
const tickLine = isExternalLayer ? lineFromPolar(
|
|
1220
|
+
center,
|
|
1221
|
+
rings.houses.r2 + 2 * scale,
|
|
1222
|
+
Math.max(rings.houses.r2 + 6 * scale, radius - glyphFontSize * 0.44),
|
|
1223
|
+
tickAngle
|
|
1224
|
+
) : lineFromPolar(center, ring.r2 - tickLength, ring.r2, tickAngle);
|
|
1225
|
+
const leaderStartRadius = isExternalLayer ? Math.max(rings.houses.r2 + 6 * scale, radius - glyphFontSize * 0.44) : radius;
|
|
1226
|
+
const leaderStart = polarToXY(center.x, center.y, leaderStartRadius, tickAngle);
|
|
1227
|
+
const idealPosition = polarToXY(center.x, center.y, glyphRadius, tickAngle);
|
|
1228
|
+
const point = makeAstroWheelPoint({
|
|
1229
|
+
layer,
|
|
1230
|
+
seed,
|
|
1231
|
+
tickLine,
|
|
1232
|
+
leaderStart,
|
|
1233
|
+
tickAngle,
|
|
1234
|
+
labelAngle: tickAngle,
|
|
1235
|
+
glyphPosition: idealPosition,
|
|
1236
|
+
glyphFontSize: pointGlyphFontSize,
|
|
1237
|
+
color,
|
|
1238
|
+
tickColor
|
|
1239
|
+
});
|
|
1240
|
+
const layout = getPointLabelLayout(point, scale);
|
|
1241
|
+
const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
|
|
1242
|
+
const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
|
|
1243
|
+
const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
|
|
1244
|
+
const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
|
|
1245
|
+
return {
|
|
1246
|
+
seed,
|
|
1247
|
+
tickAngle,
|
|
1248
|
+
tickLine,
|
|
1249
|
+
leaderStart,
|
|
1250
|
+
glyphRadius,
|
|
1251
|
+
pointGlyphFontSize,
|
|
1252
|
+
tangentDemandPx
|
|
1253
|
+
};
|
|
1254
|
+
});
|
|
1255
|
+
const solvedLabels = solveCircularLabelAngles(
|
|
1256
|
+
pointIntents.map((intent) => ({
|
|
1257
|
+
item: intent,
|
|
1258
|
+
idealAngle: intent.tickAngle,
|
|
1259
|
+
radius: intent.glyphRadius,
|
|
1260
|
+
tangentDemandPx: intent.tangentDemandPx
|
|
1261
|
+
})),
|
|
1262
|
+
collisionPadding
|
|
1263
|
+
);
|
|
1264
|
+
const visualAngleByKey = Object.fromEntries(
|
|
1265
|
+
solvedLabels.map(({ item, visualAngle }) => [item.seed.key, visualAngle])
|
|
1266
|
+
);
|
|
1267
|
+
const points = pointIntents.map((intent) => {
|
|
1268
|
+
const visualAngle = visualAngleByKey[intent.seed.key] ?? intent.tickAngle;
|
|
1269
|
+
let glyphPosition = polarToXY(center.x, center.y, intent.glyphRadius, visualAngle);
|
|
1270
|
+
let point = makeAstroWheelPoint({
|
|
1271
|
+
layer,
|
|
1272
|
+
seed: intent.seed,
|
|
1273
|
+
tickLine: intent.tickLine,
|
|
1274
|
+
leaderStart: intent.leaderStart,
|
|
1275
|
+
tickAngle: intent.tickAngle,
|
|
1276
|
+
labelAngle: visualAngle,
|
|
1277
|
+
glyphPosition,
|
|
1278
|
+
glyphFontSize: intent.pointGlyphFontSize,
|
|
1279
|
+
color,
|
|
1280
|
+
tickColor
|
|
1281
|
+
});
|
|
1282
|
+
const layout = getPointLabelLayout(point, scale);
|
|
1283
|
+
const constrainedLabel = constrainLabelInsideCircle({
|
|
1284
|
+
center,
|
|
1285
|
+
position: glyphPosition,
|
|
1286
|
+
layout,
|
|
1287
|
+
padding: collisionPadding,
|
|
1288
|
+
maxRadius: labelMaxRadius
|
|
1289
|
+
});
|
|
1290
|
+
if (constrainedLabel.moved) {
|
|
1291
|
+
glyphPosition = constrainedLabel.position;
|
|
1292
|
+
point = {
|
|
1293
|
+
...point,
|
|
1294
|
+
glyphPosition,
|
|
1295
|
+
leaderLine: {
|
|
1296
|
+
x1: intent.leaderStart.x,
|
|
1297
|
+
y1: intent.leaderStart.y,
|
|
1298
|
+
x2: glyphPosition.x,
|
|
1299
|
+
y2: glyphPosition.y
|
|
1289
1300
|
}
|
|
1290
|
-
return {
|
|
1291
|
-
...point2,
|
|
1292
|
-
labelBounds: constrainedLabel.bounds
|
|
1293
|
-
};
|
|
1294
1301
|
};
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
attempts += 1;
|
|
1301
|
-
}
|
|
1302
|
-
if (point.labelBounds) {
|
|
1303
|
-
placedLabelBounds.push(point.labelBounds);
|
|
1304
|
-
}
|
|
1305
|
-
return point;
|
|
1306
|
-
});
|
|
1302
|
+
}
|
|
1303
|
+
return {
|
|
1304
|
+
...point,
|
|
1305
|
+
labelBounds: constrainedLabel.bounds
|
|
1306
|
+
};
|
|
1307
1307
|
});
|
|
1308
1308
|
return {
|
|
1309
1309
|
id: layer.id,
|
|
@@ -1314,6 +1314,45 @@ function buildPointLayer(params) {
|
|
|
1314
1314
|
points
|
|
1315
1315
|
};
|
|
1316
1316
|
}
|
|
1317
|
+
function makeAstroWheelPoint(params) {
|
|
1318
|
+
const {
|
|
1319
|
+
layer,
|
|
1320
|
+
seed,
|
|
1321
|
+
tickLine,
|
|
1322
|
+
leaderStart,
|
|
1323
|
+
tickAngle,
|
|
1324
|
+
labelAngle,
|
|
1325
|
+
glyphPosition,
|
|
1326
|
+
glyphFontSize,
|
|
1327
|
+
color,
|
|
1328
|
+
tickColor
|
|
1329
|
+
} = params;
|
|
1330
|
+
const labelDisplaced = circularAngleDistance(labelAngle, tickAngle) > 1e-4;
|
|
1331
|
+
return {
|
|
1332
|
+
layerId: layer.id,
|
|
1333
|
+
key: seed.key,
|
|
1334
|
+
name: seed.name,
|
|
1335
|
+
kind: seed.kind,
|
|
1336
|
+
glyph: seed.glyph,
|
|
1337
|
+
glyphKey: seed.glyphKey,
|
|
1338
|
+
longitude: normalizeAngle(seed.longitude),
|
|
1339
|
+
displayLongitude: normalizeAngle(seed.longitude),
|
|
1340
|
+
zodiacPosition: seed.zodiacPosition,
|
|
1341
|
+
tickLine,
|
|
1342
|
+
labelAngle,
|
|
1343
|
+
leaderLine: labelDisplaced ? {
|
|
1344
|
+
x1: leaderStart.x,
|
|
1345
|
+
y1: leaderStart.y,
|
|
1346
|
+
x2: glyphPosition.x,
|
|
1347
|
+
y2: glyphPosition.y
|
|
1348
|
+
} : void 0,
|
|
1349
|
+
glyphPosition,
|
|
1350
|
+
glyphFontSize,
|
|
1351
|
+
retrograde: seed.retrograde,
|
|
1352
|
+
color,
|
|
1353
|
+
tickColor
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1317
1356
|
function buildAspectLayer(params) {
|
|
1318
1357
|
const { layer, chart, pointByKey, center, angleOf, rings, palette, excludedBodies } = params;
|
|
1319
1358
|
const sourceEdges = getSourceAspectEdges(chart, {
|
|
@@ -1435,37 +1474,81 @@ function pointSeed(point, layerId) {
|
|
|
1435
1474
|
zodiacPosition: point.zodiacPosition
|
|
1436
1475
|
};
|
|
1437
1476
|
}
|
|
1438
|
-
function
|
|
1439
|
-
if (
|
|
1477
|
+
function solveCircularLabelAngles(items, paddingPx) {
|
|
1478
|
+
if (items.length === 0) {
|
|
1440
1479
|
return [];
|
|
1441
1480
|
}
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1481
|
+
const normalized = items.map((item) => ({
|
|
1482
|
+
...item,
|
|
1483
|
+
idealAngle: clampRad(item.idealAngle)
|
|
1484
|
+
})).sort((a, b) => a.idealAngle - b.idealAngle);
|
|
1485
|
+
if (normalized.length === 1) {
|
|
1486
|
+
return [{ ...normalized[0], visualAngle: normalized[0].idealAngle }];
|
|
1487
|
+
}
|
|
1488
|
+
let largestGap = -Infinity;
|
|
1489
|
+
let seamIndex = 0;
|
|
1490
|
+
for (let i = 0; i < normalized.length; i++) {
|
|
1491
|
+
const current = normalized[i];
|
|
1492
|
+
const next = normalized[(i + 1) % normalized.length];
|
|
1493
|
+
const nextAngle = i === normalized.length - 1 ? next.idealAngle + TAU : next.idealAngle;
|
|
1494
|
+
const gap = nextAngle - current.idealAngle;
|
|
1495
|
+
if (gap > largestGap) {
|
|
1496
|
+
largestGap = gap;
|
|
1497
|
+
seamIndex = (i + 1) % normalized.length;
|
|
1448
1498
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1499
|
+
}
|
|
1500
|
+
const linear = [
|
|
1501
|
+
...normalized.slice(seamIndex),
|
|
1502
|
+
...normalized.slice(0, seamIndex)
|
|
1503
|
+
].map((item, index) => {
|
|
1504
|
+
const wrapped = seamIndex > 0 && index >= normalized.length - seamIndex;
|
|
1505
|
+
return {
|
|
1506
|
+
...item,
|
|
1507
|
+
idealAngle: item.idealAngle + (wrapped ? TAU : 0)
|
|
1508
|
+
};
|
|
1509
|
+
});
|
|
1510
|
+
for (let i = 1; i < linear.length; i++) {
|
|
1511
|
+
while (linear[i].idealAngle <= linear[i - 1].idealAngle) {
|
|
1512
|
+
linear[i] = {
|
|
1513
|
+
...linear[i],
|
|
1514
|
+
idealAngle: linear[i].idealAngle + TAU
|
|
1515
|
+
};
|
|
1456
1516
|
}
|
|
1457
1517
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1518
|
+
const solved = linear.map((item) => ({
|
|
1519
|
+
...item,
|
|
1520
|
+
visualAngle: item.idealAngle
|
|
1521
|
+
}));
|
|
1522
|
+
for (let i = 1; i < solved.length; i++) {
|
|
1523
|
+
const previous = solved[i - 1];
|
|
1524
|
+
const current = solved[i];
|
|
1525
|
+
const minGap = labelAngularHalfDemand(previous, paddingPx) + labelAngularHalfDemand(current, paddingPx);
|
|
1526
|
+
if (current.visualAngle < previous.visualAngle + minGap) {
|
|
1527
|
+
current.visualAngle = previous.visualAngle + minGap;
|
|
1466
1528
|
}
|
|
1467
1529
|
}
|
|
1468
|
-
|
|
1530
|
+
for (let i = solved.length - 2; i >= 0; i--) {
|
|
1531
|
+
const current = solved[i];
|
|
1532
|
+
const next = solved[i + 1];
|
|
1533
|
+
const minGap = labelAngularHalfDemand(current, paddingPx) + labelAngularHalfDemand(next, paddingPx);
|
|
1534
|
+
if (current.visualAngle > next.visualAngle - minGap) {
|
|
1535
|
+
current.visualAngle = next.visualAngle - minGap;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return solved.map((item) => ({
|
|
1539
|
+
...item,
|
|
1540
|
+
visualAngle: clampRad(item.visualAngle)
|
|
1541
|
+
}));
|
|
1542
|
+
}
|
|
1543
|
+
function labelAngularHalfDemand(item, paddingPx) {
|
|
1544
|
+
return (item.tangentDemandPx / 2 + paddingPx) / Math.max(item.radius, 1);
|
|
1545
|
+
}
|
|
1546
|
+
function clampRad(value) {
|
|
1547
|
+
return (value % TAU + TAU) % TAU;
|
|
1548
|
+
}
|
|
1549
|
+
function circularAngleDistance(a, b) {
|
|
1550
|
+
const delta = Math.abs(clampRad(a) - clampRad(b));
|
|
1551
|
+
return Math.min(delta, TAU - delta);
|
|
1469
1552
|
}
|
|
1470
1553
|
function getSourceAspectEdges(chart, options) {
|
|
1471
1554
|
if (options.edges) {
|
|
@@ -1575,7 +1658,7 @@ function resolvePalette(palette = "default", background = "transparent") {
|
|
|
1575
1658
|
};
|
|
1576
1659
|
}
|
|
1577
1660
|
function defaultGlyphHalo(background) {
|
|
1578
|
-
return background === "transparent" ? "#
|
|
1661
|
+
return background === "transparent" ? "#fff" : background;
|
|
1579
1662
|
}
|
|
1580
1663
|
function clonePalette(palette) {
|
|
1581
1664
|
return {
|
|
@@ -2758,5 +2841,5 @@ exports.getAstroWheelRenderModel = getAstroWheelRenderModel;
|
|
|
2758
2841
|
exports.getTreeLayout = getTreeLayout;
|
|
2759
2842
|
exports.getTreeRenderModel = getTreeRenderModel;
|
|
2760
2843
|
exports.listAstroGlyphs = listAstroGlyphs;
|
|
2761
|
-
//# sourceMappingURL=chunk-
|
|
2762
|
-
//# sourceMappingURL=chunk-
|
|
2844
|
+
//# sourceMappingURL=chunk-NRAAMI6I.js.map
|
|
2845
|
+
//# sourceMappingURL=chunk-NRAAMI6I.js.map
|