@visualli/core 0.2.16 → 0.2.18
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-4R5LZUVK.js → chunk-2JCBDPOL.js} +2 -2
- package/dist/{chunk-COKCN5NW.js → chunk-3RLUS5K7.js} +15 -5
- package/dist/chunk-3RLUS5K7.js.map +1 -0
- package/dist/{chunk-EASI6BW7.js → chunk-3UZU4SK5.js} +17 -3
- package/dist/chunk-3UZU4SK5.js.map +1 -0
- package/dist/{chunk-URWZU4I5.js → chunk-6GAKZATW.js} +2 -2
- package/dist/{chunk-RDHSLWMU.js → chunk-6LHBNFP4.js} +2 -1
- package/dist/{chunk-RDHSLWMU.js.map → chunk-6LHBNFP4.js.map} +1 -1
- package/dist/{chunk-C5IC52GJ.js → chunk-EGXQEULM.js} +4 -4
- package/dist/{chunk-OOTXA4BA.js → chunk-T3SFVKHY.js} +2 -2
- package/dist/{chunk-KP57ODE7.js → chunk-YU3KV4UY.js} +2 -2
- package/dist/config/index.cjs +15 -1
- package/dist/config/index.cjs.map +1 -1
- package/dist/config/index.d.cts +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.js +2 -2
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +2 -2
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/{designSystem-D-iI9c23.d.cts → designSystem-D1TEwtFB.d.cts} +1 -0
- package/dist/{designSystem-D-iI9c23.d.ts → designSystem-D1TEwtFB.d.ts} +1 -0
- package/dist/{ideaSize-Dj7qGmuk.d.cts → ideaSize-BNzONHMD.d.cts} +1 -1
- package/dist/{ideaSize-BD-vUcOU.d.ts → ideaSize-D3bwx7nU.d.ts} +1 -1
- package/dist/{index-uqNXf5yF.d.cts → index-CpNpxxTi.d.cts} +1 -1
- package/dist/{index-Bi8djF7z.d.ts → index-b1eML2o2.d.ts} +1 -1
- package/dist/index.cjs +111 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -23
- package/dist/index.d.ts +82 -23
- package/dist/index.js +86 -11
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.cts +2 -2
- package/dist/layout/index.d.ts +2 -2
- package/dist/{mindmap-BbQrM6Pm.d.cts → mindmap-BkGXWW3M.d.cts} +1 -1
- package/dist/{mindmap-BU-aLrAR.d.ts → mindmap-GAjdtx5S.d.ts} +1 -1
- package/dist/parser/index.cjs +15 -1
- package/dist/parser/index.cjs.map +1 -1
- package/dist/parser/index.d.cts +3 -3
- package/dist/parser/index.d.ts +3 -3
- package/dist/parser/index.js +4 -4
- package/dist/performance/index.cjs.map +1 -1
- package/dist/performance/index.js +2 -2
- package/dist/theme/index.cjs +1 -0
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.cts +2 -2
- package/dist/theme/index.d.ts +2 -2
- package/dist/theme/index.js +2 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/viewport/index.cjs.map +1 -1
- package/dist/viewport/index.d.cts +2 -2
- package/dist/viewport/index.d.ts +2 -2
- package/dist/viewport/index.js +2 -2
- package/package.json +2 -2
- package/src/generated/designSystem.ts +1 -0
- package/src/generated/geometry/container.ts +80 -2
- package/src/generated/geometry/idea.ts +12 -1
- package/src/generated/geometry/interaction.ts +29 -4
- package/src/index.ts +3 -3
- package/src/utils/navigation.ts +13 -8
- package/dist/chunk-COKCN5NW.js.map +0 -1
- package/dist/chunk-EASI6BW7.js.map +0 -1
- /package/dist/{chunk-4R5LZUVK.js.map → chunk-2JCBDPOL.js.map} +0 -0
- /package/dist/{chunk-URWZU4I5.js.map → chunk-6GAKZATW.js.map} +0 -0
- /package/dist/{chunk-C5IC52GJ.js.map → chunk-EGXQEULM.js.map} +0 -0
- /package/dist/{chunk-OOTXA4BA.js.map → chunk-T3SFVKHY.js.map} +0 -0
- /package/dist/{chunk-KP57ODE7.js.map → chunk-YU3KV4UY.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RenderConfig, N as NodeSelection, F as FlatNode, M as MindMapConnection, V as ViewportState } from './mindmap-
|
|
2
|
-
export { E as ELLIPSE, a as IDEA, I as IdeaKind, L as LABEL_GROWTH, b as MindMapConfig, c as MindMapData, d as MindMapNode, e as NodeMap, S as ShapeProfile, f as SpatialBounds, T as TopLevelConnection, i as ideaSize, l as labelGrowth, g as labelLayout, h as layoutGrowth, j as lineWidthsInShape, w as wrapInShape, k as wrapLines } from './mindmap-
|
|
1
|
+
import { R as RenderConfig, N as NodeSelection, F as FlatNode, M as MindMapConnection, V as ViewportState } from './mindmap-BkGXWW3M.cjs';
|
|
2
|
+
export { E as ELLIPSE, a as IDEA, I as IdeaKind, L as LABEL_GROWTH, b as MindMapConfig, c as MindMapData, d as MindMapNode, e as NodeMap, S as ShapeProfile, f as SpatialBounds, T as TopLevelConnection, i as ideaSize, l as labelGrowth, g as labelLayout, h as layoutGrowth, j as lineWidthsInShape, w as wrapInShape, k as wrapLines } from './mindmap-BkGXWW3M.cjs';
|
|
3
3
|
import { V as VisualliDocument } from './document-MEJEfxl3.cjs';
|
|
4
4
|
export { S as SemanticAnchor, a as VisualliMeta } from './document-MEJEfxl3.cjs';
|
|
5
5
|
import { V as VisualliLayer } from './layer-B2A3Ki48.cjs';
|
|
@@ -13,9 +13,9 @@ export { WorldBounds, calculateViewportBounds, clampZoom, focusOnNode, isNodeInV
|
|
|
13
13
|
export { FPSMonitor, MemoryMonitor, MemoryStats, PerformanceProfiler } from './performance/index.cjs';
|
|
14
14
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
15
15
|
export { BLOB_SHAPES, ConnectorGeometry, MAX_RINGS, NodeLike, RINGS, SHAPE, arrowPath, blobPath, blobProfile, blobRadius, connectorGeometry, drawBlob, edgePath, nodeBounds, nodeRadii, outlineRadius, ringCount, ringsFor, shapeForLevel, shapeOfLevel } from './config/index.cjs';
|
|
16
|
-
export { I as IdeaMeasure, a as approximateMeasure, i as ideaKindOf } from './ideaSize-
|
|
17
|
-
export { C as CUSTOM, a as Comfort, I as IMMERSION, b as IdeaColor, M as Metrics, R as ResolvedComfort, T as TOPIC_ORDER, c as ThemeEnv, d as ThemeFamily, e as ThemeInput, f as TopicStyle, g as customColor, h as getTokens, i as ideaColor, j as ideaStyle, k as isContrastTheme, l as isDarkTheme, m as isFocusTheme, n as isThemeName, o as labelScale, p as metricsFor, r as resolveComfort, q as resolveTheme, t as token, s as topicFor, u as topicFromName, v as topicStyle } from './index-
|
|
18
|
-
export { C as CANVAS_STYLE, D as DESIGN_SYSTEM_VERSION, M as METRICS, b as METRICS_REDUCED_MOTION, c as THEME_NAMES, d as TOKENS, e as TOPICS, f as TYPE_STYLES, a as ThemeName, T as TopicName } from './designSystem-
|
|
16
|
+
export { I as IdeaMeasure, a as approximateMeasure, i as ideaKindOf } from './ideaSize-BNzONHMD.cjs';
|
|
17
|
+
export { C as CUSTOM, a as Comfort, I as IMMERSION, b as IdeaColor, M as Metrics, R as ResolvedComfort, T as TOPIC_ORDER, c as ThemeEnv, d as ThemeFamily, e as ThemeInput, f as TopicStyle, g as customColor, h as getTokens, i as ideaColor, j as ideaStyle, k as isContrastTheme, l as isDarkTheme, m as isFocusTheme, n as isThemeName, o as labelScale, p as metricsFor, r as resolveComfort, q as resolveTheme, t as token, s as topicFor, u as topicFromName, v as topicStyle } from './index-CpNpxxTi.cjs';
|
|
18
|
+
export { C as CANVAS_STYLE, D as DESIGN_SYSTEM_VERSION, M as METRICS, b as METRICS_REDUCED_MOTION, c as THEME_NAMES, d as TOKENS, e as TOPICS, f as TYPE_STYLES, a as ThemeName, T as TopicName } from './designSystem-D1TEwtFB.cjs';
|
|
19
19
|
export { Connection, Container, Extension, Layer, Meta, Node } from '@visualli/bindings';
|
|
20
20
|
|
|
21
21
|
interface BoundingBox {
|
|
@@ -166,8 +166,11 @@ declare const FRAME: {
|
|
|
166
166
|
/** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */ readonly ring: 0.3;
|
|
167
167
|
readonly clearX: 16;
|
|
168
168
|
readonly clearY: 16;
|
|
169
|
-
/** Room beyond each container hull for its dashed line and the name pill straddling it
|
|
169
|
+
/** Room beyond each container hull for its dashed line and the name pill straddling it: at least `hullX` / `hullY`
|
|
170
|
+
* (a one-line pill), more when the pill reaches further (a 2 - 3 line name): half its largest drawn height plus
|
|
171
|
+
* `pillAir`. A pill on a side edge may reach further sideways; the framing doesn't reserve that. */ readonly hullX: 24;
|
|
170
172
|
readonly hullY: 40;
|
|
173
|
+
readonly pillAir: 12;
|
|
171
174
|
};
|
|
172
175
|
type FrameBox = {
|
|
173
176
|
x0: number;
|
|
@@ -175,13 +178,16 @@ type FrameBox = {
|
|
|
175
178
|
x1: number;
|
|
176
179
|
y1: number;
|
|
177
180
|
};
|
|
178
|
-
/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull.
|
|
181
|
+
/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. A hull's `pillH` is
|
|
182
|
+
* its name pill's height at the largest drawn size (container.ts pillScaled at PILL.maxGrow). */
|
|
179
183
|
declare function layerBounds(ideas: ReadonlyArray<{
|
|
180
184
|
x: number;
|
|
181
185
|
y: number;
|
|
182
186
|
rx: number;
|
|
183
187
|
ry: number;
|
|
184
|
-
}>, hulls?: ReadonlyArray<FrameBox
|
|
188
|
+
}>, hulls?: ReadonlyArray<FrameBox & {
|
|
189
|
+
pillH?: number;
|
|
190
|
+
}>): FrameBox;
|
|
185
191
|
/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the
|
|
186
192
|
* world point to centre. */
|
|
187
193
|
declare function fitView(bounds: FrameBox, width: number, height: number): {
|
|
@@ -262,6 +268,10 @@ declare const TRAIL: {
|
|
|
262
268
|
readonly stroke: 1.25;
|
|
263
269
|
readonly currentStroke: 1.75;
|
|
264
270
|
};
|
|
271
|
+
/** How an idea draws while a highlight is on (VisualMap `highlight`, or picking ideas for a group or a connector):
|
|
272
|
+
* `ids` are the highlighted ideas. A non-empty list: those are 'selected' and every other idea 'dimmed'. An empty list:
|
|
273
|
+
* every idea 'dimmed' while `picking` (nothing chosen yet), else no highlight (null). No list: null. */
|
|
274
|
+
declare function ideaHighlight(ids: readonly string[] | null | undefined, picking: boolean, id: string): 'selected' | 'dimmed' | null;
|
|
265
275
|
/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */
|
|
266
276
|
declare function pointerModeFor(pointerType: string): 'hover' | 'touch' | null;
|
|
267
277
|
/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */
|
|
@@ -286,18 +296,22 @@ interface FitResult {
|
|
|
286
296
|
centerY: number;
|
|
287
297
|
zoomLevel: number;
|
|
288
298
|
}
|
|
289
|
-
/**
|
|
290
|
-
|
|
299
|
+
/** A container as the fit sees it: its members and, when it has a name, the name's pill at 1x (`w` × `h`, the design
|
|
300
|
+
* system's pillLayout: the host measures it with the real face). The hull widens for the pill and the framing leaves
|
|
301
|
+
* room for it (containerHull, layerBounds). Without it the container is framed by its hull alone. */
|
|
302
|
+
interface FitContainer {
|
|
291
303
|
nodeIds: string[];
|
|
292
|
-
|
|
304
|
+
pill?: {
|
|
305
|
+
w: number;
|
|
306
|
+
h: number;
|
|
307
|
+
} | null;
|
|
308
|
+
}
|
|
309
|
+
/** The box a layer is framed by: its ideas (their real sizes) and the hulls of its `containers`. */
|
|
310
|
+
declare function layerFrame(nodes: ReadonlyArray<FlatNode>, containers?: ReadonlyArray<FitContainer>): FrameBox;
|
|
293
311
|
/** The zoom that fits a layer's ideas (and container hulls) into a canvas of `canvasWidth` × `canvasHeight`. */
|
|
294
|
-
declare function calculateFitZoom(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<
|
|
295
|
-
nodeIds: string[];
|
|
296
|
-
}>): number;
|
|
312
|
+
declare function calculateFitZoom(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<FitContainer>): number;
|
|
297
313
|
/** The world point a fitted layer is centred on: the middle of its frame. */
|
|
298
|
-
declare function calculateFitCenter(nodes: FlatNode[], containers?: ReadonlyArray<{
|
|
299
|
-
nodeIds: string[];
|
|
300
|
-
}>): {
|
|
314
|
+
declare function calculateFitCenter(nodes: FlatNode[], containers?: ReadonlyArray<FitContainer>): {
|
|
301
315
|
x: number;
|
|
302
316
|
y: number;
|
|
303
317
|
};
|
|
@@ -318,9 +332,7 @@ declare function getContainersForLayer(doc: VisualliDocument, layerId: string):
|
|
|
318
332
|
* layer fits the free area and sits centred in it (the design system's fitViewInset); the viewport centre returned is
|
|
319
333
|
* the world point at the middle of the canvas, as the viewport store keeps it.
|
|
320
334
|
*/
|
|
321
|
-
declare function calculateFitView(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<
|
|
322
|
-
nodeIds: string[];
|
|
323
|
-
}>, insets?: FrameInsets): FitResult;
|
|
335
|
+
declare function calculateFitView(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<FitContainer>, insets?: FrameInsets): FitResult;
|
|
324
336
|
|
|
325
337
|
interface CullingOptions {
|
|
326
338
|
nodes: FlatNode[];
|
|
@@ -483,12 +495,59 @@ declare const HULL_CLEAR: {
|
|
|
483
495
|
readonly x: 50;
|
|
484
496
|
readonly y: 51;
|
|
485
497
|
};
|
|
498
|
+
/** The name pill (1x, world units = CSS px): the `note` face 26px bold (× the label scale), line-height 1.1, padding
|
|
499
|
+
* and border as the CSS draws them. It grows with the name up to `maxWidth` (padding and border included), then wraps
|
|
500
|
+
* to at most `maxLines` lines (a word wider than a line is split across lines); an ellipsis only past that. Zooming grows the text with the label growth (up to
|
|
501
|
+
* `maxGrow`) but never the padding or border, and never re-wraps. `.vi-map__group-label`'s max-width equals
|
|
502
|
+
* `maxWidth` (the build checks it). */
|
|
503
|
+
declare const PILL: {
|
|
504
|
+
readonly fontPx: 26;
|
|
505
|
+
readonly lineHeight: 1.1;
|
|
506
|
+
readonly padX: 22;
|
|
507
|
+
readonly padTop: 6;
|
|
508
|
+
readonly padBottom: 8;
|
|
509
|
+
readonly border: 1.5;
|
|
510
|
+
readonly maxWidth: 420;
|
|
511
|
+
readonly maxLines: 3;
|
|
512
|
+
readonly maxGrow: 1.3;
|
|
513
|
+
};
|
|
514
|
+
/** The pill's fixed chrome (padding + border): width and height that don't scale with the text. */
|
|
515
|
+
declare const PILL_CHROME: {
|
|
516
|
+
readonly w: number;
|
|
517
|
+
readonly h: number;
|
|
518
|
+
};
|
|
519
|
+
type PillSize = {
|
|
520
|
+
lines: string[];
|
|
521
|
+
w: number;
|
|
522
|
+
h: number;
|
|
523
|
+
};
|
|
524
|
+
/** Wraps a container's name into its pill at 1x. `measure(text, px)` is the width of `text` in the note face at `px`
|
|
525
|
+
* (an injected canvas measure, like wrapLines in idea.ts); `scale` is the label scale (1.15 in large type). Lines break
|
|
526
|
+
* at spaces first; a word wider than a whole line (the pill's room: `maxWidth` less the padding and border) is split
|
|
527
|
+
* across lines, each filled with as many characters as fit, never inside a character (an emoji, a combining mark), so
|
|
528
|
+
* every line fits the pill. Past `maxLines` the last line ends in an ellipsis that fits. `w` is the widest line plus
|
|
529
|
+
* the chrome (at most `maxWidth`), `h` the lines plus the chrome. */
|
|
530
|
+
declare function pillLayout(name: string, measure: (text: string, px: number) => number, scale?: number): PillSize;
|
|
531
|
+
/** The pill as drawn at label growth `k` (1 to PILL.maxGrow): the text grows, the padding and border don't. */
|
|
532
|
+
declare function pillScaled(p: {
|
|
533
|
+
w: number;
|
|
534
|
+
h: number;
|
|
535
|
+
}, k: number): {
|
|
536
|
+
w: number;
|
|
537
|
+
h: number;
|
|
538
|
+
};
|
|
486
539
|
/** The hull around a group's ideas: `padX` / `padY` beyond their centres, or more for an idea that has grown to show
|
|
487
|
-
* its label (`rx` / `ry`, its half size: then its outline plus HULL_CLEAR).
|
|
540
|
+
* its label (`rx` / `ry`, its half size: then its outline plus HULL_CLEAR). With the name's `pill` (its 1x size,
|
|
541
|
+
* from pillLayout) the hull is also widened, symmetrically about its centre, so that the pill at its largest drawn
|
|
542
|
+
* size (PILL.maxGrow) fits on the straight part of an edge: pill width + 2 × the corner radius. Hull and pill then
|
|
543
|
+
* never change while zooming. Without a pill the hull is as before. */
|
|
488
544
|
declare function containerHull(members: ReadonlyArray<Pt & {
|
|
489
545
|
rx?: number;
|
|
490
546
|
ry?: number;
|
|
491
|
-
}
|
|
547
|
+
}>, pill?: {
|
|
548
|
+
w: number;
|
|
549
|
+
h: number;
|
|
550
|
+
} | null): Hull | null;
|
|
492
551
|
/** Candidate spots for a w × h pill, in preference order: bottom center (the default look), top center, the thirds of
|
|
493
552
|
* bottom and top, then the sides. Spots keep the whole pill on the straight part of an edge, clear of the corners. */
|
|
494
553
|
declare function labelCandidates(hull: Hull, w: number, h: number): {
|
|
@@ -522,4 +581,4 @@ declare function ideaDetail(screenWidth: number, emphasised?: boolean): IdeaDeta
|
|
|
522
581
|
/** Whether idea shadows are drawn with this many ideas in view. */
|
|
523
582
|
declare function shadowsShown(visibleIdeas: number): boolean;
|
|
524
583
|
|
|
525
|
-
export { BACK, type Bezier, type BoundingBox, type ContainerGroupInfo, type CullingOptions, DETAIL, EASE, FEATURE_FLAGS, FIT_ROOM, FRAME, type FitResult, FlatNode, type FrameBox, type FrameInsets, GESTURE, HULL, HULL_CLEAR, type Hull, type IRenderConfigStore, type ISelectionStore, type ISpatialIndex, type IdeaDetail, type Box as LabelBox, type LabelPlacement, type LabelSide, type LayerVia, MOTION, MindMapConnection, NodeSelection, PEEK, PEEK_PLACEMENT, type Pt, RBushSpatialIndex, RenderConfig, SHEET, TERM, TRAIL, VIEW, ViewportState, VisualliDocument, VisualliLayer, bloomOffset, calculateFitCenter, calculateFitView, calculateFitZoom, connectorDelay, connectorSamples, containerHull, cssEase, ease as easeBezier, fitView, fitViewInset, getChildLayerForNode, getConnectionsForLayer, getContainersForLayer, getLayerForNavigation, getViewportVisibleNodes, hoverOpensTerm, ideaDetail, intersectsViewport, labelCandidates, layerBlooms, layerBounds, layerFrame, layerReveal, motionVars, peekPosition, pinchZoom, placeContainerLabel, pointerModeFor, renderConfigStore, revealDelay, revealSlot, revealTotal, selectionStore, shadowsShown, swapDelay, zoomAround };
|
|
584
|
+
export { BACK, type Bezier, type BoundingBox, type ContainerGroupInfo, type CullingOptions, DETAIL, EASE, FEATURE_FLAGS, FIT_ROOM, FRAME, type FitContainer, type FitResult, FlatNode, type FrameBox, type FrameInsets, GESTURE, HULL, HULL_CLEAR, type Hull, type IRenderConfigStore, type ISelectionStore, type ISpatialIndex, type IdeaDetail, type Box as LabelBox, type LabelPlacement, type LabelSide, type LayerVia, MOTION, MindMapConnection, NodeSelection, PEEK, PEEK_PLACEMENT, PILL, PILL_CHROME, type PillSize, type Pt, RBushSpatialIndex, RenderConfig, SHEET, TERM, TRAIL, VIEW, ViewportState, VisualliDocument, VisualliLayer, bloomOffset, calculateFitCenter, calculateFitView, calculateFitZoom, connectorDelay, connectorSamples, containerHull, cssEase, ease as easeBezier, fitView, fitViewInset, getChildLayerForNode, getConnectionsForLayer, getContainersForLayer, getLayerForNavigation, getViewportVisibleNodes, hoverOpensTerm, ideaDetail, ideaHighlight, intersectsViewport, labelCandidates, layerBlooms, layerBounds, layerFrame, layerReveal, motionVars, peekPosition, pillLayout, pillScaled, pinchZoom, placeContainerLabel, pointerModeFor, renderConfigStore, revealDelay, revealSlot, revealTotal, selectionStore, shadowsShown, swapDelay, zoomAround };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RenderConfig, N as NodeSelection, F as FlatNode, M as MindMapConnection, V as ViewportState } from './mindmap-
|
|
2
|
-
export { E as ELLIPSE, a as IDEA, I as IdeaKind, L as LABEL_GROWTH, b as MindMapConfig, c as MindMapData, d as MindMapNode, e as NodeMap, S as ShapeProfile, f as SpatialBounds, T as TopLevelConnection, i as ideaSize, l as labelGrowth, g as labelLayout, h as layoutGrowth, j as lineWidthsInShape, w as wrapInShape, k as wrapLines } from './mindmap-
|
|
1
|
+
import { R as RenderConfig, N as NodeSelection, F as FlatNode, M as MindMapConnection, V as ViewportState } from './mindmap-GAjdtx5S.js';
|
|
2
|
+
export { E as ELLIPSE, a as IDEA, I as IdeaKind, L as LABEL_GROWTH, b as MindMapConfig, c as MindMapData, d as MindMapNode, e as NodeMap, S as ShapeProfile, f as SpatialBounds, T as TopLevelConnection, i as ideaSize, l as labelGrowth, g as labelLayout, h as layoutGrowth, j as lineWidthsInShape, w as wrapInShape, k as wrapLines } from './mindmap-GAjdtx5S.js';
|
|
3
3
|
import { V as VisualliDocument } from './document-BFBwn93X.js';
|
|
4
4
|
export { S as SemanticAnchor, a as VisualliMeta } from './document-BFBwn93X.js';
|
|
5
5
|
import { V as VisualliLayer } from './layer-B2A3Ki48.js';
|
|
@@ -13,9 +13,9 @@ export { WorldBounds, calculateViewportBounds, clampZoom, focusOnNode, isNodeInV
|
|
|
13
13
|
export { FPSMonitor, MemoryMonitor, MemoryStats, PerformanceProfiler } from './performance/index.js';
|
|
14
14
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
15
15
|
export { BLOB_SHAPES, ConnectorGeometry, MAX_RINGS, NodeLike, RINGS, SHAPE, arrowPath, blobPath, blobProfile, blobRadius, connectorGeometry, drawBlob, edgePath, nodeBounds, nodeRadii, outlineRadius, ringCount, ringsFor, shapeForLevel, shapeOfLevel } from './config/index.js';
|
|
16
|
-
export { I as IdeaMeasure, a as approximateMeasure, i as ideaKindOf } from './ideaSize-
|
|
17
|
-
export { C as CUSTOM, a as Comfort, I as IMMERSION, b as IdeaColor, M as Metrics, R as ResolvedComfort, T as TOPIC_ORDER, c as ThemeEnv, d as ThemeFamily, e as ThemeInput, f as TopicStyle, g as customColor, h as getTokens, i as ideaColor, j as ideaStyle, k as isContrastTheme, l as isDarkTheme, m as isFocusTheme, n as isThemeName, o as labelScale, p as metricsFor, r as resolveComfort, q as resolveTheme, t as token, s as topicFor, u as topicFromName, v as topicStyle } from './index-
|
|
18
|
-
export { C as CANVAS_STYLE, D as DESIGN_SYSTEM_VERSION, M as METRICS, b as METRICS_REDUCED_MOTION, c as THEME_NAMES, d as TOKENS, e as TOPICS, f as TYPE_STYLES, a as ThemeName, T as TopicName } from './designSystem-
|
|
16
|
+
export { I as IdeaMeasure, a as approximateMeasure, i as ideaKindOf } from './ideaSize-D3bwx7nU.js';
|
|
17
|
+
export { C as CUSTOM, a as Comfort, I as IMMERSION, b as IdeaColor, M as Metrics, R as ResolvedComfort, T as TOPIC_ORDER, c as ThemeEnv, d as ThemeFamily, e as ThemeInput, f as TopicStyle, g as customColor, h as getTokens, i as ideaColor, j as ideaStyle, k as isContrastTheme, l as isDarkTheme, m as isFocusTheme, n as isThemeName, o as labelScale, p as metricsFor, r as resolveComfort, q as resolveTheme, t as token, s as topicFor, u as topicFromName, v as topicStyle } from './index-b1eML2o2.js';
|
|
18
|
+
export { C as CANVAS_STYLE, D as DESIGN_SYSTEM_VERSION, M as METRICS, b as METRICS_REDUCED_MOTION, c as THEME_NAMES, d as TOKENS, e as TOPICS, f as TYPE_STYLES, a as ThemeName, T as TopicName } from './designSystem-D1TEwtFB.js';
|
|
19
19
|
export { Connection, Container, Extension, Layer, Meta, Node } from '@visualli/bindings';
|
|
20
20
|
|
|
21
21
|
interface BoundingBox {
|
|
@@ -166,8 +166,11 @@ declare const FRAME: {
|
|
|
166
166
|
/** Room beyond each idea's outermost ring (RINGS[2].scale, 1.3 × its half size): its stroke, hover lift and a little air. */ readonly ring: 0.3;
|
|
167
167
|
readonly clearX: 16;
|
|
168
168
|
readonly clearY: 16;
|
|
169
|
-
/** Room beyond each container hull for its dashed line and the name pill straddling it
|
|
169
|
+
/** Room beyond each container hull for its dashed line and the name pill straddling it: at least `hullX` / `hullY`
|
|
170
|
+
* (a one-line pill), more when the pill reaches further (a 2 - 3 line name): half its largest drawn height plus
|
|
171
|
+
* `pillAir`. A pill on a side edge may reach further sideways; the framing doesn't reserve that. */ readonly hullX: 24;
|
|
170
172
|
readonly hullY: 40;
|
|
173
|
+
readonly pillAir: 12;
|
|
171
174
|
};
|
|
172
175
|
type FrameBox = {
|
|
173
176
|
x0: number;
|
|
@@ -175,13 +178,16 @@ type FrameBox = {
|
|
|
175
178
|
x1: number;
|
|
176
179
|
y1: number;
|
|
177
180
|
};
|
|
178
|
-
/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull.
|
|
181
|
+
/** The box a layer is framed by: every idea (`rx` / `ry` its half size) and every container hull. A hull's `pillH` is
|
|
182
|
+
* its name pill's height at the largest drawn size (container.ts pillScaled at PILL.maxGrow). */
|
|
179
183
|
declare function layerBounds(ideas: ReadonlyArray<{
|
|
180
184
|
x: number;
|
|
181
185
|
y: number;
|
|
182
186
|
rx: number;
|
|
183
187
|
ry: number;
|
|
184
|
-
}>, hulls?: ReadonlyArray<FrameBox
|
|
188
|
+
}>, hulls?: ReadonlyArray<FrameBox & {
|
|
189
|
+
pillH?: number;
|
|
190
|
+
}>): FrameBox;
|
|
185
191
|
/** Fit to view: the scale that shows `bounds` in an area of `width` × `height` (never beyond VIEW.fitMax), and the
|
|
186
192
|
* world point to centre. */
|
|
187
193
|
declare function fitView(bounds: FrameBox, width: number, height: number): {
|
|
@@ -262,6 +268,10 @@ declare const TRAIL: {
|
|
|
262
268
|
readonly stroke: 1.25;
|
|
263
269
|
readonly currentStroke: 1.75;
|
|
264
270
|
};
|
|
271
|
+
/** How an idea draws while a highlight is on (VisualMap `highlight`, or picking ideas for a group or a connector):
|
|
272
|
+
* `ids` are the highlighted ideas. A non-empty list: those are 'selected' and every other idea 'dimmed'. An empty list:
|
|
273
|
+
* every idea 'dimmed' while `picking` (nothing chosen yet), else no highlight (null). No list: null. */
|
|
274
|
+
declare function ideaHighlight(ids: readonly string[] | null | undefined, picking: boolean, id: string): 'selected' | 'dimmed' | null;
|
|
265
275
|
/** How an input answers: a mouse hovers (peeks and terms open on hover); touch and pen tap. Null for unknown pointers. */
|
|
266
276
|
declare function pointerModeFor(pointerType: string): 'hover' | 'touch' | null;
|
|
267
277
|
/** Whether a pointer of this type opens a term on hover (PointerEvent.pointerType). */
|
|
@@ -286,18 +296,22 @@ interface FitResult {
|
|
|
286
296
|
centerY: number;
|
|
287
297
|
zoomLevel: number;
|
|
288
298
|
}
|
|
289
|
-
/**
|
|
290
|
-
|
|
299
|
+
/** A container as the fit sees it: its members and, when it has a name, the name's pill at 1x (`w` × `h`, the design
|
|
300
|
+
* system's pillLayout: the host measures it with the real face). The hull widens for the pill and the framing leaves
|
|
301
|
+
* room for it (containerHull, layerBounds). Without it the container is framed by its hull alone. */
|
|
302
|
+
interface FitContainer {
|
|
291
303
|
nodeIds: string[];
|
|
292
|
-
|
|
304
|
+
pill?: {
|
|
305
|
+
w: number;
|
|
306
|
+
h: number;
|
|
307
|
+
} | null;
|
|
308
|
+
}
|
|
309
|
+
/** The box a layer is framed by: its ideas (their real sizes) and the hulls of its `containers`. */
|
|
310
|
+
declare function layerFrame(nodes: ReadonlyArray<FlatNode>, containers?: ReadonlyArray<FitContainer>): FrameBox;
|
|
293
311
|
/** The zoom that fits a layer's ideas (and container hulls) into a canvas of `canvasWidth` × `canvasHeight`. */
|
|
294
|
-
declare function calculateFitZoom(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<
|
|
295
|
-
nodeIds: string[];
|
|
296
|
-
}>): number;
|
|
312
|
+
declare function calculateFitZoom(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<FitContainer>): number;
|
|
297
313
|
/** The world point a fitted layer is centred on: the middle of its frame. */
|
|
298
|
-
declare function calculateFitCenter(nodes: FlatNode[], containers?: ReadonlyArray<{
|
|
299
|
-
nodeIds: string[];
|
|
300
|
-
}>): {
|
|
314
|
+
declare function calculateFitCenter(nodes: FlatNode[], containers?: ReadonlyArray<FitContainer>): {
|
|
301
315
|
x: number;
|
|
302
316
|
y: number;
|
|
303
317
|
};
|
|
@@ -318,9 +332,7 @@ declare function getContainersForLayer(doc: VisualliDocument, layerId: string):
|
|
|
318
332
|
* layer fits the free area and sits centred in it (the design system's fitViewInset); the viewport centre returned is
|
|
319
333
|
* the world point at the middle of the canvas, as the viewport store keeps it.
|
|
320
334
|
*/
|
|
321
|
-
declare function calculateFitView(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<
|
|
322
|
-
nodeIds: string[];
|
|
323
|
-
}>, insets?: FrameInsets): FitResult;
|
|
335
|
+
declare function calculateFitView(nodes: FlatNode[], canvasWidth: number, canvasHeight: number, containers?: ReadonlyArray<FitContainer>, insets?: FrameInsets): FitResult;
|
|
324
336
|
|
|
325
337
|
interface CullingOptions {
|
|
326
338
|
nodes: FlatNode[];
|
|
@@ -483,12 +495,59 @@ declare const HULL_CLEAR: {
|
|
|
483
495
|
readonly x: 50;
|
|
484
496
|
readonly y: 51;
|
|
485
497
|
};
|
|
498
|
+
/** The name pill (1x, world units = CSS px): the `note` face 26px bold (× the label scale), line-height 1.1, padding
|
|
499
|
+
* and border as the CSS draws them. It grows with the name up to `maxWidth` (padding and border included), then wraps
|
|
500
|
+
* to at most `maxLines` lines (a word wider than a line is split across lines); an ellipsis only past that. Zooming grows the text with the label growth (up to
|
|
501
|
+
* `maxGrow`) but never the padding or border, and never re-wraps. `.vi-map__group-label`'s max-width equals
|
|
502
|
+
* `maxWidth` (the build checks it). */
|
|
503
|
+
declare const PILL: {
|
|
504
|
+
readonly fontPx: 26;
|
|
505
|
+
readonly lineHeight: 1.1;
|
|
506
|
+
readonly padX: 22;
|
|
507
|
+
readonly padTop: 6;
|
|
508
|
+
readonly padBottom: 8;
|
|
509
|
+
readonly border: 1.5;
|
|
510
|
+
readonly maxWidth: 420;
|
|
511
|
+
readonly maxLines: 3;
|
|
512
|
+
readonly maxGrow: 1.3;
|
|
513
|
+
};
|
|
514
|
+
/** The pill's fixed chrome (padding + border): width and height that don't scale with the text. */
|
|
515
|
+
declare const PILL_CHROME: {
|
|
516
|
+
readonly w: number;
|
|
517
|
+
readonly h: number;
|
|
518
|
+
};
|
|
519
|
+
type PillSize = {
|
|
520
|
+
lines: string[];
|
|
521
|
+
w: number;
|
|
522
|
+
h: number;
|
|
523
|
+
};
|
|
524
|
+
/** Wraps a container's name into its pill at 1x. `measure(text, px)` is the width of `text` in the note face at `px`
|
|
525
|
+
* (an injected canvas measure, like wrapLines in idea.ts); `scale` is the label scale (1.15 in large type). Lines break
|
|
526
|
+
* at spaces first; a word wider than a whole line (the pill's room: `maxWidth` less the padding and border) is split
|
|
527
|
+
* across lines, each filled with as many characters as fit, never inside a character (an emoji, a combining mark), so
|
|
528
|
+
* every line fits the pill. Past `maxLines` the last line ends in an ellipsis that fits. `w` is the widest line plus
|
|
529
|
+
* the chrome (at most `maxWidth`), `h` the lines plus the chrome. */
|
|
530
|
+
declare function pillLayout(name: string, measure: (text: string, px: number) => number, scale?: number): PillSize;
|
|
531
|
+
/** The pill as drawn at label growth `k` (1 to PILL.maxGrow): the text grows, the padding and border don't. */
|
|
532
|
+
declare function pillScaled(p: {
|
|
533
|
+
w: number;
|
|
534
|
+
h: number;
|
|
535
|
+
}, k: number): {
|
|
536
|
+
w: number;
|
|
537
|
+
h: number;
|
|
538
|
+
};
|
|
486
539
|
/** The hull around a group's ideas: `padX` / `padY` beyond their centres, or more for an idea that has grown to show
|
|
487
|
-
* its label (`rx` / `ry`, its half size: then its outline plus HULL_CLEAR).
|
|
540
|
+
* its label (`rx` / `ry`, its half size: then its outline plus HULL_CLEAR). With the name's `pill` (its 1x size,
|
|
541
|
+
* from pillLayout) the hull is also widened, symmetrically about its centre, so that the pill at its largest drawn
|
|
542
|
+
* size (PILL.maxGrow) fits on the straight part of an edge: pill width + 2 × the corner radius. Hull and pill then
|
|
543
|
+
* never change while zooming. Without a pill the hull is as before. */
|
|
488
544
|
declare function containerHull(members: ReadonlyArray<Pt & {
|
|
489
545
|
rx?: number;
|
|
490
546
|
ry?: number;
|
|
491
|
-
}
|
|
547
|
+
}>, pill?: {
|
|
548
|
+
w: number;
|
|
549
|
+
h: number;
|
|
550
|
+
} | null): Hull | null;
|
|
492
551
|
/** Candidate spots for a w × h pill, in preference order: bottom center (the default look), top center, the thirds of
|
|
493
552
|
* bottom and top, then the sides. Spots keep the whole pill on the straight part of an edge, clear of the corners. */
|
|
494
553
|
declare function labelCandidates(hull: Hull, w: number, h: number): {
|
|
@@ -522,4 +581,4 @@ declare function ideaDetail(screenWidth: number, emphasised?: boolean): IdeaDeta
|
|
|
522
581
|
/** Whether idea shadows are drawn with this many ideas in view. */
|
|
523
582
|
declare function shadowsShown(visibleIdeas: number): boolean;
|
|
524
583
|
|
|
525
|
-
export { BACK, type Bezier, type BoundingBox, type ContainerGroupInfo, type CullingOptions, DETAIL, EASE, FEATURE_FLAGS, FIT_ROOM, FRAME, type FitResult, FlatNode, type FrameBox, type FrameInsets, GESTURE, HULL, HULL_CLEAR, type Hull, type IRenderConfigStore, type ISelectionStore, type ISpatialIndex, type IdeaDetail, type Box as LabelBox, type LabelPlacement, type LabelSide, type LayerVia, MOTION, MindMapConnection, NodeSelection, PEEK, PEEK_PLACEMENT, type Pt, RBushSpatialIndex, RenderConfig, SHEET, TERM, TRAIL, VIEW, ViewportState, VisualliDocument, VisualliLayer, bloomOffset, calculateFitCenter, calculateFitView, calculateFitZoom, connectorDelay, connectorSamples, containerHull, cssEase, ease as easeBezier, fitView, fitViewInset, getChildLayerForNode, getConnectionsForLayer, getContainersForLayer, getLayerForNavigation, getViewportVisibleNodes, hoverOpensTerm, ideaDetail, intersectsViewport, labelCandidates, layerBlooms, layerBounds, layerFrame, layerReveal, motionVars, peekPosition, pinchZoom, placeContainerLabel, pointerModeFor, renderConfigStore, revealDelay, revealSlot, revealTotal, selectionStore, shadowsShown, swapDelay, zoomAround };
|
|
584
|
+
export { BACK, type Bezier, type BoundingBox, type ContainerGroupInfo, type CullingOptions, DETAIL, EASE, FEATURE_FLAGS, FIT_ROOM, FRAME, type FitContainer, type FitResult, FlatNode, type FrameBox, type FrameInsets, GESTURE, HULL, HULL_CLEAR, type Hull, type IRenderConfigStore, type ISelectionStore, type ISpatialIndex, type IdeaDetail, type Box as LabelBox, type LabelPlacement, type LabelSide, type LayerVia, MOTION, MindMapConnection, NodeSelection, PEEK, PEEK_PLACEMENT, PILL, PILL_CHROME, type PillSize, type Pt, RBushSpatialIndex, RenderConfig, SHEET, TERM, TRAIL, VIEW, ViewportState, VisualliDocument, VisualliLayer, bloomOffset, calculateFitCenter, calculateFitView, calculateFitZoom, connectorDelay, connectorSamples, containerHull, cssEase, ease as easeBezier, fitView, fitViewInset, getChildLayerForNode, getConnectionsForLayer, getContainersForLayer, getLayerForNavigation, getViewportVisibleNodes, hoverOpensTerm, ideaDetail, ideaHighlight, intersectsViewport, labelCandidates, layerBlooms, layerBounds, layerFrame, layerReveal, motionVars, peekPosition, pillLayout, pillScaled, pinchZoom, placeContainerLabel, pointerModeFor, renderConfigStore, revealDelay, revealSlot, revealTotal, selectionStore, shadowsShown, swapDelay, zoomAround };
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
setViewportCenter,
|
|
10
10
|
worldToScreen,
|
|
11
11
|
zoomViewport
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YU3KV4UY.js";
|
|
13
13
|
import "./chunk-LSPDGEVE.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_RENDER_CONFIG,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getRecommendedRenderConfig,
|
|
23
23
|
getRenderConfigForQuality,
|
|
24
24
|
isFeatureEnabled
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-2JCBDPOL.js";
|
|
26
26
|
import {
|
|
27
27
|
checkCollision,
|
|
28
28
|
getNodeBounds,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
parseVisualliFile,
|
|
50
50
|
parseVisualliFromMongoDB,
|
|
51
51
|
resolveNodeOverlaps
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-EGXQEULM.js";
|
|
53
53
|
import {
|
|
54
54
|
BLOB_SHAPES,
|
|
55
55
|
ELLIPSE,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
shapeOfLevel,
|
|
82
82
|
wrapInShape,
|
|
83
83
|
wrapLines
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-3UZU4SK5.js";
|
|
85
85
|
import {
|
|
86
86
|
LAYOUT_SPACING
|
|
87
87
|
} from "./chunk-N7HCYULH.js";
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
FPSMonitor,
|
|
97
97
|
MemoryMonitor,
|
|
98
98
|
PerformanceProfiler
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-T3SFVKHY.js";
|
|
100
100
|
import {
|
|
101
101
|
BACK,
|
|
102
102
|
CIRCULAR_REFERENCE_MAX_DEPTH,
|
|
@@ -152,12 +152,13 @@ import {
|
|
|
152
152
|
fitView,
|
|
153
153
|
fitViewInset,
|
|
154
154
|
hoverOpensTerm,
|
|
155
|
+
ideaHighlight,
|
|
155
156
|
layerBounds,
|
|
156
157
|
peekPosition,
|
|
157
158
|
pinchZoom,
|
|
158
159
|
pointerModeFor,
|
|
159
160
|
zoomAround
|
|
160
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-3RLUS5K7.js";
|
|
161
162
|
import {
|
|
162
163
|
CUSTOM,
|
|
163
164
|
IMMERSION,
|
|
@@ -178,7 +179,7 @@ import {
|
|
|
178
179
|
topicFor,
|
|
179
180
|
topicFromName,
|
|
180
181
|
topicStyle
|
|
181
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-6GAKZATW.js";
|
|
182
183
|
import {
|
|
183
184
|
CANVAS_STYLE,
|
|
184
185
|
DESIGN_SYSTEM_VERSION,
|
|
@@ -188,7 +189,7 @@ import {
|
|
|
188
189
|
TOKENS,
|
|
189
190
|
TOPICS,
|
|
190
191
|
TYPE_STYLES
|
|
191
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-6LHBNFP4.js";
|
|
192
193
|
import "./chunk-VLGR5PZX.js";
|
|
193
194
|
|
|
194
195
|
// src/spatial/spatialIndex.ts
|
|
@@ -292,7 +293,69 @@ var renderConfigStore = createStore((set, get) => ({
|
|
|
292
293
|
var HULL = { padX: 150, padY: 125, radius: 48 };
|
|
293
294
|
var WEIGHT = { idea: 1e3, label: 1e3, connector: 60, preference: 1 };
|
|
294
295
|
var HULL_CLEAR = { x: 50, y: 51 };
|
|
295
|
-
|
|
296
|
+
var PILL = {
|
|
297
|
+
fontPx: 26,
|
|
298
|
+
lineHeight: 1.1,
|
|
299
|
+
padX: 22,
|
|
300
|
+
padTop: 6,
|
|
301
|
+
padBottom: 8,
|
|
302
|
+
border: 1.5,
|
|
303
|
+
maxWidth: 420,
|
|
304
|
+
maxLines: 3,
|
|
305
|
+
maxGrow: 1.3
|
|
306
|
+
};
|
|
307
|
+
var PILL_CHROME = { w: 2 * PILL.padX + 2 * PILL.border, h: PILL.padTop + PILL.padBottom + 2 * PILL.border };
|
|
308
|
+
function graphemes(text) {
|
|
309
|
+
const out = [], joins = /^[\p{M}\u200d\ufe00-\ufe0f\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}]$/u, flag = /^[\u{1f1e6}-\u{1f1ff}]$/u;
|
|
310
|
+
for (const c of Array.from(text)) {
|
|
311
|
+
const last = out.length - 1;
|
|
312
|
+
if (last >= 0 && (joins.test(c) || out[last].endsWith("\u200D") || flag.test(c) && Array.from(out[last]).every((x) => flag.test(x)) && Array.from(out[last]).length % 2 === 1)) out[last] += c;
|
|
313
|
+
else out.push(c);
|
|
314
|
+
}
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
317
|
+
function pillLayout(name, measure, scale = 1) {
|
|
318
|
+
const px = PILL.fontPx * scale, room = PILL.maxWidth - PILL_CHROME.w, m = (s) => measure(s, px);
|
|
319
|
+
const rows = [];
|
|
320
|
+
let cur = "";
|
|
321
|
+
for (const w of name.split(/\s+/).filter(Boolean)) {
|
|
322
|
+
if (m(w) > room) {
|
|
323
|
+
if (cur) rows.push({ text: cur, mid: false });
|
|
324
|
+
let part = "";
|
|
325
|
+
for (const g of graphemes(w)) {
|
|
326
|
+
if (part && m(part + g) > room) {
|
|
327
|
+
rows.push({ text: part, mid: true });
|
|
328
|
+
part = g;
|
|
329
|
+
} else part += g;
|
|
330
|
+
}
|
|
331
|
+
cur = part;
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
const next = cur ? `${cur} ${w}` : w;
|
|
335
|
+
if (cur && m(next) > room) {
|
|
336
|
+
rows.push({ text: cur, mid: false });
|
|
337
|
+
cur = w;
|
|
338
|
+
} else cur = next;
|
|
339
|
+
}
|
|
340
|
+
if (cur) rows.push({ text: cur, mid: false });
|
|
341
|
+
let lines = rows.map((r) => r.text);
|
|
342
|
+
if (!lines.length) lines = [""];
|
|
343
|
+
if (rows.length > PILL.maxLines) {
|
|
344
|
+
let rest = "";
|
|
345
|
+
rows.slice(PILL.maxLines - 1).forEach((r, i, a) => {
|
|
346
|
+
rest += r.text + (i < a.length - 1 && !r.mid ? " " : "");
|
|
347
|
+
});
|
|
348
|
+
const gs = graphemes(rest);
|
|
349
|
+
while (gs.length > 1 && m(gs.join("") + "\u2026") > room) gs.pop();
|
|
350
|
+
lines = [...lines.slice(0, PILL.maxLines - 1), gs.join("").replace(/\s+$/, "") + "\u2026"];
|
|
351
|
+
}
|
|
352
|
+
const widest = Math.max(...lines.map(m));
|
|
353
|
+
return { lines, w: Math.min(PILL.maxWidth, widest + PILL_CHROME.w), h: lines.length * px * PILL.lineHeight + PILL_CHROME.h };
|
|
354
|
+
}
|
|
355
|
+
function pillScaled(p, k) {
|
|
356
|
+
return { w: (p.w - PILL_CHROME.w) * k + PILL_CHROME.w, h: (p.h - PILL_CHROME.h) * k + PILL_CHROME.h };
|
|
357
|
+
}
|
|
358
|
+
function containerHull(members, pill) {
|
|
296
359
|
if (!members.length) return null;
|
|
297
360
|
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
298
361
|
for (const m of members) {
|
|
@@ -302,6 +365,13 @@ function containerHull(members) {
|
|
|
302
365
|
y0 = Math.min(y0, m.y - py);
|
|
303
366
|
y1 = Math.max(y1, m.y + py);
|
|
304
367
|
}
|
|
368
|
+
if (pill) {
|
|
369
|
+
const need = pillScaled(pill, PILL.maxGrow).w + 2 * HULL.radius, cx = (x0 + x1) / 2;
|
|
370
|
+
if (x1 - x0 < need) {
|
|
371
|
+
x0 = cx - need / 2;
|
|
372
|
+
x1 = cx + need / 2;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
305
375
|
return { x0, x1, y0, y1, radius: HULL.radius };
|
|
306
376
|
}
|
|
307
377
|
function labelCandidates(hull, w, h) {
|
|
@@ -385,8 +455,8 @@ function layerFrame(nodes, containers = []) {
|
|
|
385
455
|
const hull = containerHull(c.nodeIds.flatMap((id) => {
|
|
386
456
|
const n = byId.get(id);
|
|
387
457
|
return n ? [{ x: n.x, y: n.y, rx: n.width / 2, ry: n.height / 2 }] : [];
|
|
388
|
-
}));
|
|
389
|
-
if (hull) hulls.push(hull);
|
|
458
|
+
}), c.pill);
|
|
459
|
+
if (hull) hulls.push(c.pill ? { ...hull, pillH: pillScaled(c.pill, PILL.maxGrow).h } : hull);
|
|
390
460
|
}
|
|
391
461
|
return layerBounds(nodes.map((n) => ({ x: n.x, y: n.y, rx: n.width / 2, ry: n.height / 2 })), hulls);
|
|
392
462
|
}
|
|
@@ -677,6 +747,8 @@ export {
|
|
|
677
747
|
PEEK,
|
|
678
748
|
PEEK_PLACEMENT,
|
|
679
749
|
PERFORMANCE_TOAST_COOLDOWN,
|
|
750
|
+
PILL,
|
|
751
|
+
PILL_CHROME,
|
|
680
752
|
PerformanceProfiler,
|
|
681
753
|
QUALITY_HIGH,
|
|
682
754
|
QUALITY_LEVELS,
|
|
@@ -766,6 +838,7 @@ export {
|
|
|
766
838
|
hoverOpensTerm,
|
|
767
839
|
ideaColor,
|
|
768
840
|
ideaDetail,
|
|
841
|
+
ideaHighlight,
|
|
769
842
|
ideaKindOf,
|
|
770
843
|
ideaSize,
|
|
771
844
|
ideaStyle,
|
|
@@ -797,6 +870,8 @@ export {
|
|
|
797
870
|
parseVisualliFile,
|
|
798
871
|
parseVisualliFromMongoDB,
|
|
799
872
|
peekPosition,
|
|
873
|
+
pillLayout,
|
|
874
|
+
pillScaled,
|
|
800
875
|
pinchZoom,
|
|
801
876
|
placeContainerLabel,
|
|
802
877
|
pointerModeFor,
|