ngwr 16.3.0 → 16.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/carousel/styles/_index.scss +53 -1
  2. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  3. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  4. package/fesm2022/ngwr-carousel-testing.mjs +24 -1
  5. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  6. package/fesm2022/ngwr-carousel.mjs +67 -4
  7. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  8. package/fesm2022/ngwr-cascader.mjs +10 -23
  9. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  10. package/fesm2022/ngwr-context-menu.mjs +16 -1
  11. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  12. package/fesm2022/ngwr-dropdown.mjs +18 -4
  13. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  14. package/fesm2022/ngwr-file-upload.mjs +7 -3
  15. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  16. package/fesm2022/ngwr-graph-testing.mjs +27 -0
  17. package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
  18. package/fesm2022/ngwr-graph.mjs +568 -7
  19. package/fesm2022/ngwr-graph.mjs.map +1 -1
  20. package/fesm2022/ngwr-i18n-ar.mjs +8 -4
  21. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  22. package/fesm2022/ngwr-i18n-cs.mjs +8 -4
  23. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  24. package/fesm2022/ngwr-i18n-de.mjs +8 -4
  25. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  26. package/fesm2022/ngwr-i18n-en.mjs +8 -4
  27. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  28. package/fesm2022/ngwr-i18n-es.mjs +8 -4
  29. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  30. package/fesm2022/ngwr-i18n-fr.mjs +8 -4
  31. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  32. package/fesm2022/ngwr-i18n-he.mjs +8 -4
  33. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  34. package/fesm2022/ngwr-i18n-hi.mjs +8 -4
  35. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-id.mjs +8 -4
  37. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-it.mjs +8 -4
  39. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-ja.mjs +8 -4
  41. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-ko.mjs +8 -4
  43. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-nl.mjs +8 -4
  45. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-pl.mjs +8 -4
  47. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-pt.mjs +8 -4
  49. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-ru.mjs +8 -4
  51. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-sv.mjs +8 -4
  53. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-tr.mjs +8 -4
  55. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-uk.mjs +8 -4
  57. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-vi.mjs +8 -4
  59. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  60. package/fesm2022/ngwr-i18n-zh-tw.mjs +8 -4
  61. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-zh.mjs +8 -4
  63. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  64. package/fesm2022/ngwr-lightbox.mjs +2 -2
  65. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  66. package/fesm2022/ngwr-list.mjs +2 -2
  67. package/fesm2022/ngwr-list.mjs.map +1 -1
  68. package/fesm2022/ngwr-pagination.mjs +1 -0
  69. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  70. package/fesm2022/ngwr-schema-form.mjs +1 -0
  71. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  72. package/fesm2022/ngwr-select.mjs +100 -3
  73. package/fesm2022/ngwr-select.mjs.map +1 -1
  74. package/fesm2022/ngwr-sortable-list.mjs +2 -2
  75. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  76. package/fesm2022/ngwr-table-testing.mjs +71 -3
  77. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  78. package/fesm2022/ngwr-table.mjs +171 -11
  79. package/fesm2022/ngwr-table.mjs.map +1 -1
  80. package/fesm2022/ngwr-tour-testing.mjs +13 -1
  81. package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
  82. package/fesm2022/ngwr-tour.mjs +13 -9
  83. package/fesm2022/ngwr-tour.mjs.map +1 -1
  84. package/fesm2022/ngwr-tree.mjs +12 -1
  85. package/fesm2022/ngwr-tree.mjs.map +1 -1
  86. package/fesm2022/ngwr-utils.mjs +64 -1
  87. package/fesm2022/ngwr-utils.mjs.map +1 -1
  88. package/fesm2022/ngwr-version.mjs +1 -1
  89. package/fesm2022/ngwr-version.mjs.map +1 -1
  90. package/graph/styles/_index.scss +87 -0
  91. package/i18n/ar.json +8 -4
  92. package/i18n/cs.json +8 -4
  93. package/i18n/de.json +8 -4
  94. package/i18n/en.json +8 -4
  95. package/i18n/es.json +8 -4
  96. package/i18n/fr.json +8 -4
  97. package/i18n/he.json +8 -4
  98. package/i18n/hi.json +8 -4
  99. package/i18n/id.json +8 -4
  100. package/i18n/it.json +8 -4
  101. package/i18n/ja.json +8 -4
  102. package/i18n/ko.json +8 -4
  103. package/i18n/nl.json +8 -4
  104. package/i18n/pl.json +8 -4
  105. package/i18n/pt.json +8 -4
  106. package/i18n/ru.json +8 -4
  107. package/i18n/sv.json +8 -4
  108. package/i18n/tr.json +8 -4
  109. package/i18n/uk.json +8 -4
  110. package/i18n/vi.json +8 -4
  111. package/i18n/zh-TW.json +8 -4
  112. package/i18n/zh.json +8 -4
  113. package/llms-full.txt +4 -4
  114. package/llms.txt +57 -24
  115. package/package.json +1 -1
  116. package/schematics/collection.json +5 -0
  117. package/schematics/eject/index.js +158 -0
  118. package/schematics/eject/schema.js +8 -0
  119. package/schematics/eject/schema.json +24 -0
  120. package/schematics/eject/source.js +295 -0
  121. package/schematics/use/symbol-map.json +1 -0
  122. package/select/styles/_index.scss +13 -0
  123. package/skills/ngwr/SKILL.md +30 -3
  124. package/skills/ngwr/references/catalog.md +1 -1
  125. package/table/styles/_index.scss +24 -0
  126. package/theme/styles/_focus.scss +11 -1
  127. package/types/ngwr-carousel-testing.d.ts +27 -6
  128. package/types/ngwr-carousel.d.ts +42 -6
  129. package/types/ngwr-cascader.d.ts +3 -5
  130. package/types/ngwr-context-menu.d.ts +2 -0
  131. package/types/ngwr-dropdown.d.ts +2 -0
  132. package/types/ngwr-file-upload.d.ts +8 -2
  133. package/types/ngwr-graph-testing.d.ts +28 -0
  134. package/types/ngwr-graph.d.ts +247 -91
  135. package/types/ngwr-select.d.ts +37 -0
  136. package/types/ngwr-table-testing.d.ts +52 -1
  137. package/types/ngwr-table.d.ts +101 -9
  138. package/types/ngwr-tour-testing.d.ts +10 -0
  139. package/types/ngwr-tour.d.ts +11 -2
  140. package/types/ngwr-tree.d.ts +2 -0
  141. package/types/ngwr-utils.d.ts +79 -1
  142. package/types/ngwr-version.d.ts +1 -1
