kaabalah 6.2.4 → 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/{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-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 +954 -104
- 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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +147 -122
- package/dist/index.mjs +7 -6
- 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-HAMDOCS5.js.map +0 -1
- package/dist/chunk-RZBVUDBM.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}`);
|
|
@@ -8932,7 +8932,7 @@ var import_config3 = require("dotenv/config");
|
|
|
8932
8932
|
// package.json
|
|
8933
8933
|
var package_default = {
|
|
8934
8934
|
name: "kaabalah",
|
|
8935
|
-
version: "6.
|
|
8935
|
+
version: "6.3.0",
|
|
8936
8936
|
description: "The de-facto library for any esoteric calculations and tooling",
|
|
8937
8937
|
engines: {
|
|
8938
8938
|
node: ">=18.18.0"
|
|
@@ -8995,6 +8995,11 @@ var package_default = {
|
|
|
8995
8995
|
types: "./dist/semantic/index.d.ts",
|
|
8996
8996
|
require: "./dist/semantic/index.js",
|
|
8997
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"
|
|
8998
9003
|
}
|
|
8999
9004
|
},
|
|
9000
9005
|
files: [
|
|
@@ -9204,6 +9209,56 @@ var COMMANDS = [
|
|
|
9204
9209
|
flags: [],
|
|
9205
9210
|
examples: ["kaabalah tree:types --json"]
|
|
9206
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
|
+
},
|
|
9207
9262
|
{
|
|
9208
9263
|
name: "astrology",
|
|
9209
9264
|
description: "Calculate birth chart using Swiss Ephemeris",
|
|
@@ -14482,13 +14537,13 @@ function loadHermeticQabalah(tree) {
|
|
|
14482
14537
|
}
|
|
14483
14538
|
];
|
|
14484
14539
|
for (const path of paths) {
|
|
14485
|
-
const
|
|
14540
|
+
const pathId2 = tree.addPath({
|
|
14486
14541
|
leftSphere: path.leftSphere,
|
|
14487
14542
|
rightSphere: path.rightSphere,
|
|
14488
14543
|
relatedNumber: path.relatedNumber
|
|
14489
14544
|
});
|
|
14490
14545
|
tree.addLetters({
|
|
14491
|
-
path:
|
|
14546
|
+
path: pathId2,
|
|
14492
14547
|
letters: path.letters
|
|
14493
14548
|
});
|
|
14494
14549
|
}
|
|
@@ -15048,7 +15103,7 @@ function loadColors(tree) {
|
|
|
15048
15103
|
}
|
|
15049
15104
|
];
|
|
15050
15105
|
for (const sphereColor of sphereColors) {
|
|
15051
|
-
const
|
|
15106
|
+
const sphereId2 = id("sphere" /* SPHERE */, sphereColor.sphere);
|
|
15052
15107
|
for (const worldColor of sphereColor.worldColors) {
|
|
15053
15108
|
const colorId = tree.upsertNode(
|
|
15054
15109
|
new BaseNode({
|
|
@@ -15057,7 +15112,7 @@ function loadColors(tree) {
|
|
|
15057
15112
|
data: worldColor.color.data
|
|
15058
15113
|
})
|
|
15059
15114
|
);
|
|
15060
|
-
tree.link(
|
|
15115
|
+
tree.link(sphereId2, colorId);
|
|
15061
15116
|
tree.link(colorId, id("world" /* WORLD */, worldColor.world));
|
|
15062
15117
|
}
|
|
15063
15118
|
}
|
|
@@ -15137,7 +15192,7 @@ function loadMusicalNotes(tree) {
|
|
|
15137
15192
|
}
|
|
15138
15193
|
];
|
|
15139
15194
|
for (const musicalNote of musicalNotes) {
|
|
15140
|
-
const
|
|
15195
|
+
const sphereId2 = id("sphere" /* SPHERE */, musicalNote.sphere);
|
|
15141
15196
|
const noteId = tree.upsertNode(
|
|
15142
15197
|
new BaseNode({
|
|
15143
15198
|
id: id("musicalNote" /* MUSICAL_NOTE */, musicalNote.note),
|
|
@@ -15145,7 +15200,7 @@ function loadMusicalNotes(tree) {
|
|
|
15145
15200
|
data: musicalNote.noteData
|
|
15146
15201
|
})
|
|
15147
15202
|
);
|
|
15148
|
-
tree.link(
|
|
15203
|
+
tree.link(sphereId2, noteId);
|
|
15149
15204
|
}
|
|
15150
15205
|
return tree;
|
|
15151
15206
|
}
|
|
@@ -15175,14 +15230,14 @@ var loadWesternAstrology = (tree) => {
|
|
|
15175
15230
|
{ sphere: SPHERES.MALKUTH, planet: PLANETS.EARTH }
|
|
15176
15231
|
];
|
|
15177
15232
|
for (const planet of planets) {
|
|
15178
|
-
const
|
|
15233
|
+
const sphereId2 = id("sphere" /* SPHERE */, planet.sphere);
|
|
15179
15234
|
const planetId = tree.upsertNode(
|
|
15180
15235
|
new BaseNode({
|
|
15181
15236
|
id: id("planet" /* PLANET */, planet.planet),
|
|
15182
15237
|
type: "planet" /* PLANET */
|
|
15183
15238
|
})
|
|
15184
15239
|
);
|
|
15185
|
-
tree.link(
|
|
15240
|
+
tree.link(sphereId2, planetId);
|
|
15186
15241
|
}
|
|
15187
15242
|
return tree;
|
|
15188
15243
|
};
|
|
@@ -15806,14 +15861,14 @@ var loadKaabalah = (tree) => {
|
|
|
15806
15861
|
}
|
|
15807
15862
|
];
|
|
15808
15863
|
for (const path of paths) {
|
|
15809
|
-
const
|
|
15864
|
+
const pathId2 = tree.addPath({
|
|
15810
15865
|
leftSphere: path.leftSphere,
|
|
15811
15866
|
rightSphere: path.rightSphere,
|
|
15812
15867
|
relatedNumber: path.relatedNumber,
|
|
15813
15868
|
data: path.data
|
|
15814
15869
|
});
|
|
15815
15870
|
tree.addLetters({
|
|
15816
|
-
path:
|
|
15871
|
+
path: pathId2,
|
|
15817
15872
|
letters: path.letters
|
|
15818
15873
|
});
|
|
15819
15874
|
}
|
|
@@ -15964,89 +16019,93 @@ var loadColors2 = (tree) => {
|
|
|
15964
16019
|
},
|
|
15965
16020
|
{
|
|
15966
16021
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.KETHER_BINAH),
|
|
15967
|
-
color: "
|
|
16022
|
+
color: "warm-gold",
|
|
15968
16023
|
colorData: {
|
|
15969
|
-
colorDescription: "
|
|
15970
|
-
colorNames: ["
|
|
15971
|
-
colorHexCodes: ["#
|
|
16024
|
+
colorDescription: "Warm gold",
|
|
16025
|
+
colorNames: ["warm gold"],
|
|
16026
|
+
colorHexCodes: ["#E8C848"]
|
|
15972
16027
|
}
|
|
15973
16028
|
},
|
|
15974
16029
|
{
|
|
15975
16030
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.KETHER_TIPHARETH),
|
|
15976
|
-
color: "grey",
|
|
16031
|
+
color: "blue-grey",
|
|
15977
16032
|
colorData: {
|
|
15978
|
-
colorDescription: "
|
|
15979
|
-
colorNames: ["grey"],
|
|
15980
|
-
colorHexCodes: ["#
|
|
16033
|
+
colorDescription: "Blue-grey",
|
|
16034
|
+
colorNames: ["blue-grey"],
|
|
16035
|
+
colorHexCodes: ["#8098B0"]
|
|
15981
16036
|
}
|
|
15982
16037
|
},
|
|
15983
16038
|
{
|
|
15984
16039
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHOKHMAH_BINAH),
|
|
15985
|
-
color: "
|
|
16040
|
+
color: "salmon-pink",
|
|
15986
16041
|
colorData: {
|
|
15987
|
-
colorDescription: "
|
|
15988
|
-
colorNames: ["
|
|
15989
|
-
colorHexCodes: ["#
|
|
16042
|
+
colorDescription: "Salmon pink",
|
|
16043
|
+
colorNames: ["salmon pink"],
|
|
16044
|
+
colorHexCodes: ["#E06080"]
|
|
15990
16045
|
}
|
|
15991
16046
|
},
|
|
15992
16047
|
{
|
|
15993
16048
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHOKHMAH_TIPHARETH),
|
|
15994
|
-
color: "
|
|
16049
|
+
color: "warm-salmon",
|
|
15995
16050
|
colorData: {
|
|
15996
|
-
colorDescription: "
|
|
15997
|
-
colorNames: ["
|
|
15998
|
-
colorHexCodes: ["#
|
|
16051
|
+
colorDescription: "Warm salmon",
|
|
16052
|
+
colorNames: ["warm salmon"],
|
|
16053
|
+
colorHexCodes: ["#E87050"]
|
|
15999
16054
|
}
|
|
16000
16055
|
},
|
|
16001
16056
|
{
|
|
16002
16057
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHOKHMAH_CHESED),
|
|
16003
|
-
color: "
|
|
16058
|
+
color: "periwinkle-blue",
|
|
16004
16059
|
colorData: {
|
|
16005
|
-
colorDescription: "
|
|
16006
|
-
colorNames: ["
|
|
16007
|
-
colorHexCodes: ["#
|
|
16060
|
+
colorDescription: "Periwinkle blue",
|
|
16061
|
+
colorNames: ["periwinkle blue"],
|
|
16062
|
+
colorHexCodes: ["#7088C0"]
|
|
16008
16063
|
}
|
|
16009
16064
|
},
|
|
16010
16065
|
{
|
|
16011
16066
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.BINAH_TIPHARETH),
|
|
16012
|
-
color: "orange
|
|
16067
|
+
color: "peach-orange",
|
|
16013
16068
|
colorData: {
|
|
16014
|
-
colorDescription: "
|
|
16015
|
-
colorNames: ["orange
|
|
16016
|
-
colorHexCodes: ["#
|
|
16069
|
+
colorDescription: "Peach orange",
|
|
16070
|
+
colorNames: ["peach orange"],
|
|
16071
|
+
colorHexCodes: ["#E8A850"]
|
|
16017
16072
|
}
|
|
16018
16073
|
},
|
|
16019
16074
|
{
|
|
16020
16075
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.BINAH_GEBURAH),
|
|
16021
|
-
color: "
|
|
16076
|
+
color: "dark-red",
|
|
16022
16077
|
colorData: {
|
|
16023
|
-
colorDescription: "
|
|
16024
|
-
colorNames: ["
|
|
16025
|
-
colorHexCodes: ["#
|
|
16078
|
+
colorDescription: "Dark red",
|
|
16079
|
+
colorNames: ["dark red"],
|
|
16080
|
+
colorHexCodes: ["#C82030"]
|
|
16026
16081
|
}
|
|
16027
16082
|
},
|
|
16028
16083
|
{
|
|
16029
16084
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHESED_GEBURAH),
|
|
16030
|
-
color: "
|
|
16085
|
+
color: "olive-green",
|
|
16031
16086
|
colorData: {
|
|
16032
|
-
colorDescription: "
|
|
16033
|
-
colorNames: ["
|
|
16034
|
-
colorHexCodes: ["#
|
|
16087
|
+
colorDescription: "Olive green",
|
|
16088
|
+
colorNames: ["olive green"],
|
|
16089
|
+
colorHexCodes: ["#A8B840"]
|
|
16035
16090
|
}
|
|
16036
16091
|
},
|
|
16037
16092
|
{
|
|
16038
16093
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHESED_TIPHARETH),
|
|
16039
|
-
color: "
|
|
16094
|
+
color: "sage",
|
|
16040
16095
|
colorData: {
|
|
16041
|
-
colorDescription: "
|
|
16042
|
-
colorNames: ["
|
|
16043
|
-
colorHexCodes: ["#
|
|
16096
|
+
colorDescription: "Sage",
|
|
16097
|
+
colorNames: ["sage"],
|
|
16098
|
+
colorHexCodes: ["#B6BD9A"]
|
|
16044
16099
|
}
|
|
16045
16100
|
},
|
|
16046
16101
|
{
|
|
16047
16102
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.CHESED_NETZACH),
|
|
16048
|
-
color:
|
|
16049
|
-
colorData:
|
|
16103
|
+
color: "blue",
|
|
16104
|
+
colorData: {
|
|
16105
|
+
colorDescription: "Blue",
|
|
16106
|
+
colorNames: ["blue"],
|
|
16107
|
+
colorHexCodes: ["#5080C0"]
|
|
16108
|
+
}
|
|
16050
16109
|
},
|
|
16051
16110
|
{
|
|
16052
16111
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.GEBURAH_TIPHARETH),
|
|
@@ -16054,39 +16113,43 @@ var loadColors2 = (tree) => {
|
|
|
16054
16113
|
colorData: {
|
|
16055
16114
|
colorDescription: "Emerald green",
|
|
16056
16115
|
colorNames: ["emerald green"],
|
|
16057
|
-
colorHexCodes: ["#
|
|
16116
|
+
colorHexCodes: ["#48A860"]
|
|
16058
16117
|
}
|
|
16059
16118
|
},
|
|
16060
16119
|
{
|
|
16061
16120
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.GEBURAH_HOD),
|
|
16062
|
-
color: "
|
|
16121
|
+
color: "lavender",
|
|
16063
16122
|
colorData: {
|
|
16064
|
-
colorDescription: "
|
|
16065
|
-
colorNames: ["
|
|
16066
|
-
colorHexCodes: ["#
|
|
16123
|
+
colorDescription: "Lavender",
|
|
16124
|
+
colorNames: ["lavender"],
|
|
16125
|
+
colorHexCodes: ["#8878B8"]
|
|
16067
16126
|
}
|
|
16068
16127
|
},
|
|
16069
16128
|
{
|
|
16070
16129
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.TIPHARETH_NETZACH),
|
|
16071
|
-
color: "
|
|
16130
|
+
color: "teal-green-netzach",
|
|
16072
16131
|
colorData: {
|
|
16073
|
-
colorDescription: "
|
|
16074
|
-
colorNames: ["
|
|
16075
|
-
colorHexCodes: ["#
|
|
16132
|
+
colorDescription: "Teal green",
|
|
16133
|
+
colorNames: ["teal green"],
|
|
16134
|
+
colorHexCodes: ["#28A880"]
|
|
16076
16135
|
}
|
|
16077
16136
|
},
|
|
16078
16137
|
{
|
|
16079
16138
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.TIPHARETH_YESOD),
|
|
16080
|
-
color:
|
|
16081
|
-
colorData:
|
|
16139
|
+
color: "purple-yesod-path",
|
|
16140
|
+
colorData: {
|
|
16141
|
+
colorDescription: "Purple",
|
|
16142
|
+
colorNames: ["purple"],
|
|
16143
|
+
colorHexCodes: ["#8050A8"]
|
|
16144
|
+
}
|
|
16082
16145
|
},
|
|
16083
16146
|
{
|
|
16084
16147
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.TIPHARETH_HOD),
|
|
16085
|
-
color: "
|
|
16148
|
+
color: "magenta-pink",
|
|
16086
16149
|
colorData: {
|
|
16087
|
-
colorDescription: "
|
|
16088
|
-
colorNames: ["
|
|
16089
|
-
colorHexCodes: ["#
|
|
16150
|
+
colorDescription: "Magenta pink",
|
|
16151
|
+
colorNames: ["magenta pink"],
|
|
16152
|
+
colorHexCodes: ["#C850A0"]
|
|
16090
16153
|
}
|
|
16091
16154
|
},
|
|
16092
16155
|
{
|
|
@@ -16095,7 +16158,7 @@ var loadColors2 = (tree) => {
|
|
|
16095
16158
|
colorData: {
|
|
16096
16159
|
colorDescription: "Rose",
|
|
16097
16160
|
colorNames: ["Rose"],
|
|
16098
|
-
colorHexCodes: ["#
|
|
16161
|
+
colorHexCodes: ["#D06088"]
|
|
16099
16162
|
}
|
|
16100
16163
|
},
|
|
16101
16164
|
{
|
|
@@ -16104,43 +16167,43 @@ var loadColors2 = (tree) => {
|
|
|
16104
16167
|
colorData: {
|
|
16105
16168
|
colorDescription: "Violet",
|
|
16106
16169
|
colorNames: ["violet"],
|
|
16107
|
-
colorHexCodes: ["#
|
|
16170
|
+
colorHexCodes: ["#8848C0"]
|
|
16108
16171
|
}
|
|
16109
16172
|
},
|
|
16110
16173
|
{
|
|
16111
16174
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.NETZACH_MALKUTH),
|
|
16112
|
-
color: "
|
|
16175
|
+
color: "salmon",
|
|
16113
16176
|
colorData: {
|
|
16114
|
-
colorDescription: "
|
|
16115
|
-
colorNames: ["
|
|
16116
|
-
colorHexCodes: ["#
|
|
16177
|
+
colorDescription: "Salmon",
|
|
16178
|
+
colorNames: ["salmon"],
|
|
16179
|
+
colorHexCodes: ["#D86858"]
|
|
16117
16180
|
}
|
|
16118
16181
|
},
|
|
16119
16182
|
{
|
|
16120
16183
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.HOD_YESOD),
|
|
16121
|
-
color: "orange
|
|
16184
|
+
color: "orange",
|
|
16122
16185
|
colorData: {
|
|
16123
|
-
colorDescription: "Orange
|
|
16124
|
-
colorNames: ["orange
|
|
16125
|
-
colorHexCodes: ["#
|
|
16186
|
+
colorDescription: "Orange",
|
|
16187
|
+
colorNames: ["orange"],
|
|
16188
|
+
colorHexCodes: ["#E89040"]
|
|
16126
16189
|
}
|
|
16127
16190
|
},
|
|
16128
16191
|
{
|
|
16129
16192
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.HOD_MALKUTH),
|
|
16130
|
-
color: "
|
|
16193
|
+
color: "rose-pink",
|
|
16131
16194
|
colorData: {
|
|
16132
|
-
colorDescription: "
|
|
16133
|
-
colorNames: ["
|
|
16134
|
-
colorHexCodes: ["#
|
|
16195
|
+
colorDescription: "Rose pink",
|
|
16196
|
+
colorNames: ["rose pink"],
|
|
16197
|
+
colorHexCodes: ["#D06080"]
|
|
16135
16198
|
}
|
|
16136
16199
|
},
|
|
16137
16200
|
{
|
|
16138
16201
|
path: id("path" /* PATH */, MELKITZEDEKI_PATHS.YESOD_MALKUTH),
|
|
16139
|
-
color: "
|
|
16202
|
+
color: "teal-green-malkuth",
|
|
16140
16203
|
colorData: {
|
|
16141
|
-
colorDescription: "
|
|
16142
|
-
colorNames: ["
|
|
16143
|
-
colorHexCodes: ["#
|
|
16204
|
+
colorDescription: "Teal green",
|
|
16205
|
+
colorNames: ["teal green"],
|
|
16206
|
+
colorHexCodes: ["#30B898"]
|
|
16144
16207
|
}
|
|
16145
16208
|
}
|
|
16146
16209
|
];
|
|
@@ -18124,13 +18187,13 @@ function loadLurianicKabbalah(tree) {
|
|
|
18124
18187
|
}
|
|
18125
18188
|
];
|
|
18126
18189
|
for (const path of paths) {
|
|
18127
|
-
const
|
|
18190
|
+
const pathId2 = tree.addPath({
|
|
18128
18191
|
leftSphere: path.leftSphere,
|
|
18129
18192
|
rightSphere: path.rightSphere,
|
|
18130
18193
|
relatedNumber: path.relatedNumber
|
|
18131
18194
|
});
|
|
18132
18195
|
tree.addLetters({
|
|
18133
|
-
path:
|
|
18196
|
+
path: pathId2,
|
|
18134
18197
|
letters: path.letters
|
|
18135
18198
|
});
|
|
18136
18199
|
}
|
|
@@ -18595,15 +18658,15 @@ var TreeOfLife = class {
|
|
|
18595
18658
|
data,
|
|
18596
18659
|
relatedNumber
|
|
18597
18660
|
}) {
|
|
18598
|
-
const
|
|
18661
|
+
const sphereId2 = this.upsertNode(
|
|
18599
18662
|
new BaseNode({
|
|
18600
18663
|
id: sphere,
|
|
18601
18664
|
type: "sphere" /* SPHERE */,
|
|
18602
18665
|
data
|
|
18603
18666
|
})
|
|
18604
18667
|
);
|
|
18605
|
-
this.addNumber({ number: relatedNumber, nodeId:
|
|
18606
|
-
return
|
|
18668
|
+
this.addNumber({ number: relatedNumber, nodeId: sphereId2 });
|
|
18669
|
+
return sphereId2;
|
|
18607
18670
|
}
|
|
18608
18671
|
/**
|
|
18609
18672
|
* Adds a path between two spheres with its associated number
|
|
@@ -18618,7 +18681,7 @@ var TreeOfLife = class {
|
|
|
18618
18681
|
relatedNumber,
|
|
18619
18682
|
data
|
|
18620
18683
|
}) {
|
|
18621
|
-
const
|
|
18684
|
+
const pathId2 = this.upsertNode(
|
|
18622
18685
|
new BaseNode({
|
|
18623
18686
|
id: relatedNumber,
|
|
18624
18687
|
type: "path" /* PATH */,
|
|
@@ -18631,11 +18694,11 @@ var TreeOfLife = class {
|
|
|
18631
18694
|
);
|
|
18632
18695
|
const numberOfSpheres = 10;
|
|
18633
18696
|
const pathNumber = relatedNumber + numberOfSpheres;
|
|
18634
|
-
this.link(leftSphere,
|
|
18635
|
-
this.link(rightSphere,
|
|
18636
|
-
this.addNumber({ number: relatedNumber, nodeId:
|
|
18637
|
-
this.addNumber({ number: pathNumber, nodeId:
|
|
18638
|
-
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;
|
|
18639
18702
|
}
|
|
18640
18703
|
addLetters({
|
|
18641
18704
|
path,
|
|
@@ -19611,7 +19674,7 @@ async function readStdin(flags, options) {
|
|
|
19611
19674
|
if (!hasStdinSource()) {
|
|
19612
19675
|
exitWithError(options.emptyCode, options.emptyMessage, flags);
|
|
19613
19676
|
}
|
|
19614
|
-
return await new Promise((
|
|
19677
|
+
return await new Promise((resolve2, reject) => {
|
|
19615
19678
|
const chunks = [];
|
|
19616
19679
|
let totalBytes = 0;
|
|
19617
19680
|
const cleanup = () => {
|
|
@@ -19637,7 +19700,7 @@ async function readStdin(flags, options) {
|
|
|
19637
19700
|
if (value.length === 0) {
|
|
19638
19701
|
exitWithError(options.emptyCode, options.emptyMessage, flags);
|
|
19639
19702
|
}
|
|
19640
|
-
|
|
19703
|
+
resolve2(value);
|
|
19641
19704
|
};
|
|
19642
19705
|
const onError = (err) => {
|
|
19643
19706
|
cleanup();
|
|
@@ -21947,7 +22010,7 @@ var RAW_ARKANNUS = [
|
|
|
21947
22010
|
suit: "pentacles"
|
|
21948
22011
|
}
|
|
21949
22012
|
];
|
|
21950
|
-
var sleep = (ms) => new Promise((
|
|
22013
|
+
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
21951
22014
|
var shuffleArray = (array) => {
|
|
21952
22015
|
const newArray = [...array];
|
|
21953
22016
|
for (let i = newArray.length - 1; i > 0; i--) {
|
|
@@ -22779,6 +22842,516 @@ function cmdTarotSpread(cardQueries, flags) {
|
|
|
22779
22842
|
}
|
|
22780
22843
|
}
|
|
22781
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
|
+
|
|
22782
23355
|
// src/cli/commands/tree.ts
|
|
22783
23356
|
function getTree() {
|
|
22784
23357
|
return getCanonicalTree({
|
|
@@ -22868,6 +23441,174 @@ function describeSources(edge) {
|
|
|
22868
23441
|
}
|
|
22869
23442
|
return [...parts].join(", ");
|
|
22870
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
|
+
}
|
|
22871
23612
|
function cmdTree(flags) {
|
|
22872
23613
|
const tree = getTree();
|
|
22873
23614
|
const allNodes = tree.getNodes();
|
|
@@ -23071,6 +23812,106 @@ Tree search
|
|
|
23071
23812
|
}
|
|
23072
23813
|
console.log();
|
|
23073
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
|
+
}
|
|
23074
23915
|
|
|
23075
23916
|
// src/cli/app.ts
|
|
23076
23917
|
function outputVersion(flags) {
|
|
@@ -23236,6 +24077,15 @@ async function runCli(argv) {
|
|
|
23236
24077
|
case "tree:types":
|
|
23237
24078
|
cmdTreeTypes(flags);
|
|
23238
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;
|
|
23239
24089
|
case "astrology":
|
|
23240
24090
|
await cmdAstrology(args.slice(1), flags, inputPayload, execution);
|
|
23241
24091
|
return;
|