@rubin-epo/epo-widget-lib 1.1.0 → 1.1.1

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),V=require("react"),j=require("d3-geo"),s=require("./widgets/ViewIndicator/styles.cjs"),W=require("./lib/utils.cjs"),h=10,$=10,k=[h,$],m=100,v=100,g=j.geoGraticule();g.step([180,180]);const b=t=>{const{backFaces:n=!1,applyRotation:i=!0}=t||{},e=j.geoOrthographic();e.fitExtent([[0,0],[m,v]],g.outline()),i&&e.rotate(k),n&&e.clipAngle(null);const r=j.geoPath(e);return{projection:e,pathGenerator:a=>r(a)||void 0}},A=()=>{const{pathGenerator:t}=b({applyRotation:!1});return o.jsx(s.Outline,{d:t(g.outline())})},R=({backFaces:t})=>{const{pathGenerator:n}=b({backFaces:t});return o.jsx(s.Meridian,{d:n(g()),opacity:t?.8:void 0})},C=(t,n)=>{const i=t>90-h&&t<270-h,e=n>0+$,r=t>180-h,c=["top","bottom"],a=["left","right"];e&&c.reverse(),r&&a.reverse();const d=["plane",c[0],...a,c[1]];return i&&d.reverse(),d},N=({ra:t,dec:n,fov:i})=>{const{pathGenerator:e}=b({backFaces:!0}),[r,c]=i,a=Math.max(r,.1)/2,d=Math.max(c,.1)/2,S=n+d,M=n-d,w=t+a,G=t-a,p=[w,S],f=[G,S],x=[w,M],y=[G,M],E=m/2,F=v/2,u=l=>`${l}L${E},${F}`,L={plane:o.jsx(s.Plane,{d:e({type:"Polygon",coordinates:[[p,f,y,x,p]]})}),top:o.jsx(s.TopEdges,{d:u(e({type:"LineString",coordinates:[p,f]}))}),bottom:o.jsx(s.TopEdges,{d:u(e({type:"LineString",coordinates:[y,x]}))}),left:o.jsx(s.SideEdges,{d:u(e({type:"LineString",coordinates:[x,p]}))}),right:o.jsx(s.SideEdges,{d:u(e({type:"LineString",coordinates:[f,y]}))})},O=C(t,n),P=W.getLinearScale([0,180],[0,100],{clamp:!0,fractionDigits:0})(Math.abs(180-t));return o.jsx(s.ViewCone,{style:{"--percent-mix-primary":`${P}%`,"--percent-mix-secondary":`${100-P}%`},children:O.map(l=>{if(L[l])return o.jsx(V.Fragment,{children:L[l]},l)})})},q=({size:t="var(--size-spacing-m)",className:n,ra:i,dec:e,fov:r})=>{const c=typeof i<"u"&&typeof e<"u"&&typeof r<"u";return o.jsxs(s.Container,{style:{"--size-container":t},className:n,children:[o.jsx(s.NorthDirection,{children:"N"}),o.jsxs(s.SVG,{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${m} ${v}`,children:[o.jsx(R,{backFaces:!0}),c&&o.jsx(N,{ra:i,dec:e,fov:r}),o.jsx(R,{}),o.jsx(A,{})]})]})};q.displayName="Widget.ViewIndicator";exports.default=q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),k=require("react"),j=require("d3-geo"),u=require("./widgets/ViewIndicator/styles.cjs"),O=require("./lib/utils.cjs"),g=10,q=10,A=[g,q],m=100,v=100,d=j.geoGraticule();d.step([180,180]);d.precision(90);const b=t=>{const{backFaces:n=!1,applyRotation:i=!0}=t||{},e=j.geoOrthographic();e.fitExtent([[0,0],[m,v]],d.outline()),i&&e.rotate(A),n&&e.clipAngle(null);const s=j.geoPath(e).digits(1);return{projection:e,pathGenerator:c=>s(c)||void 0}},C=()=>{const{pathGenerator:t}=b({applyRotation:!1});return o.jsx("path",{strokeWidth:3,d:t(d.outline())})},$=({backFaces:t})=>{const{pathGenerator:n}=b({backFaces:t});return o.jsx("path",{d:n(d()),opacity:t?.8:void 0})},N=(t,n)=>{const i=t>90-g&&t<270-g,e=n>0+q,s=t>180-g,r=["top","bottom"],c=["left","right"];e&&r.reverse(),s&&c.reverse();const a=["plane",r[0],...c,r[1]];return i&&a.reverse(),a},z=({ra:t,dec:n,fov:i})=>{const{pathGenerator:e}=b({backFaces:!0}),[s,r]=i,c=Math.max(s,.1)/2,a=Math.max(r,.1)/2,S=n+a,M=n-a,w=t+c,G=t-c,l=[w,S],f=[G,S],y=[w,M],x=[G,M],P=m/2,V=v/2,h=p=>`${p}L${P},${V}`,L={plane:o.jsx("path",{opacity:.8,d:e({type:"Polygon",coordinates:[[l,f,x,y,l]]})}),top:o.jsx("path",{opacity:.5,d:h(e({type:"LineString",coordinates:[l,f]}))}),bottom:o.jsx("path",{opacity:.5,d:h(e({type:"LineString",coordinates:[x,y]}))}),left:o.jsx("path",{opacity:.3,d:h(e({type:"LineString",coordinates:[y,l]}))}),right:o.jsx("path",{opacity:.3,d:h(e({type:"LineString",coordinates:[f,x]}))})},W=N(t,n),R=O.getLinearScale([0,180],[0,100],{clamp:!0,fractionDigits:0})(Math.abs(180-t));return o.jsx(u.ViewCone,{style:{"--percent-mix-primary":`${R}%`,"--percent-mix-secondary":`${100-R}%`},children:W.map(p=>{if(L[p])return o.jsx(k.Fragment,{children:L[p]},p)})})},F=({size:t="var(--size-spacing-m)",className:n,ra:i,dec:e,fov:s})=>{const r=typeof i<"u"&&typeof e<"u"&&typeof s<"u";return o.jsxs(u.Container,{style:{"--size-container":t},className:n,children:[o.jsx(u.NorthDirection,{children:"N"}),o.jsxs(u.SVG,{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${m} ${v}`,children:[o.jsx($,{backFaces:!0}),r&&o.jsx(z,{ra:i,dec:e,fov:s}),o.jsx($,{}),o.jsx(C,{})]})]})};F.displayName="Widget.ViewIndicator";exports.default=F;
@@ -1,10 +1,11 @@
1
- import { jsxs as G, jsx as o } from "react/jsx-runtime";
2
- import { Fragment as W } from "react";
1
+ import { jsxs as $, jsx as o } from "react/jsx-runtime";
2
+ import { Fragment as j } from "react";
3
3
  import { geoGraticule as k, geoOrthographic as A, geoPath as C } from "d3-geo";