@@ -1,8 +1,9 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, Directive, LOCALE_ID, TemplateRef, ViewEncapsulation, computed, contentChild, effect, inject, input, isDevMode, linkedSignal, output, signal } from "@angular/core";
3
- import { NgTemplateOutlet } from "@angular/common";
2
+ import { Component, DestroyRef, Directive, LOCALE_ID, PLATFORM_ID, TemplateRef, ViewEncapsulation, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, effect, inject, input, isDevMode, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
4
4
  import { wrCheckStyles, wrNumAttr } from "ngwr/utils";
5
5
  import { WrI18n, useI18nFormatter, useI18nText } from "ngwr/i18n";
6
+ import { WrPlatform } from "ngwr/platform";
6
7
  import { Directionality } from "@angular/cdk/bidi";
7
8
  /**
8
9
  * @license
@@ -554,10 +555,82 @@ var WrLayeredGraphLayout = class extends WrGraphLayout {
554
555
  * Use of this source code is governed by an MIT-style license that can be
555
556
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
556
557
  */
558
+ const KEEP_VISIBLE = 48;
559
+ function clampAxis(offset, origin, extent, room) {
560
+ const keep = Math.min(KEEP_VISIBLE, extent, room);
561
+ const min = keep - extent - origin;
562
+ const max = room - keep - origin;
563
+ return Math.min(max, Math.max(min, offset));
564
+ }
565
+ const IDENTITY = {
566
+ x: 0,
567
+ y: 0,
568
+ k: 1
569
+ };
570
+ function roundZoom(value) {
571
+ return Math.round(value * 1e4) / 1e4;
572
+ }
573
+ function clampZoom(value, min, max) {
574
+ return roundZoom(Math.min(max, Math.max(min, Number.isFinite(value) && value > 0 ? value : 1)));
575
+ }
576
+ function zoomAround(from, k, px, py, frame) {
577
+ const ratio = k / from.k;
578
+ const dx = px - frame.originX;
579
+ const dy = py - frame.originY;
580
+ return {
581
+ k,
582
+ x: dx - (dx - from.x) * ratio,
583
+ y: dy - (dy - from.y) * ratio
584
+ };
585
+ }
586
+ function clampPan(at, frame, width, height) {
587
+ if (frame.width <= 0 || frame.height <= 0) return at;
588
+ return {
589
+ k: at.k,
590
+ x: clampAxis(at.x, frame.originX, width * at.k, frame.width),
591
+ y: clampAxis(at.y, frame.originY, height * at.k, frame.height)
592
+ };
593
+ }
594
+ function fitTransform(frame, insets, width, height, min, max) {
595
+ const roomX = Math.max(0, frame.width - insets.left - insets.right);
596
+ const roomY = Math.max(0, frame.height - insets.top - insets.bottom);
597
+ const k = clampZoom(Math.min(1, width > 0 ? roomX / width : 1, height > 0 ? roomY / height : 1), min, max);
598
+ return {
599
+ k,
600
+ x: insets.left + (roomX - width * k) / 2 - frame.originX,
601
+ y: insets.top + (roomY - height * k) / 2 - frame.originY
602
+ };
603
+ }
604
+ /**
605
+ * @license
606
+ *
607
+ * Use of this source code is governed by an MIT-style license that can be
608
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
609
+ */
557
610
  const DEFAULT_NODE_WIDTH = 160;
558
611
  const DEFAULT_NODE_HEIGHT = 48;
559
612
  const ARROW_SIZE = 6;
613
+ const DEFAULT_MIN_ZOOM = .25;
614
+ const DEFAULT_MAX_ZOOM = 4;
615
+ const ZOOM_STEP = 1.25;
616
+ const PAN_STEP = 40;
617
+ const DRAG_THRESHOLD = 3;
618
+ const WHEEL_RATE = .01;
619
+ const WHEEL_MAX = 24;
620
+ const WHEEL_LINE = 16;
621
+ const INTERACTIVE = "a[href], button, input, select, textarea, summary, [tabindex], [contenteditable], [draggable=\"true\"]";
560
622
  let graphUid = 0;
623
+ const NO_FRAME = {
624
+ left: 0,
625
+ top: 0,
626
+ width: 0,
627
+ height: 0,
628
+ originX: 0,
629
+ originY: 0
630
+ };
631
+ function sameTransform(a, b) {
632
+ return a.x === b.x && a.y === b.y && a.k === b.k;
633
+ }
561
634
  function isSize(value) {
562
635
  return typeof value === "number" && Number.isFinite(value) && value > 0;
563
636
  }
@@ -645,11 +718,36 @@ var WrGraph = class WrGraph {
645
718
  transform: wrNumAttr(48)
646
719
  });
647
720
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
721
+ zoomable = input(false, {
722
+ ...ngDevMode ? { debugName: "zoomable" } : /* istanbul ignore next */ {},
723
+ transform: booleanAttribute
724
+ });
725
+ wheelZoom = input(false, {
726
+ ...ngDevMode ? { debugName: "wheelZoom" } : /* istanbul ignore next */ {},
727
+ transform: booleanAttribute
728
+ });
729
+ zoom = model(1, ...ngDevMode ? [{ debugName: "zoom" }] : /* istanbul ignore next */ []);
730
+ minZoom = input(DEFAULT_MIN_ZOOM, {
731
+ ...ngDevMode ? { debugName: "minZoom" } : /* istanbul ignore next */ {},
732
+ transform: wrNumAttr(DEFAULT_MIN_ZOOM)
733
+ });
734
+ maxZoom = input(DEFAULT_MAX_ZOOM, {
735
+ ...ngDevMode ? { debugName: "maxZoom" } : /* istanbul ignore next */ {},
736
+ transform: wrNumAttr(DEFAULT_MAX_ZOOM)
737
+ });
738
+ zoomInLabel = input(null, ...ngDevMode ? [{ debugName: "zoomInLabel" }] : /* istanbul ignore next */ []);
739
+ zoomOutLabel = input(null, ...ngDevMode ? [{ debugName: "zoomOutLabel" }] : /* istanbul ignore next */ []);
740
+ fitLabel = input(null, ...ngDevMode ? [{ debugName: "fitLabel" }] : /* istanbul ignore next */ []);
648
741
  layoutError = output();
