kaabalah 6.11.0 → 6.12.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.
@@ -1,5 +1,5 @@
1
1
  import { TREE_TOPOLOGY_SPHERE_NAMES, TREE_TOPOLOGY_SPHERE_IDS, TREE_TOPOLOGY_PATH_IDS } from './chunk-X5HGLMEF.mjs';
2
- import { id, createTree } from './chunk-NOZKIUGP.mjs';
2
+ import { id, createTree, parseId } from './chunk-NOZKIUGP.mjs';
3
3
 
4
4
  // src/visual/archeometer.ts
5
5
  var TAU = Math.PI * 2;
@@ -2916,6 +2916,15 @@ function textFontFamily2() {
2916
2916
  }
2917
2917
 
2918
2918
  // src/visual/tree.ts
2919
+ var TREE_SVG_SUPPORTED_SYSTEM = "kaabalah";
2920
+ function getUnsupportedTreeSvgSystemMessage(system) {
2921
+ return `tree:svg is only supported for the Melkitzedeki system ('${TREE_SVG_SUPPORTED_SYSTEM}'); received '${system}'.`;
2922
+ }
2923
+ function assertTreeSvgSupportedSystem(system) {
2924
+ if (system !== TREE_SVG_SUPPORTED_SYSTEM) {
2925
+ throw new Error(getUnsupportedTreeSvgSystemMessage(system));
2926
+ }
2927
+ }
2919
2928
  var TREE_SVG_DEFAULT_VIEWBOX = {
2920
2929
  minX: 0,
2921
2930
  minY: 0,
@@ -2943,7 +2952,42 @@ var DEFAULT_PATH_HIGHLIGHT_WIDTH = 8;
2943
2952
  var DEFAULT_SPHERE_HIT_RADIUS = DEFAULT_SPHERE_RADIUS + 8;
2944
2953
  var DEFAULT_PATH_HIT_STROKE_WIDTH = DEFAULT_PATH_EDGE_WIDTH + 8;
2945
2954
  var MUTED_TARGET_COLOR = "#AAA";
2955
+ var INNER_BORDER_SPHERE_NAMES = /* @__PURE__ */ new Set(["Tiphareth"]);
2956
+ var NAZAR_NACRE = "__nacre__";
2957
+ var NAZAR_IRIS = "#33a6dd";
2958
+ var NAZAR_PUPIL = "#0b0b12";
2946
2959
  var sphereId = (name) => id("sphere" /* SPHERE */, name);
2960
+ var pathId = (value) => id("path" /* PATH */, value);
2961
+ var SPLIT_GRADIENT_PATH_IDS = new Set(
2962
+ Array.from({ length: 22 }, (_, index) => pathId(String(index + 1)))
2963
+ );
2964
+ var SPLIT_GRADIENT_BLEND = 34;
2965
+ var SPECIAL_SPHERE_PATH_COLORS = {
2966
+ Kether: "#cfe0f2",
2967
+ Chokhmah: "#e6d6ef",
2968
+ Malkuth: "#8a6a52"
2969
+ };
2970
+ var CHOKHMAH_SWEEP_SPAN = 0.42;
2971
+ var CHOKHMAH_SWEEP_SAMPLES = 12;
2972
+ function iridescentColorAt(t) {
2973
+ const frac = (t % 1 + 1) % 1;
2974
+ return interpolateColorStops(IRIDESCENT_STOPS, frac);
2975
+ }
2976
+ function iridescentContactT(center, toward) {
2977
+ const degrees = Math.atan2(toward.y - center.y, toward.x - center.x) * 180 / Math.PI;
2978
+ return ((degrees + 90) / 360 % 1 + 1) % 1;
2979
+ }
2980
+ function edgeAnchoredVector(from, to, radius) {
2981
+ const length = Math.hypot(to.x - from.x, to.y - from.y) || 1;
2982
+ const ux = (to.x - from.x) / length;
2983
+ const uy = (to.y - from.y) / length;
2984
+ return {
2985
+ x1: round3(from.x + ux * radius),
2986
+ y1: round3(from.y + uy * radius),
2987
+ x2: round3(to.x - ux * radius),
2988
+ y2: round3(to.y - uy * radius)
2989
+ };
2990
+ }
2947
2991
  var TREE_SPHERE_IDS = [...TREE_TOPOLOGY_SPHERE_IDS];
2948
2992
  var TREE_PATH_IDS = [...TREE_TOPOLOGY_PATH_IDS];
2949
2993
  var CANONICAL_SPHERE_PERCENTAGES = {
@@ -3138,6 +3182,7 @@ function getTreeRenderModel(options = {}) {
3138
3182
  }
3139
3183
  function generateTreeSvg(options = {}) {
3140
3184
  const system = options.system ?? "kaabalah";
3185
+ assertTreeSvgSupportedSystem(system);
3141
3186
  const daathLayer = options.daathLayer ?? "front";
3142
3187
  const tree = createTree({ system, parts: ["colors"] });
3143
3188
  const viewBox = normalizeViewBox3(options.viewBox);
@@ -3195,21 +3240,44 @@ function generateTreeSvg(options = {}) {
3195
3240
  `<clipPath id="clip-${slug}"><circle cx="${point.x}" cy="${point.y}" r="${radius}"/></clipPath>`
3196
3241
  );
3197
3242
  }
3198
- push(`<radialGradient id="kether-glow" cx="50%" cy="50%" r="50%">
3199
- <stop offset="0%" stop-color="white" stop-opacity="0.95"/>
3200
- <stop offset="45%" stop-color="white" stop-opacity="0.6"/>
3201
- <stop offset="80%" stop-color="white" stop-opacity="0.15"/>
3202
- <stop offset="100%" stop-color="white" stop-opacity="0"/>
3203
- </radialGradient>`);
3204
- push(`<linearGradient id="kether-facet" x1="0" y1="0" x2="0" y2="1">
3205
- <stop offset="0%" stop-color="white" stop-opacity="0.9"/>
3206
- <stop offset="50%" stop-color="white" stop-opacity="0.5"/>
3207
- <stop offset="100%" stop-color="white" stop-opacity="0.1"/>
3208
- </linearGradient>`);
3209
- push(`<radialGradient id="kether-rim" cx="50%" cy="50%" r="75%">
3210
- <stop offset="60%" stop-color="black" stop-opacity="0"/>
3211
- <stop offset="100%" stop-color="black" stop-opacity="0.18"/>
3212
- </radialGradient>`);
3243
+ if (palette.mode === "color") {
3244
+ for (const splitPathId of SPLIT_GRADIENT_PATH_IDS) {
3245
+ const splitPath = layout.paths[splitPathId];
3246
+ if (!splitPath || highlights.pathColors[splitPathId] !== void 0 || activationMap.get(splitPathId) !== void 0) {
3247
+ continue;
3248
+ }
3249
+ const fromColor = resolveSplitEndpointColor({
3250
+ palette,
3251
+ sphereId: splitPath.fromId,
3252
+ tree
3253
+ });
3254
+ const toColor = resolveSplitEndpointColor({
3255
+ palette,
3256
+ sphereId: splitPath.toId,
3257
+ tree
3258
+ });
3259
+ const blendStart = round3(50 - SPLIT_GRADIENT_BLEND / 2);
3260
+ const blendEnd = round3(50 + SPLIT_GRADIENT_BLEND / 2);
3261
+ const fromName = parseId(splitPath.fromId);
3262
+ const toName = parseId(splitPath.toId);
3263
+ const contactT = toName === "Chokhmah" ? iridescentContactT(splitPath.to, splitPath.from) : fromName === "Chokhmah" ? iridescentContactT(splitPath.from, splitPath.to) : null;
3264
+ const stops = buildSplitGradientStops({
3265
+ fromName,
3266
+ toName,
3267
+ fromColor,
3268
+ toColor,
3269
+ blendStart,
3270
+ blendEnd,
3271
+ contactT
3272
+ });
3273
+ const edge = edgeAnchoredVector(splitPath.from, splitPath.to, radius);
3274
+ push(
3275
+ `<linearGradient id="path-grad-${parseId(splitPathId)}" gradientUnits="userSpaceOnUse" x1="${edge.x1}" y1="${edge.y1}" x2="${edge.x2}" y2="${edge.y2}">
3276
+ ${stops}
3277
+ </linearGradient>`
3278
+ );
3279
+ }
3280
+ }
3213
3281
  push(`</defs>`);
3214
3282
  const background = options.background ?? "white";
3215
3283
  if (background !== "transparent") {
@@ -3255,22 +3323,31 @@ function generateTreeSvg(options = {}) {
3255
3323
  activation: activationMap.get(currentPathId),
3256
3324
  canonicalColor
3257
3325
  });
3258
- const color = activation ? resolvePathDisplayColor({
3259
- canonicalColor,
3260
- activation
3261
- }) : baseColor;
3262
- const edgeColor = resolvePathEdgeColor({
3263
- palette,
3264
- pathColor: color
3265
- });
3326
+ const useSplitGradient = palette.mode === "color" && !activation && highlights.pathColors[currentPathId] === void 0 && SPLIT_GRADIENT_PATH_IDS.has(currentPathId);
3327
+ const solidColor = activation ? resolvePathDisplayColor({ canonicalColor, activation }) : baseColor;
3328
+ const solidEdgeColor = resolvePathEdgeColor({ palette, pathColor: solidColor });
3329
+ const gradientRef = useSplitGradient ? `url(#path-grad-${parseId(currentPathId)})` : null;
3330
+ const color = gradientRef ?? solidColor;
3331
+ const edgeColor = gradientRef ?? solidEdgeColor;
3332
+ const edgeFilter = palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : "";
3333
+ if (gradientRef) {
3334
+ push(
3335
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(solidEdgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${edgeFilter}/>`
3336
+ );
3337
+ }
3266
3338
  push(
3267
- `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
3339
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${edgeFilter}/>`
3268
3340
  );
3269
3341
  if (activation?.visible && activation.emphasis > 0) {
3270
3342
  push(
3271
3343
  `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-opacity="${round3(0.18 + activation.emphasis * 0.28)}" stroke-width="${round3(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
3272
3344
  );
3273
3345
  }
3346
+ if (gradientRef) {
3347
+ push(
3348
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(solidColor)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
3349
+ );
3350
+ }
3274
3351
  push(
3275
3352
  `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
3276
3353
  );
@@ -3385,6 +3462,16 @@ function renderSphere(push, params) {
3385
3462
  push(
3386
3463
  `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr3(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
3387
3464
  );
3465
+ } else if (INNER_BORDER_SPHERE_NAMES.has(params.sphereName)) {
3466
+ const borderWidth = round3(params.radius * 0.05);
3467
+ const borderColor = interpolateColor(
3468
+ toPrimaryFill(activeFill, params.palette.defaultSphereFill),
3469
+ "#000000",
3470
+ 0.2
3471
+ );
3472
+ push(
3473
+ `<circle cx="${point.x}" cy="${point.y}" r="${round3(params.radius - borderWidth / 2)}" fill="none" stroke="${escapeAttr3(borderColor)}" stroke-width="${borderWidth}"/>`
3474
+ );
3388
3475
  }
3389
3476
  }
3390
3477
  function buildLayoutMap(tree, spherePositions) {
@@ -3471,6 +3558,40 @@ function resolveTargetActivation(params) {
3471
3558
  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
3472
3559
  };
3473
3560
  }
3561
+ function resolveSplitEndpointColor(params) {
3562
+ const name = parseId(params.sphereId);
3563
+ return SPECIAL_SPHERE_PATH_COLORS[name] ?? resolveSphereCanonicalColor(params);
3564
+ }
3565
+ function buildSplitGradientStops(params) {
3566
+ const { fromName, toName, fromColor, toColor, blendStart, blendEnd, contactT } = params;
3567
+ const stop = (offset, color) => ` <stop offset="${round3(offset)}%" stop-color="${escapeAttr3(color)}"/>`;
3568
+ const sweep = (start, end, t0, sphereAtEnd) => Array.from({ length: CHOKHMAH_SWEEP_SAMPLES }, (_, index) => {
3569
+ const f = index / (CHOKHMAH_SWEEP_SAMPLES - 1);
3570
+ const offset = start + f * (end - start);
3571
+ const along = sphereAtEnd ? 1 - f : f;
3572
+ return stop(offset, iridescentColorAt(t0 + along * CHOKHMAH_SWEEP_SPAN));
3573
+ });
3574
+ if (toName === "Chokhmah" && contactT !== null) {
3575
+ return [
3576
+ stop(0, fromColor),
3577
+ stop(blendStart, fromColor),
3578
+ ...sweep(blendEnd, 100, contactT, true)
3579
+ ].join("\n");
3580
+ }
3581
+ if (fromName === "Chokhmah" && contactT !== null) {
3582
+ return [
3583
+ ...sweep(0, blendStart, contactT, false),
3584
+ stop(blendEnd, toColor),
3585
+ stop(100, toColor)
3586
+ ].join("\n");
3587
+ }
3588
+ return [
3589
+ stop(0, fromColor),
3590
+ stop(blendStart, fromColor),
3591
+ stop(blendEnd, toColor),
3592
+ stop(100, toColor)
3593
+ ].join("\n");
3594
+ }
3474
3595
  function resolveSphereCanonicalColor(params) {
3475
3596
  const override = params.palette.sphereFills[params.sphereId];
3476
3597
  if (override) {
@@ -3718,33 +3839,18 @@ function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
3718
3839
  const largeArc = endDegrees - startDegrees <= 180 ? 0 : 1;
3719
3840
  return `M ${cx} ${cy} L ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
3720
3841
  }
3721
- function renderKether(push, point, radius, baseFill = "#e0e0e0") {
3842
+ function renderKether(push, point, radius, baseFill = NAZAR_NACRE) {
3843
+ const { x, y } = point;
3844
+ renderIridescent(push, point, radius, NACRE_STOPS);
3845
+ if (baseFill !== NAZAR_NACRE) {
3846
+ renderSphereTintOverlay(push, point, radius, baseFill, 0.5);
3847
+ }
3722
3848
  push(
3723
- `<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(baseFill)}"/>`
3849
+ `<circle cx="${x}" cy="${y}" r="${round3(radius * 0.42)}" fill="${escapeAttr3(NAZAR_IRIS)}"/>`
3850
+ );
3851
+ push(
3852
+ `<circle cx="${x}" cy="${y}" r="${round3(radius * 0.2)}" fill="${escapeAttr3(NAZAR_PUPIL)}"/>`
3724
3853
  );
3725
- push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
3726
- const spokes = 16;
3727
- const innerRadius = round3(radius * 0.18);
3728
- const outerRadius = round3(radius * 0.92);
3729
- const innerWidth = round3(radius * 0.04);
3730
- const angleStep = 360 / spokes;
3731
- push(`<g opacity="0.85">`);
3732
- for (let index = 0; index < spokes; index++) {
3733
- const angle = index * angleStep;
3734
- push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
3735
- const x0 = round3(point.x - innerWidth);
3736
- const y0 = round3(point.y - innerRadius);
3737
- const x1 = point.x;
3738
- const y1 = round3(point.y - outerRadius);
3739
- const x2 = round3(point.x + innerWidth);
3740
- const y2 = round3(point.y - innerRadius);
3741
- push(
3742
- `<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
3743
- );
3744
- push(`</g>`);
3745
- }
3746
- push(`</g>`);
3747
- push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-rim)"/>`);
3748
3854
  }
3749
3855
  function renderSlicedSphere(push, point, radius, colors, startAngle) {
3750
3856
  const segmentCount = colors.length;
@@ -3756,18 +3862,28 @@ function renderSlicedSphere(push, point, radius, colors, startAngle) {
3756
3862
  currentAngle += step;
3757
3863
  }
3758
3864
  }
3759
- function renderIridescent(push, point, radius) {
3760
- const stops = [
3761
- [0, "#F0E8EE"],
3762
- [0.1, "#ffa3e6"],
3763
- [0.22, "#a7e0ff"],
3764
- [0.34, "#baff9a"],
3765
- [0.46, "#ffe28a"],
3766
- [0.58, "#c6a4ff"],
3767
- [0.7, "#9ad6ff"],
3768
- [0.82, "#ffa3e6"],
3769
- [1, "#F0E8EE"]
3770
- ];
3865
+ var IRIDESCENT_STOPS = [
3866
+ [0, "#F0E8EE"],
3867
+ [0.1, "#ffa3e6"],
3868
+ [0.22, "#a7e0ff"],
3869
+ [0.34, "#baff9a"],
3870
+ [0.46, "#ffe28a"],
3871
+ [0.58, "#c6a4ff"],
3872
+ [0.7, "#9ad6ff"],
3873
+ [0.82, "#ffa3e6"],
3874
+ [1, "#F0E8EE"]
3875
+ ];
3876
+ var NACRE_STOPS = [
3877
+ [0, "#eaf6f6"],
3878
+ [0.12, "#a8d6ec"],
3879
+ [0.25, "#c3b6ec"],
3880
+ [0.4, "#a6ecec"],
3881
+ [0.55, "#dfe6fb"],
3882
+ [0.7, "#a6cdf0"],
3883
+ [0.82, "#cbb4ec"],
3884
+ [1, "#eaf6f6"]
3885
+ ];
3886
+ function renderIridescent(push, point, radius, stops = IRIDESCENT_STOPS) {
3771
3887
  const slices = 72;
3772
3888
  const sphereRadius = round3(radius * 0.96);
3773
3889
  for (let index = 0; index < slices; index++) {
@@ -3845,6 +3961,6 @@ function escapeAttr3(value) {
3845
3961
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3846
3962
  }
3847
3963
 
3848
- export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ARCHEOMETER_DEFAULT_VIEWBOX, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, DEFAULT_ARCHEOMETER_MUSICAL_NOTES, DEFAULT_ARCHEOMETER_PLANETS, DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES, DEFAULT_ARCHEOMETER_TRIANGLES, DEFAULT_ARCHEOMETER_TRIANGLE_LABELS, DEFAULT_ARCHEOMETER_UTTERANCE, DEFAULT_ARCHEOMETER_ZODIAC, DEFAULT_ARCHETYPE_MUSICAL_NOTES, DEFAULT_ARCHETYPE_PLANETS, DEFAULT_ARCHETYPE_TRIANGLES, DEFAULT_ARCHETYPE_UTTERANCE, DEFAULT_ARCHETYPE_ZODIAC, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateArcheometerSvg, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getArcheometerRenderModel, getAstroGlyph, getRouteActivations, getTreeLayout, getTreeRenderModel, listAstroGlyphs };
3964
+ export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ARCHEOMETER_DEFAULT_VIEWBOX, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, DEFAULT_ARCHEOMETER_MUSICAL_NOTES, DEFAULT_ARCHEOMETER_PLANETS, DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES, DEFAULT_ARCHEOMETER_TRIANGLES, DEFAULT_ARCHEOMETER_TRIANGLE_LABELS, DEFAULT_ARCHEOMETER_UTTERANCE, DEFAULT_ARCHEOMETER_ZODIAC, DEFAULT_ARCHETYPE_MUSICAL_NOTES, DEFAULT_ARCHETYPE_PLANETS, DEFAULT_ARCHETYPE_TRIANGLES, DEFAULT_ARCHETYPE_UTTERANCE, DEFAULT_ARCHETYPE_ZODIAC, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, TREE_SVG_SUPPORTED_SYSTEM, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateArcheometerSvg, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getArcheometerRenderModel, getAstroGlyph, getRouteActivations, getTreeLayout, getTreeRenderModel, getUnsupportedTreeSvgSystemMessage, listAstroGlyphs };
3849
3965
  //# sourceMappingURL=out.js.map
3850
- //# sourceMappingURL=chunk-4MACEIWO.mjs.map
3966
+ //# sourceMappingURL=chunk-LXJ3THNW.mjs.map