expressive-charts 0.10.0 → 0.11.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.
package/dist/index.cjs CHANGED
@@ -10082,6 +10082,40 @@ function between$1(outer, inner, root, screen = screenMatrix) {
10082
10082
  if (a && b) return matrix.multiply(invert(a), b);
10083
10083
  return matrix.multiply(invert(fromRoot(outer, root)), fromRoot(inner, root));
10084
10084
  }
10085
+ function mapMark(mark, m) {
10086
+ if (isIdentity$1(m)) return mark;
10087
+ const point = (p) => matrix.apply(m, p);
10088
+ const path = (d) => formatPath(transformPath(parsePath(d), m));
10089
+ const scale = scaleOf$2(m);
10090
+ const { outline } = mark;
10091
+ return {
10092
+ key: mark.key,
10093
+ ...mark.series === void 0 ? {} : { series: mark.series },
10094
+ start: point(mark.start),
10095
+ end: point(mark.end),
10096
+ length: mark.length * scale,
10097
+ path: (t) => point(mark.path(t)),
10098
+ angle: (t) => {
10099
+ const angle = mark.angle(t);
10100
+ const cos = Math.cos(angle);
10101
+ const sin = Math.sin(angle);
10102
+ return Math.atan2(m[1] * cos + m[3] * sin, m[0] * cos + m[2] * sin);
10103
+ },
10104
+ slice: (t0, t1) => path(mark.slice(t0, t1)),
10105
+ ...mark.gaps === void 0 ? {} : { gaps: mark.gaps },
10106
+ thickness: mark.thickness * scale,
10107
+ outline: {
10108
+ d: path(outline.d),
10109
+ closed: outline.closed,
10110
+ sample: (n) => outline.sample(n).map(point)
10111
+ },
10112
+ bounds: boxIn(m, mark.bounds),
10113
+ center: point(mark.center),
10114
+ pivot: point(mark.pivot),
10115
+ ...mark.segments === void 0 ? {} : { segments: mark.segments.map((segment) => mapMark(segment, m)) }
10116
+ };
10117
+ }
10118
+ const isIdentity$1 = (m) => m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1 && m[4] === 0 && m[5] === 0;
10085
10119
  function ownTransform(element) {
10086
10120
  return parseTransform(element.getAttribute("transform") ?? "");
10087
10121
  }
@@ -11121,7 +11155,7 @@ function expressive$1(target, options, env) {
11121
11155
  if (root.lastElementChild !== overlay) root.appendChild(overlay);
11122
11156
  overlay.removeAttribute("transform");
11123
11157
  const m = between$1(overlay, ancestor, root);
11124
- if (!isIdentity$1(m)) overlay.setAttribute("transform", transformAttribute(m));
11158
+ if (!isIdentity(m)) overlay.setAttribute("transform", transformAttribute(m));
11125
11159
  }
11126
11160
  function moveTo(next) {
11127
11161
  detach();
@@ -11672,7 +11706,7 @@ function tryInvert(m) {
11672
11706
  return;
11673
11707
  }
11674
11708
  }