649
742
  label = useI18nText(this.ariaLabel, "graph.label", "Graph");
650
743
  parentsText = useI18nFormatter("graph.parents", "Parents: {{names}}.");
651
744
  childrenText = useI18nFormatter("graph.children", "Children: {{names}}.");
745
+ zoomInText = useI18nText(this.zoomInLabel, "graph.zoomIn", "Zoom in");
746
+ zoomOutText = useI18nText(this.zoomOutLabel, "graph.zoomOut", "Zoom out");
747
+ fitText = useI18nText(this.fitLabel, "graph.fit", "Fit to view");
652
748
  nodeTemplate = contentChild(WrGraphNodeTemplate, ...ngDevMode ? [{ debugName: "nodeTemplate" }] : /* istanbul ignore next */ []);
749
+ viewportRef = viewChild("viewport", ...ngDevMode ? [{ debugName: "viewportRef" }] : /* istanbul ignore next */ []);
750
+ stageRef = viewChild("stage", ...ngDevMode ? [{ debugName: "stageRef" }] : /* istanbul ignore next */ []);
653
751
  markerId = `wr-graph-${graphUid++}-arrow`;
654
752
  markerUrl = `url(#${this.markerId})`;
655
753
  arrowSize = ARROW_SIZE;
@@ -657,6 +755,8 @@ var WrGraph = class WrGraph {
657
755
  dir = inject(Directionality, { optional: true });
658
756
  i18n = inject(WrI18n, { optional: true });
659
757
  localeId = inject(LOCALE_ID);
758
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
759
+ reducedMotion = inject(WrPlatform).prefersReducedMotion;
660
760
  isRtl = computed(() => this.dir?.valueSignal() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
661
761
  locale = computed(() => this.i18n?.locale() ?? this.localeId, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
662
762
  defaultSize = computed(() => {
@@ -780,6 +880,49 @@ var WrGraph = class WrGraph {
780
880
  }))
781
881
  };
782
882
  }, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
883
+ bounds = computed(() => {
884
+ const min = isSize(this.minZoom()) ? this.minZoom() : DEFAULT_MIN_ZOOM;
885
+ const max = isSize(this.maxZoom()) ? this.maxZoom() : DEFAULT_MAX_ZOOM;
886
+ return {
887
+ min,
888
+ max: Math.max(min, max)
889
+ };
890
+ }, ...ngDevMode ? [{ debugName: "bounds" }] : /* istanbul ignore next */ []);
891
+ at = signal(IDENTITY, ...ngDevMode ? [{ debugName: "at" }] : /* istanbul ignore next */ []);
892
+ pan = computed(() => {
893
+ const { x, y } = this.at();
894
+ return {
895
+ x,
896
+ y
897
+ };
898
+ }, {
899
+ ...ngDevMode ? { debugName: "pan" } : /* istanbul ignore next */ {},
900
+ equal: (a, b) => a.x === b.x && a.y === b.y
901
+ });
902
+ size = computed(() => {
903
+ const { width, height } = this.view();
904
+ return {
905
+ width,
906
+ height
907
+ };
908
+ }, {
909
+ ...ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {},
910
+ equal: (a, b) => a.width === b.width && a.height === b.height
911
+ });
912
+ stageTransform = computed(() => {
913
+ const at = this.at();
914
+ if (!this.zoomable() || sameTransform(at, IDENTITY)) return null;
915
+ return `translate(${px(at.x)}px, ${px(at.y)}px) scale(${at.k})`;
916
+ }, ...ngDevMode ? [{ debugName: "stageTransform" }] : /* istanbul ignore next */ []);
917
+ atMinZoom = computed(() => this.at().k <= this.bounds().min, ...ngDevMode ? [{ debugName: "atMinZoom" }] : /* istanbul ignore next */ []);
918
+ atMaxZoom = computed(() => this.at().k >= this.bounds().max, ...ngDevMode ? [{ debugName: "atMaxZoom" }] : /* istanbul ignore next */ []);
919
+ panning = signal(false, ...ngDevMode ? [{ debugName: "panning" }] : /* istanbul ignore next */ []);
920
+ animated = signal(false, ...ngDevMode ? [{ debugName: "animated" }] : /* istanbul ignore next */ []);
921
+ moved = false;
922
+ queued = null;
923
+ frameId = null;
924
+ pointers = /* @__PURE__ */ new Map();
925
+ dragging = false;
783
926
  relations = computed(() => {
784
927
  const { nodes } = this.placed();
785
928
  const list = listFormat(this.locale());
@@ -835,6 +978,57 @@ var WrGraph = class WrGraph {
835
978
  this.layoutError.emit(error);
836
979
  });
837
980
  });
