@mark1russell7/visuals 0.3.7 → 0.3.8

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/README.md CHANGED
@@ -674,6 +674,7 @@ stage?.refresh();
674
674
  - At the zoom 1 or less, the lines and the signs keep their size on the screen. Above it, they grow with the boxes.
675
675
  - The selected record and the records at it stay clear. Each other record has less color, and the colors change in a short time.
676
676
  - `setFocus` sets the records of the focus from the page. The option `focus: "none"` stops the focus of the selection.
677
+ - A route that the looks do not show brings no box into the focus. The option `routes` of `focusOf` does the same in a test.
677
678
  - A person points at the top box below the pointer. A box with no child comes before the box around it.
678
679
  - The option `picks` tells which records a person can point at, for example the routes too.
679
680
  - The content makes shapes only for the records in view.
package/build/graph.d.ts CHANGED
@@ -268,15 +268,23 @@ interface PictureFocus {
268
268
  type FocusLevel = "all" | "in" | "beside" | "out";
269
269
  /** The share of the color that a record keeps at each focus level. */
270
270
  export declare const FOCUS_OPACITY: Readonly<Record<FocusLevel, number>>;
271
+ /** The options of `focusOf`. */
272
+ interface FocusOptions {
273
+ /**
274
+ * This function tells if a route at a box of the list is in the focus. The default permits each route.
275
+ * A content gives the routes that its looks show, so a route with no line brings no box. A route of the list is in the focus in each case.
276
+ */
277
+ readonly routes?: ((route: PictureRoute) => boolean) | undefined;
278
+ }
271
279
  /**
272
280
  * This function gives the focus of a list of records, or `undefined` when the picture has none of them.
273
281
  *
274
282
  * - A box brings each box below it in the tree.
275
- * - Each route at one of these boxes is in the focus, with the box at its other end.
283
+ * - Each route at one of these boxes is in the focus, with the box at its other end. The option `routes` can refuse a route.
276
284
  * - A route brings its two boxes.
277
285
  * - Each box of the focus brings each box above it in the tree, so the card of a row stays clear.
278
286
  */
279
- export declare function focusOf(index: PictureIndex, seeds: Iterable<string>): PictureFocus | undefined;
287
+ export declare function focusOf(index: PictureIndex, seeds: Iterable<string>, options?: FocusOptions): PictureFocus | undefined;
280
288
  /** This function gives the focus level of a box. */
281
289
  export declare function boxFocus(focus: PictureFocus | undefined, box: PictureBox): FocusLevel;
282
290
  /** This function gives the focus level of a route: `all`, `in` or `out`. */
@@ -828,5 +836,5 @@ export declare function pointerCancel(pointers: Pointers, id: number): Pointers;
828
836
  * - The stage disposes the stack, and the stack disposes each content.
829
837
  */
830
838
  export declare function stackPictureContents<P, T>(contents: readonly [PictureContent<P, T>, ...PictureContent<P, T>[]]): PictureContent<P, T>;
831
- export type { AimFrame, BoxLook, BoxMark, BoxRing, FitOptions, FocusLevel, FrameOptions, Insets, LabelLook, LayoutPictureContent, PaintOutline, PaintOutlined, PaintShape, PaintState, PaintText, PickAt, PickOptions, PictureAim, PictureContent, PictureContentOptions, PictureFocus, PictureFrame, PictureIndex, PictureKeyAction, PictureKeyOptions, PictureLooks, PictureMove, PictureMoveStep, PicturePick, PictureRecord, PictureStage, PictureStageOptions, PictureTheme, PictureView, PlainLookOptions, PointerMoveResult, PointerPair, PointerUpResult, Pointers, RecordState, RevealOptions, RouteEnd, RouteLine, RouteLook, ZoomLimits };
839
+ export type { AimFrame, BoxLook, BoxMark, BoxRing, FitOptions, FocusLevel, FocusOptions, FrameOptions, Insets, LabelLook, LayoutPictureContent, PaintOutline, PaintOutlined, PaintShape, PaintState, PaintText, PickAt, PickOptions, PictureAim, PictureContent, PictureContentOptions, PictureFocus, PictureFrame, PictureIndex, PictureKeyAction, PictureKeyOptions, PictureLooks, PictureMove, PictureMoveStep, PicturePick, PictureRecord, PictureStage, PictureStageOptions, PictureTheme, PictureView, PlainLookOptions, PointerMoveResult, PointerPair, PointerUpResult, Pointers, RecordState, RevealOptions, RouteEnd, RouteLine, RouteLook, ZoomLimits };
832
840
  //# sourceMappingURL=graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph.d.ts","names":[],"sources":["../src/graph/camera.ts","../src/graph/aim.ts","../src/graph/records.ts","../src/graph/focus.ts","../src/graph/looks.ts","../src/graph/stage.ts","../src/graph/content.ts","../src/graph/paint.ts","../src/graph/draw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AAmB;;KCvB9E;WAA8B;WAAuB,IAAI;;WAA2B;WAAuB;;;UAGtG;;WAEN;;WAEA,QAAQ,SAAS;;WAEjB,SAAS;;;;;;;;;;wBAWJ,iBAAiB,aAAa,KAAK,aAAa,MAAM,MAAM,SAAS,oBAAoB;;UCpBxF;;WAEN,IAAI,oBAAoB;;WAExB,OAAO;;WAEP;;;qBAIE,aAAa;;qBAGb;;wBAGG,YAAY,UAAU,UAAU,YAAY,IAAI,QAAQ;;UAQvD;WACN,UAAU;WACV,MAAM;;;;;;;;;wBAUD,YAAY,UAAU,UAAU,YAAY,IAAI,OAAO,MAAM,aAAa,SAAQ,aAA2B;;UAa5G;WACN,UAAU;;WAEV;;;;;;;;wBASK,UAAU,UAAU,UAAU,YAAY,IAAI,OAAO,iBAAiC;;wBAStF,cAAc,UAAU,UAAU,aAAa;;;;;;;;;;;;wBC9D/C,qBAAqB,GAAG,GAAG,oBAAoB,eAAe,GAAG,OAAO,eAAe,GAAG,QAAQ,eAAe,GAAG"}
1
+ {"version":3,"file":"graph.d.ts","names":[],"sources":["../src/graph/camera.ts","../src/graph/aim.ts","../src/graph/records.ts","../src/graph/focus.ts","../src/graph/looks.ts","../src/graph/stage.ts","../src/graph/content.ts","../src/graph/paint.ts","../src/graph/draw.ts","../src/graph/hit.ts","../src/graph/keys.ts","../src/graph/pointers.ts","../src/graph/stack.ts"],"mappings":";;;;;;UAOiB;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;WACA;;;qBAIE,aAAa;;qBAGb,WAAW;;wBAGR,UAAU,WAAW,SAAQ;;wBAK7B,UAAU,MAAM,aAAa,QAAQ,QAAQ;;wBAK7C,SAAS,MAAM,aAAa,OAAO,QAAQ;;wBAK3C,aAAa,MAAM,aAAa,MAAM,OAAO;;wBAK7C,OAAO,OAAO,OAAO,IAAI,OAAO,YAAY;;wBAK5C,QAAQ,MAAM,aAAa,YAAY,aAAa;;;;;wBAQpD,SAAS,MAAM,aAAa,IAAI,OAAO,gBAAgB,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aAA2B;;UAa5G;WACN,UAAU;;WAEV;;;;;;;;wBASK,UAAU,UAAU,UAAU,YAAY,IAAI,OAAO,iBAAiC;;wBAStF,cAAc,UAAU,UAAU,aAAa;;;;;;;;;;;;wBC9D/C,qBAAqB,GAAG,GAAG,oBAAoB,eAAe,GAAG,OAAO,eAAe,GAAG,QAAQ,eAAe,GAAG"}
package/build/graph.js CHANGED
@@ -395,11 +395,12 @@ const FOCUS_OPACITY = {
395
395
  * This function gives the focus of a list of records, or `undefined` when the picture has none of them.
396
396
  *
397
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.
398
+ * - Each route at one of these boxes is in the focus, with the box at its other end. The option `routes` can refuse a route.
399
399
  * - A route brings its two boxes.
400
400
  * - Each box of the focus brings each box above it in the tree, so the card of a row stays clear.
401
401
  */
402
- function focusOf(index, seeds) {
402
+ function focusOf(index, seeds, options = {}) {
403
+ const permits = options.routes;
403
404
  const boxes = /* @__PURE__ */ new Set();
404
405
  const routes = /* @__PURE__ */ new Set();
405
406
  /** The boxes of the list, and each box below them. */
@@ -422,7 +423,7 @@ function focusOf(index, seeds) {
422
423
  for (const child of index.children.get(id) ?? []) stack.push(child.id);
423
424
  }
424
425
  }
425
- for (const id of own) for (const route of index.routesAt.get(id) ?? []) addRoute(route);
426
+ for (const id of own) for (const route of index.routesAt.get(id) ?? []) if (permits === void 0 || permits(route)) addRoute(route);
426
427
  for (const route of seedRoutes) addRoute(route);
427
428
  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
429
  return boxes.size === 0 && routes.size === 0 ? void 0 : {
@@ -1216,7 +1217,12 @@ function createPictureContent(picture, options) {
1216
1217
  const { view } = frame;
1217
1218
  const from = seedsOf(highlight);
1218
1219
  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
+ const plain = {
1221
+ zoom: view.k,
1222
+ highlight
1223
+ };
1224
+ const shown = (route) => looks.route(route, routeState(route, plain), theme) !== void 0;
1225
+ const next = from.length === 0 ? void 0 : focusOf(index, from, { routes: shown });
1220
1226
  if (fresh || frame.settle) fades.clear();
1221
1227
  else fadeTo(next);
1222
1228
  seeds = from;
@@ -1 +1 @@
1
- {"version":3,"file":"graph.js","names":["boxesOnly"],"sources":["../src/graph/camera.ts","../src/graph/aim.ts","../src/graph/draw.ts","../src/graph/focus.ts","../src/graph/records.ts","../src/graph/hit.ts","../src/graph/looks.ts","../src/graph/paint.ts","../src/graph/content.ts","../src/graph/keys.ts","../src/graph/pointers.ts","../src/graph/stack.ts","../src/graph/stage.ts"],"sourcesContent":["import { rectCenter, type Point, type Rect } from \"@mark1russell7/layout-contract\";\nimport { easeInOut, partAt } from \"../motion.ts\";\n\n/**\n * The camera of a flat picture: a zoom and the position of the origin.\n * A point `p` of the picture shows at the screen point `p * k + (x, y)`. Each screen length is in CSS pixels.\n */\nexport interface PictureView {\n /** The screen position of the origin of the picture, from the left edge. */\n readonly x: number;\n /** The screen position of the origin of the picture, from the top edge. */\n readonly y: number;\n /** The zoom: the screen length of one unit of the picture. */\n readonly k: number;\n}\n\n/** The limits of the zoom of a camera. */\nexport interface ZoomLimits {\n readonly min: number;\n readonly max: number;\n}\n\n/** The default limits of the zoom. */\nexport const ZOOM_LIMITS: ZoomLimits = { min: 0.05, max: 8 };\n\n/** The view that shows each point of the picture at its own position. */\nexport const UNIT_VIEW: PictureView = { x: 0, y: 0, k: 1 };\n\n/** This function gives a zoom in its limits. A zoom that is not a number gives the smallest zoom. */\nexport function clampZoom(k: number, limits: ZoomLimits = ZOOM_LIMITS): number {\n return k >= limits.min ? Math.min(k, limits.max) : limits.min;\n}\n\n/** This function gives the point of the picture that shows at a screen point. */\nexport function toPicture(view: PictureView, screen: Point): Point {\n return { x: (screen.x - view.x) / view.k, y: (screen.y - view.y) / view.k };\n}\n\n/** This function gives the screen point that shows a point of the picture. */\nexport function toScreen(view: PictureView, point: Point): Point {\n return { x: point.x * view.k + view.x, y: point.y * view.k + view.y };\n}\n\n/** This function gives the screen rectangle that shows a rectangle of the picture. */\nexport function rectToScreen(view: PictureView, rect: Rect): Rect {\n return { x: rect.x * view.k + view.x, y: rect.y * view.k + view.y, w: rect.w * view.k, h: rect.h * view.k };\n}\n\n/** This function gives the view with the zoom `k` that shows the point `point` of the picture at the screen point `at`. */\nexport function viewAt(point: Point, at: Point, k: number): PictureView {\n return { x: at.x - point.x * k, y: at.y - point.y * k, k };\n}\n\n/** This function gives the view after a move of the picture by a screen distance. */\nexport function panView(view: PictureView, dx: number, dy: number): PictureView {\n return { x: view.x + dx, y: view.y + dy, k: view.k };\n}\n\n/**\n * This function gives the view after a zoom by `factor`. The zoom stays in its limits.\n * The screen point `at` shows the same point of the picture before and after the zoom.\n */\nexport function zoomView(view: PictureView, at: Point, factor: number, limits: ZoomLimits = ZOOM_LIMITS): PictureView {\n const k = clampZoom(view.k * factor, limits);\n const ratio = k / view.k;\n return { x: at.x - (at.x - view.x) * ratio, y: at.y - (at.y - view.y) * ratio, k };\n}\n\n/** The positions of the two pointers of a pinch, in CSS pixels. */\nexport type PointerPair = readonly [Point, Point];\n\n/**\n * This function gives the view after the two pointers of a pinch move from `before` to `after`.\n *\n * The zoom changes by the ratio of the two distances between the pointers.\n * The point of the picture at the middle of the pointers stays at their middle.\n * Thus each pointer keeps its point of the picture, if the pointers do not turn and the zoom is in its limits.\n */\nexport function pinchView(view: PictureView, before: PointerPair, after: PointerPair, limits: ZoomLimits = ZOOM_LIMITS): PictureView {\n const from = { x: (before[0].x + before[1].x) / 2, y: (before[0].y + before[1].y) / 2 };\n const to = { x: (after[0].x + after[1].x) / 2, y: (after[0].y + after[1].y) / 2 };\n const was = Math.hypot(before[0].x - before[1].x, before[0].y - before[1].y);\n const is = Math.hypot(after[0].x - after[1].x, after[0].y - after[1].y);\n // Two pointers at one position give no ratio. The picture then only moves.\n const factor = was > 0 && is > 0 ? is / was : 1;\n return zoomView(panView(view, to.x - from.x, to.y - from.y), to, factor, limits);\n}\n\n/** The speed of the zoom of a wheel: the change of the natural logarithm of the zoom for one CSS pixel of the wheel. */\nexport const WHEEL_SPEED = 0.0015;\n\n/** The height of one line of a wheel that gives its turn in lines, in CSS pixels. */\nexport const WHEEL_LINE = 16;\n\n/** The factor of the speed of the wheel for a pinch on a touch pad. A browser gives such a pinch as a wheel with the key `Control`. */\nexport const WHEEL_PINCH = 10;\n\n/**\n * This function gives the factor of the zoom for one event of a wheel. A turn away from the person makes the picture larger.\n *\n * `deltaY` and `deltaMode` are the fields of the event. A mode of 1 has its turn in lines.\n * `pinch` is the field `ctrlKey` of the event: a pinch on a touch pad has small turns, so its speed is higher.\n */\nexport function wheelFactor(deltaY: number, deltaMode: number = 0, pinch: boolean = false): number {\n const pixels = deltaMode === 1 ? deltaY * WHEEL_LINE : deltaY;\n return Math.exp(0 - pixels * WHEEL_SPEED * (pinch ? WHEEL_PINCH : 1));\n}\n\n/** The parts of a picture that a page covers, from each edge, in CSS pixels. */\nexport interface Insets {\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly left: number;\n}\n\n/** The smallest width and height of a free area, in CSS pixels. */\nexport const SMALLEST_AREA = 80;\n\n/**\n * This function gives the free area of a picture: the screen rectangle that the page does not cover.\n * A camera shows a selection in this area, so a panel of the page does not hide it.\n * The width and the height of the area are `SMALLEST_AREA` at least.\n */\nexport function freeArea(size: { readonly width: number; readonly height: number }, insets: Partial<Insets> = {}): Rect {\n const left = insets.left ?? 0;\n const top = insets.top ?? 0;\n return {\n x: left,\n y: top,\n w: Math.max(SMALLEST_AREA, size.width - left - (insets.right ?? 0)),\n h: Math.max(SMALLEST_AREA, size.height - top - (insets.bottom ?? 0)),\n };\n}\n\n/** The default distance between a rectangle that a camera shows and each edge of the area, in CSS pixels. */\nexport const FIT_PADDING = 24;\n\n/** The options of `fitRect`. */\nexport interface FitOptions {\n /** The distance between the rectangle and each edge of the area, in CSS pixels. The default is `FIT_PADDING`. */\n readonly padding?: number | undefined;\n /** The largest zoom of the result. The default is the largest zoom of the limits. */\n readonly most?: number | undefined;\n /** The limits of the zoom. The default is `ZOOM_LIMITS`. */\n readonly limits?: ZoomLimits | undefined;\n}\n\n/** This function gives the zoom at which a rectangle of the picture fills an area of the screen, with a padding at each edge. */\nfunction fillZoom(rect: Rect, area: Rect, padding: number): number {\n const width = Math.max(area.w - 2 * padding, 1);\n const height = Math.max(area.h - 2 * padding, 1);\n return Math.min(width / Math.max(rect.w, 0), height / Math.max(rect.h, 0));\n}\n\n/**\n * This function gives the view that shows a rectangle of the picture in an area of the screen, as large as the area permits.\n * The middle of the rectangle is at the middle of the area. A rectangle with no size gets the largest zoom.\n */\nexport function fitRect(rect: Rect, area: Rect, options: FitOptions = {}): PictureView {\n const limits = options.limits ?? ZOOM_LIMITS;\n const k = clampZoom(Math.min(options.most ?? limits.max, fillZoom(rect, area, options.padding ?? FIT_PADDING)), limits);\n return viewAt(rectCenter(rect), rectCenter(area), k);\n}\n\n/**\n * This function gives the limits of the zoom for a picture with the bounds `bounds`.\n *\n * The smallest zoom of the result shows all of the picture in the area, with a padding at each edge.\n * A picture that fits at the smallest zoom of `limits` keeps `limits`. Thus a person can show all of a very large picture.\n */\nexport function zoomLimitsFor(bounds: Rect, area: Rect, limits: ZoomLimits = ZOOM_LIMITS, padding: number = FIT_PADDING): ZoomLimits {\n const all = fillZoom(bounds, area, padding);\n return all > 0 && all < limits.min ? { min: all, max: limits.max } : limits;\n}\n\n/** The length of a picture that stays in the free area when a person moves the picture, in CSS pixels. */\nexport const KEEP_IN_VIEW = 64;\n\n/** This function gives the start of a span of the screen that keeps the length `least` in an area, on one axis. */\nfunction keepSpan(start: number, length: number, areaStart: number, areaLength: number, least: number): number {\n const keep = Math.min(Math.max(least, 0), length, areaLength);\n return Math.min(Math.max(start, areaStart + keep - length), areaStart + areaLength - keep);\n}\n\n/**\n * This function gives the view that keeps a part of a rectangle of the picture in an area of the screen.\n * A person who moves the picture then cannot lose it.\n *\n * `least` is the length of the rectangle that stays in the area on each axis, in CSS pixels.\n * A rectangle that is smaller on the screen stays in the area fully. The zoom does not change.\n * The result is `view` itself when the view keeps the rectangle.\n */\nexport function keepRect(view: PictureView, rect: Rect, area: Rect, least: number = KEEP_IN_VIEW): PictureView {\n const shown = rectToScreen(view, rect);\n const x = keepSpan(shown.x, shown.w, area.x, area.w, least);\n const y = keepSpan(shown.y, shown.h, area.y, area.h, least);\n return x === shown.x && y === shown.y ? view : { x: view.x + x - shown.x, y: view.y + y - shown.y, k: view.k };\n}\n\n/** This function tells if two views are equal. */\nexport function sameView(a: PictureView, b: PictureView): boolean {\n return a.x === b.x && a.y === b.y && a.k === b.k;\n}\n\n/** The options of `frameRects`. */\nexport interface FrameOptions extends FitOptions {\n /** The smallest zoom at which a person reads the content of a rectangle. */\n readonly least: number;\n}\n\n/**\n * This function gives the view for the first rectangle of a list that an area of the screen shows at the zoom `least` or more.\n *\n * Give the bounds of the largest group of boxes first, then the bounds of smaller groups.\n * If no rectangle is small enough, the result has the zoom `least` and the middle of the last rectangle at the middle of the area.\n * An empty list gives `undefined`.\n */\nexport function frameRects(rects: readonly Rect[], area: Rect, options: FrameOptions): PictureView | undefined {\n for (const rect of rects) {\n const view = fitRect(rect, area, options);\n if (view.k >= options.least) return view;\n }\n const last = rects.at(-1);\n if (last === undefined) return undefined;\n return viewAt(rectCenter(last), rectCenter(area), clampZoom(options.least, options.limits));\n}\n\n/**\n * This function tells if a view shows all of a rectangle of the picture in an area of the screen.\n * `margin` is the smallest distance between the rectangle and each edge of the area, in CSS pixels.\n */\nexport function showsRect(view: PictureView, rect: Rect, area: Rect, margin: number = 0): boolean {\n const shown = rectToScreen(view, rect);\n return shown.x >= area.x + margin && shown.y >= area.y + margin && shown.x + shown.w <= area.x + area.w - margin && shown.y + shown.h <= area.y + area.h - margin;\n}\n\n/** The options of `revealRects`. */\nexport interface RevealOptions extends FrameOptions {\n /** The smallest distance between a rectangle in view and each edge of the area, in CSS pixels. The default is 0. */\n readonly margin?: number | undefined;\n}\n\n/**\n * This function gives the view that shows a selection, and it keeps the view `view` when the selection is in view.\n *\n * The rectangles are the bounds of the groups of the selection, as for `frameRects`, the largest group first.\n * The selection is in view when `view` has the zoom `least` or more, and shows all of the rectangle that `frameRects` selects.\n * The result is then `view` itself, so a camera does not move for a click on a box that a person reads.\n * In each other case, the result is the view of `frameRects`. An empty list gives `view`.\n */\nexport function revealRects(view: PictureView, rects: readonly Rect[], area: Rect, options: RevealOptions): PictureView {\n for (const rect of rects) {\n const framed = fitRect(rect, area, options);\n if (framed.k < options.least) continue;\n return view.k >= options.least && showsRect(view, rect, area, options.margin ?? 0) ? view : framed;\n }\n return frameRects(rects.slice(-1), area, options) ?? view;\n}\n\n/**\n * This function gives the view at a part of the way between two views. `part` goes from 0 to 1.\n *\n * The zoom changes by an equal factor for each equal step, so a zoom has one speed in the picture.\n * The way is a zoom at one screen point: the point of the picture that the two views show there stays there.\n * Thus each point of the picture moves along a straight line of the screen, in one direction.\n * Two views with one zoom give a straight move at one speed.\n */\nexport function viewBetween(from: PictureView, to: PictureView, part: number): PictureView {\n if (!(part > 0)) return from;\n if (part >= 1) return to;\n const log = Math.log(to.k / from.k);\n if (!Number.isFinite(log)) return to;\n // The origin moves in proportion to the change of the zoom. The function expm1 keeps the precision for two zooms that are almost equal.\n const share = log === 0 ? part : Math.expm1(log * part) / Math.expm1(log);\n return { x: from.x + (to.x - from.x) * share, y: from.y + (to.y - from.y) * share, k: from.k * Math.exp(log * part) };\n}\n\n/** A move of the camera of a flat picture from one view to a different view. */\nexport interface PictureMove {\n readonly from: PictureView;\n readonly to: PictureView;\n /** The time of the start of the move, in milliseconds. */\n readonly start: number;\n /** The time that the move takes, in milliseconds. */\n readonly duration: number;\n}\n\n/** The view of a camera at one time of a move. */\nexport interface PictureMoveStep {\n readonly view: PictureView;\n /** This value is true at the end of the move, and after it. */\n readonly done: boolean;\n}\n\n/**\n * This function gives the view of a camera at the time `now` of a move, in milliseconds.\n * The move has a slow start and a slow end. A move with no duration is at its end immediately.\n */\nexport function pictureMoveAt(move: PictureMove, now: number): PictureMoveStep {\n const part = partAt(move.start, move.duration, now);\n if (part >= 1) return { view: move.to, done: true };\n return { view: viewBetween(move.from, move.to, easeInOut(part)), done: false };\n}\n","import type { Rect } from \"@mark1russell7/layout-contract\";\nimport { fitRect, frameRects, revealRects, type FitOptions, type FrameOptions, type PictureView, type RevealOptions, type ZoomLimits } from \"./camera.ts\";\n\n/** What an aim gets: the picture and the screen at the time of the aim. */\nexport interface AimFrame {\n /** The bounds of the content, in the unit of the picture. */\n readonly bounds: Rect;\n /** The free area of the picture on the screen, in CSS pixels. */\n readonly area: Rect;\n /** The view of the camera before the aim. */\n readonly view: PictureView;\n /** The limits of the zoom. */\n readonly limits: ZoomLimits;\n}\n\n/**\n * An aim of the camera of a flat picture: a function that gives the view for a picture and a screen.\n * A stage asks the aim again after a change of the size of the picture, so the view stays correct.\n */\nexport type PictureAim = (frame: AimFrame) => PictureView;\n\n/** This function makes the aim that shows all of the picture, as large as the free area permits. */\nexport function aimAll(options: FitOptions = {}): PictureAim {\n return (frame) => fitRect(frame.bounds, frame.area, { ...options, limits: options.limits ?? frame.limits });\n}\n\n/**\n * This function makes the aim that shows a group of boxes at a zoom that a person reads.\n * The rectangles are the bounds of the groups, the largest group first: `frameRects` selects one. An empty list keeps the view.\n */\nexport function aimRects(rects: readonly Rect[], options: FrameOptions): PictureAim {\n return (frame) => frameRects(rects, frame.area, { ...options, limits: options.limits ?? frame.limits }) ?? frame.view;\n}\n\n/**\n * This function makes the aim that shows a selection, and keeps the view when the selection is in view.\n * The rectangles are the bounds of the groups of the selection, the largest group first: `revealRects` selects one.\n */\nexport function aimReveal(rects: readonly Rect[], options: RevealOptions): PictureAim {\n return (frame) => revealRects(frame.view, rects, frame.area, { ...options, limits: options.limits ?? frame.limits });\n}\n","import type { PathSegment } from \"@mark1russell7/layout-contract\";\nimport type { PictureView } from \"./camera.ts\";\nimport type { PaintOutline, PaintShape } from \"./paint.ts\";\n\nconst TURN = 2 * Math.PI;\n\n/** This function adds a path of the picture to the path of a context. */\nfunction tracePath(context: CanvasRenderingContext2D, path: readonly PathSegment[]): void {\n for (const segment of path) {\n switch (segment.kind) {\n case \"move\":\n context.moveTo(segment.to.x, segment.to.y);\n break;\n case \"line\":\n context.lineTo(segment.to.x, segment.to.y);\n break;\n case \"cubic\":\n context.bezierCurveTo(segment.c1.x, segment.c1.y, segment.c2.x, segment.c2.y, segment.to.x, segment.to.y);\n break;\n case \"arc\":\n context.arc(segment.center.x, segment.center.y, segment.radius, segment.start, segment.start + segment.sweep, segment.sweep < 0);\n break;\n }\n }\n}\n\n/** This function makes the path of an outline in a context. */\nfunction trace(context: CanvasRenderingContext2D, outline: PaintOutline): void {\n context.beginPath();\n switch (outline.kind) {\n case \"rect\":\n // An old browser has no round rectangle: its boxes get sharp corners.\n if (outline.radius > 0 && typeof context.roundRect === \"function\") context.roundRect(outline.x, outline.y, outline.w, outline.h, outline.radius);\n else context.rect(outline.x, outline.y, outline.w, outline.h);\n break;\n case \"ellipse\":\n context.ellipse(outline.cx, outline.cy, outline.rx, outline.ry, 0, 0, TURN);\n break;\n case \"polygon\":\n for (const ring of outline.rings) {\n ring.forEach(([x, y], i) => (i === 0 ? context.moveTo(x, y) : context.lineTo(x, y)));\n context.closePath();\n }\n break;\n case \"path\":\n tracePath(context, outline.path);\n break;\n }\n}\n\n/**\n * This function draws a paint list on a canvas, in the order of the list. `paintPicture` makes the list.\n *\n * The unit of the context is the CSS pixel, as a flat stage gives it: the function applies the view of the camera.\n * The function keeps the state of the context: after it, the context has the transform and the styles that it had before.\n */\nexport function drawShapes(context: CanvasRenderingContext2D, shapes: readonly PaintShape[], view: PictureView): void {\n if (shapes.length === 0) return;\n context.save();\n context.transform(view.k, 0, 0, view.k, view.x, view.y);\n context.lineJoin = \"round\";\n context.lineCap = \"round\";\n context.textBaseline = \"middle\";\n /** This value is true while the context has dashes. Most shapes have none, so the function sets them only at a change. */\n let dashed = false;\n for (const shape of shapes) {\n context.globalAlpha = shape.opacity;\n if (shape.type === \"text\") {\n context.font = shape.font;\n context.textAlign = shape.align;\n if (shape.halo !== undefined && dashed) {\n context.setLineDash([]);\n dashed = false;\n }\n const scale = shape.scale !== undefined && shape.scale > 0 ? shape.scale : 1;\n let { x, y } = shape;\n if (scale !== 1) {\n // The text is larger about its point: the point becomes the origin of the context.\n context.save();\n context.translate(x, y);\n context.scale(scale, scale);\n x = 0;\n y = 0;\n }\n if (shape.halo !== undefined) {\n context.strokeStyle = shape.halo.color;\n context.lineWidth = shape.halo.width / scale;\n context.strokeText(shape.text, x, y);\n }\n context.fillStyle = shape.fill;\n context.fillText(shape.text, x, y);\n if (scale !== 1) context.restore();\n continue;\n }\n trace(context, shape.outline);\n if (shape.fill !== undefined) {\n context.fillStyle = shape.fill;\n // A hole of a polygon stays empty with this rule.\n context.fill(\"evenodd\");\n }\n if (shape.stroke !== undefined && shape.lineWidth !== undefined && shape.lineWidth > 0) {\n const dash = shape.dash;\n const next = dash !== undefined && dash.length > 0;\n if (next || dashed) {\n context.setLineDash(next ? [...dash] : []);\n dashed = next;\n }\n context.strokeStyle = shape.stroke;\n context.lineWidth = shape.lineWidth;\n context.stroke();\n }\n }\n context.restore();\n}\n","import type { PictureBox, PictureRoute } from \"@mark1russell7/layout-contract\";\nimport type { PictureIndex } from \"./records.ts\";\n\n/** The focus of a picture: the records that stay clear, while each other record has less color. */\nexport interface PictureFocus {\n /** The ids of the boxes of the focus. */\n readonly boxes: ReadonlySet<string>;\n /** The ids of the routes of the focus. */\n readonly routes: ReadonlySet<string>;\n}\n\n/**\n * How near a record is to the focus of a picture.\n *\n * - `all`: the picture has no focus, so each record is clear.\n * - `in`: the record is in the focus.\n * - `beside`: the box is not in the focus, and its parent is. An example is a different row of the card of the selection.\n * - `out`: the record is not in the focus.\n */\nexport type FocusLevel = \"all\" | \"in\" | \"beside\" | \"out\";\n\n/** The share of the color that a record keeps at each focus level. */\nexport const FOCUS_OPACITY: Readonly<Record<FocusLevel, number>> = { all: 1, in: 1, beside: 0.55, out: 0.2 };\n\n/**\n * This function gives the focus of a list of records, or `undefined` when the picture has none of them.\n *\n * - A box brings each box below it in the tree.\n * - Each route at one of these boxes is in the focus, with the box at its other end.\n * - A route brings its two boxes.\n * - Each box of the focus brings each box above it in the tree, so the card of a row stays clear.\n */\nexport function focusOf(index: PictureIndex, seeds: Iterable<string>): PictureFocus | undefined {\n const boxes = new Set<string>();\n const routes = new Set<string>();\n /** The boxes of the list, and each box below them. */\n const own: string[] = [];\n const addRoute = (route: PictureRoute): void => {\n routes.add(route.id);\n if (index.boxes.has(route.source)) boxes.add(route.source);\n if (index.boxes.has(route.target)) boxes.add(route.target);\n };\n const seedRoutes: PictureRoute[] = [];\n for (const seed of seeds) {\n const route = index.routes.get(seed);\n if (route !== undefined) seedRoutes.push(route);\n if (!index.boxes.has(seed)) continue;\n const stack = [seed];\n for (let id = stack.pop(); id !== undefined; id = stack.pop()) {\n if (boxes.has(id)) continue;\n boxes.add(id);\n own.push(id);\n for (const child of index.children.get(id) ?? []) stack.push(child.id);\n }\n }\n for (const id of own) for (const route of index.routesAt.get(id) ?? []) addRoute(route);\n for (const route of seedRoutes) addRoute(route);\n for (const id of [...boxes]) {\n // A box that is in the focus stops the way up: a different step adds the boxes above it.\n for (let parent = index.boxes.get(id)?.parent; parent !== undefined && index.boxes.has(parent) && !boxes.has(parent); parent = index.boxes.get(parent)?.parent) {\n boxes.add(parent);\n }\n }\n return boxes.size === 0 && routes.size === 0 ? undefined : { boxes, routes };\n}\n\n/** This function gives the focus level of a box. */\nexport function boxFocus(focus: PictureFocus | undefined, box: PictureBox): FocusLevel {\n if (focus === undefined) return \"all\";\n if (focus.boxes.has(box.id)) return \"in\";\n return box.parent !== undefined && focus.boxes.has(box.parent) ? \"beside\" : \"out\";\n}\n\n/** This function gives the focus level of a route: `all`, `in` or `out`. */\nexport function routeFocus(focus: PictureFocus | undefined, route: PictureRoute): FocusLevel {\n if (focus === undefined) return \"all\";\n return focus.routes.has(route.id) ? \"in\" : \"out\";\n}\n","import { pathBounds, samplePath, type LayoutPicture, type PictureBox, type PictureLabel, type PictureRoute, type Point, type Rect } from \"@mark1russell7/layout-contract\";\n\n/**\n * A record of a picture that a person can point at: a box or a route. The name of the record is its id.\n * A box and a route with the same id are one record for the highlights of a stage.\n */\nexport type PictureRecord =\n | { readonly type: \"box\"; readonly id: string; readonly box: PictureBox }\n | { readonly type: \"route\"; readonly id: string; readonly route: PictureRoute };\n\n/** The tables of a picture, for the functions that find its records. */\nexport interface PictureIndex {\n readonly picture: LayoutPicture;\n /** Each box by its id. */\n readonly boxes: ReadonlyMap<string, PictureBox>;\n /** Each route by its id. */\n readonly routes: ReadonlyMap<string, PictureRoute>;\n /** The children of each box that has children, in the order of the picture. A box with children is a container. */\n readonly children: ReadonlyMap<string, readonly PictureBox[]>;\n /** The routes that start or end at each box, in the order of the picture. */\n readonly routesAt: ReadonlyMap<string, readonly PictureRoute[]>;\n /** The labels that name each box, in the order of the picture. */\n readonly boxLabels: ReadonlyMap<string, readonly PictureLabel[]>;\n /** The labels that name each route, in the order of the picture. */\n readonly routeLabels: ReadonlyMap<string, readonly PictureLabel[]>;\n /** The labels that name no record, in the order of the picture. */\n readonly freeLabels: readonly PictureLabel[];\n}\n\n/** This function adds a value to the list of a key. */\nfunction add<V>(lists: Map<string, V[]>, key: string, value: V): void {\n const list = lists.get(key);\n if (list === undefined) lists.set(key, [value]);\n else list.push(value);\n}\n\n/**\n * This function makes the tables of a picture. It does not examine the picture: `checkPicture` of `@mark1russell7/layout-contract` does that.\n * 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.\n * Thus a page that removes a route from a picture can keep the label of the route.\n */\nexport function indexPicture(picture: LayoutPicture): PictureIndex {\n const boxes = new Map<string, PictureBox>();\n const routes = new Map<string, PictureRoute>();\n const children = new Map<string, PictureBox[]>();\n const routesAt = new Map<string, PictureRoute[]>();\n const boxLabels = new Map<string, PictureLabel[]>();\n const routeLabels = new Map<string, PictureLabel[]>();\n const freeLabels: PictureLabel[] = [];\n for (const box of picture.boxes) {\n boxes.set(box.id, box);\n if (box.parent !== undefined) add(children, box.parent, box);\n }\n for (const route of picture.routes) {\n routes.set(route.id, route);\n add(routesAt, route.source, route);\n if (route.target !== route.source) add(routesAt, route.target, route);\n }\n for (const label of picture.labels) {\n if (label.box !== undefined) {\n if (boxes.has(label.box)) add(boxLabels, label.box, label);\n } else if (label.route !== undefined) {\n if (routes.has(label.route)) add(routeLabels, label.route, label);\n } else {\n freeLabels.push(label);\n }\n }\n return { picture, boxes, routes, children, routesAt, boxLabels, routeLabels, freeLabels };\n}\n\n/** The line of a route, for the functions that find it: its bounds, and a polyline that follows its path. */\nexport interface RouteLine {\n readonly bounds: Rect;\n /** The polyline is 0.5 units or less from the path. */\n readonly points: readonly Point[];\n}\n\nconst lines = new WeakMap<PictureRoute, RouteLine>();\n\n/**\n * This function gives the line of a route, or `undefined` for a route with an empty path.\n * It keeps the line of each route, so a second question about a route costs nothing.\n */\nexport function routeLine(route: PictureRoute): RouteLine | undefined {\n if (route.path.length === 0) return undefined;\n const known = lines.get(route);\n if (known !== undefined) return known;\n const line: RouteLine = { bounds: pathBounds(route.path), points: samplePath(route.path) };\n lines.set(route, line);\n return line;\n}\n","import { pointPolylineDistance, pointRegionDistance, type PictureBox, type Point } from \"@mark1russell7/layout-contract\";\nimport { routeLine, type PictureIndex, type PictureRecord } from \"./records.ts\";\n\n/** The options of `pickRecord`. */\nexport interface PickOptions {\n /** The distance from the point at which a record is below the point, in the unit of the picture. The default is 0. */\n readonly slack?: number | undefined;\n /** This function tells if a person can point at a record. The default permits each box and no route. */\n readonly picks?: ((record: PictureRecord) => boolean) | undefined;\n}\n\n/** 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. */\nexport function boxDistance(box: PictureBox, point: Point): number {\n if (box.shape === undefined) return pointRegionDistance(point, { kind: \"rect\", x: box.x, y: box.y, w: box.w, h: box.h });\n return pointRegionDistance({ x: point.x - box.x, y: point.y - box.y }, box.shape);\n}\n\nconst boxesOnly = (record: PictureRecord): boolean => record.type === \"box\";\n\n/**\n * This function gives the record of a picture below a point, or `undefined` for no record.\n *\n * - A box with no child comes first: the top box at the point, then the nearest box in the slack.\n * - A route comes next: the nearest route in the slack. A route is thin, so it comes before a container.\n * - A box with children comes last: the top one at the point, then the nearest one in the slack.\n *\n * 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.\n */\nexport function pickRecord(index: PictureIndex, point: Point, options: PickOptions = {}): PictureRecord | undefined {\n const slack = Math.max(0, options.slack ?? 0);\n const picks = options.picks ?? boxesOnly;\n let leaf: PictureRecord | undefined;\n let nearLeaf: PictureRecord | undefined;\n let nearLeafAt = Infinity;\n let container: PictureRecord | undefined;\n let nearContainer: PictureRecord | undefined;\n let nearContainerAt = Infinity;\n for (const box of index.picture.boxes) {\n 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;\n const distance = boxDistance(box, point);\n if (distance > slack) continue;\n const record: PictureRecord = { type: \"box\", id: box.id, box };\n if (!picks(record)) continue;\n if (index.children.has(box.id)) {\n if (distance === 0) container = record;\n else if (distance <= nearContainerAt) {\n nearContainer = record;\n nearContainerAt = distance;\n }\n } else if (distance === 0) leaf = record;\n else if (distance <= nearLeafAt) {\n nearLeaf = record;\n nearLeafAt = distance;\n }\n }\n if (leaf !== undefined) return leaf;\n if (nearLeaf !== undefined) return nearLeaf;\n let found: PictureRecord | undefined;\n let foundAt = Infinity;\n for (const route of index.picture.routes) {\n const line = routeLine(route);\n if (line === undefined) continue;\n const { bounds } = line;\n 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;\n const record: PictureRecord = { type: \"route\", id: route.id, route };\n if (!picks(record)) continue;\n const distance = pointPolylineDistance(point, line.points);\n if (distance > slack || distance > foundAt) continue;\n found = record;\n foundAt = distance;\n }\n return found ?? container ?? nearContainer;\n}\n","import type { PictureBox, PictureLabel, PictureRoute } from \"@mark1russell7/layout-contract\";\nimport type { Highlight } from \"../highlight.ts\";\nimport type { FocusLevel } from \"./focus.ts\";\nimport type { PictureRecord } from \"./records.ts\";\n\n/** What a look knows about a record at the time of a picture. */\nexport interface RecordState {\n /** The highlight of the record. A label has the highlight of the record that it names. */\n readonly highlight: Highlight;\n /** How near the record is to the focus of the picture. */\n readonly focus: FocusLevel;\n /** The zoom of the camera: the number of CSS pixels for one unit of the picture. */\n readonly zoom: number;\n /** This value is true for a box with children, and for a label of such a box. */\n readonly container: boolean;\n}\n\n/**\n * This function gives the size of one unit of a look, in the unit of the picture.\n * The widths of the lines, the dashes and the sizes of the signs of a look are in this unit.\n *\n * At the zoom 1 or less, one unit is one CSS pixel. Thus a thin line stays clear in a small picture.\n * Above the zoom 1, one unit is one unit of the picture. Thus a line grows with its box.\n */\nexport function lookUnit(zoom: number): number {\n return zoom > 0 && zoom < 1 ? 1 / zoom : 1;\n}\n\n/** A line around a box, off its border. A page shows a selection with it. */\nexport interface BoxRing {\n readonly color: string;\n /** The width of the line, in units of a look. */\n readonly width: number;\n /** The distance from the border of the box to the line, in units of a look. A polygon has the line on its border. */\n readonly gap: number;\n}\n\n/** A small sign in a box, for example for the state of its record. */\nexport interface BoxMark {\n /** A `dot` is a full circle, and a `ring` is the line of a circle. */\n readonly shape: \"dot\" | \"ring\";\n /** The middle of the sign from the left edge of the box, in the unit of the picture. */\n readonly x: number;\n /** The middle of the sign from the top edge of the box, in the unit of the picture. */\n readonly y: number;\n /** The radius of the sign, in units of a look. */\n readonly radius: number;\n readonly color: string;\n /** The width of the line of a ring, in units of a look. The default is 1.5. */\n readonly width?: number | undefined;\n}\n\n/** The look of a box. A box with no `fill` and no `stroke` shows only its ring and its signs. */\nexport interface BoxLook {\n /** The color of the inside. */\n readonly fill?: string | undefined;\n /** The color of the border. */\n readonly stroke?: string | undefined;\n /** The width of the border, in units of a look. The default is 1. */\n readonly width?: number | undefined;\n /** The lengths of the dashes and the gaps of the border, in units of a look. */\n readonly dash?: readonly number[] | undefined;\n /** The radius of the corners of a rectangle, in the unit of the picture. The default is 0. */\n readonly radius?: number | undefined;\n /** The share of its color that the box keeps, from 0 to 1. The focus of the picture decreases it more. The default is 1. */\n readonly opacity?: number | undefined;\n readonly ring?: BoxRing | undefined;\n readonly marks?: readonly BoxMark[] | undefined;\n}\n\n/** The sign at an end of a route. */\nexport interface RouteEnd {\n /** An `arrow` points along the route, out of it. A `dot` is a full circle. */\n readonly shape: \"arrow\" | \"dot\";\n /** The length of an arrow or the radius of a dot, in units of a look. */\n readonly size: number;\n}\n\n/** The look of a route. */\nexport interface RouteLook {\n readonly stroke: string;\n /** The width of the line, in units of a look. The default is 1.25. */\n readonly width?: number | undefined;\n /** The lengths of the dashes and the gaps, in units of a look. */\n readonly dash?: readonly number[] | undefined;\n /** The share of its color that the route keeps, from 0 to 1. The default is 1. */\n readonly opacity?: number | undefined;\n /** The sign at the source of the route. */\n readonly start?: RouteEnd | undefined;\n /** The sign at the target of the route. */\n readonly end?: RouteEnd | undefined;\n}\n\n/** The look of a label. */\nexport interface LabelLook {\n readonly color: string;\n /** The share of its color that the label keeps, from 0 to 1. The default is 1. */\n readonly opacity?: number | undefined;\n /** The color of a line around each letter. A text on a route is clear with the color of the page. */\n readonly halo?: string | undefined;\n /** With `bars`, each line is a bar of its width: a person sees the form of a text that is too small to read. The default is `text`. */\n readonly as?: \"text\" | \"bars\" | undefined;\n /**\n * The smallest height of a line of the label on the screen, in CSS pixels. Use it for a name that a person reads in a far view.\n * At a zoom with a smaller line, the text keeps this height. It becomes larger about its place, and it is on top of each other shape.\n *\n * Two such texts do not overlap. The text of a record with a highlight has the first choice, then the text of the larger box.\n * A text with no free place has no paint. The value is at most `MOST_KEPT_LINE`, and it has no effect on bars.\n */\n readonly least?: number | undefined;\n}\n\n/** The largest height on the screen that a label keeps with `least`, in CSS pixels. A larger value of `least` becomes this value. */\nexport const MOST_KEPT_LINE = 32;\n\n/**\n * The looks of a picture: one function for each type of record. `T` is the type of the theme.\n * Each function gives the look of a record in a state, or `undefined` for a record that the picture does not show.\n * A box that the picture does not show takes its labels with it, and a person cannot point at it.\n */\nexport interface PictureLooks<T> {\n box(box: PictureBox, state: RecordState, theme: T): BoxLook | undefined;\n route(route: PictureRoute, state: RecordState, theme: T): RouteLook | undefined;\n /** `of` is the record that the label names, or `undefined` for a label that names no record. */\n label(label: PictureLabel, state: RecordState, theme: T, of: PictureRecord | undefined): LabelLook | undefined;\n}\n\n/** The colors of a plain picture. */\nexport interface PictureTheme {\n /** The inside of a box with no child. */\n readonly box: string;\n /** The border of a box with no child. */\n readonly boxLine: string;\n /** The inside of a box with children. */\n readonly container: string;\n /** The border of a box with children, and the bars of a text that is too small to read. */\n readonly containerLine: string;\n readonly text: string;\n /** The text of a box with children. */\n readonly mutedText: string;\n readonly route: string;\n /** The color of a record with a highlight. */\n readonly accent: string;\n /** The color of the page behind the picture. The line around the text of a route has it. */\n readonly paper: string;\n}\n\n/** The colors of a plain picture on a light page. */\nexport const LIGHT_PICTURE_THEME: PictureTheme = {\n box: \"#ffffff\",\n boxLine: \"#454f67\",\n container: \"#eef1f6\",\n containerLine: \"#aeb6c7\",\n text: \"#151c2e\",\n mutedText: \"#5f6880\",\n route: \"#7a8399\",\n accent: \"#2346c4\",\n paper: \"#f5f6f9\",\n};\n\n/** The colors of a plain picture on a dark page. */\nexport const DARK_PICTURE_THEME: PictureTheme = {\n box: \"#151a2b\",\n boxLine: \"#b3bad0\",\n container: \"#1c2236\",\n containerLine: \"#46507a\",\n text: \"#e6e9f3\",\n mutedText: \"#949cb3\",\n route: \"#6f7aa3\",\n accent: \"#93abff\",\n paper: \"#0e1220\",\n};\n\n/** 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. */\nexport const SMALLEST_TEXT_LINE = 11;\n\n/** The smallest height of a line of text on the screen that a plain picture shows as a bar, in CSS pixels. */\nexport const SMALLEST_BAR_LINE = 2.5;\n\n/** The smallest width on the screen of a box with children whose name stays a text in a plain picture, in CSS pixels. */\nexport const SMALLEST_NAMED_BOX = 48;\n\n/** The options of `plainLooks`. */\nexport interface PlainLookOptions {\n /** The radius of the corners of each box, in the unit of the picture. The default is 6. */\n readonly radius?: number | undefined;\n /** The sign at the target of each route. The default is no sign. */\n readonly end?: RouteEnd | undefined;\n}\n\n/**\n * This function gives the looks of a plain picture: boxes with a border, routes as lines and the text of the labels.\n *\n * - A record below the pointer has the color `accent`. The selected record has a wider line too.\n * - A box with children has the colors of a container, and its label has the muted color.\n * - The label of a route has a line of the color `paper` around its letters.\n * - A text that is too small to read is a row of bars. A text that is smaller than a bar has no paint.\n * - 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.\n * The name of such a box with a highlight stays a text at each size.\n */\nexport function plainLooks(options: PlainLookOptions = {}): PictureLooks<PictureTheme> {\n const radius = options.radius ?? 6;\n return {\n box(_box, state, theme) {\n const plain = state.container ? theme.containerLine : theme.boxLine;\n return {\n fill: state.container ? theme.container : theme.box,\n stroke: state.highlight > 0 ? theme.accent : plain,\n width: state.highlight === 2 ? 2 : 1,\n radius,\n };\n },\n route(_route, state, theme) {\n return { stroke: state.highlight > 0 ? theme.accent : theme.route, width: state.highlight === 2 ? 2 : 1.25, end: options.end };\n },\n label(label, state, theme, of) {\n const tall = label.lineHeight * state.zoom;\n // The name of a group keeps a height that a person can read, until the group is small. The pointer shows the name of a small group.\n if (tall < SMALLEST_TEXT_LINE && state.container && of?.type === \"box\" && (state.highlight > 0 || of.box.w * state.zoom >= SMALLEST_NAMED_BOX)) {\n return { color: theme.mutedText, halo: theme.paper, least: SMALLEST_TEXT_LINE };\n }\n if (tall < SMALLEST_BAR_LINE) return undefined;\n if (tall < SMALLEST_TEXT_LINE) return { color: theme.containerLine, as: \"bars\" };\n if (of?.type === \"route\") return { color: theme.text, halo: theme.paper };\n return { color: state.container ? theme.mutedText : theme.text };\n },\n };\n}\n","import {\n grow,\n overlapOf,\n pathEnd,\n pathStart,\n translate,\n type LabelAlign,\n type PathSegment,\n type PathTangent,\n type PictureBox,\n type PictureLabel,\n type PictureRoute,\n type Rect,\n type Region,\n type Ring,\n} from \"@mark1russell7/layout-contract\";\nimport type { Highlight } from \"../highlight.ts\";\nimport { boxFocus, FOCUS_OPACITY, routeFocus, type FocusLevel, type PictureFocus } from \"./focus.ts\";\nimport { lookUnit, MOST_KEPT_LINE, type BoxLook, type LabelLook, type PictureLooks, type RecordState, type RouteEnd, type RouteLook } from \"./looks.ts\";\nimport { routeLine, type PictureIndex, type PictureRecord } from \"./records.ts\";\n\n/** The outline of a shape of a paint list, in the unit of the picture. */\nexport type PaintOutline =\n | { readonly kind: \"rect\"; readonly x: number; readonly y: number; readonly w: number; readonly h: number; readonly radius: number }\n | { readonly kind: \"ellipse\"; readonly cx: number; readonly cy: number; readonly rx: number; readonly ry: number }\n | { readonly kind: \"polygon\"; readonly rings: readonly Ring[] }\n | { readonly kind: \"path\"; readonly path: readonly PathSegment[] };\n\n/** A shape of a paint list with an outline: an inside, a line, or the two. */\nexport interface PaintOutlined {\n readonly type: \"shape\";\n readonly outline: PaintOutline;\n /** The color of the inside. */\n readonly fill?: string | undefined;\n /** The color of the line. */\n readonly stroke?: string | undefined;\n /** The width of the line, in the unit of the picture. */\n readonly lineWidth?: number | undefined;\n /** The lengths of the dashes and the gaps of the line, in the unit of the picture. */\n readonly dash?: readonly number[] | undefined;\n /** The share of its color that the shape keeps, above 0 and to 1. */\n readonly opacity: number;\n}\n\n/** One line of text of a paint list. */\nexport interface PaintText {\n readonly type: \"text\";\n readonly text: string;\n /** The point of the line on the x axis: its left end, its middle or its right end, as `align` tells. */\n readonly x: number;\n /** The middle of the height of the line. */\n readonly y: number;\n /** The font, as the CSS property `font`. Its size is in the unit of the picture. */\n readonly font: string;\n readonly align: LabelAlign;\n readonly fill: string;\n /** A line around each letter, below the letters. Its width is in the unit of the picture. */\n readonly halo?: { readonly color: string; readonly width: number } | undefined;\n /** The share of its color that the text keeps, above 0 and to 1. */\n readonly opacity: number;\n /**\n * The factor by which the text is larger than its font, about its point (`x`, `y`). The default is 1.\n * A label that keeps a height on the screen has it. The width of `halo` is the width after this factor.\n */\n readonly scale?: number | undefined;\n}\n\n/** One shape of a paint list. The list is in the order of the paint, so its first shape is at the back. */\nexport type PaintShape = PaintOutlined | PaintText;\n\n/** The state of a picture at the time of a paint. */\nexport interface PaintState {\n /** The zoom of the camera: the number of CSS pixels for one unit of the picture. */\n readonly zoom: number;\n /** This function gives the highlight of a record by its name. */\n readonly highlight: (record: string) => Highlight;\n /** The focus of the picture. Without it, each record is clear. */\n readonly focus?: PictureFocus | undefined;\n /** The part of the picture in view. A record out of it gets no shape. Without it, each record gets its shapes. */\n readonly visible?: Rect | undefined;\n /** This function gives the width of a text in a font, in the unit of the picture. A bar of a label has this width, or the width of the label. */\n readonly measure?: ((font: string, text: string) => number) | undefined;\n /**\n * This function gives the share of its color that a record keeps. `key` is the key of the record, and `goal` is the share of its focus level.\n * A content gives a function that goes to the goal with time. Without it, the share is the goal.\n */\n readonly fade?: ((key: string, goal: number) => number) | undefined;\n}\n\n/** The key of the labels that name no record, for `fade`. */\nexport const FREE_LABELS = \"labels\";\n\n/** 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. */\nexport const VIEW_MARGIN = 24;\n\n/** The height of a bar of a label, as a share of the height of its line. */\nexport const BAR_HEIGHT = 0.42;\n\n/** The width of the line around the letters of a label, as a share of the height of its line. */\nexport const HALO_WIDTH = 0.25;\n\n/** The half width of an arrow at the end of a route, as a share of its length. */\nexport const ARROW_SPREAD = 0.45;\n\n/** The smallest distance between two labels that keep a height on the screen, in units of a look. */\nexport const KEPT_GAP = 4;\n\n/** 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. */\nexport function recordKey(type: PictureRecord[\"type\"], id: string): string {\n return `${type}:${id}`;\n}\n\n/** This function gives the state of a box for its look. */\nexport function boxState(index: PictureIndex, box: PictureBox, state: PaintState): RecordState {\n return { highlight: state.highlight(box.id), focus: boxFocus(state.focus, box), zoom: state.zoom, container: index.children.has(box.id) };\n}\n\n/** This function gives the state of a route for its look. */\nexport function routeState(route: PictureRoute, state: PaintState): RecordState {\n return { highlight: state.highlight(route.id), focus: routeFocus(state.focus, route), zoom: state.zoom, container: false };\n}\n\n/** This function gives the outline of a box, larger by `more` at each side. A polygon does not become larger. */\nfunction outlineOf(box: PictureBox, radius: number, more: number): PaintOutline {\n const region: Region = box.shape === undefined ? { kind: \"rect\", x: box.x, y: box.y, w: box.w, h: box.h } : translate(box.shape, box.x, box.y);\n switch (region.kind) {\n case \"rect\": {\n const w = Math.max(0, region.w + 2 * more);\n const h = Math.max(0, region.h + 2 * more);\n return { kind: \"rect\", x: region.x - more, y: region.y - more, w, h, radius: Math.max(0, Math.min(radius + more, w / 2, h / 2)) };\n }\n case \"circle\":\n return { kind: \"ellipse\", cx: region.cx, cy: region.cy, rx: Math.max(0, region.r + more), ry: Math.max(0, region.r + more) };\n case \"ellipse\":\n return { kind: \"ellipse\", cx: region.cx, cy: region.cy, rx: Math.max(0, region.rx + more), ry: Math.max(0, region.ry + more) };\n case \"polygon\":\n return { kind: \"polygon\", rings: region.holes === undefined ? [region.points] : [region.points, ...region.holes] };\n }\n}\n\n/** This function gives the lengths of a dash in the unit of the picture. */\nfunction dashOf(dash: readonly number[] | undefined, unit: number): readonly number[] | undefined {\n return dash === undefined || dash.length === 0 ? undefined : dash.map((length) => length * unit);\n}\n\n/** This function adds the shapes of a box: its ring, its inside and border, and its signs. */\nfunction addBox(shapes: PaintShape[], box: PictureBox, look: BoxLook, unit: number, share: number): void {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (!(opacity > 0)) return;\n const radius = look.radius ?? 0;\n if (look.ring !== undefined) {\n const more = (look.ring.gap + look.ring.width / 2) * unit;\n shapes.push({ type: \"shape\", outline: outlineOf(box, radius, more), stroke: look.ring.color, lineWidth: look.ring.width * unit, opacity });\n }\n if (look.fill !== undefined || look.stroke !== undefined) {\n const line = look.stroke === undefined ? undefined : (look.width ?? 1) * unit;\n shapes.push({ type: \"shape\", outline: outlineOf(box, radius, 0), fill: look.fill, stroke: look.stroke, lineWidth: line, dash: dashOf(look.dash, unit), opacity });\n }\n for (const mark of look.marks ?? []) {\n const r = Math.max(0, mark.radius * unit);\n const outline: PaintOutline = { kind: \"ellipse\", cx: box.x + mark.x, cy: box.y + mark.y, rx: r, ry: r };\n if (mark.shape === \"dot\") shapes.push({ type: \"shape\", outline, fill: mark.color, opacity });\n else shapes.push({ type: \"shape\", outline, stroke: mark.color, lineWidth: (mark.width ?? 1.5) * unit, opacity });\n }\n}\n\n/** 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. */\nfunction leftShare(label: PictureLabel): number {\n return label.align === \"center\" ? 0.5 : label.align === \"right\" ? 1 : 0;\n}\n\n/**\n * This function gives the factor by which a label becomes larger, so that a line is `least` CSS pixels high on the screen.\n * The factor is 1 for a label that is high enough.\n */\nfunction keptScale(label: PictureLabel, least: number, zoom: number): number {\n const tall = label.lineHeight * zoom;\n return tall > 0 && tall < least ? least / tall : 1;\n}\n\n/**\n * 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.\n * 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.\n */\nfunction keptRect(label: PictureLabel, wide: number, scale: number): Rect {\n const left = leftShare(label);\n const tall = label.lines.length * label.lineHeight;\n return { x: label.x + left * label.w - left * wide * scale, y: label.y + (tall - tall * scale) / 2, w: wide * scale, h: tall * scale };\n}\n\n/** A label that keeps a height on the screen, before it has a place. */\ninterface KeptLabel {\n readonly label: PictureLabel;\n readonly look: LabelLook;\n readonly scale: number;\n readonly opacity: number;\n /** The highlight of the record that the label names. */\n readonly highlight: Highlight;\n /** The area of the box that the label names, or 0. */\n readonly area: number;\n}\n\n/** This function adds the texts of a label that keeps a height on the screen. `rect` is the rectangle of its lines. */\nfunction addKept(shapes: PaintShape[], kept: KeptLabel, rect: Rect): void {\n const { label, look, scale, opacity } = kept;\n const tall = label.lineHeight * scale;\n const halo = look.halo === undefined ? undefined : { color: look.halo, width: tall * HALO_WIDTH };\n const x = label.x + leftShare(label) * label.w;\n for (let i = 0; i < label.lines.length; i++) {\n const text = label.lines[i]!;\n if (text.trim() === \"\") continue;\n shapes.push({ type: \"text\", text, x, y: rect.y + (i + 0.5) * tall, font: label.font, align: label.align ?? \"left\", fill: look.color, halo, opacity, scale });\n }\n}\n\n/** This function adds the shapes of a label: one text or one bar for each line that is not empty. */\nfunction addLabel(shapes: PaintShape[], label: PictureLabel, look: LabelLook, share: number, measure: PaintState[\"measure\"]): void {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (!(opacity > 0)) return;\n const align = label.align ?? \"left\";\n const left = leftShare(label);\n for (let i = 0; i < label.lines.length; i++) {\n const text = label.lines[i]!;\n if (text.trim() === \"\") continue;\n const y = label.y + (i + 0.5) * label.lineHeight;\n if (look.as !== \"bars\") {\n const halo = look.halo === undefined ? undefined : { color: look.halo, width: label.lineHeight * HALO_WIDTH };\n shapes.push({ type: \"text\", text, x: label.x + left * label.w, y, font: label.font, align, fill: look.color, halo, opacity });\n continue;\n }\n const measured = measure === undefined ? label.w : measure(label.font, text);\n const wide = label.w > 0 ? Math.min(measured, label.w) : measured;\n if (!(wide > 0)) continue;\n const tall = label.lineHeight * BAR_HEIGHT;\n const outline: PaintOutline = { kind: \"rect\", x: label.x + left * (label.w - wide), y: y - tall / 2, w: wide, h: tall, radius: Math.min(tall, wide) / 2 };\n shapes.push({ type: \"shape\", outline, fill: look.color, opacity });\n }\n}\n\n/** 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. */\nfunction addEnd(shapes: PaintShape[], at: PathTangent, out: 1 | -1, end: RouteEnd, stroke: string, lineWidth: number, unit: number, opacity: number): void {\n const size = end.size * unit;\n if (!(size > 0)) return;\n const { point } = at;\n if (end.shape === \"dot\") {\n shapes.push({ type: \"shape\", outline: { kind: \"ellipse\", cx: point.x, cy: point.y, rx: size, ry: size }, fill: stroke, opacity });\n return;\n }\n const dx = at.direction.x * out;\n const dy = at.direction.y * out;\n // A path with no length has no direction, so it has no arrow.\n if (dx === 0 && dy === 0) return;\n // The arrow is two lines from its point back to each side of the route.\n const backX = point.x - dx * size;\n const backY = point.y - dy * size;\n const half = size * ARROW_SPREAD;\n const path: PathSegment[] = [\n { kind: \"move\", to: { x: backX - dy * half, y: backY + dx * half } },\n { kind: \"line\", to: point },\n { kind: \"line\", to: { x: backX + dy * half, y: backY - dx * half } },\n ];\n shapes.push({ type: \"shape\", outline: { kind: \"path\", path }, stroke, lineWidth, opacity });\n}\n\n/** This function adds the shapes of a route: its line, and the signs at its ends. */\nfunction addRoute(shapes: PaintShape[], route: PictureRoute, look: RouteLook, unit: number, share: number): void {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (!(opacity > 0)) return;\n const lineWidth = (look.width ?? 1.25) * unit;\n shapes.push({ type: \"shape\", outline: { kind: \"path\", path: route.path }, stroke: look.stroke, lineWidth, dash: dashOf(look.dash, unit), opacity });\n if (look.start !== undefined) addEnd(shapes, pathStart(route.path), -1, look.start, look.stroke, lineWidth, unit, opacity);\n if (look.end !== undefined) addEnd(shapes, pathEnd(route.path), 1, look.end, look.stroke, lineWidth, unit, opacity);\n}\n\n/**\n * This function gives the paint list of a picture: the shapes that a renderer draws, in the order of the paint.\n * The function is pure, so a test examines a picture with no browser. `drawShapes` draws the list on a canvas.\n *\n * The layers are, from the back:\n *\n * - The boxes with children, each with its labels.\n * - The routes. The routes of the focus and those with a highlight are after the others.\n * - The boxes with no child, each with its labels.\n * - The labels of the routes, then the labels that name no record.\n * - The labels that keep a height on the screen (`least` of a label look).\n *\n * In a layer, the records are in the order of the picture. A label has the state of the record that it names.\n * The focus of the picture decreases the color of each record out of it (`FOCUS_OPACITY`).\n */\nexport function paintPicture<T>(index: PictureIndex, looks: PictureLooks<T>, theme: T, state: PaintState): PaintShape[] {\n const { picture } = index;\n const unit = lookUnit(state.zoom);\n const margin = VIEW_MARGIN * unit;\n const { visible, measure, zoom } = state;\n const inView = (rect: Rect): boolean => {\n if (visible === undefined) return true;\n const overlap = overlapOf(grow(rect, margin), visible);\n return overlap.x >= 0 && overlap.y >= 0;\n };\n /** This function tells if a label can be in view: at its place, or with the largest height that a label keeps. */\n const near = (label: PictureLabel): boolean => {\n if (inView(label)) return true;\n const most = keptScale(label, MOST_KEPT_LINE, zoom);\n return most > 1 && inView(keptRect(label, label.w, most));\n };\n const shareOf = (key: string, level: FocusLevel): number => {\n const goal = FOCUS_OPACITY[level];\n return state.fade === undefined ? goal : state.fade(key, goal);\n };\n const kept: KeptLabel[] = [];\n /** 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. */\n const place = (shapes: PaintShape[], label: PictureLabel, look: LabelLook | undefined, share: number, highlight: Highlight, area: number): void => {\n if (look === undefined) return;\n const scale = look.least === undefined || look.as === \"bars\" ? 1 : keptScale(label, Math.min(look.least, MOST_KEPT_LINE), zoom);\n if (scale > 1) {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (opacity > 0) kept.push({ label, look, scale, opacity, highlight, area });\n } else if (inView(label)) addLabel(shapes, label, look, share, measure);\n };\n\n const containers: PaintShape[] = [];\n const leaves: PaintShape[] = [];\n for (const box of picture.boxes) {\n const labels = index.boxLabels.get(box.id) ?? [];\n const shown = inView(box);\n if (!shown && !labels.some(near)) continue;\n const boxIs = boxState(index, box, state);\n const look = looks.box(box, boxIs, theme);\n if (look === undefined) continue;\n const share = shareOf(recordKey(\"box\", box.id), boxIs.focus);\n const shapes = boxIs.container ? containers : leaves;\n if (shown) addBox(shapes, box, look, unit, share);\n const record: PictureRecord = { type: \"box\", id: box.id, box };\n for (const label of labels) if (near(label)) place(shapes, label, looks.label(label, boxIs, theme, record), share, boxIs.highlight, box.w * box.h);\n }\n\n const back: PaintShape[] = [];\n const front: PaintShape[] = [];\n const routeLabels: PaintShape[] = [];\n for (const route of picture.routes) {\n const line = routeLine(route);\n if (line === undefined) continue;\n const labels = index.routeLabels.get(route.id) ?? [];\n const shown = inView(line.bounds);\n if (!shown && !labels.some(near)) continue;\n const routeIs = routeState(route, state);\n const look = looks.route(route, routeIs, theme);\n if (look === undefined) continue;\n const share = shareOf(recordKey(\"route\", route.id), routeIs.focus);\n if (shown) addRoute(routeIs.focus === \"in\" || routeIs.highlight > 0 ? front : back, route, look, unit, share);\n const record: PictureRecord = { type: \"route\", id: route.id, route };\n for (const label of labels) if (near(label)) place(routeLabels, label, looks.label(label, routeIs, theme, record), share, routeIs.highlight, 0);\n }\n\n const free: PaintShape[] = [];\n if (index.freeLabels.length > 0) {\n const level: FocusLevel = state.focus === undefined ? \"all\" : \"out\";\n const labelIs: RecordState = { highlight: 0, focus: level, zoom: state.zoom, container: false };\n const share = shareOf(FREE_LABELS, level);\n for (const label of index.freeLabels) if (near(label)) place(free, label, looks.label(label, labelIs, theme, undefined), share, 0, 0);\n }\n\n const top: PaintShape[] = [];\n if (kept.length > 0) {\n // The sort keeps the order of two labels of the same rank: the boxes, then the routes, then the labels that name no record.\n kept.sort((a, b) => b.highlight - a.highlight || b.area - a.area);\n const gap = KEPT_GAP * unit;\n const taken: Rect[] = [];\n for (const item of kept) {\n const { label } = item;\n const lines = label.lines.filter((line) => line.trim() !== \"\");\n if (lines.length === 0) continue;\n let wide = measure === undefined ? label.w : Math.max(...lines.map((line) => measure(label.font, line)));\n if (label.w > 0) wide = Math.min(wide, label.w);\n const rect = keptRect(label, wide, item.scale);\n if (!inView(rect)) continue;\n const space = grow(rect, gap);\n const clear = taken.every((other) => {\n const overlap = overlapOf(space, other);\n return !(overlap.x > 0 && overlap.y > 0);\n });\n if (!clear) continue;\n taken.push(rect);\n addKept(top, item, rect);\n }\n }\n return containers.concat(back, front, leaves, routeLabels, free, top);\n}\n","import { pictureBounds, type LayoutPicture, type Rect } from \"@mark1russell7/layout-contract\";\nimport type { Highlight } from \"../highlight.ts\";\nimport { approach } from \"../motion.ts\";\nimport { drawShapes } from \"./draw.ts\";\nimport { boxFocus, FOCUS_OPACITY, focusOf, routeFocus, type PictureFocus } from \"./focus.ts\";\nimport { pickRecord } from \"./hit.ts\";\nimport type { PictureLooks } from \"./looks.ts\";\nimport { boxState, FREE_LABELS, paintPicture, recordKey, routeState, type PaintState } from \"./paint.ts\";\nimport { indexPicture, type PictureRecord } from \"./records.ts\";\nimport type { PictureContent } from \"./stage.ts\";\n\n/** 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. */\nexport const FOCUS_FADE = 0.08;\n\n/** The bounds of a picture with no record. */\nconst NO_BOUNDS: Rect = { x: 0, y: 0, w: 0, h: 0 };\n\n/** The largest number of text widths that a content keeps. */\nconst MOST_WIDTHS = 4000;\n\nconst NO_SEEDS: readonly string[] = [];\n\n/** The options of `createPictureContent`. `T` is the type of the theme. */\nexport interface PictureContentOptions<T> {\n /** The looks of the records. `plainLooks` gives the looks of a plain picture. */\n readonly looks: PictureLooks<T>;\n /** This function tells if a person can point at a record. The default permits each box and no route. */\n readonly picks?: ((record: PictureRecord) => boolean) | undefined;\n /**\n * The records of the focus. With `selection`, the selected record and the records at it stay clear, and each other record has less color.\n * With `none`, the picture has no focus until the page gives one with `setFocus`. The default is `selection`.\n */\n readonly focus?: \"selection\" | \"none\" | undefined;\n}\n\n/** The content of a flat stage that shows a picture of `@mark1russell7/layout-contract`. The value of a pick is the record. */\nexport interface LayoutPictureContent<T> extends PictureContent<PictureRecord, T> {\n /** This function shows a different picture, for example after a new layout. Start `refresh` of the stage after it. */\n setPicture(picture: LayoutPicture): void;\n /**\n * This function sets the records of the focus by their names. An empty list gives no focus.\n * `undefined` gives the focus of the options again. Start `refresh` of the stage after it.\n */\n setFocus(records: readonly string[] | undefined): void;\n}\n\nconst boxesOnly = (record: PictureRecord): boolean => record.type === \"box\";\n\n/**\n * This function makes the content of a flat stage from a picture: its boxes, its routes and its labels.\n *\n * - The looks give the colors, the lines and the signs of each record from its state.\n * - A person points at the top box below the pointer, or at a route that the option `picks` permits.\n * - A change of the focus changes the colors in a short time.\n * - The content makes shapes only for the records in view.\n *\n * The picture must be good (`checkPicture` of `@mark1russell7/layout-contract`). The content does not change it.\n */\nexport function createPictureContent<T>(picture: LayoutPicture, options: PictureContentOptions<T>): LayoutPictureContent<T> {\n const { looks } = options;\n const permits = options.picks ?? boxesOnly;\n const bySelection = (options.focus ?? \"selection\") === \"selection\";\n let index = indexPicture(picture);\n let bounds = pictureBounds(picture) ?? NO_BOUNDS;\n /** The records of `setFocus`, or `undefined` for the focus of the options. */\n let asked: readonly string[] | undefined;\n /** The names from which the focus of the last picture came. */\n let seeds: readonly string[] = NO_SEEDS;\n let focus: PictureFocus | undefined;\n /** This value is true until the first picture of a picture. The first focus has no change with time. */\n let fresh = true;\n /** The color share of each record whose share changes, by the key of the record. */\n const fades = new Map<string, { value: number; goal: number }>();\n /** The theme and the state of the last picture. A person cannot point at a record that the last picture did not show. */\n let last: { readonly theme: T; readonly state: PaintState } | undefined;\n /** The width of each text that the content measured, by its font and its text. */\n const widths = new Map<string, number>();\n\n const widthOf = (context: CanvasRenderingContext2D, font: string, text: string): number => {\n const key = `${font}\\n${text}`;\n const known = widths.get(key);\n if (known !== undefined) return known;\n const before = context.font;\n context.font = font;\n const width = context.measureText(text).width;\n context.font = before;\n if (widths.size >= MOST_WIDTHS) widths.clear();\n widths.set(key, width);\n return width;\n };\n\n /** This function gives the names from which the focus comes. */\n const seedsOf = (highlight: (record: string) => Highlight): readonly string[] => {\n if (asked !== undefined) return asked;\n if (!bySelection) return NO_SEEDS;\n const out: string[] = [];\n for (const id of index.boxes.keys()) if (highlight(id) === 2) out.push(id);\n for (const id of index.routes.keys()) if (!index.boxes.has(id) && highlight(id) === 2) out.push(id);\n return out;\n };\n\n /** This function starts the change of the color of each record whose focus level changes. A change that continues starts from its value. */\n const fadeTo = (next: PictureFocus | undefined): void => {\n const add = (key: string, from: number, goal: number): void => {\n const value = fades.get(key)?.value ?? from;\n if (value === goal) fades.delete(key);\n else fades.set(key, { value, goal });\n };\n for (const box of index.picture.boxes) add(recordKey(\"box\", box.id), FOCUS_OPACITY[boxFocus(focus, box)], FOCUS_OPACITY[boxFocus(next, box)]);\n for (const route of index.picture.routes) add(recordKey(\"route\", route.id), FOCUS_OPACITY[routeFocus(focus, route)], FOCUS_OPACITY[routeFocus(next, route)]);\n if (index.freeLabels.length > 0) add(FREE_LABELS, FOCUS_OPACITY[focus === undefined ? \"all\" : \"out\"], FOCUS_OPACITY[next === undefined ? \"all\" : \"out\"]);\n };\n\n return {\n get bounds(): Rect {\n return bounds;\n },\n has: (record) => index.boxes.has(record) || index.routes.has(record),\n pick(at) {\n const known = last;\n const state: PaintState | undefined = known === undefined ? undefined : { ...known.state, zoom: at.view.k };\n const shown = (record: PictureRecord): boolean => {\n if (!permits(record)) return false;\n if (known === undefined || state === undefined) return true;\n if (record.type === \"box\") return looks.box(record.box, boxState(index, record.box, state), known.theme) !== undefined;\n return looks.route(record.route, routeState(record.route, state), known.theme) !== undefined;\n };\n const record = pickRecord(index, at.point, { slack: at.slack / at.view.k, picks: shown });\n return record === undefined ? undefined : { record: record.id, value: record };\n },\n draw(context, frame, theme, highlight) {\n const { view } = frame;\n const from = seedsOf(highlight);\n if (fresh || from.length !== seeds.length || from.some((id, i) => id !== seeds[i])) {\n const next = from.length === 0 ? undefined : focusOf(index, from);\n if (fresh || frame.settle) fades.clear();\n else fadeTo(next);\n seeds = from;\n focus = next;\n fresh = false;\n }\n if (frame.settle) fades.clear();\n for (const [key, fade] of fades) {\n fade.value = approach(fade.value, fade.goal, frame.seconds, FOCUS_FADE);\n if (fade.value === fade.goal) fades.delete(key);\n }\n const state: PaintState = {\n zoom: view.k,\n highlight,\n focus,\n visible: { x: (0 - view.x) / view.k, y: (0 - view.y) / view.k, w: frame.width / view.k, h: frame.height / view.k },\n measure: (font, text) => widthOf(context, font, text),\n fade: fades.size === 0 ? undefined : (key, goal) => fades.get(key)?.value ?? goal,\n };\n last = { theme, state };\n drawShapes(context, paintPicture(index, looks, theme, state), view);\n return fades.size > 0;\n },\n setPicture(next) {\n index = indexPicture(next);\n bounds = pictureBounds(next) ?? NO_BOUNDS;\n fades.clear();\n fresh = true;\n last = undefined;\n },\n setFocus(records) {\n asked = records === undefined ? undefined : [...records];\n },\n dispose() {\n fades.clear();\n widths.clear();\n last = undefined;\n },\n };\n}\n","import { rectCenter, type Rect } from \"@mark1russell7/layout-contract\";\nimport { KEY_PART, KEY_ZOOM } from \"../keys.ts\";\nimport { panView, zoomView, type PictureView, type ZoomLimits } from \"./camera.ts\";\n\n/** What a key does on a flat picture: it moves the camera to a view, or it shows a view by its name. */\nexport type PictureKeyAction = { readonly type: \"move\"; readonly to: PictureView } | { readonly type: \"view\"; readonly view: string };\n\n/** The keys of a flat picture. */\nexport interface PictureKeyOptions {\n /** The name of the view of the keys `Home` and `0`. */\n readonly home: string;\n /** The name of the view of each other key, for example `{ f: \"focus\" }`. A letter has no case. */\n readonly views?: Readonly<Record<string, string>> | undefined;\n /** The limits of the zoom. The default is `ZOOM_LIMITS`. */\n readonly limits?: ZoomLimits | undefined;\n}\n\n/**\n * This function gives the action of a key on a flat picture, or `undefined` for a key with no action.\n *\n * `area` is the part of the screen that shows the picture. `freeArea` gives it.\n * An arrow key moves the camera by the part `KEY_PART` of the smaller side of the area.\n * The keys `+` and `-` zoom at the middle of the area, by the factor of one step of a key on a 3D stage.\n * The keys `Home` and `0` show the home view.\n */\nexport function pictureKeyAction(key: string, now: PictureView, area: Rect, options: PictureKeyOptions): PictureKeyAction | undefined {\n const step = Math.min(area.w, area.h) * KEY_PART;\n const middle = rectCenter(area);\n switch (key) {\n // The camera moves in the direction of the arrow, so the picture moves in the opposite direction.\n case \"ArrowLeft\":\n return { type: \"move\", to: panView(now, step, 0) };\n case \"ArrowRight\":\n return { type: \"move\", to: panView(now, 0 - step, 0) };\n case \"ArrowUp\":\n return { type: \"move\", to: panView(now, 0, step) };\n case \"ArrowDown\":\n return { type: \"move\", to: panView(now, 0, 0 - step) };\n case \"+\":\n case \"=\":\n return { type: \"move\", to: zoomView(now, middle, 1 / KEY_ZOOM, options.limits) };\n case \"-\":\n case \"_\":\n return { type: \"move\", to: zoomView(now, middle, KEY_ZOOM, options.limits) };\n case \"Home\":\n case \"0\":\n return { type: \"view\", view: options.home };\n default: {\n const view = key.length === 1 ? options.views?.[key.toLowerCase()] : undefined;\n return view === undefined ? undefined : { type: \"view\", view };\n }\n }\n}\n","import type { Point } from \"@mark1russell7/layout-contract\";\nimport { CLICK_DISTANCE, isClick } from \"../highlight.ts\";\nimport { panView, pinchView, ZOOM_LIMITS, type PictureView, type ZoomLimits } from \"./camera.ts\";\n\n/** The pointers that are down on a picture: a mouse button, a pen or each finger of a hand. */\nexport interface Pointers {\n /** The screen position of each pointer that is down, by the id of the pointer. */\n readonly at: ReadonlyMap<number, Point>;\n /** The position where the first pointer went down. */\n readonly start: Point | undefined;\n /** This value is true after a second pointer went down. The pointers then make no click. */\n readonly many: boolean;\n}\n\n/** The pointers of a picture that no pointer is down on. */\nexport const NO_POINTERS: Pointers = { at: new Map(), start: undefined, many: false };\n\n/** A finger moves more than a mouse between down and up. This is the distance of a click for a finger, in CSS pixels. */\nexport const TOUCH_CLICK_DISTANCE = 10;\n\n/** This function gives the pointers after a pointer went down. The first pointer starts a possible click. */\nexport function pointerDown(pointers: Pointers, id: number, at: Point): Pointers {\n const next = new Map(pointers.at).set(id, at);\n // A pointer that went up outside of the page can go down again with no up between.\n const first = next.size === 1;\n return first ? { at: next, start: at, many: false } : { at: next, start: pointers.start, many: true };\n}\n\n/** The result of `pointerMove`: the pointers and the view after the move. */\nexport interface PointerMoveResult {\n readonly pointers: Pointers;\n readonly view: PictureView;\n}\n\n/**\n * This function gives the pointers and the view after a pointer moved.\n *\n * One pointer moves the picture, so the point of the picture below the pointer stays there.\n * Two pointers make a pinch: `pinchView` gives the view. Three pointers or more do not change the view.\n * A pointer that is not down changes nothing.\n */\nexport function pointerMove(pointers: Pointers, id: number, at: Point, view: PictureView, limits: ZoomLimits = ZOOM_LIMITS): PointerMoveResult {\n const old = pointers.at.get(id);\n if (old === undefined) return { pointers, view };\n const next: Pointers = { ...pointers, at: new Map(pointers.at).set(id, at) };\n if (pointers.at.size === 1) return { pointers: next, view: panView(view, at.x - old.x, at.y - old.y) };\n if (pointers.at.size > 2) return { pointers: next, view };\n for (const [key, other] of pointers.at) {\n if (key !== id) return { pointers: next, view: pinchView(view, [old, other], [at, other], limits) };\n }\n return { pointers: next, view };\n}\n\n/** The result of `pointerUp`: the pointers that stay down, and the answer if the pointer made a click. */\nexport interface PointerUpResult {\n readonly pointers: Pointers;\n /** This value is true when one pointer went down and up at almost the same position. */\n readonly click: boolean;\n}\n\n/**\n * This function gives the pointers after a pointer went up, and tells if the pointer made a click.\n *\n * A click is one pointer that went up not more than `limit` from its start, with no second pointer between.\n * The default of `limit` is `CLICK_DISTANCE`. Use `TOUCH_CLICK_DISTANCE` for a finger.\n */\nexport function pointerUp(pointers: Pointers, id: number, at: Point, limit: number = CLICK_DISTANCE): PointerUpResult {\n if (!pointers.at.has(id)) return { pointers, click: false };\n const rest = new Map(pointers.at);\n rest.delete(id);\n if (rest.size > 0) return { pointers: { ...pointers, at: rest }, click: false };\n return { pointers: NO_POINTERS, click: !pointers.many && pointers.start !== undefined && isClick(pointers.start, at, limit) };\n}\n\n/** This function gives the pointers after the browser stopped a pointer, for example for a gesture of the system. It makes no click. */\nexport function pointerCancel(pointers: Pointers, id: number): Pointers {\n if (!pointers.at.has(id)) return pointers;\n const rest = new Map(pointers.at);\n rest.delete(id);\n return rest.size > 0 ? { ...pointers, at: rest } : NO_POINTERS;\n}\n","import type { PictureContent, PicturePick } from \"./stage.ts\";\n\n/**\n * This function makes one content from a list of contents, for a flat stage that shows them together.\n * An example is a layer of boxes below a layer of routes and a layer of labels.\n *\n * - The first content gives the bounds: the views and the limits of the camera come from it.\n * - The stack draws the contents in their sequence, so the last content is on top.\n * - A pick asks the last content first. The first record that a content gives is the record.\n * - A record that two contents have is one record: each of them gets its highlight.\n * - A content does not get the state of the canvas of an earlier content: the stack restores it.\n * - The stage disposes the stack, and the stack disposes each content.\n */\nexport function stackPictureContents<P, T>(contents: readonly [PictureContent<P, T>, ...PictureContent<P, T>[]]): PictureContent<P, T> {\n const [first] = contents;\n return {\n get bounds() {\n return first.bounds;\n },\n has: (record) => contents.some((content) => content.has(record)),\n pick(at): PicturePick<P> | undefined {\n for (let index = contents.length - 1; index >= 0; index -= 1) {\n const pick = contents[index]?.pick(at);\n if (pick !== undefined) return pick;\n }\n return undefined;\n },\n draw(context, frame, theme, highlight): boolean {\n let active = false;\n // Each content has its picture, also after a content that continues to change.\n for (const content of contents) {\n context.save();\n active = content.draw(context, frame, theme, highlight) || active;\n context.restore();\n }\n return active;\n },\n dispose(): void {\n for (const content of contents) content.dispose?.();\n },\n };\n}\n","import { rectCenter, type Point, type Rect } from \"@mark1russell7/layout-contract\";\nimport { CLICK_DISTANCE, highlightOf, NO_HIGHLIGHTS, type Highlight, type Highlights } from \"../highlight.ts\";\nimport { lessMotion, MOVE_TIME } from \"../motion.ts\";\nimport { aimAll, type AimFrame, type PictureAim } from \"./aim.ts\";\nimport {\n clampZoom,\n freeArea,\n keepRect,\n pictureMoveAt,\n sameView,\n toPicture,\n UNIT_VIEW,\n viewAt,\n wheelFactor,\n ZOOM_LIMITS,\n zoomLimitsFor,\n zoomView,\n type Insets,\n type PictureMove,\n type PictureView,\n type ZoomLimits,\n} from \"./camera.ts\";\nimport { pictureKeyAction } from \"./keys.ts\";\nimport { NO_POINTERS, pointerCancel, pointerDown, pointerMove, pointerUp, TOUCH_CLICK_DISTANCE, type Pointers } from \"./pointers.ts\";\n\n/** The record below the pointer of a flat picture: its name, and the value that the content gives for it. */\nexport interface PicturePick<P> {\n /** The name of the record. The highlights of the stage use this name. */\n readonly record: string;\n /** The value of the record for the page, for example its kind and its source. */\n readonly value: P;\n}\n\n/** The position of a pointer on a flat picture, for the pick of a content. */\nexport interface PickAt {\n /** The point of the picture below the pointer. */\n readonly point: Point;\n /** The position of the pointer on the screen, in CSS pixels from the top left corner of the picture. */\n readonly screen: Point;\n /** The view of the camera. */\n readonly view: PictureView;\n /** The distance from the pointer at which a thin part is below the pointer, in CSS pixels. A finger has a larger distance than a mouse. */\n readonly slack: number;\n}\n\n/** One picture of a flat stage, for the drawing of its content. */\nexport interface PictureFrame {\n /** The view of the camera. */\n readonly view: PictureView;\n /** The width of the picture, in CSS pixels. */\n readonly width: number;\n /** The height of the picture, in CSS pixels. */\n readonly height: number;\n /** The part of the picture that the page does not cover, in CSS pixels. */\n readonly area: Rect;\n /** The number of pixels of the canvas for one CSS pixel. */\n readonly pixelRatio: number;\n /** The time since the last picture, in seconds. */\n readonly seconds: number;\n /**\n * This value is true for the first picture of a content, and for a person who asks for less motion.\n * Each change then has no time: the content sets each value to its goal immediately.\n */\n readonly settle: boolean;\n}\n\n/**\n * The content of a flat stage: what the stage draws, and what the stage asks of it.\n * `P` is the type of the value of a pick, and `T` is the type of the theme.\n */\nexport interface PictureContent<P, T> {\n /** The bounds of the content, in the unit of the picture. The views and the limits of the camera come from them. */\n readonly bounds: Rect;\n /** This function tells if the content has a record with a name. */\n has(record: string): boolean;\n /** This function gives the record below a pointer, or `undefined` for no record. */\n pick(at: PickAt): PicturePick<P> | undefined;\n /**\n * This function draws the content on a clear canvas. The unit of the context is the CSS pixel: the view is in the frame.\n * `highlight` gives the highlight of a record. The function gives true while a part continues to change.\n * The stage then makes the next picture.\n */\n draw(context: CanvasRenderingContext2D, frame: PictureFrame, theme: T, highlight: (record: string) => Highlight): boolean;\n /** This function releases what the content keeps, for example its images. */\n dispose?(): void;\n}\n\n/** The options of a flat stage. */\nexport interface PictureStageOptions<P, T> {\n /** The first content. The stage disposes each content that it gets. */\n readonly content: PictureContent<P, T>;\n readonly theme: T;\n /** The name of the picture for a screen reader. */\n readonly label: string;\n /** The views of the stage, each with a name. The view `all` shows all of the picture, if the options do not give a different one. */\n readonly views?: Readonly<Record<string, PictureAim>> | undefined;\n /** The name of the first view. The keys `Home` and `0` show it. The default is `all`. */\n readonly home?: string | undefined;\n /** The name of the view of a key, for example `{ f: \"focus\" }`. A letter has no case. */\n readonly keys?: Readonly<Record<string, string>> | undefined;\n /** The limits of the zoom. The default is `ZOOM_LIMITS`. A very large picture gets a smaller least zoom, so a person can show all of it. */\n readonly limits?: ZoomLimits | undefined;\n /** The parts of the picture that the page covers, from each edge, in CSS pixels. */\n readonly insets?: Partial<Insets> | undefined;\n /**\n * When the wheel changes the zoom. With `in-use`, the wheel moves the page until a person uses the picture.\n * With `always`, the wheel changes the zoom at each time. The default is `in-use`. A pinch on a touch pad changes the zoom always.\n */\n readonly wheel?: \"always\" | \"in-use\" | undefined;\n /** The stage starts this function when the pointer goes to a different record, or to no record. */\n readonly onHover?: ((pick: P | undefined) => void) | undefined;\n /** The stage starts this function when a person selects a record with the pointer, or selects no record. */\n readonly onSelect?: ((pick: P | undefined) => void) | undefined;\n /** The stage starts this function after a change of the view, one time for each picture at most. */\n readonly onView?: ((view: PictureView) => void) | undefined;\n}\n\n/** A flat stage in a page: one canvas with a camera that a person moves, and one content. */\nexport interface PictureStage<P, T> {\n /** The canvas of the stage. It is in the container. */\n readonly canvas: HTMLCanvasElement;\n /** This function shows a different content, and disposes the old content. The view stays if a person moved it. */\n setContent(content: PictureContent<P, T>): void;\n /** This function changes the colors. */\n setTheme(theme: T): void;\n /** This function moves the camera to a view: a name of the options, or an aim. `animate` has the default true. */\n setView(view: string | PictureAim, animate?: boolean): void;\n /** This function tells the stage which parts of the picture the page covers. The camera goes to its view again if no person moved it. */\n setInsets(insets: Partial<Insets>): void;\n /** This function gives the view of the camera. */\n view(): PictureView;\n /** This function gives the part of the picture that the page does not cover, in CSS pixels. */\n area(): Rect;\n /** This function changes the zoom by a factor, at the middle of the free area. Use it for the buttons of a page. `animate` has the default true. */\n zoomBy(factor: number, animate?: boolean): void;\n /** This function highlights records by their names, as the pointer does. An empty list removes the highlights. */\n highlight(records: readonly string[]): void;\n /** This function selects one record by its name, or no record. It does not start `onSelect`. */\n select(record: string | undefined): void;\n /**\n * This function makes a new picture. Use it after a change of the content.\n * After a change of the bounds of the content, the camera goes to its view again if no person moved it.\n */\n refresh(): void;\n /** This function removes the canvas, and disposes the content. */\n dispose(): void;\n}\n\n/** The distance from a mouse at which a thin part is below the pointer, in CSS pixels. */\nexport const PICK_SLACK = 5;\n\n/** The distance from a finger or a pen at which a thin part is below the pointer, in CSS pixels. */\nexport const TOUCH_PICK_SLACK = 12;\n\n/** The factor of the zoom for a double click. */\nexport const DOUBLE_CLICK_ZOOM = 2;\n\n/** The largest number of pixels of the canvas for one CSS pixel. A larger number costs memory, and a person does not see it. */\nconst LARGEST_PIXEL_RATIO = 3;\n\n/**\n * This function makes a flat stage in a container of a page. The stage fills the container, so give the container a size.\n *\n * A person moves the picture with a drag, and changes the zoom with the wheel, with two fingers or with a double click.\n * A click selects the record below the pointer. With the keyboard, the arrow keys move the camera, `+` and `-` change the zoom,\n * and `Home` shows the first view. The stage makes a picture only after a change.\n *\n * The function gives `undefined` when the browser gives no 2D context for a canvas. It does not throw.\n */\nexport function createPictureStage<P, T>(container: HTMLElement, options: PictureStageOptions<P, T>): PictureStage<P, T> | undefined {\n const canvas = container.ownerDocument.createElement(\"canvas\");\n const made = canvas.getContext(\"2d\");\n if (made === null) return undefined;\n // The functions below use this constant: its type has no `null`.\n const context: CanvasRenderingContext2D = made;\n\n canvas.style.display = \"block\";\n canvas.style.width = \"100%\";\n canvas.style.height = \"100%\";\n canvas.style.cursor = \"grab\";\n canvas.style.touchAction = \"none\";\n canvas.tabIndex = 0;\n canvas.setAttribute(\"role\", \"application\");\n canvas.setAttribute(\"aria-label\", options.label);\n container.append(canvas);\n\n const views: Readonly<Record<string, PictureAim>> = { all: aimAll(), ...options.views };\n const home = options.home ?? \"all\";\n const baseLimits = options.limits ?? ZOOM_LIMITS;\n const wheel = options.wheel ?? \"in-use\";\n\n let content = options.content;\n let theme = options.theme;\n let insets: Partial<Insets> = options.insets ?? {};\n let highlights: Highlights = NO_HIGHLIGHTS;\n /** The size of the picture, in CSS pixels. */\n let width = 0;\n let height = 0;\n let pixelRatio = 1;\n /** This value is true after the container gave a size. A stage with no size makes no picture. */\n let sized = false;\n let area: Rect = freeArea({ width, height }, insets);\n let limits: ZoomLimits = baseLimits;\n let view: PictureView = UNIT_VIEW;\n /** The view that the camera has, or goes to: a name of the views, or an aim. */\n let aim: string | PictureAim = home;\n let move: PictureMove | undefined;\n /** This value is true after a person moved the view. Then a new size of the container does not aim the camera again. */\n let moved = false;\n /** This value is true until the content had a picture with no time. */\n let settle = true;\n /** This value is true while a person uses the picture. The wheel then changes the zoom. */\n let inUse = false;\n let pointers: Pointers = NO_POINTERS;\n /** This value is true while a pointer that is down moves the picture. */\n let dragging = false;\n /** The view that `onView` got last. */\n let told: PictureView | undefined;\n let frame = 0;\n let lastTime = 0;\n let disposed = false;\n\n const invalidate = (): void => {\n if (frame === 0 && !disposed) frame = requestAnimationFrame(tick);\n };\n\n const setCursor = (): void => {\n canvas.style.cursor = dragging ? \"grabbing\" : highlights.hovered === undefined ? \"grab\" : \"pointer\";\n };\n\n /** The bounds of the content at the last `setArea`. `refresh` finds a change of the bounds with them. */\n let fitted: Rect = content.bounds;\n\n /** This function sets the free area and the limits of the zoom, from the size, the insets and the content. */\n const setArea = (): void => {\n area = freeArea({ width, height }, insets);\n fitted = content.bounds;\n limits = zoomLimitsFor(fitted, area, baseLimits);\n };\n\n const aimFrame = (): AimFrame => ({ bounds: content.bounds, area, view, limits });\n\n /** This function moves the camera to a view, with a move or immediately. A picture with no size has no move. */\n const glide = (to: PictureView, animate: boolean): void => {\n if (animate && sized && !lessMotion() && !sameView(view, to)) {\n move = { from: view, to, start: performance.now(), duration: MOVE_TIME };\n } else {\n move = undefined;\n view = to;\n }\n invalidate();\n };\n\n const goTo = (next: string | PictureAim, animate: boolean): void => {\n const found = typeof next === \"string\" ? views[next] : next;\n if (found === undefined) return;\n aim = next;\n moved = false;\n glide(found(aimFrame()), animate);\n };\n\n /**\n * This function sets a view that a person made, immediately. The zoom stays in its limits, and a part of the picture stays in the free area.\n * A zoom that the limits change keeps the point of the picture at the middle of the free area.\n */\n const hold = (base: PictureView): void => {\n const k = clampZoom(base.k, limits);\n const middle = rectCenter(area);\n move = undefined;\n view = keepRect(k === base.k ? base : viewAt(toPicture(base, middle), middle, k), content.bounds, area);\n invalidate();\n };\n\n /** This function sets a view that a person made with a pointer, the wheel or a key. */\n const steer = (next: PictureView): void => {\n moved = true;\n hold(next);\n };\n\n /**\n * This function sets the size of the canvas from the size of the container and the pixels of the screen.\n * It gives true after a change. A container with no size changes nothing.\n */\n const setSize = (): boolean => {\n const wide = container.clientWidth;\n const tall = container.clientHeight;\n if (wide === 0 || tall === 0) return false;\n const ratio = Math.min(globalThis.devicePixelRatio > 0 ? globalThis.devicePixelRatio : 1, LARGEST_PIXEL_RATIO);\n if (wide === width && tall === height && ratio === pixelRatio) return false;\n width = wide;\n height = tall;\n pixelRatio = ratio;\n canvas.width = Math.round(wide * ratio);\n canvas.height = Math.round(tall * ratio);\n return true;\n };\n\n /** This function sets the camera after a change of the size of the picture. */\n const fitAgain = (): void => {\n const before = area;\n const first = !sized;\n sized = true;\n setArea();\n if (first || !moved) {\n goTo(aim, false);\n return;\n }\n // A person moved the view: the point of the picture at the middle of the free area stays at the middle.\n const base = move?.to ?? view;\n hold(viewAt(toPicture(base, rectCenter(before)), rectCenter(area), base.k));\n };\n\n function tick(now: number): void {\n frame = 0;\n if (disposed) return;\n // The pixels of the screen change with no event when a window goes to a different screen.\n if (setSize()) fitAgain();\n if (!sized) return;\n const seconds = lastTime === 0 ? 1 / 60 : Math.min((now - lastTime) / 1000, 0.1);\n let active = false;\n if (move !== undefined) {\n const step = pictureMoveAt(move, now);\n view = step.view;\n if (step.done) move = undefined;\n active = !step.done;\n }\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.clearRect(0, 0, canvas.width, canvas.height);\n context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n const shown = highlights;\n const drawing = content.draw(context, { view, width, height, area, pixelRatio, seconds, settle: settle || lessMotion() }, theme, (record) => highlightOf(shown, record));\n settle = false;\n active = drawing || active;\n lastTime = active ? now : 0;\n if (told === undefined || !sameView(told, view)) {\n told = view;\n options.onView?.(view);\n }\n if (active) invalidate();\n }\n\n /** This function gives the position of a pointer in the picture, in CSS pixels from its top left corner. */\n const positionOf = (event: { readonly clientX: number; readonly clientY: number }): Point => {\n const box = canvas.getBoundingClientRect();\n return { x: event.clientX - box.left, y: event.clientY - box.top };\n };\n\n const pickAt = (screen: Point, slack: number): PicturePick<P> | undefined => content.pick({ point: toPicture(view, screen), screen, view, slack });\n\n const setHover = (pick: PicturePick<P> | undefined): void => {\n const record = pick?.record;\n if (record === highlights.hovered) return;\n highlights = { ...highlights, hovered: record };\n setCursor();\n invalidate();\n options.onHover?.(pick?.value);\n };\n\n const listeners = new AbortController();\n const signal = listeners.signal;\n canvas.addEventListener(\n \"pointerdown\",\n (event) => {\n if (event.button !== 0) return;\n inUse = true;\n canvas.focus({ preventScroll: true });\n try {\n // With the capture, a drag continues when the pointer goes out of the canvas.\n canvas.setPointerCapture(event.pointerId);\n } catch {\n // A pointer that the browser does not know has no capture. The drag then ends at the edge of the canvas.\n }\n if (move !== undefined) {\n // A pointer stops a move, as a hand stops a thing that moves.\n move = undefined;\n moved = true;\n }\n pointers = pointerDown(pointers, event.pointerId, positionOf(event));\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointermove\",\n (event) => {\n if (pointers.at.has(event.pointerId)) {\n const next = pointerMove(pointers, event.pointerId, positionOf(event), view, limits);\n pointers = next.pointers;\n if (sameView(next.view, view)) return;\n dragging = true;\n setCursor();\n steer(next.view);\n return;\n }\n // A finger is on the picture only while it is down, so it has no record below it before a click.\n if (event.pointerType !== \"touch\" && pointers.at.size === 0) setHover(pickAt(positionOf(event), PICK_SLACK));\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointerup\",\n (event) => {\n if (!pointers.at.has(event.pointerId)) return;\n const mouse = event.pointerType === \"mouse\";\n const position = positionOf(event);\n const up = pointerUp(pointers, event.pointerId, position, mouse ? CLICK_DISTANCE : TOUCH_CLICK_DISTANCE);\n pointers = up.pointers;\n if (pointers.at.size === 0) {\n dragging = false;\n setCursor();\n }\n if (!up.click) return;\n const pick = pickAt(position, mouse ? PICK_SLACK : TOUCH_PICK_SLACK);\n highlights = { ...highlights, selected: pick?.record };\n invalidate();\n options.onSelect?.(pick?.value);\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointercancel\",\n (event) => {\n pointers = pointerCancel(pointers, event.pointerId);\n if (pointers.at.size > 0) return;\n dragging = false;\n setCursor();\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointerleave\",\n (event) => {\n setHover(undefined);\n if (event.pointerType === \"mouse\") inUse = false;\n },\n { signal },\n );\n canvas.addEventListener(\n \"blur\",\n () => {\n inUse = false;\n },\n { signal },\n );\n canvas.addEventListener(\n \"wheel\",\n (event) => {\n // A browser gives a pinch on a touch pad as a wheel with the key `Control`. Without the stage, it changes the zoom of the page.\n if (wheel === \"in-use\" && !inUse && !event.ctrlKey) return;\n event.preventDefault();\n steer(zoomView(view, positionOf(event), wheelFactor(event.deltaY, event.deltaMode, event.ctrlKey), limits));\n },\n { signal, passive: false },\n );\n canvas.addEventListener(\n \"dblclick\",\n (event) => {\n event.preventDefault();\n moved = true;\n glide(keepRect(zoomView(view, positionOf(event), DOUBLE_CLICK_ZOOM, limits), content.bounds, area), true);\n },\n { signal },\n );\n canvas.addEventListener(\n \"keydown\",\n (event) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const action = pictureKeyAction(event.key, view, area, { home, views: options.keys, limits });\n if (action === undefined) return;\n event.preventDefault();\n inUse = true;\n if (action.type === \"view\") goTo(action.view, true);\n else steer(action.to);\n },\n { signal },\n );\n\n const observer = new ResizeObserver(() => {\n if (!disposed && setSize()) fitAgain();\n });\n\n if (setSize()) fitAgain();\n observer.observe(container);\n invalidate();\n\n return {\n canvas,\n setContent(next: PictureContent<P, T>): void {\n if (disposed || next === content) return;\n content.dispose?.();\n content = next;\n const selected = highlights.selected !== undefined && content.has(highlights.selected) ? highlights.selected : undefined;\n highlights = { ...highlights, hovered: undefined, selected };\n settle = true;\n setCursor();\n setArea();\n if (moved) hold(move?.to ?? view);\n else goTo(aim, false);\n },\n setTheme(next: T): void {\n theme = next;\n invalidate();\n },\n setView(next: string | PictureAim, animate: boolean = true): void {\n goTo(next, animate);\n },\n setInsets(next: Partial<Insets>): void {\n insets = next;\n setArea();\n if (!sized) return;\n if (moved) hold(move?.to ?? view);\n else goTo(aim, true);\n },\n view: () => view,\n area: () => area,\n zoomBy(factor: number, animate: boolean = true): void {\n moved = true;\n // A second step of a button starts from the goal of the first step, so each step has its full factor.\n glide(keepRect(zoomView(move?.to ?? view, rectCenter(area), factor, limits), content.bounds, area), animate);\n },\n highlight(records: readonly string[]): void {\n highlights = { ...highlights, highlighted: new Set(records) };\n invalidate();\n },\n select(record: string | undefined): void {\n highlights = { ...highlights, selected: record };\n invalidate();\n },\n refresh(): void {\n if (disposed) return;\n // The record below the pointer can go with a change of the content.\n if (highlights.hovered !== undefined && !content.has(highlights.hovered)) setHover(undefined);\n const bounds = content.bounds;\n if (bounds.x !== fitted.x || bounds.y !== fitted.y || bounds.w !== fitted.w || bounds.h !== fitted.h) {\n setArea();\n if (sized) {\n if (moved) hold(move?.to ?? view);\n else goTo(aim, true);\n }\n }\n invalidate();\n },\n dispose(): void {\n if (disposed) return;\n disposed = true;\n cancelAnimationFrame(frame);\n observer.disconnect();\n listeners.abort();\n content.dispose?.();\n canvas.remove();\n },\n };\n}\n"],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ACtB,QAAQ;GACR,WAAW;EACb;EACA,QAAQ,MAA2B,UAAmB,MAAY;GAChE,KAAK,MAAM,OAAO;EACpB;EACA,UAAU,MAA6B;GACrC,SAAS;GACT,QAAQ;GACR,IAAI,CAAC,OAAO;GACZ,IAAI,OAAO,KAAK,MAAM,MAAM,IAAI;QAC3B,KAAK,KAAK,IAAI;EACrB;EACA,YAAY;EACZ,YAAY;EACZ,OAAO,QAAgB,UAAmB,MAAY;GACpD,QAAQ;GAER,MAAM,SAAS,SAAS,MAAM,MAAM,MAAM,WAAW,IAAI,GAAG,QAAQ,MAAM,GAAG,QAAQ,QAAQ,IAAI,GAAG,OAAO;EAC7G;EACA,UAAU,SAAkC;GAC1C,aAAa;IAAE,GAAG;IAAY,aAAa,IAAI,IAAI,OAAO;GAAE;GAC5D,WAAW;EACb;EACA,OAAO,QAAkC;GACvC,aAAa;IAAE,GAAG;IAAY,UAAU;GAAO;GAC/C,WAAW;EACb;EACA,UAAgB;GACd,IAAI,UAAU;GAEd,IAAI,WAAW,YAAY,KAAA,KAAa,CAAC,QAAQ,IAAI,WAAW,OAAO,GAAG,SAAS,KAAA,CAAS;GAC5F,MAAM,SAAS,QAAQ;GACvB,IAAI,OAAO,MAAM,OAAO,KAAK,OAAO,MAAM,OAAO,KAAK,OAAO,MAAM,OAAO,KAAK,OAAO,MAAM,OAAO,GAAG;IACpG,QAAQ;IACR,IAAI,OAAO;KACT,IAAI,OAAO,KAAK,MAAM,MAAM,IAAI;UAC3B,KAAK,KAAK,IAAI;IACrB;GACF;GACA,WAAW;EACb;EACA,UAAgB;GACd,IAAI,UAAU;GACd,WAAW;GACX,qBAAqB,KAAK;GAC1B,SAAS,WAAW;GACpB,UAAU,MAAM;GAChB,QAAQ,UAAU;GAClB,OAAO,OAAO;EAChB;CACF;AACF"}
1
+ {"version":3,"file":"graph.js","names":["boxesOnly"],"sources":["../src/graph/camera.ts","../src/graph/aim.ts","../src/graph/draw.ts","../src/graph/focus.ts","../src/graph/records.ts","../src/graph/hit.ts","../src/graph/looks.ts","../src/graph/paint.ts","../src/graph/content.ts","../src/graph/keys.ts","../src/graph/pointers.ts","../src/graph/stack.ts","../src/graph/stage.ts"],"sourcesContent":["import { rectCenter, type Point, type Rect } from \"@mark1russell7/layout-contract\";\nimport { easeInOut, partAt } from \"../motion.ts\";\n\n/**\n * The camera of a flat picture: a zoom and the position of the origin.\n * A point `p` of the picture shows at the screen point `p * k + (x, y)`. Each screen length is in CSS pixels.\n */\nexport interface PictureView {\n /** The screen position of the origin of the picture, from the left edge. */\n readonly x: number;\n /** The screen position of the origin of the picture, from the top edge. */\n readonly y: number;\n /** The zoom: the screen length of one unit of the picture. */\n readonly k: number;\n}\n\n/** The limits of the zoom of a camera. */\nexport interface ZoomLimits {\n readonly min: number;\n readonly max: number;\n}\n\n/** The default limits of the zoom. */\nexport const ZOOM_LIMITS: ZoomLimits = { min: 0.05, max: 8 };\n\n/** The view that shows each point of the picture at its own position. */\nexport const UNIT_VIEW: PictureView = { x: 0, y: 0, k: 1 };\n\n/** This function gives a zoom in its limits. A zoom that is not a number gives the smallest zoom. */\nexport function clampZoom(k: number, limits: ZoomLimits = ZOOM_LIMITS): number {\n return k >= limits.min ? Math.min(k, limits.max) : limits.min;\n}\n\n/** This function gives the point of the picture that shows at a screen point. */\nexport function toPicture(view: PictureView, screen: Point): Point {\n return { x: (screen.x - view.x) / view.k, y: (screen.y - view.y) / view.k };\n}\n\n/** This function gives the screen point that shows a point of the picture. */\nexport function toScreen(view: PictureView, point: Point): Point {\n return { x: point.x * view.k + view.x, y: point.y * view.k + view.y };\n}\n\n/** This function gives the screen rectangle that shows a rectangle of the picture. */\nexport function rectToScreen(view: PictureView, rect: Rect): Rect {\n return { x: rect.x * view.k + view.x, y: rect.y * view.k + view.y, w: rect.w * view.k, h: rect.h * view.k };\n}\n\n/** This function gives the view with the zoom `k` that shows the point `point` of the picture at the screen point `at`. */\nexport function viewAt(point: Point, at: Point, k: number): PictureView {\n return { x: at.x - point.x * k, y: at.y - point.y * k, k };\n}\n\n/** This function gives the view after a move of the picture by a screen distance. */\nexport function panView(view: PictureView, dx: number, dy: number): PictureView {\n return { x: view.x + dx, y: view.y + dy, k: view.k };\n}\n\n/**\n * This function gives the view after a zoom by `factor`. The zoom stays in its limits.\n * The screen point `at` shows the same point of the picture before and after the zoom.\n */\nexport function zoomView(view: PictureView, at: Point, factor: number, limits: ZoomLimits = ZOOM_LIMITS): PictureView {\n const k = clampZoom(view.k * factor, limits);\n const ratio = k / view.k;\n return { x: at.x - (at.x - view.x) * ratio, y: at.y - (at.y - view.y) * ratio, k };\n}\n\n/** The positions of the two pointers of a pinch, in CSS pixels. */\nexport type PointerPair = readonly [Point, Point];\n\n/**\n * This function gives the view after the two pointers of a pinch move from `before` to `after`.\n *\n * The zoom changes by the ratio of the two distances between the pointers.\n * The point of the picture at the middle of the pointers stays at their middle.\n * Thus each pointer keeps its point of the picture, if the pointers do not turn and the zoom is in its limits.\n */\nexport function pinchView(view: PictureView, before: PointerPair, after: PointerPair, limits: ZoomLimits = ZOOM_LIMITS): PictureView {\n const from = { x: (before[0].x + before[1].x) / 2, y: (before[0].y + before[1].y) / 2 };\n const to = { x: (after[0].x + after[1].x) / 2, y: (after[0].y + after[1].y) / 2 };\n const was = Math.hypot(before[0].x - before[1].x, before[0].y - before[1].y);\n const is = Math.hypot(after[0].x - after[1].x, after[0].y - after[1].y);\n // Two pointers at one position give no ratio. The picture then only moves.\n const factor = was > 0 && is > 0 ? is / was : 1;\n return zoomView(panView(view, to.x - from.x, to.y - from.y), to, factor, limits);\n}\n\n/** The speed of the zoom of a wheel: the change of the natural logarithm of the zoom for one CSS pixel of the wheel. */\nexport const WHEEL_SPEED = 0.0015;\n\n/** The height of one line of a wheel that gives its turn in lines, in CSS pixels. */\nexport const WHEEL_LINE = 16;\n\n/** The factor of the speed of the wheel for a pinch on a touch pad. A browser gives such a pinch as a wheel with the key `Control`. */\nexport const WHEEL_PINCH = 10;\n\n/**\n * This function gives the factor of the zoom for one event of a wheel. A turn away from the person makes the picture larger.\n *\n * `deltaY` and `deltaMode` are the fields of the event. A mode of 1 has its turn in lines.\n * `pinch` is the field `ctrlKey` of the event: a pinch on a touch pad has small turns, so its speed is higher.\n */\nexport function wheelFactor(deltaY: number, deltaMode: number = 0, pinch: boolean = false): number {\n const pixels = deltaMode === 1 ? deltaY * WHEEL_LINE : deltaY;\n return Math.exp(0 - pixels * WHEEL_SPEED * (pinch ? WHEEL_PINCH : 1));\n}\n\n/** The parts of a picture that a page covers, from each edge, in CSS pixels. */\nexport interface Insets {\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly left: number;\n}\n\n/** The smallest width and height of a free area, in CSS pixels. */\nexport const SMALLEST_AREA = 80;\n\n/**\n * This function gives the free area of a picture: the screen rectangle that the page does not cover.\n * A camera shows a selection in this area, so a panel of the page does not hide it.\n * The width and the height of the area are `SMALLEST_AREA` at least.\n */\nexport function freeArea(size: { readonly width: number; readonly height: number }, insets: Partial<Insets> = {}): Rect {\n const left = insets.left ?? 0;\n const top = insets.top ?? 0;\n return {\n x: left,\n y: top,\n w: Math.max(SMALLEST_AREA, size.width - left - (insets.right ?? 0)),\n h: Math.max(SMALLEST_AREA, size.height - top - (insets.bottom ?? 0)),\n };\n}\n\n/** The default distance between a rectangle that a camera shows and each edge of the area, in CSS pixels. */\nexport const FIT_PADDING = 24;\n\n/** The options of `fitRect`. */\nexport interface FitOptions {\n /** The distance between the rectangle and each edge of the area, in CSS pixels. The default is `FIT_PADDING`. */\n readonly padding?: number | undefined;\n /** The largest zoom of the result. The default is the largest zoom of the limits. */\n readonly most?: number | undefined;\n /** The limits of the zoom. The default is `ZOOM_LIMITS`. */\n readonly limits?: ZoomLimits | undefined;\n}\n\n/** This function gives the zoom at which a rectangle of the picture fills an area of the screen, with a padding at each edge. */\nfunction fillZoom(rect: Rect, area: Rect, padding: number): number {\n const width = Math.max(area.w - 2 * padding, 1);\n const height = Math.max(area.h - 2 * padding, 1);\n return Math.min(width / Math.max(rect.w, 0), height / Math.max(rect.h, 0));\n}\n\n/**\n * This function gives the view that shows a rectangle of the picture in an area of the screen, as large as the area permits.\n * The middle of the rectangle is at the middle of the area. A rectangle with no size gets the largest zoom.\n */\nexport function fitRect(rect: Rect, area: Rect, options: FitOptions = {}): PictureView {\n const limits = options.limits ?? ZOOM_LIMITS;\n const k = clampZoom(Math.min(options.most ?? limits.max, fillZoom(rect, area, options.padding ?? FIT_PADDING)), limits);\n return viewAt(rectCenter(rect), rectCenter(area), k);\n}\n\n/**\n * This function gives the limits of the zoom for a picture with the bounds `bounds`.\n *\n * The smallest zoom of the result shows all of the picture in the area, with a padding at each edge.\n * A picture that fits at the smallest zoom of `limits` keeps `limits`. Thus a person can show all of a very large picture.\n */\nexport function zoomLimitsFor(bounds: Rect, area: Rect, limits: ZoomLimits = ZOOM_LIMITS, padding: number = FIT_PADDING): ZoomLimits {\n const all = fillZoom(bounds, area, padding);\n return all > 0 && all < limits.min ? { min: all, max: limits.max } : limits;\n}\n\n/** The length of a picture that stays in the free area when a person moves the picture, in CSS pixels. */\nexport const KEEP_IN_VIEW = 64;\n\n/** This function gives the start of a span of the screen that keeps the length `least` in an area, on one axis. */\nfunction keepSpan(start: number, length: number, areaStart: number, areaLength: number, least: number): number {\n const keep = Math.min(Math.max(least, 0), length, areaLength);\n return Math.min(Math.max(start, areaStart + keep - length), areaStart + areaLength - keep);\n}\n\n/**\n * This function gives the view that keeps a part of a rectangle of the picture in an area of the screen.\n * A person who moves the picture then cannot lose it.\n *\n * `least` is the length of the rectangle that stays in the area on each axis, in CSS pixels.\n * A rectangle that is smaller on the screen stays in the area fully. The zoom does not change.\n * The result is `view` itself when the view keeps the rectangle.\n */\nexport function keepRect(view: PictureView, rect: Rect, area: Rect, least: number = KEEP_IN_VIEW): PictureView {\n const shown = rectToScreen(view, rect);\n const x = keepSpan(shown.x, shown.w, area.x, area.w, least);\n const y = keepSpan(shown.y, shown.h, area.y, area.h, least);\n return x === shown.x && y === shown.y ? view : { x: view.x + x - shown.x, y: view.y + y - shown.y, k: view.k };\n}\n\n/** This function tells if two views are equal. */\nexport function sameView(a: PictureView, b: PictureView): boolean {\n return a.x === b.x && a.y === b.y && a.k === b.k;\n}\n\n/** The options of `frameRects`. */\nexport interface FrameOptions extends FitOptions {\n /** The smallest zoom at which a person reads the content of a rectangle. */\n readonly least: number;\n}\n\n/**\n * This function gives the view for the first rectangle of a list that an area of the screen shows at the zoom `least` or more.\n *\n * Give the bounds of the largest group of boxes first, then the bounds of smaller groups.\n * If no rectangle is small enough, the result has the zoom `least` and the middle of the last rectangle at the middle of the area.\n * An empty list gives `undefined`.\n */\nexport function frameRects(rects: readonly Rect[], area: Rect, options: FrameOptions): PictureView | undefined {\n for (const rect of rects) {\n const view = fitRect(rect, area, options);\n if (view.k >= options.least) return view;\n }\n const last = rects.at(-1);\n if (last === undefined) return undefined;\n return viewAt(rectCenter(last), rectCenter(area), clampZoom(options.least, options.limits));\n}\n\n/**\n * This function tells if a view shows all of a rectangle of the picture in an area of the screen.\n * `margin` is the smallest distance between the rectangle and each edge of the area, in CSS pixels.\n */\nexport function showsRect(view: PictureView, rect: Rect, area: Rect, margin: number = 0): boolean {\n const shown = rectToScreen(view, rect);\n return shown.x >= area.x + margin && shown.y >= area.y + margin && shown.x + shown.w <= area.x + area.w - margin && shown.y + shown.h <= area.y + area.h - margin;\n}\n\n/** The options of `revealRects`. */\nexport interface RevealOptions extends FrameOptions {\n /** The smallest distance between a rectangle in view and each edge of the area, in CSS pixels. The default is 0. */\n readonly margin?: number | undefined;\n}\n\n/**\n * This function gives the view that shows a selection, and it keeps the view `view` when the selection is in view.\n *\n * The rectangles are the bounds of the groups of the selection, as for `frameRects`, the largest group first.\n * The selection is in view when `view` has the zoom `least` or more, and shows all of the rectangle that `frameRects` selects.\n * The result is then `view` itself, so a camera does not move for a click on a box that a person reads.\n * In each other case, the result is the view of `frameRects`. An empty list gives `view`.\n */\nexport function revealRects(view: PictureView, rects: readonly Rect[], area: Rect, options: RevealOptions): PictureView {\n for (const rect of rects) {\n const framed = fitRect(rect, area, options);\n if (framed.k < options.least) continue;\n return view.k >= options.least && showsRect(view, rect, area, options.margin ?? 0) ? view : framed;\n }\n return frameRects(rects.slice(-1), area, options) ?? view;\n}\n\n/**\n * This function gives the view at a part of the way between two views. `part` goes from 0 to 1.\n *\n * The zoom changes by an equal factor for each equal step, so a zoom has one speed in the picture.\n * The way is a zoom at one screen point: the point of the picture that the two views show there stays there.\n * Thus each point of the picture moves along a straight line of the screen, in one direction.\n * Two views with one zoom give a straight move at one speed.\n */\nexport function viewBetween(from: PictureView, to: PictureView, part: number): PictureView {\n if (!(part > 0)) return from;\n if (part >= 1) return to;\n const log = Math.log(to.k / from.k);\n if (!Number.isFinite(log)) return to;\n // The origin moves in proportion to the change of the zoom. The function expm1 keeps the precision for two zooms that are almost equal.\n const share = log === 0 ? part : Math.expm1(log * part) / Math.expm1(log);\n return { x: from.x + (to.x - from.x) * share, y: from.y + (to.y - from.y) * share, k: from.k * Math.exp(log * part) };\n}\n\n/** A move of the camera of a flat picture from one view to a different view. */\nexport interface PictureMove {\n readonly from: PictureView;\n readonly to: PictureView;\n /** The time of the start of the move, in milliseconds. */\n readonly start: number;\n /** The time that the move takes, in milliseconds. */\n readonly duration: number;\n}\n\n/** The view of a camera at one time of a move. */\nexport interface PictureMoveStep {\n readonly view: PictureView;\n /** This value is true at the end of the move, and after it. */\n readonly done: boolean;\n}\n\n/**\n * This function gives the view of a camera at the time `now` of a move, in milliseconds.\n * The move has a slow start and a slow end. A move with no duration is at its end immediately.\n */\nexport function pictureMoveAt(move: PictureMove, now: number): PictureMoveStep {\n const part = partAt(move.start, move.duration, now);\n if (part >= 1) return { view: move.to, done: true };\n return { view: viewBetween(move.from, move.to, easeInOut(part)), done: false };\n}\n","import type { Rect } from \"@mark1russell7/layout-contract\";\nimport { fitRect, frameRects, revealRects, type FitOptions, type FrameOptions, type PictureView, type RevealOptions, type ZoomLimits } from \"./camera.ts\";\n\n/** What an aim gets: the picture and the screen at the time of the aim. */\nexport interface AimFrame {\n /** The bounds of the content, in the unit of the picture. */\n readonly bounds: Rect;\n /** The free area of the picture on the screen, in CSS pixels. */\n readonly area: Rect;\n /** The view of the camera before the aim. */\n readonly view: PictureView;\n /** The limits of the zoom. */\n readonly limits: ZoomLimits;\n}\n\n/**\n * An aim of the camera of a flat picture: a function that gives the view for a picture and a screen.\n * A stage asks the aim again after a change of the size of the picture, so the view stays correct.\n */\nexport type PictureAim = (frame: AimFrame) => PictureView;\n\n/** This function makes the aim that shows all of the picture, as large as the free area permits. */\nexport function aimAll(options: FitOptions = {}): PictureAim {\n return (frame) => fitRect(frame.bounds, frame.area, { ...options, limits: options.limits ?? frame.limits });\n}\n\n/**\n * This function makes the aim that shows a group of boxes at a zoom that a person reads.\n * The rectangles are the bounds of the groups, the largest group first: `frameRects` selects one. An empty list keeps the view.\n */\nexport function aimRects(rects: readonly Rect[], options: FrameOptions): PictureAim {\n return (frame) => frameRects(rects, frame.area, { ...options, limits: options.limits ?? frame.limits }) ?? frame.view;\n}\n\n/**\n * This function makes the aim that shows a selection, and keeps the view when the selection is in view.\n * The rectangles are the bounds of the groups of the selection, the largest group first: `revealRects` selects one.\n */\nexport function aimReveal(rects: readonly Rect[], options: RevealOptions): PictureAim {\n return (frame) => revealRects(frame.view, rects, frame.area, { ...options, limits: options.limits ?? frame.limits });\n}\n","import type { PathSegment } from \"@mark1russell7/layout-contract\";\nimport type { PictureView } from \"./camera.ts\";\nimport type { PaintOutline, PaintShape } from \"./paint.ts\";\n\nconst TURN = 2 * Math.PI;\n\n/** This function adds a path of the picture to the path of a context. */\nfunction tracePath(context: CanvasRenderingContext2D, path: readonly PathSegment[]): void {\n for (const segment of path) {\n switch (segment.kind) {\n case \"move\":\n context.moveTo(segment.to.x, segment.to.y);\n break;\n case \"line\":\n context.lineTo(segment.to.x, segment.to.y);\n break;\n case \"cubic\":\n context.bezierCurveTo(segment.c1.x, segment.c1.y, segment.c2.x, segment.c2.y, segment.to.x, segment.to.y);\n break;\n case \"arc\":\n context.arc(segment.center.x, segment.center.y, segment.radius, segment.start, segment.start + segment.sweep, segment.sweep < 0);\n break;\n }\n }\n}\n\n/** This function makes the path of an outline in a context. */\nfunction trace(context: CanvasRenderingContext2D, outline: PaintOutline): void {\n context.beginPath();\n switch (outline.kind) {\n case \"rect\":\n // An old browser has no round rectangle: its boxes get sharp corners.\n if (outline.radius > 0 && typeof context.roundRect === \"function\") context.roundRect(outline.x, outline.y, outline.w, outline.h, outline.radius);\n else context.rect(outline.x, outline.y, outline.w, outline.h);\n break;\n case \"ellipse\":\n context.ellipse(outline.cx, outline.cy, outline.rx, outline.ry, 0, 0, TURN);\n break;\n case \"polygon\":\n for (const ring of outline.rings) {\n ring.forEach(([x, y], i) => (i === 0 ? context.moveTo(x, y) : context.lineTo(x, y)));\n context.closePath();\n }\n break;\n case \"path\":\n tracePath(context, outline.path);\n break;\n }\n}\n\n/**\n * This function draws a paint list on a canvas, in the order of the list. `paintPicture` makes the list.\n *\n * The unit of the context is the CSS pixel, as a flat stage gives it: the function applies the view of the camera.\n * The function keeps the state of the context: after it, the context has the transform and the styles that it had before.\n */\nexport function drawShapes(context: CanvasRenderingContext2D, shapes: readonly PaintShape[], view: PictureView): void {\n if (shapes.length === 0) return;\n context.save();\n context.transform(view.k, 0, 0, view.k, view.x, view.y);\n context.lineJoin = \"round\";\n context.lineCap = \"round\";\n context.textBaseline = \"middle\";\n /** This value is true while the context has dashes. Most shapes have none, so the function sets them only at a change. */\n let dashed = false;\n for (const shape of shapes) {\n context.globalAlpha = shape.opacity;\n if (shape.type === \"text\") {\n context.font = shape.font;\n context.textAlign = shape.align;\n if (shape.halo !== undefined && dashed) {\n context.setLineDash([]);\n dashed = false;\n }\n const scale = shape.scale !== undefined && shape.scale > 0 ? shape.scale : 1;\n let { x, y } = shape;\n if (scale !== 1) {\n // The text is larger about its point: the point becomes the origin of the context.\n context.save();\n context.translate(x, y);\n context.scale(scale, scale);\n x = 0;\n y = 0;\n }\n if (shape.halo !== undefined) {\n context.strokeStyle = shape.halo.color;\n context.lineWidth = shape.halo.width / scale;\n context.strokeText(shape.text, x, y);\n }\n context.fillStyle = shape.fill;\n context.fillText(shape.text, x, y);\n if (scale !== 1) context.restore();\n continue;\n }\n trace(context, shape.outline);\n if (shape.fill !== undefined) {\n context.fillStyle = shape.fill;\n // A hole of a polygon stays empty with this rule.\n context.fill(\"evenodd\");\n }\n if (shape.stroke !== undefined && shape.lineWidth !== undefined && shape.lineWidth > 0) {\n const dash = shape.dash;\n const next = dash !== undefined && dash.length > 0;\n if (next || dashed) {\n context.setLineDash(next ? [...dash] : []);\n dashed = next;\n }\n context.strokeStyle = shape.stroke;\n context.lineWidth = shape.lineWidth;\n context.stroke();\n }\n }\n context.restore();\n}\n","import type { PictureBox, PictureRoute } from \"@mark1russell7/layout-contract\";\nimport type { PictureIndex } from \"./records.ts\";\n\n/** The focus of a picture: the records that stay clear, while each other record has less color. */\nexport interface PictureFocus {\n /** The ids of the boxes of the focus. */\n readonly boxes: ReadonlySet<string>;\n /** The ids of the routes of the focus. */\n readonly routes: ReadonlySet<string>;\n}\n\n/**\n * How near a record is to the focus of a picture.\n *\n * - `all`: the picture has no focus, so each record is clear.\n * - `in`: the record is in the focus.\n * - `beside`: the box is not in the focus, and its parent is. An example is a different row of the card of the selection.\n * - `out`: the record is not in the focus.\n */\nexport type FocusLevel = \"all\" | \"in\" | \"beside\" | \"out\";\n\n/** The share of the color that a record keeps at each focus level. */\nexport const FOCUS_OPACITY: Readonly<Record<FocusLevel, number>> = { all: 1, in: 1, beside: 0.55, out: 0.2 };\n\n/** The options of `focusOf`. */\nexport interface FocusOptions {\n /**\n * This function tells if a route at a box of the list is in the focus. The default permits each route.\n * A content gives the routes that its looks show, so a route with no line brings no box. A route of the list is in the focus in each case.\n */\n readonly routes?: ((route: PictureRoute) => boolean) | undefined;\n}\n\n/**\n * This function gives the focus of a list of records, or `undefined` when the picture has none of them.\n *\n * - A box brings each box below it in the tree.\n * - Each route at one of these boxes is in the focus, with the box at its other end. The option `routes` can refuse a route.\n * - A route brings its two boxes.\n * - Each box of the focus brings each box above it in the tree, so the card of a row stays clear.\n */\nexport function focusOf(index: PictureIndex, seeds: Iterable<string>, options: FocusOptions = {}): PictureFocus | undefined {\n const permits = options.routes;\n const boxes = new Set<string>();\n const routes = new Set<string>();\n /** The boxes of the list, and each box below them. */\n const own: string[] = [];\n const addRoute = (route: PictureRoute): void => {\n routes.add(route.id);\n if (index.boxes.has(route.source)) boxes.add(route.source);\n if (index.boxes.has(route.target)) boxes.add(route.target);\n };\n const seedRoutes: PictureRoute[] = [];\n for (const seed of seeds) {\n const route = index.routes.get(seed);\n if (route !== undefined) seedRoutes.push(route);\n if (!index.boxes.has(seed)) continue;\n const stack = [seed];\n for (let id = stack.pop(); id !== undefined; id = stack.pop()) {\n if (boxes.has(id)) continue;\n boxes.add(id);\n own.push(id);\n for (const child of index.children.get(id) ?? []) stack.push(child.id);\n }\n }\n for (const id of own) for (const route of index.routesAt.get(id) ?? []) if (permits === undefined || permits(route)) addRoute(route);\n for (const route of seedRoutes) addRoute(route);\n for (const id of [...boxes]) {\n // A box that is in the focus stops the way up: a different step adds the boxes above it.\n for (let parent = index.boxes.get(id)?.parent; parent !== undefined && index.boxes.has(parent) && !boxes.has(parent); parent = index.boxes.get(parent)?.parent) {\n boxes.add(parent);\n }\n }\n return boxes.size === 0 && routes.size === 0 ? undefined : { boxes, routes };\n}\n\n/** This function gives the focus level of a box. */\nexport function boxFocus(focus: PictureFocus | undefined, box: PictureBox): FocusLevel {\n if (focus === undefined) return \"all\";\n if (focus.boxes.has(box.id)) return \"in\";\n return box.parent !== undefined && focus.boxes.has(box.parent) ? \"beside\" : \"out\";\n}\n\n/** This function gives the focus level of a route: `all`, `in` or `out`. */\nexport function routeFocus(focus: PictureFocus | undefined, route: PictureRoute): FocusLevel {\n if (focus === undefined) return \"all\";\n return focus.routes.has(route.id) ? \"in\" : \"out\";\n}\n","import { pathBounds, samplePath, type LayoutPicture, type PictureBox, type PictureLabel, type PictureRoute, type Point, type Rect } from \"@mark1russell7/layout-contract\";\n\n/**\n * A record of a picture that a person can point at: a box or a route. The name of the record is its id.\n * A box and a route with the same id are one record for the highlights of a stage.\n */\nexport type PictureRecord =\n | { readonly type: \"box\"; readonly id: string; readonly box: PictureBox }\n | { readonly type: \"route\"; readonly id: string; readonly route: PictureRoute };\n\n/** The tables of a picture, for the functions that find its records. */\nexport interface PictureIndex {\n readonly picture: LayoutPicture;\n /** Each box by its id. */\n readonly boxes: ReadonlyMap<string, PictureBox>;\n /** Each route by its id. */\n readonly routes: ReadonlyMap<string, PictureRoute>;\n /** The children of each box that has children, in the order of the picture. A box with children is a container. */\n readonly children: ReadonlyMap<string, readonly PictureBox[]>;\n /** The routes that start or end at each box, in the order of the picture. */\n readonly routesAt: ReadonlyMap<string, readonly PictureRoute[]>;\n /** The labels that name each box, in the order of the picture. */\n readonly boxLabels: ReadonlyMap<string, readonly PictureLabel[]>;\n /** The labels that name each route, in the order of the picture. */\n readonly routeLabels: ReadonlyMap<string, readonly PictureLabel[]>;\n /** The labels that name no record, in the order of the picture. */\n readonly freeLabels: readonly PictureLabel[];\n}\n\n/** This function adds a value to the list of a key. */\nfunction add<V>(lists: Map<string, V[]>, key: string, value: V): void {\n const list = lists.get(key);\n if (list === undefined) lists.set(key, [value]);\n else list.push(value);\n}\n\n/**\n * This function makes the tables of a picture. It does not examine the picture: `checkPicture` of `@mark1russell7/layout-contract` does that.\n * 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.\n * Thus a page that removes a route from a picture can keep the label of the route.\n */\nexport function indexPicture(picture: LayoutPicture): PictureIndex {\n const boxes = new Map<string, PictureBox>();\n const routes = new Map<string, PictureRoute>();\n const children = new Map<string, PictureBox[]>();\n const routesAt = new Map<string, PictureRoute[]>();\n const boxLabels = new Map<string, PictureLabel[]>();\n const routeLabels = new Map<string, PictureLabel[]>();\n const freeLabels: PictureLabel[] = [];\n for (const box of picture.boxes) {\n boxes.set(box.id, box);\n if (box.parent !== undefined) add(children, box.parent, box);\n }\n for (const route of picture.routes) {\n routes.set(route.id, route);\n add(routesAt, route.source, route);\n if (route.target !== route.source) add(routesAt, route.target, route);\n }\n for (const label of picture.labels) {\n if (label.box !== undefined) {\n if (boxes.has(label.box)) add(boxLabels, label.box, label);\n } else if (label.route !== undefined) {\n if (routes.has(label.route)) add(routeLabels, label.route, label);\n } else {\n freeLabels.push(label);\n }\n }\n return { picture, boxes, routes, children, routesAt, boxLabels, routeLabels, freeLabels };\n}\n\n/** The line of a route, for the functions that find it: its bounds, and a polyline that follows its path. */\nexport interface RouteLine {\n readonly bounds: Rect;\n /** The polyline is 0.5 units or less from the path. */\n readonly points: readonly Point[];\n}\n\nconst lines = new WeakMap<PictureRoute, RouteLine>();\n\n/**\n * This function gives the line of a route, or `undefined` for a route with an empty path.\n * It keeps the line of each route, so a second question about a route costs nothing.\n */\nexport function routeLine(route: PictureRoute): RouteLine | undefined {\n if (route.path.length === 0) return undefined;\n const known = lines.get(route);\n if (known !== undefined) return known;\n const line: RouteLine = { bounds: pathBounds(route.path), points: samplePath(route.path) };\n lines.set(route, line);\n return line;\n}\n","import { pointPolylineDistance, pointRegionDistance, type PictureBox, type Point } from \"@mark1russell7/layout-contract\";\nimport { routeLine, type PictureIndex, type PictureRecord } from \"./records.ts\";\n\n/** The options of `pickRecord`. */\nexport interface PickOptions {\n /** The distance from the point at which a record is below the point, in the unit of the picture. The default is 0. */\n readonly slack?: number | undefined;\n /** This function tells if a person can point at a record. The default permits each box and no route. */\n readonly picks?: ((record: PictureRecord) => boolean) | undefined;\n}\n\n/** 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. */\nexport function boxDistance(box: PictureBox, point: Point): number {\n if (box.shape === undefined) return pointRegionDistance(point, { kind: \"rect\", x: box.x, y: box.y, w: box.w, h: box.h });\n return pointRegionDistance({ x: point.x - box.x, y: point.y - box.y }, box.shape);\n}\n\nconst boxesOnly = (record: PictureRecord): boolean => record.type === \"box\";\n\n/**\n * This function gives the record of a picture below a point, or `undefined` for no record.\n *\n * - A box with no child comes first: the top box at the point, then the nearest box in the slack.\n * - A route comes next: the nearest route in the slack. A route is thin, so it comes before a container.\n * - A box with children comes last: the top one at the point, then the nearest one in the slack.\n *\n * 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.\n */\nexport function pickRecord(index: PictureIndex, point: Point, options: PickOptions = {}): PictureRecord | undefined {\n const slack = Math.max(0, options.slack ?? 0);\n const picks = options.picks ?? boxesOnly;\n let leaf: PictureRecord | undefined;\n let nearLeaf: PictureRecord | undefined;\n let nearLeafAt = Infinity;\n let container: PictureRecord | undefined;\n let nearContainer: PictureRecord | undefined;\n let nearContainerAt = Infinity;\n for (const box of index.picture.boxes) {\n 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;\n const distance = boxDistance(box, point);\n if (distance > slack) continue;\n const record: PictureRecord = { type: \"box\", id: box.id, box };\n if (!picks(record)) continue;\n if (index.children.has(box.id)) {\n if (distance === 0) container = record;\n else if (distance <= nearContainerAt) {\n nearContainer = record;\n nearContainerAt = distance;\n }\n } else if (distance === 0) leaf = record;\n else if (distance <= nearLeafAt) {\n nearLeaf = record;\n nearLeafAt = distance;\n }\n }\n if (leaf !== undefined) return leaf;\n if (nearLeaf !== undefined) return nearLeaf;\n let found: PictureRecord | undefined;\n let foundAt = Infinity;\n for (const route of index.picture.routes) {\n const line = routeLine(route);\n if (line === undefined) continue;\n const { bounds } = line;\n 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;\n const record: PictureRecord = { type: \"route\", id: route.id, route };\n if (!picks(record)) continue;\n const distance = pointPolylineDistance(point, line.points);\n if (distance > slack || distance > foundAt) continue;\n found = record;\n foundAt = distance;\n }\n return found ?? container ?? nearContainer;\n}\n","import type { PictureBox, PictureLabel, PictureRoute } from \"@mark1russell7/layout-contract\";\nimport type { Highlight } from \"../highlight.ts\";\nimport type { FocusLevel } from \"./focus.ts\";\nimport type { PictureRecord } from \"./records.ts\";\n\n/** What a look knows about a record at the time of a picture. */\nexport interface RecordState {\n /** The highlight of the record. A label has the highlight of the record that it names. */\n readonly highlight: Highlight;\n /** How near the record is to the focus of the picture. */\n readonly focus: FocusLevel;\n /** The zoom of the camera: the number of CSS pixels for one unit of the picture. */\n readonly zoom: number;\n /** This value is true for a box with children, and for a label of such a box. */\n readonly container: boolean;\n}\n\n/**\n * This function gives the size of one unit of a look, in the unit of the picture.\n * The widths of the lines, the dashes and the sizes of the signs of a look are in this unit.\n *\n * At the zoom 1 or less, one unit is one CSS pixel. Thus a thin line stays clear in a small picture.\n * Above the zoom 1, one unit is one unit of the picture. Thus a line grows with its box.\n */\nexport function lookUnit(zoom: number): number {\n return zoom > 0 && zoom < 1 ? 1 / zoom : 1;\n}\n\n/** A line around a box, off its border. A page shows a selection with it. */\nexport interface BoxRing {\n readonly color: string;\n /** The width of the line, in units of a look. */\n readonly width: number;\n /** The distance from the border of the box to the line, in units of a look. A polygon has the line on its border. */\n readonly gap: number;\n}\n\n/** A small sign in a box, for example for the state of its record. */\nexport interface BoxMark {\n /** A `dot` is a full circle, and a `ring` is the line of a circle. */\n readonly shape: \"dot\" | \"ring\";\n /** The middle of the sign from the left edge of the box, in the unit of the picture. */\n readonly x: number;\n /** The middle of the sign from the top edge of the box, in the unit of the picture. */\n readonly y: number;\n /** The radius of the sign, in units of a look. */\n readonly radius: number;\n readonly color: string;\n /** The width of the line of a ring, in units of a look. The default is 1.5. */\n readonly width?: number | undefined;\n}\n\n/** The look of a box. A box with no `fill` and no `stroke` shows only its ring and its signs. */\nexport interface BoxLook {\n /** The color of the inside. */\n readonly fill?: string | undefined;\n /** The color of the border. */\n readonly stroke?: string | undefined;\n /** The width of the border, in units of a look. The default is 1. */\n readonly width?: number | undefined;\n /** The lengths of the dashes and the gaps of the border, in units of a look. */\n readonly dash?: readonly number[] | undefined;\n /** The radius of the corners of a rectangle, in the unit of the picture. The default is 0. */\n readonly radius?: number | undefined;\n /** The share of its color that the box keeps, from 0 to 1. The focus of the picture decreases it more. The default is 1. */\n readonly opacity?: number | undefined;\n readonly ring?: BoxRing | undefined;\n readonly marks?: readonly BoxMark[] | undefined;\n}\n\n/** The sign at an end of a route. */\nexport interface RouteEnd {\n /** An `arrow` points along the route, out of it. A `dot` is a full circle. */\n readonly shape: \"arrow\" | \"dot\";\n /** The length of an arrow or the radius of a dot, in units of a look. */\n readonly size: number;\n}\n\n/** The look of a route. */\nexport interface RouteLook {\n readonly stroke: string;\n /** The width of the line, in units of a look. The default is 1.25. */\n readonly width?: number | undefined;\n /** The lengths of the dashes and the gaps, in units of a look. */\n readonly dash?: readonly number[] | undefined;\n /** The share of its color that the route keeps, from 0 to 1. The default is 1. */\n readonly opacity?: number | undefined;\n /** The sign at the source of the route. */\n readonly start?: RouteEnd | undefined;\n /** The sign at the target of the route. */\n readonly end?: RouteEnd | undefined;\n}\n\n/** The look of a label. */\nexport interface LabelLook {\n readonly color: string;\n /** The share of its color that the label keeps, from 0 to 1. The default is 1. */\n readonly opacity?: number | undefined;\n /** The color of a line around each letter. A text on a route is clear with the color of the page. */\n readonly halo?: string | undefined;\n /** With `bars`, each line is a bar of its width: a person sees the form of a text that is too small to read. The default is `text`. */\n readonly as?: \"text\" | \"bars\" | undefined;\n /**\n * The smallest height of a line of the label on the screen, in CSS pixels. Use it for a name that a person reads in a far view.\n * At a zoom with a smaller line, the text keeps this height. It becomes larger about its place, and it is on top of each other shape.\n *\n * Two such texts do not overlap. The text of a record with a highlight has the first choice, then the text of the larger box.\n * A text with no free place has no paint. The value is at most `MOST_KEPT_LINE`, and it has no effect on bars.\n */\n readonly least?: number | undefined;\n}\n\n/** The largest height on the screen that a label keeps with `least`, in CSS pixels. A larger value of `least` becomes this value. */\nexport const MOST_KEPT_LINE = 32;\n\n/**\n * The looks of a picture: one function for each type of record. `T` is the type of the theme.\n * Each function gives the look of a record in a state, or `undefined` for a record that the picture does not show.\n * A box that the picture does not show takes its labels with it, and a person cannot point at it.\n */\nexport interface PictureLooks<T> {\n box(box: PictureBox, state: RecordState, theme: T): BoxLook | undefined;\n route(route: PictureRoute, state: RecordState, theme: T): RouteLook | undefined;\n /** `of` is the record that the label names, or `undefined` for a label that names no record. */\n label(label: PictureLabel, state: RecordState, theme: T, of: PictureRecord | undefined): LabelLook | undefined;\n}\n\n/** The colors of a plain picture. */\nexport interface PictureTheme {\n /** The inside of a box with no child. */\n readonly box: string;\n /** The border of a box with no child. */\n readonly boxLine: string;\n /** The inside of a box with children. */\n readonly container: string;\n /** The border of a box with children, and the bars of a text that is too small to read. */\n readonly containerLine: string;\n readonly text: string;\n /** The text of a box with children. */\n readonly mutedText: string;\n readonly route: string;\n /** The color of a record with a highlight. */\n readonly accent: string;\n /** The color of the page behind the picture. The line around the text of a route has it. */\n readonly paper: string;\n}\n\n/** The colors of a plain picture on a light page. */\nexport const LIGHT_PICTURE_THEME: PictureTheme = {\n box: \"#ffffff\",\n boxLine: \"#454f67\",\n container: \"#eef1f6\",\n containerLine: \"#aeb6c7\",\n text: \"#151c2e\",\n mutedText: \"#5f6880\",\n route: \"#7a8399\",\n accent: \"#2346c4\",\n paper: \"#f5f6f9\",\n};\n\n/** The colors of a plain picture on a dark page. */\nexport const DARK_PICTURE_THEME: PictureTheme = {\n box: \"#151a2b\",\n boxLine: \"#b3bad0\",\n container: \"#1c2236\",\n containerLine: \"#46507a\",\n text: \"#e6e9f3\",\n mutedText: \"#949cb3\",\n route: \"#6f7aa3\",\n accent: \"#93abff\",\n paper: \"#0e1220\",\n};\n\n/** 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. */\nexport const SMALLEST_TEXT_LINE = 11;\n\n/** The smallest height of a line of text on the screen that a plain picture shows as a bar, in CSS pixels. */\nexport const SMALLEST_BAR_LINE = 2.5;\n\n/** The smallest width on the screen of a box with children whose name stays a text in a plain picture, in CSS pixels. */\nexport const SMALLEST_NAMED_BOX = 48;\n\n/** The options of `plainLooks`. */\nexport interface PlainLookOptions {\n /** The radius of the corners of each box, in the unit of the picture. The default is 6. */\n readonly radius?: number | undefined;\n /** The sign at the target of each route. The default is no sign. */\n readonly end?: RouteEnd | undefined;\n}\n\n/**\n * This function gives the looks of a plain picture: boxes with a border, routes as lines and the text of the labels.\n *\n * - A record below the pointer has the color `accent`. The selected record has a wider line too.\n * - A box with children has the colors of a container, and its label has the muted color.\n * - The label of a route has a line of the color `paper` around its letters.\n * - A text that is too small to read is a row of bars. A text that is smaller than a bar has no paint.\n * - 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.\n * The name of such a box with a highlight stays a text at each size.\n */\nexport function plainLooks(options: PlainLookOptions = {}): PictureLooks<PictureTheme> {\n const radius = options.radius ?? 6;\n return {\n box(_box, state, theme) {\n const plain = state.container ? theme.containerLine : theme.boxLine;\n return {\n fill: state.container ? theme.container : theme.box,\n stroke: state.highlight > 0 ? theme.accent : plain,\n width: state.highlight === 2 ? 2 : 1,\n radius,\n };\n },\n route(_route, state, theme) {\n return { stroke: state.highlight > 0 ? theme.accent : theme.route, width: state.highlight === 2 ? 2 : 1.25, end: options.end };\n },\n label(label, state, theme, of) {\n const tall = label.lineHeight * state.zoom;\n // The name of a group keeps a height that a person can read, until the group is small. The pointer shows the name of a small group.\n if (tall < SMALLEST_TEXT_LINE && state.container && of?.type === \"box\" && (state.highlight > 0 || of.box.w * state.zoom >= SMALLEST_NAMED_BOX)) {\n return { color: theme.mutedText, halo: theme.paper, least: SMALLEST_TEXT_LINE };\n }\n if (tall < SMALLEST_BAR_LINE) return undefined;\n if (tall < SMALLEST_TEXT_LINE) return { color: theme.containerLine, as: \"bars\" };\n if (of?.type === \"route\") return { color: theme.text, halo: theme.paper };\n return { color: state.container ? theme.mutedText : theme.text };\n },\n };\n}\n","import {\n grow,\n overlapOf,\n pathEnd,\n pathStart,\n translate,\n type LabelAlign,\n type PathSegment,\n type PathTangent,\n type PictureBox,\n type PictureLabel,\n type PictureRoute,\n type Rect,\n type Region,\n type Ring,\n} from \"@mark1russell7/layout-contract\";\nimport type { Highlight } from \"../highlight.ts\";\nimport { boxFocus, FOCUS_OPACITY, routeFocus, type FocusLevel, type PictureFocus } from \"./focus.ts\";\nimport { lookUnit, MOST_KEPT_LINE, type BoxLook, type LabelLook, type PictureLooks, type RecordState, type RouteEnd, type RouteLook } from \"./looks.ts\";\nimport { routeLine, type PictureIndex, type PictureRecord } from \"./records.ts\";\n\n/** The outline of a shape of a paint list, in the unit of the picture. */\nexport type PaintOutline =\n | { readonly kind: \"rect\"; readonly x: number; readonly y: number; readonly w: number; readonly h: number; readonly radius: number }\n | { readonly kind: \"ellipse\"; readonly cx: number; readonly cy: number; readonly rx: number; readonly ry: number }\n | { readonly kind: \"polygon\"; readonly rings: readonly Ring[] }\n | { readonly kind: \"path\"; readonly path: readonly PathSegment[] };\n\n/** A shape of a paint list with an outline: an inside, a line, or the two. */\nexport interface PaintOutlined {\n readonly type: \"shape\";\n readonly outline: PaintOutline;\n /** The color of the inside. */\n readonly fill?: string | undefined;\n /** The color of the line. */\n readonly stroke?: string | undefined;\n /** The width of the line, in the unit of the picture. */\n readonly lineWidth?: number | undefined;\n /** The lengths of the dashes and the gaps of the line, in the unit of the picture. */\n readonly dash?: readonly number[] | undefined;\n /** The share of its color that the shape keeps, above 0 and to 1. */\n readonly opacity: number;\n}\n\n/** One line of text of a paint list. */\nexport interface PaintText {\n readonly type: \"text\";\n readonly text: string;\n /** The point of the line on the x axis: its left end, its middle or its right end, as `align` tells. */\n readonly x: number;\n /** The middle of the height of the line. */\n readonly y: number;\n /** The font, as the CSS property `font`. Its size is in the unit of the picture. */\n readonly font: string;\n readonly align: LabelAlign;\n readonly fill: string;\n /** A line around each letter, below the letters. Its width is in the unit of the picture. */\n readonly halo?: { readonly color: string; readonly width: number } | undefined;\n /** The share of its color that the text keeps, above 0 and to 1. */\n readonly opacity: number;\n /**\n * The factor by which the text is larger than its font, about its point (`x`, `y`). The default is 1.\n * A label that keeps a height on the screen has it. The width of `halo` is the width after this factor.\n */\n readonly scale?: number | undefined;\n}\n\n/** One shape of a paint list. The list is in the order of the paint, so its first shape is at the back. */\nexport type PaintShape = PaintOutlined | PaintText;\n\n/** The state of a picture at the time of a paint. */\nexport interface PaintState {\n /** The zoom of the camera: the number of CSS pixels for one unit of the picture. */\n readonly zoom: number;\n /** This function gives the highlight of a record by its name. */\n readonly highlight: (record: string) => Highlight;\n /** The focus of the picture. Without it, each record is clear. */\n readonly focus?: PictureFocus | undefined;\n /** The part of the picture in view. A record out of it gets no shape. Without it, each record gets its shapes. */\n readonly visible?: Rect | undefined;\n /** This function gives the width of a text in a font, in the unit of the picture. A bar of a label has this width, or the width of the label. */\n readonly measure?: ((font: string, text: string) => number) | undefined;\n /**\n * This function gives the share of its color that a record keeps. `key` is the key of the record, and `goal` is the share of its focus level.\n * A content gives a function that goes to the goal with time. Without it, the share is the goal.\n */\n readonly fade?: ((key: string, goal: number) => number) | undefined;\n}\n\n/** The key of the labels that name no record, for `fade`. */\nexport const FREE_LABELS = \"labels\";\n\n/** 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. */\nexport const VIEW_MARGIN = 24;\n\n/** The height of a bar of a label, as a share of the height of its line. */\nexport const BAR_HEIGHT = 0.42;\n\n/** The width of the line around the letters of a label, as a share of the height of its line. */\nexport const HALO_WIDTH = 0.25;\n\n/** The half width of an arrow at the end of a route, as a share of its length. */\nexport const ARROW_SPREAD = 0.45;\n\n/** The smallest distance between two labels that keep a height on the screen, in units of a look. */\nexport const KEPT_GAP = 4;\n\n/** 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. */\nexport function recordKey(type: PictureRecord[\"type\"], id: string): string {\n return `${type}:${id}`;\n}\n\n/** This function gives the state of a box for its look. */\nexport function boxState(index: PictureIndex, box: PictureBox, state: PaintState): RecordState {\n return { highlight: state.highlight(box.id), focus: boxFocus(state.focus, box), zoom: state.zoom, container: index.children.has(box.id) };\n}\n\n/** This function gives the state of a route for its look. */\nexport function routeState(route: PictureRoute, state: PaintState): RecordState {\n return { highlight: state.highlight(route.id), focus: routeFocus(state.focus, route), zoom: state.zoom, container: false };\n}\n\n/** This function gives the outline of a box, larger by `more` at each side. A polygon does not become larger. */\nfunction outlineOf(box: PictureBox, radius: number, more: number): PaintOutline {\n const region: Region = box.shape === undefined ? { kind: \"rect\", x: box.x, y: box.y, w: box.w, h: box.h } : translate(box.shape, box.x, box.y);\n switch (region.kind) {\n case \"rect\": {\n const w = Math.max(0, region.w + 2 * more);\n const h = Math.max(0, region.h + 2 * more);\n return { kind: \"rect\", x: region.x - more, y: region.y - more, w, h, radius: Math.max(0, Math.min(radius + more, w / 2, h / 2)) };\n }\n case \"circle\":\n return { kind: \"ellipse\", cx: region.cx, cy: region.cy, rx: Math.max(0, region.r + more), ry: Math.max(0, region.r + more) };\n case \"ellipse\":\n return { kind: \"ellipse\", cx: region.cx, cy: region.cy, rx: Math.max(0, region.rx + more), ry: Math.max(0, region.ry + more) };\n case \"polygon\":\n return { kind: \"polygon\", rings: region.holes === undefined ? [region.points] : [region.points, ...region.holes] };\n }\n}\n\n/** This function gives the lengths of a dash in the unit of the picture. */\nfunction dashOf(dash: readonly number[] | undefined, unit: number): readonly number[] | undefined {\n return dash === undefined || dash.length === 0 ? undefined : dash.map((length) => length * unit);\n}\n\n/** This function adds the shapes of a box: its ring, its inside and border, and its signs. */\nfunction addBox(shapes: PaintShape[], box: PictureBox, look: BoxLook, unit: number, share: number): void {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (!(opacity > 0)) return;\n const radius = look.radius ?? 0;\n if (look.ring !== undefined) {\n const more = (look.ring.gap + look.ring.width / 2) * unit;\n shapes.push({ type: \"shape\", outline: outlineOf(box, radius, more), stroke: look.ring.color, lineWidth: look.ring.width * unit, opacity });\n }\n if (look.fill !== undefined || look.stroke !== undefined) {\n const line = look.stroke === undefined ? undefined : (look.width ?? 1) * unit;\n shapes.push({ type: \"shape\", outline: outlineOf(box, radius, 0), fill: look.fill, stroke: look.stroke, lineWidth: line, dash: dashOf(look.dash, unit), opacity });\n }\n for (const mark of look.marks ?? []) {\n const r = Math.max(0, mark.radius * unit);\n const outline: PaintOutline = { kind: \"ellipse\", cx: box.x + mark.x, cy: box.y + mark.y, rx: r, ry: r };\n if (mark.shape === \"dot\") shapes.push({ type: \"shape\", outline, fill: mark.color, opacity });\n else shapes.push({ type: \"shape\", outline, stroke: mark.color, lineWidth: (mark.width ?? 1.5) * unit, opacity });\n }\n}\n\n/** 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. */\nfunction leftShare(label: PictureLabel): number {\n return label.align === \"center\" ? 0.5 : label.align === \"right\" ? 1 : 0;\n}\n\n/**\n * This function gives the factor by which a label becomes larger, so that a line is `least` CSS pixels high on the screen.\n * The factor is 1 for a label that is high enough.\n */\nfunction keptScale(label: PictureLabel, least: number, zoom: number): number {\n const tall = label.lineHeight * zoom;\n return tall > 0 && tall < least ? least / tall : 1;\n}\n\n/**\n * 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.\n * 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.\n */\nfunction keptRect(label: PictureLabel, wide: number, scale: number): Rect {\n const left = leftShare(label);\n const tall = label.lines.length * label.lineHeight;\n return { x: label.x + left * label.w - left * wide * scale, y: label.y + (tall - tall * scale) / 2, w: wide * scale, h: tall * scale };\n}\n\n/** A label that keeps a height on the screen, before it has a place. */\ninterface KeptLabel {\n readonly label: PictureLabel;\n readonly look: LabelLook;\n readonly scale: number;\n readonly opacity: number;\n /** The highlight of the record that the label names. */\n readonly highlight: Highlight;\n /** The area of the box that the label names, or 0. */\n readonly area: number;\n}\n\n/** This function adds the texts of a label that keeps a height on the screen. `rect` is the rectangle of its lines. */\nfunction addKept(shapes: PaintShape[], kept: KeptLabel, rect: Rect): void {\n const { label, look, scale, opacity } = kept;\n const tall = label.lineHeight * scale;\n const halo = look.halo === undefined ? undefined : { color: look.halo, width: tall * HALO_WIDTH };\n const x = label.x + leftShare(label) * label.w;\n for (let i = 0; i < label.lines.length; i++) {\n const text = label.lines[i]!;\n if (text.trim() === \"\") continue;\n shapes.push({ type: \"text\", text, x, y: rect.y + (i + 0.5) * tall, font: label.font, align: label.align ?? \"left\", fill: look.color, halo, opacity, scale });\n }\n}\n\n/** This function adds the shapes of a label: one text or one bar for each line that is not empty. */\nfunction addLabel(shapes: PaintShape[], label: PictureLabel, look: LabelLook, share: number, measure: PaintState[\"measure\"]): void {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (!(opacity > 0)) return;\n const align = label.align ?? \"left\";\n const left = leftShare(label);\n for (let i = 0; i < label.lines.length; i++) {\n const text = label.lines[i]!;\n if (text.trim() === \"\") continue;\n const y = label.y + (i + 0.5) * label.lineHeight;\n if (look.as !== \"bars\") {\n const halo = look.halo === undefined ? undefined : { color: look.halo, width: label.lineHeight * HALO_WIDTH };\n shapes.push({ type: \"text\", text, x: label.x + left * label.w, y, font: label.font, align, fill: look.color, halo, opacity });\n continue;\n }\n const measured = measure === undefined ? label.w : measure(label.font, text);\n const wide = label.w > 0 ? Math.min(measured, label.w) : measured;\n if (!(wide > 0)) continue;\n const tall = label.lineHeight * BAR_HEIGHT;\n const outline: PaintOutline = { kind: \"rect\", x: label.x + left * (label.w - wide), y: y - tall / 2, w: wide, h: tall, radius: Math.min(tall, wide) / 2 };\n shapes.push({ type: \"shape\", outline, fill: look.color, opacity });\n }\n}\n\n/** 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. */\nfunction addEnd(shapes: PaintShape[], at: PathTangent, out: 1 | -1, end: RouteEnd, stroke: string, lineWidth: number, unit: number, opacity: number): void {\n const size = end.size * unit;\n if (!(size > 0)) return;\n const { point } = at;\n if (end.shape === \"dot\") {\n shapes.push({ type: \"shape\", outline: { kind: \"ellipse\", cx: point.x, cy: point.y, rx: size, ry: size }, fill: stroke, opacity });\n return;\n }\n const dx = at.direction.x * out;\n const dy = at.direction.y * out;\n // A path with no length has no direction, so it has no arrow.\n if (dx === 0 && dy === 0) return;\n // The arrow is two lines from its point back to each side of the route.\n const backX = point.x - dx * size;\n const backY = point.y - dy * size;\n const half = size * ARROW_SPREAD;\n const path: PathSegment[] = [\n { kind: \"move\", to: { x: backX - dy * half, y: backY + dx * half } },\n { kind: \"line\", to: point },\n { kind: \"line\", to: { x: backX + dy * half, y: backY - dx * half } },\n ];\n shapes.push({ type: \"shape\", outline: { kind: \"path\", path }, stroke, lineWidth, opacity });\n}\n\n/** This function adds the shapes of a route: its line, and the signs at its ends. */\nfunction addRoute(shapes: PaintShape[], route: PictureRoute, look: RouteLook, unit: number, share: number): void {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (!(opacity > 0)) return;\n const lineWidth = (look.width ?? 1.25) * unit;\n shapes.push({ type: \"shape\", outline: { kind: \"path\", path: route.path }, stroke: look.stroke, lineWidth, dash: dashOf(look.dash, unit), opacity });\n if (look.start !== undefined) addEnd(shapes, pathStart(route.path), -1, look.start, look.stroke, lineWidth, unit, opacity);\n if (look.end !== undefined) addEnd(shapes, pathEnd(route.path), 1, look.end, look.stroke, lineWidth, unit, opacity);\n}\n\n/**\n * This function gives the paint list of a picture: the shapes that a renderer draws, in the order of the paint.\n * The function is pure, so a test examines a picture with no browser. `drawShapes` draws the list on a canvas.\n *\n * The layers are, from the back:\n *\n * - The boxes with children, each with its labels.\n * - The routes. The routes of the focus and those with a highlight are after the others.\n * - The boxes with no child, each with its labels.\n * - The labels of the routes, then the labels that name no record.\n * - The labels that keep a height on the screen (`least` of a label look).\n *\n * In a layer, the records are in the order of the picture. A label has the state of the record that it names.\n * The focus of the picture decreases the color of each record out of it (`FOCUS_OPACITY`).\n */\nexport function paintPicture<T>(index: PictureIndex, looks: PictureLooks<T>, theme: T, state: PaintState): PaintShape[] {\n const { picture } = index;\n const unit = lookUnit(state.zoom);\n const margin = VIEW_MARGIN * unit;\n const { visible, measure, zoom } = state;\n const inView = (rect: Rect): boolean => {\n if (visible === undefined) return true;\n const overlap = overlapOf(grow(rect, margin), visible);\n return overlap.x >= 0 && overlap.y >= 0;\n };\n /** This function tells if a label can be in view: at its place, or with the largest height that a label keeps. */\n const near = (label: PictureLabel): boolean => {\n if (inView(label)) return true;\n const most = keptScale(label, MOST_KEPT_LINE, zoom);\n return most > 1 && inView(keptRect(label, label.w, most));\n };\n const shareOf = (key: string, level: FocusLevel): number => {\n const goal = FOCUS_OPACITY[level];\n return state.fade === undefined ? goal : state.fade(key, goal);\n };\n const kept: KeptLabel[] = [];\n /** 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. */\n const place = (shapes: PaintShape[], label: PictureLabel, look: LabelLook | undefined, share: number, highlight: Highlight, area: number): void => {\n if (look === undefined) return;\n const scale = look.least === undefined || look.as === \"bars\" ? 1 : keptScale(label, Math.min(look.least, MOST_KEPT_LINE), zoom);\n if (scale > 1) {\n const opacity = Math.min(1, (look.opacity ?? 1) * share);\n if (opacity > 0) kept.push({ label, look, scale, opacity, highlight, area });\n } else if (inView(label)) addLabel(shapes, label, look, share, measure);\n };\n\n const containers: PaintShape[] = [];\n const leaves: PaintShape[] = [];\n for (const box of picture.boxes) {\n const labels = index.boxLabels.get(box.id) ?? [];\n const shown = inView(box);\n if (!shown && !labels.some(near)) continue;\n const boxIs = boxState(index, box, state);\n const look = looks.box(box, boxIs, theme);\n if (look === undefined) continue;\n const share = shareOf(recordKey(\"box\", box.id), boxIs.focus);\n const shapes = boxIs.container ? containers : leaves;\n if (shown) addBox(shapes, box, look, unit, share);\n const record: PictureRecord = { type: \"box\", id: box.id, box };\n for (const label of labels) if (near(label)) place(shapes, label, looks.label(label, boxIs, theme, record), share, boxIs.highlight, box.w * box.h);\n }\n\n const back: PaintShape[] = [];\n const front: PaintShape[] = [];\n const routeLabels: PaintShape[] = [];\n for (const route of picture.routes) {\n const line = routeLine(route);\n if (line === undefined) continue;\n const labels = index.routeLabels.get(route.id) ?? [];\n const shown = inView(line.bounds);\n if (!shown && !labels.some(near)) continue;\n const routeIs = routeState(route, state);\n const look = looks.route(route, routeIs, theme);\n if (look === undefined) continue;\n const share = shareOf(recordKey(\"route\", route.id), routeIs.focus);\n if (shown) addRoute(routeIs.focus === \"in\" || routeIs.highlight > 0 ? front : back, route, look, unit, share);\n const record: PictureRecord = { type: \"route\", id: route.id, route };\n for (const label of labels) if (near(label)) place(routeLabels, label, looks.label(label, routeIs, theme, record), share, routeIs.highlight, 0);\n }\n\n const free: PaintShape[] = [];\n if (index.freeLabels.length > 0) {\n const level: FocusLevel = state.focus === undefined ? \"all\" : \"out\";\n const labelIs: RecordState = { highlight: 0, focus: level, zoom: state.zoom, container: false };\n const share = shareOf(FREE_LABELS, level);\n for (const label of index.freeLabels) if (near(label)) place(free, label, looks.label(label, labelIs, theme, undefined), share, 0, 0);\n }\n\n const top: PaintShape[] = [];\n if (kept.length > 0) {\n // The sort keeps the order of two labels of the same rank: the boxes, then the routes, then the labels that name no record.\n kept.sort((a, b) => b.highlight - a.highlight || b.area - a.area);\n const gap = KEPT_GAP * unit;\n const taken: Rect[] = [];\n for (const item of kept) {\n const { label } = item;\n const lines = label.lines.filter((line) => line.trim() !== \"\");\n if (lines.length === 0) continue;\n let wide = measure === undefined ? label.w : Math.max(...lines.map((line) => measure(label.font, line)));\n if (label.w > 0) wide = Math.min(wide, label.w);\n const rect = keptRect(label, wide, item.scale);\n if (!inView(rect)) continue;\n const space = grow(rect, gap);\n const clear = taken.every((other) => {\n const overlap = overlapOf(space, other);\n return !(overlap.x > 0 && overlap.y > 0);\n });\n if (!clear) continue;\n taken.push(rect);\n addKept(top, item, rect);\n }\n }\n return containers.concat(back, front, leaves, routeLabels, free, top);\n}\n","import { pictureBounds, type LayoutPicture, type PictureRoute, type Rect } from \"@mark1russell7/layout-contract\";\nimport type { Highlight } from \"../highlight.ts\";\nimport { approach } from \"../motion.ts\";\nimport { drawShapes } from \"./draw.ts\";\nimport { boxFocus, FOCUS_OPACITY, focusOf, routeFocus, type PictureFocus } from \"./focus.ts\";\nimport { pickRecord } from \"./hit.ts\";\nimport type { PictureLooks } from \"./looks.ts\";\nimport { boxState, FREE_LABELS, paintPicture, recordKey, routeState, type PaintState } from \"./paint.ts\";\nimport { indexPicture, type PictureRecord } from \"./records.ts\";\nimport type { PictureContent } from \"./stage.ts\";\n\n/** 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. */\nexport const FOCUS_FADE = 0.08;\n\n/** The bounds of a picture with no record. */\nconst NO_BOUNDS: Rect = { x: 0, y: 0, w: 0, h: 0 };\n\n/** The largest number of text widths that a content keeps. */\nconst MOST_WIDTHS = 4000;\n\nconst NO_SEEDS: readonly string[] = [];\n\n/** The options of `createPictureContent`. `T` is the type of the theme. */\nexport interface PictureContentOptions<T> {\n /** The looks of the records. `plainLooks` gives the looks of a plain picture. */\n readonly looks: PictureLooks<T>;\n /** This function tells if a person can point at a record. The default permits each box and no route. */\n readonly picks?: ((record: PictureRecord) => boolean) | undefined;\n /**\n * The records of the focus. With `selection`, the selected record and the records at it stay clear, and each other record has less color.\n * With `none`, the picture has no focus until the page gives one with `setFocus`. The default is `selection`.\n */\n readonly focus?: \"selection\" | \"none\" | undefined;\n}\n\n/** The content of a flat stage that shows a picture of `@mark1russell7/layout-contract`. The value of a pick is the record. */\nexport interface LayoutPictureContent<T> extends PictureContent<PictureRecord, T> {\n /** This function shows a different picture, for example after a new layout. Start `refresh` of the stage after it. */\n setPicture(picture: LayoutPicture): void;\n /**\n * This function sets the records of the focus by their names. An empty list gives no focus.\n * `undefined` gives the focus of the options again. Start `refresh` of the stage after it.\n */\n setFocus(records: readonly string[] | undefined): void;\n}\n\nconst boxesOnly = (record: PictureRecord): boolean => record.type === \"box\";\n\n/**\n * This function makes the content of a flat stage from a picture: its boxes, its routes and its labels.\n *\n * - The looks give the colors, the lines and the signs of each record from its state.\n * - A person points at the top box below the pointer, or at a route that the option `picks` permits.\n * - A change of the focus changes the colors in a short time.\n * - The content makes shapes only for the records in view.\n *\n * The picture must be good (`checkPicture` of `@mark1russell7/layout-contract`). The content does not change it.\n */\nexport function createPictureContent<T>(picture: LayoutPicture, options: PictureContentOptions<T>): LayoutPictureContent<T> {\n const { looks } = options;\n const permits = options.picks ?? boxesOnly;\n const bySelection = (options.focus ?? \"selection\") === \"selection\";\n let index = indexPicture(picture);\n let bounds = pictureBounds(picture) ?? NO_BOUNDS;\n /** The records of `setFocus`, or `undefined` for the focus of the options. */\n let asked: readonly string[] | undefined;\n /** The names from which the focus of the last picture came. */\n let seeds: readonly string[] = NO_SEEDS;\n let focus: PictureFocus | undefined;\n /** This value is true until the first picture of a picture. The first focus has no change with time. */\n let fresh = true;\n /** The color share of each record whose share changes, by the key of the record. */\n const fades = new Map<string, { value: number; goal: number }>();\n /** The theme and the state of the last picture. A person cannot point at a record that the last picture did not show. */\n let last: { readonly theme: T; readonly state: PaintState } | undefined;\n /** The width of each text that the content measured, by its font and its text. */\n const widths = new Map<string, number>();\n\n const widthOf = (context: CanvasRenderingContext2D, font: string, text: string): number => {\n const key = `${font}\\n${text}`;\n const known = widths.get(key);\n if (known !== undefined) return known;\n const before = context.font;\n context.font = font;\n const width = context.measureText(text).width;\n context.font = before;\n if (widths.size >= MOST_WIDTHS) widths.clear();\n widths.set(key, width);\n return width;\n };\n\n /** This function gives the names from which the focus comes. */\n const seedsOf = (highlight: (record: string) => Highlight): readonly string[] => {\n if (asked !== undefined) return asked;\n if (!bySelection) return NO_SEEDS;\n const out: string[] = [];\n for (const id of index.boxes.keys()) if (highlight(id) === 2) out.push(id);\n for (const id of index.routes.keys()) if (!index.boxes.has(id) && highlight(id) === 2) out.push(id);\n return out;\n };\n\n /** This function starts the change of the color of each record whose focus level changes. A change that continues starts from its value. */\n const fadeTo = (next: PictureFocus | undefined): void => {\n const add = (key: string, from: number, goal: number): void => {\n const value = fades.get(key)?.value ?? from;\n if (value === goal) fades.delete(key);\n else fades.set(key, { value, goal });\n };\n for (const box of index.picture.boxes) add(recordKey(\"box\", box.id), FOCUS_OPACITY[boxFocus(focus, box)], FOCUS_OPACITY[boxFocus(next, box)]);\n for (const route of index.picture.routes) add(recordKey(\"route\", route.id), FOCUS_OPACITY[routeFocus(focus, route)], FOCUS_OPACITY[routeFocus(next, route)]);\n if (index.freeLabels.length > 0) add(FREE_LABELS, FOCUS_OPACITY[focus === undefined ? \"all\" : \"out\"], FOCUS_OPACITY[next === undefined ? \"all\" : \"out\"]);\n };\n\n return {\n get bounds(): Rect {\n return bounds;\n },\n has: (record) => index.boxes.has(record) || index.routes.has(record),\n pick(at) {\n const known = last;\n const state: PaintState | undefined = known === undefined ? undefined : { ...known.state, zoom: at.view.k };\n const shown = (record: PictureRecord): boolean => {\n if (!permits(record)) return false;\n if (known === undefined || state === undefined) return true;\n if (record.type === \"box\") return looks.box(record.box, boxState(index, record.box, state), known.theme) !== undefined;\n return looks.route(record.route, routeState(record.route, state), known.theme) !== undefined;\n };\n const record = pickRecord(index, at.point, { slack: at.slack / at.view.k, picks: shown });\n return record === undefined ? undefined : { record: record.id, value: record };\n },\n draw(context, frame, theme, highlight) {\n const { view } = frame;\n const from = seedsOf(highlight);\n if (fresh || from.length !== seeds.length || from.some((id, i) => id !== seeds[i])) {\n // A route that the looks do not show brings no box into the focus. The looks get the state of a picture with no focus.\n const plain: PaintState = { zoom: view.k, highlight };\n const shown = (route: PictureRoute): boolean => looks.route(route, routeState(route, plain), theme) !== undefined;\n const next = from.length === 0 ? undefined : focusOf(index, from, { routes: shown });\n if (fresh || frame.settle) fades.clear();\n else fadeTo(next);\n seeds = from;\n focus = next;\n fresh = false;\n }\n if (frame.settle) fades.clear();\n for (const [key, fade] of fades) {\n fade.value = approach(fade.value, fade.goal, frame.seconds, FOCUS_FADE);\n if (fade.value === fade.goal) fades.delete(key);\n }\n const state: PaintState = {\n zoom: view.k,\n highlight,\n focus,\n visible: { x: (0 - view.x) / view.k, y: (0 - view.y) / view.k, w: frame.width / view.k, h: frame.height / view.k },\n measure: (font, text) => widthOf(context, font, text),\n fade: fades.size === 0 ? undefined : (key, goal) => fades.get(key)?.value ?? goal,\n };\n last = { theme, state };\n drawShapes(context, paintPicture(index, looks, theme, state), view);\n return fades.size > 0;\n },\n setPicture(next) {\n index = indexPicture(next);\n bounds = pictureBounds(next) ?? NO_BOUNDS;\n fades.clear();\n fresh = true;\n last = undefined;\n },\n setFocus(records) {\n asked = records === undefined ? undefined : [...records];\n },\n dispose() {\n fades.clear();\n widths.clear();\n last = undefined;\n },\n };\n}\n","import { rectCenter, type Rect } from \"@mark1russell7/layout-contract\";\nimport { KEY_PART, KEY_ZOOM } from \"../keys.ts\";\nimport { panView, zoomView, type PictureView, type ZoomLimits } from \"./camera.ts\";\n\n/** What a key does on a flat picture: it moves the camera to a view, or it shows a view by its name. */\nexport type PictureKeyAction = { readonly type: \"move\"; readonly to: PictureView } | { readonly type: \"view\"; readonly view: string };\n\n/** The keys of a flat picture. */\nexport interface PictureKeyOptions {\n /** The name of the view of the keys `Home` and `0`. */\n readonly home: string;\n /** The name of the view of each other key, for example `{ f: \"focus\" }`. A letter has no case. */\n readonly views?: Readonly<Record<string, string>> | undefined;\n /** The limits of the zoom. The default is `ZOOM_LIMITS`. */\n readonly limits?: ZoomLimits | undefined;\n}\n\n/**\n * This function gives the action of a key on a flat picture, or `undefined` for a key with no action.\n *\n * `area` is the part of the screen that shows the picture. `freeArea` gives it.\n * An arrow key moves the camera by the part `KEY_PART` of the smaller side of the area.\n * The keys `+` and `-` zoom at the middle of the area, by the factor of one step of a key on a 3D stage.\n * The keys `Home` and `0` show the home view.\n */\nexport function pictureKeyAction(key: string, now: PictureView, area: Rect, options: PictureKeyOptions): PictureKeyAction | undefined {\n const step = Math.min(area.w, area.h) * KEY_PART;\n const middle = rectCenter(area);\n switch (key) {\n // The camera moves in the direction of the arrow, so the picture moves in the opposite direction.\n case \"ArrowLeft\":\n return { type: \"move\", to: panView(now, step, 0) };\n case \"ArrowRight\":\n return { type: \"move\", to: panView(now, 0 - step, 0) };\n case \"ArrowUp\":\n return { type: \"move\", to: panView(now, 0, step) };\n case \"ArrowDown\":\n return { type: \"move\", to: panView(now, 0, 0 - step) };\n case \"+\":\n case \"=\":\n return { type: \"move\", to: zoomView(now, middle, 1 / KEY_ZOOM, options.limits) };\n case \"-\":\n case \"_\":\n return { type: \"move\", to: zoomView(now, middle, KEY_ZOOM, options.limits) };\n case \"Home\":\n case \"0\":\n return { type: \"view\", view: options.home };\n default: {\n const view = key.length === 1 ? options.views?.[key.toLowerCase()] : undefined;\n return view === undefined ? undefined : { type: \"view\", view };\n }\n }\n}\n","import type { Point } from \"@mark1russell7/layout-contract\";\nimport { CLICK_DISTANCE, isClick } from \"../highlight.ts\";\nimport { panView, pinchView, ZOOM_LIMITS, type PictureView, type ZoomLimits } from \"./camera.ts\";\n\n/** The pointers that are down on a picture: a mouse button, a pen or each finger of a hand. */\nexport interface Pointers {\n /** The screen position of each pointer that is down, by the id of the pointer. */\n readonly at: ReadonlyMap<number, Point>;\n /** The position where the first pointer went down. */\n readonly start: Point | undefined;\n /** This value is true after a second pointer went down. The pointers then make no click. */\n readonly many: boolean;\n}\n\n/** The pointers of a picture that no pointer is down on. */\nexport const NO_POINTERS: Pointers = { at: new Map(), start: undefined, many: false };\n\n/** A finger moves more than a mouse between down and up. This is the distance of a click for a finger, in CSS pixels. */\nexport const TOUCH_CLICK_DISTANCE = 10;\n\n/** This function gives the pointers after a pointer went down. The first pointer starts a possible click. */\nexport function pointerDown(pointers: Pointers, id: number, at: Point): Pointers {\n const next = new Map(pointers.at).set(id, at);\n // A pointer that went up outside of the page can go down again with no up between.\n const first = next.size === 1;\n return first ? { at: next, start: at, many: false } : { at: next, start: pointers.start, many: true };\n}\n\n/** The result of `pointerMove`: the pointers and the view after the move. */\nexport interface PointerMoveResult {\n readonly pointers: Pointers;\n readonly view: PictureView;\n}\n\n/**\n * This function gives the pointers and the view after a pointer moved.\n *\n * One pointer moves the picture, so the point of the picture below the pointer stays there.\n * Two pointers make a pinch: `pinchView` gives the view. Three pointers or more do not change the view.\n * A pointer that is not down changes nothing.\n */\nexport function pointerMove(pointers: Pointers, id: number, at: Point, view: PictureView, limits: ZoomLimits = ZOOM_LIMITS): PointerMoveResult {\n const old = pointers.at.get(id);\n if (old === undefined) return { pointers, view };\n const next: Pointers = { ...pointers, at: new Map(pointers.at).set(id, at) };\n if (pointers.at.size === 1) return { pointers: next, view: panView(view, at.x - old.x, at.y - old.y) };\n if (pointers.at.size > 2) return { pointers: next, view };\n for (const [key, other] of pointers.at) {\n if (key !== id) return { pointers: next, view: pinchView(view, [old, other], [at, other], limits) };\n }\n return { pointers: next, view };\n}\n\n/** The result of `pointerUp`: the pointers that stay down, and the answer if the pointer made a click. */\nexport interface PointerUpResult {\n readonly pointers: Pointers;\n /** This value is true when one pointer went down and up at almost the same position. */\n readonly click: boolean;\n}\n\n/**\n * This function gives the pointers after a pointer went up, and tells if the pointer made a click.\n *\n * A click is one pointer that went up not more than `limit` from its start, with no second pointer between.\n * The default of `limit` is `CLICK_DISTANCE`. Use `TOUCH_CLICK_DISTANCE` for a finger.\n */\nexport function pointerUp(pointers: Pointers, id: number, at: Point, limit: number = CLICK_DISTANCE): PointerUpResult {\n if (!pointers.at.has(id)) return { pointers, click: false };\n const rest = new Map(pointers.at);\n rest.delete(id);\n if (rest.size > 0) return { pointers: { ...pointers, at: rest }, click: false };\n return { pointers: NO_POINTERS, click: !pointers.many && pointers.start !== undefined && isClick(pointers.start, at, limit) };\n}\n\n/** This function gives the pointers after the browser stopped a pointer, for example for a gesture of the system. It makes no click. */\nexport function pointerCancel(pointers: Pointers, id: number): Pointers {\n if (!pointers.at.has(id)) return pointers;\n const rest = new Map(pointers.at);\n rest.delete(id);\n return rest.size > 0 ? { ...pointers, at: rest } : NO_POINTERS;\n}\n","import type { PictureContent, PicturePick } from \"./stage.ts\";\n\n/**\n * This function makes one content from a list of contents, for a flat stage that shows them together.\n * An example is a layer of boxes below a layer of routes and a layer of labels.\n *\n * - The first content gives the bounds: the views and the limits of the camera come from it.\n * - The stack draws the contents in their sequence, so the last content is on top.\n * - A pick asks the last content first. The first record that a content gives is the record.\n * - A record that two contents have is one record: each of them gets its highlight.\n * - A content does not get the state of the canvas of an earlier content: the stack restores it.\n * - The stage disposes the stack, and the stack disposes each content.\n */\nexport function stackPictureContents<P, T>(contents: readonly [PictureContent<P, T>, ...PictureContent<P, T>[]]): PictureContent<P, T> {\n const [first] = contents;\n return {\n get bounds() {\n return first.bounds;\n },\n has: (record) => contents.some((content) => content.has(record)),\n pick(at): PicturePick<P> | undefined {\n for (let index = contents.length - 1; index >= 0; index -= 1) {\n const pick = contents[index]?.pick(at);\n if (pick !== undefined) return pick;\n }\n return undefined;\n },\n draw(context, frame, theme, highlight): boolean {\n let active = false;\n // Each content has its picture, also after a content that continues to change.\n for (const content of contents) {\n context.save();\n active = content.draw(context, frame, theme, highlight) || active;\n context.restore();\n }\n return active;\n },\n dispose(): void {\n for (const content of contents) content.dispose?.();\n },\n };\n}\n","import { rectCenter, type Point, type Rect } from \"@mark1russell7/layout-contract\";\nimport { CLICK_DISTANCE, highlightOf, NO_HIGHLIGHTS, type Highlight, type Highlights } from \"../highlight.ts\";\nimport { lessMotion, MOVE_TIME } from \"../motion.ts\";\nimport { aimAll, type AimFrame, type PictureAim } from \"./aim.ts\";\nimport {\n clampZoom,\n freeArea,\n keepRect,\n pictureMoveAt,\n sameView,\n toPicture,\n UNIT_VIEW,\n viewAt,\n wheelFactor,\n ZOOM_LIMITS,\n zoomLimitsFor,\n zoomView,\n type Insets,\n type PictureMove,\n type PictureView,\n type ZoomLimits,\n} from \"./camera.ts\";\nimport { pictureKeyAction } from \"./keys.ts\";\nimport { NO_POINTERS, pointerCancel, pointerDown, pointerMove, pointerUp, TOUCH_CLICK_DISTANCE, type Pointers } from \"./pointers.ts\";\n\n/** The record below the pointer of a flat picture: its name, and the value that the content gives for it. */\nexport interface PicturePick<P> {\n /** The name of the record. The highlights of the stage use this name. */\n readonly record: string;\n /** The value of the record for the page, for example its kind and its source. */\n readonly value: P;\n}\n\n/** The position of a pointer on a flat picture, for the pick of a content. */\nexport interface PickAt {\n /** The point of the picture below the pointer. */\n readonly point: Point;\n /** The position of the pointer on the screen, in CSS pixels from the top left corner of the picture. */\n readonly screen: Point;\n /** The view of the camera. */\n readonly view: PictureView;\n /** The distance from the pointer at which a thin part is below the pointer, in CSS pixels. A finger has a larger distance than a mouse. */\n readonly slack: number;\n}\n\n/** One picture of a flat stage, for the drawing of its content. */\nexport interface PictureFrame {\n /** The view of the camera. */\n readonly view: PictureView;\n /** The width of the picture, in CSS pixels. */\n readonly width: number;\n /** The height of the picture, in CSS pixels. */\n readonly height: number;\n /** The part of the picture that the page does not cover, in CSS pixels. */\n readonly area: Rect;\n /** The number of pixels of the canvas for one CSS pixel. */\n readonly pixelRatio: number;\n /** The time since the last picture, in seconds. */\n readonly seconds: number;\n /**\n * This value is true for the first picture of a content, and for a person who asks for less motion.\n * Each change then has no time: the content sets each value to its goal immediately.\n */\n readonly settle: boolean;\n}\n\n/**\n * The content of a flat stage: what the stage draws, and what the stage asks of it.\n * `P` is the type of the value of a pick, and `T` is the type of the theme.\n */\nexport interface PictureContent<P, T> {\n /** The bounds of the content, in the unit of the picture. The views and the limits of the camera come from them. */\n readonly bounds: Rect;\n /** This function tells if the content has a record with a name. */\n has(record: string): boolean;\n /** This function gives the record below a pointer, or `undefined` for no record. */\n pick(at: PickAt): PicturePick<P> | undefined;\n /**\n * This function draws the content on a clear canvas. The unit of the context is the CSS pixel: the view is in the frame.\n * `highlight` gives the highlight of a record. The function gives true while a part continues to change.\n * The stage then makes the next picture.\n */\n draw(context: CanvasRenderingContext2D, frame: PictureFrame, theme: T, highlight: (record: string) => Highlight): boolean;\n /** This function releases what the content keeps, for example its images. */\n dispose?(): void;\n}\n\n/** The options of a flat stage. */\nexport interface PictureStageOptions<P, T> {\n /** The first content. The stage disposes each content that it gets. */\n readonly content: PictureContent<P, T>;\n readonly theme: T;\n /** The name of the picture for a screen reader. */\n readonly label: string;\n /** The views of the stage, each with a name. The view `all` shows all of the picture, if the options do not give a different one. */\n readonly views?: Readonly<Record<string, PictureAim>> | undefined;\n /** The name of the first view. The keys `Home` and `0` show it. The default is `all`. */\n readonly home?: string | undefined;\n /** The name of the view of a key, for example `{ f: \"focus\" }`. A letter has no case. */\n readonly keys?: Readonly<Record<string, string>> | undefined;\n /** The limits of the zoom. The default is `ZOOM_LIMITS`. A very large picture gets a smaller least zoom, so a person can show all of it. */\n readonly limits?: ZoomLimits | undefined;\n /** The parts of the picture that the page covers, from each edge, in CSS pixels. */\n readonly insets?: Partial<Insets> | undefined;\n /**\n * When the wheel changes the zoom. With `in-use`, the wheel moves the page until a person uses the picture.\n * With `always`, the wheel changes the zoom at each time. The default is `in-use`. A pinch on a touch pad changes the zoom always.\n */\n readonly wheel?: \"always\" | \"in-use\" | undefined;\n /** The stage starts this function when the pointer goes to a different record, or to no record. */\n readonly onHover?: ((pick: P | undefined) => void) | undefined;\n /** The stage starts this function when a person selects a record with the pointer, or selects no record. */\n readonly onSelect?: ((pick: P | undefined) => void) | undefined;\n /** The stage starts this function after a change of the view, one time for each picture at most. */\n readonly onView?: ((view: PictureView) => void) | undefined;\n}\n\n/** A flat stage in a page: one canvas with a camera that a person moves, and one content. */\nexport interface PictureStage<P, T> {\n /** The canvas of the stage. It is in the container. */\n readonly canvas: HTMLCanvasElement;\n /** This function shows a different content, and disposes the old content. The view stays if a person moved it. */\n setContent(content: PictureContent<P, T>): void;\n /** This function changes the colors. */\n setTheme(theme: T): void;\n /** This function moves the camera to a view: a name of the options, or an aim. `animate` has the default true. */\n setView(view: string | PictureAim, animate?: boolean): void;\n /** This function tells the stage which parts of the picture the page covers. The camera goes to its view again if no person moved it. */\n setInsets(insets: Partial<Insets>): void;\n /** This function gives the view of the camera. */\n view(): PictureView;\n /** This function gives the part of the picture that the page does not cover, in CSS pixels. */\n area(): Rect;\n /** This function changes the zoom by a factor, at the middle of the free area. Use it for the buttons of a page. `animate` has the default true. */\n zoomBy(factor: number, animate?: boolean): void;\n /** This function highlights records by their names, as the pointer does. An empty list removes the highlights. */\n highlight(records: readonly string[]): void;\n /** This function selects one record by its name, or no record. It does not start `onSelect`. */\n select(record: string | undefined): void;\n /**\n * This function makes a new picture. Use it after a change of the content.\n * After a change of the bounds of the content, the camera goes to its view again if no person moved it.\n */\n refresh(): void;\n /** This function removes the canvas, and disposes the content. */\n dispose(): void;\n}\n\n/** The distance from a mouse at which a thin part is below the pointer, in CSS pixels. */\nexport const PICK_SLACK = 5;\n\n/** The distance from a finger or a pen at which a thin part is below the pointer, in CSS pixels. */\nexport const TOUCH_PICK_SLACK = 12;\n\n/** The factor of the zoom for a double click. */\nexport const DOUBLE_CLICK_ZOOM = 2;\n\n/** The largest number of pixels of the canvas for one CSS pixel. A larger number costs memory, and a person does not see it. */\nconst LARGEST_PIXEL_RATIO = 3;\n\n/**\n * This function makes a flat stage in a container of a page. The stage fills the container, so give the container a size.\n *\n * A person moves the picture with a drag, and changes the zoom with the wheel, with two fingers or with a double click.\n * A click selects the record below the pointer. With the keyboard, the arrow keys move the camera, `+` and `-` change the zoom,\n * and `Home` shows the first view. The stage makes a picture only after a change.\n *\n * The function gives `undefined` when the browser gives no 2D context for a canvas. It does not throw.\n */\nexport function createPictureStage<P, T>(container: HTMLElement, options: PictureStageOptions<P, T>): PictureStage<P, T> | undefined {\n const canvas = container.ownerDocument.createElement(\"canvas\");\n const made = canvas.getContext(\"2d\");\n if (made === null) return undefined;\n // The functions below use this constant: its type has no `null`.\n const context: CanvasRenderingContext2D = made;\n\n canvas.style.display = \"block\";\n canvas.style.width = \"100%\";\n canvas.style.height = \"100%\";\n canvas.style.cursor = \"grab\";\n canvas.style.touchAction = \"none\";\n canvas.tabIndex = 0;\n canvas.setAttribute(\"role\", \"application\");\n canvas.setAttribute(\"aria-label\", options.label);\n container.append(canvas);\n\n const views: Readonly<Record<string, PictureAim>> = { all: aimAll(), ...options.views };\n const home = options.home ?? \"all\";\n const baseLimits = options.limits ?? ZOOM_LIMITS;\n const wheel = options.wheel ?? \"in-use\";\n\n let content = options.content;\n let theme = options.theme;\n let insets: Partial<Insets> = options.insets ?? {};\n let highlights: Highlights = NO_HIGHLIGHTS;\n /** The size of the picture, in CSS pixels. */\n let width = 0;\n let height = 0;\n let pixelRatio = 1;\n /** This value is true after the container gave a size. A stage with no size makes no picture. */\n let sized = false;\n let area: Rect = freeArea({ width, height }, insets);\n let limits: ZoomLimits = baseLimits;\n let view: PictureView = UNIT_VIEW;\n /** The view that the camera has, or goes to: a name of the views, or an aim. */\n let aim: string | PictureAim = home;\n let move: PictureMove | undefined;\n /** This value is true after a person moved the view. Then a new size of the container does not aim the camera again. */\n let moved = false;\n /** This value is true until the content had a picture with no time. */\n let settle = true;\n /** This value is true while a person uses the picture. The wheel then changes the zoom. */\n let inUse = false;\n let pointers: Pointers = NO_POINTERS;\n /** This value is true while a pointer that is down moves the picture. */\n let dragging = false;\n /** The view that `onView` got last. */\n let told: PictureView | undefined;\n let frame = 0;\n let lastTime = 0;\n let disposed = false;\n\n const invalidate = (): void => {\n if (frame === 0 && !disposed) frame = requestAnimationFrame(tick);\n };\n\n const setCursor = (): void => {\n canvas.style.cursor = dragging ? \"grabbing\" : highlights.hovered === undefined ? \"grab\" : \"pointer\";\n };\n\n /** The bounds of the content at the last `setArea`. `refresh` finds a change of the bounds with them. */\n let fitted: Rect = content.bounds;\n\n /** This function sets the free area and the limits of the zoom, from the size, the insets and the content. */\n const setArea = (): void => {\n area = freeArea({ width, height }, insets);\n fitted = content.bounds;\n limits = zoomLimitsFor(fitted, area, baseLimits);\n };\n\n const aimFrame = (): AimFrame => ({ bounds: content.bounds, area, view, limits });\n\n /** This function moves the camera to a view, with a move or immediately. A picture with no size has no move. */\n const glide = (to: PictureView, animate: boolean): void => {\n if (animate && sized && !lessMotion() && !sameView(view, to)) {\n move = { from: view, to, start: performance.now(), duration: MOVE_TIME };\n } else {\n move = undefined;\n view = to;\n }\n invalidate();\n };\n\n const goTo = (next: string | PictureAim, animate: boolean): void => {\n const found = typeof next === \"string\" ? views[next] : next;\n if (found === undefined) return;\n aim = next;\n moved = false;\n glide(found(aimFrame()), animate);\n };\n\n /**\n * This function sets a view that a person made, immediately. The zoom stays in its limits, and a part of the picture stays in the free area.\n * A zoom that the limits change keeps the point of the picture at the middle of the free area.\n */\n const hold = (base: PictureView): void => {\n const k = clampZoom(base.k, limits);\n const middle = rectCenter(area);\n move = undefined;\n view = keepRect(k === base.k ? base : viewAt(toPicture(base, middle), middle, k), content.bounds, area);\n invalidate();\n };\n\n /** This function sets a view that a person made with a pointer, the wheel or a key. */\n const steer = (next: PictureView): void => {\n moved = true;\n hold(next);\n };\n\n /**\n * This function sets the size of the canvas from the size of the container and the pixels of the screen.\n * It gives true after a change. A container with no size changes nothing.\n */\n const setSize = (): boolean => {\n const wide = container.clientWidth;\n const tall = container.clientHeight;\n if (wide === 0 || tall === 0) return false;\n const ratio = Math.min(globalThis.devicePixelRatio > 0 ? globalThis.devicePixelRatio : 1, LARGEST_PIXEL_RATIO);\n if (wide === width && tall === height && ratio === pixelRatio) return false;\n width = wide;\n height = tall;\n pixelRatio = ratio;\n canvas.width = Math.round(wide * ratio);\n canvas.height = Math.round(tall * ratio);\n return true;\n };\n\n /** This function sets the camera after a change of the size of the picture. */\n const fitAgain = (): void => {\n const before = area;\n const first = !sized;\n sized = true;\n setArea();\n if (first || !moved) {\n goTo(aim, false);\n return;\n }\n // A person moved the view: the point of the picture at the middle of the free area stays at the middle.\n const base = move?.to ?? view;\n hold(viewAt(toPicture(base, rectCenter(before)), rectCenter(area), base.k));\n };\n\n function tick(now: number): void {\n frame = 0;\n if (disposed) return;\n // The pixels of the screen change with no event when a window goes to a different screen.\n if (setSize()) fitAgain();\n if (!sized) return;\n const seconds = lastTime === 0 ? 1 / 60 : Math.min((now - lastTime) / 1000, 0.1);\n let active = false;\n if (move !== undefined) {\n const step = pictureMoveAt(move, now);\n view = step.view;\n if (step.done) move = undefined;\n active = !step.done;\n }\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.clearRect(0, 0, canvas.width, canvas.height);\n context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n const shown = highlights;\n const drawing = content.draw(context, { view, width, height, area, pixelRatio, seconds, settle: settle || lessMotion() }, theme, (record) => highlightOf(shown, record));\n settle = false;\n active = drawing || active;\n lastTime = active ? now : 0;\n if (told === undefined || !sameView(told, view)) {\n told = view;\n options.onView?.(view);\n }\n if (active) invalidate();\n }\n\n /** This function gives the position of a pointer in the picture, in CSS pixels from its top left corner. */\n const positionOf = (event: { readonly clientX: number; readonly clientY: number }): Point => {\n const box = canvas.getBoundingClientRect();\n return { x: event.clientX - box.left, y: event.clientY - box.top };\n };\n\n const pickAt = (screen: Point, slack: number): PicturePick<P> | undefined => content.pick({ point: toPicture(view, screen), screen, view, slack });\n\n const setHover = (pick: PicturePick<P> | undefined): void => {\n const record = pick?.record;\n if (record === highlights.hovered) return;\n highlights = { ...highlights, hovered: record };\n setCursor();\n invalidate();\n options.onHover?.(pick?.value);\n };\n\n const listeners = new AbortController();\n const signal = listeners.signal;\n canvas.addEventListener(\n \"pointerdown\",\n (event) => {\n if (event.button !== 0) return;\n inUse = true;\n canvas.focus({ preventScroll: true });\n try {\n // With the capture, a drag continues when the pointer goes out of the canvas.\n canvas.setPointerCapture(event.pointerId);\n } catch {\n // A pointer that the browser does not know has no capture. The drag then ends at the edge of the canvas.\n }\n if (move !== undefined) {\n // A pointer stops a move, as a hand stops a thing that moves.\n move = undefined;\n moved = true;\n }\n pointers = pointerDown(pointers, event.pointerId, positionOf(event));\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointermove\",\n (event) => {\n if (pointers.at.has(event.pointerId)) {\n const next = pointerMove(pointers, event.pointerId, positionOf(event), view, limits);\n pointers = next.pointers;\n if (sameView(next.view, view)) return;\n dragging = true;\n setCursor();\n steer(next.view);\n return;\n }\n // A finger is on the picture only while it is down, so it has no record below it before a click.\n if (event.pointerType !== \"touch\" && pointers.at.size === 0) setHover(pickAt(positionOf(event), PICK_SLACK));\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointerup\",\n (event) => {\n if (!pointers.at.has(event.pointerId)) return;\n const mouse = event.pointerType === \"mouse\";\n const position = positionOf(event);\n const up = pointerUp(pointers, event.pointerId, position, mouse ? CLICK_DISTANCE : TOUCH_CLICK_DISTANCE);\n pointers = up.pointers;\n if (pointers.at.size === 0) {\n dragging = false;\n setCursor();\n }\n if (!up.click) return;\n const pick = pickAt(position, mouse ? PICK_SLACK : TOUCH_PICK_SLACK);\n highlights = { ...highlights, selected: pick?.record };\n invalidate();\n options.onSelect?.(pick?.value);\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointercancel\",\n (event) => {\n pointers = pointerCancel(pointers, event.pointerId);\n if (pointers.at.size > 0) return;\n dragging = false;\n setCursor();\n },\n { signal },\n );\n canvas.addEventListener(\n \"pointerleave\",\n (event) => {\n setHover(undefined);\n if (event.pointerType === \"mouse\") inUse = false;\n },\n { signal },\n );\n canvas.addEventListener(\n \"blur\",\n () => {\n inUse = false;\n },\n { signal },\n );\n canvas.addEventListener(\n \"wheel\",\n (event) => {\n // A browser gives a pinch on a touch pad as a wheel with the key `Control`. Without the stage, it changes the zoom of the page.\n if (wheel === \"in-use\" && !inUse && !event.ctrlKey) return;\n event.preventDefault();\n steer(zoomView(view, positionOf(event), wheelFactor(event.deltaY, event.deltaMode, event.ctrlKey), limits));\n },\n { signal, passive: false },\n );\n canvas.addEventListener(\n \"dblclick\",\n (event) => {\n event.preventDefault();\n moved = true;\n glide(keepRect(zoomView(view, positionOf(event), DOUBLE_CLICK_ZOOM, limits), content.bounds, area), true);\n },\n { signal },\n );\n canvas.addEventListener(\n \"keydown\",\n (event) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const action = pictureKeyAction(event.key, view, area, { home, views: options.keys, limits });\n if (action === undefined) return;\n event.preventDefault();\n inUse = true;\n if (action.type === \"view\") goTo(action.view, true);\n else steer(action.to);\n },\n { signal },\n );\n\n const observer = new ResizeObserver(() => {\n if (!disposed && setSize()) fitAgain();\n });\n\n if (setSize()) fitAgain();\n observer.observe(container);\n invalidate();\n\n return {\n canvas,\n setContent(next: PictureContent<P, T>): void {\n if (disposed || next === content) return;\n content.dispose?.();\n content = next;\n const selected = highlights.selected !== undefined && content.has(highlights.selected) ? highlights.selected : undefined;\n highlights = { ...highlights, hovered: undefined, selected };\n settle = true;\n setCursor();\n setArea();\n if (moved) hold(move?.to ?? view);\n else goTo(aim, false);\n },\n setTheme(next: T): void {\n theme = next;\n invalidate();\n },\n setView(next: string | PictureAim, animate: boolean = true): void {\n goTo(next, animate);\n },\n setInsets(next: Partial<Insets>): void {\n insets = next;\n setArea();\n if (!sized) return;\n if (moved) hold(move?.to ?? view);\n else goTo(aim, true);\n },\n view: () => view,\n area: () => area,\n zoomBy(factor: number, animate: boolean = true): void {\n moved = true;\n // A second step of a button starts from the goal of the first step, so each step has its full factor.\n glide(keepRect(zoomView(move?.to ?? view, rectCenter(area), factor, limits), content.bounds, area), animate);\n },\n highlight(records: readonly string[]): void {\n highlights = { ...highlights, highlighted: new Set(records) };\n invalidate();\n },\n select(record: string | undefined): void {\n highlights = { ...highlights, selected: record };\n invalidate();\n },\n refresh(): void {\n if (disposed) return;\n // The record below the pointer can go with a change of the content.\n if (highlights.hovered !== undefined && !content.has(highlights.hovered)) setHover(undefined);\n const bounds = content.bounds;\n if (bounds.x !== fitted.x || bounds.y !== fitted.y || bounds.w !== fitted.w || bounds.h !== fitted.h) {\n setArea();\n if (sized) {\n if (moved) hold(move?.to ?? view);\n else goTo(aim, true);\n }\n }\n invalidate();\n },\n dispose(): void {\n if (disposed) return;\n disposed = true;\n cancelAnimationFrame(frame);\n observer.disconnect();\n listeners.abort();\n content.dispose?.();\n can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AAW;EACb;EACA,UAAgB;GACd,IAAI,UAAU;GACd,WAAW;GACX,qBAAqB,KAAK;GAC1B,SAAS,WAAW;GACpB,UAAU,MAAM;GAChB,QAAQ,UAAU;GAClB,OAAO,OAAO;EAChB;CACF;AACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/visuals",
4
- "version": "0.3.7",
4
+ "version": "0.3.8",
5
5
  "description": "3D stages for data on three.js: a camera that a person moves, views by name, picking, highlights and themes, a globe of the Earth, and the shared marks of the viewers as data.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -81,7 +81,7 @@
81
81
  ],
82
82
  "dependencies": {
83
83
  "@mark1russell7/geo": "^0.5.0",
84
- "@mark1russell7/layout-contract": "^0.10.4"
84
+ "@mark1russell7/layout-contract": "^0.10.5"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "three": ">=0.187.0"