@visualli/core 0.2.8 → 0.2.10

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.
Files changed (66) hide show
  1. package/dist/{chunk-KGMYFGOQ.js → chunk-4O42KVJ5.js} +4 -4
  2. package/dist/{chunk-AGETXG4X.js → chunk-DRTDHK4R.js} +2 -2
  3. package/dist/{chunk-GWR7CGWW.js → chunk-DYL3RO6W.js} +2 -2
  4. package/dist/{chunk-3ZEH2SFM.js → chunk-EU2VXWFX.js} +10 -1
  5. package/dist/chunk-EU2VXWFX.js.map +1 -0
  6. package/dist/{chunk-RHUW2OCC.js → chunk-FDG2FGYG.js} +2 -2
  7. package/dist/{chunk-S6H66I62.js → chunk-IBCQFSQQ.js} +2 -2
  8. package/dist/{chunk-7VTPJVPD.js → chunk-TJF6R4WH.js} +12 -2
  9. package/dist/chunk-TJF6R4WH.js.map +1 -0
  10. package/dist/{chunk-RCD6QRGP.js → chunk-WGLWQQKC.js} +2 -2
  11. package/dist/config/index.cjs +1 -0
  12. package/dist/config/index.cjs.map +1 -1
  13. package/dist/config/index.d.cts +4 -4
  14. package/dist/config/index.d.ts +4 -4
  15. package/dist/config/index.js +2 -2
  16. package/dist/constants/index.cjs.map +1 -1
  17. package/dist/constants/index.d.cts +2 -2
  18. package/dist/constants/index.d.ts +2 -2
  19. package/dist/constants/index.js +2 -2
  20. package/dist/{designSystem-3oCvYiUC.d.cts → designSystem-C6DKkmV8.d.cts} +3 -1
  21. package/dist/{designSystem-3oCvYiUC.d.ts → designSystem-C6DKkmV8.d.ts} +3 -1
  22. package/dist/{ideaSize-ACLfsm--.d.ts → ideaSize-B4lvLW5S.d.ts} +1 -1
  23. package/dist/{ideaSize-C9H3aWFn.d.cts → ideaSize-CTA03TLY.d.cts} +1 -1
  24. package/dist/{index-D2DF4f5h.d.ts → index-BSG3ACvL.d.ts} +1 -1
  25. package/dist/{index-4pAzpHHV.d.cts → index-CzKgW53y.d.cts} +1 -1
  26. package/dist/index.cjs +29 -4
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +45 -8
  29. package/dist/index.d.ts +45 -8
  30. package/dist/index.js +25 -17
  31. package/dist/index.js.map +1 -1
  32. package/dist/layout/index.d.cts +2 -2
  33. package/dist/layout/index.d.ts +2 -2
  34. package/dist/{mindmap-CYDXg2oE.d.ts → mindmap-B59ENw1g.d.ts} +1 -1
  35. package/dist/{mindmap-Bx-_0NxF.d.cts → mindmap-D2M47Mxn.d.cts} +1 -1
  36. package/dist/parser/index.cjs +9 -0
  37. package/dist/parser/index.cjs.map +1 -1
  38. package/dist/parser/index.d.cts +3 -3
  39. package/dist/parser/index.d.ts +3 -3
  40. package/dist/parser/index.js +4 -4
  41. package/dist/performance/index.cjs.map +1 -1
  42. package/dist/performance/index.js +2 -2
  43. package/dist/theme/index.cjs +11 -1
  44. package/dist/theme/index.cjs.map +1 -1
  45. package/dist/theme/index.d.cts +2 -2
  46. package/dist/theme/index.d.ts +2 -2
  47. package/dist/theme/index.js +2 -2
  48. package/dist/types/index.d.cts +2 -2
  49. package/dist/types/index.d.ts +2 -2
  50. package/dist/viewport/index.cjs.map +1 -1
  51. package/dist/viewport/index.d.cts +2 -2
  52. package/dist/viewport/index.d.ts +2 -2
  53. package/dist/viewport/index.js +2 -2
  54. package/package.json +2 -2
  55. package/src/generated/designSystem.ts +11 -1
  56. package/src/generated/geometry/interaction.ts +17 -0
  57. package/src/index.ts +2 -2
  58. package/src/utils/navigation.ts +15 -4
  59. package/dist/chunk-3ZEH2SFM.js.map +0 -1
  60. package/dist/chunk-7VTPJVPD.js.map +0 -1
  61. /package/dist/{chunk-KGMYFGOQ.js.map → chunk-4O42KVJ5.js.map} +0 -0
  62. /package/dist/{chunk-AGETXG4X.js.map → chunk-DRTDHK4R.js.map} +0 -0
  63. /package/dist/{chunk-GWR7CGWW.js.map → chunk-DYL3RO6W.js.map} +0 -0
  64. /package/dist/{chunk-RHUW2OCC.js.map → chunk-FDG2FGYG.js.map} +0 -0
  65. /package/dist/{chunk-S6H66I62.js.map → chunk-IBCQFSQQ.js.map} +0 -0
  66. /package/dist/{chunk-RCD6QRGP.js.map → chunk-WGLWQQKC.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import { R as RenderConfig } from '../mindmap-CYDXg2oE.js';
2
- import '../designSystem-3oCvYiUC.js';
1
+ import { R as RenderConfig } from '../mindmap-B59ENw1g.js';
2
+ import '../designSystem-C6DKkmV8.js';
3
3
 
4
4
  declare const FPS_TARGET = 60;
5
5
  declare const FPS_WARNING_THRESHOLD = 45;
@@ -9,7 +9,7 @@ import {
9
9
  getRecommendedRenderConfig,
10
10
  getRenderConfigForQuality,
11
11
  isFeatureEnabled
12
- } from "../chunk-S6H66I62.js";
12
+ } from "../chunk-IBCQFSQQ.js";
13
13
  import {
14
14
  LAYOUT_SPACING
15
15
  } from "../chunk-N7HCYULH.js";
