@mark1russell7/visuals 0.3.5 → 0.3.7

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/build/graph.js CHANGED
@@ -1,4 +1,5 @@
1
- import { a as partAt, c as highlightOf, f as KEY_ZOOM, l as isClick, n as easeInOut, r as lessMotion, s as NO_HIGHLIGHTS, u as KEY_PART } from "./motion-VS13e4Pw.js";
1
+ import { a as partAt, c as highlightOf, f as KEY_ZOOM, l as isClick, n as easeInOut, r as lessMotion, s as NO_HIGHLIGHTS, t as approach, u as KEY_PART } from "./motion-VS13e4Pw.js";
2
+ import { grow, overlapOf, pathBounds, pathEnd, pathStart, pictureBounds, pointPolylineDistance, pointRegionDistance, rectCenter, samplePath, translate } from "@mark1russell7/layout-contract";
2
3
  // src/graph/camera.ts
3
4
  /** The default limits of the zoom. */
4
5
  const ZOOM_LIMITS = {
@@ -123,16 +124,6 @@ function freeArea(size, insets = {}) {
123
124
  }
124
125
  /** The default distance between a rectangle that a camera shows and each edge of the area, in CSS pixels. */
125
126
  const FIT_PADDING = 24;
126
- /**
127
- * This function gives the middle of a rectangle.
128
- * The home of this function is `@mark1russell7/layout-contract`, which does not have it. It moves there with the records of a picture.
129
- */
130
- function middleOf(rect) {
131
- return {
132
- x: rect.x + rect.w / 2,
133
- y: rect.y + rect.h / 2
134
- };
135
- }
136
127
  /** This function gives the zoom at which a rectangle of the picture fills an area of the screen, with a padding at each edge. */
137
128
  function fillZoom(rect, area, padding) {
138
129
  const width = Math.max(area.w - 2 * padding, 1);
@@ -146,7 +137,7 @@ function fillZoom(rect, area, padding) {
146
137
  function fitRect(rect, area, options = {}) {
147
138
  const limits = options.limits ?? ZOOM_LIMITS;
148
139
  const k = clampZoom(Math.min(options.most ?? limits.max, fillZoom(rect, area, options.padding ?? 24)), limits);
149
- return viewAt(middleOf(rect), middleOf(area), k);
140
+ return viewAt(rectCenter(rect), rectCenter(area), k);
150
141
  }
151
142
  /**
152
143
  * This function gives the limits of the zoom for a picture with the bounds `bounds`.
@@ -204,7 +195,7 @@ function frameRects(rects, area, options) {
204
195
  }
205
196
  const last = rects.at(-1);
206
197
  if (last === void 0) return void 0;
207
- return viewAt(middleOf(last), middleOf(area), clampZoom(options.least, options.limits));
198
+ return viewAt(rectCenter(last), rectCenter(area), clampZoom(options.least, options.limits));
208
199
  }
209
200
  /**
210
201
  * This function tells if a view shows all of a rectangle of the picture in an area of the screen.
@@ -293,6 +284,987 @@ function aimReveal(rects, options) {
293
284
  limits: options.limits ?? frame.limits
294
285
  });
295
286
  }
287
+ // src/graph/draw.ts
288
+ const TURN = 2 * Math.PI;
289
+ /** This function adds a path of the picture to the path of a context. */
290
+ function tracePath(context, path) {
291
+ for (const segment of path) switch (segment.kind) {
292
+ case "move":
293
+ context.moveTo(segment.to.x, segment.to.y);
294
+ break;
295
+ case "line":
296
+ context.lineTo(segment.to.x, segment.to.y);
297
+ break;
298
+ case "cubic":
299
+ context.bezierCurveTo(segment.c1.x, segment.c1.y, segment.c2.x, segment.c2.y, segment.to.x, segment.to.y);
300
+ break;
301
+ case "arc": context.arc(segment.center.x, segment.center.y, segment.radius, segment.start, segment.start + segment.sweep, segment.sweep < 0);
302
+ }
303
+ }
304
+ /** This function makes the path of an outline in a context. */
305
+ function trace(context, outline) {
306
+ context.beginPath();
307
+ switch (outline.kind) {
308
+ case "rect":
309
+ if (outline.radius > 0 && typeof context.roundRect === "function") context.roundRect(outline.x, outline.y, outline.w, outline.h, outline.radius);
310
+ else context.rect(outline.x, outline.y, outline.w, outline.h);
311
+ break;
312
+ case "ellipse":
313
+ context.ellipse(outline.cx, outline.cy, outline.rx, outline.ry, 0, 0, TURN);
314
+ break;
315
+ case "polygon":
316
+ for (const ring of outline.rings) {
317
+ ring.forEach(([x, y], i) => i === 0 ? context.moveTo(x, y) : context.lineTo(x, y));
318
+ context.closePath();
319
+ }
320
+ break;
321
+ case "path": tracePath(context, outline.path);
322
+ }
323
+ }
324
+ /**
325
+ * This function draws a paint list on a canvas, in the order of the list. `paintPicture` makes the list.
326
+ *
327
+ * The unit of the context is the CSS pixel, as a flat stage gives it: the function applies the view of the camera.
328
+ * The function keeps the state of the context: after it, the context has the transform and the styles that it had before.
329
+ */
330
+ function drawShapes(context, shapes, view) {
331
+ if (shapes.length === 0) return;
332
+ context.save();
333
+ context.transform(view.k, 0, 0, view.k, view.x, view.y);
334
+ context.lineJoin = "round";
335
+ context.lineCap = "round";
336
+ context.textBaseline = "middle";
337
+ /** This value is true while the context has dashes. Most shapes have none, so the function sets them only at a change. */
338
+ let dashed = false;
339
+ for (const shape of shapes) {
340
+ context.globalAlpha = shape.opacity;
341
+ if (shape.type === "text") {
342
+ context.font = shape.font;
343
+ context.textAlign = shape.align;
344
+ if (shape.halo !== void 0 && dashed) {
345
+ context.setLineDash([]);
346
+ dashed = false;
347
+ }
348
+ const scale = shape.scale !== void 0 && shape.scale > 0 ? shape.scale : 1;
349
+ let { x, y } = shape;
350
+ if (scale !== 1) {
351
+ context.save();
352
+ context.translate(x, y);
353
+ context.scale(scale, scale);
354
+ x = 0;
355
+ y = 0;
356
+ }
357
+ if (shape.halo !== void 0) {
358
+ context.strokeStyle = shape.halo.color;
359
+ context.lineWidth = shape.halo.width / scale;
360
+ context.strokeText(shape.text, x, y);
361
+ }
362
+ context.fillStyle = shape.fill;
363
+ context.fillText(shape.text, x, y);
364
+ if (scale !== 1) context.restore();
365
+ continue;
366
+ }
367
+ trace(context, shape.outline);
368
+ if (shape.fill !== void 0) {
369
+ context.fillStyle = shape.fill;
370
+ context.fill("evenodd");
371
+ }
372
+ if (shape.stroke !== void 0 && shape.lineWidth !== void 0 && shape.lineWidth > 0) {
373
+ const dash = shape.dash;
374
+ const next = dash !== void 0 && dash.length > 0;
375
+ if (next || dashed) {
376
+ context.setLineDash(next ? [...dash] : []);
377
+ dashed = next;
378
+ }
379
+ context.strokeStyle = shape.stroke;
380
+ context.lineWidth = shape.lineWidth;
381
+ context.stroke();
382
+ }
383
+ }
384
+ context.restore();
385
+ }
386
+ // src/graph/focus.ts
387
+ /** The share of the color that a record keeps at each focus level. */
388
+ const FOCUS_OPACITY = {
389
+ all: 1,
390
+ in: 1,
391
+ beside: .55,
392
+ out: .2
393
+ };
394
+ /**
395
+ * This function gives the focus of a list of records, or `undefined` when the picture has none of them.
396
+ *
397
+ * - A box brings each box below it in the tree.
398
+ * - Each route at one of these boxes is in the focus, with the box at its other end.
399
+ * - A route brings its two boxes.
400
+ * - Each box of the focus brings each box above it in the tree, so the card of a row stays clear.
401
+ */
402
+ function focusOf(index, seeds) {
403
+ const boxes = /* @__PURE__ */ new Set();
404
+ const routes = /* @__PURE__ */ new Set();
405
+ /** The boxes of the list, and each box below them. */
406
+ const own = [];
407
+ const addRoute = (route) => {
408
+ routes.add(route.id);
409
+ if (index.boxes.has(route.source)) boxes.add(route.source);
410
+ if (index.boxes.has(route.target)) boxes.add(route.target);
411
+ };
412
+ const seedRoutes = [];
413
+ for (const seed of seeds) {
414
+ const route = index.routes.get(seed);
415
+ if (route !== void 0) seedRoutes.push(route);
416
+ if (!index.boxes.has(seed)) continue;
417
+ const stack = [seed];
418
+ for (let id = stack.pop(); id !== void 0; id = stack.pop()) {
419
+ if (boxes.has(id)) continue;
420
+ boxes.add(id);
421
+ own.push(id);
422
+ for (const child of index.children.get(id) ?? []) stack.push(child.id);
423
+ }
424
+ }
425
+ for (const id of own) for (const route of index.routesAt.get(id) ?? []) addRoute(route);
426
+ for (const route of seedRoutes) addRoute(route);
427
+ for (const id of [...boxes]) for (let parent = index.boxes.get(id)?.parent; parent !== void 0 && index.boxes.has(parent) && !boxes.has(parent); parent = index.boxes.get(parent)?.parent) boxes.add(parent);
428
+ return boxes.size === 0 && routes.size === 0 ? void 0 : {
429
+ boxes,
430
+ routes
431
+ };
432
+ }
433
+ /** This function gives the focus level of a box. */
434
+ function boxFocus(focus, box) {
435
+ if (focus === void 0) return "all";
436
+ if (focus.boxes.has(box.id)) return "in";
437
+ return box.parent !== void 0 && focus.boxes.has(box.parent) ? "beside" : "out";
438
+ }
439
+ /** This function gives the focus level of a route: `all`, `in` or `out`. */
440
+ function routeFocus(focus, route) {
441
+ if (focus === void 0) return "all";
442
+ return focus.routes.has(route.id) ? "in" : "out";
443
+ }
444
+ // src/graph/records.ts
445
+ /** This function adds a value to the list of a key. */
446
+ function add(lists, key, value) {
447
+ const list = lists.get(key);
448
+ if (list === void 0) lists.set(key, [value]);
449
+ else list.push(value);
450
+ }
451
+ /**
452
+ * This function makes the tables of a picture. It does not examine the picture: `checkPicture` of `@mark1russell7/layout-contract` does that.
453
+ * For an id that two boxes have, the table has the last box. A label that names a record that the picture does not have is in no table.
454
+ * Thus a page that removes a route from a picture can keep the label of the route.
455
+ */
456
+ function indexPicture(picture) {
457
+ const boxes = /* @__PURE__ */ new Map();
458
+ const routes = /* @__PURE__ */ new Map();
459
+ const children = /* @__PURE__ */ new Map();
460
+ const routesAt = /* @__PURE__ */ new Map();
461
+ const boxLabels = /* @__PURE__ */ new Map();
462
+ const routeLabels = /* @__PURE__ */ new Map();
463
+ const freeLabels = [];
464
+ for (const box of picture.boxes) {
465
+ boxes.set(box.id, box);
466
+ if (box.parent !== void 0) add(children, box.parent, box);
467
+ }
468
+ for (const route of picture.routes) {
469
+ routes.set(route.id, route);
470
+ add(routesAt, route.source, route);
471
+ if (route.target !== route.source) add(routesAt, route.target, route);
472
+ }
473
+ for (const label of picture.labels) if (label.box !== void 0) {
474
+ if (boxes.has(label.box)) add(boxLabels, label.box, label);
475
+ } else if (label.route !== void 0) {
476
+ if (routes.has(label.route)) add(routeLabels, label.route, label);
477
+ } else freeLabels.push(label);
478
+ return {
479
+ picture,
480
+ boxes,
481
+ routes,
482
+ children,
483
+ routesAt,
484
+ boxLabels,
485
+ routeLabels,
486
+ freeLabels
487
+ };
488
+ }
489
+ const lines = /* @__PURE__ */ new WeakMap();
490
+ /**
491
+ * This function gives the line of a route, or `undefined` for a route with an empty path.
492
+ * It keeps the line of each route, so a second question about a route costs nothing.
493
+ */
494
+ function routeLine(route) {
495
+ if (route.path.length === 0) return void 0;
496
+ const known = lines.get(route);
497
+ if (known !== void 0) return known;
498
+ const line = {
499
+ bounds: pathBounds(route.path),
500
+ points: samplePath(route.path)
501
+ };
502
+ lines.set(route, line);
503
+ return line;
504
+ }
505
+ // src/graph/hit.ts
506
+ /** This function gives the distance from a point to a box, and 0 for a point in the box. A box with a `shape` is that region. */
507
+ function boxDistance(box, point) {
508
+ if (box.shape === void 0) return pointRegionDistance(point, {
509
+ kind: "rect",
510
+ x: box.x,
511
+ y: box.y,
512
+ w: box.w,
513
+ h: box.h
514
+ });
515
+ return pointRegionDistance({
516
+ x: point.x - box.x,
517
+ y: point.y - box.y
518
+ }, box.shape);
519
+ }
520
+ const boxesOnly$1 = (record) => record.type === "box";
521
+ /**
522
+ * This function gives the record of a picture below a point, or `undefined` for no record.
523
+ *
524
+ * - A box with no child comes first: the top box at the point, then the nearest box in the slack.
525
+ * - A route comes next: the nearest route in the slack. A route is thin, so it comes before a container.
526
+ * - A box with children comes last: the top one at the point, then the nearest one in the slack.
527
+ *
528
+ * The last record of a list of the picture is the top one. The distance to a route has an error of 0.5 units or less.
529
+ */
530
+ function pickRecord(index, point, options = {}) {
531
+ const slack = Math.max(0, options.slack ?? 0);
532
+ const picks = options.picks ?? boxesOnly$1;
533
+ let leaf;
534
+ let nearLeaf;
535
+ let nearLeafAt = 1e400;
536
+ let container;
537
+ let nearContainer;
538
+ let nearContainerAt = 1e400;
539
+ for (const box of index.picture.boxes) {
540
+ if (point.x < box.x - slack || point.x > box.x + box.w + slack || point.y < box.y - slack || point.y > box.y + box.h + slack) continue;
541
+ const distance = boxDistance(box, point);
542
+ if (distance > slack) continue;
543
+ const record = {
544
+ type: "box",
545
+ id: box.id,
546
+ box
547
+ };
548
+ if (!picks(record)) continue;
549
+ if (index.children.has(box.id)) {
550
+ if (distance === 0) container = record;
551
+ else if (distance <= nearContainerAt) {
552
+ nearContainer = record;
553
+ nearContainerAt = distance;
554
+ }
555
+ } else if (distance === 0) leaf = record;
556
+ else if (distance <= nearLeafAt) {
557
+ nearLeaf = record;
558
+ nearLeafAt = distance;
559
+ }
560
+ }
561
+ if (leaf !== void 0) return leaf;
562
+ if (nearLeaf !== void 0) return nearLeaf;
563
+ let found;
564
+ let foundAt = 1e400;
565
+ for (const route of index.picture.routes) {
566
+ const line = routeLine(route);
567
+ if (line === void 0) continue;
568
+ const { bounds } = line;
569
+ if (point.x < bounds.x - slack || point.x > bounds.x + bounds.w + slack || point.y < bounds.y - slack || point.y > bounds.y + bounds.h + slack) continue;
570
+ const record = {
571
+ type: "route",
572
+ id: route.id,
573
+ route
574
+ };
575
+ if (!picks(record)) continue;
576
+ const distance = pointPolylineDistance(point, line.points);
577
+ if (distance > slack || distance > foundAt) continue;
578
+ found = record;
579
+ foundAt = distance;
580
+ }
581
+ return found ?? container ?? nearContainer;
582
+ }
583
+ // src/graph/looks.ts
584
+ /**
585
+ * This function gives the size of one unit of a look, in the unit of the picture.
586
+ * The widths of the lines, the dashes and the sizes of the signs of a look are in this unit.
587
+ *
588
+ * At the zoom 1 or less, one unit is one CSS pixel. Thus a thin line stays clear in a small picture.
589
+ * Above the zoom 1, one unit is one unit of the picture. Thus a line grows with its box.
590
+ */
591
+ function lookUnit(zoom) {
592
+ return zoom > 0 && zoom < 1 ? 1 / zoom : 1;
593
+ }
594
+ /** The largest height on the screen that a label keeps with `least`, in CSS pixels. A larger value of `least` becomes this value. */
595
+ const MOST_KEPT_LINE = 32;
596
+ /** The colors of a plain picture on a light page. */
597
+ const LIGHT_PICTURE_THEME = {
598
+ box: "#ffffff",
599
+ boxLine: "#454f67",
600
+ container: "#eef1f6",
601
+ containerLine: "#aeb6c7",
602
+ text: "#151c2e",
603
+ mutedText: "#5f6880",
604
+ route: "#7a8399",
605
+ accent: "#2346c4",
606
+ paper: "#f5f6f9"
607
+ };
608
+ /** The colors of a plain picture on a dark page. */
609
+ const DARK_PICTURE_THEME = {
610
+ box: "#151a2b",
611
+ boxLine: "#b3bad0",
612
+ container: "#1c2236",
613
+ containerLine: "#46507a",
614
+ text: "#e6e9f3",
615
+ mutedText: "#949cb3",
616
+ route: "#6f7aa3",
617
+ accent: "#93abff",
618
+ paper: "#0e1220"
619
+ };
620
+ /** The smallest height of a line of text on the screen that a person can read, in CSS pixels. A smaller line is a bar in a plain picture. */
621
+ const SMALLEST_TEXT_LINE = 11;
622
+ /** The smallest height of a line of text on the screen that a plain picture shows as a bar, in CSS pixels. */
623
+ const SMALLEST_BAR_LINE = 2.5;
624
+ /** The smallest width on the screen of a box with children whose name stays a text in a plain picture, in CSS pixels. */
625
+ const SMALLEST_NAMED_BOX = 48;
626
+ /**
627
+ * This function gives the looks of a plain picture: boxes with a border, routes as lines and the text of the labels.
628
+ *
629
+ * - A record below the pointer has the color `accent`. The selected record has a wider line too.
630
+ * - A box with children has the colors of a container, and its label has the muted color.
631
+ * - The label of a route has a line of the color `paper` around its letters.
632
+ * - A text that is too small to read is a row of bars. A text that is smaller than a bar has no paint.
633
+ * - The name of a box with children stays a text in a far view, while the box is `SMALLEST_NAMED_BOX` wide or more on the screen.
634
+ * The name of such a box with a highlight stays a text at each size.
635
+ */
636
+ function plainLooks(options = {}) {
637
+ const radius = options.radius ?? 6;
638
+ return {
639
+ box(_box, state, theme) {
640
+ const plain = state.container ? theme.containerLine : theme.boxLine;
641
+ return {
642
+ fill: state.container ? theme.container : theme.box,
643
+ stroke: state.highlight > 0 ? theme.accent : plain,
644
+ width: state.highlight === 2 ? 2 : 1,
645
+ radius
646
+ };
647
+ },
648
+ route(_route, state, theme) {
649
+ return {
650
+ stroke: state.highlight > 0 ? theme.accent : theme.route,
651
+ width: state.highlight === 2 ? 2 : 1.25,
652
+ end: options.end
653
+ };
654
+ },
655
+ label(label, state, theme, of) {
656
+ const tall = label.lineHeight * state.zoom;
657
+ if (tall < 11 && state.container && of?.type === "box" && (state.highlight > 0 || of.box.w * state.zoom >= 48)) return {
658
+ color: theme.mutedText,
659
+ halo: theme.paper,
660
+ least: 11
661
+ };
662
+ if (tall < 2.5) return void 0;
663
+ if (tall < 11) return {
664
+ color: theme.containerLine,
665
+ as: "bars"
666
+ };
667
+ if (of?.type === "route") return {
668
+ color: theme.text,
669
+ halo: theme.paper
670
+ };
671
+ return { color: state.container ? theme.mutedText : theme.text };
672
+ }
673
+ };
674
+ }
675
+ // src/graph/paint.ts
676
+ /** The key of the labels that name no record, for `fade`. */
677
+ const FREE_LABELS = "labels";
678
+ /** The distance out of the view at which a record keeps its shapes, in units of a look. A ring, a sign or a wide line can be this far from its record. */
679
+ const VIEW_MARGIN = 24;
680
+ /** The height of a bar of a label, as a share of the height of its line. */
681
+ const BAR_HEIGHT = .42;
682
+ /** The width of the line around the letters of a label, as a share of the height of its line. */
683
+ const HALO_WIDTH = .25;
684
+ /** The half width of an arrow at the end of a route, as a share of its length. */
685
+ const ARROW_SPREAD = .45;
686
+ /** The smallest distance between two labels that keep a height on the screen, in units of a look. */
687
+ const KEPT_GAP = 4;
688
+ /** This function gives the key of a record for `fade`: its type, a colon and its id. A box and a route with the same id have different keys. */
689
+ function recordKey(type, id) {
690
+ return `${type}:${id}`;
691
+ }
692
+ /** This function gives the state of a box for its look. */
693
+ function boxState(index, box, state) {
694
+ return {
695
+ highlight: state.highlight(box.id),
696
+ focus: boxFocus(state.focus, box),
697
+ zoom: state.zoom,
698
+ container: index.children.has(box.id)
699
+ };
700
+ }
701
+ /** This function gives the state of a route for its look. */
702
+ function routeState(route, state) {
703
+ return {
704
+ highlight: state.highlight(route.id),
705
+ focus: routeFocus(state.focus, route),
706
+ zoom: state.zoom,
707
+ container: false
708
+ };
709
+ }
710
+ /** This function gives the outline of a box, larger by `more` at each side. A polygon does not become larger. */
711
+ function outlineOf(box, radius, more) {
712
+ const region = box.shape === void 0 ? {
713
+ kind: "rect",
714
+ x: box.x,
715
+ y: box.y,
716
+ w: box.w,
717
+ h: box.h
718
+ } : translate(box.shape, box.x, box.y);
719
+ switch (region.kind) {
720
+ case "rect": {
721
+ const w = Math.max(0, region.w + 2 * more);
722
+ const h = Math.max(0, region.h + 2 * more);
723
+ return {
724
+ kind: "rect",
725
+ x: region.x - more,
726
+ y: region.y - more,
727
+ w,
728
+ h,
729
+ radius: Math.max(0, Math.min(radius + more, w / 2, h / 2))
730
+ };
731
+ }
732
+ case "circle": return {
733
+ kind: "ellipse",
734
+ cx: region.cx,
735
+ cy: region.cy,
736
+ rx: Math.max(0, region.r + more),
737
+ ry: Math.max(0, region.r + more)
738
+ };
739
+ case "ellipse": return {
740
+ kind: "ellipse",
741
+ cx: region.cx,
742
+ cy: region.cy,
743
+ rx: Math.max(0, region.rx + more),
744
+ ry: Math.max(0, region.ry + more)
745
+ };
746
+ case "polygon": return {
747
+ kind: "polygon",
748
+ rings: region.holes === void 0 ? [region.points] : [region.points, ...region.holes]
749
+ };
750
+ }
751
+ }
752
+ /** This function gives the lengths of a dash in the unit of the picture. */
753
+ function dashOf(dash, unit) {
754
+ return dash === void 0 || dash.length === 0 ? void 0 : dash.map((length) => length * unit);
755
+ }
756
+ /** This function adds the shapes of a box: its ring, its inside and border, and its signs. */
757
+ function addBox(shapes, box, look, unit, share) {
758
+ const opacity = Math.min(1, (look.opacity ?? 1) * share);
759
+ if (!(opacity > 0)) return;
760
+ const radius = look.radius ?? 0;
761
+ if (look.ring !== void 0) {
762
+ const more = (look.ring.gap + look.ring.width / 2) * unit;
763
+ shapes.push({
764
+ type: "shape",
765
+ outline: outlineOf(box, radius, more),
766
+ stroke: look.ring.color,
767
+ lineWidth: look.ring.width * unit,
768
+ opacity
769
+ });
770
+ }
771
+ if (look.fill !== void 0 || look.stroke !== void 0) {
772
+ const line = look.stroke === void 0 ? void 0 : (look.width ?? 1) * unit;
773
+ shapes.push({
774
+ type: "shape",
775
+ outline: outlineOf(box, radius, 0),
776
+ fill: look.fill,
777
+ stroke: look.stroke,
778
+ lineWidth: line,
779
+ dash: dashOf(look.dash, unit),
780
+ opacity
781
+ });
782
+ }
783
+ for (const mark of look.marks ?? []) {
784
+ const r = Math.max(0, mark.radius * unit);
785
+ const outline = {
786
+ kind: "ellipse",
787
+ cx: box.x + mark.x,
788
+ cy: box.y + mark.y,
789
+ rx: r,
790
+ ry: r
791
+ };
792
+ if (mark.shape === "dot") shapes.push({
793
+ type: "shape",
794
+ outline,
795
+ fill: mark.color,
796
+ opacity
797
+ });
798
+ else shapes.push({
799
+ type: "shape",
800
+ outline,
801
+ stroke: mark.color,
802
+ lineWidth: (mark.width ?? 1.5) * unit,
803
+ opacity
804
+ });
805
+ }
806
+ }
807
+ /** This function gives the share of the free width of a label that is at the left of a line: 0, a half or 1. */
808
+ function leftShare(label) {
809
+ return label.align === "center" ? .5 : label.align === "right" ? 1 : 0;
810
+ }
811
+ /**
812
+ * This function gives the factor by which a label becomes larger, so that a line is `least` CSS pixels high on the screen.
813
+ * The factor is 1 for a label that is high enough.
814
+ */
815
+ function keptScale(label, least, zoom) {
816
+ const tall = label.lineHeight * zoom;
817
+ return tall > 0 && tall < least ? least / tall : 1;
818
+ }
819
+ /**
820
+ * This function gives the rectangle of the lines of a label that is larger by a factor. `wide` is the width of the lines before the factor.
821
+ * The middle of the height of the lines keeps its place. A line keeps its left end, its middle or its right end, as the label aligns it.
822
+ */
823
+ function keptRect(label, wide, scale) {
824
+ const left = leftShare(label);
825
+ const tall = label.lines.length * label.lineHeight;
826
+ return {
827
+ x: label.x + left * label.w - left * wide * scale,
828
+ y: label.y + (tall - tall * scale) / 2,
829
+ w: wide * scale,
830
+ h: tall * scale
831
+ };
832
+ }
833
+ /** This function adds the texts of a label that keeps a height on the screen. `rect` is the rectangle of its lines. */
834
+ function addKept(shapes, kept, rect) {
835
+ const { label, look, scale, opacity } = kept;
836
+ const tall = label.lineHeight * scale;
837
+ const halo = look.halo === void 0 ? void 0 : {
838
+ color: look.halo,
839
+ width: tall * HALO_WIDTH
840
+ };
841
+ const x = label.x + leftShare(label) * label.w;
842
+ for (let i = 0; i < label.lines.length; i++) {
843
+ const text = label.lines[i];
844
+ if (text.trim() === "") continue;
845
+ shapes.push({
846
+ type: "text",
847
+ text,
848
+ x,
849
+ y: rect.y + (i + .5) * tall,
850
+ font: label.font,
851
+ align: label.align ?? "left",
852
+ fill: look.color,
853
+ halo,
854
+ opacity,
855
+ scale
856
+ });
857
+ }
858
+ }
859
+ /** This function adds the shapes of a label: one text or one bar for each line that is not empty. */
860
+ function addLabel(shapes, label, look, share, measure) {
861
+ const opacity = Math.min(1, (look.opacity ?? 1) * share);
862
+ if (!(opacity > 0)) return;
863
+ const align = label.align ?? "left";
864
+ const left = leftShare(label);
865
+ for (let i = 0; i < label.lines.length; i++) {
866
+ const text = label.lines[i];
867
+ if (text.trim() === "") continue;
868
+ const y = label.y + (i + .5) * label.lineHeight;
869
+ if (look.as !== "bars") {
870
+ const halo = look.halo === void 0 ? void 0 : {
871
+ color: look.halo,
872
+ width: label.lineHeight * HALO_WIDTH
873
+ };
874
+ shapes.push({
875
+ type: "text",
876
+ text,
877
+ x: label.x + left * label.w,
878
+ y,
879
+ font: label.font,
880
+ align,
881
+ fill: look.color,
882
+ halo,
883
+ opacity
884
+ });
885
+ continue;
886
+ }
887
+ const measured = measure === void 0 ? label.w : measure(label.font, text);
888
+ const wide = label.w > 0 ? Math.min(measured, label.w) : measured;
889
+ if (!(wide > 0)) continue;
890
+ const tall = label.lineHeight * BAR_HEIGHT;
891
+ const outline = {
892
+ kind: "rect",
893
+ x: label.x + left * (label.w - wide),
894
+ y: y - tall / 2,
895
+ w: wide,
896
+ h: tall,
897
+ radius: Math.min(tall, wide) / 2
898
+ };
899
+ shapes.push({
900
+ type: "shape",
901
+ outline,
902
+ fill: look.color,
903
+ opacity
904
+ });
905
+ }
906
+ }
907
+ /** This function adds the sign at one end of a route. `out` is 1 at the target and -1 at the source: an arrow points out of the route. */
908
+ function addEnd(shapes, at, out, end, stroke, lineWidth, unit, opacity) {
909
+ const size = end.size * unit;
910
+ if (!(size > 0)) return;
911
+ const { point } = at;
912
+ if (end.shape === "dot") {
913
+ shapes.push({
914
+ type: "shape",
915
+ outline: {
916
+ kind: "ellipse",
917
+ cx: point.x,
918
+ cy: point.y,
919
+ rx: size,
920
+ ry: size
921
+ },
922
+ fill: stroke,
923
+ opacity
924
+ });
925
+ return;
926
+ }
927
+ const dx = at.direction.x * out;
928
+ const dy = at.direction.y * out;
929
+ if (dx === 0 && dy === 0) return;
930
+ const backX = point.x - dx * size;
931
+ const backY = point.y - dy * size;
932
+ const half = size * ARROW_SPREAD;
933
+ const path = [
934
+ {
935
+ kind: "move",
936
+ to: {
937
+ x: backX - dy * half,
938
+ y: backY + dx * half
939
+ }
940
+ },
941
+ {
942
+ kind: "line",
943
+ to: point
944
+ },
945
+ {
946
+ kind: "line",
947
+ to: {
948
+ x: backX + dy * half,
949
+ y: backY - dx * half
950
+ }
951
+ }
952
+ ];
953
+ shapes.push({
954
+ type: "shape",
955
+ outline: {
956
+ kind: "path",
957
+ path
958
+ },
959
+ stroke,
960
+ lineWidth,
961
+ opacity
962
+ });
963
+ }
964
+ /** This function adds the shapes of a route: its line, and the signs at its ends. */
965
+ function addRoute(shapes, route, look, unit, share) {
966
+ const opacity = Math.min(1, (look.opacity ?? 1) * share);
967
+ if (!(opacity > 0)) return;
968
+ const lineWidth = (look.width ?? 1.25) * unit;
969
+ shapes.push({
970
+ type: "shape",
971
+ outline: {
972
+ kind: "path",
973
+ path: route.path
974
+ },
975
+ stroke: look.stroke,
976
+ lineWidth,
977
+ dash: dashOf(look.dash, unit),
978
+ opacity
979
+ });
980
+ if (look.start !== void 0) addEnd(shapes, pathStart(route.path), -1, look.start, look.stroke, lineWidth, unit, opacity);
981
+ if (look.end !== void 0) addEnd(shapes, pathEnd(route.path), 1, look.end, look.stroke, lineWidth, unit, opacity);
982
+ }
983
+ /**
984
+ * This function gives the paint list of a picture: the shapes that a renderer draws, in the order of the paint.
985
+ * The function is pure, so a test examines a picture with no browser. `drawShapes` draws the list on a canvas.
986
+ *
987
+ * The layers are, from the back:
988
+ *
989
+ * - The boxes with children, each with its labels.
990
+ * - The routes. The routes of the focus and those with a highlight are after the others.
991
+ * - The boxes with no child, each with its labels.
992
+ * - The labels of the routes, then the labels that name no record.
993
+ * - The labels that keep a height on the screen (`least` of a label look).
994
+ *
995
+ * In a layer, the records are in the order of the picture. A label has the state of the record that it names.
996
+ * The focus of the picture decreases the color of each record out of it (`FOCUS_OPACITY`).
997
+ */
998
+ function paintPicture(index, looks, theme, state) {
999
+ const { picture } = index;
1000
+ const unit = lookUnit(state.zoom);
1001
+ const margin = 24 * unit;
1002
+ const { visible, measure, zoom } = state;
1003
+ const inView = (rect) => {
1004
+ if (visible === void 0) return true;
1005
+ const overlap = overlapOf(grow(rect, margin), visible);
1006
+ return overlap.x >= 0 && overlap.y >= 0;
1007
+ };
1008
+ /** This function tells if a label can be in view: at its place, or with the largest height that a label keeps. */
1009
+ const near = (label) => {
1010
+ if (inView(label)) return true;
1011
+ const most = keptScale(label, 32, zoom);
1012
+ return most > 1 && inView(keptRect(label, label.w, most));
1013
+ };
1014
+ const shareOf = (key, level) => {
1015
+ const goal = FOCUS_OPACITY[level];
1016
+ return state.fade === void 0 ? goal : state.fade(key, goal);
1017
+ };
1018
+ const kept = [];
1019
+ /** This function adds the shapes of a label at its place, or keeps a label that is larger than its place for the top layer. */
1020
+ const place = (shapes, label, look, share, highlight, area) => {
1021
+ if (look === void 0) return;
1022
+ const scale = look.least === void 0 || look.as === "bars" ? 1 : keptScale(label, Math.min(look.least, 32), zoom);
1023
+ if (scale > 1) {
1024
+ const opacity = Math.min(1, (look.opacity ?? 1) * share);
1025
+ if (opacity > 0) kept.push({
1026
+ label,
1027
+ look,
1028
+ scale,
1029
+ opacity,
1030
+ highlight,
1031
+ area
1032
+ });
1033
+ } else if (inView(label)) addLabel(shapes, label, look, share, measure);
1034
+ };
1035
+ const containers = [];
1036
+ const leaves = [];
1037
+ for (const box of picture.boxes) {
1038
+ const labels = index.boxLabels.get(box.id) ?? [];
1039
+ const shown = inView(box);
1040
+ if (!shown && !labels.some(near)) continue;
1041
+ const boxIs = boxState(index, box, state);
1042
+ const look = looks.box(box, boxIs, theme);
1043
+ if (look === void 0) continue;
1044
+ const share = shareOf(recordKey("box", box.id), boxIs.focus);
1045
+ const shapes = boxIs.container ? containers : leaves;
1046
+ if (shown) addBox(shapes, box, look, unit, share);
1047
+ const record = {
1048
+ type: "box",
1049
+ id: box.id,
1050
+ box
1051
+ };
1052
+ for (const label of labels) if (near(label)) place(shapes, label, looks.label(label, boxIs, theme, record), share, boxIs.highlight, box.w * box.h);
1053
+ }
1054
+ const back = [];
1055
+ const front = [];
1056
+ const routeLabels = [];
1057
+ for (const route of picture.routes) {
1058
+ const line = routeLine(route);
1059
+ if (line === void 0) continue;
1060
+ const labels = index.routeLabels.get(route.id) ?? [];
1061
+ const shown = inView(line.bounds);
1062
+ if (!shown && !labels.some(near)) continue;
1063
+ const routeIs = routeState(route, state);
1064
+ const look = looks.route(route, routeIs, theme);
1065
+ if (look === void 0) continue;
1066
+ const share = shareOf(recordKey("route", route.id), routeIs.focus);
1067
+ if (shown) addRoute(routeIs.focus === "in" || routeIs.highlight > 0 ? front : back, route, look, unit, share);
1068
+ const record = {
1069
+ type: "route",
1070
+ id: route.id,
1071
+ route
1072
+ };
1073
+ for (const label of labels) if (near(label)) place(routeLabels, label, looks.label(label, routeIs, theme, record), share, routeIs.highlight, 0);
1074
+ }
1075
+ const free = [];
1076
+ if (index.freeLabels.length > 0) {
1077
+ const level = state.focus === void 0 ? "all" : "out";
1078
+ const labelIs = {
1079
+ highlight: 0,
1080
+ focus: level,
1081
+ zoom: state.zoom,
1082
+ container: false
1083
+ };
1084
+ const share = shareOf(FREE_LABELS, level);
1085
+ for (const label of index.freeLabels) if (near(label)) place(free, label, looks.label(label, labelIs, theme, void 0), share, 0, 0);
1086
+ }
1087
+ const top = [];
1088
+ if (kept.length > 0) {
1089
+ kept.sort((a, b) => b.highlight - a.highlight || b.area - a.area);
1090
+ const gap = 4 * unit;
1091
+ const taken = [];
1092
+ for (const item of kept) {
1093
+ const { label } = item;
1094
+ const lines = label.lines.filter((line) => line.trim() !== "");
1095
+ if (lines.length === 0) continue;
1096
+ let wide = measure === void 0 ? label.w : Math.max(...lines.map((line) => measure(label.font, line)));
1097
+ if (label.w > 0) wide = Math.min(wide, label.w);
1098
+ const rect = keptRect(label, wide, item.scale);
1099
+ if (!inView(rect)) continue;
1100
+ const space = grow(rect, gap);
1101
+ if (!taken.every((other) => {
1102
+ const overlap = overlapOf(space, other);
1103
+ return !(overlap.x > 0 && overlap.y > 0);
1104
+ })) continue;
1105
+ taken.push(rect);
1106
+ addKept(top, item, rect);
1107
+ }
1108
+ }
1109
+ return containers.concat(back, front, leaves, routeLabels, free, top);
1110
+ }
1111
+ // src/graph/content.ts
1112
+ /** The time in which the color of a record goes most of the way to its goal after a change of the focus, in seconds. */
1113
+ const FOCUS_FADE = .08;
1114
+ /** The bounds of a picture with no record. */
1115
+ const NO_BOUNDS = {
1116
+ x: 0,
1117
+ y: 0,
1118
+ w: 0,
1119
+ h: 0
1120
+ };
1121
+ /** The largest number of text widths that a content keeps. */
1122
+ const MOST_WIDTHS = 4e3;
1123
+ const NO_SEEDS = [];
1124
+ const boxesOnly = (record) => record.type === "box";
1125
+ /**
1126
+ * This function makes the content of a flat stage from a picture: its boxes, its routes and its labels.
1127
+ *
1128
+ * - The looks give the colors, the lines and the signs of each record from its state.
1129
+ * - A person points at the top box below the pointer, or at a route that the option `picks` permits.
1130
+ * - A change of the focus changes the colors in a short time.
1131
+ * - The content makes shapes only for the records in view.
1132
+ *
1133
+ * The picture must be good (`checkPicture` of `@mark1russell7/layout-contract`). The content does not change it.
1134
+ */
1135
+ function createPictureContent(picture, options) {
1136
+ const { looks } = options;
1137
+ const permits = options.picks ?? boxesOnly;
1138
+ const bySelection = (options.focus ?? "selection") === "selection";
1139
+ let index = indexPicture(picture);
1140
+ let bounds = pictureBounds(picture) ?? NO_BOUNDS;
1141
+ /** The records of `setFocus`, or `undefined` for the focus of the options. */
1142
+ let asked;
1143
+ /** The names from which the focus of the last picture came. */
1144
+ let seeds = NO_SEEDS;
1145
+ let focus;
1146
+ /** This value is true until the first picture of a picture. The first focus has no change with time. */
1147
+ let fresh = true;
1148
+ /** The color share of each record whose share changes, by the key of the record. */
1149
+ const fades = /* @__PURE__ */ new Map();
1150
+ /** The theme and the state of the last picture. A person cannot point at a record that the last picture did not show. */
1151
+ let last;
1152
+ /** The width of each text that the content measured, by its font and its text. */
1153
+ const widths = /* @__PURE__ */ new Map();
1154
+ const widthOf = (context, font, text) => {
1155
+ const key = `${font}\n${text}`;
1156
+ const known = widths.get(key);
1157
+ if (known !== void 0) return known;
1158
+ const before = context.font;
1159
+ context.font = font;
1160
+ const width = context.measureText(text).width;
1161
+ context.font = before;
1162
+ if (widths.size >= MOST_WIDTHS) widths.clear();
1163
+ widths.set(key, width);
1164
+ return width;
1165
+ };
1166
+ /** This function gives the names from which the focus comes. */
1167
+ const seedsOf = (highlight) => {
1168
+ if (asked !== void 0) return asked;
1169
+ if (!bySelection) return NO_SEEDS;
1170
+ const out = [];
1171
+ for (const id of index.boxes.keys()) if (highlight(id) === 2) out.push(id);
1172
+ for (const id of index.routes.keys()) if (!index.boxes.has(id) && highlight(id) === 2) out.push(id);
1173
+ return out;
1174
+ };
1175
+ /** This function starts the change of the color of each record whose focus level changes. A change that continues starts from its value. */
1176
+ const fadeTo = (next) => {
1177
+ const add = (key, from, goal) => {
1178
+ const value = fades.get(key)?.value ?? from;
1179
+ if (value === goal) fades.delete(key);
1180
+ else fades.set(key, {
1181
+ value,
1182
+ goal
1183
+ });
1184
+ };
1185
+ for (const box of index.picture.boxes) add(recordKey("box", box.id), FOCUS_OPACITY[boxFocus(focus, box)], FOCUS_OPACITY[boxFocus(next, box)]);
1186
+ for (const route of index.picture.routes) add(recordKey("route", route.id), FOCUS_OPACITY[routeFocus(focus, route)], FOCUS_OPACITY[routeFocus(next, route)]);
1187
+ if (index.freeLabels.length > 0) add(FREE_LABELS, FOCUS_OPACITY[focus === void 0 ? "all" : "out"], FOCUS_OPACITY[next === void 0 ? "all" : "out"]);
1188
+ };
1189
+ return {
1190
+ get bounds() {
1191
+ return bounds;
1192
+ },
1193
+ has: (record) => index.boxes.has(record) || index.routes.has(record),
1194
+ pick(at) {
1195
+ const known = last;
1196
+ const state = known === void 0 ? void 0 : {
1197
+ ...known.state,
1198
+ zoom: at.view.k
1199
+ };
1200
+ const shown = (record) => {
1201
+ if (!permits(record)) return false;
1202
+ if (known === void 0 || state === void 0) return true;
1203
+ if (record.type === "box") return looks.box(record.box, boxState(index, record.box, state), known.theme) !== void 0;
1204
+ return looks.route(record.route, routeState(record.route, state), known.theme) !== void 0;
1205
+ };
1206
+ const record = pickRecord(index, at.point, {
1207
+ slack: at.slack / at.view.k,
1208
+ picks: shown
1209
+ });
1210
+ return record === void 0 ? void 0 : {
1211
+ record: record.id,
1212
+ value: record
1213
+ };
1214
+ },
1215
+ draw(context, frame, theme, highlight) {
1216
+ const { view } = frame;
1217
+ const from = seedsOf(highlight);
1218
+ if (fresh || from.length !== seeds.length || from.some((id, i) => id !== seeds[i])) {
1219
+ const next = from.length === 0 ? void 0 : focusOf(index, from);
1220
+ if (fresh || frame.settle) fades.clear();
1221
+ else fadeTo(next);
1222
+ seeds = from;
1223
+ focus = next;
1224
+ fresh = false;
1225
+ }
1226
+ if (frame.settle) fades.clear();
1227
+ for (const [key, fade] of fades) {
1228
+ fade.value = approach(fade.value, fade.goal, frame.seconds, FOCUS_FADE);
1229
+ if (fade.value === fade.goal) fades.delete(key);
1230
+ }
1231
+ const state = {
1232
+ zoom: view.k,
1233
+ highlight,
1234
+ focus,
1235
+ visible: {
1236
+ x: (0 - view.x) / view.k,
1237
+ y: (0 - view.y) / view.k,
1238
+ w: frame.width / view.k,
1239
+ h: frame.height / view.k
1240
+ },
1241
+ measure: (font, text) => widthOf(context, font, text),
1242
+ fade: fades.size === 0 ? void 0 : (key, goal) => fades.get(key)?.value ?? goal
1243
+ };
1244
+ last = {
1245
+ theme,
1246
+ state
1247
+ };
1248
+ drawShapes(context, paintPicture(index, looks, theme, state), view);
1249
+ return fades.size > 0;
1250
+ },
1251
+ setPicture(next) {
1252
+ index = indexPicture(next);
1253
+ bounds = pictureBounds(next) ?? NO_BOUNDS;
1254
+ fades.clear();
1255
+ fresh = true;
1256
+ last = void 0;
1257
+ },
1258
+ setFocus(records) {
1259
+ asked = records === void 0 ? void 0 : [...records];
1260
+ },
1261
+ dispose() {
1262
+ fades.clear();
1263
+ widths.clear();
1264
+ last = void 0;
1265
+ }
1266
+ };
1267
+ }
296
1268
  // src/graph/keys.ts
297
1269
  /**
298
1270
  * This function gives the action of a key on a flat picture, or `undefined` for a key with no action.
@@ -304,7 +1276,7 @@ function aimReveal(rects, options) {
304
1276
  */
305
1277
  function pictureKeyAction(key, now, area, options) {
306
1278
  const step = Math.min(area.w, area.h) * KEY_PART;
307
- const middle = middleOf(area);
1279
+ const middle = rectCenter(area);
308
1280
  switch (key) {
309
1281
  case "ArrowLeft": return {
310
1282
  type: "move",
@@ -554,13 +1526,16 @@ function createPictureStage(container, options) {
554
1526
  const setCursor = () => {
555
1527
  canvas.style.cursor = dragging ? "grabbing" : highlights.hovered === void 0 ? "grab" : "pointer";
556
1528
  };
1529
+ /** The bounds of the content at the last `setArea`. `refresh` finds a change of the bounds with them. */
1530
+ let fitted = content.bounds;
557
1531
  /** This function sets the free area and the limits of the zoom, from the size, the insets and the content. */
558
1532
  const setArea = () => {
559
1533
  area = freeArea({
560
1534
  width,
561
1535
  height
562
1536
  }, insets);
563
- limits = zoomLimitsFor(content.bounds, area, baseLimits);
1537
+ fitted = content.bounds;
1538
+ limits = zoomLimitsFor(fitted, area, baseLimits);
564
1539
  };
565
1540
  const aimFrame = () => ({
566
1541
  bounds: content.bounds,
@@ -595,7 +1570,7 @@ function createPictureStage(container, options) {
595
1570
  */
596
1571
  const hold = (base) => {
597
1572
  const k = clampZoom(base.k, limits);
598
- const middle = middleOf(area);
1573
+ const middle = rectCenter(area);
599
1574
  move = void 0;
600
1575
  view = keepRect(k === base.k ? base : viewAt(toPicture(base, middle), middle, k), content.bounds, area);
601
1576
  invalidate();
@@ -633,7 +1608,7 @@ function createPictureStage(container, options) {
633
1608
  return;
634
1609
  }
635
1610
  const base = move?.to ?? view;
636
- hold(viewAt(toPicture(base, middleOf(before)), middleOf(area), base.k));
1611
+ hold(viewAt(toPicture(base, rectCenter(before)), rectCenter(area), base.k));
637
1612
  };
638
1613
  function tick(now) {
639
1614
  frame = 0;
@@ -822,7 +1797,7 @@ function createPictureStage(container, options) {
822
1797
  area: () => area,
823
1798
  zoomBy(factor, animate = true) {
824
1799
  moved = true;
825
- glide(keepRect(zoomView(move?.to ?? view, middleOf(area), factor, limits), content.bounds, area), animate);
1800
+ glide(keepRect(zoomView(move?.to ?? view, rectCenter(area), factor, limits), content.bounds, area), animate);
826
1801
  },
827
1802
  highlight(records) {
828
1803
  highlights = {
@@ -838,7 +1813,19 @@ function createPictureStage(container, options) {
838
1813
  };
839
1814
  invalidate();
840
1815
  },
841
- refresh: invalidate,
1816
+ refresh() {
1817
+ if (disposed) return;
1818
+ if (highlights.hovered !== void 0 && !content.has(highlights.hovered)) setHover(void 0);
1819
+ const bounds = content.bounds;
1820
+ if (bounds.x !== fitted.x || bounds.y !== fitted.y || bounds.w !== fitted.w || bounds.h !== fitted.h) {
1821
+ setArea();
1822
+ if (sized) {
1823
+ if (moved) hold(move?.to ?? view);
1824
+ else goTo(aim, true);
1825
+ }
1826
+ }
1827
+ invalidate();
1828
+ },
842
1829
  dispose() {
843
1830
  if (disposed) return;
844
1831
  disposed = true;
@@ -850,6 +1837,6 @@ function createPictureStage(container, options) {
850
1837
  }
851
1838
  };
852
1839
  }
853
- export { DOUBLE_CLICK_ZOOM, FIT_PADDING, KEEP_IN_VIEW, NO_POINTERS, PICK_SLACK, SMALLEST_AREA, TOUCH_CLICK_DISTANCE, TOUCH_PICK_SLACK, UNIT_VIEW, WHEEL_LINE, WHEEL_PINCH, WHEEL_SPEED, ZOOM_LIMITS, aimAll, aimRects, aimReveal, clampZoom, createPictureStage, fitRect, frameRects, freeArea, keepRect, panView, pictureKeyAction, pictureMoveAt, pinchView, pointerCancel, pointerDown, pointerMove, pointerUp, rectToScreen, revealRects, showsRect, stackPictureContents, toPicture, toScreen, viewAt, viewBetween, wheelFactor, zoomLimitsFor, zoomView };
1840
+ export { ARROW_SPREAD, BAR_HEIGHT, DARK_PICTURE_THEME, DOUBLE_CLICK_ZOOM, FIT_PADDING, FOCUS_FADE, FOCUS_OPACITY, FREE_LABELS, HALO_WIDTH, KEEP_IN_VIEW, KEPT_GAP, LIGHT_PICTURE_THEME, MOST_KEPT_LINE, NO_POINTERS, PICK_SLACK, SMALLEST_AREA, SMALLEST_BAR_LINE, SMALLEST_NAMED_BOX, SMALLEST_TEXT_LINE, TOUCH_CLICK_DISTANCE, TOUCH_PICK_SLACK, UNIT_VIEW, VIEW_MARGIN, WHEEL_LINE, WHEEL_PINCH, WHEEL_SPEED, ZOOM_LIMITS, aimAll, aimRects, aimReveal, boxDistance, boxFocus, boxState, clampZoom, createPictureContent, createPictureStage, drawShapes, fitRect, focusOf, frameRects, freeArea, indexPicture, keepRect, lookUnit, paintPicture, panView, pickRecord, pictureKeyAction, pictureMoveAt, pinchView, plainLooks, pointerCancel, pointerDown, pointerMove, pointerUp, recordKey, rectToScreen, revealRects, routeFocus, routeLine, routeState, showsRect, stackPictureContents, toPicture, toScreen, viewAt, viewBetween, wheelFactor, zoomLimitsFor, zoomView };
854
1841
 
855
1842
  //# sourceMappingURL=graph.js.map