kaabalah 6.4.3 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2WCC2KCJ.js +76 -0
- package/dist/chunk-2WCC2KCJ.js.map +1 -0
- package/dist/{chunk-EVH4J5E2.mjs → chunk-BKNWKD32.mjs} +364 -23
- package/dist/chunk-BKNWKD32.mjs.map +1 -0
- package/dist/{chunk-EMTVK46M.js → chunk-SW5O2BJI.js} +364 -22
- package/dist/chunk-SW5O2BJI.js.map +1 -0
- package/dist/chunk-URDMOQRN.mjs +74 -0
- package/dist/chunk-URDMOQRN.mjs.map +1 -0
- package/dist/cli.js +574 -42
- package/dist/cli.js.map +1 -1
- package/dist/ifa/index.js +2 -2
- package/dist/ifa/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -9
- package/dist/index.mjs +2 -2
- package/dist/visual/index.d.mts +116 -1
- package/dist/visual/index.d.ts +116 -1
- package/dist/visual/index.js +11 -7
- package/dist/visual/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3WVZRLPG.js +0 -52
- package/dist/chunk-3WVZRLPG.js.map +0 -1
- package/dist/chunk-EMTVK46M.js.map +0 -1
- package/dist/chunk-EVH4J5E2.mjs.map +0 -1
- package/dist/chunk-YTZCZRJG.mjs +0 -50
- package/dist/chunk-YTZCZRJG.mjs.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/ifa/index.ts
|
|
4
|
+
function isMidnight(date, mode) {
|
|
5
|
+
if (mode === "utc") {
|
|
6
|
+
return date.getUTCHours() === 0 && date.getUTCMinutes() === 0 && date.getUTCSeconds() === 0 && date.getUTCMilliseconds() === 0;
|
|
7
|
+
}
|
|
8
|
+
return date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0 && date.getMilliseconds() === 0;
|
|
9
|
+
}
|
|
10
|
+
function extractDateParts(date) {
|
|
11
|
+
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
12
|
+
throw new Error("Date must be a valid Date object");
|
|
13
|
+
}
|
|
14
|
+
const useLocalDate = isMidnight(date, "local") && !isMidnight(date, "utc");
|
|
15
|
+
if (useLocalDate) {
|
|
16
|
+
return {
|
|
17
|
+
day: date.getDate().toString().padStart(2, "0"),
|
|
18
|
+
month: (date.getMonth() + 1).toString().padStart(2, "0"),
|
|
19
|
+
year: date.getFullYear().toString().padStart(4, "0")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const formattedDate = date.toISOString().split("T")[0];
|
|
23
|
+
const [year, month, day] = formattedDate.split("-");
|
|
24
|
+
return { day, month, year };
|
|
25
|
+
}
|
|
26
|
+
function reduceNumber(num) {
|
|
27
|
+
if (num <= 16) {
|
|
28
|
+
return num;
|
|
29
|
+
}
|
|
30
|
+
return reduceNumber(
|
|
31
|
+
num.toString().split("").reduce((sum, digit) => sum + Number.parseInt(digit, 10), 0)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function calculateOdu(date) {
|
|
35
|
+
const { day, month, year } = extractDateParts(date);
|
|
36
|
+
const leftNumbers = [
|
|
37
|
+
Number.parseInt(day[0], 10),
|
|
38
|
+
// First digit of day
|
|
39
|
+
Number.parseInt(month[0], 10),
|
|
40
|
+
// First digit of month
|
|
41
|
+
Number.parseInt(year[0], 10),
|
|
42
|
+
// First digit of year
|
|
43
|
+
Number.parseInt(year[2], 10)
|
|
44
|
+
// Third digit of year
|
|
45
|
+
];
|
|
46
|
+
const rightNumbers = [
|
|
47
|
+
Number.parseInt(day[1], 10),
|
|
48
|
+
// Second digit of day
|
|
49
|
+
Number.parseInt(month[1], 10),
|
|
50
|
+
// Second digit of month
|
|
51
|
+
Number.parseInt(year[1], 10),
|
|
52
|
+
// Second digit of year
|
|
53
|
+
Number.parseInt(year[3], 10)
|
|
54
|
+
// Fourth digit of year
|
|
55
|
+
];
|
|
56
|
+
const rawLeftSum = leftNumbers.reduce((a, b) => a + b, 0);
|
|
57
|
+
const rawRightSum = rightNumbers.reduce((a, b) => a + b, 0);
|
|
58
|
+
const north = reduceNumber(rawLeftSum);
|
|
59
|
+
const south = reduceNumber(rawRightSum);
|
|
60
|
+
const east = reduceNumber(north + south);
|
|
61
|
+
const west = reduceNumber(north + south + east);
|
|
62
|
+
const center = reduceNumber(north + south + east + west);
|
|
63
|
+
return {
|
|
64
|
+
leftNumbers,
|
|
65
|
+
rightNumbers,
|
|
66
|
+
north,
|
|
67
|
+
south,
|
|
68
|
+
east,
|
|
69
|
+
west,
|
|
70
|
+
center
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.calculateOdu = calculateOdu;
|
|
75
|
+
//# sourceMappingURL=chunk-2WCC2KCJ.js.map
|
|
76
|
+
//# sourceMappingURL=chunk-2WCC2KCJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ifa/index.ts"],"names":[],"mappings":";;;AAWA,SAAS,UAAA,CAAW,MAAY,IAAgC,EAAA;AAC9D,EAAA,IAAI,SAAS,KAAO,EAAA;AAClB,IAAA,OACE,IAAK,CAAA,WAAA,EAAkB,KAAA,CAAA,IACvB,KAAK,aAAc,EAAA,KAAM,CACzB,IAAA,IAAA,CAAK,aAAc,EAAA,KAAM,CACzB,IAAA,IAAA,CAAK,oBAAyB,KAAA,CAAA;AAAA;AAIlC,EAAA,OACE,IAAK,CAAA,QAAA,EAAe,KAAA,CAAA,IACpB,KAAK,UAAW,EAAA,KAAM,CACtB,IAAA,IAAA,CAAK,UAAW,EAAA,KAAM,CACtB,IAAA,IAAA,CAAK,iBAAsB,KAAA,CAAA;AAE/B;AAEA,SAAS,iBAAiB,IAA0D,EAAA;AAClF,EAAI,IAAA,EAAE,gBAAgB,IAAS,CAAA,IAAA,MAAA,CAAO,MAAM,IAAK,CAAA,OAAA,EAAS,CAAG,EAAA;A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A,YAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-2WCC2KCJ.js","sourcesContent":["\nexport type OduNumbers = {\n leftNumbers: number[],\n rightNumbers: number[],\n north: number,\n south: number,\n east: number,\n west: number,\n center: number\n}\n\nfunction isMidnight(date: Date, mode: \"local\" | \"utc\"): boolean {\n if (mode === \"utc\") {\n return (\n date.getUTCHours() === 0 &&\n date.getUTCMinutes() === 0 &&\n date.getUTCSeconds() === 0 &&\n date.getUTCMilliseconds() === 0\n );\n }\n\n return (\n date.getHours() === 0 &&\n date.getMinutes() === 0 &&\n date.getSeconds() === 0 &&\n date.getMilliseconds() === 0\n );\n}\n\nfunction extractDateParts(date: Date): { day: string; month: string; year: string } {\n if (!(date instanceof Date) || Number.isNaN(date.getTime())) {\n throw new Error(\"Date must be a valid Date object\");\n }\n\n const useLocalDate = isMidnight(date, \"local\") && !isMidnight(date, \"utc\");\n\n if (useLocalDate) {\n return {\n day: date.getDate().toString().padStart(2, \"0\"),\n month: (date.getMonth() + 1).toString().padStart(2, \"0\"),\n year: date.getFullYear().toString().padStart(4, \"0\"),\n };\n }\n\n const formattedDate = date.toISOString().split(\"T\")[0];\n const [year, month, day] = formattedDate.split(\"-\");\n\n return { day, month, year };\n}\n\nfunction reduceNumber(num: number): number {\n if (num <= 16) {\n return num;\n }\n\n return reduceNumber(\n num\n .toString()\n .split(\"\")\n .reduce((sum, digit) => sum + Number.parseInt(digit, 10), 0)\n );\n}\n\n/**\n * Calculate the Odu numbers based on a date\n * @param date - Date object\n * @returns Odu numbers\n */\nexport function calculateOdu(date: Date): OduNumbers {\n const { day, month, year } = extractDateParts(date);\n\n // Split into left and right columns\n const leftNumbers = [\n Number.parseInt(day[0], 10), // First digit of day\n Number.parseInt(month[0], 10), // First digit of month\n Number.parseInt(year[0], 10), // First digit of year\n Number.parseInt(year[2], 10) // Third digit of year\n ];\n\n const rightNumbers = [\n Number.parseInt(day[1], 10), // Second digit of day\n Number.parseInt(month[1], 10), // Second digit of month\n Number.parseInt(year[1], 10), // Second digit of year\n Number.parseInt(year[3], 10) // Fourth digit of year\n ];\n\n // Calculate initial sums\n const rawLeftSum = leftNumbers.reduce((a, b) => a + b, 0);\n const rawRightSum = rightNumbers.reduce((a, b) => a + b, 0);\n\n // Calculate and reduce each direction\n const north = reduceNumber(rawLeftSum);\n const south = reduceNumber(rawRightSum);\n const east = reduceNumber(north + south);\n const west = reduceNumber(north + south + east);\n const center = reduceNumber(north + south + east + west);\n\n return {\n leftNumbers,\n rightNumbers,\n north,\n south,\n east,\n west,\n center\n };\n}\n"]}
|
|
@@ -36,6 +36,9 @@ var DEFAULT_SPHERE_RADIUS = 30;
|
|
|
36
36
|
var DEFAULT_PATH_EDGE_WIDTH = 26;
|
|
37
37
|
var DEFAULT_PATH_MAIN_WIDTH = 22;
|
|
38
38
|
var DEFAULT_PATH_HIGHLIGHT_WIDTH = 8;
|
|
39
|
+
var DEFAULT_SPHERE_HIT_RADIUS = DEFAULT_SPHERE_RADIUS + 8;
|
|
40
|
+
var DEFAULT_PATH_HIT_STROKE_WIDTH = DEFAULT_PATH_EDGE_WIDTH + 8;
|
|
41
|
+
var MUTED_TARGET_COLOR = "#AAA";
|
|
39
42
|
var sphereId = (name) => id("sphere" /* SPHERE */, name);
|
|
40
43
|
var pathId = (pathNumber) => id("path" /* PATH */, String(pathNumber));
|
|
41
44
|
var TREE_SPHERE_IDS = TREE_SPHERE_NAMES.map(
|
|
@@ -73,6 +76,155 @@ function getTreeLayout(system = "kaabalah") {
|
|
|
73
76
|
viewBoxUnits
|
|
74
77
|
};
|
|
75
78
|
}
|
|
79
|
+
function getTreeRenderModel(options = {}) {
|
|
80
|
+
const system = options.system ?? "kaabalah";
|
|
81
|
+
const tree = createTree({ system, parts: ["colors"] });
|
|
82
|
+
const viewBox = normalizeViewBox(options.viewBox);
|
|
83
|
+
const palette = resolvePalette(options.palette);
|
|
84
|
+
const highlights = resolveHighlights(options.highlights);
|
|
85
|
+
const activationMap = resolveActivationMap(options.activations);
|
|
86
|
+
const layout = getTreeLayout(system);
|
|
87
|
+
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
88
|
+
const viewBoxLayout = buildLayoutMap(tree, spherePositions);
|
|
89
|
+
const scale = Math.min(
|
|
90
|
+
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
91
|
+
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
92
|
+
);
|
|
93
|
+
const radius = round(DEFAULT_SPHERE_RADIUS * scale);
|
|
94
|
+
const pathEdgeWidth = round(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
95
|
+
const pathMainWidth = round(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
96
|
+
const pathHighlightWidth = round(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
97
|
+
const sphereHitRadius = round(DEFAULT_SPHERE_HIT_RADIUS * scale);
|
|
98
|
+
const pathHitStrokeWidth = round(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
|
|
99
|
+
const layers = [
|
|
100
|
+
{ name: "background", order: 0, description: "Background rectangle when requested." },
|
|
101
|
+
...options.daathLayer === "back" ? [{ name: "spheres-behind-paths", order: 1, description: "Daath behind the paths." }] : [],
|
|
102
|
+
{ name: "paths", order: options.daathLayer === "back" ? 2 : 1, description: "Canonical paths and activation emphasis." },
|
|
103
|
+
{ name: "spheres", order: options.daathLayer === "back" ? 3 : 2, description: "Canonical sphere material and activation halos." },
|
|
104
|
+
{ name: "hit-targets", order: options.daathLayer === "back" ? 4 : 3, description: "Invisible anchors for interaction." }
|
|
105
|
+
];
|
|
106
|
+
const layerOrder = layers.map((layer) => layer.name);
|
|
107
|
+
const spheres = TREE_SPHERE_NAMES.map((sphereName) => {
|
|
108
|
+
const sphereIdValue = sphereId(sphereName);
|
|
109
|
+
const canonicalColor = resolveSphereCanonicalColor({
|
|
110
|
+
palette,
|
|
111
|
+
sphereId: sphereIdValue,
|
|
112
|
+
tree
|
|
113
|
+
});
|
|
114
|
+
const point = spherePositions[sphereIdValue];
|
|
115
|
+
const activation = resolveTargetActivation({
|
|
116
|
+
activation: activationMap.get(sphereIdValue),
|
|
117
|
+
canonicalColor
|
|
118
|
+
});
|
|
119
|
+
const activeFill = resolveSphereDisplayFill({
|
|
120
|
+
palette,
|
|
121
|
+
highlights,
|
|
122
|
+
sphereId: sphereIdValue,
|
|
123
|
+
canonicalColor,
|
|
124
|
+
activation
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
id: sphereIdValue,
|
|
128
|
+
name: sphereName,
|
|
129
|
+
slug: sphereName.toLowerCase(),
|
|
130
|
+
canonicalColor,
|
|
131
|
+
geometry: {
|
|
132
|
+
percentages: {
|
|
133
|
+
center: { ...layout.percentages.spheres[sphereIdValue] },
|
|
134
|
+
anchor: getPercentageAnchor(layout.percentages.spheres[sphereIdValue])
|
|
135
|
+
},
|
|
136
|
+
viewBoxUnits: {
|
|
137
|
+
center: { ...point },
|
|
138
|
+
anchor: getViewBoxAnchor(point, viewBox),
|
|
139
|
+
hitTarget: {
|
|
140
|
+
kind: "circle",
|
|
141
|
+
cx: point.x,
|
|
142
|
+
cy: point.y,
|
|
143
|
+
r: sphereHitRadius
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
radius: {
|
|
147
|
+
viewBoxUnits: radius
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
material: getSphereMaterial({
|
|
151
|
+
sphereName,
|
|
152
|
+
preserveSpecialMaterial: shouldPreserveSpecialRenderer({
|
|
153
|
+
palette,
|
|
154
|
+
highlights,
|
|
155
|
+
hasPaintOverride: activation !== null || highlights.sphereFills[sphereIdValue] !== void 0,
|
|
156
|
+
activation
|
|
157
|
+
})
|
|
158
|
+
}),
|
|
159
|
+
activation,
|
|
160
|
+
displayFill: activeFill
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
const paths = TREE_PATH_IDS.map((pathIdValue) => {
|
|
164
|
+
const canonicalColor = resolvePathCanonicalColor({
|
|
165
|
+
palette,
|
|
166
|
+
tree,
|
|
167
|
+
pathId: pathIdValue
|
|
168
|
+
});
|
|
169
|
+
const path = viewBoxLayout.paths[pathIdValue];
|
|
170
|
+
const activation = resolveTargetActivation({
|
|
171
|
+
activation: activationMap.get(pathIdValue),
|
|
172
|
+
canonicalColor
|
|
173
|
+
});
|
|
174
|
+
const displayColor = activation ? resolvePathDisplayColor({
|
|
175
|
+
canonicalColor,
|
|
176
|
+
activation
|
|
177
|
+
}) : resolvePathBaseColor({
|
|
178
|
+
canonicalColor,
|
|
179
|
+
highlights,
|
|
180
|
+
pathId: pathIdValue
|
|
181
|
+
});
|
|
182
|
+
return {
|
|
183
|
+
id: pathIdValue,
|
|
184
|
+
canonicalColor,
|
|
185
|
+
geometry: {
|
|
186
|
+
percentages: {
|
|
187
|
+
from: { ...layout.percentages.paths[pathIdValue].from },
|
|
188
|
+
to: { ...layout.percentages.paths[pathIdValue].to },
|
|
189
|
+
anchor: getPercentagePathAnchor(layout.percentages.paths[pathIdValue])
|
|
190
|
+
},
|
|
191
|
+
viewBoxUnits: {
|
|
192
|
+
from: { ...path.from },
|
|
193
|
+
to: { ...path.to },
|
|
194
|
+
anchor: getViewBoxPathAnchor(path, viewBox),
|
|
195
|
+
hitTarget: {
|
|
196
|
+
kind: "line",
|
|
197
|
+
x1: path.from.x,
|
|
198
|
+
y1: path.from.y,
|
|
199
|
+
x2: path.to.x,
|
|
200
|
+
y2: path.to.y,
|
|
201
|
+
strokeWidth: pathHitStrokeWidth
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
widths: {
|
|
205
|
+
edge: pathEdgeWidth,
|
|
206
|
+
main: pathMainWidth,
|
|
207
|
+
highlight: pathHighlightWidth,
|
|
208
|
+
hitTarget: pathHitStrokeWidth
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
activation,
|
|
212
|
+
displayColor
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
return {
|
|
216
|
+
system,
|
|
217
|
+
viewBox,
|
|
218
|
+
scale,
|
|
219
|
+
layout,
|
|
220
|
+
layerOrder,
|
|
221
|
+
layers,
|
|
222
|
+
spheres,
|
|
223
|
+
paths,
|
|
224
|
+
sphereById: Object.fromEntries(spheres.map((entry) => [entry.id, entry])),
|
|
225
|
+
pathById: Object.fromEntries(paths.map((entry) => [entry.id, entry]))
|
|
226
|
+
};
|
|
227
|
+
}
|
|
76
228
|
function generateTreeSvg(options = {}) {
|
|
77
229
|
const system = options.system ?? "kaabalah";
|
|
78
230
|
const daathLayer = options.daathLayer ?? "front";
|
|
@@ -80,6 +232,7 @@ function generateTreeSvg(options = {}) {
|
|
|
80
232
|
const viewBox = normalizeViewBox(options.viewBox);
|
|
81
233
|
const palette = resolvePalette(options.palette);
|
|
82
234
|
const highlights = resolveHighlights(options.highlights);
|
|
235
|
+
const activationMap = resolveActivationMap(options.activations);
|
|
83
236
|
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
84
237
|
const layout = buildLayoutMap(tree, spherePositions);
|
|
85
238
|
const scale = Math.min(
|
|
@@ -157,6 +310,14 @@ function generateTreeSvg(options = {}) {
|
|
|
157
310
|
push(`<g id="spheres-behind-paths">`);
|
|
158
311
|
renderSphere(push, {
|
|
159
312
|
highlights,
|
|
313
|
+
activation: resolveTargetActivation({
|
|
314
|
+
activation: activationMap.get(sphereId("Daath")),
|
|
315
|
+
canonicalColor: resolveSphereCanonicalColor({
|
|
316
|
+
palette,
|
|
317
|
+
sphereId: sphereId("Daath"),
|
|
318
|
+
tree
|
|
319
|
+
})
|
|
320
|
+
}),
|
|
160
321
|
tree,
|
|
161
322
|
palette,
|
|
162
323
|
radius,
|
|
@@ -169,12 +330,24 @@ function generateTreeSvg(options = {}) {
|
|
|
169
330
|
push(`<g id="paths">`);
|
|
170
331
|
for (const currentPathId of TREE_PATH_IDS) {
|
|
171
332
|
const path = layout.paths[currentPathId];
|
|
172
|
-
const
|
|
173
|
-
highlights,
|
|
333
|
+
const canonicalColor = resolvePathCanonicalColor({
|
|
174
334
|
palette,
|
|
175
335
|
tree,
|
|
176
336
|
pathId: currentPathId
|
|
177
337
|
});
|
|
338
|
+
const baseColor = resolvePathBaseColor({
|
|
339
|
+
canonicalColor,
|
|
340
|
+
highlights,
|
|
341
|
+
pathId: currentPathId
|
|
342
|
+
});
|
|
343
|
+
const activation = resolveTargetActivation({
|
|
344
|
+
activation: activationMap.get(currentPathId),
|
|
345
|
+
canonicalColor
|
|
346
|
+
});
|
|
347
|
+
const color = activation ? resolvePathDisplayColor({
|
|
348
|
+
canonicalColor,
|
|
349
|
+
activation
|
|
350
|
+
}) : baseColor;
|
|
178
351
|
const edgeColor = resolvePathEdgeColor({
|
|
179
352
|
palette,
|
|
180
353
|
pathColor: color
|
|
@@ -182,6 +355,11 @@ function generateTreeSvg(options = {}) {
|
|
|
182
355
|
push(
|
|
183
356
|
`<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)"` : ""}/>`
|
|
184
357
|
);
|
|
358
|
+
if (activation?.visible && activation.emphasis > 0) {
|
|
359
|
+
push(
|
|
360
|
+
`<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"/>`
|
|
361
|
+
);
|
|
362
|
+
}
|
|
185
363
|
push(
|
|
186
364
|
`<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"/>`
|
|
187
365
|
);
|
|
@@ -193,8 +371,18 @@ function generateTreeSvg(options = {}) {
|
|
|
193
371
|
const frontSphereNames = daathLayer === "back" ? TREE_SPHERE_NAMES.filter((name) => name !== "Daath") : TREE_SPHERE_NAMES;
|
|
194
372
|
push(`<g id="spheres">`);
|
|
195
373
|
for (const sphereName of frontSphereNames) {
|
|
374
|
+
const currentSphereId = sphereId(sphereName);
|
|
375
|
+
const canonicalColor = resolveSphereCanonicalColor({
|
|
376
|
+
palette,
|
|
377
|
+
sphereId: currentSphereId,
|
|
378
|
+
tree
|
|
379
|
+
});
|
|
196
380
|
renderSphere(push, {
|
|
197
381
|
highlights,
|
|
382
|
+
activation: resolveTargetActivation({
|
|
383
|
+
activation: activationMap.get(currentSphereId),
|
|
384
|
+
canonicalColor
|
|
385
|
+
}),
|
|
198
386
|
tree,
|
|
199
387
|
palette,
|
|
200
388
|
radius,
|
|
@@ -223,9 +411,23 @@ function renderSphere(push, params) {
|
|
|
223
411
|
sphereId: currentSphereId,
|
|
224
412
|
defaultColors: colorData
|
|
225
413
|
});
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const
|
|
414
|
+
const activationFill = params.activation && (params.activation.state === "inactive" || params.activation.colorOverride) ? params.activation.displayColor : void 0;
|
|
415
|
+
const highlightFill = activationFill ?? params.highlights.sphereFills[currentSphereId];
|
|
416
|
+
const activeFill = params.activation ? params.activation.displayColor : highlightFill ?? sphereFill;
|
|
417
|
+
const preserveSpecialRenderer = shouldPreserveSpecialRenderer({
|
|
418
|
+
palette: params.palette,
|
|
419
|
+
highlights: params.highlights,
|
|
420
|
+
hasPaintOverride: highlightFill !== void 0,
|
|
421
|
+
activation: params.activation
|
|
422
|
+
});
|
|
423
|
+
if (params.activation?.visible && params.activation.emphasis > 0) {
|
|
424
|
+
const haloStrokeWidth = round(3.2 + params.activation.emphasis * 4.8);
|
|
425
|
+
const haloRadius = round(params.radius + haloStrokeWidth / 2 + 0.7);
|
|
426
|
+
const haloColor = params.activation.displayColor;
|
|
427
|
+
push(
|
|
428
|
+
`<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}"/>`
|
|
429
|
+
);
|
|
430
|
+
}
|
|
229
431
|
push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
|
|
230
432
|
if (preserveSpecialRenderer) {
|
|
231
433
|
if (params.sphereName === "Kether") {
|
|
@@ -329,6 +531,160 @@ function normalizeViewBox(viewBox) {
|
|
|
329
531
|
height: viewBox?.height ?? TREE_SVG_DEFAULT_VIEWBOX.height
|
|
330
532
|
};
|
|
331
533
|
}
|
|
534
|
+
function resolveActivationMap(activations) {
|
|
535
|
+
const map = /* @__PURE__ */ new Map();
|
|
536
|
+
for (const activation of activations ?? []) {
|
|
537
|
+
map.set(activation.targetId, activation);
|
|
538
|
+
}
|
|
539
|
+
return map;
|
|
540
|
+
}
|
|
541
|
+
function resolveTargetActivation(params) {
|
|
542
|
+
if (!params.activation) {
|
|
543
|
+
return null;
|
|
544
|
+
}
|
|
545
|
+
const state = params.activation.state ?? (params.activation.count > 0 ? "active" : "inactive");
|
|
546
|
+
const strength = clamp01(
|
|
547
|
+
params.activation.strength ?? (params.activation.total > 0 ? params.activation.count / params.activation.total : 0)
|
|
548
|
+
);
|
|
549
|
+
const displayColor = state === "inactive" ? params.activation.color ?? MUTED_TARGET_COLOR : params.activation.color ?? params.canonicalColor;
|
|
550
|
+
return {
|
|
551
|
+
state,
|
|
552
|
+
count: params.activation.count,
|
|
553
|
+
total: params.activation.total,
|
|
554
|
+
strength,
|
|
555
|
+
canonicalColor: params.canonicalColor,
|
|
556
|
+
displayColor,
|
|
557
|
+
colorOverride: params.activation.color,
|
|
558
|
+
mutedColor: MUTED_TARGET_COLOR,
|
|
559
|
+
visible: state !== "inactive",
|
|
560
|
+
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
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
function resolveSphereCanonicalColor(params) {
|
|
564
|
+
const override = params.palette.sphereFills[params.sphereId];
|
|
565
|
+
if (override) {
|
|
566
|
+
return toPrimaryFill(override, params.palette.defaultSphereFill);
|
|
567
|
+
}
|
|
568
|
+
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
569
|
+
return params.palette.defaultSphereFill;
|
|
570
|
+
}
|
|
571
|
+
const treeColor = params.tree.relatedFirst(params.sphereId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
|
|
572
|
+
return treeColor ?? params.palette.defaultSphereFill;
|
|
573
|
+
}
|
|
574
|
+
function resolvePathCanonicalColor(params) {
|
|
575
|
+
const override = params.palette.pathColors[params.pathId];
|
|
576
|
+
if (override) {
|
|
577
|
+
return override;
|
|
578
|
+
}
|
|
579
|
+
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
580
|
+
return params.palette.defaultPathColor;
|
|
581
|
+
}
|
|
582
|
+
const treeColor = params.tree.relatedFirst(params.pathId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
|
|
583
|
+
return treeColor ?? params.palette.defaultPathColor;
|
|
584
|
+
}
|
|
585
|
+
function resolvePathBaseColor(params) {
|
|
586
|
+
const highlightOverride = params.highlights.pathColors[params.pathId];
|
|
587
|
+
if (highlightOverride) {
|
|
588
|
+
return highlightOverride;
|
|
589
|
+
}
|
|
590
|
+
return params.canonicalColor;
|
|
591
|
+
}
|
|
592
|
+
function resolveSphereDisplayFill(params) {
|
|
593
|
+
const highlightOverride = params.highlights.sphereFills[params.sphereId];
|
|
594
|
+
const fallbackFill = Array.isArray(params.canonicalColor) ? params.canonicalColor[0] ?? params.palette.defaultSphereFill : params.canonicalColor;
|
|
595
|
+
if (params.activation) {
|
|
596
|
+
if (params.activation.state !== "inactive" && !params.activation.colorOverride) {
|
|
597
|
+
return params.canonicalColor ?? fallbackFill;
|
|
598
|
+
}
|
|
599
|
+
return params.activation.displayColor;
|
|
600
|
+
}
|
|
601
|
+
if (highlightOverride) {
|
|
602
|
+
return highlightOverride;
|
|
603
|
+
}
|
|
604
|
+
return params.canonicalColor ?? fallbackFill;
|
|
605
|
+
}
|
|
606
|
+
function resolvePathDisplayColor(params) {
|
|
607
|
+
if (!params.activation) {
|
|
608
|
+
return params.canonicalColor;
|
|
609
|
+
}
|
|
610
|
+
return params.activation.displayColor;
|
|
611
|
+
}
|
|
612
|
+
function getPercentageAnchor(point) {
|
|
613
|
+
return {
|
|
614
|
+
x: point.x,
|
|
615
|
+
y: point.y,
|
|
616
|
+
vertical: point.y < 18 ? "below" : "above"
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function getViewBoxAnchor(point, viewBox) {
|
|
620
|
+
return {
|
|
621
|
+
x: point.x,
|
|
622
|
+
y: point.y,
|
|
623
|
+
vertical: point.y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
function getPercentagePathAnchor(path) {
|
|
627
|
+
const y = round((path.from.y + path.to.y) / 2);
|
|
628
|
+
return {
|
|
629
|
+
x: round((path.from.x + path.to.x) / 2),
|
|
630
|
+
y,
|
|
631
|
+
vertical: y < 18 ? "below" : "above"
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
function getViewBoxPathAnchor(path, viewBox) {
|
|
635
|
+
const y = round((path.from.y + path.to.y) / 2);
|
|
636
|
+
return {
|
|
637
|
+
x: round((path.from.x + path.to.x) / 2),
|
|
638
|
+
y,
|
|
639
|
+
vertical: y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function shouldPreserveSpecialRenderer(params) {
|
|
643
|
+
return params.palette.specialSphereMode === "preserve" && (params.activation !== null || !params.hasPaintOverride || params.highlights.specialSphereMode === "preserve");
|
|
644
|
+
}
|
|
645
|
+
function getSphereMaterial(params) {
|
|
646
|
+
if (!params.preserveSpecialMaterial) {
|
|
647
|
+
return {
|
|
648
|
+
kind: "standard",
|
|
649
|
+
preserveOnActivation: false
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
if (params.sphereName === "Kether") {
|
|
653
|
+
return {
|
|
654
|
+
kind: "special",
|
|
655
|
+
specialSphereName: "Kether",
|
|
656
|
+
preserveOnActivation: true
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
if (params.sphereName === "Chokhmah") {
|
|
660
|
+
return {
|
|
661
|
+
kind: "special",
|
|
662
|
+
specialSphereName: "Chokhmah",
|
|
663
|
+
preserveOnActivation: true
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
if (params.sphereName === "Daath") {
|
|
667
|
+
return {
|
|
668
|
+
kind: "special",
|
|
669
|
+
specialSphereName: "Daath",
|
|
670
|
+
preserveOnActivation: true
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
if (params.sphereName === "Malkuth") {
|
|
674
|
+
return {
|
|
675
|
+
kind: "special",
|
|
676
|
+
specialSphereName: "Malkuth",
|
|
677
|
+
preserveOnActivation: true
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
return {
|
|
681
|
+
kind: "standard",
|
|
682
|
+
preserveOnActivation: false
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function clamp01(value) {
|
|
686
|
+
return Math.max(0, Math.min(1, value));
|
|
687
|
+
}
|
|
332
688
|
function resolvePalette(palette) {
|
|
333
689
|
if (palette === void 0 || palette === "color") {
|
|
334
690
|
return {
|
|
@@ -382,21 +738,6 @@ function resolveHighlights(highlights) {
|
|
|
382
738
|
specialSphereMode: highlights?.specialSphereMode ?? "preserve"
|
|
383
739
|
};
|
|
384
740
|
}
|
|
385
|
-
function resolvePathColor(params) {
|
|
386
|
-
const highlightOverride = params.highlights.pathColors[params.pathId];
|
|
387
|
-
if (highlightOverride) {
|
|
388
|
-
return highlightOverride;
|
|
389
|
-
}
|
|
390
|
-
const override = params.palette.pathColors[params.pathId];
|
|
391
|
-
if (override) {
|
|
392
|
-
return override;
|
|
393
|
-
}
|
|
394
|
-
if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
|
|
395
|
-
return params.palette.defaultPathColor;
|
|
396
|
-
}
|
|
397
|
-
const treeColor = params.tree.relatedFirst(params.pathId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
|
|
398
|
-
return treeColor ?? params.palette.defaultPathColor;
|
|
399
|
-
}
|
|
400
741
|
function resolvePathEdgeColor(params) {
|
|
401
742
|
if (params.palette.mode === "color") {
|
|
402
743
|
return params.pathColor;
|
|
@@ -593,6 +934,6 @@ function escapeAttr(value) {
|
|
|
593
934
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
594
935
|
}
|
|
595
936
|
|
|
596
|
-
export { TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, generateTreeSvg, getTreeLayout };
|
|
597
|
-
//# sourceMappingURL=chunk-
|
|
598
|
-
//# sourceMappingURL=chunk-
|
|
937
|
+
export { TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, generateTreeSvg, getTreeLayout, getTreeRenderModel };
|
|
938
|
+
//# sourceMappingURL=chunk-BKNWKD32.mjs.map
|
|
939
|
+
//# sourceMappingURL=chunk-BKNWKD32.mjs.map
|