4
- import { Container as N, NorthDirection as z, SVG as B, Outline as D, Meridian as H, Plane as I, TopEdges as F, SideEdges as P, ViewCone as Y } from "./widgets/ViewIndicator/styles.js";
5
- import { getLinearScale as q } from "./lib/utils.js";
6
- const h = 10, O = 10, T = [h, O], y = 100, v = 100, f = k();
7
- f.step([180, 180]);
4
+ import { Container as N, NorthDirection as O, SVG as z, ViewCone as B } from "./widgets/ViewIndicator/styles.js";
5
+ import { getLinearScale as D } from "./lib/utils.js";
6
+ const f = 10, R = 10, E = [f, R], y = 100, v = 100, d = k();
7
+ d.step([180, 180]);
8
+ d.precision(90);
8
9
  const x = (t) => {
9
10
  const { backFaces: n = !1, applyRotation: i = !0 } = t || {}, e = A();
10
11
  e.fitExtent(
@@ -12,52 +13,55 @@ const x = (t) => {
12
13
  [0, 0],
13
14
  [y, v]
14
15
  ],
15
- f.outline()
16
- ), i && e.rotate(T), n && e.clipAngle(null);
17
- const r = C(e);
16
+ d.outline()
17
+ ), i && e.rotate(E), n && e.clipAngle(null);
18
+ const r = C(e).digits(1);
18
19
  return { projection: e, pathGenerator: (s) => r(s) || void 0 };
