@rubin-epo/epo-widget-lib 0.10.0 → 0.10.2
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/FilterTool.cjs +1 -1
- package/dist/FilterTool.js +2 -1
- package/dist/localeStrings/fr/epo-widget-lib.json +78 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.cjs +1 -1
- package/dist/widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.js +36 -31
- package/package.json +2 -2
package/dist/FilterTool.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),i=require("react-i18next"),m=require("@rubin-epo/epo-react-lib/SelectListbox"),_=require("@rubin-epo/epo-react-lib/ColorSwatch"),r=require("./widgets/FilterTool/styles.cjs"),d=e=>e&&e.__esModule?e:{default:e},b=d(m),C=d(_),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),i=require("react-i18next"),m=require("@rubin-epo/epo-react-lib/SelectListbox"),_=require("@rubin-epo/epo-react-lib/ColorSwatch"),r=require("./widgets/FilterTool/styles.cjs"),d=e=>e&&e.__esModule?e:{default:e},b=d(m),C=d(_),c=({selectedColor:e="none",selectionCallback:f,isDisabled:j=!1,id:h,labelledById:u})=>{const{t:l}=i.useTranslation(),t={violet:"#861cff",blue:"#006da8",green:"#6bd853",yellow:"#ffdd15",orange:"#f18922",red:"#ec1c24",none:"transparent"},p={violet:"M546.1,312.5l212.8,1.9h0.4l0.5,0.2L1396,522.8c6.9,2.3,10.7,9.7,8.5,16.7s-9.7,10.7-16.7,8.5l0,0l-0.4-0.1L757.8,320.4l0.9,0.2L546.1,312.5z",blue:"M546.1,312.4l206.5-4.4h0.4l0.4,0.1l641.1,164c7,1.8,11.2,8.9,9.4,15.9c-1.8,7-8.9,11.2-15.9,9.4l-0.4-0.1L751.8,313.8l0.8,0.1L546.1,312.4z",green:"M547.8,312l200.6-10.6h0.3l0.4,0.1l644.8,120.3c7,1.4,11.5,8.2,10.1,15.2c-1.4,6.9-8,11.4-14.9,10.2l-0.4-0.1L747.8,307.4l0.7,0.1L547.8,312z",yellow:"M546.1,312.5l205.8-17.3h0.3h0.4l640.4,75.3c7.1,0.8,12.2,7.2,11.3,14.3c-0.8,7.1-7.2,12.2-14.3,11.3l-0.4-0.1l-637.9-94.5h0.6L546.1,312.5z",orange:"M546.1,311l189.3-21.8h0.2h0.3l656.5,33.3c7,0.4,12.4,6.3,12,13.3s-6.3,12.4-13.3,12h-0.4l-655.2-52.9h0.5L546.1,311z",red:"M546.1,311L730,283.9h0.1h0.2l661.4-9.9c6.9-0.1,12.6,5.4,12.7,12.3s-5.4,12.6-12.3,12.7h-0.4l-661.4-9.8h0.4L546.1,311z"},n={violet:[[1426.5,547.9],[1353.2,550.6],[1377.9,530.1],[1372.3,498.5]],blue:[[1431.5,496.4],[1358.6,504.1],[1381.8,482],[1374.1,450.9]],green:[[1437.9,443.4],[1366.1,458.4],[1387,434.1],[1376.2,403.9]],yellow:[[1438.9,389.7],[1368,408.2],[1387.6,382.8],[1375.4,353.3]],orange:[[1443.7,340.3],[1373.9,362.8],[1392.1,336.4],[1378.2,307.5]],red:[[1441.9,290],[1372.4,313.2],[1390.3,286.6],[1376.1,257.9]]},g=Object.keys(t).map(s=>({value:s,label:l(`filterTool.colors.${s}`),icon:o.jsx(C.default,{color:s,size:"small"})})),x=s=>e!==s&&e!=="none",y=l("filterTool.selectLabel"),a=e==="none";return o.jsxs(r.Wrapper,{ratio:"landscape",children:[o.jsxs(r.PrismSVG,{version:"1.1",viewBox:"0 0 1551.6 736.7","aria-labelledby":u,children:[o.jsxs("defs",{children:[o.jsxs("linearGradient",{id:"no-arrow-red",children:[o.jsx("stop",{offset:"0%",stopColor:t.red}),o.jsx("stop",{offset:"81%",stopColor:t.red}),o.jsx("stop",{offset:"81%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-orange",children:[o.jsx("stop",{offset:"0%",stopColor:t.orange}),o.jsx("stop",{offset:"80%",stopColor:t.orange}),o.jsx("stop",{offset:"80%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-yellow",children:[o.jsx("stop",{offset:"0%",stopColor:t.yellow}),o.jsx("stop",{offset:"79%",stopColor:t.yellow}),o.jsx("stop",{offset:"79%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-green",children:[o.jsx("stop",{offset:"0%",stopColor:t.green}),o.jsx("stop",{offset:"78%",stopColor:t.green}),o.jsx("stop",{offset:"78%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-blue",children:[o.jsx("stop",{offset:"0%",stopColor:t.blue}),o.jsx("stop",{offset:"77%",stopColor:t.blue}),o.jsx("stop",{offset:"77%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-violet",children:[o.jsx("stop",{offset:"0%",stopColor:t.violet}),o.jsx("stop",{offset:"77%",stopColor:t.violet}),o.jsx("stop",{offset:"77%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]})]}),o.jsxs("radialGradient",{id:"gradient_1_",cx:"718.4264",cy:"-294.6529",r:"417.8",fx:"638.9412",fy:"-303.5418",gradientTransform:"matrix(1 0 0 1 0 534)",gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{offset:"0.12",style:{stopColor:"#FFFFFF"}}),o.jsx("stop",{offset:"1",style:{stopColor:"#000000"}})]}),o.jsxs("g",{children:[o.jsx(r.WhiteLine,{id:"white_ray",x1:"108.2",y1:"463.3",x2:"546.1",y2:"312.5"}),o.jsx(r.WhiteLine,{id:"white_light_arrow_line",x1:"376.8",y1:"327.9",x2:"430",y2:"309.6"}),o.jsx("polygon",{id:"white_light_arrow",points:"420.7,325.4 428.1,310.3 413,302.9 422.5,299.7 437.6,307 430.2,322.1",fill:"#ffffff"}),o.jsx("text",{transform:"matrix(0.9446 -0.3282 0.3282 0.9446 370 342.5)",textAnchor:"end",fill:"#ffffff",children:o.jsx(i.Trans,{i18nKey:"filterTool.whiteLight"})})]}),o.jsxs("g",{children:[o.jsx("text",{transform:"matrix(1 0 0 1 598.2964 606.0872)",fill:"#ffffff",children:o.jsx(i.Trans,{i18nKey:"filterTool.prism"})}),o.jsx("polygon",{id:"gradient",points:"653.2,127 867.4,498 438.9,498",fill:"url(#gradient_1_)",style:{opacity:.3}})]}),o.jsx(r.PrismOutline,{id:"outline",points:"653.2,127 760.3,312.5 867.4,498 653.2,498 438.9,498 546.1,312.5 "}),o.jsx("g",{role:"list",id:"rays_out","aria-label":l("filterTool.light_out"),children:Object.keys(p).map(s=>o.jsx(r.Ray,{id:`${s}_ray`,style:{"--ray-fill":x(s)?`url(#no-arrow-${s})`:t[s]},d:p[s],role:"listitem","aria-label":l(`filterTool.colors.${s}`)},s))}),o.jsxs("g",{children:[o.jsx("text",{transform:"matrix(1 0 0 1 1206.5464 164.1372)",fill:"#ffffff",children:o.jsx(i.Trans,{i18nKey:"filterTool.filter"})}),o.jsx(r.Filter,{id:"filter",x1:"1255.6",y1:"235.7",x2:"1193.1",y2:"550.3",stroke:t[e],fill:"#ffffff","aria-label":l(`filterTool.colors.${e}`)})]}),o.jsxs("g",{role:"list",id:"rays_filtered","aria-label":l("filterTool.light_filtered"),children:[Object.keys(n).map(s=>o.jsx(r.Arrow,{id:`${s}_arrow`,style:{"--arrow-opacity":x(s)&&0,"--arrow-fill":t[s]},points:n[s].map(w=>w.join(",")).join(" "),role:a?"listitem":"presentation","aria-label":a?l(`filterTool.colors.${s}`):void 0},s)),!a&&o.jsx("text",{role:"listitem",x:n[e][3][0],y:n[e][3][1],fill:"#ffffff",dy:"-25",children:o.jsx(i.Trans,{i18nKey:`filterTool.colors.${e}`})})]})]}),o.jsx(r.SelectContainer,{children:o.jsx(b.default,{options:g,isDisabled:j,value:e,onChangeCallback:s=>f&&f(s||"none"),placeholder:y,maxWidth:"100%",width:"200px",id:h})})]})};c.displayName="Widgets.FilterTool";exports.default=c;
|
package/dist/FilterTool.js
CHANGED
|
@@ -163,7 +163,8 @@ const j = ({
|
|
|
163
163
|
/* @__PURE__ */ o(
|
|
164
164
|
"text",
|
|
165
165
|
{
|
|
166
|
-
transform: "matrix(0.9446 -0.3282 0.3282 0.9446
|
|
166
|
+
transform: "matrix(0.9446 -0.3282 0.3282 0.9446 370 342.5)",
|
|
167
|
+
textAnchor: "end",
|
|
167
168
|
fill: "#ffffff",
|
|
168
169
|
children: /* @__PURE__ */ o(n, { i18nKey: "filterTool.whiteLight" })
|
|
169
170
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"blinker": {
|
|
3
|
+
"controls": {
|
|
4
|
+
"backward": "Revenir en arrière",
|
|
5
|
+
"forward": "Avancer",
|
|
6
|
+
"play": "Lecture",
|
|
7
|
+
"pause": "Pause"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"elapsed_time": {
|
|
11
|
+
"title": "Temps écoulé",
|
|
12
|
+
"step": {
|
|
13
|
+
"day_one": "Jour",
|
|
14
|
+
"day_other": "Jours",
|
|
15
|
+
"hour_one": "Heure",
|
|
16
|
+
"hour_other": "Heures",
|
|
17
|
+
"minute_one": "Minute",
|
|
18
|
+
"minute_other": "Minutes",
|
|
19
|
+
"second_one": "Seconde",
|
|
20
|
+
"second_other": "Secondes",
|
|
21
|
+
"year_one": "Année",
|
|
22
|
+
"year_other": "Années"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"filterTool": {
|
|
26
|
+
"title": "Outil Filtre",
|
|
27
|
+
"filter": "Filtre",
|
|
28
|
+
"whiteLight": "Lumière blanche",
|
|
29
|
+
"prism": "Prisme",
|
|
30
|
+
"selectLabel": "Sélectionner un filtre :",
|
|
31
|
+
"light_out": "Lumière éteinte",
|
|
32
|
+
"light_filtered": "Lumière filtrée",
|
|
33
|
+
"colors": {
|
|
34
|
+
"violet": "Violet",
|
|
35
|
+
"blue": "Bleu",
|
|
36
|
+
"green": "Vert",
|
|
37
|
+
"yellow": "Jaune",
|
|
38
|
+
"orange": "Orange",
|
|
39
|
+
"red": "Rouge",
|
|
40
|
+
"none": "Aucun"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"colorTool": {
|
|
44
|
+
"labels": {
|
|
45
|
+
"object_type": "Type d'objet:",
|
|
46
|
+
"object": "Objet:",
|
|
47
|
+
"object_selected": "Objet sélectionné :",
|
|
48
|
+
"filter": "Filtre",
|
|
49
|
+
"color": "Couleur",
|
|
50
|
+
"color_intensity": "Intensité de la couleur"
|
|
51
|
+
},
|
|
52
|
+
"actions": {
|
|
53
|
+
"select_an_object": "Sélectionner un objet",
|
|
54
|
+
"select_filter": "Sélectionner un filtre",
|
|
55
|
+
"reset": "Réinitialiser",
|
|
56
|
+
"export": "Exporter"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"source_selector": {
|
|
60
|
+
"messages": {
|
|
61
|
+
"success": "Tu as trouvé !",
|
|
62
|
+
"failure": "Essaye encore."
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"camera_filter": {
|
|
66
|
+
"title": "Gamme de filtres de la caméra LSST de l'Observatoire Rubin",
|
|
67
|
+
"labels": {
|
|
68
|
+
"select": "Sélectionner l'un des filtres Rubin",
|
|
69
|
+
"option": "Filtre {{band}}",
|
|
70
|
+
"option_none": "Aucun filtre",
|
|
71
|
+
"captured_range": "Spectres électromagnetiques obtenus en appliquant le filtre {{filter}}",
|
|
72
|
+
"captured_range_no_filter": "Spectres électromagnetiques obtenus sans filtre",
|
|
73
|
+
"ultraviolet": "Ultraviolet",
|
|
74
|
+
"visible": "Lumière visible",
|
|
75
|
+
"infrared": "Infrarouge"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),g=require("react-i18next"),M=require("../../../../lib/utils.cjs"),s=require("../../styles.cjs"),a=({colors:r,activeRange:x,isBandSelected:d,isCondensed:t})=>{const{t:u,i18n:{language:m}}=g.useTranslation(),n=t?350:r[0].range[0],h=(t?1e3:820)-n,b=Math.floor(h/(r.length-1));return e.jsx("g",{role:"list","data-testid":"color-labels",children:r.map(({name:c,range:l,color:j},y)=>{const o=n+b*y,p=d&&M.intersection(l,x)===null,i=(l[0]+l[1])/2;return e.jsxs("g",{children:[e.jsx("line",{strokeWidth:1,stroke:"#b2b2b2",x1:i,x2:i,y1:"100",y2:t?"105":"110",role:"presentation"}),e.jsx("line",{strokeWidth:1,stroke:"#b2b2b2",x1:i,x2:o,y1:t?"105":"110",y2:t?"145":"140",role:"presentation"}),e.jsx("circle",{cx:o,cy:t?"145":"140",r:t?15:10,fill:j,role:"presentation"}),e.jsxs("text",{x:o,dominantBaseline:"middle",textAnchor:"middle",y:"150",role:"listitem","aria-hidden":p,children:[e.jsx(s.ColorName,{x:o,dy:"1.25em",textAnchor:"middle",children:u(`filterTool.colors.${c}`).toLocaleLowerCase(m)}),e.jsx(s.ColorSpectrum,{x:o,dy:"1.25em",textAnchor:"middle",children:l.join("–")}),e.jsx(s.ColorSpectrumUnit,{x:o,dy:"1.25em",textAnchor:"middle",children:"nm"})]})]},c)})})};a.displayName="Widgets.CameraFilter.ColorLabels";const f=a;exports.default=f;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as a } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation as g } from "react-i18next";
|
|
4
|
+
import { intersection as L } from "../../../../lib/utils.js";
|
|
5
|
+
import { ColorName as k, ColorSpectrum as A, ColorSpectrumUnit as M } from "../../styles.js";
|
|
6
|
+
const s = ({
|
|
7
|
+
colors: r,
|
|
8
|
+
activeRange: m,
|
|
7
9
|
isBandSelected: d,
|
|
8
10
|
isCondensed: t
|
|
9
11
|
}) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const {
|
|
13
|
+
t: x,
|
|
14
|
+
i18n: { language: h }
|
|
15
|
+
} = g(), n = t ? 350 : r[0].range[0], p = (t ? 1e3 : 820) - n, b = Math.floor(p / (r.length - 1));
|
|
16
|
+
return /* @__PURE__ */ o("g", { role: "list", "data-testid": "color-labels", children: r.map(({ name: c, range: l, color: y }, u) => {
|
|
17
|
+
const e = n + b * u, f = d && L(l, m) === null, i = (l[0] + l[1]) / 2;
|
|
13
18
|
return /* @__PURE__ */ a("g", { children: [
|
|
14
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ o(
|
|
15
20
|
"line",
|
|
16
21
|
{
|
|
17
22
|
strokeWidth: 1,
|
|
@@ -23,60 +28,60 @@ const m = ({
|
|
|
23
28
|
role: "presentation"
|
|
24
29
|
}
|
|
25
30
|
),
|
|
26
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ o(
|
|
27
32
|
"line",
|
|
28
33
|
{
|
|
29
34
|
strokeWidth: 1,
|
|
30
35
|
stroke: "#b2b2b2",
|
|
31
36
|
x1: i,
|
|
32
|
-
x2:
|
|
37
|
+
x2: e,
|
|
33
38
|
y1: t ? "105" : "110",
|
|
34
39
|
y2: t ? "145" : "140",
|
|
35
40
|
role: "presentation"
|
|
36
41
|
}
|
|
37
42
|
),
|
|
38
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ o(
|
|
39
44
|
"circle",
|
|
40
45
|
{
|
|
41
|
-
cx:
|
|
46
|
+
cx: e,
|
|
42
47
|
cy: t ? "145" : "140",
|
|
43
48
|
r: t ? 15 : 10,
|
|
44
|
-
fill:
|
|
49
|
+
fill: y,
|
|
45
50
|
role: "presentation"
|
|
46
51
|
}
|
|
47
52
|
),
|
|
48
53
|
/* @__PURE__ */ a(
|
|
49
54
|
"text",
|
|
50
55
|
{
|
|
51
|
-
x:
|
|
56
|
+
x: e,
|
|
52
57
|
dominantBaseline: "middle",
|
|
53
58
|
textAnchor: "middle",
|
|
54
59
|
y: "150",
|
|
55
60
|
role: "listitem",
|
|
56
|
-
"aria-hidden":
|
|
61
|
+
"aria-hidden": f,
|
|
57
62
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
63
|
+
/* @__PURE__ */ o(
|
|
64
|
+
k,
|
|
60
65
|
{
|
|
61
|
-
x:
|
|
66
|
+
x: e,
|
|
62
67
|
dy: "1.25em",
|
|
63
68
|
textAnchor: "middle",
|
|
64
|
-
children: c
|
|
69
|
+
children: x(`filterTool.colors.${c}`).toLocaleLowerCase(h)
|
|
65
70
|
}
|
|
66
71
|
),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
72
|
+
/* @__PURE__ */ o(
|
|
73
|
+
A,
|
|
69
74
|
{
|
|
70
|
-
x:
|
|
75
|
+
x: e,
|
|
71
76
|
dy: "1.25em",
|
|
72
77
|
textAnchor: "middle",
|
|
73
|
-
children:
|
|
78
|
+
children: l.join("–")
|
|
74
79
|
}
|
|
75
80
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
81
|
+
/* @__PURE__ */ o(
|
|
82
|
+
M,
|
|
78
83
|
{
|
|
79
|
-
x:
|
|
84
|
+
x: e,
|
|
80
85
|
dy: "1.25em",
|
|
81
86
|
textAnchor: "middle",
|
|
82
87
|
children: "nm"
|
|
@@ -88,8 +93,8 @@ const m = ({
|
|
|
88
93
|
] }, c);
|
|
89
94
|
}) });
|
|
90
95
|
};
|
|
91
|
-
|
|
92
|
-
const
|
|
96
|
+
s.displayName = "Widgets.CameraFilter.ColorLabels";
|
|
97
|
+
const T = s;
|
|
93
98
|
export {
|
|
94
|
-
|
|
99
|
+
T as default
|
|
95
100
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubin-epo/epo-widget-lib",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
|
|
5
5
|
"author": "Rubin EPO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-i18next": "^12.2.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@rubin-epo/epo-react-lib": "
|
|
41
|
+
"@rubin-epo/epo-react-lib": "~2.0",
|
|
42
42
|
"context-filter-polyfill": "^0.3.6",
|
|
43
43
|
"d3-array": "^3.2.4",
|
|
44
44
|
"d3-geo": "^3.1.0",
|