@rubin-epo/epo-widget-lib 0.5.1-alpha.1 → 0.6.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/CameraFilter.d.ts +3 -0
- package/dist/ColorTool.cjs +1 -1
- package/dist/ColorTool.d.ts +3 -0
- package/dist/ColorTool.js +115 -79
- package/dist/FilterTool.d.ts +3 -0
- package/dist/SourceSelector.d.ts +3 -0
- package/dist/{types/cjs/atomic/PlaybackControl/styles.d.cts → atomic/PlaybackControl/styles.d.ts} +1 -1
- package/dist/hooks/useImage.cjs +1 -0
- package/dist/hooks/useImage.d.ts +10 -0
- package/dist/hooks/useImage.js +30 -0
- package/dist/lib/reimg.cjs +1 -0
- package/dist/lib/reimg.d.ts +7 -0
- package/dist/lib/reimg.js +60 -0
- package/dist/widgets/ColorTool/Actions/Export/index.cjs +1 -0
- package/dist/widgets/ColorTool/Actions/Export/index.d.ts +12 -0
- package/dist/widgets/ColorTool/Actions/Export/index.js +36 -0
- package/dist/widgets/ColorTool/Actions/Reset/index.cjs +1 -0
- package/dist/widgets/ColorTool/Actions/Reset/index.d.ts +9 -0
- package/dist/widgets/ColorTool/Actions/Reset/index.js +39 -0
- package/dist/widgets/ColorTool/Actions/index.cjs +1 -0
- package/dist/widgets/ColorTool/Actions/index.d.ts +13 -0
- package/dist/widgets/ColorTool/Actions/index.js +55 -0
- package/dist/widgets/ColorTool/Actions/styles.cjs +5 -0
- package/dist/widgets/ColorTool/Actions/styles.d.ts +272 -0
- package/dist/widgets/ColorTool/Actions/styles.js +9 -0
- package/dist/{types/cjs/widgets/ColorTool/ColorTool.d.cts → widgets/ColorTool/ColorTool.d.ts} +11 -5
- package/dist/widgets/ColorTool/FilterControls/FilterControls.cjs +1 -1
- package/dist/widgets/ColorTool/FilterControls/FilterControls.js +43 -41
- package/dist/widgets/ColorTool/FilterControls/styles.cjs +58 -0
- package/dist/widgets/ColorTool/FilterControls/styles.d.ts +956 -0
- package/dist/widgets/ColorTool/FilterControls/styles.js +67 -0
- package/dist/widgets/ColorTool/FilterImage/FilterImage.cjs +1 -1
- package/dist/widgets/ColorTool/FilterImage/FilterImage.d.ts +16 -0
- package/dist/widgets/ColorTool/FilterImage/FilterImage.js +40 -31
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.cjs +1 -1
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.d.ts +12 -0
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.js +54 -29
- package/dist/widgets/ColorTool/ImageComposite/styles.cjs +19 -0
- package/dist/widgets/ColorTool/ImageComposite/styles.d.ts +544 -0
- package/dist/widgets/ColorTool/ImageComposite/styles.js +24 -0
- package/dist/widgets/ColorTool/styles.cjs +21 -77
- package/dist/{types/cjs/widgets/ColorTool/styles.d.cts → widgets/ColorTool/styles.d.ts} +276 -1207
- package/dist/widgets/ColorTool/styles.js +29 -96
- package/dist/widgets/ColorTool/utilities.cjs +1 -1
- package/dist/{types/cjs/widgets/ColorTool/utilities.d.cts → widgets/ColorTool/utilities.d.ts} +3 -2
- package/dist/widgets/ColorTool/utilities.js +30 -29
- package/package.json +7 -43
- package/dist/types/CameraFilter.d.ts +0 -6
- package/dist/types/ColorTool.d.ts +0 -45
- package/dist/types/FilterTool.d.ts +0 -16
- package/dist/types/SourceSelector.d.ts +0 -28
- package/dist/types/cjs/CameraFilter.d.cts +0 -1
- package/dist/types/cjs/ColorTool.d.cts +0 -1
- package/dist/types/cjs/FilterTool.d.cts +0 -1
- package/dist/types/cjs/SourceSelector.d.cts +0 -1
- package/dist/types/cjs/widgets/ColorTool/FilterImage/FilterImage.d.cts +0 -11
- package/dist/types/cjs/widgets/ColorTool/ImageComposite/ImageComposite.d.cts +0 -7
- /package/dist/{types/cjs/atomic/Blinker/Blinker.d.cts → atomic/Blinker/Blinker.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/Controls/Controls.d.cts → atomic/Blinker/Controls/Controls.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/Controls/styles.d.cts → atomic/Blinker/Controls/styles.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/Image/Image.d.cts → atomic/Blinker/Image/Image.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/Image/styles.d.cts → atomic/Blinker/Image/styles.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/Images/Images.d.cts → atomic/Blinker/Images/Images.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/Images/styles.d.cts → atomic/Blinker/Images/styles.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/_mocks/index.d.cts → atomic/Blinker/_mocks/index.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/Blinker/index.d.cts → atomic/Blinker/index.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/ElapsedTime/ElapsedTime.d.cts → atomic/ElapsedTime/ElapsedTime.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/ElapsedTime/index.d.cts → atomic/ElapsedTime/index.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/ElapsedTime/styles.d.cts → atomic/ElapsedTime/styles.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/PlaybackControl/PlaybackControl.d.cts → atomic/PlaybackControl/PlaybackControl.d.ts} +0 -0
- /package/dist/{types/cjs/atomic/PlaybackControl/index.d.cts → atomic/PlaybackControl/index.d.ts} +0 -0
- /package/dist/{types/cjs/hooks/useInterval.d.cts → hooks/useInterval.d.ts} +0 -0
- /package/dist/{types/cjs/lib/utils.d.cts → lib/utils.d.ts} +0 -0
- /package/dist/{types/cjs/lib/utils.test.d.cts → lib/utils.test.d.ts} +0 -0
- /package/dist/{types/cjs/styles/svg.d.cts → styles/svg.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/CameraFilter.d.cts → widgets/CameraFilter/CameraFilter.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.d.cts → widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/CondensedFilterRanges/index.d.cts → widgets/CameraFilter/CondensedFilterRanges/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.d.cts → widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/SpectrumDisplay/ColorLabels/index.d.cts → widgets/CameraFilter/SpectrumDisplay/ColorLabels/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.d.cts → widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/SpectrumLabels.d.cts → widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/SpectrumLabels.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/index.d.cts → widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/SpectrumDisplay/index.d.cts → widgets/CameraFilter/SpectrumDisplay/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/data.d.cts → widgets/CameraFilter/data.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/index.d.cts → widgets/CameraFilter/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/CameraFilter/styles.d.cts → widgets/CameraFilter/styles.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/ColorTool/FilterControls/FilterControls.d.cts → widgets/ColorTool/FilterControls/FilterControls.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/ColorTool/FilterControls/index.d.cts → widgets/ColorTool/FilterControls/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/ColorTool/FilterImage/index.d.cts → widgets/ColorTool/FilterImage/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/ColorTool/ImageComposite/index.d.cts → widgets/ColorTool/ImageComposite/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/ColorTool/index.d.cts → widgets/ColorTool/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/FilterTool/FilterTool.d.cts → widgets/FilterTool/FilterTool.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/FilterTool/index.d.cts → widgets/FilterTool/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/FilterTool/styles.d.cts → widgets/FilterTool/styles.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Message/Message.d.cts → widgets/SourceSelector/Message/Message.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Message/index.d.cts → widgets/SourceSelector/Message/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Message/styles.d.cts → widgets/SourceSelector/Message/styles.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Point/Point.d.cts → widgets/SourceSelector/Point/Point.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Point/index.d.cts → widgets/SourceSelector/Point/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Point/styles.d.cts → widgets/SourceSelector/Point/styles.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Points/Points.d.cts → widgets/SourceSelector/Points/Points.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/Points/index.d.cts → widgets/SourceSelector/Points/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/SourceSelector.d.cts → widgets/SourceSelector/SourceSelector.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/index.d.cts → widgets/SourceSelector/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/mocks/index.d.cts → widgets/SourceSelector/mocks/index.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/utilities.d.cts → widgets/SourceSelector/utilities.d.ts} +0 -0
- /package/dist/{types/cjs/widgets/SourceSelector/utilities.test.d.cts → widgets/SourceSelector/utilities.test.d.ts} +0 -0
package/dist/ColorTool.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),x=require("react"),N=require("react-i18next"),O=require("./widgets/ColorTool/utilities.cjs"),o=require("./widgets/ColorTool/styles.cjs"),W=require("@rubin-epo/epo-react-lib/SelectListbox"),H=require("./widgets/ColorTool/Actions/index.cjs"),y=require("./widgets/ColorTool/ImageComposite/ImageComposite.cjs"),R=require("./widgets/ColorTool/FilterControls/FilterControls.cjs"),$=l=>l&&l.__esModule?l:{default:l},v=$(W),T=({data:l,objectOptions:p=[],selectedData:n,colorOptions:L=[],selectionCallback:r,isDisabled:u=!1,isDisplayOnly:C=!1,config:S={actions:["reset"],width:600,height:600,hideSubtitle:!1}})=>{var g;const _={actions:["reset"],width:600,height:600,hideSubtitle:!1},h=x.useRef(null),{t:a}=N.useTranslation(),q=x.useCallback(t=>{const{label:f}=t,{filters:b}=n,M=b.map(m=>m.label===f?t:m);return r&&r({...n,filters:M})},[n,r]),F=x.useCallback(t=>{if(t!==null)return r&&r({name:t,filters:O.getDataFiltersByName(l,t)})},[r,l]),{filters:c,name:d}=n,{actions:w,width:s,height:i,hideSubtitle:B}={..._,...S};if(C)return e.jsx(y.default,{ref:h,filters:c,width:s,height:i,selectedObjectName:d});const j=l.length>1,I=a("colorTool.actions.select_an_object");return e.jsx(o.WidgetContainer,{children:e.jsxs(o.WidgetLayout,{style:{"--image-width":typeof s=="number"?`${s}px`:s,"--image-height":typeof i=="number"?`${i}px`:i},children:[d&&j&&e.jsx(o.Title,{children:!B&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:a("colorTool.labels.object")}),e.jsx("dd",{children:d})]})}),e.jsxs(o.ControlsContainer,{children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(o.ToolsHeader,{id:"filterLabel",children:a("colorTool.labels.filter")}),e.jsx(o.ToolsHeader,{id:"colorLabel",children:a("colorTool.labels.color")}),e.jsx(o.ToolsHeader,{id:"intensityLabel",children:a("colorTool.labels.color_intensity")})]}),c&&c.map(t=>{const{label:f,isDisabled:b}=t;return e.jsx(R.default,{filter:t,isDisabled:u||b,colorOptions:L,onChangeFilterCallback:q,buttonLabelledById:"filterLabel",selectLabelledById:"colorLabel",sliderLabelledById:"intensityLabel"},`filter-${f}`)})]}),e.jsx(y.default,{ref:h,filters:c,width:s,height:i,selectedObjectName:d,children:j&&e.jsx(o.SelectionContainer,{children:e.jsx(v.default,{id:"astroObjectSelector",placeholder:I,options:p,onChangeCallback:F,value:d,isDisabled:u,width:"100%",maxWidth:"100%"})})}),e.jsx(H.default,{actions:w,images:(g=h.current)==null?void 0:g.getElementsByTagName("canvas"),selectedData:n,width:s,height:i,isDisabled:u,selectionCallback:r})]})})};T.displayName="Widgets.ColorTool";exports.default=T;
|
package/dist/ColorTool.js
CHANGED
|
@@ -1,103 +1,139 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as $, useCallback as T } from "react";
|
|
3
|
+
import { useTranslation as R } from "react-i18next";
|
|
4
|
+
import { getDataFiltersByName as A } from "./widgets/ColorTool/utilities.js";
|
|
5
|
+
import { WidgetContainer as E, WidgetLayout as H, Title as M, ControlsContainer as P, ToolsHeader as p, SelectionContainer as q } from "./widgets/ColorTool/styles.js";
|
|
6
|
+
import v from "@rubin-epo/epo-react-lib/SelectListbox";
|
|
7
|
+
import z from "./widgets/ColorTool/Actions/index.js";
|
|
8
|
+
import C from "./widgets/ColorTool/ImageComposite/ImageComposite.js";
|
|
9
|
+
import G from "./widgets/ColorTool/FilterControls/FilterControls.js";
|
|
8
10
|
const J = ({
|
|
9
|
-
data:
|
|
10
|
-
objectOptions:
|
|
11
|
-
selectedData:
|
|
12
|
-
colorOptions:
|
|
13
|
-
selectionCallback:
|
|
14
|
-
isDisabled:
|
|
15
|
-
isDisplayOnly:
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
data: d,
|
|
12
|
+
objectOptions: j = [],
|
|
13
|
+
selectedData: i,
|
|
14
|
+
colorOptions: x = [],
|
|
15
|
+
selectionCallback: o,
|
|
16
|
+
isDisabled: h = !1,
|
|
17
|
+
isDisplayOnly: S = !1,
|
|
18
|
+
config: w = {
|
|
19
|
+
actions: ["reset"],
|
|
20
|
+
width: 600,
|
|
21
|
+
height: 600,
|
|
22
|
+
hideSubtitle: !1
|
|
23
|
+
}
|
|
18
24
|
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
var g;
|
|
26
|
+
const B = {
|
|
27
|
+
actions: ["reset"],
|
|
28
|
+
width: 600,
|
|
29
|
+
height: 600,
|
|
30
|
+
hideSubtitle: !1
|
|
31
|
+
}, m = $(null), { t: n } = R(), F = T(
|
|
32
|
+
(t) => {
|
|
33
|
+
const { label: f } = t, { filters: b } = i, _ = b.map(
|
|
34
|
+
(y) => y.label === f ? t : y
|
|
35
|
+
);
|
|
36
|
+
return o && o({
|
|
37
|
+
...i,
|
|
38
|
+
filters: _
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
[i, o]
|
|
42
|
+
), I = T(
|
|
43
|
+
(t) => {
|
|
44
|
+
if (t !== null)
|
|
45
|
+
return o && o({
|
|
46
|
+
name: t,
|
|
47
|
+
filters: A(d, t)
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
[o, d]
|
|
51
|
+
), { filters: s, name: a } = i, { actions: N, width: l, height: r, hideSubtitle: W } = {
|
|
52
|
+
...B,
|
|
53
|
+
...w
|
|
54
|
+
};
|
|
55
|
+
if (S)
|
|
56
|
+
return /* @__PURE__ */ e(
|
|
57
|
+
C,
|
|
58
|
+
{
|
|
59
|
+
ref: m,
|
|
60
|
+
filters: s,
|
|
61
|
+
width: l,
|
|
62
|
+
height: r,
|
|
63
|
+
selectedObjectName: a
|
|
64
|
+
}
|
|
22
65
|
);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
}, B = (t) => {
|
|
28
|
-
const { value: n } = t.target;
|
|
29
|
-
return r && r({
|
|
30
|
-
name: n,
|
|
31
|
-
filters: W(h, n)
|
|
32
|
-
});
|
|
33
|
-
}, F = () => r && r({
|
|
34
|
-
...l,
|
|
35
|
-
filters: _(l.filters)
|
|
36
|
-
}), a = h.length > 1, { t: o } = x(), N = o("colorTool.actions.select_an_object"), { filters: d, name: s, caption: p } = l, S = I(h, s);
|
|
37
|
-
return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ i(
|
|
38
|
-
A,
|
|
66
|
+
const u = d.length > 1, O = n("colorTool.actions.select_an_object");
|
|
67
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c(
|
|
68
|
+
H,
|
|
39
69
|
{
|
|
40
70
|
style: {
|
|
41
|
-
"--
|
|
71
|
+
"--image-width": typeof l == "number" ? `${l}px` : l,
|
|
72
|
+
"--image-height": typeof r == "number" ? `${r}px` : r
|
|
42
73
|
},
|
|
43
74
|
children: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
75
|
+
a && u && /* @__PURE__ */ e(M, { children: !W && /* @__PURE__ */ c(L, { children: [
|
|
76
|
+
/* @__PURE__ */ e("dt", { children: n("colorTool.labels.object") }),
|
|
77
|
+
/* @__PURE__ */ e("dd", { children: a })
|
|
78
|
+
] }) }),
|
|
79
|
+
/* @__PURE__ */ c(P, { children: [
|
|
80
|
+
s && /* @__PURE__ */ c(L, { children: [
|
|
81
|
+
/* @__PURE__ */ e(p, { id: "filterLabel", children: n("colorTool.labels.filter") }),
|
|
82
|
+
/* @__PURE__ */ e(p, { id: "colorLabel", children: n("colorTool.labels.color") }),
|
|
83
|
+
/* @__PURE__ */ e(p, { id: "intensityLabel", children: n("colorTool.labels.color_intensity") })
|
|
48
84
|
] }),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
context: a ? "selected" : !1
|
|
52
|
-
}) }),
|
|
53
|
-
/* @__PURE__ */ e("dd", { children: s })
|
|
54
|
-
] })
|
|
55
|
-
] }),
|
|
56
|
-
!c && /* @__PURE__ */ i(M, { children: [
|
|
57
|
-
a && /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
58
|
-
z,
|
|
59
|
-
{
|
|
60
|
-
id: "astroObjectSelector",
|
|
61
|
-
placeholder: N,
|
|
62
|
-
options: C,
|
|
63
|
-
onChange: B,
|
|
64
|
-
value: s,
|
|
65
|
-
disabled: m
|
|
66
|
-
}
|
|
67
|
-
) }),
|
|
68
|
-
d && /* @__PURE__ */ i(b, { children: [
|
|
69
|
-
/* @__PURE__ */ e(g, { id: "filterLabel", children: o("colorTool.labels.filter") }),
|
|
70
|
-
/* @__PURE__ */ e(g, { id: "colorLabel", children: o("colorTool.labels.color") }),
|
|
71
|
-
/* @__PURE__ */ e(g, { id: "intensityLabel", children: o("colorTool.labels.color_intensity") })
|
|
72
|
-
] }),
|
|
73
|
-
d && d.map((t) => {
|
|
74
|
-
const { label: n, isDisabled: f } = t;
|
|
85
|
+
s && s.map((t) => {
|
|
86
|
+
const { label: f, isDisabled: b } = t;
|
|
75
87
|
return /* @__PURE__ */ e(
|
|
76
|
-
|
|
88
|
+
G,
|
|
77
89
|
{
|
|
78
90
|
filter: t,
|
|
79
|
-
isDisabled:
|
|
80
|
-
colorOptions:
|
|
81
|
-
onChangeFilterCallback:
|
|
91
|
+
isDisabled: h || b,
|
|
92
|
+
colorOptions: x,
|
|
93
|
+
onChangeFilterCallback: F,
|
|
82
94
|
buttonLabelledById: "filterLabel",
|
|
83
95
|
selectLabelledById: "colorLabel",
|
|
84
96
|
sliderLabelledById: "intensityLabel"
|
|
85
97
|
},
|
|
86
|
-
`filter-${
|
|
98
|
+
`filter-${f}`
|
|
87
99
|
);
|
|
88
100
|
})
|
|
89
101
|
] }),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
$,
|
|
102
|
+
/* @__PURE__ */ e(
|
|
103
|
+
C,
|
|
93
104
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
ref: m,
|
|
106
|
+
filters: s,
|
|
107
|
+
width: l,
|
|
108
|
+
height: r,
|
|
109
|
+
selectedObjectName: a,
|
|
110
|
+
children: u && /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(
|
|
111
|
+
v,
|
|
112
|
+
{
|
|
113
|
+
id: "astroObjectSelector",
|
|
114
|
+
placeholder: O,
|
|
115
|
+
options: j,
|
|
116
|
+
onChangeCallback: I,
|
|
117
|
+
value: a,
|
|
118
|
+
isDisabled: h,
|
|
119
|
+
width: "100%",
|
|
120
|
+
maxWidth: "100%"
|
|
121
|
+
}
|
|
122
|
+
) })
|
|
98
123
|
}
|
|
99
124
|
),
|
|
100
|
-
|
|
125
|
+
/* @__PURE__ */ e(
|
|
126
|
+
z,
|
|
127
|
+
{
|
|
128
|
+
actions: N,
|
|
129
|
+
images: (g = m.current) == null ? void 0 : g.getElementsByTagName("canvas"),
|
|
130
|
+
selectedData: i,
|
|
131
|
+
width: l,
|
|
132
|
+
height: r,
|
|
133
|
+
isDisabled: h,
|
|
134
|
+
selectionCallback: o
|
|
135
|
+
}
|
|
136
|
+
)
|
|
101
137
|
]
|
|
102
138
|
}
|
|
103
139
|
) });
|
package/dist/{types/cjs/atomic/PlaybackControl/styles.d.cts → atomic/PlaybackControl/styles.d.ts}
RENAMED
|
@@ -281,7 +281,7 @@ export declare const PlaybackButton: import("styled-components").IStyledComponen
|
|
|
281
281
|
formNoValidate?: boolean | undefined;
|
|
282
282
|
formTarget?: string | undefined;
|
|
283
283
|
name?: string | undefined;
|
|
284
|
-
type?: "button" | "
|
|
284
|
+
type?: "button" | "reset" | "submit" | undefined;
|
|
285
285
|
value?: string | number | readonly string[] | undefined;
|
|
286
286
|
defaultChecked?: boolean | undefined;
|
|
287
287
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react");function R({url:n,crossOrigin:r,referrerpolicy:u,onLoadCallback:d,onErrorCallback:s}){const o=t.useRef("loading"),c=t.useRef(),[g,a]=t.useState(0),i=t.useRef(),f=t.useRef(),m=t.useRef();return(i.current!==n||f.current!==r||m.current!==u)&&(o.current="loading",c.current=void 0,i.current=n,f.current=r,m.current=u),t.useLayoutEffect(function(){if(!n)return;var e=document.createElement("img");function v(){o.current="loaded",c.current=e,d&&d(),a(Math.random())}function l(){o.current="failed",c.current=void 0,s&&s(),a(Math.random())}return e.addEventListener("load",v),e.addEventListener("error",l),r&&(e.crossOrigin=r),u&&(e.referrerPolicy=u),e.src=n,function(){e.removeEventListener("load",v),e.removeEventListener("error",l)}},[n,r,u]),[c.current,o.current]}exports.default=R;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ImageStatus = "loading" | "loaded" | "failed";
|
|
2
|
+
interface useImageProps {
|
|
3
|
+
url: string;
|
|
4
|
+
crossOrigin?: "anonymous" | "use-credentials";
|
|
5
|
+
referrerpolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
6
|
+
onLoadCallback?: () => void;
|
|
7
|
+
onErrorCallback?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare function useImage({ url, crossOrigin, referrerpolicy, onLoadCallback, onErrorCallback, }: useImageProps): [undefined | HTMLImageElement, ImageStatus];
|
|
10
|
+
export default useImage;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useRef as o, useState as g, useLayoutEffect as l } from "react";
|
|
2
|
+
function M({
|
|
3
|
+
url: t,
|
|
4
|
+
crossOrigin: n,
|
|
5
|
+
referrerpolicy: r,
|
|
6
|
+
onLoadCallback: d,
|
|
7
|
+
onErrorCallback: a
|
|
8
|
+
}) {
|
|
9
|
+
const u = o("loading"), c = o(), [L, s] = g(0), i = o(), f = o(), m = o();
|
|
10
|
+
return (i.current !== t || f.current !== n || m.current !== r) && (u.current = "loading", c.current = void 0, i.current = t, f.current = n, m.current = r), l(
|
|
11
|
+
function() {
|
|
12
|
+
if (!t)
|
|
13
|
+
return;
|
|
14
|
+
var e = document.createElement("img");
|
|
15
|
+
function v() {
|
|
16
|
+
u.current = "loaded", c.current = e, d && d(), s(Math.random());
|
|
17
|
+
}
|
|
18
|
+
function E() {
|
|
19
|
+
u.current = "failed", c.current = void 0, a && a(), s(Math.random());
|
|
20
|
+
}
|
|
21
|
+
return e.addEventListener("load", v), e.addEventListener("error", E), n && (e.crossOrigin = n), r && (e.referrerPolicy = r), e.src = t, function() {
|
|
22
|
+
e.removeEventListener("load", v), e.removeEventListener("error", E);
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
[t, n, r]
|
|
26
|
+
), [c.current, u.current];
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
M as default
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(r,e){const c=function(){return r.indexOf("data:image/png")===0},i=function(t,o){var n=document.createElement("a");n.href=t,n.download=o,document.body.appendChild(n),n.click()};return{toBase64:function(){return r},toImg:function(){const t=document.createElement("img");return t.src=r,t},toCanvas:function(t){const o=document.createElement("canvas"),n=e==null?void 0:e.getBoundingClientRect();o.width=(n==null?void 0:n.width)||0,o.height=(n==null?void 0:n.height)||0;const a=o.getContext("2d");var u=this.toImg();u.onload=function(){a==null||a.drawImage(u,0,0),t(o)}},toPng:function(){if(c()){var t=document.createElement("img");return t.src=r,t}this.toCanvas(function(o){var n=document.createElement("img");return n.src=o.toDataURL(),n})},toJpeg:function(t){t=t||1,(o=>{this.toCanvas(function(n){var a=document.createElement("img");return a.src=n.toDataURL("image/jpeg",o),a})})(t)},downloadPng:function(t){if(t=t||"image.png",c()){i(r,t);return}this.toCanvas(function(o){i(o.toDataURL(),t)})}}}function m(r){const e=r.toDataURL();return g(e)}exports.fromCanvas=m;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function g(r, c) {
|
|
2
|
+
const i = function() {
|
|
3
|
+
return r.indexOf("data:image/png") === 0;
|
|
4
|
+
}, e = function(t, o) {
|
|
5
|
+
var n = document.createElement("a");
|
|
6
|
+
n.href = t, n.download = o, document.body.appendChild(n), n.click();
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
toBase64: function() {
|
|
10
|
+
return r;
|
|
11
|
+
},
|
|
12
|
+
toImg: function() {
|
|
13
|
+
const t = document.createElement("img");
|
|
14
|
+
return t.src = r, t;
|
|
15
|
+
},
|
|
16
|
+
toCanvas: function(t) {
|
|
17
|
+
const o = document.createElement("canvas"), n = c == null ? void 0 : c.getBoundingClientRect();
|
|
18
|
+
o.width = (n == null ? void 0 : n.width) || 0, o.height = (n == null ? void 0 : n.height) || 0;
|
|
19
|
+
const a = o.getContext("2d");
|
|
20
|
+
var u = this.toImg();
|
|
21
|
+
u.onload = function() {
|
|
22
|
+
a == null || a.drawImage(u, 0, 0), t(o);
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
toPng: function() {
|
|
26
|
+
if (i()) {
|
|
27
|
+
var t = document.createElement("img");
|
|
28
|
+
return t.src = r, t;
|
|
29
|
+
}
|
|
30
|
+
this.toCanvas(function(o) {
|
|
31
|
+
var n = document.createElement("img");
|
|
32
|
+
return n.src = o.toDataURL(), n;
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
toJpeg: function(t) {
|
|
36
|
+
t = t || 1, ((o) => {
|
|
37
|
+
this.toCanvas(function(n) {
|
|
38
|
+
var a = document.createElement("img");
|
|
39
|
+
return a.src = n.toDataURL("image/jpeg", o), a;
|
|
40
|
+
});
|
|
41
|
+
})(t);
|
|
42
|
+
},
|
|
43
|
+
downloadPng: function(t) {
|
|
44
|
+
if (t = t || "image.png", i()) {
|
|
45
|
+
e(r, t);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.toCanvas(function(o) {
|
|
49
|
+
e(o.toDataURL(), t);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function m(r) {
|
|
55
|
+
const c = r.toDataURL();
|
|
56
|
+
return g(c);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
m as fromCanvas
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),p=require("react"),x=require("@rubin-epo/epo-react-lib/Button"),g=require("../../../../lib/reimg.cjs"),v=t=>t&&t.__esModule?t:{default:t},_=v(x),c=({images:t,filters:o,filename:s,width:r,height:n,children:l,isDisabled:u})=>{const i=p.useCallback(()=>{const a=document.createElement("canvas"),e=a.getContext("2d");t&&e&&(e.canvas.width=r,e.canvas.height=n,e.globalCompositeOperation="screen",Array.from(t).forEach((d,f)=>{o[f].active&&e.drawImage(d,0,0,r,n)})),g.fromCanvas(a).downloadPng(s)},[t,o]);return m.jsx(_.default,{disabled:u,style:{"--button-text-align":"left"},icon:"ArrowUpFromBracket",onClick:i,isBlock:!0,children:l})};c.displayName="Widgets.ColorTool.Reset";const b=c;exports.default=b;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FunctionComponent, PropsWithChildren } from "react";
|
|
2
|
+
import { ImageFilter } from "../../ColorTool";
|
|
3
|
+
interface ExportProps {
|
|
4
|
+
images?: HTMLCollection;
|
|
5
|
+
filename: string;
|
|
6
|
+
filters: ImageFilter[];
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
isDisabled: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const Export: FunctionComponent<PropsWithChildren<ExportProps>>;
|
|
12
|
+
export default Export;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as x } from "react";
|
|
3
|
+
import u from "@rubin-epo/epo-react-lib/Button";
|
|
4
|
+
import { fromCanvas as C } from "../../../../lib/reimg.js";
|
|
5
|
+
const c = ({
|
|
6
|
+
images: t,
|
|
7
|
+
filters: r,
|
|
8
|
+
filename: s,
|
|
9
|
+
width: e,
|
|
10
|
+
height: a,
|
|
11
|
+
children: l,
|
|
12
|
+
isDisabled: m
|
|
13
|
+
}) => {
|
|
14
|
+
const i = x(() => {
|
|
15
|
+
const n = document.createElement("canvas"), o = n.getContext("2d");
|
|
16
|
+
t && o && (o.canvas.width = e, o.canvas.height = a, o.globalCompositeOperation = "screen", Array.from(t).forEach((p, d) => {
|
|
17
|
+
r[d].active && o.drawImage(p, 0, 0, e, a);
|
|
18
|
+
})), C(n).downloadPng(s);
|
|
19
|
+
}, [t, r]);
|
|
20
|
+
return /* @__PURE__ */ f(
|
|
21
|
+
u,
|
|
22
|
+
{
|
|
23
|
+
disabled: m,
|
|
24
|
+
style: { "--button-text-align": "left" },
|
|
25
|
+
icon: "ArrowUpFromBracket",
|
|
26
|
+
onClick: i,
|
|
27
|
+
isBlock: !0,
|
|
28
|
+
children: l
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
c.displayName = "Widgets.ColorTool.Reset";
|
|
33
|
+
const k = c;
|
|
34
|
+
export {
|
|
35
|
+
k as default
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),r=require("@rubin-epo/epo-react-lib/Button"),a=require("../../utilities.cjs"),c=t=>t&&t.__esModule?t:{default:t},d=c(r),f=t=>t.map(e=>{const{defaultValue:s,min:o,max:u}=e,i=s||1;return{...e,active:!1,color:"",brightness:a.getBrightnessValue(o,u,i),value:i}}),l=({isDisabled:t,selectedData:e,onResetCallback:s,children:o})=>{const{filters:u}=e;return n.jsx(d.default,{style:{"--button-text-align":"left"},disabled:t,icon:"RotateLeftWithCenter",onClick:()=>s&&s({...e,filters:f(u)}),isBlock:!0,children:o})};l.displayName="Widgets.ColorTool.Reset";const g=l;exports.default=g;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionComponent, PropsWithChildren } from "react";
|
|
2
|
+
import { AstroObject } from "../../ColorTool";
|
|
3
|
+
interface ResetProps {
|
|
4
|
+
isDisabled: boolean;
|
|
5
|
+
selectedData: AstroObject;
|
|
6
|
+
onResetCallback: (data: AstroObject) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const Reset: FunctionComponent<PropsWithChildren<ResetProps>>;
|
|
9
|
+
export default Reset;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import a from "@rubin-epo/epo-react-lib/Button";
|
|
3
|
+
import { getBrightnessValue as m } from "../../utilities.js";
|
|
4
|
+
const u = (o) => o.map((t) => {
|
|
5
|
+
const { defaultValue: e, min: s, max: r } = t, i = e || 1;
|
|
6
|
+
return {
|
|
7
|
+
...t,
|
|
8
|
+
active: !1,
|
|
9
|
+
color: "",
|
|
10
|
+
brightness: m(s, r, i),
|
|
11
|
+
value: i
|
|
12
|
+
};
|
|
13
|
+
}), n = ({
|
|
14
|
+
isDisabled: o,
|
|
15
|
+
selectedData: t,
|
|
16
|
+
onResetCallback: e,
|
|
17
|
+
children: s
|
|
18
|
+
}) => {
|
|
19
|
+
const { filters: r } = t;
|
|
20
|
+
return /* @__PURE__ */ l(
|
|
21
|
+
a,
|
|
22
|
+
{
|
|
23
|
+
style: { "--button-text-align": "left" },
|
|
24
|
+
disabled: o,
|
|
25
|
+
icon: "RotateLeftWithCenter",
|
|
26
|
+
onClick: () => e && e({
|
|
27
|
+
...t,
|
|
28
|
+
filters: u(r)
|
|
29
|
+
}),
|
|
30
|
+
isBlock: !0,
|
|
31
|
+
children: s
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
n.displayName = "Widgets.ColorTool.Reset";
|
|
36
|
+
const d = n;
|
|
37
|
+
export {
|
|
38
|
+
d as default
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),A=require("./Reset/index.cjs"),b=require("./Export/index.cjs"),j=require("./styles.cjs"),p=require("react-i18next"),h=require("../utilities.cjs"),i=({actions:o,isDisabled:c,width:l,height:u,selectedData:e,selectionCallback:s,images:a})=>{const{t:d}=p.useTranslation(),{filters:x,name:f}=e,r=c||!h.areActionsActive(e);return t.jsx(j.Actions,{children:o.map((m,n)=>{switch(m){case"reset":return t.jsx(A.default,{isDisabled:r,selectedData:e,onResetCallback:q=>s&&s(q),children:d("colorTool.actions.reset")},n);case"export":return t.jsx(b.default,{isDisabled:r,filters:x,width:l,height:u,images:a,filename:f,children:"Export"},n);case"save":return null;default:return null}})})};i.displayName="Widgets.ColorTool.Actions";const v=i;exports.default=v;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
import { AstroObject, ColorToolAction } from "../ColorTool";
|
|
3
|
+
interface ActionsProps {
|
|
4
|
+
actions: Array<ColorToolAction>;
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
selectedData: AstroObject;
|
|
7
|
+
images: HTMLCollection | undefined;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
selectionCallback: (data: AstroObject) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const Actions: FunctionComponent<ActionsProps>;
|
|
13
|
+
export default Actions;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import x from "./Reset/index.js";
|
|
3
|
+
import h from "./Export/index.js";
|
|
4
|
+
import { Actions as b } from "./styles.js";
|
|
5
|
+
import { useTranslation as T } from "react-i18next";
|
|
6
|
+
import { areActionsActive as v } from "../utilities.js";
|
|
7
|
+
const i = ({
|
|
8
|
+
actions: n,
|
|
9
|
+
isDisabled: c,
|
|
10
|
+
width: a,
|
|
11
|
+
height: l,
|
|
12
|
+
selectedData: o,
|
|
13
|
+
selectionCallback: t,
|
|
14
|
+
images: m
|
|
15
|
+
}) => {
|
|
16
|
+
const { t: p } = T(), { filters: f, name: u } = o, s = c || !v(o);
|
|
17
|
+
return /* @__PURE__ */ r(b, { children: n.map((d, e) => {
|
|
18
|
+
switch (d) {
|
|
19
|
+
case "reset":
|
|
20
|
+
return /* @__PURE__ */ r(
|
|
21
|
+
x,
|
|
22
|
+
{
|
|
23
|
+
isDisabled: s,
|
|
24
|
+
selectedData: o,
|
|
25
|
+
onResetCallback: (A) => t && t(A),
|
|
26
|
+
children: p("colorTool.actions.reset")
|
|
27
|
+
},
|
|
28
|
+
e
|
|
29
|
+
);
|
|
30
|
+
case "export":
|
|
31
|
+
return /* @__PURE__ */ r(
|
|
32
|
+
h,
|
|
33
|
+
{
|
|
34
|
+
isDisabled: s,
|
|
35
|
+
filters: f,
|
|
36
|
+
width: a,
|
|
37
|
+
height: l,
|
|
38
|
+
images: m,
|
|
39
|
+
filename: u,
|
|
40
|
+
children: "Export"
|
|
41
|
+
},
|
|
42
|
+
e
|
|
43
|
+
);
|
|
44
|
+
case "save":
|
|
45
|
+
return null;
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}) });
|
|
50
|
+
};
|
|
51
|
+
i.displayName = "Widgets.ColorTool.Actions";
|
|
52
|
+
const y = i;
|
|
53
|
+
export {
|
|
54
|
+
y as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("styled-components"),o=t=>t&&t.__esModule?t:{default:t},a=o(e),l=a.default.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: var(--color-tool-padding, var(--PADDING_SMALL, 20px));
|
|
4
|
+
grid-area: actions;
|
|
5
|
+
`;exports.Actions=l;
|