kaabalah 6.5.0 → 6.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2FRLTA5B.mjs +2735 -0
- package/dist/chunk-2FRLTA5B.mjs.map +1 -0
- package/dist/{chunk-UN7QMOMX.mjs → chunk-A7KBFASN.mjs} +3 -3
- package/dist/{chunk-UN7QMOMX.mjs.map → chunk-A7KBFASN.mjs.map} +1 -1
- package/dist/{chunk-UG6HZK3Z.js → chunk-CZKASW5W.js} +3 -3
- package/dist/{chunk-UG6HZK3Z.js.map → chunk-CZKASW5W.js.map} +1 -1
- package/dist/chunk-RVMZBPNZ.js +2762 -0
- package/dist/chunk-RVMZBPNZ.js.map +1 -0
- package/dist/cli.js +243 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +167 -91
- package/dist/index.mjs +4 -4
- package/dist/semantic/index.js +21 -21
- package/dist/semantic/index.mjs +2 -2
- package/dist/visual/index.d.mts +485 -1
- package/dist/visual/index.d.ts +485 -1
- package/dist/visual/index.js +84 -8
- package/dist/visual/index.mjs +1 -1
- package/package.json +5 -2
- package/dist/chunk-BKNWKD32.mjs +0 -939
- package/dist/chunk-BKNWKD32.mjs.map +0 -1
- package/dist/chunk-SW5O2BJI.js +0 -947
- package/dist/chunk-SW5O2BJI.js.map +0 -1
package/dist/chunk-SW5O2BJI.js
DELETED
|
@@ -1,947 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkS6KNERP7_js = require('./chunk-S6KNERP7.js');
|
|
4
|
-
|
|
5
|
-
// src/visual/tree-svg.ts
|
|
6
|
-
var TREE_SVG_DEFAULT_VIEWBOX = {
|
|
7
|
-
minX: 0,
|
|
8
|
-
minY: 0,
|
|
9
|
-
width: 286,
|
|
10
|
-
height: 561
|
|
11
|
-
};
|
|
12
|
-
var TREE_SPHERE_NAMES = [
|
|
13
|
-
"Kether",
|
|
14
|
-
"Chokhmah",
|
|
15
|
-
"Binah",
|
|
16
|
-
"Daath",
|
|
17
|
-
"Chesed",
|
|
18
|
-
"Geburah",
|
|
19
|
-
"Tiphareth",
|
|
20
|
-
"Netzach",
|
|
21
|
-
"Hod",
|
|
22
|
-
"Yesod",
|
|
23
|
-
"Malkuth"
|
|
24
|
-
];
|
|
25
|
-
var TREE_PATH_NUMBERS = Array.from({ length: 22 }, (_, index) => index + 1);
|
|
26
|
-
var CANONICAL_X_PERCENTAGES = { left: 13.25, mid: 49.94, right: 86.66 };
|
|
27
|
-
var CANONICAL_ROW_Y_PERCENTAGES = [
|
|
28
|
-
6.83,
|
|
29
|
-
17.68,
|
|
30
|
-
28.42,
|
|
31
|
-
39.26,
|
|
32
|
-
50.06,
|
|
33
|
-
60.85,
|
|
34
|
-
71.68,
|
|
35
|
-
93.2
|
|
36
|
-
];
|
|
37
|
-
var DEFAULT_SPHERE_RADIUS = 30;
|
|
38
|
-
var DEFAULT_PATH_EDGE_WIDTH = 26;
|
|
39
|
-
var DEFAULT_PATH_MAIN_WIDTH = 22;
|
|
40
|
-
var DEFAULT_PATH_HIGHLIGHT_WIDTH = 8;
|
|
41
|
-
var DEFAULT_SPHERE_HIT_RADIUS = DEFAULT_SPHERE_RADIUS + 8;
|
|
42
|
-
var DEFAULT_PATH_HIT_STROKE_WIDTH = DEFAULT_PATH_EDGE_WIDTH + 8;
|
|
43
|
-
var MUTED_TARGET_COLOR = "#AAA";
|
|
44
|
-
var sphereId = (name) => chunkS6KNERP7_js.id("sphere" /* SPHERE */, name);
|
|
45
|
-
var pathId = (pathNumber) => chunkS6KNERP7_js.id("path" /* PATH */, String(pathNumber));
|
|
46
|
-
var TREE_SPHERE_IDS = TREE_SPHERE_NAMES.map(
|
|
47
|
-
(name) => sphereId(name)
|
|
48
|
-
);
|
|
49
|
-
var TREE_PATH_IDS = TREE_PATH_NUMBERS.map(
|
|
50
|
-
(pathNumber) => pathId(pathNumber)
|
|
51
|
-
);
|
|
52
|
-
var CANONICAL_SPHERE_PERCENTAGES = {
|
|
53
|
-
[sphereId("Kether")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[0] },
|
|
54
|
-
[sphereId("Chokhmah")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
|
|
55
|
-
[sphereId("Binah")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
|
|
56
|
-
[sphereId("Daath")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[2] },
|
|
57
|
-
[sphereId("Chesed")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[3] },
|
|
58
|
-
[sphereId("Geburah")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[3] },
|
|
59
|
-
[sphereId("Tiphareth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[4] },
|
|
60
|
-
[sphereId("Netzach")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[5] },
|
|
61
|
-
[sphereId("Hod")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[5] },
|
|
62
|
-
[sphereId("Yesod")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[6] },
|
|
63
|
-
[sphereId("Malkuth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[7] }
|
|
64
|
-
};
|
|
65
|
-
function getTreeLayout(system = "kaabalah") {
|
|
66
|
-
const tree = chunkS6KNERP7_js.createTree({ system });
|
|
67
|
-
const percentages = buildLayoutMap(tree, CANONICAL_SPHERE_PERCENTAGES);
|
|
68
|
-
const viewBoxUnits = buildLayoutMap(
|
|
69
|
-
tree,
|
|
70
|
-
scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, TREE_SVG_DEFAULT_VIEWBOX)
|
|
71
|
-
);
|
|
72
|
-
return {
|
|
73
|
-
system,
|
|
74
|
-
viewBox: { ...TREE_SVG_DEFAULT_VIEWBOX },
|
|
75
|
-
sphereOrder: [...TREE_SPHERE_IDS],
|
|
76
|
-
pathOrder: [...TREE_PATH_IDS],
|
|
77
|
-
percentages,
|
|
78
|
-
viewBoxUnits
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function getTreeRenderModel(options = {}) {
|
|
82
|
-
const system = options.system ?? "kaabalah";
|
|
83
|
-
const tree = chunkS6KNERP7_js.createTree({ system, parts: ["colors"] });
|
|
84
|
-
const viewBox = normalizeViewBox(options.viewBox);
|
|
85
|
-
const palette = resolvePalette(options.palette);
|
|
86
|
-
const highlights = resolveHighlights(options.highlights);
|
|
87
|
-
const activationMap = resolveActivationMap(options.activations);
|
|
88
|
-
const layout = getTreeLayout(system);
|
|
89
|
-
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
90
|
-
const viewBoxLayout = buildLayoutMap(tree, spherePositions);
|
|
91
|
-
const scale = Math.min(
|
|
92
|
-
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
93
|
-
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
94
|
-
);
|
|
95
|
-
const radius = round(DEFAULT_SPHERE_RADIUS * scale);
|
|
96
|
-
const pathEdgeWidth = round(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
97
|
-
const pathMainWidth = round(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
98
|
-
const pathHighlightWidth = round(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
99
|
-
const sphereHitRadius = round(DEFAULT_SPHERE_HIT_RADIUS * scale);
|
|
100
|
-
const pathHitStrokeWidth = round(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
|
|
101
|
-
const layers = [
|
|
102
|
-
{ name: "background", order: 0, description: "Background rectangle when requested." },
|
|
103
|
-
...options.daathLayer === "back" ? [{ name: "spheres-behind-paths", order: 1, description: "Daath behind the paths." }] : [],
|
|
104
|
-
{ name: "paths", order: options.daathLayer === "back" ? 2 : 1, description: "Canonical paths and activation emphasis." },
|
|
105
|
-
{ name: "spheres", order: options.daathLayer === "back" ? 3 : 2, description: "Canonical sphere material and activation halos." },
|
|
106
|
-
{ name: "hit-targets", order: options.daathLayer === "back" ? 4 : 3, description: "Invisible anchors for interaction." }
|
|
107
|
-
];
|
|
108
|
-
const layerOrder = layers.map((layer) => layer.name);
|
|
109
|
-
const spheres = TREE_SPHERE_NAMES.map((sphereName) => {
|
|
110
|
-
const sphereIdValue = sphereId(sphereName);
|
|
111
|
-
const canonicalColor = resolveSphereCanonicalColor({
|
|
112
|
-
palette,
|
|
113
|
-
sphereId: sphereIdValue,
|
|
114
|
-
tree
|
|
115
|
-
});
|
|
116
|
-
const point = spherePositions[sphereIdValue];
|
|
117
|
-
const activation = resolveTargetActivation({
|
|
118
|
-
activation: activationMap.get(sphereIdValue),
|
|
119
|
-
canonicalColor
|
|
120
|
-
});
|
|
121
|
-
const activeFill = resolveSphereDisplayFill({
|
|
122
|
-
palette,
|
|
123
|
-
highlights,
|
|
124
|
-
sphereId: sphereIdValue,
|
|
125
|
-
canonicalColor,
|
|
126
|
-
activation
|
|
127
|
-
});
|
|
128
|
-
return {
|
|
129
|
-
id: sphereIdValue,
|
|
130
|
-
name: sphereName,
|
|
131
|
-
slug: sphereName.toLowerCase(),
|
|
132
|
-
canonicalColor,
|
|
133
|
-
geometry: {
|
|
134
|
-
percentages: {
|
|
135
|
-
center: { ...layout.percentages.spheres[sphereIdValue] },
|
|
136
|
-
anchor: getPercentageAnchor(layout.percentages.spheres[sphereIdValue])
|
|
137
|
-
},
|
|
138
|
-
viewBoxUnits: {
|
|
139
|
-
center: { ...point },
|
|
140
|
-
anchor: getViewBoxAnchor(point, viewBox),
|
|
141
|
-
hitTarget: {
|
|
142
|
-
kind: "circle",
|
|
143
|
-
cx: point.x,
|
|
144
|
-
cy: point.y,
|
|
145
|
-
r: sphereHitRadius
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
radius: {
|
|
149
|
-
viewBoxUnits: radius
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
material: getSphereMaterial({
|
|
153
|
-
sphereName,
|
|
154
|
-
preserveSpecialMaterial: shouldPreserveSpecialRenderer({
|
|
155
|
-
palette,
|
|
156
|
-
highlights,
|
|
157
|
-
hasPaintOverride: activation !== null || highlights.sphereFills[sphereIdValue] !== void 0,
|
|
158
|
-
activation
|
|
159
|
-
})
|
|
160
|
-
}),
|
|
161
|
-
activation,
|
|
162
|
-
displayFill: activeFill
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
const paths = TREE_PATH_IDS.map((pathIdValue) => {
|
|
166
|
-
const canonicalColor = resolvePathCanonicalColor({
|
|
167
|
-
palette,
|
|
168
|
-
tree,
|
|
169
|
-
pathId: pathIdValue
|
|
170
|
-
});
|
|
171
|
-
const path = viewBoxLayout.paths[pathIdValue];
|
|
172
|
-
const activation = resolveTargetActivation({
|
|
173
|
-
activation: activationMap.get(pathIdValue),
|
|
174
|
-
canonicalColor
|
|
175
|
-
});
|
|
176
|
-
const displayColor = activation ? resolvePathDisplayColor({
|
|
177
|
-
canonicalColor,
|
|
178
|
-
activation
|
|
179
|
-
}) : resolvePathBaseColor({
|
|
180
|
-
canonicalColor,
|
|
181
|
-
highlights,
|
|
182
|
-
pathId: pathIdValue
|
|
183
|
-
});
|
|
184
|
-
return {
|
|
185
|
-
id: pathIdValue,
|
|
186
|
-
canonicalColor,
|
|
187
|
-
geometry: {
|
|
188
|
-
percentages: {
|
|
189
|
-
from: { ...layout.percentages.paths[pathIdValue].from },
|
|
190
|
-
to: { ...layout.percentages.paths[pathIdValue].to },
|
|
191
|
-
anchor: getPercentagePathAnchor(layout.percentages.paths[pathIdValue])
|
|
192
|
-
},
|
|
193
|
-
viewBoxUnits: {
|
|
194
|
-
from: { ...path.from },
|
|
195
|
-
to: { ...path.to },
|
|
196
|
-
anchor: getViewBoxPathAnchor(path, viewBox),
|
|
197
|
-
hitTarget: {
|
|
198
|
-
kind: "line",
|
|
199
|
-
x1: path.from.x,
|
|
200
|
-
y1: path.from.y,
|
|
201
|
-
x2: path.to.x,
|
|
202
|
-
y2: path.to.y,
|
|
203
|
-
strokeWidth: pathHitStrokeWidth
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
widths: {
|
|
207
|
-
edge: pathEdgeWidth,
|
|
208
|
-
main: pathMainWidth,
|
|
209
|
-
highlight: pathHighlightWidth,
|
|
210
|
-
hitTarget: pathHitStrokeWidth
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
activation,
|
|
214
|
-
displayColor
|
|
215
|
-
};
|
|
216
|
-
});
|
|
217
|
-
return {
|
|
218
|
-
system,
|
|
219
|
-
viewBox,
|
|
220
|
-
scale,
|
|
221
|
-
layout,
|
|
222
|
-
layerOrder,
|
|
223
|
-
layers,
|
|
224
|
-
spheres,
|
|
225
|
-
paths,
|
|
226
|
-
sphereById: Object.fromEntries(spheres.map((entry) => [entry.id, entry])),
|
|
227
|
-
pathById: Object.fromEntries(paths.map((entry) => [entry.id, entry]))
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function generateTreeSvg(options = {}) {
|
|
231
|
-
const system = options.system ?? "kaabalah";
|
|
232
|
-
const daathLayer = options.daathLayer ?? "front";
|
|
233
|
-
const tree = chunkS6KNERP7_js.createTree({ system, parts: ["colors"] });
|
|
234
|
-
const viewBox = normalizeViewBox(options.viewBox);
|
|
235
|
-
const palette = resolvePalette(options.palette);
|
|
236
|
-
const highlights = resolveHighlights(options.highlights);
|
|
237
|
-
const activationMap = resolveActivationMap(options.activations);
|
|
238
|
-
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
239
|
-
const layout = buildLayoutMap(tree, spherePositions);
|
|
240
|
-
const scale = Math.min(
|
|
241
|
-
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
242
|
-
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
243
|
-
);
|
|
244
|
-
const radius = round(DEFAULT_SPHERE_RADIUS * scale);
|
|
245
|
-
const pathEdgeWidth = round(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
246
|
-
const pathMainWidth = round(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
247
|
-
const pathHighlightWidth = round(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
248
|
-
const sphereStrokeWidth = palette.sphereStrokeWidth ? round(palette.sphereStrokeWidth * scale) : void 0;
|
|
249
|
-
const lines = [];
|
|
250
|
-
const push = (line) => lines.push(line);
|
|
251
|
-
const svgAttributes = [
|
|
252
|
-
`xmlns="http://www.w3.org/2000/svg"`,
|
|
253
|
-
options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
|
|
254
|
-
options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
|
|
255
|
-
`viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
|
|
256
|
-
`preserveAspectRatio="xMidYMid meet"`
|
|
257
|
-
].filter(Boolean);
|
|
258
|
-
push(`<svg ${svgAttributes.join(" ")}>`);
|
|
259
|
-
push(`<defs>`);
|
|
260
|
-
push(`<filter id="pathDarken">
|
|
261
|
-
<feComponentTransfer>
|
|
262
|
-
<feFuncR type="linear" slope="0.65"/>
|
|
263
|
-
<feFuncG type="linear" slope="0.65"/>
|
|
264
|
-
<feFuncB type="linear" slope="0.65"/>
|
|
265
|
-
</feComponentTransfer>
|
|
266
|
-
</filter>`);
|
|
267
|
-
for (const sphereName of TREE_SPHERE_NAMES) {
|
|
268
|
-
const currentSphereId = sphereId(sphereName);
|
|
269
|
-
const slug = sphereName.toLowerCase();
|
|
270
|
-
const point = spherePositions[currentSphereId];
|
|
271
|
-
if (!point) {
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
push(`<radialGradient id="spec-${slug}" cx="30%" cy="25%" r="55%" fx="30%" fy="25%">
|
|
275
|
-
<stop offset="0%" stop-color="white" stop-opacity="0.95"/>
|
|
276
|
-
<stop offset="25%" stop-color="white" stop-opacity="0.45"/>
|
|
277
|
-
<stop offset="50%" stop-color="white" stop-opacity="0.08"/>
|
|
278
|
-
<stop offset="100%" stop-color="white" stop-opacity="0"/>
|
|
279
|
-
</radialGradient>`);
|
|
280
|
-
push(`<radialGradient id="shad-${slug}" cx="78%" cy="80%" r="55%" fx="78%" fy="80%">
|
|
281
|
-
<stop offset="0%" stop-color="black" stop-opacity="0.32"/>
|
|
282
|
-
<stop offset="40%" stop-color="black" stop-opacity="0.12"/>
|
|
283
|
-
<stop offset="100%" stop-color="black" stop-opacity="0"/>
|
|
284
|
-
</radialGradient>`);
|
|
285
|
-
push(
|
|
286
|
-
`<clipPath id="clip-${slug}"><circle cx="${point.x}" cy="${point.y}" r="${radius}"/></clipPath>`
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
push(`<radialGradient id="kether-glow" cx="50%" cy="50%" r="50%">
|
|
290
|
-
<stop offset="0%" stop-color="white" stop-opacity="0.95"/>
|
|
291
|
-
<stop offset="45%" stop-color="white" stop-opacity="0.6"/>
|
|
292
|
-
<stop offset="80%" stop-color="white" stop-opacity="0.15"/>
|
|
293
|
-
<stop offset="100%" stop-color="white" stop-opacity="0"/>
|
|
294
|
-
</radialGradient>`);
|
|
295
|
-
push(`<linearGradient id="kether-facet" x1="0" y1="0" x2="0" y2="1">
|
|
296
|
-
<stop offset="0%" stop-color="white" stop-opacity="0.9"/>
|
|
297
|
-
<stop offset="50%" stop-color="white" stop-opacity="0.5"/>
|
|
298
|
-
<stop offset="100%" stop-color="white" stop-opacity="0.1"/>
|
|
299
|
-
</linearGradient>`);
|
|
300
|
-
push(`<radialGradient id="kether-rim" cx="50%" cy="50%" r="75%">
|
|
301
|
-
<stop offset="60%" stop-color="black" stop-opacity="0"/>
|
|
302
|
-
<stop offset="100%" stop-color="black" stop-opacity="0.18"/>
|
|
303
|
-
</radialGradient>`);
|
|
304
|
-
push(`</defs>`);
|
|
305
|
-
const background = options.background ?? "white";
|
|
306
|
-
if (background !== "transparent") {
|
|
307
|
-
push(
|
|
308
|
-
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr(background)}"/>`
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
if (daathLayer === "back") {
|
|
312
|
-
push(`<g id="spheres-behind-paths">`);
|
|
313
|
-
renderSphere(push, {
|
|
314
|
-
highlights,
|
|
315
|
-
activation: resolveTargetActivation({
|
|
316
|
-
activation: activationMap.get(sphereId("Daath")),
|
|
317
|
-
canonicalColor: resolveSphereCanonicalColor({
|
|
318
|
-
palette,
|
|
319
|
-
sphereId: sphereId("Daath"),
|
|
320
|
-
tree
|
|
321
|
-
})
|
|
322
|
-
}),
|
|
323
|
-
tree,
|
|
324
|
-
palette,
|
|
325
|
-
radius,
|
|
326
|
-
sphereStrokeWidth,
|
|
327
|
-
spherePositions,
|
|
328
|
-
sphereName: "Daath"
|
|
329
|
-
});
|
|
330
|
-
push(`</g>`);
|
|
331
|
-
}
|
|
332
|
-
push(`<g id="paths">`);
|
|
333
|
-
for (const currentPathId of TREE_PATH_IDS) {
|
|
334
|
-
const path = layout.paths[currentPathId];
|
|
335
|
-
const canonicalColor = resolvePathCanonicalColor({
|
|
336
|
-
palette,
|
|
337
|
-
tree,
|
|
338
|
-
pathId: currentPathId
|
|
339
|
-
});
|
|
340
|
-
const baseColor = resolvePathBaseColor({
|
|
341
|
-
canonicalColor,
|
|
342
|
-
highlights,
|
|
343
|
-
pathId: currentPathId
|
|
344
|
-
});
|
|
345
|
-
const activation = resolveTargetActivation({
|
|
346
|
-
activation: activationMap.get(currentPathId),
|
|
347
|
-
canonicalColor
|
|
348
|
-
});
|
|
349
|
-
const color = activation ? resolvePathDisplayColor({
|
|
350
|
-
canonicalColor,
|
|
351
|
-
activation
|
|
352
|
-
}) : baseColor;
|
|
353
|
-
const edgeColor = resolvePathEdgeColor({
|
|
354
|
-
palette,
|
|
355
|
-
pathColor: color
|
|
356
|
-
});
|
|
357
|
-
push(
|
|
358
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
|
|
359
|
-
);
|
|
360
|
-
if (activation?.visible && activation.emphasis > 0) {
|
|
361
|
-
push(
|
|
362
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(color)}" stroke-opacity="${round(0.18 + activation.emphasis * 0.28)}" stroke-width="${round(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
push(
|
|
366
|
-
`<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"/>`
|
|
367
|
-
);
|
|
368
|
-
push(
|
|
369
|
-
`<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"/>`
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
push(`</g>`);
|
|
373
|
-
const frontSphereNames = daathLayer === "back" ? TREE_SPHERE_NAMES.filter((name) => name !== "Daath") : TREE_SPHERE_NAMES;
|
|
374
|
-
push(`<g id="spheres">`);
|
|
375
|
-
for (const sphereName of frontSphereNames) {
|
|
376
|
-
const currentSphereId = sphereId(sphereName);
|
|
377
|
-
const canonicalColor = resolveSphereCanonicalColor({
|
|
378
|
-
palette,
|
|
379
|
-
sphereId: currentSphereId,
|
|
380
|
-
tree
|
|
381
|
-
});
|
|
382
|
-
renderSphere(push, {
|
|
383
|
-
highlights,
|
|
384
|
-
activation: resolveTargetActivation({
|
|
385
|
-
activation: activationMap.get(currentSphereId),
|
|
386
|
-
canonicalColor
|
|
387
|
-
}),
|
|
388
|
-
tree,
|
|
389
|
-
palette,
|
|
390
|
-
radius,
|
|
391
|
-
sphereStrokeWidth,
|
|
392
|
-
spherePositions,
|
|
393
|
-
sphereName
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
push(`</g>`);
|
|
397
|
-
if (daathLayer === "back") {
|
|
398
|
-
const daathPoint = spherePositions[sphereId("Daath")];
|
|
399
|
-
push(
|
|
400
|
-
`<circle id="sphere-daath-hit-area" data-node-id="sphere:Daath" cx="${daathPoint.x}" cy="${daathPoint.y}" r="${radius}" fill="transparent" pointer-events="all"/>`
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
push(`</svg>`);
|
|
404
|
-
return lines.join("\n");
|
|
405
|
-
}
|
|
406
|
-
function renderSphere(push, params) {
|
|
407
|
-
const currentSphereId = sphereId(params.sphereName);
|
|
408
|
-
const point = params.spherePositions[currentSphereId];
|
|
409
|
-
const slug = params.sphereName.toLowerCase();
|
|
410
|
-
const colorData = params.tree.relatedFirst(currentSphereId, "color" /* COLOR */)?.data?.colorHexCodes ?? [];
|
|
411
|
-
const sphereFill = resolveSphereFill({
|
|
412
|
-
palette: params.palette,
|
|
413
|
-
sphereId: currentSphereId,
|
|
414
|
-
defaultColors: colorData
|
|
415
|
-
});
|
|
416
|
-
const activationFill = params.activation && (params.activation.state === "inactive" || params.activation.colorOverride) ? params.activation.displayColor : void 0;
|
|
417
|
-
const highlightFill = activationFill ?? params.highlights.sphereFills[currentSphereId];
|
|
418
|
-
const activeFill = params.activation ? params.activation.displayColor : highlightFill ?? sphereFill;
|
|
419
|
-
const preserveSpecialRenderer = shouldPreserveSpecialRenderer({
|
|
420
|
-
palette: params.palette,
|
|
421
|
-
highlights: params.highlights,
|
|
422
|
-
hasPaintOverride: highlightFill !== void 0,
|
|
423
|
-
activation: params.activation
|
|
424
|
-
});
|
|
425
|
-
if (params.activation?.visible && params.activation.emphasis > 0) {
|
|
426
|
-
const haloStrokeWidth = round(3.2 + params.activation.emphasis * 4.8);
|
|
427
|
-
const haloRadius = round(params.radius + haloStrokeWidth / 2 + 0.7);
|
|
428
|
-
const haloColor = params.activation.displayColor;
|
|
429
|
-
push(
|
|
430
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${escapeAttr(haloColor)}" stroke-opacity="${round(0.24 + params.activation.emphasis * 0.28)}" stroke-width="${haloStrokeWidth}"/>`
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
|
|
434
|
-
if (preserveSpecialRenderer) {
|
|
435
|
-
if (params.sphereName === "Kether") {
|
|
436
|
-
renderKether(
|
|
437
|
-
push,
|
|
438
|
-
point,
|
|
439
|
-
params.radius,
|
|
440
|
-
highlightFill ? toPrimaryFill(highlightFill, "#e0e0e0") : void 0
|
|
441
|
-
);
|
|
442
|
-
} else if (params.sphereName === "Chokhmah") {
|
|
443
|
-
renderIridescent(push, point, params.radius);
|
|
444
|
-
if (highlightFill) {
|
|
445
|
-
renderSphereTintOverlay(push, point, params.radius, highlightFill, 0.62);
|
|
446
|
-
}
|
|
447
|
-
} else if (params.sphereName === "Daath") {
|
|
448
|
-
renderYinYang(push, point, params.radius, highlightFill);
|
|
449
|
-
} else if (params.sphereName === "Malkuth" && colorData.length >= 4) {
|
|
450
|
-
const slicedColors = resolveMalkuthColors({
|
|
451
|
-
highlightFill,
|
|
452
|
-
paletteFill: sphereFill,
|
|
453
|
-
defaultColors: colorData.slice(0, 4)
|
|
454
|
-
});
|
|
455
|
-
renderSlicedSphere(push, point, params.radius, slicedColors, -135);
|
|
456
|
-
} else {
|
|
457
|
-
push(
|
|
458
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
} else {
|
|
462
|
-
push(
|
|
463
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
push(
|
|
467
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#spec-${slug})"/>`
|
|
468
|
-
);
|
|
469
|
-
if (!preserveSpecialRenderer || params.sphereName !== "Kether" && params.sphereName !== "Chokhmah") {
|
|
470
|
-
push(
|
|
471
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#shad-${slug})"/>`
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
push(`</g>`);
|
|
475
|
-
if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
|
|
476
|
-
push(
|
|
477
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
|
|
478
|
-
);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
function buildLayoutMap(tree, spherePositions) {
|
|
482
|
-
const paths = {};
|
|
483
|
-
for (const currentPathId of TREE_PATH_IDS) {
|
|
484
|
-
const path = tree.getNode(currentPathId);
|
|
485
|
-
const fromId = path?.data?.from;
|
|
486
|
-
const toId = path?.data?.to;
|
|
487
|
-
if (!fromId || !toId) {
|
|
488
|
-
throw new Error(`Tree path ${currentPathId} is missing endpoints.`);
|
|
489
|
-
}
|
|
490
|
-
const from = spherePositions[fromId];
|
|
491
|
-
const to = spherePositions[toId];
|
|
492
|
-
if (!from || !to) {
|
|
493
|
-
throw new Error(
|
|
494
|
-
`Tree path ${currentPathId} references unknown layout spheres: ${fromId}, ${toId}.`
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
paths[currentPathId] = {
|
|
498
|
-
fromId,
|
|
499
|
-
toId,
|
|
500
|
-
from: { ...from },
|
|
501
|
-
to: { ...to }
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
return {
|
|
505
|
-
spheres: cloneCoordinateMap(spherePositions),
|
|
506
|
-
paths
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
function cloneCoordinateMap(coordinates) {
|
|
510
|
-
const clone = {};
|
|
511
|
-
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
512
|
-
const point = coordinates[currentSphereId];
|
|
513
|
-
clone[currentSphereId] = { ...point };
|
|
514
|
-
}
|
|
515
|
-
return clone;
|
|
516
|
-
}
|
|
517
|
-
function scaleCoordinates(coordinates, viewBox) {
|
|
518
|
-
const scaled = {};
|
|
519
|
-
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
520
|
-
const point = coordinates[currentSphereId];
|
|
521
|
-
scaled[currentSphereId] = {
|
|
522
|
-
x: round(viewBox.minX + point.x / 100 * viewBox.width),
|
|
523
|
-
y: round(viewBox.minY + point.y / 100 * viewBox.height)
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
return scaled;
|
|
527
|
-
}
|
|
528
|
-
function normalizeViewBox(viewBox) {
|
|
529
|
-
return {
|
|
530
|
-
minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
|
|
531
|
-
minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
|
|
532
|
-
width: viewBox?.width ?? TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
533
|
-
height: viewBox?.height ?? TREE_SVG_DEFAULT_VIEWBOX.height
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
function resolveActivationMap(activations) {
|
|
537
|
-
const map = /* @__PURE__ */ new Map();
|
|
538
|
-
for (const activation of activations ?? []) {
|
|
539
|
-
map.set(activation.targetId, activation);
|
|
540
|
-
}
|
|
541
|
-
return map;
|
|
542
|
-
}
|
|
543
|
-
function resolveTargetActivation(params) {
|
|
544
|
-
if (!params.activation) {
|
|
545
|
-
return null;
|
|
546
|
-
}
|
|
547
|
-
const state = params.activation.state ?? (params.activation.count > 0 ? "active" : "inactive");
|
|
548
|
-
const strength = clamp01(
|
|
549
|
-
params.activation.strength ?? (params.activation.total > 0 ? params.activation.count / params.activation.total : 0)
|
|
550
|
-
);
|
|
551
|
-
const displayColor = state === "inactive" ? params.activation.color ?? MUTED_TARGET_COLOR : params.activation.color ?? params.canonicalColor;
|
|
552
|
-
return {
|
|
553
|
-
state,
|
|
554
|
-
count: params.activation.count,
|
|
555
|
-
total: params.activation.total,
|
|
556
|
-
strength,
|
|
557
|
-
canonicalColor: params.canonicalColor,
|
|
558
|
-
displayColor,
|
|
559
|
-
colorOverride: params.activation.color,
|
|
560
|
-
mutedColor: MUTED_TARGET_COLOR,
|
|
561
|
-
visible: state !== "inactive",
|
|
562
|
-
emphasis: state === "selected" ? clamp01(Math.max(strength, 0.9)) : state === "hovered" ? clamp01(Math.max(strength, 0.72)) : state === "active" ? clamp01(Math.max(strength, 0.56)) : 0
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
function resolveSphereCanonicalColor(params) {
|
|
566
|
-
const override = params.palette.sphereFills[params.sphereId];
|
|
567
|
-
if (override) {
|
|
568
|
-
return toPrimaryFill(override, params.palette.defaultSphereFill);
|
|
569
|
-
}
|
|
570
|
-
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
571
|
-
return params.palette.defaultSphereFill;
|
|
572
|
-
}
|
|
573
|
-
const treeColor = params.tree.relatedFirst(params.sphereId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
|
|
574
|
-
return treeColor ?? params.palette.defaultSphereFill;
|
|
575
|
-
}
|
|
576
|
-
function resolvePathCanonicalColor(params) {
|
|
577
|
-
const override = params.palette.pathColors[params.pathId];
|
|
578
|
-
if (override) {
|
|
579
|
-
return override;
|
|
580
|
-
}
|
|
581
|
-
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
582
|
-
return params.palette.defaultPathColor;
|
|
583
|
-
}
|
|
584
|
-
const treeColor = params.tree.relatedFirst(params.pathId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
|
|
585
|
-
return treeColor ?? params.palette.defaultPathColor;
|
|
586
|
-
}
|
|
587
|
-
function resolvePathBaseColor(params) {
|
|
588
|
-
const highlightOverride = params.highlights.pathColors[params.pathId];
|
|
589
|
-
if (highlightOverride) {
|
|
590
|
-
return highlightOverride;
|
|
591
|
-
}
|
|
592
|
-
return params.canonicalColor;
|
|
593
|
-
}
|
|
594
|
-
function resolveSphereDisplayFill(params) {
|
|
595
|
-
const highlightOverride = params.highlights.sphereFills[params.sphereId];
|
|
596
|
-
const fallbackFill = Array.isArray(params.canonicalColor) ? params.canonicalColor[0] ?? params.palette.defaultSphereFill : params.canonicalColor;
|
|
597
|
-
if (params.activation) {
|
|
598
|
-
if (params.activation.state !== "inactive" && !params.activation.colorOverride) {
|
|
599
|
-
return params.canonicalColor ?? fallbackFill;
|
|
600
|
-
}
|
|
601
|
-
return params.activation.displayColor;
|
|
602
|
-
}
|
|
603
|
-
if (highlightOverride) {
|
|
604
|
-
return highlightOverride;
|
|
605
|
-
}
|
|
606
|
-
return params.canonicalColor ?? fallbackFill;
|
|
607
|
-
}
|
|
608
|
-
function resolvePathDisplayColor(params) {
|
|
609
|
-
if (!params.activation) {
|
|
610
|
-
return params.canonicalColor;
|
|
611
|
-
}
|
|
612
|
-
return params.activation.displayColor;
|
|
613
|
-
}
|
|
614
|
-
function getPercentageAnchor(point) {
|
|
615
|
-
return {
|
|
616
|
-
x: point.x,
|
|
617
|
-
y: point.y,
|
|
618
|
-
vertical: point.y < 18 ? "below" : "above"
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
function getViewBoxAnchor(point, viewBox) {
|
|
622
|
-
return {
|
|
623
|
-
x: point.x,
|
|
624
|
-
y: point.y,
|
|
625
|
-
vertical: point.y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
function getPercentagePathAnchor(path) {
|
|
629
|
-
const y = round((path.from.y + path.to.y) / 2);
|
|
630
|
-
return {
|
|
631
|
-
x: round((path.from.x + path.to.x) / 2),
|
|
632
|
-
y,
|
|
633
|
-
vertical: y < 18 ? "below" : "above"
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
function getViewBoxPathAnchor(path, viewBox) {
|
|
637
|
-
const y = round((path.from.y + path.to.y) / 2);
|
|
638
|
-
return {
|
|
639
|
-
x: round((path.from.x + path.to.x) / 2),
|
|
640
|
-
y,
|
|
641
|
-
vertical: y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
function shouldPreserveSpecialRenderer(params) {
|
|
645
|
-
return params.palette.specialSphereMode === "preserve" && (params.activation !== null || !params.hasPaintOverride || params.highlights.specialSphereMode === "preserve");
|
|
646
|
-
}
|
|
647
|
-
function getSphereMaterial(params) {
|
|
648
|
-
if (!params.preserveSpecialMaterial) {
|
|
649
|
-
return {
|
|
650
|
-
kind: "standard",
|
|
651
|
-
preserveOnActivation: false
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
if (params.sphereName === "Kether") {
|
|
655
|
-
return {
|
|
656
|
-
kind: "special",
|
|
657
|
-
specialSphereName: "Kether",
|
|
658
|
-
preserveOnActivation: true
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
if (params.sphereName === "Chokhmah") {
|
|
662
|
-
return {
|
|
663
|
-
kind: "special",
|
|
664
|
-
specialSphereName: "Chokhmah",
|
|
665
|
-
preserveOnActivation: true
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
if (params.sphereName === "Daath") {
|
|
669
|
-
return {
|
|
670
|
-
kind: "special",
|
|
671
|
-
specialSphereName: "Daath",
|
|
672
|
-
preserveOnActivation: true
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
if (params.sphereName === "Malkuth") {
|
|
676
|
-
return {
|
|
677
|
-
kind: "special",
|
|
678
|
-
specialSphereName: "Malkuth",
|
|
679
|
-
preserveOnActivation: true
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
return {
|
|
683
|
-
kind: "standard",
|
|
684
|
-
preserveOnActivation: false
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
function clamp01(value) {
|
|
688
|
-
return Math.max(0, Math.min(1, value));
|
|
689
|
-
}
|
|
690
|
-
function resolvePalette(palette) {
|
|
691
|
-
if (palette === void 0 || palette === "color") {
|
|
692
|
-
return {
|
|
693
|
-
mode: "color",
|
|
694
|
-
defaultSphereFill: "#888888",
|
|
695
|
-
defaultPathColor: "#888888",
|
|
696
|
-
sphereFills: {},
|
|
697
|
-
pathColors: {},
|
|
698
|
-
pathEdgeColor: "#888888",
|
|
699
|
-
pathEdgeUseFilter: true,
|
|
700
|
-
pathHighlightColor: "white",
|
|
701
|
-
pathHighlightOpacity: 0.25,
|
|
702
|
-
specialSphereMode: "preserve"
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
if (palette === "monochrome") {
|
|
706
|
-
return {
|
|
707
|
-
mode: "monochrome",
|
|
708
|
-
defaultSphereFill: "#e6ddd0",
|
|
709
|
-
defaultPathColor: "#e0d7ca",
|
|
710
|
-
sphereFills: {},
|
|
711
|
-
pathColors: {},
|
|
712
|
-
pathEdgeColor: "#2f271e",
|
|
713
|
-
pathEdgeUseFilter: false,
|
|
714
|
-
sphereStrokeColor: "#2f271e",
|
|
715
|
-
sphereStrokeWidth: 2.4,
|
|
716
|
-
pathHighlightColor: "white",
|
|
717
|
-
pathHighlightOpacity: 0.2,
|
|
718
|
-
specialSphereMode: "plain"
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
return {
|
|
722
|
-
mode: "custom",
|
|
723
|
-
defaultSphereFill: palette.defaultSphereFill ?? "#111111",
|
|
724
|
-
defaultPathColor: palette.defaultPathColor ?? "#111111",
|
|
725
|
-
sphereFills: palette.sphereFills ?? {},
|
|
726
|
-
pathColors: palette.pathColors ?? {},
|
|
727
|
-
pathEdgeColor: palette.pathEdgeColor ?? (palette.defaultPathColor ?? "#111111"),
|
|
728
|
-
pathEdgeUseFilter: false,
|
|
729
|
-
sphereStrokeColor: palette.sphereStrokeColor,
|
|
730
|
-
sphereStrokeWidth: palette.sphereStrokeWidth,
|
|
731
|
-
pathHighlightColor: palette.pathHighlightColor ?? "white",
|
|
732
|
-
pathHighlightOpacity: palette.pathHighlightOpacity ?? 0.18,
|
|
733
|
-
specialSphereMode: palette.specialSphereMode ?? "plain"
|
|
734
|
-
};
|
|
735
|
-
}
|
|
736
|
-
function resolveHighlights(highlights) {
|
|
737
|
-
return {
|
|
738
|
-
pathColors: highlights?.paths ?? {},
|
|
739
|
-
sphereFills: highlights?.spheres ?? {},
|
|
740
|
-
specialSphereMode: highlights?.specialSphereMode ?? "preserve"
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
function resolvePathEdgeColor(params) {
|
|
744
|
-
if (params.palette.mode === "color") {
|
|
745
|
-
return params.pathColor;
|
|
746
|
-
}
|
|
747
|
-
return params.palette.pathEdgeColor;
|
|
748
|
-
}
|
|
749
|
-
function resolveSphereFill(params) {
|
|
750
|
-
const override = params.palette.sphereFills[params.sphereId];
|
|
751
|
-
if (override) {
|
|
752
|
-
return override;
|
|
753
|
-
}
|
|
754
|
-
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
755
|
-
return params.palette.defaultSphereFill;
|
|
756
|
-
}
|
|
757
|
-
if (params.defaultColors.length > 0) {
|
|
758
|
-
return params.defaultColors;
|
|
759
|
-
}
|
|
760
|
-
return params.palette.defaultSphereFill;
|
|
761
|
-
}
|
|
762
|
-
function toPrimaryFill(fill, fallback) {
|
|
763
|
-
if (Array.isArray(fill)) {
|
|
764
|
-
return fill[0] ?? fallback;
|
|
765
|
-
}
|
|
766
|
-
return fill;
|
|
767
|
-
}
|
|
768
|
-
function resolveMalkuthColors(params) {
|
|
769
|
-
if (params.highlightFill) {
|
|
770
|
-
return expandColors(
|
|
771
|
-
params.highlightFill,
|
|
772
|
-
params.defaultColors.length,
|
|
773
|
-
params.defaultColors
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
if (Array.isArray(params.paletteFill)) {
|
|
777
|
-
return expandColors(
|
|
778
|
-
params.paletteFill,
|
|
779
|
-
params.defaultColors.length,
|
|
780
|
-
params.defaultColors
|
|
781
|
-
);
|
|
782
|
-
}
|
|
783
|
-
return params.defaultColors;
|
|
784
|
-
}
|
|
785
|
-
function expandColors(fill, count, fallbackColors) {
|
|
786
|
-
if (Array.isArray(fill)) {
|
|
787
|
-
if (fill.length === 0) {
|
|
788
|
-
return fallbackColors.slice(0, count);
|
|
789
|
-
}
|
|
790
|
-
return Array.from({ length: count }, (_, index) => {
|
|
791
|
-
return fill[index] ?? fill[fill.length - 1];
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
return Array.from({ length: count }, () => fill);
|
|
795
|
-
}
|
|
796
|
-
function round(value) {
|
|
797
|
-
return Math.round(value * 100) / 100;
|
|
798
|
-
}
|
|
799
|
-
function polarToCartesian(cx, cy, radius, degrees) {
|
|
800
|
-
const radians = Math.PI / 180 * degrees;
|
|
801
|
-
return {
|
|
802
|
-
x: round(cx + radius * Math.cos(radians)),
|
|
803
|
-
y: round(cy + radius * Math.sin(radians))
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
function arcPath(cx, cy, radius, startDegrees, endDegrees) {
|
|
807
|
-
const start = polarToCartesian(cx, cy, radius, startDegrees);
|
|
808
|
-
const end = polarToCartesian(cx, cy, radius, endDegrees);
|
|
809
|
-
const largeArc = endDegrees - startDegrees <= 180 ? 0 : 1;
|
|
810
|
-
return `M ${cx} ${cy} L ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
|
|
811
|
-
}
|
|
812
|
-
function renderKether(push, point, radius, baseFill = "#e0e0e0") {
|
|
813
|
-
push(
|
|
814
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr(baseFill)}"/>`
|
|
815
|
-
);
|
|
816
|
-
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
|
|
817
|
-
const spokes = 16;
|
|
818
|
-
const innerRadius = round(radius * 0.18);
|
|
819
|
-
const outerRadius = round(radius * 0.92);
|
|
820
|
-
const innerWidth = round(radius * 0.04);
|
|
821
|
-
const angleStep = 360 / spokes;
|
|
822
|
-
push(`<g opacity="0.85">`);
|
|
823
|
-
for (let index = 0; index < spokes; index++) {
|
|
824
|
-
const angle = index * angleStep;
|
|
825
|
-
push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
|
|
826
|
-
const x0 = round(point.x - innerWidth);
|
|
827
|
-
const y0 = round(point.y - innerRadius);
|
|
828
|
-
const x1 = point.x;
|
|
829
|
-
const y1 = round(point.y - outerRadius);
|
|
830
|
-
const x2 = round(point.x + innerWidth);
|
|
831
|
-
const y2 = round(point.y - innerRadius);
|
|
832
|
-
push(
|
|
833
|
-
`<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
|
|
834
|
-
);
|
|
835
|
-
push(`</g>`);
|
|
836
|
-
}
|
|
837
|
-
push(`</g>`);
|
|
838
|
-
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-rim)"/>`);
|
|
839
|
-
}
|
|
840
|
-
function renderSlicedSphere(push, point, radius, colors, startAngle) {
|
|
841
|
-
const segmentCount = colors.length;
|
|
842
|
-
const step = 360 / segmentCount;
|
|
843
|
-
let currentAngle = startAngle;
|
|
844
|
-
for (let index = 0; index < segmentCount; index++) {
|
|
845
|
-
const path = arcPath(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
|
|
846
|
-
push(`<path d="${path}" fill="${escapeAttr(colors[index])}" stroke="none"/>`);
|
|
847
|
-
currentAngle += step;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
function renderIridescent(push, point, radius) {
|
|
851
|
-
const stops = [
|
|
852
|
-
[0, "#F0E8EE"],
|
|
853
|
-
[0.1, "#ffa3e6"],
|
|
854
|
-
[0.22, "#a7e0ff"],
|
|
855
|
-
[0.34, "#baff9a"],
|
|
856
|
-
[0.46, "#ffe28a"],
|
|
857
|
-
[0.58, "#c6a4ff"],
|
|
858
|
-
[0.7, "#9ad6ff"],
|
|
859
|
-
[0.82, "#ffa3e6"],
|
|
860
|
-
[1, "#F0E8EE"]
|
|
861
|
-
];
|
|
862
|
-
const slices = 72;
|
|
863
|
-
const sphereRadius = round(radius * 0.96);
|
|
864
|
-
for (let index = 0; index < slices; index++) {
|
|
865
|
-
const t = index / slices;
|
|
866
|
-
const color = interpolateColorStops(stops, t);
|
|
867
|
-
const startDegrees = t * 360 - 90;
|
|
868
|
-
const endDegrees = startDegrees + 360 / slices + 0.5;
|
|
869
|
-
const path = arcPath(point.x, point.y, sphereRadius, startDegrees, endDegrees);
|
|
870
|
-
push(`<path d="${path}" fill="${color}" stroke="none"/>`);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
function interpolateColorStops(stops, t) {
|
|
874
|
-
let lower = stops[0];
|
|
875
|
-
let upper = stops[stops.length - 1];
|
|
876
|
-
for (let index = 0; index < stops.length - 1; index++) {
|
|
877
|
-
if (t >= stops[index][0] && t <= stops[index + 1][0]) {
|
|
878
|
-
lower = stops[index];
|
|
879
|
-
upper = stops[index + 1];
|
|
880
|
-
break;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
const range = upper[0] - lower[0] || 1;
|
|
884
|
-
return interpolateColor(lower[1], upper[1], (t - lower[0]) / range);
|
|
885
|
-
}
|
|
886
|
-
function interpolateColor(start, end, factor) {
|
|
887
|
-
const parse = (hex) => {
|
|
888
|
-
const match = hex.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
889
|
-
return match ? [
|
|
890
|
-
Number.parseInt(match[1], 16),
|
|
891
|
-
Number.parseInt(match[2], 16),
|
|
892
|
-
Number.parseInt(match[3], 16)
|
|
893
|
-
] : [0, 0, 0];
|
|
894
|
-
};
|
|
895
|
-
const [r1, g1, b1] = parse(start);
|
|
896
|
-
const [r2, g2, b2] = parse(end);
|
|
897
|
-
const mix = (left, right) => Math.round(left + (right - left) * factor);
|
|
898
|
-
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")}`;
|
|
899
|
-
}
|
|
900
|
-
function renderYinYang(push, point, radius, fill) {
|
|
901
|
-
const scale = radius / 50;
|
|
902
|
-
const circleRadius = round(48 * scale);
|
|
903
|
-
const halfRadius = round(24 * scale);
|
|
904
|
-
const dotRadius = round(6 * scale);
|
|
905
|
-
const [lightFill, darkFill] = resolveDualToneFill(fill);
|
|
906
|
-
push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
|
|
907
|
-
push(
|
|
908
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${escapeAttr(lightFill)}"/>`
|
|
909
|
-
);
|
|
910
|
-
push(
|
|
911
|
-
`<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="${escapeAttr(darkFill)}"/>`
|
|
912
|
-
);
|
|
913
|
-
push(
|
|
914
|
-
`<circle cx="${point.x}" cy="${round(point.y - halfRadius)}" r="${dotRadius}" fill="${escapeAttr(lightFill)}"/>`
|
|
915
|
-
);
|
|
916
|
-
push(
|
|
917
|
-
`<circle cx="${point.x}" cy="${round(point.y + halfRadius)}" r="${dotRadius}" fill="${escapeAttr(darkFill)}"/>`
|
|
918
|
-
);
|
|
919
|
-
push(`</g>`);
|
|
920
|
-
}
|
|
921
|
-
function renderSphereTintOverlay(push, point, radius, fill, opacity) {
|
|
922
|
-
push(
|
|
923
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr(toPrimaryFill(fill, "#ffffff"))}" fill-opacity="${opacity}"/>`
|
|
924
|
-
);
|
|
925
|
-
}
|
|
926
|
-
function resolveDualToneFill(fill) {
|
|
927
|
-
if (Array.isArray(fill)) {
|
|
928
|
-
return [fill[0] ?? "white", fill[1] ?? "black"];
|
|
929
|
-
}
|
|
930
|
-
if (fill) {
|
|
931
|
-
return [fill, "black"];
|
|
932
|
-
}
|
|
933
|
-
return ["white", "black"];
|
|
934
|
-
}
|
|
935
|
-
function escapeAttr(value) {
|
|
936
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
exports.TREE_PATH_IDS = TREE_PATH_IDS;
|
|
940
|
-
exports.TREE_SPHERE_IDS = TREE_SPHERE_IDS;
|
|
941
|
-
exports.TREE_SPHERE_NAMES = TREE_SPHERE_NAMES;
|
|
942
|
-
exports.TREE_SVG_DEFAULT_VIEWBOX = TREE_SVG_DEFAULT_VIEWBOX;
|
|
943
|
-
exports.generateTreeSvg = generateTreeSvg;
|
|
944
|
-
exports.getTreeLayout = getTreeLayout;
|
|
945
|
-
exports.getTreeRenderModel = getTreeRenderModel;
|
|
946
|
-
//# sourceMappingURL=chunk-SW5O2BJI.js.map
|
|
947
|
-
//# sourceMappingURL=chunk-SW5O2BJI.js.map
|