981
+ effect(() => {
982
+ const zoom = this.zoom();
983
+ const { min, max } = this.bounds();
984
+ if (!this.zoomable()) return;
985
+ untracked(() => {
986
+ const from = this.current();
987
+ const k = clampZoom(zoom, min, max);
988
+ if (k !== from.k) {
989
+ const frame = this.frame();
990
+ this.moved = true;
991
+ this.commit(this.bounded(zoomAround(from, k, frame.width / 2, frame.height / 2, frame), frame));
992
+ } else if (k !== zoom) this.zoom.set(k);
993
+ });
994
+ });
995
+ effect((onCleanup) => {
996
+ const viewport = this.viewportRef()?.nativeElement;
997
+ if (!this.isBrowser || !viewport || !this.zoomable()) return;
998
+ const controller = new AbortController();
999
+ const { signal: stop } = controller;
1000
+ viewport.addEventListener("wheel", (event) => this.onWheel(event), {
1001
+ signal: stop,
1002
+ passive: false
1003
+ });
1004
+ viewport.addEventListener("keydown", (event) => this.onKeydown(event), { signal: stop });
1005
+ viewport.addEventListener("pointerdown", (event) => this.onPointerDown(event, viewport), { signal: stop });
1006
+ viewport.addEventListener("pointermove", (event) => this.onPointerMove(event, viewport), { signal: stop });
1007
+ viewport.addEventListener("pointerup", (event) => this.onPointerEnd(event, viewport), { signal: stop });
1008
+ viewport.addEventListener("pointercancel", (event) => this.onPointerEnd(event, viewport), { signal: stop });
1009
+ onCleanup(() => {
1010
+ controller.abort();
1011
+ this.pointers.clear();
1012
+ this.dragging = false;
1013
+ untracked(() => this.panning.set(false));
1014
+ });
1015
+ });
1016
+ afterRenderEffect(() => {
1017
+ this.size();
1018
+ if (!this.zoomable()) return;
1019
+ untracked(() => this.settle());
1020
+ });
1021
+ const destroyRef = inject(DestroyRef);
1022
+ afterNextRender(() => {
1023
+ const viewport = this.viewportRef()?.nativeElement;
1024
+ if (!viewport || typeof ResizeObserver === "undefined") return;
1025
+ const observer = new ResizeObserver(() => {
1026
+ if (this.zoomable()) this.settle();
1027
+ });
1028
+ observer.observe(viewport);
1029
+ destroyRef.onDestroy(() => observer.disconnect());
1030
+ });
1031
+ destroyRef.onDestroy(() => this.cancelFrame());
838
1032
  if (isDevMode()) {
839
1033
  effect(() => {
840
1034
  const graph = this.prepared();
@@ -856,6 +1050,220 @@ var WrGraph = class WrGraph {
856
1050
  });
857
1051
  }
858
1052
  }