19
- }, X = () => {
20
+ }, H = () => {
20
21
  const { pathGenerator: t } = x({ applyRotation: !1 });
21
- return /* @__PURE__ */ o(D, { d: t(f.outline()) });
22
- }, R = ({ backFaces: t }) => {
22
+ return /* @__PURE__ */ o("path", { strokeWidth: 3, d: t(d.outline()) });
23
+ }, F = ({ backFaces: t }) => {
23
24
  const { pathGenerator: n } = x({ backFaces: t });
24
25
  return /* @__PURE__ */ o(
25
- H,
26
+ "path",
26
27
  {
27
- d: n(f()),
28
+ d: n(d()),
28
29
  opacity: t ? 0.8 : void 0
29
30
  }
30
31
  );
31
- }, J = (t, n) => {
32
- const i = t > 90 - h && t < 270 - h, e = n > 0 + O, r = t > 180 - h, c = ["top", "bottom"], s = ["left", "right"];
32
+ }, I = (t, n) => {
33
+ const i = t > 90 - f && t < 270 - f, e = n > 0 + R, r = t > 180 - f, c = ["top", "bottom"], s = ["left", "right"];
33
34
  e && c.reverse(), r && s.reverse();
34
35
  const a = ["plane", c[0], ...s, c[1]];
35
36
  return i && a.reverse(), a;
36
- }, K = ({ ra: t, dec: n, fov: i }) => {
37
- const { pathGenerator: e } = x({ backFaces: !0 }), [r, c] = i, s = Math.max(r, 0.1) / 2, a = Math.max(c, 0.1) / 2, b = n + a, M = n - a, S = t + s, $ = t - s, p = [S, b], g = [$, b], m = [S, M], u = [$, M], V = y / 2, j = v / 2, l = (d) => `${d}L${V},${j}`, w = {
37
+ }, Y = ({ ra: t, dec: n, fov: i }) => {
38
+ const { pathGenerator: e } = x({ backFaces: !0 }), [r, c] = i, s = Math.max(r, 0.1) / 2, a = Math.max(c, 0.1) / 2, b = n + a, w = n - a, L = t + s, S = t - s, h = [L, b], g = [S, b], m = [L, w], u = [S, w], P = y / 2, V = v / 2, l = (p) => `${p}L${P},${V}`, G = {
38
39
  plane: /* @__PURE__ */ o(
39
- I,
40
+ "path",
40
41
  {
42
+ opacity: 0.8,
41
43
  d: e({
42
44
  type: "Polygon",
43
- coordinates: [[p, g, u, m, p]]
45
+ coordinates: [[h, g, u, m, h]]
44
46
  })
45
47
  }
46
48
  ),
47
49
  top: /* @__PURE__ */ o(
48
- F,
50
+ "path",
49
51
  {
52
+ opacity: 0.5,
50
53
  d: l(
51
54
  e({
52
55
  type: "LineString",
53
- coordinates: [p, g]
56
+ coordinates: [h, g]
54
57
  })
55
58
  )
56
59
  }
57
60
  ),
58
61
  bottom: /* @__PURE__ */ o(
59
- F,
62
+ "path",
60
63
  {
64
+ opacity: 0.5,
61
65
  d: l(
62
66
  e({
63
67
  type: "LineString",
@@ -67,19 +71,21 @@ const x = (t) => {
67
71
  }
68
72
  ),
69
73
  left: /* @__PURE__ */ o(
70
- P,
74
+ "path",
71
75
  {
76
+ opacity: 0.3,
72
77
  d: l(
73
78
  e({
74
79
  type: "LineString",
75
- coordinates: [m, p]
80
+ coordinates: [m, h]
76
81
  })
77
82
  )
78
83
  }
79
84
  ),
80
85
  right: /* @__PURE__ */ o(
81
- P,
86
+ "path",
82
87
  {
88
+ opacity: 0.3,
83
89
  d: l(
84
90
  e({
85
91
  type: "LineString",
@@ -88,24 +94,24 @@ const x = (t) => {
88
94
  )
89
95
  }
90
96
  )
91
- }, E = J(t, n), L = q([0, 180], [0, 100], {
97
+ }, W = I(t, n), M = D([0, 180], [0, 100], {
92
98
  clamp: !0,
93
99
  fractionDigits: 0
94
100
  })(Math.abs(180 - t));
95
101
  return /* @__PURE__ */ o(
96
- Y,
102
+ B,
97
103
  {
98
104
  style: {
99
- "--percent-mix-primary": `${L}%`,
100
- "--percent-mix-secondary": `${100 - L}%`
105
+ "--percent-mix-primary": `${M}%`,
106
+ "--percent-mix-secondary": `${100 - M}%`
101
107
  },
102
- children: E.map((d) => {
103
- if (w[d])
104
- return /* @__PURE__ */ o(W, { children: w[d] }, d);
108
+ children: W.map((p) => {
109
+ if (G[p])
110
+ return /* @__PURE__ */ o(j, { children: G[p] }, p);
105
111
  })
106
112
  }
107
113
  );
108
- }, Q = ({
114
+ }, q = ({
109
115
  size: t = "var(--size-spacing-m)",
110
116
  className: n,
111
117
  ra: i,
@@ -113,23 +119,23 @@ const x = (t) => {
113
119
  fov: r
114
120
  }) => {
115
121
  const c = typeof i < "u" && typeof e < "u" && typeof r < "u";
116
- return /* @__PURE__ */ G(
122
+ return /* @__PURE__ */ $(
117
123
  N,
118
124
  {
119
125
  style: { "--size-container": t },
120
126
  className: n,
121
127
  children: [
122
- /* @__PURE__ */ o(z, { children: "N" }),
123
- /* @__PURE__ */ G(
124
- B,
128
+ /* @__PURE__ */ o(O, { children: "N" }),
129
+ /* @__PURE__ */ $(
130
+ z,
125
131
  {
126
132
  preserveAspectRatio: "xMidYMid meet",
127
133
  viewBox: `0 0 ${y} ${v}`,
128
134
  children: [
129
- /* @__PURE__ */ o(R, { backFaces: !0 }),
130
- c && /* @__PURE__ */ o(K, { ra: i, dec: e, fov: r }),
131
- /* @__PURE__ */ o(R, {}),
132
- /* @__PURE__ */ o(X, {})
135
+ /* @__PURE__ */ o(F, { backFaces: !0 }),
136
+ c && /* @__PURE__ */ o(Y, { ra: i, dec: e, fov: r }),
137
+ /* @__PURE__ */ o(F, {}),
138
+ /* @__PURE__ */ o(H, {})
133
139
  ]
134
140
  }
135
141
  )
@@ -137,7 +143,7 @@ const x = (t) => {
137
143
  }
138
144
  );
139
145
  };
140
- Q.displayName = "Widget.ViewIndicator";
146
+ q.displayName = "Widget.ViewIndicator";
141
147
  export {
142
- Q as default
148
+ q as default
143
149
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),c=require("@rubin-epo/epo-react-lib/styles");require("../Base/index.cjs");require("../XAxis/index.cjs");require("../YAxis/index.cjs");require("../Guidelines/index.cjs");require("../Tooltip/index.cjs");require("../Bars/index.cjs");const d=require("../Viewport/index.cjs"),y=require("../ForeignObject/index.cjs");require("../ScatterPlot/index.cjs");const o=require("./styles.cjs"),j=(r="")=>{const i=["top","right"],a=["center","center"],n=r?[...r.split(" "),...a].slice(0,2):i,e={justifyContent:null,alignItems:null};return n.forEach(s=>{switch(s){case"center":e.alignItems=e.alignItems??"center",e.justifyContent=e.justifyContent??"center";break;case"top":e.alignItems="start";break;case"right":e.justifyContent="end";break;case"bottom":e.alignItems="end";break;case"left":e.justifyContent="start";break}}),e},u=({className:r,children:i,position:a,viewport:n,forIds:e,forScreenreaders:s})=>{const l=t.jsx(y.default,{children:t.jsx(o.DisplayContainer,{style:j(a),children:t.jsxs(o.Display,{form:Array.isArray(e)?e.join(" "):e,className:r,children:[t.jsx("span",{"aria-hidden":!!s,children:i}),t.jsx(c.ScreenreaderText,{children:s})]})})});return n?t.jsx(d.default,{...n,children:l}):l};u.displayName="Charts.Readout";exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),u=require("@rubin-epo/epo-react-lib/styles"),o=require("./styles.cjs"),d=require("../ForeignObject/index.cjs"),y=require("../Viewport/index.cjs"),j=(n="")=>{const r=["top","right"],a=["center","center"],s=n?[...n.split(" "),...a].slice(0,2):r,e={justifyContent:null,alignItems:null};return s.forEach(i=>{switch(i){case"center":e.alignItems=e.alignItems??"center",e.justifyContent=e.justifyContent??"center";break;case"top":e.alignItems="start";break;case"right":e.justifyContent="end";break;case"bottom":e.alignItems="end";break;case"left":e.justifyContent="start";break}}),e},c=({className:n,children:r,position:a,viewport:s,forIds:e,forScreenreaders:i})=>{const l=t.jsx(d.default,{children:t.jsx(o.DisplayContainer,{style:j(a),children:t.jsxs(o.Display,{form:Array.isArray(e)?e.join(" "):e,className:n,children:[t.jsx("span",{"aria-hidden":!!i,children:r}),t.jsx(u.ScreenreaderText,{children:i})]})})});return s?t.jsx(y.default,{...s,children:l}):l};c.displayName="Charts.Readout";exports.default=c;
@@ -1,22 +1,15 @@
1
1
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
2
  import { ScreenreaderText as c } from "@rubin-epo/epo-react-lib/styles";
3
- import "../Base/index.js";
4
- import "../XAxis/index.js";
5
- import "../YAxis/index.js";
6
- import "../Guidelines/index.js";
7
- import "../Tooltip/index.js";
8
- import "../Bars/index.js";
9
- import m from "../Viewport/index.js";
10
- import p from "../ForeignObject/index.js";
11
- import "../ScatterPlot/index.js";
12
- import { DisplayContainer as f, Display as u } from "./styles.js";
13
- const d = (i = "") => {
14
- const o = ["top", "right"], s = ["center", "center"], r = i ? [...i.split(" "), ...s].slice(0, 2) : o, t = {
3
+ import { DisplayContainer as m, Display as f } from "./styles.js";
4
+ import u from "../ForeignObject/index.js";
5
+ import d from "../Viewport/index.js";
6
+ const p = (n = "") => {
7
+ const s = ["top", "right"], o = ["center", "center"], i = n ? [...n.split(" "), ...o].slice(0, 2) : s, t = {
15
8
  justifyContent: null,
16
9
  alignItems: null
17
10
  };
18
- return r.forEach((n) => {
19
- switch (n) {
11
+ return i.forEach((r) => {
12
+ switch (r) {
20
13
  case "center":
21
14
  t.alignItems = t.alignItems ?? "center", t.justifyContent = t.justifyContent ?? "center";
22
15
  break;
@@ -35,25 +28,25 @@ const d = (i = "") => {
35
28
  }
36
29
  }), t;
37
30
  }, y = ({
38
- className: i,
39
- children: o,
40
- position: s,
41
- viewport: r,
31
+ className: n,
32
+ children: s,
33
+ position: o,
34
+ viewport: i,
42
35
  forIds: t,
43
- forScreenreaders: n
36
+ forScreenreaders: r
44
37
  }) => {
45
- const a = /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(f, { style: d(s), children: /* @__PURE__ */ l(
46
- u,
38
+ const a = /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(m, { style: p(o), children: /* @__PURE__ */ l(
39
+ f,
47
40
  {
48
41
  form: Array.isArray(t) ? t.join(" ") : t,
49
- className: i,
42
+ className: n,
50
43
  children: [
51
- /* @__PURE__ */ e("span", { "aria-hidden": !!n, children: o }),
52
- /* @__PURE__ */ e(c, { children: n })
44
+ /* @__PURE__ */ e("span", { "aria-hidden": !!r, children: s }),
45
+ /* @__PURE__ */ e(c, { children: r })
53
46
  ]
54
47
  }
55
48
  ) }) });
56
- return r ? /* @__PURE__ */ e(m, { ...r, children: a }) : a;
49
+ return i ? /* @__PURE__ */ e(d, { ...i, children: a }) : a;
57
50
  };
58
51
  y.displayName = "Charts.Readout";
59
52
  export {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),J=require("react");require("../Base/index.cjs");const K=require("../XAxis/index.cjs"),Q=require("../YAxis/index.cjs"),$=require("../Guidelines/index.cjs"),U=require("../Points/index.cjs"),V=require("../Tooltip/index.cjs"),X=require("../ClippingContainer/index.cjs");require("../Bars/index.cjs");require("../Viewport/index.cjs");const R=require("../hooks/useAxis.cjs"),Y=require("./styles.cjs"),H=require("../defaults.cjs"),Z=require("../canvas/Points/index.cjs"),w={svg:U.default,canvas:Z.default},M=({data:C,className:D,xAxis:l,yAxis:c,width:d,height:u,title:T,activePointId:p,margins:z,tooltip:a,onLoadedCallback:B,renderer:E="svg",plotChildren:y})=>{const[q,h]=J.useState(),{label:O,points:x}=C,o={...H.default.margins,...z},e=typeof q<"u"?x[q]:x.find(({id:v})=>v===p),f=[0+o.left,d-o.right],b=[u-o.bottom,0+o.top],[r,j,t]=R.default({...l,range:f}),[i,m,s]=R.default({...c,range:b}),S=s(i[0]),g=t(r[0]),I=s(i[1]),_=t(r[1]),k="x-axis-label",L="y-axis-label",N=Math.abs(f[1]-f[0]),W=Math.abs(b[1]-b[0]),F=w[E],P=n.jsx(F,{data:x,onHoverCallback:a?v=>h(v):void 0,onHoverOutCallback:a?()=>h(void 0):void 0,width:d,height:u,xScale:t,yScale:s,label:O,onLoadedCallback:B}),G={Data:P,xScale:t,yScale:s,yStart:S,yEnd:I,xStart:g,xEnd:_,yDomain:i,xDomain:r};return n.jsxs(Y.Chart,{verticalLabel:c.label,verticalLabelId:L,horizontalLabel:l.label,horizontalLabelId:k,className:D,width:d,height:u,title:T,children:[n.jsx(Q.default,{ticks:m,x:g,labelledById:L,yDomain:i,yScale:s}),n.jsxs(X.default,{x:g,y:I,width:N,height:W,children:[l.guidelines&&n.jsx($.default,{guides:j.length,direction:"vertical",xDomain:r,yDomain:i,xScale:t,yScale:s}),c.guidelines&&n.jsx($.default,{guides:m.length,xDomain:r,yDomain:i,xScale:t,yScale:s}),y?y(G):P]}),n.jsx(K.default,{ticks:j,y:S,labelledById:k,xDomain:r,xScale:t}),a&&n.jsxs(V.default,{x:e?t(e.x):void 0,y:e?s(e.y):void 0,visible:!!e,offset:H.default.pointRadius,children:[e&&typeof a=="function"&&a(e),e&&typeof a=="string"&&a]})]})};M.displayName="Charts.ScatterPlot";exports.default=M;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),J=require("react"),$=require("../hooks/useAxis.cjs"),K=require("./styles.cjs"),R=require("../defaults.cjs"),Q=require("../canvas/Points/index.cjs"),U=require("../YAxis/index.cjs"),V=require("../ClippingContainer/index.cjs"),H=require("../Guidelines/index.cjs"),X=require("../XAxis/index.cjs"),Y=require("../Tooltip/index.cjs"),Z=require("../Points/index.cjs"),w={svg:Z.default,canvas:Q.default},M=({data:C,className:D,xAxis:l,yAxis:c,width:d,height:u,title:T,activePointId:p,margins:z,tooltip:a,onLoadedCallback:B,renderer:E="svg",plotChildren:y})=>{const[q,h]=J.useState(),{label:O,points:x}=C,o={...R.default.margins,...z},e=typeof q<"u"?x[q]:x.find(({id:v})=>v===p),f=[0+o.left,d-o.right],b=[u-o.bottom,0+o.top],[r,j,t]=$.default({...l,range:f}),[i,m,s]=$.default({...c,range:b}),S=s(i[0]),g=t(r[0]),I=s(i[1]),_=t(r[1]),k="x-axis-label",L="y-axis-label",N=Math.abs(f[1]-f[0]),W=Math.abs(b[1]-b[0]),F=w[E],P=n.jsx(F,{data:x,onHoverCallback:a?v=>h(v):void 0,onHoverOutCallback:a?()=>h(void 0):void 0,width:d,height:u,xScale:t,yScale:s,label:O,onLoadedCallback:B}),G={Data:P,xScale:t,yScale:s,yStart:S,yEnd:I,xStart:g,xEnd:_,yDomain:i,xDomain:r};return n.jsxs(K.Chart,{verticalLabel:c.label,verticalLabelId:L,horizontalLabel:l.label,horizontalLabelId:k,className:D,width:d,height:u,title:T,children:[n.jsx(U.default,{ticks:m,x:g,labelledById:L,yDomain:i,yScale:s}),n.jsxs(V.default,{x:g,y:I,width:N,height:W,children:[l.guidelines&&n.jsx(H.default,{guides:j.length,direction:"vertical",xDomain:r,yDomain:i,xScale:t,yScale:s}),c.guidelines&&n.jsx(H.default,{guides:m.length,xDomain:r,yDomain:i,xScale:t,yScale:s}),y?y(G):P]}),n.jsx(X.default,{ticks:j,y:S,labelledById:k,xDomain:r,xScale:t}),a&&n.jsxs(Y.default,{x:e?t(e.x):void 0,y:e?s(e.y):void 0,visible:!!e,offset:R.default.pointRadius,children:[e&&typeof a=="function"&&a(e),e&&typeof a=="string"&&a]})]})};M.displayName="Charts.ScatterPlot";exports.default=M;
@@ -1,22 +1,19 @@
1
1
  "use client";
2
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
+ import { jsxs as u, jsx as i } from "react/jsx-runtime";
3
3
  import { useState as F } from "react";
4
- import "../Base/index.js";
5
- import J from "../XAxis/index.js";
6
- import K from "../YAxis/index.js";
7
- import R from "../Guidelines/index.js";
8
- import Q from "../Points/index.js";
9
- import U from "../Tooltip/index.js";
10
- import V from "../ClippingContainer/index.js";
11
- import "../Bars/index.js";
12
- import "../Viewport/index.js";
13
- import D from "../hooks/useAxis.js";
14
- import { Chart as Z } from "./styles.js";
15
- import T from "../defaults.js";
16
- import _ from "../canvas/Points/index.js";
4
+ import R from "../hooks/useAxis.js";
5
+ import { Chart as J } from "./styles.js";
6
+ import D from "../defaults.js";
7
+ import K from "../canvas/Points/index.js";
8
+ import Q from "../YAxis/index.js";
9
+ import U from "../ClippingContainer/index.js";
10
+ import T from "../Guidelines/index.js";
11
+ import V from "../XAxis/index.js";
12
+ import Z from "../Tooltip/index.js";
13
+ import _ from "../Points/index.js";
17
14
  const $ = {
18
- svg: Q,
19
- canvas: _
15
+ svg: _,
16
+ canvas: K
20
17
  }, w = ({
21
18
  data: j,
22
19
  className: z,
@@ -32,32 +29,32 @@ const $ = {
32
29
  renderer: G = "svg",
33
30
  plotChildren: x
34
31
  }) => {
35
- const [y, h] = F(), { label: N, points: f } = j, a = { ...T.margins, ...M }, t = typeof y < "u" ? f[y] : f.find(({ id: v }) => v === E), p = [0 + a.left, d - a.right], b = [m - a.bottom, 0 + a.top], [i, I, o] = D({ ...l, range: p }), [r, P, e] = D({ ...c, range: b }), S = e(r[0]), g = o(i[0]), k = e(r[1]), O = o(i[1]), C = "x-axis-label", L = "y-axis-label", W = Math.abs(p[1] - p[0]), X = Math.abs(b[1] - b[0]), Y = $[G], H = /* @__PURE__ */ s(
32
+ const [y, h] = F(), { label: N, points: f } = j, r = { ...D.margins, ...M }, t = typeof y < "u" ? f[y] : f.find(({ id: p }) => p === E), b = [0 + r.left, d - r.right], g = [m - r.bottom, 0 + r.top], [s, I, e] = R({ ...l, range: b }), [a, P, o] = R({ ...c, range: g }), S = o(a[0]), v = e(s[0]), k = o(a[1]), O = e(s[1]), C = "x-axis-label", L = "y-axis-label", W = Math.abs(b[1] - b[0]), X = Math.abs(g[1] - g[0]), Y = $[G], H = /* @__PURE__ */ i(
36
33
  Y,
37
34
  {
38
35
  data: f,
39
- onHoverCallback: n ? (v) => h(v) : void 0,
36
+ onHoverCallback: n ? (p) => h(p) : void 0,
40
37
  onHoverOutCallback: n ? () => h(void 0) : void 0,
41
38
  width: d,
42
39
  height: m,
43
- xScale: o,
44
- yScale: e,
40
+ xScale: e,
41
+ yScale: o,
45
42
  label: N,
46
43
  onLoadedCallback: A
47
44
  }
48
45
  ), q = {
49
46
  Data: H,
50
- xScale: o,
51
- yScale: e,
47
+ xScale: e,
48
+ yScale: o,
52
49
  yStart: S,
53
50
  yEnd: k,
54
- xStart: g,
51
+ xStart: v,
55
52
  xEnd: O,
56
- yDomain: r,
57
- xDomain: i
53
+ yDomain: a,
54
+ xDomain: s
58
55
  };
59
56
  return /* @__PURE__ */ u(
60
- Z,
57
+ J,
61
58
  {
62
59
  verticalLabel: c.label,
63
60
  verticalLabelId: L,
@@ -68,66 +65,66 @@ const $ = {
68
65
  height: m,
69
66
  title: B,
70
67
  children: [
71
- /* @__PURE__ */ s(
72
- K,
68
+ /* @__PURE__ */ i(
69
+ Q,
73
70
  {
74
71
  ticks: P,
75
- x: g,
72
+ x: v,
76
73
  labelledById: L,
77
- yDomain: r,
78
- yScale: e
74
+ yDomain: a,
75
+ yScale: o
79
76
  }
80
77
  ),
81
78
  /* @__PURE__ */ u(
82
- V,
79
+ U,
83
80
  {
84
- x: g,
81
+ x: v,
85
82
  y: k,
86
83
  width: W,
87
84
  height: X,
88
85
  children: [
89
- l.guidelines && /* @__PURE__ */ s(
90
- R,
86
+ l.guidelines && /* @__PURE__ */ i(
87
+ T,
91
88
  {
92
89
  guides: I.length,
93
90
  direction: "vertical",
94
- xDomain: i,
95
- yDomain: r,
96
- xScale: o,
97
- yScale: e
91
+ xDomain: s,
92
+ yDomain: a,
93
+ xScale: e,
94
+ yScale: o
98
95
  }
99
96
  ),
100
- c.guidelines && /* @__PURE__ */ s(
101
- R,
97
+ c.guidelines && /* @__PURE__ */ i(
98
+ T,
102
99
  {
103
100
  guides: P.length,
104
- xDomain: i,
105
- yDomain: r,
106
- xScale: o,
107
- yScale: e
101
+ xDomain: s,
102
+ yDomain: a,
103
+ xScale: e,
104
+ yScale: o
108
105
  }
109
106
  ),
110
107
  x ? x(q) : H
111
108
  ]
112
109
  }
113
110
  ),
114
- /* @__PURE__ */ s(
115
- J,
111
+ /* @__PURE__ */ i(
112
+ V,
116
113
  {
117
114
  ticks: I,
118
115
  y: S,
119
116
  labelledById: C,
120
- xDomain: i,
121
- xScale: o
117
+ xDomain: s,
118
+ xScale: e
122
119
  }
123
120
  ),
124
121
  n && /* @__PURE__ */ u(
125
- U,
122
+ Z,
126
123
  {
127
- x: t ? o(t.x) : void 0,
128
- y: t ? e(t.y) : void 0,
124
+ x: t ? e(t.x) : void 0,
125
+ y: t ? o(t.y) : void 0,
129
126
  visible: !!t,
130
- offset: T.pointRadius,
127
+ offset: D.pointRadius,
131
128
  children: [
132
129
  t && typeof n == "function" && n(t),
133
130
  t && typeof n == "string" && n
@@ -1385,7 +1385,7 @@ export declare const FilterRange: import('styled-components').IStyledComponent<"
1385
1385
  abbr?: string | undefined;
1386
1386
  height?: string | number | undefined;
1387
1387
  width?: string | number | undefined;
1388
- valign?: "baseline" | "middle" | "top" | "bottom" | undefined;
1388
+ valign?: "top" | "bottom" | "baseline" | "middle" | undefined;
1389
1389
  defaultChecked?: boolean | undefined;
1390
1390
  defaultValue?: string | number | readonly string[] | undefined;
1391
1391
  suppressContentEditableWarning?: boolean | undefined;
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("react"),_=require("d3-geo-projection"),S=require("d3-geo"),M=require("d3-array"),E=require("../../../charts/Base/index.cjs");require("../../../charts/XAxis/index.cjs");require("../../../charts/YAxis/index.cjs");require("../../../charts/Guidelines/index.cjs");const N=require("../../../charts/Tooltip/index.cjs");require("../../../charts/Bars/index.cjs");require("../../../charts/Viewport/index.cjs");require("../../../charts/ScatterPlot/index.cjs");const U=require("../../../atomic/ImageStack/index.cjs"),r=require("./styles.cjs"),y=({className:L,objects:p=[],images:v=[],visibleImages:w=[],describedById:G})=>{const[O,P]=b.useState(!1),[x,f]=b.useState(),l=600,c=300,n={top:20,right:0,bottom:20,left:20},W=l+n.right+n.left,$=c+n.top+n.bottom,d=15,u=30,j=-90,m=90,g=-180,q=180,h=2,i=_.geoAitoff(),s=S.geoGraticule();s.step([u,d]),s.extent([[g,j],[q,m]]),i.fitExtent([[n.left,n.top],[n.left+l-h,n.top+c]],s.outline());const B=M.range(j+d,m,d),A=M.range(g+u,q,u),C=S.geoPath(i).pointRadius(6),a=t=>C(t)||void 0,o=typeof x<"u"?p[x]:void 0,k=(o?i([o==null?void 0:o.long,o==null?void 0:o.lat]):[0,0])||[0,0];return e.jsxs(E.default,{width:W,height:$,className:L,children:[e.jsx("mask",{id:"imageMask",children:e.jsx("path",{d:a(s.outline()),fill:"white"})}),e.jsx(r.Background,{d:a(s.outline())}),e.jsx(r.Graticule,{d:a(s())}),e.jsx(r.ImageStackerWrapper,{style:{"--image-stack-opacity":O&&1},x:n.left,y:n.top,width:l-h,height:c,mask:"url(#imageMask)",children:e.jsx(U.default,{images:v,describedById:G,visible:w,loadCallback:()=>P(!0),showBackdrop:!1,showLoader:!1})}),e.jsx("g",{children:p.map(({id:t,lat:H,long:R},T)=>e.jsx(r.UserObject,{d:a({type:"Point",coordinates:[R,H]}),onMouseOver:()=>f(T),onMouseOut:()=>f(void 0)},t))}),e.jsx("g",{"aria-hidden":"true",children:B.map(t=>t===0?null:e.jsxs(r.LatLabel,{style:{dominantBaseline:t>0?"text-after-edge":"text-before-edge"},transform:`translate(${i([g,t])})`,children:[t,"°"]},t))}),e.jsx("g",{"aria-hidden":"true",children:A.map(t=>e.jsxs(r.LongLabel,{transform:`translate(${i([t,0])})`,children:[t,"°"]},t))}),e.jsx(r.Outline,{strokeWidth:h,d:a(s.outline())}),e.jsx(N.default,{visible:!!o,x:k[0],y:k[1],children:o==null?void 0:o.id})]})};y.displayName="Widgets.SupernovaThreeVector.Skymap";exports.default=y;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),S=require("react"),_=require("d3-geo-projection"),M=require("d3-geo"),q=require("d3-array"),E=require("../../../atomic/ImageStack/index.cjs"),a=require("./styles.cjs"),N=require("../../../charts/Base/index.cjs"),U=require("../../../charts/Tooltip/index.cjs"),y=({className:L,objects:p=[],images:v=[],visibleImages:w=[],describedById:G})=>{const[O,P]=S.useState(!1),[x,f]=S.useState(),l=600,c=300,n={top:20,right:0,bottom:20,left:20},W=l+n.right+n.left,$=c+n.top+n.bottom,d=15,u=30,j=-90,m=90,g=-180,k=180,h=2,i=_.geoAitoff(),s=M.geoGraticule();s.step([u,d]),s.extent([[g,j],[k,m]]),i.fitExtent([[n.left,n.top],[n.left+l-h,n.top+c]],s.outline());const B=q.range(j+d,m,d),A=q.range(g+u,k,u),C=M.geoPath(i).pointRadius(6),r=t=>C(t)||void 0,o=typeof x<"u"?p[x]:void 0,b=(o?i([o==null?void 0:o.long,o==null?void 0:o.lat]):[0,0])||[0,0];return e.jsxs(N.default,{width:W,height:$,className:L,children:[e.jsx("mask",{id:"imageMask",children:e.jsx("path",{d:r(s.outline()),fill:"white"})}),e.jsx(a.Background,{d:r(s.outline())}),e.jsx(a.Graticule,{d:r(s())}),e.jsx(a.ImageStackerWrapper,{style:{"--image-stack-opacity":O&&1},x:n.left,y:n.top,width:l-h,height:c,mask:"url(#imageMask)",children:e.jsx(E.default,{images:v,describedById:G,visible:w,loadCallback:()=>P(!0),showBackdrop:!1,showLoader:!1})}),e.jsx("g",{children:p.map(({id:t,lat:H,long:R},T)=>e.jsx(a.UserObject,{d:r({type:"Point",coordinates:[R,H]}),onMouseOver:()=>f(T),onMouseOut:()=>f(void 0)},t))}),e.jsx("g",{"aria-hidden":"true",children:B.map(t=>t===0?null:e.jsxs(a.LatLabel,{style:{dominantBaseline:t>0?"text-after-edge":"text-before-edge"},transform:`translate(${i([g,t])})`,children:[t,"°"]},t))}),e.jsx("g",{"aria-hidden":"true",children:A.map(t=>e.jsxs(a.LongLabel,{transform:`translate(${i([t,0])})`,children:[t,"°"]},t))}),e.jsx(a.Outline,{strokeWidth:h,d:r(s.outline())}),e.jsx(U.default,{visible:!!o,x:b[0],y:b[1],children:o==null?void 0:o.id})]})};y.displayName="Widgets.SupernovaThreeVector.Skymap";exports.default=y;