11675
- function isIdentity$1(m) {
11709
+ function isIdentity(m) {
11676
11710
  return Math.abs(m[0] - 1) < 1e-9 && Math.abs(m[1]) < 1e-9 && Math.abs(m[2]) < 1e-9 && Math.abs(m[3] - 1) < 1e-9 && Math.abs(m[4]) < 1e-6 && Math.abs(m[5]) < 1e-6;
11677
11711
  }
11678
11712
  function valuesChanged(from, to) {
@@ -11725,19 +11759,37 @@ function scaled(value, scale) {
11725
11759
  if (scale === 1) return value;
11726
11760
  return value.replace(/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px)?(?![\w.%])/gi, (_, n, px) => `${Math.round(Number(n) * scale * 1e3) / 1e3}${px ?? ""}`);
11727
11761
  }
11728
- function hostView(attachment, options = {}) {
11729
- const port = typeof attachment === "object" && attachment !== null ? portOf(attachment) : void 0;
11730
- const inside = insidesOf(port);
11731
- if (!port || !inside?.root()) throw new TypeError("hostView needs an attachment that expressive() or fromVegaView() returned, with marks in an <svg>.");
11762
+ function hostView(attachments, options = {}) {
11763
+ const list = Array.isArray(attachments) ? attachments : [attachments];
11764
+ if (list.length === 0) throw new TypeError("hostView needs an attachment, or an array of attachments on one <svg>: hostView([dots, connectors]).");
11765
+ const parts = list.map((attachment, i) => {
11766
+ const port = typeof attachment === "object" && attachment !== null ? portOf(attachment) : void 0;
11767
+ const inside = insidesOf(port);
11768
+ if (!port || !inside?.root()) throw new TypeError(list === attachments ? `hostView needs attachments that expressive() or fromVegaView() returned, each with marks in an <svg>: attachments[${i}] isn't one.` : "hostView needs an attachment that expressive() or fromVegaView() returned, with marks in an <svg>.");
11769
+ if (list.indexOf(attachment) !== i) throw new TypeError(`hostView: attachments[${i}] is attachments[${list.indexOf(attachment)}] again. Each attachment is in a view once.`);
11770
+ return {
11771
+ attachment,
11772
+ port,
11773
+ inside,
11774
+ hidden: []
11775
+ };
11776
+ });
11732
11777
  if (typeof options !== "object" || options === null || options.labels !== void 0 && typeof options.labels !== "function") throw new TypeError("hostView: labels must be a function that returns the host's labels, such as () => names.map((element) => ({ element, key: element.textContent, role: \"category\" })).");
11733
- const { edits } = inside;
11734
- const svg = () => inside.root();
11778
+ if (options.guides !== void 0 && typeof options.guides !== "function") throw new TypeError("hostView: guides must be a function that returns the host's guides, such as () => [{ element: svg.querySelector(\"g.axis\"), key: \"y\" }].");
11779
+ const lead = parts[0];
11780
+ const several = parts.length > 1;
11781
+ const { edits } = lead.inside;
11782
+ const svg = () => lead.inside.root();
11735
11783
  let given;
11736
- let hidden = [];
11784
+ let guided;
11737
11785
  let classed;
11786
+ const clash = several ? clashOf(parts, svg()) : void 0;
11787
+ if (clash) throw new TypeError(`hostView: ${clash.problem}.`);
11788
+ const drawn = () => parts.filter((part) => part.inside.root() === svg());
11789
+ const ownerOf = (key) => drawn().find((part) => part.attachment.marks().some((mark) => mark.key === key));
11738
11790
  function read() {
11739
11791
  if (!options.labels) return [];
11740
- const keys = new Set(attachment.marks().map((mark) => mark.key));
11792
+ const keys = new Set(drawn().flatMap((part) => part.attachment.marks().map((mark) => mark.key)));
11741
11793
  try {
11742
11794
  return Array.from(options.labels()).filter((label) => label?.element?.localName === "text" && svg().contains(label.element) && keys.has(label.key) && (label.role === "category" || label.role === "value"));
11743
11795
  } catch (error) {
@@ -11745,6 +11797,16 @@ function hostView(attachment, options = {}) {
11745
11797
  return [];
11746
11798
  }
11747
11799
  }
11800
+ function guides() {
11801
+ if (!options.guides) return [];
11802
+ const root = svg();
11803
+ try {
11804
+ return Array.from(options.guides()).filter((guide) => (guide?.element)?.nodeType === 1 && guide.element !== root && root.contains(guide.element) && typeof guide.key === "string");
11805
+ } catch (error) {
11806
+ report(error);
11807
+ return [];
11808
+ }
11809
+ }
11748
11810
  function chartLabel({ element, key, role }) {
11749
11811
  const root = svg();
11750
11812
  const m = between$1(view.space, element, root);
@@ -11775,16 +11837,27 @@ function hostView(attachment, options = {}) {
11775
11837
  };
11776
11838
  }
11777
11839
  const hide = (on) => {
11840
+ if (on && given === void 0 && several) {
11841
+ const found = clashOf(parts, svg());
11842
+ if (found) report(/* @__PURE__ */ new TypeError(`hostView: ${found.problem}. The switch plays on, and ${found.left}.`));
11843
+ }
11778
11844
  const root = on ? svg() : void 0;
11779
11845
  given = on ? read() : void 0;
11780
- const now = new Set(given ? [
11846
+ guided = on ? guides() : void 0;
11847
+ const named = [...(given ?? []).map((label) => label.element), ...(guided ?? []).map((guide) => guide.element)];
11848
+ const now = parts.map(({ inside, hidden }, i) => new Set(given ? [
11781
11849
  ...inside.elements(),
11782
- ...given.map((label) => label.element),
11850
+ ...i === 0 ? named : [],
11783
11851
  ...hidden.filter((element) => root?.contains(element))
11784
- ] : []);
11785
- for (const element of hidden) if (!now.has(element)) edits.style(element, "visibility", void 0);
11786
- hidden = [...now];
11787
- for (const element of hidden) edits.style(element, "visibility", "hidden");
11852
+ ] : []));
11853
+ for (let i = 1; i < now.length; i++) for (const element of now[i]) if (now.some((earlier, j) => j < i && earlier.has(element))) now[i].delete(element);
11854
+ parts.forEach((part, i) => {
11855
+ for (const element of part.hidden) if (!now[i].has(element)) part.inside.edits.style(element, "visibility", void 0);
11856
+ });
11857
+ parts.forEach((part, i) => {
11858
+ part.hidden = [...now[i]];
11859
+ for (const element of part.hidden) part.inside.edits.style(element, "visibility", "hidden");
11860
+ });
11788
11861
  if (classed !== root) {
11789
11862
  if (classed) edits.toggleClass(classed, "ec-morphing", false);
11790
11863
  if (root) edits.toggleClass(root, "ec-morphing", true);
@@ -11796,36 +11869,82 @@ function hostView(attachment, options = {}) {
11796
11869
  return svg();
11797
11870
  },
11798
11871
  get space() {
11799
- return inside.ancestor() ?? svg();
11800
- },
11801
- refresh: (source) => attachment.refresh(source),
11802
- update: (next) => attachment.update(next),
11803
- on: (type, listener) => attachment.on(type, listener),
11804
- marks: () => attachment.marks(),
11805
- focus: (key) => attachment.focus(key),
11806
- leave: () => attachment.leave(),
11872
+ const root = svg();
11873
+ const [space, ...others] = drawn().map((part) => part.inside.ancestor() ?? root);
11874
+ let common = space;
11875
+ for (const other of others) while (common !== root && !common.contains(other)) common = common.parentElement ?? root;
11876
+ return common;
11877
+ },
11878
+ refresh(source) {
11879
+ if (several && source !== void 0) throw new TypeError("hostView: a view of several attachments refreshes each from what it last read, with refresh(). To read new sources, refresh each attachment with its own.");
11880
+ for (const { attachment } of parts) attachment.refresh(source);
11881
+ },
11882
+ update: (next) => several ? Promise.all(parts.map(({ attachment }) => attachment.update(next))).then(() => {}) : lead.attachment.update(next),
11883
+ on(type, listener) {
11884
+ const stops = parts.map(({ attachment }) => attachment.on(type, listener));
11885
+ return several ? () => stops.forEach((stop) => stop()) : stops[0];
11886
+ },
11887
+ marks() {
11888
+ const root = svg();
11889
+ const space = view.space;
11890
+ const keys = /* @__PURE__ */ new Set();
11891
+ return drawn().flatMap(({ attachment, inside }) => {
11892
+ const ancestor = inside.ancestor() ?? root;
11893
+ const m = ancestor === space ? void 0 : between$1(space, ancestor, root);
11894
+ return attachment.marks().flatMap((mark) => keys.has(mark.key) ? [] : (keys.add(mark.key), [m ? mapMark(mark, m) : mark]));
11895
+ });
11896
+ },
11897
+ focus: (key) => ownerOf(key)?.attachment.focus(key),
11898
+ leave() {
11899
+ for (const { attachment } of parts) attachment.leave();
11900
+ },
11807
11901
  destroy() {
11808
- given = classed = void 0;
11809
- hidden = [];
11810
- attachment.destroy();
11902
+ given = guided = classed = void 0;
11903
+ for (const part of parts) part.hidden = [];
11904
+ for (const { attachment } of [...parts].reverse()) attachment.destroy();
11811
11905
  },
11812
11906
  labels: () => (given ?? read()).map(chartLabel),
11907
+ guides: () => guided ?? guides(),
11813
11908
  paintOf(key) {
11814
- const color = inside.colorOf(key);
11815
- return color === void 0 ? void 0 : {
11816
- color: key,
11817
- drawn: true,
11818
- cssColor: color
11819
- };
11909
+ for (const { inside } of drawn()) {
11910
+ const color = inside.colorOf(key);
11911
+ if (color !== void 0) return {
11912
+ color: key,
11913
+ drawn: true,
11914
+ cssColor: color
11915
+ };
11916
+ }
11917
+ },
11918
+ keyOf(element) {
11919
+ for (const { inside } of parts) {
11920
+ const key = inside.keyOf(element);
11921
+ if (key !== void 0) return key;
11922
+ }
11820
11923
  },
11821
- keyOf: (element) => inside.keyOf(element),
11822
- moveTabStop: (key) => inside.moveTabStop(key),
11924
+ moveTabStop: (key) => drawn().some(({ inside }) => inside.moveTabStop(key)),
11823
11925
  morphing: hide
11824
11926
  };
11825
- inside.refreshed.add(() => {
11927
+ for (const { inside } of parts) inside.refreshed.add(() => {
11826
11928
  if (given) hide(true);
11827
11929
  });
11828
- return linkable(port, view);
11930
+ return several ? view : linkable(lead.port, view);
11931
+ }
11932
+ function clashOf(parts, root) {
11933
+ const owners = /* @__PURE__ */ new Map();
11934
+ for (const [i, { attachment, inside }] of parts.entries()) {
11935
+ if (inside.root() !== root) return {
11936
+ problem: `attachments[${i}]'s marks are in another <svg> than attachments[0]'s, and a view's attachments share one`,
11937
+ left: `attachments[${i}]'s marks are left out`
11938
+ };
11939
+ for (const { key } of attachment.marks()) {
11940
+ const owner = owners.get(key);
11941
+ if (owner !== void 0 && owner !== i) return {
11942
+ problem: `attachments[${owner}] and attachments[${i}] both have a mark with the key ${JSON.stringify(key)}, and each key must be one mark's. Key each one's marks apart, such as (d) => \`first@\${d.name}\``,
11943
+ left: `the key stays attachments[${owner}]'s: attachments[${i}]'s mark is left out`
11944
+ };
11945
+ owners.set(key, i);
11946
+ }
11947
+ }
11829
11948
  }
11830
11949
  // src/charts/adapter/vega.ts
11831
11950
  const MARK_TYPES = [
@@ -12586,14 +12705,16 @@ function chartSwitch$1(target, options, env) {
12586
12705
  reached();
12587
12706
  return Promise.resolve();
12588
12707
  }
12708
+ const guides = [];
12589
12709
  for (const each of [from, to]) {
12590
12710
  each.container.classList.remove("ec-switch-inactive");
12711
+ guides.push(guidesOf(each));
12591
12712
  each.container.classList.add("ec-switching");
12592
12713
  each.container.setAttribute("inert", "");
12593
12714
  each.chart.morphing?.(true);
12594
12715
  each.chart.element.classList.add("ec-morphing");
12595
12716
  }
12596
- const { pairs, surface, scene } = prepare(from, to);
12717
+ const { pairs, surface, scene } = prepare(from, to, guides);
12597
12718
  const { done, settle } = carried ?? deferred();
12598
12719
  const session = {
12599
12720
  a: from,
@@ -12691,7 +12812,7 @@ function chartSwitch$1(target, options, env) {
12691
12812
  }
12692
12813
  session.settle();
12693
12814
  }
12694
- function prepare(a, b) {
12815
+ function prepare(a, b, guides) {
12695
12816
  const toA = between$1(overlay, a.chart.space ?? a.chart.element, wrapper);
12696
12817
  const toB = between$1(overlay, b.chart.space ?? b.chart.element, wrapper);
12697
12818
  const scaleA = scaleOf(toA);
@@ -12741,9 +12862,39 @@ function chartSwitch$1(target, options, env) {
12741
12862
  }
12742
12863
  for (const label of labelsA) if (!matched.has(id(label))) drawings.push(fadeLabel(copyLabel(label, toA, sizeA), fadeOut));
12743
12864
  for (const label of labelsB) if (!byId.has(id(label))) drawings.push(fadeLabel(copyLabel(label, toB, sizeB), fadeIn));
12865
+ const [guidesA = [], guidesB = []] = guides;
12866
+ const partners = /* @__PURE__ */ new Map();
12867
+ for (const guide of guidesA) if (!partners.has(guide.key)) partners.set(guide.key, guide);
12868
+ const kept = /* @__PURE__ */ new Set();
12869
+ for (const guide of guidesB) {
12870
+ const partner = partners.get(guide.key);
12871
+ partners.delete(guide.key);
12872
+ if (partner && sameGuide(partner, guide)) kept.add(partner).add(guide);
12873
+ }
12874
+ let guidesLayer;
12875
+ if (guidesA.length + guidesB.length > 0) {
12876
+ const layer = guidesLayer = doc.createElementNS(SVG_NS$2, "g");
12877
+ layer.setAttribute("class", "ec-switch-guides");
12878
+ overlay.insertBefore(layer, fadesLayer);
12879
+ [[
12880
+ guidesA,
12881
+ (s) => s < HALF ? 1 : 0,
12882
+ othersOut
12883
+ ], [
12884
+ guidesB,
12885
+ (s) => s < HALF ? 0 : 1,
12886
+ othersIn
12887
+ ]].forEach(([list, steady, fading]) => {
12888
+ for (const guide of list) {
12889
+ layer.appendChild(guide.group);
12890
+ const opacity = kept.has(guide) ? steady : fading;
12891
+ drawings.push((s) => guide.group.setAttribute("opacity", opacityText(opacity(s))));
12892
+ }
12893
+ });
12894
+ }
12744
12895
  drawings.push((s) => {
12745
- setOpacity(a.container, 1 - clamp$1(s / OUT_BY));
12746
- setOpacity(b.container, clamp$1((s - HALF) / .5));
12896
+ setOpacity(a.container, othersOut(s));
12897
+ setOpacity(b.container, othersIn(s));
12747
12898
  });
12748
12899
  return {
12749
12900
  pairs,
@@ -12753,6 +12904,7 @@ function chartSwitch$1(target, options, env) {
12753
12904
  for (const draw of drawings) draw(s);
12754
12905
  },
12755
12906
  clear: () => {
12907
+ guidesLayer?.remove();
12756
12908
  fadesLayer.replaceChildren();
12757
12909
  runsLayer.replaceChildren();
12758
12910
  labelsLayer.replaceChildren();
@@ -12760,6 +12912,31 @@ function chartSwitch$1(target, options, env) {
12760
12912
  }
12761
12913
  };
12762
12914
  }
12915
+ function guidesOf(view) {
12916
+ const root = view.chart.element;
12917
+ return (view.chart.guides?.() ?? []).flatMap((guide) => {
12918
+ const element = guide?.element;
12919
+ const parent = element?.parentElement;
12920
+ if (typeof guide?.key !== "string" || !parent || !root.contains(parent)) return [];
12921
+ const m = between$1(overlay, parent, wrapper);
12922
+ const copy = paintedCopy(element, root);
12923
+ const group = doc.createElementNS(SVG_NS$2, "g");
12924
+ setAttributes(group, {
12925
+ class: "ec-switch-guide",
12926
+ "data-key": guide.key,
12927
+ transform: isIdentity$1(m) ? void 0 : transformAttribute(m)
12928
+ });
12929
+ group.appendChild(copy);
12930
+ const own = ownTransform(element);
12931
+ return [{
12932
+ key: guide.key,
12933
+ group,
12934
+ markup: copy.outerHTML,
12935
+ corners: cornersOf(element).map((p) => matrix.apply(m, matrix.apply(own, p))),
12936
+ place: m
12937
+ }];
12938
+ });
12939
+ }
12763
12940
  function fadeMark(mark, paint, scale, opacity) {
12764
12941
  const group = svgElement("g", {
12765
12942
  class: "ec-switch-fade",
@@ -12965,8 +13142,105 @@ function setActive(container, active) {
12965
13142
  else container.setAttribute("aria-hidden", "true");
12966
13143
  }
12967
13144
  function setOpacity(container, opacity) {
12968
- container.style.setProperty("opacity", String(Math.round(opacity * 1e3) / 1e3));
13145
+ container.style.setProperty("opacity", opacityText(opacity));
13146
+ }
13147
+ const opacityText = (opacity) => String(Math.round(opacity * 1e3) / 1e3);
13148
+ const INHERITED = [
13149
+ "fill",
13150
+ "fill-opacity",
13151
+ "fill-rule",
13152
+ "stroke",
13153
+ "stroke-opacity",
13154
+ "stroke-width",
13155
+ "stroke-dasharray",
13156
+ "stroke-dashoffset",
13157
+ "stroke-linecap",
13158
+ "stroke-linejoin",
13159
+ "stroke-miterlimit",
13160
+ "paint-order",
13161
+ "marker-start",
13162
+ "marker-mid",
13163
+ "marker-end",
13164
+ "color",
13165
+ "visibility",
13166
+ "font-family",
13167
+ "font-size",
13168
+ "font-style",
13169
+ "font-weight",
13170
+ "font-stretch",
13171
+ "font-variant-caps",
13172
+ "font-variant-ligatures",
13173
+ "font-variant-numeric",
13174
+ "font-feature-settings",
13175
+ "font-kerning",
13176
+ "letter-spacing",
13177
+ "word-spacing",
13178
+ "text-anchor",
13179
+ "dominant-baseline",
13180
+ "text-rendering",
13181
+ "shape-rendering",
13182
+ "writing-mode",
13183
+ "direction"
13184
+ ];
13185
+ const OWN = {
13186
+ opacity: "1",
13187
+ display: "inline",
13188
+ "clip-path": "none",
13189
+ mask: "none",
13190
+ filter: "none",
13191
+ "vector-effect": "none"
13192
+ };
13193
+ function paintedCopy(source, root) {
13194
+ const copy = source.cloneNode(true);
13195
+ const sources = [source, ...source.querySelectorAll("*")];
13196
+ const copies = [copy, ...copy.querySelectorAll("*")];
13197
+ sources.forEach((element, i) => {
13198
+ const target = copies[i];
13199
+ target.removeAttribute("id");
13200
+ const computed = element.ownerDocument.defaultView?.getComputedStyle?.(element);
13201
+ const styles = {};
13202
+ for (const property of INHERITED) styles[property] = drawnStyle(element, root, property) || void 0;
13203
+ for (const [property, initial] of Object.entries(OWN)) {
13204
+ const value = computed?.getPropertyValue(property).trim();
13205
+ if (value && value !== initial) styles[property] = value;
13206
+ }
13207
+ setStyles(target, styles);
13208
+ });
13209
+ return copy;
13210
+ }
13211
+ function cornersOf(element) {
13212
+ try {
13213
+ const box = element.getBBox?.();
13214
+ if (box) return [
13215
+ {
13216
+ x: box.x,
13217
+ y: box.y
13218
+ },
13219
+ {
13220
+ x: box.x + box.width,
13221
+ y: box.y
13222
+ },
13223
+ {
13224
+ x: box.x,
13225
+ y: box.y + box.height
13226
+ },
13227
+ {
13228
+ x: box.x + box.width,
13229
+ y: box.y + box.height
13230
+ }
13231
+ ];
13232
+ } catch {}
13233
+ return [{
13234
+ x: 0,
13235
+ y: 0
13236
+ }];
12969
13237
  }
13238
+ const sameGuide = (a, b) => a.markup === b.markup && a.corners.length === b.corners.length && a.corners.every((p, i) => Math.hypot(p.x - b.corners[i].x, p.y - b.corners[i].y) <= .5) && [
13239
+ 0,
13240
+ 1,
13241
+ 2,
13242
+ 3
13243
+ ].every((i) => Math.abs(a.place[i] - b.place[i]) <= 1e-4);
12970
13244
  function moveLabel(a, b) {
12971
13245
  return (s) => {
12972
13246
  const x = mix$1(a.at.x, b.at.x, s);
@@ -12999,6 +13273,8 @@ function fadeLabel(label, opacity) {
12999
13273
  }
13000
13274
  const fadeOut = (s) => 1 - clamp$1(s / HALF);
13001
13275
  const fadeIn = (s) => clamp$1((s - HALF) / .5);
13276
+ const othersOut = (s) => 1 - clamp$1(s / OUT_BY);
13277
+ const othersIn = fadeIn;
13002
13278
  const clamp$1 = (value) => Math.min(1, Math.max(0, value));
13003
13279
  const mix$1 = (x, y, s) => x * (1 - s) + y * s;
13004
13280
  function paintOf(view, mark) {
@@ -13032,41 +13308,7 @@ function placeDot(element, end) {
13032
13308
  "stroke-width": end.ring
13033
13309
  });
13034
13310
  }
13035
- const isIdentity = (m) => m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1 && m[4] === 0 && m[5] === 0;
13036
13311
  const scaleOf = (m) => Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));
13037
- function mapMark(mark, m) {
13038
- if (isIdentity(m)) return mark;
13039
- const point = (p) => matrix.apply(m, p);
13040
- const path = (d) => formatPath(transformPath(parsePath(d), m));
13041
- const scale = scaleOf(m);
13042
- const { outline } = mark;
13043
- return {
13044
- key: mark.key,
13045
- ...mark.series === void 0 ? {} : { series: mark.series },
13046
- start: point(mark.start),
13047
- end: point(mark.end),
13048
- length: mark.length * scale,
13049
- path: (t) => point(mark.path(t)),
13050
- angle: (t) => {
13051
- const angle = mark.angle(t);
13052
- const cos = Math.cos(angle);
13053
- const sin = Math.sin(angle);
13054
- return Math.atan2(m[1] * cos + m[3] * sin, m[0] * cos + m[2] * sin);
13055
- },
13056
- slice: (t0, t1) => path(mark.slice(t0, t1)),
13057
- ...mark.gaps === void 0 ? {} : { gaps: mark.gaps },
13058
- thickness: mark.thickness * scale,
13059
- outline: {
13060
- d: path(outline.d),
13061
- closed: outline.closed,
13062
- sample: (n) => outline.sample(n).map(point)
13063
- },
13064
- bounds: boxIn(m, mark.bounds),
13065
- center: point(mark.center),
13066
- pivot: point(mark.pivot),
13067
- ...mark.segments === void 0 ? {} : { segments: mark.segments.map((segment) => mapMark(segment, m)) }
13068
- };
13069
- }
13070
13312
  function deferred() {
13071
13313
  let settle;
13072
13314
  return {
@@ -15314,7 +15556,7 @@ function configure(options) {
15314
15556
  }
15315
15557
  }
15316
15558
  // src/index.ts
15317
- const VERSION = "0.10.0";
15559
+ const VERSION = "0.11.0";
15318
15560
  const env = {
15319
15561
  presets: presetRegistry,
15320
15562
  icons: iconRegistry,