1053
+ fit() {
1054
+ this.fitView(false);
1055
+ }
1056
+ resetView() {
1057
+ if (!this.zoomable()) return;
1058
+ this.moved = true;
1059
+ this.commit(IDENTITY);
1060
+ }
1061
+ zoomIn() {
1062
+ this.zoomBy(ZOOM_STEP);
1063
+ }
1064
+ zoomOut() {
1065
+ this.zoomBy(1 / ZOOM_STEP);
1066
+ }
1067
+ fitView(animate) {
1068
+ if (!this.zoomable()) return;
1069
+ this.moved = false;
1070
+ const fitted = this.fitted();
1071
+ if (fitted) this.commit(fitted, animate);
1072
+ }
1073
+ frame() {
1074
+ const viewport = this.viewportRef()?.nativeElement;
1075
+ const stage = this.stageRef()?.nativeElement;
1076
+ if (!this.isBrowser || !viewport || !stage) return NO_FRAME;
1077
+ const rect = viewport.getBoundingClientRect();
1078
+ return {
1079
+ left: rect.left,
1080
+ top: rect.top,
1081
+ width: rect.width,
1082
+ height: rect.height,
1083
+ originX: viewport.clientLeft + stage.offsetLeft,
1084
+ originY: viewport.clientTop + stage.offsetTop
1085
+ };
1086
+ }
1087
+ fitted() {
1088
+ const viewport = this.viewportRef()?.nativeElement;
1089
+ const frame = this.frame();
1090
+ const { width, height } = this.size();
1091
+ if (!viewport || !frame.width || !frame.height || !width || !height) return null;
1092
+ const style = getComputedStyle(viewport);
1093
+ const inset = (value) => Number.parseFloat(value) || 0;
1094
+ const { min, max } = this.bounds();
1095
+ return fitTransform(frame, {
1096
+ top: inset(style.paddingTop),
1097
+ right: inset(style.paddingRight),
1098
+ bottom: inset(style.paddingBottom),
1099
+ left: inset(style.paddingLeft)
1100
+ }, width, height, min, max);
1101
+ }
1102
+ settle() {
1103
+ if (!this.moved) {
1104
+ const fitted = this.fitted();
1105
+ if (fitted) this.commit(fitted);
1106
+ return;
1107
+ }
1108
+ this.commit(this.bounded(this.current(), this.frame()));
1109
+ }
1110
+ current() {
1111
+ return this.queued ?? this.at();
1112
+ }
1113
+ bounded(at, frame) {
1114
+ const { width, height } = this.size();
1115
+ return clampPan(at, frame, width, height);
1116
+ }
1117
+ commit(next, animate = false) {
1118
+ this.cancelFrame();
1119
+ if (sameTransform(next, this.at())) return;
1120
+ this.animated.set(animate && !this.reducedMotion());
1121
+ this.at.set(next);
1122
+ this.zoom.set(next.k);
1123
+ }
1124
+ schedule(next) {
1125
+ if (sameTransform(next, this.current())) return;
1126
+ this.moved = true;
1127
+ this.queued = next;
1128
+ this.frameId ??= requestAnimationFrame(() => {
1129
+ this.frameId = null;
1130
+ const queued = this.queued;
1131
+ if (queued) this.commit(queued);
1132
+ });
1133
+ }
1134
+ cancelFrame() {
1135
+ if (this.frameId !== null) cancelAnimationFrame(this.frameId);
1136
+ this.frameId = null;
1137
+ this.queued = null;
1138
+ }
1139
+ zoomBy(factor) {
1140
+ const frame = this.frame();
1141
+ const from = this.current();
1142
+ const { min, max } = this.bounds();
1143
+ const k = clampZoom(from.k * factor, min, max);
1144
+ if (k === from.k) return;
1145
+ this.moved = true;
1146
+ this.commit(this.bounded(zoomAround(from, k, frame.width / 2, frame.height / 2, frame), frame), true);
1147
+ }
1148
+ panBy(dx, dy) {
1149
+ const from = this.current();
1150
+ const next = this.bounded({
1151
+ k: from.k,
1152
+ x: from.x + dx,
1153
+ y: from.y + dy
1154
+ }, this.frame());
1155
+ if (sameTransform(next, from)) return;
1156
+ this.moved = true;
1157
+ this.commit(next, true);
1158
+ }
1159
+ onWheel(event) {
1160
+ if (!event.ctrlKey && !event.metaKey && !this.wheelZoom()) return;
1161
+ event.preventDefault();
1162
+ const frame = this.frame();
1163
+ const unit = event.deltaMode === 1 ? WHEEL_LINE : event.deltaMode === 2 ? frame.height : 1;
1164
+ const delta = Math.min(WHEEL_MAX, Math.max(-24, event.deltaY * unit));
1165
+ const from = this.current();
1166
+ const { min, max } = this.bounds();
1167
+ const k = clampZoom(from.k * Math.exp(-delta * WHEEL_RATE), min, max);
1168
+ if (k === from.k) return;
1169
+ this.schedule(this.bounded(zoomAround(from, k, event.clientX - frame.left, event.clientY - frame.top, frame), frame));
1170
+ }
1171
+ onKeydown(event) {
1172
+ if (event.target !== event.currentTarget || event.ctrlKey || event.metaKey || event.altKey) return;
1173
+ switch (event.key) {
1174
+ case "+":
1175
+ case "=":
1176
+ this.zoomIn();
1177
+ break;
1178
+ case "-":
1179
+ case "_":
1180
+ this.zoomOut();
1181
+ break;
1182
+ case "0":
1183
+ this.fitView(true);
1184
+ break;
1185
+ case "ArrowLeft":
1186
+ this.panBy(PAN_STEP, 0);
1187
+ break;
1188
+ case "ArrowRight":
1189
+ this.panBy(-40, 0);
1190
+ break;
1191
+ case "ArrowUp":
1192
+ this.panBy(0, PAN_STEP);
1193
+ break;
1194
+ case "ArrowDown":
1195
+ this.panBy(0, -40);
1196
+ break;
1197
+ default: return;
1198
+ }
1199
+ event.preventDefault();
1200
+ }
1201
+ onPointerDown(event, viewport) {
1202
+ if (event.pointerType === "mouse" && event.button !== 0) return;
1203
+ const target = event.target instanceof Element ? event.target.closest(INTERACTIVE) : null;
1204
+ if (target && target !== viewport) return;
1205
+ this.pointers.set(event.pointerId, {
1206
+ x: event.clientX,
1207
+ y: event.clientY
1208
+ });
1209
+ if (this.pointers.size === 2) this.startDrag(viewport);
1210
+ else if (this.pointers.size > 2) this.pointers.delete(event.pointerId);
1211
+ }
1212
+ onPointerMove(event, viewport) {
1213
+ const last = this.pointers.get(event.pointerId);
1214
+ if (!last) return;
1215
+ if (event.pointerType === "mouse" && event.buttons === 0) {
1216
+ this.onPointerEnd(event, viewport);
1217
+ return;
1218
+ }
1219
+ const dx = event.clientX - last.x;
1220
+ const dy = event.clientY - last.y;
1221
+ if (!this.dragging) {
1222
+ if (Math.abs(dx) < DRAG_THRESHOLD && Math.abs(dy) < DRAG_THRESHOLD) return;
1223
+ this.startDrag(viewport);
1224
+ }
1225
+ const frame = this.frame();
1226
+ const from = this.current();
1227
+ const point = {
1228
+ x: event.clientX,
1229
+ y: event.clientY
1230
+ };
1231
+ const other = [...this.pointers].find(([id]) => id !== event.pointerId)?.[1];
1232
+ this.pointers.set(event.pointerId, point);
1233
+ if (!other) {
1234
+ this.schedule(this.bounded({
1235
+ k: from.k,
1236
+ x: from.x + dx,
1237
+ y: from.y + dy
1238
+ }, frame));
1239
+ return;
1240
+ }
1241
+ const before = Math.hypot(last.x - other.x, last.y - other.y);
1242
+ const after = Math.hypot(point.x - other.x, point.y - other.y);
1243
+ const { min, max } = this.bounds();
1244
+ const k = before > 0 ? clampZoom(from.k * after / before, min, max) : from.k;
1245
+ const midX = (last.x + other.x) / 2;
1246
+ const midY = (last.y + other.y) / 2;
1247
+ const zoomed = zoomAround(from, k, midX - frame.left, midY - frame.top, frame);
1248
+ this.schedule(this.bounded({
1249
+ k,
1250
+ x: zoomed.x + dx / 2,
1251
+ y: zoomed.y + dy / 2
1252
+ }, frame));
1253
+ }
1254
+ onPointerEnd(event, viewport) {
1255
+ if (!this.pointers.delete(event.pointerId)) return;
1256
+ if (this.dragging && viewport.hasPointerCapture?.(event.pointerId)) viewport.releasePointerCapture(event.pointerId);
1257
+ if (this.pointers.size) return;
1258
+ this.dragging = false;
1259
+ this.panning.set(false);
1260
+ }
1261
+ startDrag(viewport) {
1262
+ this.dragging = true;
1263
+ this.panning.set(true);
1264
+ this.animated.set(false);
1265
+ for (const id of this.pointers.keys()) viewport.setPointerCapture?.(id);
1266
+ }
859
1267
  static ɵfac = i0.ɵɵngDeclareFactory({
860
1268
  minVersion: "12.0.0",
861
1269
  version: "22.2.6",
@@ -905,11 +1313,74 @@ var WrGraph = class WrGraph {
905
1313
  isSignal: true,
906
1314
  isRequired: false,
907
1315
  transformFunction: null
1316
+ },
1317
+ zoomable: {
1318
+ classPropertyName: "zoomable",
1319
+ publicName: "zoomable",
1320
+ isSignal: true,
1321
+ isRequired: false,
1322
+ transformFunction: null
1323
+ },
1324
+ wheelZoom: {
1325
+ classPropertyName: "wheelZoom",
1326
+ publicName: "wheelZoom",
1327
+ isSignal: true,
1328
+ isRequired: false,
1329
+ transformFunction: null
1330
+ },
1331
+ zoom: {
1332
+ classPropertyName: "zoom",
1333
+ publicName: "zoom",
1334
+ isSignal: true,
1335
+ isRequired: false,
1336
+ transformFunction: null
1337
+ },
1338
+ minZoom: {
1339
+ classPropertyName: "minZoom",
1340
+ publicName: "minZoom",
1341
+ isSignal: true,
1342
+ isRequired: false,
1343
+ transformFunction: null
1344
+ },
1345
+ maxZoom: {
1346
+ classPropertyName: "maxZoom",
1347
+ publicName: "maxZoom",
1348
+ isSignal: true,
1349
+ isRequired: false,
1350
+ transformFunction: null
1351
+ },
1352
+ zoomInLabel: {
1353
+ classPropertyName: "zoomInLabel",
1354
+ publicName: "zoomInLabel",
1355
+ isSignal: true,
1356
+ isRequired: false,
1357
+ transformFunction: null
1358
+ },
1359
+ zoomOutLabel: {
1360
+ classPropertyName: "zoomOutLabel",
1361
+ publicName: "zoomOutLabel",
1362
+ isSignal: true,
1363
+ isRequired: false,
1364
+ transformFunction: null
1365
+ },
1366
+ fitLabel: {
1367
+ classPropertyName: "fitLabel",
1368
+ publicName: "fitLabel",
1369
+ isSignal: true,
1370
+ isRequired: false,
1371
+ transformFunction: null
908
1372
  }
909
1373
  },
910
- outputs: { layoutError: "layoutError" },
1374
+ outputs: {
1375
+ zoom: "zoomChange",
1376
+ layoutError: "layoutError"
1377
+ },
911
1378
  host: {
912
- properties: { "class.wr-graph--pending": "layoutPending()" },
1379
+ properties: {
1380
+ "class.wr-graph--pending": "layoutPending()",
1381
+ "class.wr-graph--zoomable": "zoomable()",
1382
+ "class.wr-graph--panning": "panning()"
1383
+ },
913
1384
  classAttribute: "wr-graph"
914
1385
  },
915
1386
  queries: [{
@@ -919,8 +1390,21 @@ var WrGraph = class WrGraph {
919
1390
  descendants: true,
920
1391
  isSignal: true
921
1392
  }],
1393
+ viewQueries: [{
1394
+ propertyName: "viewportRef",
1395
+ first: true,
1396
+ predicate: ["viewport"],
1397
+ descendants: true,
1398
+ isSignal: true
1399
+ }, {
1400
+ propertyName: "stageRef",
1401
+ first: true,
1402
+ predicate: ["stage"],
1403
+ descendants: true,
1404
+ isSignal: true
1405
+ }],
922
1406
  ngImport: i0,
923
- template: "@let graph = view();\n<!-- The scroller is the one tab stop: a named group, so its label is allowed, and focusable so a keyboard can scroll it. -->\n<div\n class=\"wr-graph__viewport\"\n role=\"group\"\n tabindex=\"0\"\n [attr.aria-label]=\"label()\"\n [attr.aria-busy]=\"layoutPending() ? 'true' : null\"\n>\n <div class=\"wr-graph__stage\" [style.width.px]=\"graph.width\" [style.height.px]=\"graph.height\">\n <svg\n class=\"wr-graph__edges\"\n aria-hidden=\"true\"\n focusable=\"false\"\n [attr.width]=\"graph.width\"\n [attr.height]=\"graph.height\"\n >\n <defs>\n <marker\n [attr.id]=\"markerId\"\n viewBox=\"0 0 10 10\"\n refX=\"10\"\n refY=\"5\"\n markerUnits=\"userSpaceOnUse\"\n [attr.markerWidth]=\"arrowSize\"\n [attr.markerHeight]=\"arrowSize\"\n orient=\"auto\"\n >\n <polygon points=\"0,1 10,5 0,9\" />\n </marker>\n </defs>\n @for (edge of graph.edges; track edge.id) {\n <path\n class=\"wr-graph__edge\"\n [attr.d]=\"edge.d\"\n [attr.data-from]=\"edge.from\"\n [attr.data-to]=\"edge.to\"\n [attr.marker-end]=\"markerUrl\"\n />\n }\n </svg>\n <!-- Items are DIRECT children of the list: a wrapper carrying ARIA or a tabindex would break ownership. -->\n <div class=\"wr-graph__nodes\" [attr.role]=\"graph.nodes.length ? 'list' : null\">\n @for (entry of graph.nodes; track entry.node.id) {\n @let relation = relations().get(entry.node.id);\n <div\n class=\"wr-graph__node\"\n role=\"listitem\"\n [style.width.px]=\"entry.width\"\n [style.height.px]=\"entry.height\"\n [style.transform]=\"entry.transform\"\n >\n @if (nodeTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"{ $implicit: entry.node }\" />\n } @else {\n <div class=\"wr-graph__card\">{{ entry.node.label }}</div>\n }\n @if (relation) {\n <span class=\"wr-graph__sr-only\">{{ relation }}</span>\n }\n </div>\n }\n </div>\n </div>\n</div>\n",
1407
+ template: "@let graph = view();\n<!-- The scroller is the one tab stop: a named group, so its label is allowed, and focusable so a keyboard can scroll it — or, when zoomable, zoom and pan it. -->\n<div\n #viewport\n class=\"wr-graph__viewport\"\n role=\"group\"\n tabindex=\"0\"\n [attr.aria-label]=\"label()\"\n [attr.aria-busy]=\"layoutPending() ? 'true' : null\"\n>\n <div\n #stage\n class=\"wr-graph__stage\"\n [class.wr-graph__stage--animated]=\"animated()\"\n [style.width.px]=\"graph.width\"\n [style.height.px]=\"graph.height\"\n [style.transform]=\"stageTransform()\"\n (transitionend)=\"animated.set(false)\"\n >\n <svg\n class=\"wr-graph__edges\"\n aria-hidden=\"true\"\n focusable=\"false\"\n [attr.width]=\"graph.width\"\n [attr.height]=\"graph.height\"\n >\n <defs>\n <marker\n [attr.id]=\"markerId\"\n viewBox=\"0 0 10 10\"\n refX=\"10\"\n refY=\"5\"\n markerUnits=\"userSpaceOnUse\"\n [attr.markerWidth]=\"arrowSize\"\n [attr.markerHeight]=\"arrowSize\"\n orient=\"auto\"\n >\n <polygon points=\"0,1 10,5 0,9\" />\n </marker>\n </defs>\n @for (edge of graph.edges; track edge.id) {\n <path\n class=\"wr-graph__edge\"\n [attr.d]=\"edge.d\"\n [attr.data-from]=\"edge.from\"\n [attr.data-to]=\"edge.to\"\n [attr.marker-end]=\"markerUrl\"\n />\n }\n </svg>\n <!-- Items are DIRECT children of the list: a wrapper carrying ARIA or a tabindex would break ownership. -->\n <div class=\"wr-graph__nodes\" [attr.role]=\"graph.nodes.length ? 'list' : null\">\n @for (entry of graph.nodes; track entry.node.id) {\n @let relation = relations().get(entry.node.id);\n <div\n class=\"wr-graph__node\"\n role=\"listitem\"\n [style.width.px]=\"entry.width\"\n [style.height.px]=\"entry.height\"\n [style.transform]=\"entry.transform\"\n >\n @if (nodeTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"{ $implicit: entry.node }\" />\n } @else {\n <div class=\"wr-graph__card\">{{ entry.node.label }}</div>\n }\n @if (relation) {\n <span class=\"wr-graph__sr-only\">{{ relation }}</span>\n }\n </div>\n }\n </div>\n </div>\n</div>\n<!-- After the viewport, never inside it: the buttons stay put while the drawing moves, and follow it in the tab order. -->\n@if (zoomable()) {\n <div class=\"wr-graph__controls\">\n <!-- `aria-disabled`, not `disabled`: a button that reached its bound under the keyboard keeps the focus. -->\n <button\n type=\"button\"\n class=\"wr-graph__control wr-graph__control--zoom-in\"\n [attr.aria-label]=\"zoomInText()\"\n [attr.aria-disabled]=\"atMaxZoom() ? 'true' : null\"\n (click)=\"zoomIn()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-graph__control wr-graph__control--zoom-out\"\n [attr.aria-label]=\"zoomOutText()\"\n [attr.aria-disabled]=\"atMinZoom() ? 'true' : null\"\n (click)=\"zoomOut()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M5 12h14\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-graph__control wr-graph__control--fit\"\n [attr.aria-label]=\"fitText()\"\n (click)=\"fitView(true)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n <path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n <path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n </svg>\n </button>\n </div>\n}\n",
924
1408
  dependencies: [{
925
1409
  kind: "directive",
926
1410
  type: NgTemplateOutlet,
@@ -947,9 +1431,11 @@ i0.ɵɵngDeclareClassMetadata({
947
1431
  encapsulation: ViewEncapsulation.None,
948
1432
  host: {
949
1433
  class: "wr-graph",
950
- "[class.wr-graph--pending]": "layoutPending()"
1434
+ "[class.wr-graph--pending]": "layoutPending()",
1435
+ "[class.wr-graph--zoomable]": "zoomable()",
1436
+ "[class.wr-graph--panning]": "panning()"
951
1437
  },
952
- template: "@let graph = view();\n<!-- The scroller is the one tab stop: a named group, so its label is allowed, and focusable so a keyboard can scroll it. -->\n<div\n class=\"wr-graph__viewport\"\n role=\"group\"\n tabindex=\"0\"\n [attr.aria-label]=\"label()\"\n [attr.aria-busy]=\"layoutPending() ? 'true' : null\"\n>\n <div class=\"wr-graph__stage\" [style.width.px]=\"graph.width\" [style.height.px]=\"graph.height\">\n <svg\n class=\"wr-graph__edges\"\n aria-hidden=\"true\"\n focusable=\"false\"\n [attr.width]=\"graph.width\"\n [attr.height]=\"graph.height\"\n >\n <defs>\n <marker\n [attr.id]=\"markerId\"\n viewBox=\"0 0 10 10\"\n refX=\"10\"\n refY=\"5\"\n markerUnits=\"userSpaceOnUse\"\n [attr.markerWidth]=\"arrowSize\"\n [attr.markerHeight]=\"arrowSize\"\n orient=\"auto\"\n >\n <polygon points=\"0,1 10,5 0,9\" />\n </marker>\n </defs>\n @for (edge of graph.edges; track edge.id) {\n <path\n class=\"wr-graph__edge\"\n [attr.d]=\"edge.d\"\n [attr.data-from]=\"edge.from\"\n [attr.data-to]=\"edge.to\"\n [attr.marker-end]=\"markerUrl\"\n />\n }\n </svg>\n <!-- Items are DIRECT children of the list: a wrapper carrying ARIA or a tabindex would break ownership. -->\n <div class=\"wr-graph__nodes\" [attr.role]=\"graph.nodes.length ? 'list' : null\">\n @for (entry of graph.nodes; track entry.node.id) {\n @let relation = relations().get(entry.node.id);\n <div\n class=\"wr-graph__node\"\n role=\"listitem\"\n [style.width.px]=\"entry.width\"\n [style.height.px]=\"entry.height\"\n [style.transform]=\"entry.transform\"\n >\n @if (nodeTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"{ $implicit: entry.node }\" />\n } @else {\n <div class=\"wr-graph__card\">{{ entry.node.label }}</div>\n }\n @if (relation) {\n <span class=\"wr-graph__sr-only\">{{ relation }}</span>\n }\n </div>\n }\n </div>\n </div>\n</div>\n"
1438
+ template: "@let graph = view();\n<!-- The scroller is the one tab stop: a named group, so its label is allowed, and focusable so a keyboard can scroll it — or, when zoomable, zoom and pan it. -->\n<div\n #viewport\n class=\"wr-graph__viewport\"\n role=\"group\"\n tabindex=\"0\"\n [attr.aria-label]=\"label()\"\n [attr.aria-busy]=\"layoutPending() ? 'true' : null\"\n>\n <div\n #stage\n class=\"wr-graph__stage\"\n [class.wr-graph__stage--animated]=\"animated()\"\n [style.width.px]=\"graph.width\"\n [style.height.px]=\"graph.height\"\n [style.transform]=\"stageTransform()\"\n (transitionend)=\"animated.set(false)\"\n >\n <svg\n class=\"wr-graph__edges\"\n aria-hidden=\"true\"\n focusable=\"false\"\n [attr.width]=\"graph.width\"\n [attr.height]=\"graph.height\"\n >\n <defs>\n <marker\n [attr.id]=\"markerId\"\n viewBox=\"0 0 10 10\"\n refX=\"10\"\n refY=\"5\"\n markerUnits=\"userSpaceOnUse\"\n [attr.markerWidth]=\"arrowSize\"\n [attr.markerHeight]=\"arrowSize\"\n orient=\"auto\"\n >\n <polygon points=\"0,1 10,5 0,9\" />\n </marker>\n </defs>\n @for (edge of graph.edges; track edge.id) {\n <path\n class=\"wr-graph__edge\"\n [attr.d]=\"edge.d\"\n [attr.data-from]=\"edge.from\"\n [attr.data-to]=\"edge.to\"\n [attr.marker-end]=\"markerUrl\"\n />\n }\n </svg>\n <!-- Items are DIRECT children of the list: a wrapper carrying ARIA or a tabindex would break ownership. -->\n <div class=\"wr-graph__nodes\" [attr.role]=\"graph.nodes.length ? 'list' : null\">\n @for (entry of graph.nodes; track entry.node.id) {\n @let relation = relations().get(entry.node.id);\n <div\n class=\"wr-graph__node\"\n role=\"listitem\"\n [style.width.px]=\"entry.width\"\n [style.height.px]=\"entry.height\"\n [style.transform]=\"entry.transform\"\n >\n @if (nodeTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"{ $implicit: entry.node }\" />\n } @else {\n <div class=\"wr-graph__card\">{{ entry.node.label }}</div>\n }\n @if (relation) {\n <span class=\"wr-graph__sr-only\">{{ relation }}</span>\n }\n </div>\n }\n </div>\n </div>\n</div>\n<!-- After the viewport, never inside it: the buttons stay put while the drawing moves, and follow it in the tab order. -->\n@if (zoomable()) {\n <div class=\"wr-graph__controls\">\n <!-- `aria-disabled`, not `disabled`: a button that reached its bound under the keyboard keeps the focus. -->\n <button\n type=\"button\"\n class=\"wr-graph__control wr-graph__control--zoom-in\"\n [attr.aria-label]=\"zoomInText()\"\n [attr.aria-disabled]=\"atMaxZoom() ? 'true' : null\"\n (click)=\"zoomIn()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-graph__control wr-graph__control--zoom-out\"\n [attr.aria-label]=\"zoomOutText()\"\n [attr.aria-disabled]=\"atMinZoom() ? 'true' : null\"\n (click)=\"zoomOut()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M5 12h14\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-graph__control wr-graph__control--fit\"\n [attr.aria-label]=\"fitText()\"\n (click)=\"fitView(true)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n <path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n <path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n </svg>\n </button>\n </div>\n}\n"
953
1439
  }]
954
1440
  }],
955
1441
  ctorParameters: () => [],
@@ -994,6 +1480,73 @@ i0.ɵɵngDeclareClassMetadata({
994
1480
  required: false
995
1481
  }]
996
1482
  }],
