@visualli/core 0.2.11 → 0.2.12
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-DYL3RO6W.js → chunk-C2DF7LGT.js} +2 -2
- package/dist/{chunk-IBCQFSQQ.js → chunk-EB5RHCQP.js} +2 -2
- package/dist/{chunk-EU2VXWFX.js → chunk-KUW3GHKQ.js} +7 -8
- package/dist/chunk-KUW3GHKQ.js.map +1 -0
- package/dist/{chunk-FDG2FGYG.js → chunk-XMD5FYME.js} +2 -2
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.js +2 -2
- package/dist/index.cjs +6 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +4 -4
- package/dist/performance/index.cjs.map +1 -1
- package/dist/performance/index.js +2 -2
- package/dist/viewport/index.cjs.map +1 -1
- package/dist/viewport/index.js +2 -2
- package/package.json +2 -2
- package/src/generated/geometry/interaction.ts +3 -3
- package/dist/chunk-EU2VXWFX.js.map +0 -1
- /package/dist/{chunk-DYL3RO6W.js.map → chunk-C2DF7LGT.js.map} +0 -0
- /package/dist/{chunk-IBCQFSQQ.js.map → chunk-EB5RHCQP.js.map} +0 -0
- /package/dist/{chunk-FDG2FGYG.js.map → chunk-XMD5FYME.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
FPS_SAMPLE_WINDOW,
|
|
3
3
|
FPS_TARGET,
|
|
4
4
|
MEMORY_CHECK_INTERVAL
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KUW3GHKQ.js";
|
|
6
6
|
|
|
7
7
|
// src/performance/performanceMonitor.ts
|
|
8
8
|
var FPSMonitor = class {
|
|
@@ -136,4 +136,4 @@ export {
|
|
|
136
136
|
MemoryMonitor,
|
|
137
137
|
PerformanceProfiler
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=chunk-
|
|
139
|
+
//# sourceMappingURL=chunk-C2DF7LGT.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
QUALITY_HIGH,
|
|
5
5
|
QUALITY_LOW,
|
|
6
6
|
QUALITY_MEDIUM
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KUW3GHKQ.js";
|
|
8
8
|
|
|
9
9
|
// src/constants/renderConfig.ts
|
|
10
10
|
var DEFAULT_RENDER_CONFIG = {
|
|
@@ -105,4 +105,4 @@ export {
|
|
|
105
105
|
isFeatureEnabled,
|
|
106
106
|
getRecommendedRenderConfig
|
|
107
107
|
};
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-EB5RHCQP.js.map
|
|
@@ -74,11 +74,10 @@ function zoomAround(t0, s0, s1, from, to) {
|
|
|
74
74
|
return { x: to.x - wx * s1, y: to.y - wy * s1 };
|
|
75
75
|
}
|
|
76
76
|
var FRAME = {
|
|
77
|
-
/** Room beyond each idea's
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
minPadY: 120,
|
|
77
|
+
/** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */
|
|
78
|
+
ring: 0.3,
|
|
79
|
+
clearX: 16,
|
|
80
|
+
clearY: 16,
|
|
82
81
|
/** Room beyond each container hull for its dashed line and the name pill straddling it. */
|
|
83
82
|
hullX: 24,
|
|
84
83
|
hullY: 40
|
|
@@ -86,7 +85,7 @@ var FRAME = {
|
|
|
86
85
|
function layerBounds(ideas, hulls = []) {
|
|
87
86
|
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
88
87
|
for (const n of ideas) {
|
|
89
|
-
const px =
|
|
88
|
+
const px = n.rx * (1 + FRAME.ring) + FRAME.clearX, py = n.ry * (1 + FRAME.ring) + FRAME.clearY;
|
|
90
89
|
x0 = Math.min(x0, n.x - px);
|
|
91
90
|
x1 = Math.max(x1, n.x + px);
|
|
92
91
|
y0 = Math.min(y0, n.y - py);
|
|
@@ -98,7 +97,7 @@ function layerBounds(ideas, hulls = []) {
|
|
|
98
97
|
y0 = Math.min(y0, h.y0 - FRAME.hullY);
|
|
99
98
|
y1 = Math.max(y1, h.y1 + FRAME.hullY);
|
|
100
99
|
}
|
|
101
|
-
if (!Number.isFinite(x0)) return { x0: -
|
|
100
|
+
if (!Number.isFinite(x0)) return { x0: -150, y0: -120, x1: 150, y1: 120 };
|
|
102
101
|
return { x0, y0, x1, y1 };
|
|
103
102
|
}
|
|
104
103
|
function fitView(bounds, width, height) {
|
|
@@ -281,4 +280,4 @@ export {
|
|
|
281
280
|
NODE_COUNT_THRESHOLDS,
|
|
282
281
|
VIEWPORT_CONFIG
|
|
283
282
|
};
|
|
284
|
-
//# sourceMappingURL=chunk-
|
|
283
|
+
//# sourceMappingURL=chunk-KUW3GHKQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generated/geometry/interaction.ts","../src/constants/performanceConstants.ts"],"sourcesContent":["// Generated from visualli.ai design-system/components/src/interaction.ts — do not edit here.\n/* How the canvas answers the pointer and the keyboard — the timing and rules behind the peek (an idea's summary)\n and terms (semantic anchors: an underlined word and its definition card). The look and the pop-in animation live\n in the CSS (.vi-fact, .vi-anchor, .vi-anchor-card); these are the behaviours, as data, so every renderer (VisualMap,\n the spec SDK on a canvas) opens and closes them alike. Times in ms. No dependencies, so it can travel alone. */\n\n/** Terms (semantic anchors) in a peek's text. */\nexport const TERM = {\n /** Hovering the term this long opens its definition card… */ hoverOpen: 250,\n /** …which closes this long after the pointer leaves both the term and the card (moving between them keeps it open). */ hoverClose: 300,\n /** Only a mouse opens on hover; touch and pen open on tap. */ hoverPointers: ['mouse'] as readonly string[],\n /** A click, tap, Enter or Space pins the card open (hovering away doesn't close it); pressing again unpins and closes. */ clickPins: true,\n /** Escape closes the card and returns focus to the term; a press anywhere outside the term and its card closes it. */ escapeCloses: true, pressOutsideCloses: true,\n /** Opening by click or keyboard moves focus to the card's first link or button. */ focusCardOnOpen: true,\n /** The card is kept this far inside the viewport's left and right edges. */ viewportMargin: 8,\n /** The card's link to a source about the term. */ learnMoreLabel: 'Learn more',\n} as const;\n\n/** The peek: an idea's summary card on hover (pointer) or tap (touch). */\nexport const PEEK = {\n /** Hovering an idea opens its peek at once; it stays this long after the pointer leaves the idea (and while the\n * pointer is over the peek itself), so the pointer can travel from the idea onto the card. */ hoverClose: 180,\n} as const;\n\n/** The touch peek: a bottom sheet with a grip. */\nexport const SHEET = {\n /** Dragging the grip down this far closes the sheet (or collapses it when expanded); up this far expands it. */ dismissDrag: 80, expandDrag: 40,\n /** Its height: this share of the map, at most `maxHeight` px; the map pans the chosen idea into the space above it. */ heightRatio: 0.42, maxHeight: 300,\n} as const;\n\n/** Zoom, pan and fit. */\nexport const VIEW = {\n /** Each zoom step multiplies or divides the zoom by this. */ zoomStep: 1.2,\n /** Zoom limits (the zoom-min / zoom-max tokens; the build checks they agree). */ zoomMin: 0.3, zoomMax: 5,\n /** Fit to view never enlarges a layer beyond this. */ fitMax: 1.1,\n} as const;\n\n/** Touch gestures on the map (any touch input — phones, tablets and touchscreen laptops alike; it follows the pointer\n * in use, not the device, so a mouse or trackpad on the same laptop isn't affected). */\nexport const GESTURE = {\n /** Two fingers pinch to zoom the map's contents — ideas, connectors, containers and their labels — around the\n * point between the fingers, within VIEW's limits. Controls, the depth trail, the peek, chat and the page never scale. */ pinchZoom: true,\n /** Moving both fingers pans the contents. */ twoFingerPan: true,\n /** The pointers that pinch (PointerEvent.pointerType). */ pointers: ['touch'] as readonly string[],\n /** Where the map is the page (an app: AppShell, the mobile app), it takes every touch gesture (touch-action: none),\n * so the browser never zooms the page. Embedded on a scrolling page (website, docs), one finger still scrolls the\n * page (touch-action: pan-x pan-y); two fingers that land together pinch the map. */ appTouchAction: 'none', embeddedTouchAction: 'pan-x pan-y',\n /** Press and move on the empty canvas to pan the contents (mouse and pen; touch pans with two fingers, so one finger\n * still scrolls an embedded page). A press that moves less than `panSlop` px is a click. */ dragPan: true,\n panPointers: ['mouse', 'pen'] as readonly string[], panSlop: 6,\n /** Moving an idea starts once the press has moved this far (px), by pointerModeFor: a mouse ('hover') sooner, a finger\n * or pen ('touch') later, so taps still work. */\n ideaDragSlop: { hover: 4, touch: 10 },\n /** Zoom never navigates: stepping inside and backing out stay explicit (tap an idea / Step inside, the depth trail,\n * Escape or Backspace). */ zoomNavigates: false,\n} as const;\n\n/** The zoom after a pinch: the zoom at the start, scaled by how far the fingers spread, within VIEW's limits. */\nexport function pinchZoom(startZoom: number, startDistance: number, distance: number): number {\n const z = startZoom * (distance / Math.max(startDistance, 1));\n return Math.min(VIEW.zoomMax, Math.max(VIEW.zoomMin, z));\n}\n\n/** Keeps the map point that was under `from` under `to` when the scale changes from `s0` to `s1`: the new\n * translation, given the old one (screen = world × s + t). Used to zoom around the fingers. */\nexport function zoomAround(t0: { x: number; y: number }, s0: number, s1: number, from: { x: number; y: number }, to: { x: number; y: number }): { x: number; y: number } {\n const wx = (from.x - t0.x) / s0, wy = (from.y - t0.y) / s0;\n return { x: to.x - wx * s1, y: to.y - wy * s1 };\n}\n\n/** Framing a layer (fit to view): its ideas with room around them, and its container hulls with room for the name pill. */\nexport const FRAME = {\n /** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */ ring: 0.3, clearX: 16, clearY: 16,\n /** Room beyond each container hull for its dashed line and the name pill straddling it. */ hullX: 24, hullY: 40,\n} as const;\nexport type FrameBox = { x0: number; y0: number; x1: number; y1: number };\n\n/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. */\nexport function layerBounds(ideas: ReadonlyArray<{ x: number; y: number; rx: number; ry: number }>, hulls: ReadonlyArray<FrameBox> = []): FrameBox {\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const n of ideas) {\n const px = n.rx * (1 + FRAME.ring) + FRAME.clearX, py = n.ry * (1 + FRAME.ring) + FRAME.clearY;\n x0 = Math.min(x0, n.x - px); x1 = Math.max(x1, n.x + px); y0 = Math.min(y0, n.y - py); y1 = Math.max(y1, n.y + py);\n }\n for (const h of hulls) { x0 = Math.min(x0, h.x0 - FRAME.hullX); x1 = Math.max(x1, h.x1 + FRAME.hullX); y0 = Math.min(y0, h.y0 - FRAME.hullY); y1 = Math.max(y1, h.y1 + FRAME.hullY); }\n if (!Number.isFinite(x0)) return { x0: -150, y0: -120, x1: 150, y1: 120 };\n return { x0, y0, x1, y1 };\n}\n\n/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the\n * world point to centre. */\nexport function fitView(bounds: FrameBox, width: number, height: number): { scale: number; center: { x: number; y: number } } {\n const scale = Math.min(width / Math.max(1, bounds.x1 - bounds.x0), height / Math.max(1, bounds.y1 - bounds.y0), VIEW.fitMax);\n return { scale, center: { x: (bounds.x0 + bounds.x1) / 2, y: (bounds.y0 + bounds.y1) / 2 } };\n}\n\n/** Insets: room the host's chrome takes at each edge of the map (a docked Vault, a top bar, the Composer). */\nexport type FrameInsets = { top?: number; right?: number; bottom?: number; left?: number };\n/** The smallest free area a map is ever fitted into, however much the insets take. */\nexport const FIT_ROOM = { minWidth: 200, minHeight: 160 } as const;\n\n/** Fit to view inside insets. The map's canvas fills its whole frame - so the canvas itself and its chromatic immersion\n * run behind the host's chrome (a docked Vault floats over the tinted canvas) - while the layer is fitted into the\n * free area (the frame less the insets, never below FIT_ROOM) and centred in it. `screen`: where on the canvas the\n * world `center` goes (screen = world × scale + translation); `room`: the free area's size. With no insets this is\n * fitView, centred on the canvas. */\nexport function fitViewInset(bounds: FrameBox, width: number, height: number, insets: FrameInsets = {}): { scale: number; center: { x: number; y: number }; screen: { x: number; y: number }; room: { width: number; height: number } } {\n const top = insets.top ?? 0, right = insets.right ?? 0, bottom = insets.bottom ?? 0, left = insets.left ?? 0;\n const w = Math.max(FIT_ROOM.minWidth, width - left - right), h = Math.max(FIT_ROOM.minHeight, height - top - bottom);\n const { scale, center } = fitView(bounds, w, h);\n return { scale, center, screen: { x: left + w / 2, y: top + h / 2 }, room: { width: w, height: h } };\n}\n\n/** Where the peek card sits (pointer): beside the idea — right of it if it fits, else left — and level with it. */\nexport const PEEK_PLACEMENT = {\n /** Gap between the idea's outermost ring and the card. */ gap: 16,\n /** The card's width and the height kept clear below it. */ cardWidth: 300, cardHeight: 220,\n /** The card is raised this much above the idea's centre. */ raise: 70,\n /** Kept this far inside the map's edges. */ margin: 12,\n} as const;\n\n/** The peek card's top-left, in map (screen) pixels. `idea`: the idea's centre on screen and its on-screen half\n * width with its outermost ring (`half`); `box`: the map's size. */\nexport function peekPosition(idea: { x: number; y: number; half: number }, box: { w: number; h: number }, card: { w: number; h: number } = { w: PEEK_PLACEMENT.cardWidth, h: PEEK_PLACEMENT.cardHeight }) {\n const P = PEEK_PLACEMENT, half = idea.half + P.gap;\n const right = idea.x + half + card.w < box.w - P.margin;\n return { left: right ? idea.x + half : Math.max(P.margin, idea.x - half - card.w), top: Math.min(Math.max(P.margin, idea.y - P.raise), box.h - card.h), side: right ? 'right' as const : 'left' as const };\n}\n\n/** The depth trail: each entry shows the idea that was stepped into — its title and a dot in its color (the same\n * topic or custom color the idea is drawn in, including the sibling-order topic of an uncolored idea). The first\n * entry is the map itself: a `stone` dot and the home glyph only (`rootLabel: 'icon'`) — no text, since a map's title\n * usually repeats its centre idea's, which the next entry shows; its accessible name and tooltip are the map's title.\n * The dot is the idea shape (shapeForLevel). */\nexport const TRAIL = { rootTopic: 'stone', rootLabel: 'icon', homeIconSize: 12, dotBox: 16, dotRadius: 6.4, stroke: 1.25, currentStroke: 1.75 } as const;\n\n/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */\nexport function pointerModeFor(pointerType: string): 'hover' | 'touch' | null {\n return pointerType === 'mouse' ? 'hover' : pointerType === 'touch' || pointerType === 'pen' ? 'touch' : null;\n}\n\n/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */\nexport function hoverOpensTerm(pointerType: string): boolean {\n return TERM.hoverPointers.includes(pointerType);\n}\n","// ─── Performance & Rendering Constants ───────────────────────────────────────\n//\n// Performance budgets and interaction thresholds. Visual values (colours,\n// stroke widths, node size, zoom range) come from the design system tokens.\n\nimport { VIEW } from '../generated/geometry/interaction.js';\n\n// ── FPS ───────────────────────────────────────────────────────────────────────\n\nexport const FPS_TARGET = 60;\nexport const FPS_WARNING_THRESHOLD = 45;\nexport const FPS_CRITICAL_THRESHOLD = 30;\nexport const TARGET_FRAME_TIME = 1000 / FPS_TARGET; // ~16.67 ms\nexport const MAX_FRAME_TIME = 18; // p95 threshold\n\n/** Legacy frame-rate targets kept for backward compatibility. */\nexport const FPS_TARGETS = {\n PAN_MIN: 30,\n ZOOM_TARGET: 60,\n WARNING_THRESHOLD: 20,\n} as const;\n\n// ── Timing Thresholds (ms) ────────────────────────────────────────────────────\n\nexport const TIMING_THRESHOLDS = {\n VIEWPORT_QUERY_MAX: 5,\n SPATIAL_UPDATE_MAX: 10,\n DRAG_RESPONSE_MAX: 16,\n LOAD_5K_TARGET: 2000,\n LOAD_10K_TARGET: 3000,\n VIEWPORT_DEBOUNCE: 100,\n SPATIAL_INDEX_BUILD: 50,\n} as const;\n\n// ── Memory Limits (MB) ────────────────────────────────────────────────────────\n\nexport const MEMORY_TARGET_MB = 500;\nexport const MEMORY_WARNING_MB = 600;\nexport const MEMORY_CRITICAL_MB = 800;\n\nexport const MEMORY_LIMITS = {\n MAX_10K_NODES: 500,\n MAX_GROWTH_PERCENT: 20,\n WARNING_THRESHOLD: 400,\n} as const;\n\n// ── Viewport Culling ──────────────────────────────────────────────────────────\n\nexport const VIEWPORT_MARGIN = 0.1;\nexport const MAX_VISIBLE_NODES = 800;\nexport const CULLING_QUERY_TIME_BUDGET = 5;\n\n// ── Spatial Index ─────────────────────────────────────────────────────────────\n\nexport const RBUSH_MAX_ENTRIES = 16;\nexport const SPATIAL_INDEX_BUILD_BUDGET = 50;\n\n// ── Zoom Constraints ──────────────────────────────────────────────────────────\n\n// Zoom limits: the design system's VIEW (geometry/interaction.ts; equal to the zoom-min / zoom-max tokens).\nexport const ZOOM_MIN = VIEW.zoomMin;\nexport const ZOOM_MAX = VIEW.zoomMax;\nexport const ZOOM_DEFAULT = 1.0;\n\n// ── Quality Level Presets ─────────────────────────────────────────────────────\n\nexport const QUALITY_HIGH = {\n shadows: true,\n bezierCurves: true,\n animations: true,\n textQuality: 'high' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_MEDIUM = {\n shadows: false,\n bezierCurves: true,\n animations: true,\n textQuality: 'medium' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_LOW = {\n shadows: false,\n bezierCurves: false,\n animations: false,\n textQuality: 'low' as const,\n antialiasing: false,\n};\n\n// ── Performance Monitoring ────────────────────────────────────────────────────\n\nexport const FPS_SAMPLE_WINDOW = 60;\nexport const FPS_UPDATE_INTERVAL = 1000;\nexport const MEMORY_CHECK_INTERVAL = 5000;\nexport const PERFORMANCE_TOAST_COOLDOWN = 10000;\n\n// ── Auto-Adjustment ───────────────────────────────────────────────────────────\n\nexport const FPS_DOWNGRADE_THRESHOLD = 45;\nexport const FPS_UPGRADE_THRESHOLD = 58;\nexport const FPS_STABILIZATION_FRAMES = 180;\n\n// ── Canvas Dimensions ─────────────────────────────────────────────────────────\n\nexport const DEFAULT_CANVAS_WIDTH = 1920;\nexport const DEFAULT_CANVAS_HEIGHT = 1080;\n\n// ── Interaction ───────────────────────────────────────────────────────────────\n\nexport const CLICK_THRESHOLD = 5;\nexport const DOUBLE_CLICK_DELAY = 300;\nexport const DRAG_START_DISTANCE = 10;\n\n// ── Data Validation ───────────────────────────────────────────────────────────\n\nexport const MAX_NODES = 20000;\nexport const CIRCULAR_REFERENCE_MAX_DEPTH = 1000;\n\n// ── Debounce / Throttle ───────────────────────────────────────────────────────\n\nexport const RESIZE_DEBOUNCE = 300;\nexport const SCROLL_THROTTLE = 16;\nexport const SEARCH_DEBOUNCE = 500;\n\n/** Node count thresholds that gate optimisation strategies. */\nexport const NODE_COUNT_THRESHOLDS = {\n SPATIAL_INDEX_MIN: 100,\n VIEWPORT_CULLING_MIN: 500,\n CANVAS_RENDERING_MIN: 2000,\n DOM_RENDERING_MAX: 5000,\n} as const;\n\n/** Viewport buffer configuration. */\nexport const VIEWPORT_CONFIG = {\n BUFFER_PERCENT: 0.2,\n MIN_VISIBLE_NODES: 10,\n} as const;\n"],"mappings":";AAOO,IAAM,OAAO;AAAA;AAAA,EAC4C,WAAW;AAAA;AAAA,EAC+C,YAAY;AAAA;AAAA,EACrE,eAAe,CAAC,OAAO;AAAA;AAAA,EACqC,WAAW;AAAA;AAAA,EACf,cAAc;AAAA,EAAM,oBAAoB;AAAA;AAAA,EAC3E,iBAAiB;AAAA;AAAA,EACxB,gBAAgB;AAAA;AAAA,EAC1C,gBAAgB;AACrE;AAGO,IAAM,OAAO;AAAA;AAAA;AAAA,EAE8E,YAAY;AAC9G;AAGO,IAAM,QAAQ;AAAA;AAAA,EAC8F,aAAa;AAAA,EAAI,YAAY;AAAA;AAAA,EACtB,aAAa;AAAA,EAAM,WAAW;AACxJ;AAGO,IAAM,OAAO;AAAA;AAAA,EAC4C,UAAU;AAAA;AAAA,EACU,SAAS;AAAA,EAAK,SAAS;AAAA;AAAA,EAClD,QAAQ;AACjE;AAIO,IAAM,UAAU;AAAA;AAAA;AAAA,EAEuG,WAAW;AAAA;AAAA,EACzF,cAAc;AAAA;AAAA,EACD,UAAU,CAAC,OAAO;AAAA;AAAA;AAAA;AAAA,EAGU,gBAAgB;AAAA,EAAQ,qBAAqB;AAAA;AAAA;AAAA,EAEtC,SAAS;AAAA,EACvG,aAAa,CAAC,SAAS,KAAK;AAAA,EAAwB,SAAS;AAAA;AAAA;AAAA,EAG7D,cAAc,EAAE,OAAO,GAAG,OAAO,GAAG;AAAA;AAAA;AAAA,EAEP,eAAe;AAC9C;AAGO,SAAS,UAAU,W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,6BAA6B;AAKnC,IAAM,WAAwB,KAAK;AACnC,IAAM,WAAwB,KAAK;AACnC,IAAM,eAAwB;AAI9B,IAAM,eAAe;AAAA,EAC1B,SAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAc;AAAA,EACd,aAAc;AAAA,EACd,cAAc;AAChB;AAEO,IAAM,iBAAiB;AAAA,EAC5B,SAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAc;AAAA,EACd,aAAc;AAAA,EACd,cAAc;AAChB;AAEO,IAAM,cAAc;AAAA,EACzB,SAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAc;AAAA,EACd,aAAc;AAAA,EACd,cAAc;AAChB;AAIO,IAAM,oBAA6B;AACnC,IAAM,sBAA6B;AACnC,IAAM,wBAA6B;AACnC,IAAM,6BAA6B;AAInC,IAAM,0BAA6B;AACnC,IAAM,wBAA6B;AACnC,IAAM,2BAA6B;AAInC,IAAM,uBAAwB;AAC9B,IAAM,wBAAwB;AAI9B,IAAM,kBAAuB;AAC7B,IAAM,qBAAuB;AAC7B,IAAM,sBAAuB;AAI7B,IAAM,YAA+B;AACrC,IAAM,+BAA+B;AAIrC,IAAM,kBAAmB;AACzB,IAAM,kBAAmB;AACzB,IAAM,kBAAmB;AAGzB,IAAM,wBAAwB;AAAA,EACnC,mBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,mBAAsB;AACxB;AAGO,IAAM,kBAAkB;AAAA,EAC7B,gBAAkB;AAAA,EAClB,mBAAmB;AACrB;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
VIEWPORT_MARGIN,
|
|
5
5
|
ZOOM_MAX,
|
|
6
6
|
ZOOM_MIN
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KUW3GHKQ.js";
|
|
8
8
|
|
|
9
9
|
// src/viewport/viewportUtils.ts
|
|
10
10
|
function calculateViewportBounds(viewport, canvasWidth = DEFAULT_CANVAS_WIDTH, canvasHeight = DEFAULT_CANVAS_HEIGHT) {
|
|
@@ -92,4 +92,4 @@ export {
|
|
|
92
92
|
focusOnNode,
|
|
93
93
|
isNodeInViewport
|
|
94
94
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
95
|
+
//# sourceMappingURL=chunk-XMD5FYME.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/index.ts","../../src/generated/geometry/interaction.ts","../../src/constants/performanceConstants.ts","../../src/constants/layout.ts","../../src/constants/renderConfig.ts"],"sourcesContent":["export * from './performanceConstants.js';\nexport * from './layout.js';\nexport * from './renderConfig.js';\n","// Generated from visualli.ai design-system/components/src/interaction.ts — do not edit here.\n/* How the canvas answers the pointer and the keyboard — the timing and rules behind the peek (an idea's summary)\n and terms (semantic anchors: an underlined word and its definition card). The look and the pop-in animation live\n in the CSS (.vi-fact, .vi-anchor, .vi-anchor-card); these are the behaviours, as data, so every renderer (VisualMap,\n the spec SDK on a canvas) opens and closes them alike. Times in ms. No dependencies, so it can travel alone. */\n\n/** Terms (semantic anchors) in a peek's text. */\nexport const TERM = {\n /** Hovering the term this long opens its definition card… */ hoverOpen: 250,\n /** …which closes this long after the pointer leaves both the term and the card (moving between them keeps it open). */ hoverClose: 300,\n /** Only a mouse opens on hover; touch and pen open on tap. */ hoverPointers: ['mouse'] as readonly string[],\n /** A click, tap, Enter or Space pins the card open (hovering away doesn't close it); pressing again unpins and closes. */ clickPins: true,\n /** Escape closes the card and returns focus to the term; a press anywhere outside the term and its card closes it. */ escapeCloses: true, pressOutsideCloses: true,\n /** Opening by click or keyboard moves focus to the card's first link or button. */ focusCardOnOpen: true,\n /** The card is kept this far inside the viewport's left and right edges. */ viewportMargin: 8,\n /** The card's link to a source about the term. */ learnMoreLabel: 'Learn more',\n} as const;\n\n/** The peek: an idea's summary card on hover (pointer) or tap (touch). */\nexport const PEEK = {\n /** Hovering an idea opens its peek at once; it stays this long after the pointer leaves the idea (and while the\n * pointer is over the peek itself), so the pointer can travel from the idea onto the card. */ hoverClose: 180,\n} as const;\n\n/** The touch peek: a bottom sheet with a grip. */\nexport const SHEET = {\n /** Dragging the grip down this far closes the sheet (or collapses it when expanded); up this far expands it. */ dismissDrag: 80, expandDrag: 40,\n /** Its height: this share of the map, at most `maxHeight` px; the map pans the chosen idea into the space above it. */ heightRatio: 0.42, maxHeight: 300,\n} as const;\n\n/** Zoom, pan and fit. */\nexport const VIEW = {\n /** Each zoom step multiplies or divides the zoom by this. */ zoomStep: 1.2,\n /** Zoom limits (the zoom-min / zoom-max tokens; the build checks they agree). */ zoomMin: 0.3, zoomMax: 5,\n /** Fit to view never enlarges a layer beyond this. */ fitMax: 1.1,\n} as const;\n\n/** Touch gestures on the map (any touch input — phones, tablets and touchscreen laptops alike; it follows the pointer\n * in use, not the device, so a mouse or trackpad on the same laptop isn't affected). */\nexport const GESTURE = {\n /** Two fingers pinch to zoom the map's contents — ideas, connectors, containers and their labels — around the\n * point between the fingers, within VIEW's limits. Controls, the depth trail, the peek, chat and the page never scale. */ pinchZoom: true,\n /** Moving both fingers pans the contents. */ twoFingerPan: true,\n /** The pointers that pinch (PointerEvent.pointerType). */ pointers: ['touch'] as readonly string[],\n /** Where the map is the page (an app: AppShell, the mobile app), it takes every touch gesture (touch-action: none),\n * so the browser never zooms the page. Embedded on a scrolling page (website, docs), one finger still scrolls the\n * page (touch-action: pan-x pan-y); two fingers that land together pinch the map. */ appTouchAction: 'none', embeddedTouchAction: 'pan-x pan-y',\n /** Press and move on the empty canvas to pan the contents (mouse and pen; touch pans with two fingers, so one finger\n * still scrolls an embedded page). A press that moves less than `panSlop` px is a click. */ dragPan: true,\n panPointers: ['mouse', 'pen'] as readonly string[], panSlop: 6,\n /** Moving an idea starts once the press has moved this far (px), by pointerModeFor: a mouse ('hover') sooner, a finger\n * or pen ('touch') later, so taps still work. */\n ideaDragSlop: { hover: 4, touch: 10 },\n /** Zoom never navigates: stepping inside and backing out stay explicit (tap an idea / Step inside, the depth trail,\n * Escape or Backspace). */ zoomNavigates: false,\n} as const;\n\n/** The zoom after a pinch: the zoom at the start, scaled by how far the fingers spread, within VIEW's limits. */\nexport function pinchZoom(startZoom: number, startDistance: number, distance: number): number {\n const z = startZoom * (distance / Math.max(startDistance, 1));\n return Math.min(VIEW.zoomMax, Math.max(VIEW.zoomMin, z));\n}\n\n/** Keeps the map point that was under `from` under `to` when the scale changes from `s0` to `s1`: the new\n * translation, given the old one (screen = world × s + t). Used to zoom around the fingers. */\nexport function zoomAround(t0: { x: number; y: number }, s0: number, s1: number, from: { x: number; y: number }, to: { x: number; y: number }): { x: number; y: number } {\n const wx = (from.x - t0.x) / s0, wy = (from.y - t0.y) / s0;\n return { x: to.x - wx * s1, y: to.y - wy * s1 };\n}\n\n/** Framing a layer (fit to view): its ideas with room around them, and its container hulls with room for the name pill. */\nexport const FRAME = {\n /** Room beyond each idea's outline (at least `minPadX` / `minPadY` from its centre). */ clearX: 50, clearY: 46, minPadX: 150, minPadY: 120,\n /** Room beyond each container hull for its dashed line and the name pill straddling it. */ hullX: 24, hullY: 40,\n} as const;\nexport type FrameBox = { x0: number; y0: number; x1: number; y1: number };\n\n/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. */\nexport function layerBounds(ideas: ReadonlyArray<{ x: number; y: number; rx: number; ry: number }>, hulls: ReadonlyArray<FrameBox> = []): FrameBox {\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const n of ideas) {\n const px = Math.max(FRAME.minPadX, n.rx + FRAME.clearX), py = Math.max(FRAME.minPadY, n.ry + FRAME.clearY);\n x0 = Math.min(x0, n.x - px); x1 = Math.max(x1, n.x + px); y0 = Math.min(y0, n.y - py); y1 = Math.max(y1, n.y + py);\n }\n for (const h of hulls) { x0 = Math.min(x0, h.x0 - FRAME.hullX); x1 = Math.max(x1, h.x1 + FRAME.hullX); y0 = Math.min(y0, h.y0 - FRAME.hullY); y1 = Math.max(y1, h.y1 + FRAME.hullY); }\n if (!Number.isFinite(x0)) return { x0: -FRAME.minPadX, y0: -FRAME.minPadY, x1: FRAME.minPadX, y1: FRAME.minPadY };\n return { x0, y0, x1, y1 };\n}\n\n/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the\n * world point to centre. */\nexport function fitView(bounds: FrameBox, width: number, height: number): { scale: number; center: { x: number; y: number } } {\n const scale = Math.min(width / Math.max(1, bounds.x1 - bounds.x0), height / Math.max(1, bounds.y1 - bounds.y0), VIEW.fitMax);\n return { scale, center: { x: (bounds.x0 + bounds.x1) / 2, y: (bounds.y0 + bounds.y1) / 2 } };\n}\n\n/** Insets: room the host's chrome takes at each edge of the map (a docked Vault, a top bar, the Composer). */\nexport type FrameInsets = { top?: number; right?: number; bottom?: number; left?: number };\n/** The smallest free area a map is ever fitted into, however much the insets take. */\nexport const FIT_ROOM = { minWidth: 200, minHeight: 160 } as const;\n\n/** Fit to view inside insets. The map's canvas fills its whole frame - so the canvas itself and its chromatic immersion\n * run behind the host's chrome (a docked Vault floats over the tinted canvas) - while the layer is fitted into the\n * free area (the frame less the insets, never below FIT_ROOM) and centred in it. `screen`: where on the canvas the\n * world `center` goes (screen = world × scale + translation); `room`: the free area's size. With no insets this is\n * fitView, centred on the canvas. */\nexport function fitViewInset(bounds: FrameBox, width: number, height: number, insets: FrameInsets = {}): { scale: number; center: { x: number; y: number }; screen: { x: number; y: number }; room: { width: number; height: number } } {\n const top = insets.top ?? 0, right = insets.right ?? 0, bottom = insets.bottom ?? 0, left = insets.left ?? 0;\n const w = Math.max(FIT_ROOM.minWidth, width - left - right), h = Math.max(FIT_ROOM.minHeight, height - top - bottom);\n const { scale, center } = fitView(bounds, w, h);\n return { scale, center, screen: { x: left + w / 2, y: top + h / 2 }, room: { width: w, height: h } };\n}\n\n/** Where the peek card sits (pointer): beside the idea — right of it if it fits, else left — and level with it. */\nexport const PEEK_PLACEMENT = {\n /** Gap between the idea's outermost ring and the card. */ gap: 16,\n /** The card's width and the height kept clear below it. */ cardWidth: 300, cardHeight: 220,\n /** The card is raised this much above the idea's centre. */ raise: 70,\n /** Kept this far inside the map's edges. */ margin: 12,\n} as const;\n\n/** The peek card's top-left, in map (screen) pixels. `idea`: the idea's centre on screen and its on-screen half\n * width with its outermost ring (`half`); `box`: the map's size. */\nexport function peekPosition(idea: { x: number; y: number; half: number }, box: { w: number; h: number }, card: { w: number; h: number } = { w: PEEK_PLACEMENT.cardWidth, h: PEEK_PLACEMENT.cardHeight }) {\n const P = PEEK_PLACEMENT, half = idea.half + P.gap;\n const right = idea.x + half + card.w < box.w - P.margin;\n return { left: right ? idea.x + half : Math.max(P.margin, idea.x - half - card.w), top: Math.min(Math.max(P.margin, idea.y - P.raise), box.h - card.h), side: right ? 'right' as const : 'left' as const };\n}\n\n/** The depth trail: each entry shows the idea that was stepped into — its title and a dot in its color (the same\n * topic or custom color the idea is drawn in, including the sibling-order topic of an uncolored idea). The first\n * entry is the map itself: a `stone` dot and the home glyph only (`rootLabel: 'icon'`) — no text, since a map's title\n * usually repeats its centre idea's, which the next entry shows; its accessible name and tooltip are the map's title.\n * The dot is the idea shape (shapeForLevel). */\nexport const TRAIL = { rootTopic: 'stone', rootLabel: 'icon', homeIconSize: 12, dotBox: 16, dotRadius: 6.4, stroke: 1.25, currentStroke: 1.75 } as const;\n\n/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */\nexport function pointerModeFor(pointerType: string): 'hover' | 'touch' | null {\n return pointerType === 'mouse' ? 'hover' : pointerType === 'touch' || pointerType === 'pen' ? 'touch' : null;\n}\n\n/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */\nexport function hoverOpensTerm(pointerType: string): boolean {\n return TERM.hoverPointers.includes(pointerType);\n}\n","// ─── Performance & Rendering Constants ───────────────────────────────────────\n//\n// Performance budgets and interaction thresholds. Visual values (colours,\n// stroke widths, node size, zoom range) come from the design system tokens.\n\nimport { VIEW } from '../generated/geometry/interaction.js';\n\n// ── FPS ───────────────────────────────────────────────────────────────────────\n\nexport const FPS_TARGET = 60;\nexport const FPS_WARNING_THRESHOLD = 45;\nexport const FPS_CRITICAL_THRESHOLD = 30;\nexport const TARGET_FRAME_TIME = 1000 / FPS_TARGET; // ~16.67 ms\nexport const MAX_FRAME_TIME = 18; // p95 threshold\n\n/** Legacy frame-rate targets kept for backward compatibility. */\nexport const FPS_TARGETS = {\n PAN_MIN: 30,\n ZOOM_TARGET: 60,\n WARNING_THRESHOLD: 20,\n} as const;\n\n// ── Timing Thresholds (ms) ────────────────────────────────────────────────────\n\nexport const TIMING_THRESHOLDS = {\n VIEWPORT_QUERY_MAX: 5,\n SPATIAL_UPDATE_MAX: 10,\n DRAG_RESPONSE_MAX: 16,\n LOAD_5K_TARGET: 2000,\n LOAD_10K_TARGET: 3000,\n VIEWPORT_DEBOUNCE: 100,\n SPATIAL_INDEX_BUILD: 50,\n} as const;\n\n// ── Memory Limits (MB) ────────────────────────────────────────────────────────\n\nexport const MEMORY_TARGET_MB = 500;\nexport const MEMORY_WARNING_MB = 600;\nexport const MEMORY_CRITICAL_MB = 800;\n\nexport const MEMORY_LIMITS = {\n MAX_10K_NODES: 500,\n MAX_GROWTH_PERCENT: 20,\n WARNING_THRESHOLD: 400,\n} as const;\n\n// ── Viewport Culling ──────────────────────────────────────────────────────────\n\nexport const VIEWPORT_MARGIN = 0.1;\nexport const MAX_VISIBLE_NODES = 800;\nexport const CULLING_QUERY_TIME_BUDGET = 5;\n\n// ── Spatial Index ─────────────────────────────────────────────────────────────\n\nexport const RBUSH_MAX_ENTRIES = 16;\nexport const SPATIAL_INDEX_BUILD_BUDGET = 50;\n\n// ── Zoom Constraints ──────────────────────────────────────────────────────────\n\n// Zoom limits: the design system's VIEW (geometry/interaction.ts; equal to the zoom-min / zoom-max tokens).\nexport const ZOOM_MIN = VIEW.zoomMin;\nexport const ZOOM_MAX = VIEW.zoomMax;\nexport const ZOOM_DEFAULT = 1.0;\n\n// ── Quality Level Presets ─────────────────────────────────────────────────────\n\nexport const QUALITY_HIGH = {\n shadows: true,\n bezierCurves: true,\n animations: true,\n textQuality: 'high' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_MEDIUM = {\n shadows: false,\n bezierCurves: true,\n animations: true,\n textQuality: 'medium' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_LOW = {\n shadows: false,\n bezierCurves: false,\n animations: false,\n textQuality: 'low' as const,\n antialiasing: false,\n};\n\n// ── Performance Monitoring ────────────────────────────────────────────────────\n\nexport const FPS_SAMPLE_WINDOW = 60;\nexport const FPS_UPDATE_INTERVAL = 1000;\nexport const MEMORY_CHECK_INTERVAL = 5000;\nexport const PERFORMANCE_TOAST_COOLDOWN = 10000;\n\n// ── Auto-Adjustment ───────────────────────────────────────────────────────────\n\nexport const FPS_DOWNGRADE_THRESHOLD = 45;\nexport const FPS_UPGRADE_THRESHOLD = 58;\nexport const FPS_STABILIZATION_FRAMES = 180;\n\n// ── Canvas Dimensions ─────────────────────────────────────────────────────────\n\nexport const DEFAULT_CANVAS_WIDTH = 1920;\nexport const DEFAULT_CANVAS_HEIGHT = 1080;\n\n// ── Interaction ───────────────────────────────────────────────────────────────\n\nexport const CLICK_THRESHOLD = 5;\nexport const DOUBLE_CLICK_DELAY = 300;\nexport const DRAG_START_DISTANCE = 10;\n\n// ── Data Validation ───────────────────────────────────────────────────────────\n\nexport const MAX_NODES = 20000;\nexport const CIRCULAR_REFERENCE_MAX_DEPTH = 1000;\n\n// ── Debounce / Throttle ───────────────────────────────────────────────────────\n\nexport const RESIZE_DEBOUNCE = 300;\nexport const SCROLL_THROTTLE = 16;\nexport const SEARCH_DEBOUNCE = 500;\n\n/** Node count thresholds that gate optimisation strategies. */\nexport const NODE_COUNT_THRESHOLDS = {\n SPATIAL_INDEX_MIN: 100,\n VIEWPORT_CULLING_MIN: 500,\n CANVAS_RENDERING_MIN: 2000,\n DOM_RENDERING_MAX: 5000,\n} as const;\n\n/** Viewport buffer configuration. */\nexport const VIEWPORT_CONFIG = {\n BUFFER_PERCENT: 0.2,\n MIN_VISIBLE_NODES: 10,\n} as const;\n","// ─── Layout constants ────────────────────────────────────────────────────────\n//\n// Non-visual layout metrics (world units). Everything visual (colours, fonts,\n// radii, spacing, motion) comes from the design system: see ../theme.\n\nexport const LAYOUT_SPACING = {\n nodeSpacing: 200,\n levelSpacing: 150,\n containerPadding: 20,\n gridSize: 50,\n} as const;\n","// ─── Render Configuration ─────────────────────────────────────────────────────\n\nimport type { RenderConfig } from '../types/mindmap.js';\nimport {\n FPS_TARGET,\n MEMORY_TARGET_MB,\n QUALITY_HIGH,\n QUALITY_MEDIUM,\n QUALITY_LOW,\n NODE_COUNT_THRESHOLDS,\n} from './performanceConstants.js';\n\n// ── Defaults ──────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_RENDER_CONFIG: RenderConfig = {\n renderMode: 'canvas',\n qualityLevel: 'high',\n cullingEnabled: false,\n fpsTarget: FPS_TARGET,\n memoryLimit: MEMORY_TARGET_MB,\n};\n\nexport const SIMPLIFIED_RENDER_CONFIG: RenderConfig = {\n renderMode: 'simplified',\n qualityLevel: 'low',\n cullingEnabled: true,\n fpsTarget: 30,\n memoryLimit: 400,\n};\n\n// ── Quality Map ───────────────────────────────────────────────────────────────\n\nexport const QUALITY_SETTINGS = {\n high: QUALITY_HIGH,\n medium: QUALITY_MEDIUM,\n low: QUALITY_LOW,\n} as const;\n\n// ── Feature Flags ─────────────────────────────────────────────────────────────\n\nexport const FEATURE_FLAGS = {\n viewportCulling: true,\n spatialIndexing: true,\n shadows: true,\n bezierCurves: true,\n animations: true,\n branchBadges: true,\n autoQualityAdjustment: true,\n performanceMonitoring: true,\n performanceToasts: true,\n debugOverlay: false,\n showFPS: false,\n showMemory: false,\n showVisibleCount: false,\n} as const;\n\n// ── Render Modes ──────────────────────────────────────────────────────────────\n\nexport type RenderMode = RenderConfig['renderMode'];\nexport type QualityLevel = RenderConfig['qualityLevel'];\n\nexport const RENDER_MODES = {\n canvas: {\n name: 'Canvas',\n description: 'Full Konva canvas rendering with all features',\n features: { culling: true, shadows: true, bezierCurves: true, animations: true },\n },\n simplified: {\n name: 'Simplified',\n description: 'Reduced feature set for low-end devices',\n features: { culling: true, shadows: false, bezierCurves: false, animations: false },\n },\n} as const;\n\nexport const QUALITY_LEVELS = {\n high: { name: 'High', description: 'All visual features enabled', targetFPS: 60, features: QUALITY_HIGH },\n medium: { name: 'Medium', description: 'Shadows disabled, other features enabled', targetFPS: 60, features: QUALITY_MEDIUM },\n low: { name: 'Low', description: 'Minimal visual features, max performance', targetFPS: 30, features: QUALITY_LOW },\n} as const;\n\n// ── Auto-Adjustment Helpers ───────────────────────────────────────────────────\n\nexport function getOptimalQualityLevel(\n currentFPS: number,\n currentQuality: QualityLevel,\n): QualityLevel {\n if (currentFPS < 45 && currentQuality === 'high') return 'medium';\n if (currentFPS < 30 && currentQuality === 'medium') return 'low';\n if (currentFPS > 58 && currentQuality === 'low') return 'medium';\n if (currentFPS > 58 && currentQuality === 'medium') return 'high';\n return currentQuality;\n}\n\nexport function getRenderConfigForQuality(quality: QualityLevel): Partial<RenderConfig> {\n return { qualityLevel: quality, fpsTarget: QUALITY_LEVELS[quality].targetFPS };\n}\n\nexport function isFeatureEnabled(\n featureName: keyof typeof FEATURE_FLAGS,\n config: RenderConfig,\n): boolean {\n if (!FEATURE_FLAGS[featureName]) return false;\n\n const qs = QUALITY_SETTINGS[config.qualityLevel];\n switch (featureName) {\n case 'shadows': return qs.shadows;\n case 'bezierCurves': return qs.bezierCurves;\n case 'animations': return qs.animations;\n default: return FEATURE_FLAGS[featureName] as boolean;\n }\n}\n\n// ── Device Detection ──────────────────────────────────────────────────────────\n\n/**\n * Recommend a render config based on detected device memory (browser only).\n * Falls back to SIMPLIFIED_RENDER_CONFIG when the Performance Memory API is\n * unavailable or memory is constrained.\n */\nexport function getRecommendedRenderConfig(): RenderConfig {\n if (typeof performance === 'undefined' || !(performance as unknown as Record<string, unknown>)['memory']) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n const memory = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number>;\n if (memory?.['jsHeapSizeLimit'] && memory['jsHeapSizeLimit'] < 512 * 1024 * 1024) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n return DEFAULT_RENDER_CONFIG;\n}\n\n/** Re-export so consumers need only one import. */\nexport { NODE_COUNT_THRESHOLDS };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC+BO,IAAM,OAAO;AAAA;AAAA,EAC4C,UAAU;AAAA;AAAA,EACU,SAAS;AAAA,EAAK,SAAS;AAAA;AAAA,EAClD,QAAQ;AACjE;;;AC1BO,IAAM,aAA6B;AACnC,IAAM,wBAA6B;AACnC,IAAM,yBAA6B;AACnC,IAAM,oBAA6B,MAAO;AAC1C,IAAM,iBAA6B;AAGnC,IAAM,cAAc;AAAA,EACzB,SAAmB;AAAA,EACnB,aAAmB;AAAA,EACnB,mBAAmB;AACrB;AAIO,IAAM,oBAAoB;AAAA,EAC/B,oBAAuB;AAAA,EACvB,oBAAuB;AAAA,EACvB,mBAAuB;AAAA,EACvB,gBAAuB;AAAA,EACvB,iBAAuB;AAAA,EACvB,mBAAuB;AAAA,EACvB,qBAAuB;AACzB;AAIO,IAAM,mBAAqB;AAC3B,IAAM,oBAAqB;AAC3B,IAAM,qBAAqB;AAE3B,IAAM,gBAAgB;AAAA,EAC3B,eAAqB;AAAA,EACrB,oBAAqB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AAa,MAAM,mBAAmB,MAAU,QAAO;AAC3D,MAAI,aAAa,MAAM,mBAAmB,SAAU,QAAO;AAC3D,SAAO;AACT;AAEO,SAAS,0BAA0B,SAA8C;AACtF,SAAO,EAAE,cAAc,SAAS,WAAW,eAAe,OAAO,EAAE,UAAU;AAC/E;AAEO,SAAS,iBACd,aACA,QACS;AACT,MAAI,CAAC,cAAc,WAAW,EAAG,QAAO;AAExC,QAAM,KAAK,iBAAiB,OAAO,YAAY;AAC/C,UAAQ,aAAa;AAAA,IACnB,KAAK;AAAgB,aAAO,GAAG;AAAA,IAC/B,KAAK;AAAgB,aAAO,GAAG;AAAA,IAC/B,KAAK;AAAgB,aAAO,GAAG;AAAA,IAC/B;AAAqB,aAAO,cAAc,WAAW;AAAA,EACvD;AACF;AASO,SAAS,6BAA2C;AACzD,MAAI,OAAO,gBAAgB,eAAe,CAAE,YAAmD,QAAQ,GAAG;AACxG,WAAO;AAAA,EACT;AAEA,QAAM,SAAU,YAAmD,QAAQ;AAC3E,MAAI,SAAS,iBAAiB,KAAK,OAAO,iBAAiB,IAAI,MAAM,OAAO,MAAM;AAChF,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/constants/index.ts","../../src/generated/geometry/interaction.ts","../../src/constants/performanceConstants.ts","../../src/constants/layout.ts","../../src/constants/renderConfig.ts"],"sourcesContent":["export * from './performanceConstants.js';\nexport * from './layout.js';\nexport * from './renderConfig.js';\n","// Generated from visualli.ai design-system/components/src/interaction.ts — do not edit here.\n/* How the canvas answers the pointer and the keyboard — the timing and rules behind the peek (an idea's summary)\n and terms (semantic anchors: an underlined word and its definition card). The look and the pop-in animation live\n in the CSS (.vi-fact, .vi-anchor, .vi-anchor-card); these are the behaviours, as data, so every renderer (VisualMap,\n the spec SDK on a canvas) opens and closes them alike. Times in ms. No dependencies, so it can travel alone. */\n\n/** Terms (semantic anchors) in a peek's text. */\nexport const TERM = {\n /** Hovering the term this long opens its definition card… */ hoverOpen: 250,\n /** …which closes this long after the pointer leaves both the term and the card (moving between them keeps it open). */ hoverClose: 300,\n /** Only a mouse opens on hover; touch and pen open on tap. */ hoverPointers: ['mouse'] as readonly string[],\n /** A click, tap, Enter or Space pins the card open (hovering away doesn't close it); pressing again unpins and closes. */ clickPins: true,\n /** Escape closes the card and returns focus to the term; a press anywhere outside the term and its card closes it. */ escapeCloses: true, pressOutsideCloses: true,\n /** Opening by click or keyboard moves focus to the card's first link or button. */ focusCardOnOpen: true,\n /** The card is kept this far inside the viewport's left and right edges. */ viewportMargin: 8,\n /** The card's link to a source about the term. */ learnMoreLabel: 'Learn more',\n} as const;\n\n/** The peek: an idea's summary card on hover (pointer) or tap (touch). */\nexport const PEEK = {\n /** Hovering an idea opens its peek at once; it stays this long after the pointer leaves the idea (and while the\n * pointer is over the peek itself), so the pointer can travel from the idea onto the card. */ hoverClose: 180,\n} as const;\n\n/** The touch peek: a bottom sheet with a grip. */\nexport const SHEET = {\n /** Dragging the grip down this far closes the sheet (or collapses it when expanded); up this far expands it. */ dismissDrag: 80, expandDrag: 40,\n /** Its height: this share of the map, at most `maxHeight` px; the map pans the chosen idea into the space above it. */ heightRatio: 0.42, maxHeight: 300,\n} as const;\n\n/** Zoom, pan and fit. */\nexport const VIEW = {\n /** Each zoom step multiplies or divides the zoom by this. */ zoomStep: 1.2,\n /** Zoom limits (the zoom-min / zoom-max tokens; the build checks they agree). */ zoomMin: 0.3, zoomMax: 5,\n /** Fit to view never enlarges a layer beyond this. */ fitMax: 1.1,\n} as const;\n\n/** Touch gestures on the map (any touch input — phones, tablets and touchscreen laptops alike; it follows the pointer\n * in use, not the device, so a mouse or trackpad on the same laptop isn't affected). */\nexport const GESTURE = {\n /** Two fingers pinch to zoom the map's contents — ideas, connectors, containers and their labels — around the\n * point between the fingers, within VIEW's limits. Controls, the depth trail, the peek, chat and the page never scale. */ pinchZoom: true,\n /** Moving both fingers pans the contents. */ twoFingerPan: true,\n /** The pointers that pinch (PointerEvent.pointerType). */ pointers: ['touch'] as readonly string[],\n /** Where the map is the page (an app: AppShell, the mobile app), it takes every touch gesture (touch-action: none),\n * so the browser never zooms the page. Embedded on a scrolling page (website, docs), one finger still scrolls the\n * page (touch-action: pan-x pan-y); two fingers that land together pinch the map. */ appTouchAction: 'none', embeddedTouchAction: 'pan-x pan-y',\n /** Press and move on the empty canvas to pan the contents (mouse and pen; touch pans with two fingers, so one finger\n * still scrolls an embedded page). A press that moves less than `panSlop` px is a click. */ dragPan: true,\n panPointers: ['mouse', 'pen'] as readonly string[], panSlop: 6,\n /** Moving an idea starts once the press has moved this far (px), by pointerModeFor: a mouse ('hover') sooner, a finger\n * or pen ('touch') later, so taps still work. */\n ideaDragSlop: { hover: 4, touch: 10 },\n /** Zoom never navigates: stepping inside and backing out stay explicit (tap an idea / Step inside, the depth trail,\n * Escape or Backspace). */ zoomNavigates: false,\n} as const;\n\n/** The zoom after a pinch: the zoom at the start, scaled by how far the fingers spread, within VIEW's limits. */\nexport function pinchZoom(startZoom: number, startDistance: number, distance: number): number {\n const z = startZoom * (distance / Math.max(startDistance, 1));\n return Math.min(VIEW.zoomMax, Math.max(VIEW.zoomMin, z));\n}\n\n/** Keeps the map point that was under `from` under `to` when the scale changes from `s0` to `s1`: the new\n * translation, given the old one (screen = world × s + t). Used to zoom around the fingers. */\nexport function zoomAround(t0: { x: number; y: number }, s0: number, s1: number, from: { x: number; y: number }, to: { x: number; y: number }): { x: number; y: number } {\n const wx = (from.x - t0.x) / s0, wy = (from.y - t0.y) / s0;\n return { x: to.x - wx * s1, y: to.y - wy * s1 };\n}\n\n/** Framing a layer (fit to view): its ideas with room around them, and its container hulls with room for the name pill. */\nexport const FRAME = {\n /** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */ ring: 0.3, clearX: 16, clearY: 16,\n /** Room beyond each container hull for its dashed line and the name pill straddling it. */ hullX: 24, hullY: 40,\n} as const;\nexport type FrameBox = { x0: number; y0: number; x1: number; y1: number };\n\n/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. */\nexport function layerBounds(ideas: ReadonlyArray<{ x: number; y: number; rx: number; ry: number }>, hulls: ReadonlyArray<FrameBox> = []): FrameBox {\n let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;\n for (const n of ideas) {\n const px = n.rx * (1 + FRAME.ring) + FRAME.clearX, py = n.ry * (1 + FRAME.ring) + FRAME.clearY;\n x0 = Math.min(x0, n.x - px); x1 = Math.max(x1, n.x + px); y0 = Math.min(y0, n.y - py); y1 = Math.max(y1, n.y + py);\n }\n for (const h of hulls) { x0 = Math.min(x0, h.x0 - FRAME.hullX); x1 = Math.max(x1, h.x1 + FRAME.hullX); y0 = Math.min(y0, h.y0 - FRAME.hullY); y1 = Math.max(y1, h.y1 + FRAME.hullY); }\n if (!Number.isFinite(x0)) return { x0: -150, y0: -120, x1: 150, y1: 120 };\n return { x0, y0, x1, y1 };\n}\n\n/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the\n * world point to centre. */\nexport function fitView(bounds: FrameBox, width: number, height: number): { scale: number; center: { x: number; y: number } } {\n const scale = Math.min(width / Math.max(1, bounds.x1 - bounds.x0), height / Math.max(1, bounds.y1 - bounds.y0), VIEW.fitMax);\n return { scale, center: { x: (bounds.x0 + bounds.x1) / 2, y: (bounds.y0 + bounds.y1) / 2 } };\n}\n\n/** Insets: room the host's chrome takes at each edge of the map (a docked Vault, a top bar, the Composer). */\nexport type FrameInsets = { top?: number; right?: number; bottom?: number; left?: number };\n/** The smallest free area a map is ever fitted into, however much the insets take. */\nexport const FIT_ROOM = { minWidth: 200, minHeight: 160 } as const;\n\n/** Fit to view inside insets. The map's canvas fills its whole frame - so the canvas itself and its chromatic immersion\n * run behind the host's chrome (a docked Vault floats over the tinted canvas) - while the layer is fitted into the\n * free area (the frame less the insets, never below FIT_ROOM) and centred in it. `screen`: where on the canvas the\n * world `center` goes (screen = world × scale + translation); `room`: the free area's size. With no insets this is\n * fitView, centred on the canvas. */\nexport function fitViewInset(bounds: FrameBox, width: number, height: number, insets: FrameInsets = {}): { scale: number; center: { x: number; y: number }; screen: { x: number; y: number }; room: { width: number; height: number } } {\n const top = insets.top ?? 0, right = insets.right ?? 0, bottom = insets.bottom ?? 0, left = insets.left ?? 0;\n const w = Math.max(FIT_ROOM.minWidth, width - left - right), h = Math.max(FIT_ROOM.minHeight, height - top - bottom);\n const { scale, center } = fitView(bounds, w, h);\n return { scale, center, screen: { x: left + w / 2, y: top + h / 2 }, room: { width: w, height: h } };\n}\n\n/** Where the peek card sits (pointer): beside the idea — right of it if it fits, else left — and level with it. */\nexport const PEEK_PLACEMENT = {\n /** Gap between the idea's outermost ring and the card. */ gap: 16,\n /** The card's width and the height kept clear below it. */ cardWidth: 300, cardHeight: 220,\n /** The card is raised this much above the idea's centre. */ raise: 70,\n /** Kept this far inside the map's edges. */ margin: 12,\n} as const;\n\n/** The peek card's top-left, in map (screen) pixels. `idea`: the idea's centre on screen and its on-screen half\n * width with its outermost ring (`half`); `box`: the map's size. */\nexport function peekPosition(idea: { x: number; y: number; half: number }, box: { w: number; h: number }, card: { w: number; h: number } = { w: PEEK_PLACEMENT.cardWidth, h: PEEK_PLACEMENT.cardHeight }) {\n const P = PEEK_PLACEMENT, half = idea.half + P.gap;\n const right = idea.x + half + card.w < box.w - P.margin;\n return { left: right ? idea.x + half : Math.max(P.margin, idea.x - half - card.w), top: Math.min(Math.max(P.margin, idea.y - P.raise), box.h - card.h), side: right ? 'right' as const : 'left' as const };\n}\n\n/** The depth trail: each entry shows the idea that was stepped into — its title and a dot in its color (the same\n * topic or custom color the idea is drawn in, including the sibling-order topic of an uncolored idea). The first\n * entry is the map itself: a `stone` dot and the home glyph only (`rootLabel: 'icon'`) — no text, since a map's title\n * usually repeats its centre idea's, which the next entry shows; its accessible name and tooltip are the map's title.\n * The dot is the idea shape (shapeForLevel). */\nexport const TRAIL = { rootTopic: 'stone', rootLabel: 'icon', homeIconSize: 12, dotBox: 16, dotRadius: 6.4, stroke: 1.25, currentStroke: 1.75 } as const;\n\n/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */\nexport function pointerModeFor(pointerType: string): 'hover' | 'touch' | null {\n return pointerType === 'mouse' ? 'hover' : pointerType === 'touch' || pointerType === 'pen' ? 'touch' : null;\n}\n\n/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */\nexport function hoverOpensTerm(pointerType: string): boolean {\n return TERM.hoverPointers.includes(pointerType);\n}\n","// ─── Performance & Rendering Constants ───────────────────────────────────────\n//\n// Performance budgets and interaction thresholds. Visual values (colours,\n// stroke widths, node size, zoom range) come from the design system tokens.\n\nimport { VIEW } from '../generated/geometry/interaction.js';\n\n// ── FPS ───────────────────────────────────────────────────────────────────────\n\nexport const FPS_TARGET = 60;\nexport const FPS_WARNING_THRESHOLD = 45;\nexport const FPS_CRITICAL_THRESHOLD = 30;\nexport const TARGET_FRAME_TIME = 1000 / FPS_TARGET; // ~16.67 ms\nexport const MAX_FRAME_TIME = 18; // p95 threshold\n\n/** Legacy frame-rate targets kept for backward compatibility. */\nexport const FPS_TARGETS = {\n PAN_MIN: 30,\n ZOOM_TARGET: 60,\n WARNING_THRESHOLD: 20,\n} as const;\n\n// ── Timing Thresholds (ms) ────────────────────────────────────────────────────\n\nexport const TIMING_THRESHOLDS = {\n VIEWPORT_QUERY_MAX: 5,\n SPATIAL_UPDATE_MAX: 10,\n DRAG_RESPONSE_MAX: 16,\n LOAD_5K_TARGET: 2000,\n LOAD_10K_TARGET: 3000,\n VIEWPORT_DEBOUNCE: 100,\n SPATIAL_INDEX_BUILD: 50,\n} as const;\n\n// ── Memory Limits (MB) ────────────────────────────────────────────────────────\n\nexport const MEMORY_TARGET_MB = 500;\nexport const MEMORY_WARNING_MB = 600;\nexport const MEMORY_CRITICAL_MB = 800;\n\nexport const MEMORY_LIMITS = {\n MAX_10K_NODES: 500,\n MAX_GROWTH_PERCENT: 20,\n WARNING_THRESHOLD: 400,\n} as const;\n\n// ── Viewport Culling ──────────────────────────────────────────────────────────\n\nexport const VIEWPORT_MARGIN = 0.1;\nexport const MAX_VISIBLE_NODES = 800;\nexport const CULLING_QUERY_TIME_BUDGET = 5;\n\n// ── Spatial Index ─────────────────────────────────────────────────────────────\n\nexport const RBUSH_MAX_ENTRIES = 16;\nexport const SPATIAL_INDEX_BUILD_BUDGET = 50;\n\n// ── Zoom Constraints ──────────────────────────────────────────────────────────\n\n// Zoom limits: the design system's VIEW (geometry/interaction.ts; equal to the zoom-min / zoom-max tokens).\nexport const ZOOM_MIN = VIEW.zoomMin;\nexport const ZOOM_MAX = VIEW.zoomMax;\nexport const ZOOM_DEFAULT = 1.0;\n\n// ── Quality Level Presets ─────────────────────────────────────────────────────\n\nexport const QUALITY_HIGH = {\n shadows: true,\n bezierCurves: true,\n animations: true,\n textQuality: 'high' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_MEDIUM = {\n shadows: false,\n bezierCurves: true,\n animations: true,\n textQuality: 'medium' as const,\n antialiasing: true,\n};\n\nexport const QUALITY_LOW = {\n shadows: false,\n bezierCurves: false,\n animations: false,\n textQuality: 'low' as const,\n antialiasing: false,\n};\n\n// ── Performance Monitoring ────────────────────────────────────────────────────\n\nexport const FPS_SAMPLE_WINDOW = 60;\nexport const FPS_UPDATE_INTERVAL = 1000;\nexport const MEMORY_CHECK_INTERVAL = 5000;\nexport const PERFORMANCE_TOAST_COOLDOWN = 10000;\n\n// ── Auto-Adjustment ───────────────────────────────────────────────────────────\n\nexport const FPS_DOWNGRADE_THRESHOLD = 45;\nexport const FPS_UPGRADE_THRESHOLD = 58;\nexport const FPS_STABILIZATION_FRAMES = 180;\n\n// ── Canvas Dimensions ─────────────────────────────────────────────────────────\n\nexport const DEFAULT_CANVAS_WIDTH = 1920;\nexport const DEFAULT_CANVAS_HEIGHT = 1080;\n\n// ── Interaction ───────────────────────────────────────────────────────────────\n\nexport const CLICK_THRESHOLD = 5;\nexport const DOUBLE_CLICK_DELAY = 300;\nexport const DRAG_START_DISTANCE = 10;\n\n// ── Data Validation ───────────────────────────────────────────────────────────\n\nexport const MAX_NODES = 20000;\nexport const CIRCULAR_REFERENCE_MAX_DEPTH = 1000;\n\n// ── Debounce / Throttle ───────────────────────────────────────────────────────\n\nexport const RESIZE_DEBOUNCE = 300;\nexport const SCROLL_THROTTLE = 16;\nexport const SEARCH_DEBOUNCE = 500;\n\n/** Node count thresholds that gate optimisation strategies. */\nexport const NODE_COUNT_THRESHOLDS = {\n SPATIAL_INDEX_MIN: 100,\n VIEWPORT_CULLING_MIN: 500,\n CANVAS_RENDERING_MIN: 2000,\n DOM_RENDERING_MAX: 5000,\n} as const;\n\n/** Viewport buffer configuration. */\nexport const VIEWPORT_CONFIG = {\n BUFFER_PERCENT: 0.2,\n MIN_VISIBLE_NODES: 10,\n} as const;\n","// ─── Layout constants ────────────────────────────────────────────────────────\n//\n// Non-visual layout metrics (world units). Everything visual (colours, fonts,\n// radii, spacing, motion) comes from the design system: see ../theme.\n\nexport const LAYOUT_SPACING = {\n nodeSpacing: 200,\n levelSpacing: 150,\n containerPadding: 20,\n gridSize: 50,\n} as const;\n","// ─── Render Configuration ─────────────────────────────────────────────────────\n\nimport type { RenderConfig } from '../types/mindmap.js';\nimport {\n FPS_TARGET,\n MEMORY_TARGET_MB,\n QUALITY_HIGH,\n QUALITY_MEDIUM,\n QUALITY_LOW,\n NODE_COUNT_THRESHOLDS,\n} from './performanceConstants.js';\n\n// ── Defaults ──────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_RENDER_CONFIG: RenderConfig = {\n renderMode: 'canvas',\n qualityLevel: 'high',\n cullingEnabled: false,\n fpsTarget: FPS_TARGET,\n memoryLimit: MEMORY_TARGET_MB,\n};\n\nexport const SIMPLIFIED_RENDER_CONFIG: RenderConfig = {\n renderMode: 'simplified',\n qualityLevel: 'low',\n cullingEnabled: true,\n fpsTarget: 30,\n memoryLimit: 400,\n};\n\n// ── Quality Map ───────────────────────────────────────────────────────────────\n\nexport const QUALITY_SETTINGS = {\n high: QUALITY_HIGH,\n medium: QUALITY_MEDIUM,\n low: QUALITY_LOW,\n} as const;\n\n// ── Feature Flags ─────────────────────────────────────────────────────────────\n\nexport const FEATURE_FLAGS = {\n viewportCulling: true,\n spatialIndexing: true,\n shadows: true,\n bezierCurves: true,\n animations: true,\n branchBadges: true,\n autoQualityAdjustment: true,\n performanceMonitoring: true,\n performanceToasts: true,\n debugOverlay: false,\n showFPS: false,\n showMemory: false,\n showVisibleCount: false,\n} as const;\n\n// ── Render Modes ──────────────────────────────────────────────────────────────\n\nexport type RenderMode = RenderConfig['renderMode'];\nexport type QualityLevel = RenderConfig['qualityLevel'];\n\nexport const RENDER_MODES = {\n canvas: {\n name: 'Canvas',\n description: 'Full Konva canvas rendering with all features',\n features: { culling: true, shadows: true, bezierCurves: true, animations: true },\n },\n simplified: {\n name: 'Simplified',\n description: 'Reduced feature set for low-end devices',\n features: { culling: true, shadows: false, bezierCurves: false, animations: false },\n },\n} as const;\n\nexport const QUALITY_LEVELS = {\n high: { name: 'High', description: 'All visual features enabled', targetFPS: 60, features: QUALITY_HIGH },\n medium: { name: 'Medium', description: 'Shadows disabled, other features enabled', targetFPS: 60, features: QUALITY_MEDIUM },\n low: { name: 'Low', description: 'Minimal visual features, max performance', targetFPS: 30, features: QUALITY_LOW },\n} as const;\n\n// ── Auto-Adjustment Helpers ───────────────────────────────────────────────────\n\nexport function getOptimalQualityLevel(\n currentFPS: number,\n currentQuality: QualityLevel,\n): QualityLevel {\n if (currentFPS < 45 && currentQuality === 'high') return 'medium';\n if (currentFPS < 30 && currentQuality === 'medium') return 'low';\n if (currentFPS > 58 && currentQuality === 'low') return 'medium';\n if (currentFPS > 58 && currentQuality === 'medium') return 'high';\n return currentQuality;\n}\n\nexport function getRenderConfigForQuality(quality: QualityLevel): Partial<RenderConfig> {\n return { qualityLevel: quality, fpsTarget: QUALITY_LEVELS[quality].targetFPS };\n}\n\nexport function isFeatureEnabled(\n featureName: keyof typeof FEATURE_FLAGS,\n config: RenderConfig,\n): boolean {\n if (!FEATURE_FLAGS[featureName]) return false;\n\n const qs = QUALITY_SETTINGS[config.qualityLevel];\n switch (featureName) {\n case 'shadows': return qs.shadows;\n case 'bezierCurves': return qs.bezierCurves;\n case 'animations': return qs.animations;\n default: return FEATURE_FLAGS[featureName] as boolean;\n }\n}\n\n// ── Device Detection ──────────────────────────────────────────────────────────\n\n/**\n * Recommend a render config based on detected device memory (browser only).\n * Falls back to SIMPLIFIED_RENDER_CONFIG when the Performance Memory API is\n * unavailable or memory is constrained.\n */\nexport function getRecommendedRenderConfig(): RenderConfig {\n if (typeof performance === 'undefined' || !(performance as unknown as Record<string, unknown>)['memory']) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n const memory = (performance as unknown as Record<string, unknown>)['memory'] as Record<string, number>;\n if (memory?.['jsHeapSizeLimit'] && memory['jsHeapSizeLimit'] < 512 * 1024 * 1024) {\n return SIMPLIFIED_RENDER_CONFIG;\n }\n\n return DEFAULT_RENDER_CONFIG;\n}\n\n/** Re-export so consumers need only one import. */\nexport { NODE_COUNT_THRESHOLDS };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC+BO,IAAM,OAAO;AAAA;AAAA,EAC4C,UAAU;AAAA;AAAA,EACU,SAAS;AAAA,EAAK,SAAS;AAAA;AAAA,EAClD,QAAQ;AACjE;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
|
package/dist/constants/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getRecommendedRenderConfig,
|
|
10
10
|
getRenderConfigForQuality,
|
|
11
11
|
isFeatureEnabled
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-EB5RHCQP.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-
|
|
58
|
+
} from "../chunk-KUW3GHKQ.js";
|
|
59
59
|
export {
|
|
60
60
|
CIRCULAR_REFERENCE_MAX_DEPTH,
|
|
61
61
|
CLICK_THRESHOLD,
|
package/dist/index.cjs
CHANGED
|
@@ -2091,11 +2091,10 @@ function zoomAround(t0, s0, s1, from, to) {
|
|
|
2091
2091
|
return { x: to.x - wx * s1, y: to.y - wy * s1 };
|
|
2092
2092
|
}
|
|
2093
2093
|
var FRAME = {
|
|
2094
|
-
/** Room beyond each idea's
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
minPadY: 120,
|
|
2094
|
+
/** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */
|
|
2095
|
+
ring: 0.3,
|
|
2096
|
+
clearX: 16,
|
|
2097
|
+
clearY: 16,
|
|
2099
2098
|
/** Room beyond each container hull for its dashed line and the name pill straddling it. */
|
|
2100
2099
|
hullX: 24,
|
|
2101
2100
|
hullY: 40
|
|
@@ -2103,7 +2102,7 @@ var FRAME = {
|
|
|
2103
2102
|
function layerBounds(ideas, hulls = []) {
|
|
2104
2103
|
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
2105
2104
|
for (const n of ideas) {
|
|
2106
|
-
const px =
|
|
2105
|
+
const px = n.rx * (1 + FRAME.ring) + FRAME.clearX, py = n.ry * (1 + FRAME.ring) + FRAME.clearY;
|
|
2107
2106
|
x0 = Math.min(x0, n.x - px);
|
|
2108
2107
|
x1 = Math.max(x1, n.x + px);
|
|
2109
2108
|
y0 = Math.min(y0, n.y - py);
|
|
@@ -2115,7 +2114,7 @@ function layerBounds(ideas, hulls = []) {
|
|
|
2115
2114
|
y0 = Math.min(y0, h.y0 - FRAME.hullY);
|
|
2116
2115
|
y1 = Math.max(y1, h.y1 + FRAME.hullY);
|
|
2117
2116
|
}
|
|
2118
|
-
if (!Number.isFinite(x0)) return { x0: -
|
|
2117
|
+
if (!Number.isFinite(x0)) return { x0: -150, y0: -120, x1: 150, y1: 120 };
|
|
2119
2118
|
return { x0, y0, x1, y1 };
|
|
2120
2119
|
}
|
|
2121
2120
|
function fitView(bounds, width, height) {
|