kaabalah 6.2.3 → 6.3.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/README.md +30 -0
- package/dist/astrology/index.d.mts +10 -4
- package/dist/astrology/index.d.ts +10 -4
- package/dist/astrology/index.js +52 -52
- package/dist/astrology/index.mjs +1 -1
- package/dist/{chunk-3JSPGVX3.js → chunk-6O7MTBZN.js} +36 -6
- package/dist/chunk-6O7MTBZN.js.map +1 -0
- package/dist/{chunk-S4EJ3ZY7.mjs → chunk-6P2CJUTH.mjs} +3 -3
- package/dist/{chunk-S4EJ3ZY7.mjs.map → chunk-6P2CJUTH.mjs.map} +1 -1
- package/dist/{chunk-O3ZBG566.js → chunk-COPYH3O2.js} +23 -23
- package/dist/{chunk-O3ZBG566.js.map → chunk-COPYH3O2.js.map} +1 -1
- package/dist/{chunk-RZBVUDBM.mjs → chunk-EFZUZI22.mjs} +81 -73
- package/dist/chunk-EFZUZI22.mjs.map +1 -0
- package/dist/chunk-EMMXVM35.mjs +511 -0
- package/dist/chunk-EMMXVM35.mjs.map +1 -0
- package/dist/{chunk-RWX6HFS5.mjs → chunk-HGGCF2CF.mjs} +5 -5
- package/dist/{chunk-RWX6HFS5.mjs.map → chunk-HGGCF2CF.mjs.map} +1 -1
- package/dist/{chunk-3KJSW6ZP.js → chunk-MJINIICB.js} +29 -29
- package/dist/{chunk-3KJSW6ZP.js.map → chunk-MJINIICB.js.map} +1 -1
- package/dist/{chunk-2RGUI5FG.mjs → chunk-MTI2SOQ6.mjs} +4 -4
- package/dist/{chunk-2RGUI5FG.mjs.map → chunk-MTI2SOQ6.mjs.map} +1 -1
- package/dist/{chunk-TMN4PYVG.js → chunk-OKZUVGA3.js} +9 -9
- package/dist/{chunk-TMN4PYVG.js.map → chunk-OKZUVGA3.js.map} +1 -1
- package/dist/{chunk-Y4PTMABP.js → chunk-PAKYKIZH.js} +4 -4
- package/dist/{chunk-Y4PTMABP.js.map → chunk-PAKYKIZH.js.map} +1 -1
- package/dist/{chunk-TZJU6SRX.mjs → chunk-PWYOHULD.mjs} +36 -6
- package/dist/chunk-PWYOHULD.mjs.map +1 -0
- package/dist/{chunk-HAMDOCS5.js → chunk-S6KNERP7.js} +81 -73
- package/dist/chunk-S6KNERP7.js.map +1 -0
- package/dist/chunk-WGYXJEG5.js +518 -0
- package/dist/chunk-WGYXJEG5.js.map +1 -0
- package/dist/{chunk-G76K6OVQ.mjs → chunk-WIKUOEOB.mjs} +3 -3
- package/dist/{chunk-G76K6OVQ.mjs.map → chunk-WIKUOEOB.mjs.map} +1 -1
- package/dist/{chunk-WSSELKIB.js → chunk-XTE5DSDO.js} +23 -23
- package/dist/{chunk-WSSELKIB.js.map → chunk-XTE5DSDO.js.map} +1 -1
- package/dist/{chunk-NBP75BAH.mjs → chunk-ZKIJAZ6B.mjs} +3 -3
- package/dist/{chunk-NBP75BAH.mjs.map → chunk-ZKIJAZ6B.mjs.map} +1 -1
- package/dist/cli.js +988 -108
- package/dist/cli.js.map +1 -1
- package/dist/core/index.js +43 -43
- package/dist/core/index.mjs +2 -2
- package/dist/gematria/index.js +5 -5
- package/dist/gematria/index.mjs +2 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +199 -174
- package/dist/index.mjs +8 -7
- package/dist/numerology/index.js +18 -18
- package/dist/numerology/index.mjs +3 -3
- package/dist/semantic/index.js +10 -10
- package/dist/semantic/index.mjs +4 -4
- package/dist/tarot/index.js +23 -23
- package/dist/tarot/index.mjs +3 -3
- package/dist/visual/index.d.mts +64 -0
- package/dist/visual/index.d.ts +64 -0
- package/dist/visual/index.js +35 -0
- package/dist/visual/index.js.map +1 -0
- package/dist/visual/index.mjs +6 -0
- package/dist/visual/index.mjs.map +1 -0
- package/package.json +6 -1
- package/dist/chunk-3JSPGVX3.js.map +0 -1
- package/dist/chunk-HAMDOCS5.js.map +0 -1
- package/dist/chunk-RZBVUDBM.mjs.map +0 -1
- package/dist/chunk-TZJU6SRX.mjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -543,8 +543,8 @@ var require_swisseph_web = __commonJS({
|
|
|
543
543
|
var moduleRtn;
|
|
544
544
|
var Module = moduleArg;
|
|
545
545
|
var readyPromiseResolve, readyPromiseReject;
|
|
546
|
-
var readyPromise = new Promise((
|
|
547
|
-
readyPromiseResolve =
|
|
546
|
+
var readyPromise = new Promise((resolve2, reject) => {
|
|
547
|
+
readyPromiseResolve = resolve2;
|
|
548
548
|
readyPromiseReject = reject;
|
|
549
549
|
});
|
|
550
550
|
var ENVIRONMENT_IS_WEB = typeof window == "object";
|
|
@@ -1005,11 +1005,11 @@ var require_swisseph_web = __commonJS({
|
|
|
1005
1005
|
}
|
|
1006
1006
|
var info = getWasmImports();
|
|
1007
1007
|
if (Module["instantiateWasm"]) {
|
|
1008
|
-
return new Promise((
|
|
1008
|
+
return new Promise((resolve2, reject) => {
|
|
1009
1009
|
try {
|
|
1010
1010
|
Module["instantiateWasm"](info, (mod, inst) => {
|
|
1011
1011
|
receiveInstance(mod, inst);
|
|
1012
|
-
|
|
1012
|
+
resolve2(mod.exports);
|
|
1013
1013
|
});
|
|
1014
1014
|
} catch (e) {
|
|
1015
1015
|
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
@@ -3640,8 +3640,8 @@ var require_swisseph_node = __commonJS({
|
|
|
3640
3640
|
var moduleRtn;
|
|
3641
3641
|
var Module = moduleArg;
|
|
3642
3642
|
var readyPromiseResolve, readyPromiseReject;
|
|
3643
|
-
var readyPromise = new Promise((
|
|
3644
|
-
readyPromiseResolve =
|
|
3643
|
+
var readyPromise = new Promise((resolve2, reject) => {
|
|
3644
|
+
readyPromiseResolve = resolve2;
|
|
3645
3645
|
readyPromiseReject = reject;
|
|
3646
3646
|
});
|
|
3647
3647
|
var ENVIRONMENT_IS_WEB = typeof window == "object";
|
|
@@ -4102,11 +4102,11 @@ var require_swisseph_node = __commonJS({
|
|
|
4102
4102
|
}
|
|
4103
4103
|
var info = getWasmImports();
|
|
4104
4104
|
if (Module["instantiateWasm"]) {
|
|
4105
|
-
return new Promise((
|
|
4105
|
+
return new Promise((resolve2, reject) => {
|
|
4106
4106
|
try {
|
|
4107
4107
|
Module["instantiateWasm"](info, (mod, inst) => {
|
|
4108
4108
|
receiveInstance(mod, inst);
|
|
4109
|
-
|
|
4109
|
+
resolve2(mod.exports);
|
|
4110
4110
|
});
|
|
4111
4111
|
} catch (e) {
|
|
4112
4112
|
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
@@ -8361,8 +8361,38 @@ __export(astrology_exports, {
|
|
|
8361
8361
|
resolveSwissEphRuntimeAssets: () => resolveSwissEphRuntimeAssets,
|
|
8362
8362
|
shorterArcMidpoint: () => shorterArcMidpoint
|
|
8363
8363
|
});
|
|
8364
|
+
function isValidLocalDateTimeParts(date) {
|
|
8365
|
+
const hour = date.hour ?? 0;
|
|
8366
|
+
const minute = date.minute ?? 0;
|
|
8367
|
+
const second = date.second ?? 0;
|
|
8368
|
+
if (!Number.isInteger(date.year) || !Number.isInteger(date.month) || !Number.isInteger(date.day) || !Number.isInteger(hour) || !Number.isInteger(minute) || !Number.isInteger(second)) {
|
|
8369
|
+
return false;
|
|
8370
|
+
}
|
|
8371
|
+
if (date.month < 1 || date.month > 12 || date.day < 1 || date.day > 31 || hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59) {
|
|
8372
|
+
return false;
|
|
8373
|
+
}
|
|
8374
|
+
const utcDate = new Date(Date.UTC(date.year, date.month - 1, date.day, hour, minute, second));
|
|
8375
|
+
return !Number.isNaN(utcDate.getTime()) && utcDate.getUTCFullYear() === date.year && utcDate.getUTCMonth() === date.month - 1 && utcDate.getUTCDate() === date.day && utcDate.getUTCHours() === hour && utcDate.getUTCMinutes() === minute && utcDate.getUTCSeconds() === second;
|
|
8376
|
+
}
|
|
8377
|
+
function getCivilMonthDay(date) {
|
|
8378
|
+
if (date instanceof Date) {
|
|
8379
|
+
return {
|
|
8380
|
+
monthIndex: date.getMonth(),
|
|
8381
|
+
day: date.getDate()
|
|
8382
|
+
};
|
|
8383
|
+
}
|
|
8384
|
+
return {
|
|
8385
|
+
monthIndex: date.month - 1,
|
|
8386
|
+
day: date.day
|
|
8387
|
+
};
|
|
8388
|
+
}
|
|
8364
8389
|
function validateInputs(options) {
|
|
8365
|
-
|
|
8390
|
+
const { date } = options;
|
|
8391
|
+
if (date instanceof Date) {
|
|
8392
|
+
if (Number.isNaN(date.getTime())) {
|
|
8393
|
+
throw new Error("Invalid date provided");
|
|
8394
|
+
}
|
|
8395
|
+
} else if (!isValidLocalDateTimeParts(date)) {
|
|
8366
8396
|
throw new Error("Invalid date provided");
|
|
8367
8397
|
}
|
|
8368
8398
|
if (typeof options.latitude !== "number" || options.latitude < -90 || options.latitude > 90) {
|
|
@@ -8819,11 +8849,11 @@ function signedAngularDelta(current, target) {
|
|
|
8819
8849
|
async function getSolarReturnChart(options) {
|
|
8820
8850
|
const natalChart = await getBirthChart(options.natal);
|
|
8821
8851
|
const natalSunLongitude = natalChart.planets.sun.longitude;
|
|
8822
|
-
const natalDate = options.natal.date;
|
|
8852
|
+
const natalDate = getCivilMonthDay(options.natal.date);
|
|
8823
8853
|
const approxReturn = new Date(Date.UTC(
|
|
8824
8854
|
options.year,
|
|
8825
|
-
natalDate.
|
|
8826
|
-
natalDate.
|
|
8855
|
+
natalDate.monthIndex,
|
|
8856
|
+
natalDate.day,
|
|
8827
8857
|
12,
|
|
8828
8858
|
0,
|
|
8829
8859
|
0
|
|
@@ -8902,7 +8932,7 @@ var import_config3 = require("dotenv/config");
|
|
|
8902
8932
|
// package.json
|
|
8903
8933
|
var package_default = {
|
|
8904
8934
|
name: "kaabalah",
|
|
8905
|
-
version: "6.
|
|
8935
|
+
version: "6.3.0",
|
|
8906
8936
|
description: "The de-facto library for any esoteric calculations and tooling",
|
|
8907
8937
|
engines: {
|
|
8908
8938
|
node: ">=18.18.0"
|
|
@@ -8965,6 +8995,11 @@ var package_default = {
|
|
|
8965
8995
|
types: "./dist/semantic/index.d.ts",
|
|
8966
8996
|
require: "./dist/semantic/index.js",
|
|
8967
8997
|
import: "./dist/semantic/index.mjs"
|
|
8998
|
+
},
|
|
8999
|
+
"./visual": {
|
|
9000
|
+
types: "./dist/visual/index.d.ts",
|
|
9001
|
+
require: "./dist/visual/index.js",
|
|
9002
|
+
import: "./dist/visual/index.mjs"
|
|
8968
9003
|
}
|
|
8969
9004
|
},
|
|
8970
9005
|
files: [
|
|
@@ -9174,6 +9209,56 @@ var COMMANDS = [
|
|
|
9174
9209
|
flags: [],
|
|
9175
9210
|
examples: ["kaabalah tree:types --json"]
|
|
9176
9211
|
},
|
|
9212
|
+
{
|
|
9213
|
+
name: "tree:layout",
|
|
9214
|
+
description: "Return the canonical Tree of Life layout coordinates for overlays and rendering",
|
|
9215
|
+
args: [],
|
|
9216
|
+
flags: [
|
|
9217
|
+
{ name: "system", type: "string", default: "kaabalah", description: "Tree system: kaabalah, hermetic-qabalah, lurianic-kabbalah" },
|
|
9218
|
+
{ name: "units", type: "string", default: "both", description: "Coordinate space: percentages, viewBoxUnits, or both" }
|
|
9219
|
+
],
|
|
9220
|
+
examples: [
|
|
9221
|
+
"kaabalah tree:layout --json --compact",
|
|
9222
|
+
"kaabalah tree:layout --system=hermetic-qabalah --units=percentages --json"
|
|
9223
|
+
]
|
|
9224
|
+
},
|
|
9225
|
+
{
|
|
9226
|
+
name: "tree:svg",
|
|
9227
|
+
description: "Generate a structural Tree of Life SVG from the canonical library renderer",
|
|
9228
|
+
args: [],
|
|
9229
|
+
flags: [
|
|
9230
|
+
{ name: "system", type: "string", default: "kaabalah", description: "Tree system: kaabalah, hermetic-qabalah, lurianic-kabbalah" },
|
|
9231
|
+
{ name: "width", type: "string", description: "SVG width attribute (e.g. 1110mm, 800, 100%)" },
|
|
9232
|
+
{ name: "height", type: "string", description: "SVG height attribute (e.g. 2220mm, 600, 100%)" },
|
|
9233
|
+
{ name: "background", type: "string", default: "white", description: 'Background fill color, or "transparent"' },
|
|
9234
|
+
{ name: "palette", type: "string", default: "color", description: 'Palette: "color" or "monochrome"' },
|
|
9235
|
+
{ name: "daath-layer", type: "string", default: "front", description: 'Render Daath in front of or behind the paths: "front" or "back"' },
|
|
9236
|
+
{ name: "output", type: "string", description: "Write the SVG to a file instead of stdout" },
|
|
9237
|
+
{ name: "viewbox-width", type: "number", description: "Override SVG viewBox width" },
|
|
9238
|
+
{ name: "viewbox-height", type: "number", description: "Override SVG viewBox height" },
|
|
9239
|
+
{ name: "viewbox-min-x", type: "number", default: 0, description: "Override SVG viewBox min-x" },
|
|
9240
|
+
{ name: "viewbox-min-y", type: "number", default: 0, description: "Override SVG viewBox min-y" }
|
|
9241
|
+
],
|
|
9242
|
+
examples: [
|
|
9243
|
+
"kaabalah tree:svg --json --compact --fields=svg",
|
|
9244
|
+
"kaabalah tree:svg --background=transparent --palette=monochrome --output=tree.svg --json",
|
|
9245
|
+
"kaabalah tree:svg --background=transparent --daath-layer=back --json --compact"
|
|
9246
|
+
]
|
|
9247
|
+
},
|
|
9248
|
+
{
|
|
9249
|
+
name: "tree:ascii",
|
|
9250
|
+
description: "Render a lightweight ASCII Tree of Life preview from the canonical layout",
|
|
9251
|
+
args: [],
|
|
9252
|
+
flags: [
|
|
9253
|
+
{ name: "system", type: "string", default: "kaabalah", description: "Tree system: kaabalah, hermetic-qabalah, lurianic-kabbalah" },
|
|
9254
|
+
{ name: "columns", type: "number", default: 61, description: "ASCII canvas width in characters (minimum 21)" },
|
|
9255
|
+
{ name: "rows", type: "number", default: 31, description: "ASCII canvas height in lines (minimum 11)" }
|
|
9256
|
+
],
|
|
9257
|
+
examples: [
|
|
9258
|
+
"kaabalah tree:ascii --no-json",
|
|
9259
|
+
"kaabalah tree:ascii --columns=41 --rows=21 --json --compact"
|
|
9260
|
+
]
|
|
9261
|
+
},
|
|
9177
9262
|
{
|
|
9178
9263
|
name: "astrology",
|
|
9179
9264
|
description: "Calculate birth chart using Swiss Ephemeris",
|
|
@@ -14452,13 +14537,13 @@ function loadHermeticQabalah(tree) {
|
|
|
14452
14537
|
}
|
|
14453
14538
|
];
|
|
14454
14539
|
for (const path of paths) {
|
|
14455
|
-
const
|
|
14540
|
+
const pathId2 = tree.addPath({
|
|
14456
14541
|
leftSphere: path.leftSphere,
|
|
14457
14542
|
rightSphere: path.rightSphere,
|
|
14458
14543
|
relatedNumber: path.relatedNumber
|
|
14459
14544
|
});
|
|
14460
14545
|
tree.addLetters({
|
|
14461
|
-
path:
|
|
14546
|
+
path: pathId2,
|
|
14462
14547
|
letters: path.letters
|
|
14463
14548
|
});
|
|
14464
14549
|
}
|
|
@@ -15018,7 +15103,7 @@ function loadColors(tree) {
|
|
|
15018
15103
|
}
|
|
15019
15104
|
];
|
|
15020
15105
|
for (const sphereColor of sphereColors) {
|
|
15021
|
-
const
|
|
15106
|
+
const sphereId2 = id("sphere" /* SPHERE */, sphereColor.sphere);
|
|
15022
15107
|
for (const worldColor of sphereColor.worldColors) {
|
|
15023
15108
|
const colorId = tree.upsertNode(
|
|
15024
15109
|
new BaseNode({
|
|
@@ -15027,7 +15112,7 @@ function loadColors(tree) {
|
|
|
15027
15112
|
data: worldColor.color.data
|
|
15028
15113
|
})
|
|
15029
15114
|
);
|
|
15030
|
-
tree.link(
|
|
15115
|
+
tree.link(sphereId2, colorId);
|
|
15031
15116
|
tree.link(colorId, id("world" /* WORLD */, worldColor.world));
|
|
15032
15117
|
}
|
|
15033
15118
|
}
|
|
@@ -15107,7 +15192,7 @@ function loadMusicalNotes(tree) {
|
|
|
15107
15192
|
}
|
|
15108
15193
|
];
|
|
15109
15194
|
for (const musicalNote of musicalNotes) {
|
|
15110
|
-
const
|
|
15195
|
+
const sphereId2 = id("sphere" /* SPHERE */, musicalNote.sphere);
|
|
15111
15196
|
const noteId = tree.upsertNode(
|
|
15112
15197
|
new BaseNode({
|
|
15113
15198
|
id: id("musicalNote" /* MUSICAL_NOTE */, musicalNote.note),
|
|
@@ -15115,7 +15200,7 @@ function loadMusicalNotes(tree) {
|
|
|
15115
15200
|
data: musicalNote.noteData
|
|
15116
15201
|
})
|
|
15117
15202
|
);
|
|
15118
|
-
tree.link(
|
|
15203
|
+
tree.link(sphereId2, noteId);
|
|
15119
15204
|
}
|
|
15120
15205
|
return tree;
|
|
15121
15206
|
}
|
|
@@ -15145,14 +15230,14 @@ var loadWesternAstrology = (tree) => {
|
|
|
15145
15230
|
{ sphere: SPHERES.MALKUTH, planet: PLANETS.EARTH }
|
|
15146
15231
|
];
|
|
15147
15232
|
for (const planet of planets) {
|
|
15148
|
-
const
|
|
15233
|
+
const sphereId2 = id("sphere" /* SPHERE */, planet.sphere);
|
|
15149
15234
|
const planetId = tree.upsertNode(
|
|
15150
15235
|
new BaseNode({
|
|
15151
15236
|
id: id("planet" /* PLANET */, planet.planet),
|
|
15152
15237
|
type: "planet" /* PLANET */
|
|
15153
15238
|
})
|
|
15154
15239
|
);
|
|
15155
|
-
tree.link(
|
|
15240
|
+
tree.link(sphereId2, planetId);
|
|
15156
15241
|
}
|
|
15157
15242
|
return tree;
|
|
15158
15243
|
};
|
|
@@ -15776,14 +15861,14 @@ var loadKaabalah = (tree) => {
|
|
|
15776
15861
|
}
|
|
15777
15862
|
];
|
|
15778
15863
|
for (const path of paths) {
|
|
15779
|
-
const
|
|
15864
|
+
const pathId2 = tree.addPath({
|
|
15780
15865
|
leftSphere: path.leftSphere,
|
|
15781
15866
|
rightSphere: path.rightSphere,
|
|
15782
15867
|
relatedNumber: path.relatedNumber,
|
|
15783
15868
|
data: path.data
|
|
15784
15869
|
});
|
|
15785
15870
|
tree.addLetters({
|
|
15786
|
-
path:
|
|
15871
|
+
path: pathId2,
|
|
15787
15872
|
letters: path.letters
|
|
15788
15873
|
});
|
|
15789
15874
|
}
|
|
@@ -15934,89 +16019,93 @@ var loadColors2 = (tree) => {
|
|
|
15934
16019
|
},
|
|
15935
16020
|
{
|
|
15936
16021
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.KETHER_BINAH),
|
|
15937
|
-
color: "
|
|
16022
|
+
color: "warm-gold",
|
|
15938
16023
|
colorData: {
|
|
15939
|
-
colorDescription: "
|
|
15940
|
-
colorNames: ["
|
|
15941
|
-
colorHexCodes: ["#
|
|
16024
|
+
colorDescription: "Warm gold",
|
|
16025
|
+
colorNames: ["warm gold"],
|
|
16026
|
+
colorHexCodes: ["#E8C848"]
|
|
15942
16027
|
}
|
|
15943
16028
|
},
|
|
15944
16029
|
{
|
|
15945
16030
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.KETHER_TIPHARETH),
|
|
15946
|
-
color: "grey",
|
|
16031
|
+
color: "blue-grey",
|
|
15947
16032
|
colorData: {
|
|
15948
|
-
colorDescription: "
|
|
15949
|
-
colorNames: ["grey"],
|
|
15950
|
-
colorHexCodes: ["#
|
|
16033
|
+
colorDescription: "Blue-grey",
|
|
16034
|
+
colorNames: ["blue-grey"],
|
|
16035
|
+
colorHexCodes: ["#8098B0"]
|
|
15951
16036
|
}
|
|
15952
16037
|
},
|
|
15953
16038
|
{
|
|
15954
16039
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHOKHMAH_BINAH),
|
|
15955
|
-
color: "
|
|
16040
|
+
color: "salmon-pink",
|
|
15956
16041
|
colorData: {
|
|
15957
|
-
colorDescription: "
|
|
15958
|
-
colorNames: ["
|
|
15959
|
-
colorHexCodes: ["#
|
|
16042
|
+
colorDescription: "Salmon pink",
|
|
16043
|
+
colorNames: ["salmon pink"],
|
|
16044
|
+
colorHexCodes: ["#E06080"]
|
|
15960
16045
|
}
|
|
15961
16046
|
},
|
|
15962
16047
|
{
|
|
15963
16048
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHOKHMAH_TIPHARETH),
|
|
15964
|
-
color: "
|
|
16049
|
+
color: "warm-salmon",
|
|
15965
16050
|
colorData: {
|
|
15966
|
-
colorDescription: "
|
|
15967
|
-
colorNames: ["
|
|
15968
|
-
colorHexCodes: ["#
|
|
16051
|
+
colorDescription: "Warm salmon",
|
|
16052
|
+
colorNames: ["warm salmon"],
|
|
16053
|
+
colorHexCodes: ["#E87050"]
|
|
15969
16054
|
}
|
|
15970
16055
|
},
|
|
15971
16056
|
{
|
|
15972
16057
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHOKHMAH_CHESED),
|
|
15973
|
-
color: "
|
|
16058
|
+
color: "periwinkle-blue",
|
|
15974
16059
|
colorData: {
|
|
15975
|
-
colorDescription: "
|
|
15976
|
-
colorNames: ["
|
|
15977
|
-
colorHexCodes: ["#
|
|
16060
|
+
colorDescription: "Periwinkle blue",
|
|
16061
|
+
colorNames: ["periwinkle blue"],
|
|
16062
|
+
colorHexCodes: ["#7088C0"]
|
|
15978
16063
|
}
|
|
15979
16064
|
},
|
|
15980
16065
|
{
|
|
15981
16066
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.BINAH_TIPHARETH),
|
|
15982
|
-
color: "orange
|
|
16067
|
+
color: "peach-orange",
|
|
15983
16068
|
colorData: {
|
|
15984
|
-
colorDescription: "
|
|
15985
|
-
colorNames: ["orange
|
|
15986
|
-
colorHexCodes: ["#
|
|
16069
|
+
colorDescription: "Peach orange",
|
|
16070
|
+
colorNames: ["peach orange"],
|
|
16071
|
+
colorHexCodes: ["#E8A850"]
|
|
15987
16072
|
}
|
|
15988
16073
|
},
|
|
15989
16074
|
{
|
|
15990
16075
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.BINAH_GEBURAH),
|
|
15991
|
-
color: "
|
|
16076
|
+
color: "dark-red",
|
|
15992
16077
|
colorData: {
|
|
15993
|
-
colorDescription: "
|
|
15994
|
-
colorNames: ["
|
|
15995
|
-
colorHexCodes: ["#
|
|
16078
|
+
colorDescription: "Dark red",
|
|
16079
|
+
colorNames: ["dark red"],
|
|
16080
|
+
colorHexCodes: ["#C82030"]
|
|
15996
16081
|
}
|
|
15997
16082
|
},
|
|
15998
16083
|
{
|
|
15999
16084
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHESED_GEBURAH),
|
|
16000
|
-
color: "
|
|
16085
|
+
color: "olive-green",
|
|
16001
16086
|
colorData: {
|
|
16002
|
-
colorDescription: "
|
|
16003
|
-
colorNames: ["
|
|
16004
|
-
colorHexCodes: ["#
|
|
16087
|
+
colorDescription: "Olive green",
|
|
16088
|
+
colorNames: ["olive green"],
|
|
16089
|
+
colorHexCodes: ["#A8B840"]
|
|
16005
16090
|
}
|
|
16006
16091
|
},
|
|
16007
16092
|
{
|
|
16008
16093
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHESED_TIPHARETH),
|
|
16009
|
-
color: "
|
|
16094
|
+
color: "sage",
|
|
16010
16095
|
colorData: {
|
|
16011
|
-
colorDescription: "
|
|
16012
|
-
colorNames: ["
|
|
16013
|
-
colorHexCodes: ["#
|
|
16096
|
+
colorDescription: "Sage",
|
|
16097
|
+
colorNames: ["sage"],
|
|
16098
|
+
colorHexCodes: ["#B6BD9A"]
|
|
16014
16099
|
}
|
|
16015
16100
|
},
|
|
16016
16101
|
{
|
|
16017
16102
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHESED_NETZACH),
|
|
16018
|
-
color:
|
|
16019
|
-
colorData:
|
|
16103
|
+
color: "blue",
|
|
16104
|
+
colorData: {
|
|
16105
|
+
colorDescription: "Blue",
|
|
16106
|
+
colorNames: ["blue"],
|
|
16107
|
+
colorHexCodes: ["#5080C0"]
|
|
16108
|
+
}
|
|
16020
16109
|
},
|
|
16021
16110
|
{
|
|
16022
16111
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.GEBURAH_TIPHARETH),
|
|
@@ -16024,39 +16113,43 @@ var loadColors2 = (tree) => {
|
|
|
16024
16113
|
colorData: {
|
|
16025
16114
|
colorDescription: "Emerald green",
|
|
16026
16115
|
colorNames: ["emerald green"],
|
|
16027
|
-
colorHexCodes: ["#
|
|
16116
|
+
colorHexCodes: ["#48A860"]
|
|
16028
16117
|
}
|
|
16029
16118
|
},
|
|
16030
16119
|
{
|
|
16031
16120
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.GEBURAH_HOD),
|
|
16032
|
-
color: "
|
|
16121
|
+
color: "lavender",
|
|
16033
16122
|
colorData: {
|
|
16034
|
-
colorDescription: "
|
|
16035
|
-
colorNames: ["
|
|
16036
|
-
colorHexCodes: ["#
|
|
16123
|
+
colorDescription: "Lavender",
|
|
16124
|
+
colorNames: ["lavender"],
|
|
16125
|
+
colorHexCodes: ["#8878B8"]
|
|
16037
16126
|
}
|
|
16038
16127
|
},
|
|
16039
16128
|
{
|
|
16040
16129
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.TIPHARETH_NETZACH),
|
|
16041
|
-
color: "
|
|
16130
|
+
color: "teal-green-netzach",
|
|
16042
16131
|
colorData: {
|
|
16043
|
-
colorDescription: "
|
|
16044
|
-
colorNames: ["
|
|
16045
|
-
colorHexCodes: ["#
|
|
16132
|
+
colorDescription: "Teal green",
|
|
16133
|
+
colorNames: ["teal green"],
|
|
16134
|
+
colorHexCodes: ["#28A880"]
|
|
16046
16135
|
}
|
|
16047
16136
|
},
|
|
16048
16137
|
{
|
|
16049
16138
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.TIPHARETH_YESOD),
|
|
16050
|
-
color:
|
|
16051
|
-
colorData:
|
|
16139
|
+
color: "purple-yesod-path",
|
|
16140
|
+
colorData: {
|
|
16141
|
+
colorDescription: "Purple",
|
|
16142
|
+
colorNames: ["purple"],
|
|
16143
|
+
colorHexCodes: ["#8050A8"]
|
|
16144
|
+
}
|
|
16052
16145
|
},
|
|
16053
16146
|
{
|
|
16054
16147
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.TIPHARETH_HOD),
|
|
16055
|
-
color: "
|
|
16148
|
+
color: "magenta-pink",
|
|
16056
16149
|
colorData: {
|
|
16057
|
-
colorDescription: "
|
|
16058
|
-
colorNames: ["
|
|
16059
|
-
colorHexCodes: ["#
|
|
16150
|
+
colorDescription: "Magenta pink",
|
|
16151
|
+
colorNames: ["magenta pink"],
|
|
16152
|
+
colorHexCodes: ["#C850A0"]
|
|
16060
16153
|
}
|
|
16061
16154
|
},
|
|
16062
16155
|
{
|
|
@@ -16065,7 +16158,7 @@ var loadColors2 = (tree) => {
|
|
|
16065
16158
|
colorData: {
|
|
16066
16159
|
colorDescription: "Rose",
|
|
16067
16160
|
colorNames: ["Rose"],
|
|
16068
|
-
colorHexCodes: ["#
|
|
16161
|
+
colorHexCodes: ["#D06088"]
|
|
16069
16162
|
}
|
|
16070
16163
|
},
|
|
16071
16164
|
{
|
|
@@ -16074,43 +16167,43 @@ var loadColors2 = (tree) => {
|
|
|
16074
16167
|
colorData: {
|
|
16075
16168
|
colorDescription: "Violet",
|
|
16076
16169
|
colorNames: ["violet"],
|
|
16077
|
-
colorHexCodes: ["#
|
|
16170
|
+
colorHexCodes: ["#8848C0"]
|
|
16078
16171
|
}
|
|
16079
16172
|
},
|
|
16080
16173
|
{
|
|
16081
16174
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.NETZACH_MALKUTH),
|
|
16082
|
-
color: "
|
|
16175
|
+
color: "salmon",
|
|
16083
16176
|
colorData: {
|
|
16084
|
-
colorDescription: "
|
|
16085
|
-
colorNames: ["
|
|
16086
|
-
colorHexCodes: ["#
|
|
16177
|
+
colorDescription: "Salmon",
|
|
16178
|
+
colorNames: ["salmon"],
|
|
16179
|
+
colorHexCodes: ["#D86858"]
|
|
16087
16180
|
}
|
|
16088
16181
|
},
|
|
16089
16182
|
{
|
|
16090
16183
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.HOD_YESOD),
|
|
16091
|
-
color: "orange
|
|
16184
|
+
color: "orange",
|
|
16092
16185
|
colorData: {
|
|
16093
|
-
colorDescription: "Orange
|
|
16094
|
-
colorNames: ["orange
|
|
16095
|
-
colorHexCodes: ["#
|
|
16186
|
+
colorDescription: "Orange",
|
|
16187
|
+
colorNames: ["orange"],
|
|
16188
|
+
colorHexCodes: ["#E89040"]
|
|
16096
16189
|
}
|
|
16097
16190
|
},
|
|
16098
16191
|
{
|
|
16099
16192
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.HOD_MALKUTH),
|
|
16100
|
-
color: "
|
|
16193
|
+
color: "rose-pink",
|
|
16101
16194
|
colorData: {
|
|
16102
|
-
colorDescription: "
|
|
16103
|
-
colorNames: ["
|
|
16104
|
-
colorHexCodes: ["#
|
|
16195
|
+
colorDescription: "Rose pink",
|
|
16196
|
+
colorNames: ["rose pink"],
|
|
16197
|
+
colorHexCodes: ["#D06080"]
|
|
16105
16198
|
}
|
|
16106
16199
|
},
|
|
16107
16200
|
{
|
|
16108
16201
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.YESOD_MALKUTH),
|
|
16109
|
-
color: "
|
|
16202
|
+
color: "teal-green-malkuth",
|
|
16110
16203
|
colorData: {
|
|
16111
|
-
colorDescription: "
|
|
16112
|
-
colorNames: ["
|
|
16113
|
-
colorHexCodes: ["#
|
|
16204
|
+
colorDescription: "Teal green",
|
|
16205
|
+
colorNames: ["teal green"],
|
|
16206
|
+
colorHexCodes: ["#30B898"]
|
|
16114
16207
|
}
|
|
16115
16208
|
}
|
|
16116
16209
|
];
|
|
@@ -18094,13 +18187,13 @@ function loadLurianicKabbalah(tree) {
|
|
|
18094
18187
|
}
|
|
18095
18188
|
];
|
|
18096
18189
|
for (const path of paths) {
|
|
18097
|
-
const
|
|
18190
|
+
const pathId2 = tree.addPath({
|
|
18098
18191
|
leftSphere: path.leftSphere,
|
|
18099
18192
|
rightSphere: path.rightSphere,
|
|
18100
18193
|
relatedNumber: path.relatedNumber
|
|
18101
18194
|
});
|
|
18102
18195
|
tree.addLetters({
|
|
18103
|
-
path:
|
|
18196
|
+
path: pathId2,
|
|
18104
18197
|
letters: path.letters
|
|
18105
18198
|
});
|
|
18106
18199
|
}
|
|
@@ -18565,15 +18658,15 @@ var TreeOfLife = class {
|
|
|
18565
18658
|
data,
|
|
18566
18659
|
relatedNumber
|
|
18567
18660
|
}) {
|
|
18568
|
-
const
|
|
18661
|
+
const sphereId2 = this.upsertNode(
|
|
18569
18662
|
new BaseNode({
|
|
18570
18663
|
id: sphere,
|
|
18571
18664
|
type: "sphere" /* SPHERE */,
|
|
18572
18665
|
data
|
|
18573
18666
|
})
|
|
18574
18667
|
);
|
|
18575
|
-
this.addNumber({ number: relatedNumber, nodeId:
|
|
18576
|
-
return
|
|
18668
|
+
this.addNumber({ number: relatedNumber, nodeId: sphereId2 });
|
|
18669
|
+
return sphereId2;
|
|
18577
18670
|
}
|
|
18578
18671
|
/**
|
|
18579
18672
|
* Adds a path between two spheres with its associated number
|
|
@@ -18588,7 +18681,7 @@ var TreeOfLife = class {
|
|
|
18588
18681
|
relatedNumber,
|
|
18589
18682
|
data
|
|
18590
18683
|
}) {
|
|
18591
|
-
const
|
|
18684
|
+
const pathId2 = this.upsertNode(
|
|
18592
18685
|
new BaseNode({
|
|
18593
18686
|
id: relatedNumber,
|
|
18594
18687
|
type: "path" /* PATH */,
|
|
@@ -18601,11 +18694,11 @@ var TreeOfLife = class {
|
|
|
18601
18694
|
);
|
|
18602
18695
|
const numberOfSpheres = 10;
|
|
18603
18696
|
const pathNumber = relatedNumber + numberOfSpheres;
|
|
18604
|
-
this.link(leftSphere,
|
|
18605
|
-
this.link(rightSphere,
|
|
18606
|
-
this.addNumber({ number: relatedNumber, nodeId:
|
|
18607
|
-
this.addNumber({ number: pathNumber, nodeId:
|
|
18608
|
-
return
|
|
18697
|
+
this.link(leftSphere, pathId2);
|
|
18698
|
+
this.link(rightSphere, pathId2);
|
|
18699
|
+
this.addNumber({ number: relatedNumber, nodeId: pathId2 });
|
|
18700
|
+
this.addNumber({ number: pathNumber, nodeId: pathId2 });
|
|
18701
|
+
return pathId2;
|
|
18609
18702
|
}
|
|
18610
18703
|
addLetters({
|
|
18611
18704
|
path,
|
|
@@ -19581,7 +19674,7 @@ async function readStdin(flags, options) {
|
|
|
19581
19674
|
if (!hasStdinSource()) {
|
|
19582
19675
|
exitWithError(options.emptyCode, options.emptyMessage, flags);
|
|
19583
19676
|
}
|
|
19584
|
-
return await new Promise((
|
|
19677
|
+
return await new Promise((resolve2, reject) => {
|
|
19585
19678
|
const chunks = [];
|
|
19586
19679
|
let totalBytes = 0;
|
|
19587
19680
|
const cleanup = () => {
|
|
@@ -19607,7 +19700,7 @@ async function readStdin(flags, options) {
|
|
|
19607
19700
|
if (value.length === 0) {
|
|
19608
19701
|
exitWithError(options.emptyCode, options.emptyMessage, flags);
|
|
19609
19702
|
}
|
|
19610
|
-
|
|
19703
|
+
resolve2(value);
|
|
19611
19704
|
};
|
|
19612
19705
|
const onError = (err) => {
|
|
19613
19706
|
cleanup();
|
|
@@ -21917,7 +22010,7 @@ var RAW_ARKANNUS = [
|
|
|
21917
22010
|
suit: "pentacles"
|
|
21918
22011
|
}
|
|
21919
22012
|
];
|
|
21920
|
-
var sleep = (ms) => new Promise((
|
|
22013
|
+
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
21921
22014
|
var shuffleArray = (array) => {
|
|
21922
22015
|
const newArray = [...array];
|
|
21923
22016
|
for (let i = newArray.length - 1; i > 0; i--) {
|
|
@@ -22749,6 +22842,516 @@ function cmdTarotSpread(cardQueries, flags) {
|
|
|
22749
22842
|
}
|
|
22750
22843
|
}
|
|
22751
22844
|
|
|
22845
|
+
// src/cli/commands/tree.ts
|
|
22846
|
+
var import_node_fs2 = require("fs");
|
|
22847
|
+
var import_node_path2 = require("path");
|
|
22848
|
+
|
|
22849
|
+
// src/visual/tree-svg.ts
|
|
22850
|
+
var TREE_SVG_DEFAULT_VIEWBOX = {
|
|
22851
|
+
minX: 0,
|
|
22852
|
+
minY: 0,
|
|
22853
|
+
width: 286,
|
|
22854
|
+
height: 561
|
|
22855
|
+
};
|
|
22856
|
+
var TREE_SPHERE_NAMES = [
|
|
22857
|
+
"Kether",
|
|
22858
|
+
"Chokhmah",
|
|
22859
|
+
"Binah",
|
|
22860
|
+
"Daath",
|
|
22861
|
+
"Chesed",
|
|
22862
|
+
"Geburah",
|
|
22863
|
+
"Tiphareth",
|
|
22864
|
+
"Netzach",
|
|
22865
|
+
"Hod",
|
|
22866
|
+
"Yesod",
|
|
22867
|
+
"Malkuth"
|
|
22868
|
+
];
|
|
22869
|
+
var TREE_PATH_NUMBERS = Array.from({ length: 22 }, (_, index) => index + 1);
|
|
22870
|
+
var CANONICAL_X_PERCENTAGES = { left: 13.25, mid: 49.94, right: 86.66 };
|
|
22871
|
+
var CANONICAL_ROW_Y_PERCENTAGES = [
|
|
22872
|
+
6.83,
|
|
22873
|
+
17.68,
|
|
22874
|
+
28.42,
|
|
22875
|
+
39.26,
|
|
22876
|
+
50.06,
|
|
22877
|
+
60.85,
|
|
22878
|
+
71.68,
|
|
22879
|
+
93.2
|
|
22880
|
+
];
|
|
22881
|
+
var DEFAULT_SPHERE_RADIUS = 30;
|
|
22882
|
+
var DEFAULT_PATH_EDGE_WIDTH = 26;
|
|
22883
|
+
var DEFAULT_PATH_MAIN_WIDTH = 22;
|
|
22884
|
+
var DEFAULT_PATH_HIGHLIGHT_WIDTH = 8;
|
|
22885
|
+
var sphereId = (name) => id("sphere" /* SPHERE */, name);
|
|
22886
|
+
var pathId = (pathNumber) => id("path" /* PATH */, String(pathNumber));
|
|
22887
|
+
var TREE_SPHERE_IDS = TREE_SPHERE_NAMES.map(
|
|
22888
|
+
(name) => sphereId(name)
|
|
22889
|
+
);
|
|
22890
|
+
var TREE_PATH_IDS = TREE_PATH_NUMBERS.map(
|
|
22891
|
+
(pathNumber) => pathId(pathNumber)
|
|
22892
|
+
);
|
|
22893
|
+
var CANONICAL_SPHERE_PERCENTAGES = {
|
|
22894
|
+
[sphereId("Kether")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[0] },
|
|
22895
|
+
[sphereId("Chokhmah")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
|
|
22896
|
+
[sphereId("Binah")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
|
|
22897
|
+
[sphereId("Daath")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[2] },
|
|
22898
|
+
[sphereId("Chesed")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[3] },
|
|
22899
|
+
[sphereId("Geburah")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[3] },
|
|
22900
|
+
[sphereId("Tiphareth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[4] },
|
|
22901
|
+
[sphereId("Netzach")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[5] },
|
|
22902
|
+
[sphereId("Hod")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[5] },
|
|
22903
|
+
[sphereId("Yesod")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[6] },
|
|
22904
|
+
[sphereId("Malkuth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[7] }
|
|
22905
|
+
};
|
|
22906
|
+
function getTreeLayout(system = "kaabalah") {
|
|
22907
|
+
const tree = createTree({ system });
|
|
22908
|
+
const percentages = buildLayoutMap(tree, CANONICAL_SPHERE_PERCENTAGES);
|
|
22909
|
+
const viewBoxUnits = buildLayoutMap(
|
|
22910
|
+
tree,
|
|
22911
|
+
scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, TREE_SVG_DEFAULT_VIEWBOX)
|
|
22912
|
+
);
|
|
22913
|
+
return {
|
|
22914
|
+
system,
|
|
22915
|
+
viewBox: { ...TREE_SVG_DEFAULT_VIEWBOX },
|
|
22916
|
+
sphereOrder: [...TREE_SPHERE_IDS],
|
|
22917
|
+
pathOrder: [...TREE_PATH_IDS],
|
|
22918
|
+
percentages,
|
|
22919
|
+
viewBoxUnits
|
|
22920
|
+
};
|
|
22921
|
+
}
|
|
22922
|
+
function generateTreeSvg(options = {}) {
|
|
22923
|
+
const system = options.system ?? "kaabalah";
|
|
22924
|
+
const daathLayer = options.daathLayer ?? "front";
|
|
22925
|
+
const tree = createTree({ system, parts: ["colors"] });
|
|
22926
|
+
const viewBox = normalizeViewBox(options.viewBox);
|
|
22927
|
+
const palette = resolvePalette(options.palette);
|
|
22928
|
+
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
22929
|
+
const layout = buildLayoutMap(tree, spherePositions);
|
|
22930
|
+
const scale = Math.min(
|
|
22931
|
+
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
22932
|
+
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
22933
|
+
);
|
|
22934
|
+
const radius = round(DEFAULT_SPHERE_RADIUS * scale);
|
|
22935
|
+
const pathEdgeWidth = round(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
22936
|
+
const pathMainWidth = round(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
22937
|
+
const pathHighlightWidth = round(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
22938
|
+
const sphereStrokeWidth = palette.sphereStrokeWidth ? round(palette.sphereStrokeWidth * scale) : void 0;
|
|
22939
|
+
const lines = [];
|
|
22940
|
+
const push = (line) => lines.push(line);
|
|
22941
|
+
const svgAttributes = [
|
|
22942
|
+
`xmlns="http://www.w3.org/2000/svg"`,
|
|
22943
|
+
options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
|
|
22944
|
+
options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
|
|
22945
|
+
`viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
|
|
22946
|
+
`preserveAspectRatio="xMidYMid meet"`
|
|
22947
|
+
].filter(Boolean);
|
|
22948
|
+
push(`<svg ${svgAttributes.join(" ")}>`);
|
|
22949
|
+
push(`<defs>`);
|
|
22950
|
+
push(`<filter id="pathDarken">
|
|
22951
|
+
<feComponentTransfer>
|
|
22952
|
+
<feFuncR type="linear" slope="0.65"/>
|
|
22953
|
+
<feFuncG type="linear" slope="0.65"/>
|
|
22954
|
+
<feFuncB type="linear" slope="0.65"/>
|
|
22955
|
+
</feComponentTransfer>
|
|
22956
|
+
</filter>`);
|
|
22957
|
+
for (const sphereName of TREE_SPHERE_NAMES) {
|
|
22958
|
+
const currentSphereId = sphereId(sphereName);
|
|
22959
|
+
const slug = sphereName.toLowerCase();
|
|
22960
|
+
const point = spherePositions[currentSphereId];
|
|
22961
|
+
if (!point) {
|
|
22962
|
+
continue;
|
|
22963
|
+
}
|
|
22964
|
+
push(`<radialGradient id="spec-${slug}" cx="30%" cy="25%" r="55%" fx="30%" fy="25%">
|
|
22965
|
+
<stop offset="0%" stop-color="white" stop-opacity="0.95"/>
|
|
22966
|
+
<stop offset="25%" stop-color="white" stop-opacity="0.45"/>
|
|
22967
|
+
<stop offset="50%" stop-color="white" stop-opacity="0.08"/>
|
|
22968
|
+
<stop offset="100%" stop-color="white" stop-opacity="0"/>
|
|
22969
|
+
</radialGradient>`);
|
|
22970
|
+
push(`<radialGradient id="shad-${slug}" cx="78%" cy="80%" r="55%" fx="78%" fy="80%">
|
|
22971
|
+
<stop offset="0%" stop-color="black" stop-opacity="0.32"/>
|
|
22972
|
+
<stop offset="40%" stop-color="black" stop-opacity="0.12"/>
|
|
22973
|
+
<stop offset="100%" stop-color="black" stop-opacity="0"/>
|
|
22974
|
+
</radialGradient>`);
|
|
22975
|
+
push(
|
|
22976
|
+
`<clipPath id="clip-${slug}"><circle cx="${point.x}" cy="${point.y}" r="${radius}"/></clipPath>`
|
|
22977
|
+
);
|
|
22978
|
+
}
|
|
22979
|
+
push(`<radialGradient id="kether-glow" cx="50%" cy="50%" r="50%">
|
|
22980
|
+
<stop offset="0%" stop-color="white" stop-opacity="0.95"/>
|
|
22981
|
+
<stop offset="45%" stop-color="white" stop-opacity="0.6"/>
|
|
22982
|
+
<stop offset="80%" stop-color="white" stop-opacity="0.15"/>
|
|
22983
|
+
<stop offset="100%" stop-color="white" stop-opacity="0"/>
|
|
22984
|
+
</radialGradient>`);
|
|
22985
|
+
push(`<linearGradient id="kether-facet" x1="0" y1="0" x2="0" y2="1">
|
|
22986
|
+
<stop offset="0%" stop-color="white" stop-opacity="0.9"/>
|
|
22987
|
+
<stop offset="50%" stop-color="white" stop-opacity="0.5"/>
|
|
22988
|
+
<stop offset="100%" stop-color="white" stop-opacity="0.1"/>
|
|
22989
|
+
</linearGradient>`);
|
|
22990
|
+
push(`<radialGradient id="kether-rim" cx="50%" cy="50%" r="75%">
|
|
22991
|
+
<stop offset="60%" stop-color="black" stop-opacity="0"/>
|
|
22992
|
+
<stop offset="100%" stop-color="black" stop-opacity="0.18"/>
|
|
22993
|
+
</radialGradient>`);
|
|
22994
|
+
push(`</defs>`);
|
|
22995
|
+
const background = options.background ?? "white";
|
|
22996
|
+
if (background !== "transparent") {
|
|
22997
|
+
push(
|
|
22998
|
+
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr(background)}"/>`
|
|
22999
|
+
);
|
|
23000
|
+
}
|
|
23001
|
+
if (daathLayer === "back") {
|
|
23002
|
+
push(`<g id="spheres-behind-paths">`);
|
|
23003
|
+
renderSphere(push, {
|
|
23004
|
+
tree,
|
|
23005
|
+
palette,
|
|
23006
|
+
radius,
|
|
23007
|
+
sphereStrokeWidth,
|
|
23008
|
+
spherePositions,
|
|
23009
|
+
sphereName: "Daath"
|
|
23010
|
+
});
|
|
23011
|
+
push(`</g>`);
|
|
23012
|
+
}
|
|
23013
|
+
push(`<g id="paths">`);
|
|
23014
|
+
for (const currentPathId of TREE_PATH_IDS) {
|
|
23015
|
+
const path = layout.paths[currentPathId];
|
|
23016
|
+
const color = resolvePathColor({
|
|
23017
|
+
palette,
|
|
23018
|
+
tree,
|
|
23019
|
+
pathId: currentPathId
|
|
23020
|
+
});
|
|
23021
|
+
push(
|
|
23022
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(palette.pathEdgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
|
|
23023
|
+
);
|
|
23024
|
+
push(
|
|
23025
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
|
|
23026
|
+
);
|
|
23027
|
+
push(
|
|
23028
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(palette.pathHighlightColor)}" stroke-opacity="${palette.pathHighlightOpacity}" stroke-width="${pathHighlightWidth}" stroke-linecap="round"/>`
|
|
23029
|
+
);
|
|
23030
|
+
}
|
|
23031
|
+
push(`</g>`);
|
|
23032
|
+
const frontSphereNames = daathLayer === "back" ? TREE_SPHERE_NAMES.filter((name) => name !== "Daath") : TREE_SPHERE_NAMES;
|
|
23033
|
+
push(`<g id="spheres">`);
|
|
23034
|
+
for (const sphereName of frontSphereNames) {
|
|
23035
|
+
renderSphere(push, {
|
|
23036
|
+
tree,
|
|
23037
|
+
palette,
|
|
23038
|
+
radius,
|
|
23039
|
+
sphereStrokeWidth,
|
|
23040
|
+
spherePositions,
|
|
23041
|
+
sphereName
|
|
23042
|
+
});
|
|
23043
|
+
}
|
|
23044
|
+
push(`</g>`);
|
|
23045
|
+
if (daathLayer === "back") {
|
|
23046
|
+
const daathPoint = spherePositions[sphereId("Daath")];
|
|
23047
|
+
push(
|
|
23048
|
+
`<circle id="sphere-daath-hit-area" data-node-id="sphere:Daath" cx="${daathPoint.x}" cy="${daathPoint.y}" r="${radius}" fill="transparent" pointer-events="all"/>`
|
|
23049
|
+
);
|
|
23050
|
+
}
|
|
23051
|
+
push(`</svg>`);
|
|
23052
|
+
return lines.join("\n");
|
|
23053
|
+
}
|
|
23054
|
+
function renderSphere(push, params) {
|
|
23055
|
+
const currentSphereId = sphereId(params.sphereName);
|
|
23056
|
+
const point = params.spherePositions[currentSphereId];
|
|
23057
|
+
const slug = params.sphereName.toLowerCase();
|
|
23058
|
+
const colorData = params.tree.relatedFirst(currentSphereId, "color" /* COLOR */)?.data?.colorHexCodes ?? [];
|
|
23059
|
+
const sphereFill = resolveSphereFill({
|
|
23060
|
+
palette: params.palette,
|
|
23061
|
+
sphereId: currentSphereId,
|
|
23062
|
+
defaultColors: colorData
|
|
23063
|
+
});
|
|
23064
|
+
push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
|
|
23065
|
+
if (params.palette.specialSphereMode === "preserve") {
|
|
23066
|
+
if (params.sphereName === "Kether") {
|
|
23067
|
+
renderKether(push, point, params.radius);
|
|
23068
|
+
} else if (params.sphereName === "Chokhmah") {
|
|
23069
|
+
renderIridescent(push, point, params.radius);
|
|
23070
|
+
} else if (params.sphereName === "Daath") {
|
|
23071
|
+
renderYinYang(push, point, params.radius);
|
|
23072
|
+
} else if (params.sphereName === "Malkuth" && colorData.length >= 4) {
|
|
23073
|
+
const slicedColors = Array.isArray(sphereFill) ? sphereFill : colorData.slice(0, 4);
|
|
23074
|
+
renderSlicedSphere(push, point, params.radius, slicedColors, -135);
|
|
23075
|
+
} else {
|
|
23076
|
+
push(
|
|
23077
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr(toPrimaryFill(sphereFill, params.palette.defaultSphereFill))}"/>`
|
|
23078
|
+
);
|
|
23079
|
+
}
|
|
23080
|
+
} else {
|
|
23081
|
+
push(
|
|
23082
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr(toPrimaryFill(sphereFill, params.palette.defaultSphereFill))}"/>`
|
|
23083
|
+
);
|
|
23084
|
+
}
|
|
23085
|
+
push(
|
|
23086
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#spec-${slug})"/>`
|
|
23087
|
+
);
|
|
23088
|
+
if (params.palette.specialSphereMode !== "preserve" || params.sphereName !== "Kether" && params.sphereName !== "Chokhmah") {
|
|
23089
|
+
push(
|
|
23090
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#shad-${slug})"/>`
|
|
23091
|
+
);
|
|
23092
|
+
}
|
|
23093
|
+
push(`</g>`);
|
|
23094
|
+
if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
|
|
23095
|
+
push(
|
|
23096
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
|
|
23097
|
+
);
|
|
23098
|
+
}
|
|
23099
|
+
}
|
|
23100
|
+
function buildLayoutMap(tree, spherePositions) {
|
|
23101
|
+
const paths = {};
|
|
23102
|
+
for (const currentPathId of TREE_PATH_IDS) {
|
|
23103
|
+
const path = tree.getNode(currentPathId);
|
|
23104
|
+
const fromId = path?.data?.from;
|
|
23105
|
+
const toId = path?.data?.to;
|
|
23106
|
+
if (!fromId || !toId) {
|
|
23107
|
+
throw new Error(`Tree path ${currentPathId} is missing endpoints.`);
|
|
23108
|
+
}
|
|
23109
|
+
const from = spherePositions[fromId];
|
|
23110
|
+
const to = spherePositions[toId];
|
|
23111
|
+
if (!from || !to) {
|
|
23112
|
+
throw new Error(
|
|
23113
|
+
`Tree path ${currentPathId} references unknown layout spheres: ${fromId}, ${toId}.`
|
|
23114
|
+
);
|
|
23115
|
+
}
|
|
23116
|
+
paths[currentPathId] = {
|
|
23117
|
+
fromId,
|
|
23118
|
+
toId,
|
|
23119
|
+
from: { ...from },
|
|
23120
|
+
to: { ...to }
|
|
23121
|
+
};
|
|
23122
|
+
}
|
|
23123
|
+
return {
|
|
23124
|
+
spheres: cloneCoordinateMap(spherePositions),
|
|
23125
|
+
paths
|
|
23126
|
+
};
|
|
23127
|
+
}
|
|
23128
|
+
function cloneCoordinateMap(coordinates) {
|
|
23129
|
+
const clone = {};
|
|
23130
|
+
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
23131
|
+
const point = coordinates[currentSphereId];
|
|
23132
|
+
clone[currentSphereId] = { ...point };
|
|
23133
|
+
}
|
|
23134
|
+
return clone;
|
|
23135
|
+
}
|
|
23136
|
+
function scaleCoordinates(coordinates, viewBox) {
|
|
23137
|
+
const scaled = {};
|
|
23138
|
+
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
23139
|
+
const point = coordinates[currentSphereId];
|
|
23140
|
+
scaled[currentSphereId] = {
|
|
23141
|
+
x: round(viewBox.minX + point.x / 100 * viewBox.width),
|
|
23142
|
+
y: round(viewBox.minY + point.y / 100 * viewBox.height)
|
|
23143
|
+
};
|
|
23144
|
+
}
|
|
23145
|
+
return scaled;
|
|
23146
|
+
}
|
|
23147
|
+
function normalizeViewBox(viewBox) {
|
|
23148
|
+
return {
|
|
23149
|
+
minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
|
|
23150
|
+
minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
|
|
23151
|
+
width: viewBox?.width ?? TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
23152
|
+
height: viewBox?.height ?? TREE_SVG_DEFAULT_VIEWBOX.height
|
|
23153
|
+
};
|
|
23154
|
+
}
|
|
23155
|
+
function resolvePalette(palette) {
|
|
23156
|
+
if (palette === void 0 || palette === "color") {
|
|
23157
|
+
return {
|
|
23158
|
+
mode: "color",
|
|
23159
|
+
defaultSphereFill: "#888888",
|
|
23160
|
+
defaultPathColor: "#888888",
|
|
23161
|
+
sphereFills: {},
|
|
23162
|
+
pathColors: {},
|
|
23163
|
+
pathEdgeColor: "#888888",
|
|
23164
|
+
pathEdgeUseFilter: true,
|
|
23165
|
+
pathHighlightColor: "white",
|
|
23166
|
+
pathHighlightOpacity: 0.25,
|
|
23167
|
+
specialSphereMode: "preserve"
|
|
23168
|
+
};
|
|
23169
|
+
}
|
|
23170
|
+
if (palette === "monochrome") {
|
|
23171
|
+
return {
|
|
23172
|
+
mode: "monochrome",
|
|
23173
|
+
defaultSphereFill: "#e6ddd0",
|
|
23174
|
+
defaultPathColor: "#e0d7ca",
|
|
23175
|
+
sphereFills: {},
|
|
23176
|
+
pathColors: {},
|
|
23177
|
+
pathEdgeColor: "#2f271e",
|
|
23178
|
+
pathEdgeUseFilter: false,
|
|
23179
|
+
sphereStrokeColor: "#2f271e",
|
|
23180
|
+
sphereStrokeWidth: 2.4,
|
|
23181
|
+
pathHighlightColor: "white",
|
|
23182
|
+
pathHighlightOpacity: 0.2,
|
|
23183
|
+
specialSphereMode: "plain"
|
|
23184
|
+
};
|
|
23185
|
+
}
|
|
23186
|
+
return {
|
|
23187
|
+
mode: "custom",
|
|
23188
|
+
defaultSphereFill: palette.defaultSphereFill ?? "#111111",
|
|
23189
|
+
defaultPathColor: palette.defaultPathColor ?? "#111111",
|
|
23190
|
+
sphereFills: palette.sphereFills ?? {},
|
|
23191
|
+
pathColors: palette.pathColors ?? {},
|
|
23192
|
+
pathEdgeColor: palette.pathEdgeColor ?? (palette.defaultPathColor ?? "#111111"),
|
|
23193
|
+
pathEdgeUseFilter: false,
|
|
23194
|
+
sphereStrokeColor: palette.sphereStrokeColor,
|
|
23195
|
+
sphereStrokeWidth: palette.sphereStrokeWidth,
|
|
23196
|
+
pathHighlightColor: palette.pathHighlightColor ?? "white",
|
|
23197
|
+
pathHighlightOpacity: palette.pathHighlightOpacity ?? 0.18,
|
|
23198
|
+
specialSphereMode: palette.specialSphereMode ?? "plain"
|
|
23199
|
+
};
|
|
23200
|
+
}
|
|
23201
|
+
function resolvePathColor(params) {
|
|
23202
|
+
const override = params.palette.pathColors[params.pathId];
|
|
23203
|
+
if (override) {
|
|
23204
|
+
return override;
|
|
23205
|
+
}
|
|
23206
|
+
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
23207
|
+
return params.palette.defaultPathColor;
|
|
23208
|
+
}
|
|
23209
|
+
const treeColor = params.tree.relatedFirst(params.pathId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
|
|
23210
|
+
return treeColor ?? params.palette.defaultPathColor;
|
|
23211
|
+
}
|
|
23212
|
+
function resolveSphereFill(params) {
|
|
23213
|
+
const override = params.palette.sphereFills[params.sphereId];
|
|
23214
|
+
if (override) {
|
|
23215
|
+
return override;
|
|
23216
|
+
}
|
|
23217
|
+
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
23218
|
+
return params.palette.defaultSphereFill;
|
|
23219
|
+
}
|
|
23220
|
+
if (params.defaultColors.length > 0) {
|
|
23221
|
+
return params.defaultColors;
|
|
23222
|
+
}
|
|
23223
|
+
return params.palette.defaultSphereFill;
|
|
23224
|
+
}
|
|
23225
|
+
function toPrimaryFill(fill, fallback) {
|
|
23226
|
+
if (Array.isArray(fill)) {
|
|
23227
|
+
return fill[0] ?? fallback;
|
|
23228
|
+
}
|
|
23229
|
+
return fill;
|
|
23230
|
+
}
|
|
23231
|
+
function round(value) {
|
|
23232
|
+
return Math.round(value * 100) / 100;
|
|
23233
|
+
}
|
|
23234
|
+
function polarToCartesian(cx, cy, radius, degrees) {
|
|
23235
|
+
const radians = Math.PI / 180 * degrees;
|
|
23236
|
+
return {
|
|
23237
|
+
x: round(cx + radius * Math.cos(radians)),
|
|
23238
|
+
y: round(cy + radius * Math.sin(radians))
|
|
23239
|
+
};
|
|
23240
|
+
}
|
|
23241
|
+
function arcPath(cx, cy, radius, startDegrees, endDegrees) {
|
|
23242
|
+
const start = polarToCartesian(cx, cy, radius, startDegrees);
|
|
23243
|
+
const end = polarToCartesian(cx, cy, radius, endDegrees);
|
|
23244
|
+
const largeArc = endDegrees - startDegrees <= 180 ? 0 : 1;
|
|
23245
|
+
return `M ${cx} ${cy} L ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
|
|
23246
|
+
}
|
|
23247
|
+
function renderKether(push, point, radius) {
|
|
23248
|
+
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="#e0e0e0"/>`);
|
|
23249
|
+
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
|
|
23250
|
+
const spokes = 16;
|
|
23251
|
+
const innerRadius = round(radius * 0.18);
|
|
23252
|
+
const outerRadius = round(radius * 0.92);
|
|
23253
|
+
const innerWidth = round(radius * 0.04);
|
|
23254
|
+
const angleStep = 360 / spokes;
|
|
23255
|
+
push(`<g opacity="0.85">`);
|
|
23256
|
+
for (let index = 0; index < spokes; index++) {
|
|
23257
|
+
const angle = index * angleStep;
|
|
23258
|
+
push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
|
|
23259
|
+
const x0 = round(point.x - innerWidth);
|
|
23260
|
+
const y0 = round(point.y - innerRadius);
|
|
23261
|
+
const x1 = point.x;
|
|
23262
|
+
const y1 = round(point.y - outerRadius);
|
|
23263
|
+
const x2 = round(point.x + innerWidth);
|
|
23264
|
+
const y2 = round(point.y - innerRadius);
|
|
23265
|
+
push(
|
|
23266
|
+
`<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
|
|
23267
|
+
);
|
|
23268
|
+
push(`</g>`);
|
|
23269
|
+
}
|
|
23270
|
+
push(`</g>`);
|
|
23271
|
+
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-rim)"/>`);
|
|
23272
|
+
}
|
|
23273
|
+
function renderSlicedSphere(push, point, radius, colors, startAngle) {
|
|
23274
|
+
const segmentCount = colors.length;
|
|
23275
|
+
const step = 360 / segmentCount;
|
|
23276
|
+
let currentAngle = startAngle;
|
|
23277
|
+
for (let index = 0; index < segmentCount; index++) {
|
|
23278
|
+
const path = arcPath(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
|
|
23279
|
+
push(`<path d="${path}" fill="${escapeAttr(colors[index])}" stroke="none"/>`);
|
|
23280
|
+
currentAngle += step;
|
|
23281
|
+
}
|
|
23282
|
+
}
|
|
23283
|
+
function renderIridescent(push, point, radius) {
|
|
23284
|
+
const stops = [
|
|
23285
|
+
[0, "#F0E8EE"],
|
|
23286
|
+
[0.1, "#ffa3e6"],
|
|
23287
|
+
[0.22, "#a7e0ff"],
|
|
23288
|
+
[0.34, "#baff9a"],
|
|
23289
|
+
[0.46, "#ffe28a"],
|
|
23290
|
+
[0.58, "#c6a4ff"],
|
|
23291
|
+
[0.7, "#9ad6ff"],
|
|
23292
|
+
[0.82, "#ffa3e6"],
|
|
23293
|
+
[1, "#F0E8EE"]
|
|
23294
|
+
];
|
|
23295
|
+
const slices = 72;
|
|
23296
|
+
const sphereRadius = round(radius * 0.96);
|
|
23297
|
+
for (let index = 0; index < slices; index++) {
|
|
23298
|
+
const t = index / slices;
|
|
23299
|
+
const color = interpolateColorStops(stops, t);
|
|
23300
|
+
const startDegrees = t * 360 - 90;
|
|
23301
|
+
const endDegrees = startDegrees + 360 / slices + 0.5;
|
|
23302
|
+
const path = arcPath(point.x, point.y, sphereRadius, startDegrees, endDegrees);
|
|
23303
|
+
push(`<path d="${path}" fill="${color}" stroke="none"/>`);
|
|
23304
|
+
}
|
|
23305
|
+
}
|
|
23306
|
+
function interpolateColorStops(stops, t) {
|
|
23307
|
+
let lower = stops[0];
|
|
23308
|
+
let upper = stops[stops.length - 1];
|
|
23309
|
+
for (let index = 0; index < stops.length - 1; index++) {
|
|
23310
|
+
if (t >= stops[index][0] && t <= stops[index + 1][0]) {
|
|
23311
|
+
lower = stops[index];
|
|
23312
|
+
upper = stops[index + 1];
|
|
23313
|
+
break;
|
|
23314
|
+
}
|
|
23315
|
+
}
|
|
23316
|
+
const range = upper[0] - lower[0] || 1;
|
|
23317
|
+
return interpolateColor(lower[1], upper[1], (t - lower[0]) / range);
|
|
23318
|
+
}
|
|
23319
|
+
function interpolateColor(start, end, factor) {
|
|
23320
|
+
const parse = (hex) => {
|
|
23321
|
+
const match = hex.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
23322
|
+
return match ? [
|
|
23323
|
+
Number.parseInt(match[1], 16),
|
|
23324
|
+
Number.parseInt(match[2], 16),
|
|
23325
|
+
Number.parseInt(match[3], 16)
|
|
23326
|
+
] : [0, 0, 0];
|
|
23327
|
+
};
|
|
23328
|
+
const [r1, g1, b1] = parse(start);
|
|
23329
|
+
const [r2, g2, b2] = parse(end);
|
|
23330
|
+
const mix = (left, right) => Math.round(left + (right - left) * factor);
|
|
23331
|
+
return `#${mix(r1, r2).toString(16).padStart(2, "0")}${mix(g1, g2).toString(16).padStart(2, "0")}${mix(b1, b2).toString(16).padStart(2, "0")}`;
|
|
23332
|
+
}
|
|
23333
|
+
function renderYinYang(push, point, radius) {
|
|
23334
|
+
const scale = radius / 50;
|
|
23335
|
+
const circleRadius = round(48 * scale);
|
|
23336
|
+
const halfRadius = round(24 * scale);
|
|
23337
|
+
const dotRadius = round(6 * scale);
|
|
23338
|
+
push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
|
|
23339
|
+
push(`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="white"/>`);
|
|
23340
|
+
push(
|
|
23341
|
+
`<path d="M${point.x},${round(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round(point.y - circleRadius)}" fill="black"/>`
|
|
23342
|
+
);
|
|
23343
|
+
push(
|
|
23344
|
+
`<circle cx="${point.x}" cy="${round(point.y - halfRadius)}" r="${dotRadius}" fill="white"/>`
|
|
23345
|
+
);
|
|
23346
|
+
push(
|
|
23347
|
+
`<circle cx="${point.x}" cy="${round(point.y + halfRadius)}" r="${dotRadius}" fill="black"/>`
|
|
23348
|
+
);
|
|
23349
|
+
push(`</g>`);
|
|
23350
|
+
}
|
|
23351
|
+
function escapeAttr(value) {
|
|
23352
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
23353
|
+
}
|
|
23354
|
+
|
|
22752
23355
|
// src/cli/commands/tree.ts
|
|
22753
23356
|
function getTree() {
|
|
22754
23357
|
return getCanonicalTree({
|
|
@@ -22838,6 +23441,174 @@ function describeSources(edge) {
|
|
|
22838
23441
|
}
|
|
22839
23442
|
return [...parts].join(", ");
|
|
22840
23443
|
}
|
|
23444
|
+
function resolveSystem(flags) {
|
|
23445
|
+
const value = getFlagString(flags, "system");
|
|
23446
|
+
if (!value) {
|
|
23447
|
+
return SYSTEM2;
|
|
23448
|
+
}
|
|
23449
|
+
if (SYSTEMS.some((candidate) => candidate.SYSTEM === value)) {
|
|
23450
|
+
return value;
|
|
23451
|
+
}
|
|
23452
|
+
exitWithError(
|
|
23453
|
+
"INVALID_ARGUMENT",
|
|
23454
|
+
`Unknown tree system "${value}". Expected one of: ${SYSTEMS.map((candidate) => candidate.SYSTEM).join(", ")}.`,
|
|
23455
|
+
flags
|
|
23456
|
+
);
|
|
23457
|
+
}
|
|
23458
|
+
function resolveLayoutUnits(flags) {
|
|
23459
|
+
const units = getFlagString(flags, "units");
|
|
23460
|
+
if (!units || units === "both") {
|
|
23461
|
+
return "both";
|
|
23462
|
+
}
|
|
23463
|
+
if (units === "percentages" || units === "viewBoxUnits") {
|
|
23464
|
+
return units;
|
|
23465
|
+
}
|
|
23466
|
+
exitWithError(
|
|
23467
|
+
"INVALID_ARGUMENT",
|
|
23468
|
+
`Unknown layout units "${units}". Expected one of: percentages, viewBoxUnits, both.`,
|
|
23469
|
+
flags
|
|
23470
|
+
);
|
|
23471
|
+
}
|
|
23472
|
+
function serializeLayout(layout, units) {
|
|
23473
|
+
const base = {
|
|
23474
|
+
system: layout.system,
|
|
23475
|
+
viewBox: layout.viewBox,
|
|
23476
|
+
sphereOrder: layout.sphereOrder,
|
|
23477
|
+
pathOrder: layout.pathOrder
|
|
23478
|
+
};
|
|
23479
|
+
if (units === "both" || units === "percentages") {
|
|
23480
|
+
base.percentages = layout.percentages;
|
|
23481
|
+
}
|
|
23482
|
+
if (units === "both" || units === "viewBoxUnits") {
|
|
23483
|
+
base.viewBoxUnits = layout.viewBoxUnits;
|
|
23484
|
+
}
|
|
23485
|
+
return base;
|
|
23486
|
+
}
|
|
23487
|
+
function buildViewBox(flags) {
|
|
23488
|
+
const width = getFlagNumber(flags, "viewbox-width");
|
|
23489
|
+
const height = getFlagNumber(flags, "viewbox-height");
|
|
23490
|
+
const minX = getFlagNumber(flags, "viewbox-min-x");
|
|
23491
|
+
const minY = getFlagNumber(flags, "viewbox-min-y");
|
|
23492
|
+
if (width == null && height == null && minX == null && minY == null) {
|
|
23493
|
+
return void 0;
|
|
23494
|
+
}
|
|
23495
|
+
if (width == null || height == null) {
|
|
23496
|
+
exitWithError(
|
|
23497
|
+
"INVALID_ARGUMENT",
|
|
23498
|
+
'Both "--viewbox-width" and "--viewbox-height" are required when overriding the SVG viewBox.',
|
|
23499
|
+
flags
|
|
23500
|
+
);
|
|
23501
|
+
}
|
|
23502
|
+
return {
|
|
23503
|
+
minX: minX ?? 0,
|
|
23504
|
+
minY: minY ?? 0,
|
|
23505
|
+
width,
|
|
23506
|
+
height
|
|
23507
|
+
};
|
|
23508
|
+
}
|
|
23509
|
+
function buildSvgOptions(flags) {
|
|
23510
|
+
const palette = getFlagString(flags, "palette");
|
|
23511
|
+
if (palette && palette !== "color" && palette !== "monochrome") {
|
|
23512
|
+
exitWithError(
|
|
23513
|
+
"INVALID_ARGUMENT",
|
|
23514
|
+
`Unknown SVG palette "${palette}". Expected "color" or "monochrome".`,
|
|
23515
|
+
flags
|
|
23516
|
+
);
|
|
23517
|
+
}
|
|
23518
|
+
const daathLayer = getFlagString(flags, "daath-layer");
|
|
23519
|
+
if (daathLayer && daathLayer !== "front" && daathLayer !== "back") {
|
|
23520
|
+
exitWithError(
|
|
23521
|
+
"INVALID_ARGUMENT",
|
|
23522
|
+
`Unknown Daath layer "${daathLayer}". Expected "front" or "back".`,
|
|
23523
|
+
flags
|
|
23524
|
+
);
|
|
23525
|
+
}
|
|
23526
|
+
return {
|
|
23527
|
+
system: resolveSystem(flags),
|
|
23528
|
+
width: getFlagString(flags, "width"),
|
|
23529
|
+
height: getFlagString(flags, "height"),
|
|
23530
|
+
background: getFlagString(flags, "background") ?? void 0,
|
|
23531
|
+
palette: palette ?? void 0,
|
|
23532
|
+
viewBox: buildViewBox(flags),
|
|
23533
|
+
daathLayer: daathLayer ?? void 0
|
|
23534
|
+
};
|
|
23535
|
+
}
|
|
23536
|
+
function renderAsciiTree(layout, columns, rows) {
|
|
23537
|
+
const grid = Array.from(
|
|
23538
|
+
{ length: rows },
|
|
23539
|
+
() => Array.from({ length: columns }, () => " ")
|
|
23540
|
+
);
|
|
23541
|
+
const points = layout.percentages.spheres;
|
|
23542
|
+
const toGridX = (percentage) => Math.max(0, Math.min(columns - 1, Math.round(percentage / 100 * (columns - 1))));
|
|
23543
|
+
const toGridY = (percentage) => Math.max(0, Math.min(rows - 1, Math.round(percentage / 100 * (rows - 1))));
|
|
23544
|
+
const plot = (x, y, char) => {
|
|
23545
|
+
if (x < 0 || x >= columns || y < 0 || y >= rows) {
|
|
23546
|
+
return;
|
|
23547
|
+
}
|
|
23548
|
+
if (char === "O") {
|
|
23549
|
+
grid[y][x] = char;
|
|
23550
|
+
return;
|
|
23551
|
+
}
|
|
23552
|
+
const current = grid[y][x];
|
|
23553
|
+
if (current === " " || current === char) {
|
|
23554
|
+
grid[y][x] = char;
|
|
23555
|
+
return;
|
|
23556
|
+
}
|
|
23557
|
+
if (current === "O") {
|
|
23558
|
+
return;
|
|
23559
|
+
}
|
|
23560
|
+
grid[y][x] = "+";
|
|
23561
|
+
};
|
|
23562
|
+
const drawLine = (x0, y0, x1, y1) => {
|
|
23563
|
+
const dx = x1 - x0;
|
|
23564
|
+
const dy = y1 - y0;
|
|
23565
|
+
const lineChar = dx === 0 ? "|" : dy === 0 ? "-" : Math.sign(dx) === Math.sign(dy) ? "\\" : "/";
|
|
23566
|
+
let currentX = x0;
|
|
23567
|
+
let currentY = y0;
|
|
23568
|
+
const stepX = Math.sign(dx);
|
|
23569
|
+
const stepY = Math.sign(dy);
|
|
23570
|
+
const absDx = Math.abs(dx);
|
|
23571
|
+
const absDy = Math.abs(dy);
|
|
23572
|
+
if (absDx > absDy) {
|
|
23573
|
+
let error = absDx / 2;
|
|
23574
|
+
while (currentX !== x1) {
|
|
23575
|
+
plot(currentX, currentY, lineChar);
|
|
23576
|
+
error -= absDy;
|
|
23577
|
+
if (error < 0) {
|
|
23578
|
+
currentY += stepY;
|
|
23579
|
+
error += absDx;
|
|
23580
|
+
}
|
|
23581
|
+
currentX += stepX;
|
|
23582
|
+
}
|
|
23583
|
+
} else {
|
|
23584
|
+
let error = absDy / 2;
|
|
23585
|
+
while (currentY !== y1) {
|
|
23586
|
+
plot(currentX, currentY, lineChar);
|
|
23587
|
+
error -= absDx;
|
|
23588
|
+
if (error < 0) {
|
|
23589
|
+
currentX += stepX;
|
|
23590
|
+
error += absDy;
|
|
23591
|
+
}
|
|
23592
|
+
currentY += stepY;
|
|
23593
|
+
}
|
|
23594
|
+
}
|
|
23595
|
+
plot(x1, y1, lineChar);
|
|
23596
|
+
};
|
|
23597
|
+
for (const pathId2 of layout.pathOrder) {
|
|
23598
|
+
const path = layout.percentages.paths[pathId2];
|
|
23599
|
+
drawLine(
|
|
23600
|
+
toGridX(path.from.x),
|
|
23601
|
+
toGridY(path.from.y),
|
|
23602
|
+
toGridX(path.to.x),
|
|
23603
|
+
toGridY(path.to.y)
|
|
23604
|
+
);
|
|
23605
|
+
}
|
|
23606
|
+
for (const sphereId2 of layout.sphereOrder) {
|
|
23607
|
+
const point = points[sphereId2];
|
|
23608
|
+
plot(toGridX(point.x), toGridY(point.y), "O");
|
|
23609
|
+
}
|
|
23610
|
+
return grid.map((row) => row.join("").replace(/\s+$/, ""));
|
|
23611
|
+
}
|
|
22841
23612
|
function cmdTree(flags) {
|
|
22842
23613
|
const tree = getTree();
|
|
22843
23614
|
const allNodes = tree.getNodes();
|
|
@@ -23041,6 +23812,106 @@ Tree search
|
|
|
23041
23812
|
}
|
|
23042
23813
|
console.log();
|
|
23043
23814
|
}
|
|
23815
|
+
function cmdTreeLayout(flags) {
|
|
23816
|
+
const system = resolveSystem(flags);
|
|
23817
|
+
const units = resolveLayoutUnits(flags);
|
|
23818
|
+
const layout = getTreeLayout(system);
|
|
23819
|
+
const payload = serializeLayout(layout, units);
|
|
23820
|
+
if (isJsonMode(flags)) {
|
|
23821
|
+
outputJson(payload, flags);
|
|
23822
|
+
return;
|
|
23823
|
+
}
|
|
23824
|
+
console.log(`
|
|
23825
|
+
Tree layout (${system})
|
|
23826
|
+
`);
|
|
23827
|
+
console.log(` Spheres: ${layout.sphereOrder.length}`);
|
|
23828
|
+
console.log(` Paths: ${layout.pathOrder.length}`);
|
|
23829
|
+
console.log(` Units: ${units}`);
|
|
23830
|
+
console.log(
|
|
23831
|
+
` ViewBox: ${layout.viewBox.minX} ${layout.viewBox.minY} ${layout.viewBox.width} ${layout.viewBox.height}
|
|
23832
|
+
`
|
|
23833
|
+
);
|
|
23834
|
+
const activeSpace = units === "viewBoxUnits" ? layout.viewBoxUnits.spheres : layout.percentages.spheres;
|
|
23835
|
+
for (const sphereId2 of layout.sphereOrder) {
|
|
23836
|
+
const point = activeSpace[sphereId2];
|
|
23837
|
+
console.log(` ${sphereId2}: (${point.x}, ${point.y})`);
|
|
23838
|
+
}
|
|
23839
|
+
console.log();
|
|
23840
|
+
}
|
|
23841
|
+
function cmdTreeSvg(flags) {
|
|
23842
|
+
const svgOptions = buildSvgOptions(flags);
|
|
23843
|
+
const svg = generateTreeSvg(svgOptions);
|
|
23844
|
+
const outputPathFlag = getFlagString(flags, "output");
|
|
23845
|
+
const system = svgOptions.system ?? SYSTEM2;
|
|
23846
|
+
if (outputPathFlag) {
|
|
23847
|
+
const outputPath = (0, import_node_path2.resolve)(outputPathFlag);
|
|
23848
|
+
(0, import_node_fs2.mkdirSync)((0, import_node_path2.dirname)(outputPath), { recursive: true });
|
|
23849
|
+
(0, import_node_fs2.writeFileSync)(outputPath, svg, "utf8");
|
|
23850
|
+
if (isJsonMode(flags)) {
|
|
23851
|
+
outputJson(
|
|
23852
|
+
{
|
|
23853
|
+
system,
|
|
23854
|
+
outputPath,
|
|
23855
|
+
bytes: Buffer.byteLength(svg, "utf8"),
|
|
23856
|
+
options: {
|
|
23857
|
+
width: svgOptions.width ?? null,
|
|
23858
|
+
height: svgOptions.height ?? null,
|
|
23859
|
+
background: svgOptions.background ?? null,
|
|
23860
|
+
palette: svgOptions.palette ?? "color",
|
|
23861
|
+
viewBox: svgOptions.viewBox ?? null,
|
|
23862
|
+
daathLayer: svgOptions.daathLayer ?? "front"
|
|
23863
|
+
}
|
|
23864
|
+
},
|
|
23865
|
+
flags
|
|
23866
|
+
);
|
|
23867
|
+
return;
|
|
23868
|
+
}
|
|
23869
|
+
console.log(`Wrote ${outputPath} (${Buffer.byteLength(svg, "utf8")} bytes)`);
|
|
23870
|
+
return;
|
|
23871
|
+
}
|
|
23872
|
+
if (isJsonMode(flags)) {
|
|
23873
|
+
outputJson(
|
|
23874
|
+
{
|
|
23875
|
+
system,
|
|
23876
|
+
svg
|
|
23877
|
+
},
|
|
23878
|
+
flags
|
|
23879
|
+
);
|
|
23880
|
+
return;
|
|
23881
|
+
}
|
|
23882
|
+
process.stdout.write(svg.endsWith("\n") ? svg : `${svg}
|
|
23883
|
+
`);
|
|
23884
|
+
}
|
|
23885
|
+
function cmdTreeAscii(flags) {
|
|
23886
|
+
const system = resolveSystem(flags);
|
|
23887
|
+
const columns = getFlagNumber(flags, "columns") ?? 61;
|
|
23888
|
+
const rows = getFlagNumber(flags, "rows") ?? 31;
|
|
23889
|
+
if (columns < 21 || rows < 11) {
|
|
23890
|
+
exitWithError(
|
|
23891
|
+
"INVALID_ARGUMENT",
|
|
23892
|
+
'ASCII grid too small. Use at least "--columns=21 --rows=11".',
|
|
23893
|
+
flags
|
|
23894
|
+
);
|
|
23895
|
+
}
|
|
23896
|
+
const layout = getTreeLayout(system);
|
|
23897
|
+
const lines = renderAsciiTree(layout, columns, rows);
|
|
23898
|
+
const ascii = lines.join("\n");
|
|
23899
|
+
if (isJsonMode(flags)) {
|
|
23900
|
+
outputJson(
|
|
23901
|
+
{
|
|
23902
|
+
system,
|
|
23903
|
+
columns,
|
|
23904
|
+
rows,
|
|
23905
|
+
ascii,
|
|
23906
|
+
lines
|
|
23907
|
+
},
|
|
23908
|
+
flags
|
|
23909
|
+
);
|
|
23910
|
+
return;
|
|
23911
|
+
}
|
|
23912
|
+
process.stdout.write(`${ascii}
|
|
23913
|
+
`);
|
|
23914
|
+
}
|
|
23044
23915
|
|
|
23045
23916
|
// src/cli/app.ts
|
|
23046
23917
|
function outputVersion(flags) {
|
|
@@ -23206,6 +24077,15 @@ async function runCli(argv) {
|
|
|
23206
24077
|
case "tree:types":
|
|
23207
24078
|
cmdTreeTypes(flags);
|
|
23208
24079
|
return;
|
|
24080
|
+
case "tree:layout":
|
|
24081
|
+
cmdTreeLayout(flags);
|
|
24082
|
+
return;
|
|
24083
|
+
case "tree:svg":
|
|
24084
|
+
cmdTreeSvg(flags);
|
|
24085
|
+
return;
|
|
24086
|
+
case "tree:ascii":
|
|
24087
|
+
cmdTreeAscii(flags);
|
|
24088
|
+
return;
|
|
23209
24089
|
case "astrology":
|
|
23210
24090
|
await cmdAstrology(args.slice(1), flags, inputPayload, execution);
|
|
23211
24091
|
return;
|