1483
+ zoomable: [{
1484
+ type: i0.Input,
1485
+ args: [{
1486
+ isSignal: true,
1487
+ alias: "zoomable",
1488
+ required: false
1489
+ }]
1490
+ }],
1491
+ wheelZoom: [{
1492
+ type: i0.Input,
1493
+ args: [{
1494
+ isSignal: true,
1495
+ alias: "wheelZoom",
1496
+ required: false
1497
+ }]
1498
+ }],
1499
+ zoom: [{
1500
+ type: i0.Input,
1501
+ args: [{
1502
+ isSignal: true,
1503
+ alias: "zoom",
1504
+ required: false
1505
+ }]
1506
+ }, {
1507
+ type: i0.Output,
1508
+ args: ["zoomChange"]
1509
+ }],
1510
+ minZoom: [{
1511
+ type: i0.Input,
1512
+ args: [{
1513
+ isSignal: true,
1514
+ alias: "minZoom",
1515
+ required: false
1516
+ }]
1517
+ }],
1518
+ maxZoom: [{
1519
+ type: i0.Input,
1520
+ args: [{
1521
+ isSignal: true,
1522
+ alias: "maxZoom",
1523
+ required: false
1524
+ }]
1525
+ }],
1526
+ zoomInLabel: [{
1527
+ type: i0.Input,
1528
+ args: [{
1529
+ isSignal: true,
1530
+ alias: "zoomInLabel",
1531
+ required: false
1532
+ }]
1533
+ }],
1534
+ zoomOutLabel: [{
1535
+ type: i0.Input,
1536
+ args: [{
1537
+ isSignal: true,
1538
+ alias: "zoomOutLabel",
1539
+ required: false
1540
+ }]
1541
+ }],
1542
+ fitLabel: [{
1543
+ type: i0.Input,
1544
+ args: [{
1545
+ isSignal: true,
1546
+ alias: "fitLabel",
1547
+ required: false
1548
+ }]
1549
+ }],
997
1550
  layoutError: [{
998
1551
  type: i0.Output,
999
1552
  args: ["layoutError"]
@@ -1001,6 +1554,14 @@ i0.ɵɵngDeclareClassMetadata({
1001
1554
  nodeTemplate: [{
1002
1555
  type: i0.ContentChild,
1003
1556
  args: [i0.forwardRef(() => WrGraphNodeTemplate), { isSignal: true }]
1557
+ }],
1558
+ viewportRef: [{
1559
+ type: i0.ViewChild,
1560
+ args: ["viewport", { isSignal: true }]
1561
+ }],
1562
+ stageRef: [{
1563
+ type: i0.ViewChild,
1564
+ args: ["stage", { isSignal: true }]
1004
1565
  }]
1005
1566
  }
1006
1567
  });