@@ -55,7 +55,7 @@ import {
55
55
  ZOOM_DEFAULT,
56
56
  ZOOM_MAX,
57
57
  ZOOM_MIN
58
- } from "../chunk-3ZEH2SFM.js";
58
+ } from "../chunk-EU2VXWFX.js";
59
59
  export {
60
60
  CIRCULAR_REFERENCE_MAX_DEPTH,
61
61
  CLICK_THRESHOLD,
@@ -1,5 +1,5 @@
1
1
  /** Version of the design system these modules were generated from. */
2
- declare const DESIGN_SYSTEM_VERSION: "0.3.4";
2
+ declare const DESIGN_SYSTEM_VERSION: "0.3.6";
3
3
  declare const THEME_NAMES: readonly ["light", "dark", "focus-light", "focus-dark", "colorsafe-light", "colorsafe-dark", "contrast-light", "contrast-dark"];
4
4
  type ThemeName = (typeof THEME_NAMES)[number];
5
5
  /** Every token for every theme (each theme already merged over "light"). Keys match the CSS custom properties. */
@@ -32,6 +32,7 @@ declare const METRICS: {
32
32
  readonly durationBase: 240;
33
33
  readonly durationZoom: 500;
34
34
  readonly durationReveal: 420;
35
+ readonly durationAutoplay: 7000;
35
36
  readonly staggerReveal: 70;
36
37
  readonly zChrome: 10;
37
38
  readonly zCard: 20;
@@ -44,6 +45,7 @@ declare const METRICS_REDUCED_MOTION: {
44
45
  readonly durationBase: 0;
45
46
  readonly durationZoom: 0;
46
47
  readonly durationReveal: 0;
48
+ readonly durationAutoplay: 0;
47
49
  readonly staggerReveal: 0;
48
50
  };
49
51
  /** Canvas type styles (family is a token name: font-hand, font-note, font-ui ...). */
@@ -1,5 +1,5 @@
1
1
  /** Version of the design system these modules were generated from. */
2
- declare const DESIGN_SYSTEM_VERSION: "0.3.4";
2
+ declare const DESIGN_SYSTEM_VERSION: "0.3.6";
3
3
  declare const THEME_NAMES: readonly ["light", "dark", "focus-light", "focus-dark", "colorsafe-light", "colorsafe-dark", "contrast-light", "contrast-dark"];
4
4
  type ThemeName = (typeof THEME_NAMES)[number];
5
5
  /** Every token for every theme (each theme already merged over "light"). Keys match the CSS custom properties. */
@@ -32,6 +32,7 @@ declare const METRICS: {
32
32
  readonly durationBase: 240;
33
33
  readonly durationZoom: 500;
34
34
  readonly durationReveal: 420;
35
+ readonly durationAutoplay: 7000;
35
36
  readonly staggerReveal: 70;
36
37
  readonly zChrome: 10;
37
38
  readonly zCard: 20;
@@ -44,6 +45,7 @@ declare const METRICS_REDUCED_MOTION: {
44
45
  readonly durationBase: 0;
45
46
  readonly durationZoom: 0;
46
47
  readonly durationReveal: 0;
48
+ readonly durationAutoplay: 0;
47
49
  readonly staggerReveal: 0;
48
50
  };
49
51
  /** Canvas type styles (family is a token name: font-hand, font-note, font-ui ...). */
@@ -1,4 +1,4 @@
1
- import { I as IdeaKind } from './mindmap-CYDXg2oE.js';
1
+ import { I as IdeaKind } from './mindmap-B59ENw1g.js';
2
2
  import { V as VisualliLayer } from './layer-B2A3Ki48.js';
3
3
 
4
4
  /** Width in px of `text` in the idea label's face at `px` (the label's weight; readable type adds its tracking). */
@@ -1,4 +1,4 @@
1
- import { I as IdeaKind } from './mindmap-Bx-_0NxF.cjs';
1
+ import { I as IdeaKind } from './mindmap-D2M47Mxn.cjs';
2
2
  import { V as VisualliLayer } from './layer-B2A3Ki48.cjs';
3
3
 
4
4
  /** Width in px of `text` in the idea label's face at `px` (the label's weight; readable type adds its tracking). */
@@ -1,4 +1,4 @@
1
- import { T as TopicName$1, M as METRICS, a as ThemeName } from './designSystem-3oCvYiUC.js';
1
+ import { T as TopicName$1, M as METRICS, a as ThemeName } from './designSystem-C6DKkmV8.js';
2
2
 
3
3
  /** The eight topics, in the order missing colors cycle through. */
4
4
  declare const TOPIC_ORDER: readonly ["teal", "harbor", "iris", "berry", "coral", "amber", "sun", "stone"];
@@ -1,4 +1,4 @@
1
- import { T as TopicName$1, M as METRICS, a as ThemeName } from './designSystem-3oCvYiUC.cjs';
1
+ import { T as TopicName$1, M as METRICS, a as ThemeName } from './designSystem-C6DKkmV8.cjs';
2
2
 
3
3
  /** The eight topics, in the order missing colors cycle through. */
4
4
  declare const TOPIC_ORDER: readonly ["teal", "harbor", "iris", "berry", "coral", "amber", "sun", "stone"];
package/dist/index.cjs CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  EASE: () => EASE,
47
47
  ELLIPSE: () => ELLIPSE,
48
48
  FEATURE_FLAGS: () => FEATURE_FLAGS,
49
+ FIT_ROOM: () => FIT_ROOM,
49
50
  FPSMonitor: () => FPSMonitor,
50
51
  FPS_CRITICAL_THRESHOLD: () => FPS_CRITICAL_THRESHOLD,
51
52
  FPS_DOWNGRADE_THRESHOLD: () => FPS_DOWNGRADE_THRESHOLD,
@@ -147,6 +148,7 @@ __export(index_exports, {
147
148
  edgePath: () => edgePath,
148
149
  fetchAndParseVisualli: () => fetchAndParseVisualli,
149
150
  fitView: () => fitView,
151
+ fitViewInset: () => fitViewInset,
150
152
  flattenNodes: () => flattenNodes,
151
153
  focusOnNode: () => focusOnNode,
152
154
  generateSampleConfig: () => generateSampleConfig,
@@ -535,7 +537,7 @@ function countLayersBeneath(doc, nodeId, visited = /* @__PURE__ */ new Set()) {
535
537
  }
536
538
 
537
539
  // src/generated/designSystem.ts
538
- var DESIGN_SYSTEM_VERSION = "0.3.4";
540
+ var DESIGN_SYSTEM_VERSION = "0.3.6";
539
541
  var THEME_NAMES = [
540
542
  "light",
541
543
  "dark",
@@ -611,6 +613,7 @@ var TOKENS = {
611
613
  "duration-base": "240ms",
612
614
  "duration-zoom": "500ms",
613
615
  "duration-reveal": "420ms",
616
+ "duration-autoplay": "7000ms",
614
617
  "stagger-reveal": "70ms",
615
618
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
616
619
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -683,6 +686,7 @@ var TOKENS = {
683
686
  "duration-base": "240ms",
684
687
  "duration-zoom": "500ms",
685
688
  "duration-reveal": "420ms",
689
+ "duration-autoplay": "7000ms",
686
690
  "stagger-reveal": "70ms",
687
691
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
688
692
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -755,6 +759,7 @@ var TOKENS = {
755
759
  "duration-base": "240ms",
756
760
  "duration-zoom": "500ms",
757
761
  "duration-reveal": "420ms",
762
+ "duration-autoplay": "7000ms",
758
763
  "stagger-reveal": "70ms",
759
764
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
760
765
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -827,6 +832,7 @@ var TOKENS = {
827
832
  "duration-base": "240ms",
828
833
  "duration-zoom": "500ms",
829
834
  "duration-reveal": "420ms",
835
+ "duration-autoplay": "7000ms",
830
836
  "stagger-reveal": "70ms",
831
837
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
832
838
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -899,6 +905,7 @@ var TOKENS = {
899
905
  "duration-base": "240ms",
900
906
  "duration-zoom": "500ms",
901
907
  "duration-reveal": "420ms",
908
+ "duration-autoplay": "7000ms",
902
909
  "stagger-reveal": "70ms",
903
910
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
904
911
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -971,6 +978,7 @@ var TOKENS = {
971
978
  "duration-base": "240ms",
972
979
  "duration-zoom": "500ms",
973
980
  "duration-reveal": "420ms",
981
+ "duration-autoplay": "7000ms",
974
982
  "stagger-reveal": "70ms",
975
983
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
976
984
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -1043,6 +1051,7 @@ var TOKENS = {
1043
1051
  "duration-base": "240ms",
1044
1052
  "duration-zoom": "500ms",
1045
1053
  "duration-reveal": "420ms",
1054
+ "duration-autoplay": "7000ms",
1046
1055
  "stagger-reveal": "70ms",
1047
1056
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
1048
1057
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -1115,6 +1124,7 @@ var TOKENS = {
1115
1124
  "duration-base": "240ms",
1116
1125
  "duration-zoom": "500ms",
1117
1126
  "duration-reveal": "420ms",
1127
+ "duration-autoplay": "7000ms",
1118
1128
  "stagger-reveal": "70ms",
1119
1129
  "ease-zoom": "cubic-bezier(0.2, 0.8, 0.2, 1)",
1120
1130
  "ease-standard": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -1158,6 +1168,7 @@ var METRICS = {
1158
1168
  "durationBase": 240,
1159
1169
  "durationZoom": 500,
1160
1170
  "durationReveal": 420,
1171
+ "durationAutoplay": 7e3,
1161
1172
  "staggerReveal": 70,
1162
1173
  "zChrome": 10,
1163
1174
  "zCard": 20,
@@ -1169,6 +1180,7 @@ var METRICS_REDUCED_MOTION = {
1169
1180
  "durationBase": 0,
1170
1181
  "durationZoom": 0,
1171
1182
  "durationReveal": 0,
1183
+ "durationAutoplay": 0,
1172
1184
  "staggerReveal": 0
1173
1185
  };
1174
1186
  var TYPE_STYLES = {
@@ -2110,6 +2122,13 @@ function fitView(bounds, width, height) {
2110
2122
  const scale = Math.min(width / Math.max(1, bounds.x1 - bounds.x0), height / Math.max(1, bounds.y1 - bounds.y0), VIEW.fitMax);
2111
2123
  return { scale, center: { x: (bounds.x0 + bounds.x1) / 2, y: (bounds.y0 + bounds.y1) / 2 } };
2112
2124
  }
2125
+ var FIT_ROOM = { minWidth: 200, minHeight: 160 };
2126
+ function fitViewInset(bounds, width, height, insets = {}) {
2127
+ const top = insets.top ?? 0, right = insets.right ?? 0, bottom = insets.bottom ?? 0, left = insets.left ?? 0;
2128
+ const w = Math.max(FIT_ROOM.minWidth, width - left - right), h = Math.max(FIT_ROOM.minHeight, height - top - bottom);
2129
+ const { scale, center } = fitView(bounds, w, h);
2130
+ return { scale, center, screen: { x: left + w / 2, y: top + h / 2 }, room: { width: w, height: h } };
2131
+ }
2113
2132
  var PEEK_PLACEMENT = {
2114
2133
  /** Gap between the idea's outermost ring and the card. */
2115
2134
  gap: 16,
@@ -2726,10 +2745,14 @@ function getContainersForLayer(doc, layerId) {
2726
2745
  return { id: c.id, label, nodeIds: c.nodes, level: layer.level };
2727
2746
  });
2728
2747
  }
2729
- function calculateFitView(nodes, canvasWidth, canvasHeight, containers = []) {
2748
+ function calculateFitView(nodes, canvasWidth, canvasHeight, containers = [], insets) {
2730
2749
  if (nodes.length === 0) return { centerX: 0, centerY: 0, zoomLevel: 1 };
2731
- const { scale, center } = fitView(layerFrame(nodes, containers), canvasWidth, canvasHeight);
2732
- return { centerX: center.x, centerY: center.y, zoomLevel: scale };
2750
+ if (!insets) {
2751
+ const { scale: scale2, center: center2 } = fitView(layerFrame(nodes, containers), canvasWidth, canvasHeight);
2752
+ return { centerX: center2.x, centerY: center2.y, zoomLevel: scale2 };
2753
+ }
2754
+ const { scale, center, screen } = fitViewInset(layerFrame(nodes, containers), canvasWidth, canvasHeight, insets);
2755
+ return { centerX: center.x - (screen.x - canvasWidth / 2) / scale, centerY: center.y - (screen.y - canvasHeight / 2) / scale, zoomLevel: scale };
2733
2756
  }
2734
2757
 
2735
2758
  // src/rendering/culling.ts
@@ -2954,6 +2977,7 @@ function shadowsShown(visibleIdeas) {
2954
2977
  EASE,
2955
2978
  ELLIPSE,
2956
2979
  FEATURE_FLAGS,
2980
+ FIT_ROOM,
2957
2981
  FPSMonitor,
2958
2982
  FPS_CRITICAL_THRESHOLD,
2959
2983
  FPS_DOWNGRADE_THRESHOLD,
@@ -3055,6 +3079,7 @@ function shadowsShown(visibleIdeas) {
3055
3079
  edgePath,
3056
3080
  fetchAndParseVisualli,
3057
3081
  fitView,
3082
+ fitViewInset,
3058
3083
  flattenNodes,
3059
3084
  focusOnNode,
3060
3085
  generateSampleConfig,