@loopr-ai/craft 0.7.2 → 0.7.4
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/{ButtonBase-fc1e48eb.js → ButtonBase-85c9347b.js} +3 -3
- package/dist/{TextField-a534df29.js → TextField-fded06e5.js} +7 -7
- package/dist/Tooltip-b926c320.js +2022 -0
- package/dist/{TransitionGroupContext-ba502e63.js → TransitionGroupContext-fe9a562f.js} +3 -3
- package/dist/ZoomControllers-36e39bb0.js +1432 -0
- package/dist/components/cell/AvatarGroup/index.js +3 -3
- package/dist/components/cell/Button/index.js +3 -3
- package/dist/components/cell/Chip/index.js +5 -5
- package/dist/components/cell/ProgressBar/index.js +3 -3
- package/dist/components/cell/Search/index.js +2 -2
- package/dist/components/cell/Typography/index.js +5 -19
- package/dist/components/organ/Form/Form.interfaces.d.ts +6 -6
- package/dist/components/organ/Form/Form.styles.d.ts +99 -2
- package/dist/components/organ/Form/Form.styles.js +99 -4
- package/dist/components/organ/Form/FormInput.js +517 -0
- package/dist/components/organ/Form/index.d.ts +2 -0
- package/dist/components/organ/Form/index.js +156 -106
- package/dist/components/organ/ZoomControlWithDrag/ZoomControllers.js +2 -2
- package/dist/components/organ/ZoomControlWithDrag/index.js +2 -2
- package/dist/{createSvgIcon-bb3d4825.js → createSvgIcon-58aa3adf.js} +5 -5
- package/dist/{Grow-a906cda2.js → createSvgIcon-f773ce57.js} +4020 -3944
- package/dist/{createTheme-ca1567c6.js → createTheme-a4db2989.js} +7 -7
- package/dist/{exactProp-3d9df1ae.js → exactProp-d79ccada.js} +1 -1
- package/dist/{extendSxProp-fc2654e5.js → extendSxProp-db8b9da5.js} +1 -1
- package/dist/global/colors.d.ts +5 -0
- package/dist/global/colors.js +11 -6
- package/dist/global/constants.d.ts +3 -0
- package/dist/global/constants.js +6 -1
- package/dist/global/theme.js +1 -1
- package/dist/{Typography-65e5f8a8.js → index-03287c17.js} +61 -45
- package/dist/main.js +10 -10
- package/dist/providers/CraftThemeProvider.js +2 -2
- package/dist/{styled-80b57810.js → styled-126c6a62.js} +49 -49
- package/dist/{useTheme-16446f25.js → useTheme-573c40a2.js} +1 -1
- package/package.json +1 -1
- package/dist/Box-8cd400c2.js +0 -58
- package/dist/ZoomControllers-8a147df0.js +0 -3390
- package/dist/components/organ/Form/FieldInput.js +0 -442
- package/dist/createSvgIcon-8e5d9dc7.js +0 -81
- package/dist/dividerClasses-0233db5a.js +0 -10
- /package/dist/components/organ/Form/{FieldInput.d.ts → FormInput.d.ts} +0 -0
|
@@ -0,0 +1,1432 @@
|
|
|
1
|
+
import J, { jsx as C, jsxs as zi, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
+
import { r as x, i as I } from "./createSvgIcon-f773ce57.js";
|
|
3
|
+
import * as Q from "react";
|
|
4
|
+
import D, { useRef as q, useImperativeHandle as we, useEffect as vi, useContext as pi } from "react";
|
|
5
|
+
import { g as Ce, T as H, B as Pe } from "./Tooltip-b926c320.js";
|
|
6
|
+
import { g as ye, c as B, a as P, e as ui, _ as Zi, P as m } from "./createTheme-a4db2989.js";
|
|
7
|
+
import { g as Te, s as mi, a as $i, c as Li, b as ji } from "./styled-126c6a62.js";
|
|
8
|
+
import { B as Ye } from "./ButtonBase-85c9347b.js";
|
|
9
|
+
import { c as Ae } from "./chainPropTypes-004bf492.js";
|
|
10
|
+
function _e(i) {
|
|
11
|
+
return ye("MuiIconButton", i);
|
|
12
|
+
}
|
|
13
|
+
const ze = Te("MuiIconButton", ["root", "disabled", "colorInherit", "colorPrimary", "colorSecondary", "colorError", "colorInfo", "colorSuccess", "colorWarning", "edgeStart", "edgeEnd", "sizeSmall", "sizeMedium", "sizeLarge"]), Xe = ze, Ee = ["edge", "children", "className", "color", "disabled", "disableFocusRipple", "size"], Oe = (i) => {
|
|
14
|
+
const {
|
|
15
|
+
classes: o,
|
|
16
|
+
disabled: e,
|
|
17
|
+
color: r,
|
|
18
|
+
edge: n,
|
|
19
|
+
size: a
|
|
20
|
+
} = i, t = {
|
|
21
|
+
root: ["root", e && "disabled", r !== "default" && `color${B(r)}`, n && `edge${B(n)}`, `size${B(a)}`]
|
|
22
|
+
};
|
|
23
|
+
return ji(t, _e, o);
|
|
24
|
+
}, De = mi(Ye, {
|
|
25
|
+
name: "MuiIconButton",
|
|
26
|
+
slot: "Root",
|
|
27
|
+
overridesResolver: (i, o) => {
|
|
28
|
+
const {
|
|
29
|
+
ownerState: e
|
|
30
|
+
} = i;
|
|
31
|
+
return [o.root, e.color !== "default" && o[`color${B(e.color)}`], e.edge && o[`edge${B(e.edge)}`], o[`size${B(e.size)}`]];
|
|
32
|
+
}
|
|
33
|
+
})(({
|
|
34
|
+
theme: i,
|
|
35
|
+
ownerState: o
|
|
36
|
+
}) => P({
|
|
37
|
+
textAlign: "center",
|
|
38
|
+
flex: "0 0 auto",
|
|
39
|
+
fontSize: i.typography.pxToRem(24),
|
|
40
|
+
padding: 8,
|
|
41
|
+
borderRadius: "50%",
|
|
42
|
+
overflow: "visible",
|
|
43
|
+
// Explicitly set the default value to solve a bug on IE11.
|
|
44
|
+
color: (i.vars || i).palette.action.active,
|
|
45
|
+
transition: i.transitions.create("background-color", {
|
|
46
|
+
duration: i.transitions.duration.shortest
|
|
47
|
+
})
|
|
48
|
+
}, !o.disableRipple && {
|
|
49
|
+
"&:hover": {
|
|
50
|
+
backgroundColor: i.vars ? `rgba(${i.vars.palette.action.activeChannel} / ${i.vars.palette.action.hoverOpacity})` : ui(i.palette.action.active, i.palette.action.hoverOpacity),
|
|
51
|
+
// Reset on touch devices, it doesn't add specificity
|
|
52
|
+
"@media (hover: none)": {
|
|
53
|
+
backgroundColor: "transparent"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, o.edge === "start" && {
|
|
57
|
+
marginLeft: o.size === "small" ? -3 : -12
|
|
58
|
+
}, o.edge === "end" && {
|
|
59
|
+
marginRight: o.size === "small" ? -3 : -12
|
|
60
|
+
}), ({
|
|
61
|
+
theme: i,
|
|
62
|
+
ownerState: o
|
|
63
|
+
}) => {
|
|
64
|
+
var e;
|
|
65
|
+
const r = (e = (i.vars || i).palette) == null ? void 0 : e[o.color];
|
|
66
|
+
return P({}, o.color === "inherit" && {
|
|
67
|
+
color: "inherit"
|
|
68
|
+
}, o.color !== "inherit" && o.color !== "default" && P({
|
|
69
|
+
color: r == null ? void 0 : r.main
|
|
70
|
+
}, !o.disableRipple && {
|
|
71
|
+
"&:hover": P({}, r && {
|
|
72
|
+
backgroundColor: i.vars ? `rgba(${r.mainChannel} / ${i.vars.palette.action.hoverOpacity})` : ui(r.main, i.palette.action.hoverOpacity)
|
|
73
|
+
}, {
|
|
74
|
+
// Reset on touch devices, it doesn't add specificity
|
|
75
|
+
"@media (hover: none)": {
|
|
76
|
+
backgroundColor: "transparent"
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}), o.size === "small" && {
|
|
80
|
+
padding: 5,
|
|
81
|
+
fontSize: i.typography.pxToRem(18)
|
|
82
|
+
}, o.size === "large" && {
|
|
83
|
+
padding: 12,
|
|
84
|
+
fontSize: i.typography.pxToRem(28)
|
|
85
|
+
}, {
|
|
86
|
+
[`&.${Xe.disabled}`]: {
|
|
87
|
+
backgroundColor: "transparent",
|
|
88
|
+
color: (i.vars || i).palette.action.disabled
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}), Hi = /* @__PURE__ */ Q.forwardRef(function(o, e) {
|
|
92
|
+
const r = $i({
|
|
93
|
+
props: o,
|
|
94
|
+
name: "MuiIconButton"
|
|
95
|
+
}), {
|
|
96
|
+
edge: n = !1,
|
|
97
|
+
children: a,
|
|
98
|
+
className: t,
|
|
99
|
+
color: l = "default",
|
|
100
|
+
disabled: s = !1,
|
|
101
|
+
disableFocusRipple: d = !1,
|
|
102
|
+
size: u = "medium"
|
|
103
|
+
} = r, f = Zi(r, Ee), v = P({}, r, {
|
|
104
|
+
edge: n,
|
|
105
|
+
color: l,
|
|
106
|
+
disabled: s,
|
|
107
|
+
disableFocusRipple: d,
|
|
108
|
+
size: u
|
|
109
|
+
}), p = Oe(v);
|
|
110
|
+
return /* @__PURE__ */ C(De, P({
|
|
111
|
+
className: Li(p.root, t),
|
|
112
|
+
centerRipple: !0,
|
|
113
|
+
focusRipple: !d,
|
|
114
|
+
disabled: s,
|
|
115
|
+
ref: e,
|
|
116
|
+
ownerState: v
|
|
117
|
+
}, f, {
|
|
118
|
+
children: a
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
process.env.NODE_ENV !== "production" && (Hi.propTypes = {
|
|
122
|
+
// ----------------------------- Warning --------------------------------
|
|
123
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
124
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
125
|
+
// ----------------------------------------------------------------------
|
|
126
|
+
/**
|
|
127
|
+
* The icon to display.
|
|
128
|
+
*/
|
|
129
|
+
children: Ae(m.node, (i) => Q.Children.toArray(i.children).some((e) => /* @__PURE__ */ Q.isValidElement(e) && e.props.onClick) ? new Error(["MUI: You are providing an onClick event listener to a child of a button element.", "Prefer applying it to the IconButton directly.", "This guarantees that the whole <button> will be responsive to click events."].join(`
|
|
130
|
+
`)) : null),
|
|
131
|
+
/**
|
|
132
|
+
* Override or extend the styles applied to the component.
|
|
133
|
+
*/
|
|
134
|
+
classes: m.object,
|
|
135
|
+
/**
|
|
136
|
+
* @ignore
|
|
137
|
+
*/
|
|
138
|
+
className: m.string,
|
|
139
|
+
/**
|
|
140
|
+
* The color of the component.
|
|
141
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
142
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
143
|
+
* @default 'default'
|
|
144
|
+
*/
|
|
145
|
+
color: m.oneOfType([m.oneOf(["inherit", "default", "primary", "secondary", "error", "info", "success", "warning"]), m.string]),
|
|
146
|
+
/**
|
|
147
|
+
* If `true`, the component is disabled.
|
|
148
|
+
* @default false
|
|
149
|
+
*/
|
|
150
|
+
disabled: m.bool,
|
|
151
|
+
/**
|
|
152
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
155
|
+
disableFocusRipple: m.bool,
|
|
156
|
+
/**
|
|
157
|
+
* If `true`, the ripple effect is disabled.
|
|
158
|
+
*
|
|
159
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
160
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
disableRipple: m.bool,
|
|
164
|
+
/**
|
|
165
|
+
* If given, uses a negative margin to counteract the padding on one
|
|
166
|
+
* side (this is often helpful for aligning the left or right
|
|
167
|
+
* side of the icon with content above or below, without ruining the border
|
|
168
|
+
* size and shape).
|
|
169
|
+
* @default false
|
|
170
|
+
*/
|
|
171
|
+
edge: m.oneOf(["end", "start", !1]),
|
|
172
|
+
/**
|
|
173
|
+
* The size of the component.
|
|
174
|
+
* `small` is equivalent to the dense button styling.
|
|
175
|
+
* @default 'medium'
|
|
176
|
+
*/
|
|
177
|
+
size: m.oneOfType([m.oneOf(["small", "medium", "large"]), m.string]),
|
|
178
|
+
/**
|
|
179
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
180
|
+
*/
|
|
181
|
+
sx: m.oneOfType([m.arrayOf(m.oneOfType([m.func, m.object, m.bool])), m.func, m.object])
|
|
182
|
+
});
|
|
183
|
+
const V = Hi, We = ["absolute", "children", "className", "component", "flexItem", "light", "orientation", "role", "textAlign", "variant"], Ne = (i) => {
|
|
184
|
+
const {
|
|
185
|
+
absolute: o,
|
|
186
|
+
children: e,
|
|
187
|
+
classes: r,
|
|
188
|
+
flexItem: n,
|
|
189
|
+
light: a,
|
|
190
|
+
orientation: t,
|
|
191
|
+
textAlign: l,
|
|
192
|
+
variant: s
|
|
193
|
+
} = i;
|
|
194
|
+
return ji({
|
|
195
|
+
root: ["root", o && "absolute", s, a && "light", t === "vertical" && "vertical", n && "flexItem", e && "withChildren", e && t === "vertical" && "withChildrenVertical", l === "right" && t !== "vertical" && "textAlignRight", l === "left" && t !== "vertical" && "textAlignLeft"],
|
|
196
|
+
wrapper: ["wrapper", t === "vertical" && "wrapperVertical"]
|
|
197
|
+
}, Ce, r);
|
|
198
|
+
}, Be = mi("div", {
|
|
199
|
+
name: "MuiDivider",
|
|
200
|
+
slot: "Root",
|
|
201
|
+
overridesResolver: (i, o) => {
|
|
202
|
+
const {
|
|
203
|
+
ownerState: e
|
|
204
|
+
} = i;
|
|
205
|
+
return [o.root, e.absolute && o.absolute, o[e.variant], e.light && o.light, e.orientation === "vertical" && o.vertical, e.flexItem && o.flexItem, e.children && o.withChildren, e.children && e.orientation === "vertical" && o.withChildrenVertical, e.textAlign === "right" && e.orientation !== "vertical" && o.textAlignRight, e.textAlign === "left" && e.orientation !== "vertical" && o.textAlignLeft];
|
|
206
|
+
}
|
|
207
|
+
})(({
|
|
208
|
+
theme: i,
|
|
209
|
+
ownerState: o
|
|
210
|
+
}) => P({
|
|
211
|
+
margin: 0,
|
|
212
|
+
// Reset browser default style.
|
|
213
|
+
flexShrink: 0,
|
|
214
|
+
borderWidth: 0,
|
|
215
|
+
borderStyle: "solid",
|
|
216
|
+
borderColor: (i.vars || i).palette.divider,
|
|
217
|
+
borderBottomWidth: "thin"
|
|
218
|
+
}, o.absolute && {
|
|
219
|
+
position: "absolute",
|
|
220
|
+
bottom: 0,
|
|
221
|
+
left: 0,
|
|
222
|
+
width: "100%"
|
|
223
|
+
}, o.light && {
|
|
224
|
+
borderColor: i.vars ? `rgba(${i.vars.palette.dividerChannel} / 0.08)` : ui(i.palette.divider, 0.08)
|
|
225
|
+
}, o.variant === "inset" && {
|
|
226
|
+
marginLeft: 72
|
|
227
|
+
}, o.variant === "middle" && o.orientation === "horizontal" && {
|
|
228
|
+
marginLeft: i.spacing(2),
|
|
229
|
+
marginRight: i.spacing(2)
|
|
230
|
+
}, o.variant === "middle" && o.orientation === "vertical" && {
|
|
231
|
+
marginTop: i.spacing(1),
|
|
232
|
+
marginBottom: i.spacing(1)
|
|
233
|
+
}, o.orientation === "vertical" && {
|
|
234
|
+
height: "100%",
|
|
235
|
+
borderBottomWidth: 0,
|
|
236
|
+
borderRightWidth: "thin"
|
|
237
|
+
}, o.flexItem && {
|
|
238
|
+
alignSelf: "stretch",
|
|
239
|
+
height: "auto"
|
|
240
|
+
}), ({
|
|
241
|
+
ownerState: i
|
|
242
|
+
}) => P({}, i.children && {
|
|
243
|
+
display: "flex",
|
|
244
|
+
whiteSpace: "nowrap",
|
|
245
|
+
textAlign: "center",
|
|
246
|
+
border: 0,
|
|
247
|
+
"&::before, &::after": {
|
|
248
|
+
content: '""',
|
|
249
|
+
alignSelf: "center"
|
|
250
|
+
}
|
|
251
|
+
}), ({
|
|
252
|
+
theme: i,
|
|
253
|
+
ownerState: o
|
|
254
|
+
}) => P({}, o.children && o.orientation !== "vertical" && {
|
|
255
|
+
"&::before, &::after": {
|
|
256
|
+
width: "100%",
|
|
257
|
+
borderTop: `thin solid ${(i.vars || i).palette.divider}`
|
|
258
|
+
}
|
|
259
|
+
}), ({
|
|
260
|
+
theme: i,
|
|
261
|
+
ownerState: o
|
|
262
|
+
}) => P({}, o.children && o.orientation === "vertical" && {
|
|
263
|
+
flexDirection: "column",
|
|
264
|
+
"&::before, &::after": {
|
|
265
|
+
height: "100%",
|
|
266
|
+
borderLeft: `thin solid ${(i.vars || i).palette.divider}`
|
|
267
|
+
}
|
|
268
|
+
}), ({
|
|
269
|
+
ownerState: i
|
|
270
|
+
}) => P({}, i.textAlign === "right" && i.orientation !== "vertical" && {
|
|
271
|
+
"&::before": {
|
|
272
|
+
width: "90%"
|
|
273
|
+
},
|
|
274
|
+
"&::after": {
|
|
275
|
+
width: "10%"
|
|
276
|
+
}
|
|
277
|
+
}, i.textAlign === "left" && i.orientation !== "vertical" && {
|
|
278
|
+
"&::before": {
|
|
279
|
+
width: "10%"
|
|
280
|
+
},
|
|
281
|
+
"&::after": {
|
|
282
|
+
width: "90%"
|
|
283
|
+
}
|
|
284
|
+
})), Re = mi("span", {
|
|
285
|
+
name: "MuiDivider",
|
|
286
|
+
slot: "Wrapper",
|
|
287
|
+
overridesResolver: (i, o) => {
|
|
288
|
+
const {
|
|
289
|
+
ownerState: e
|
|
290
|
+
} = i;
|
|
291
|
+
return [o.wrapper, e.orientation === "vertical" && o.wrapperVertical];
|
|
292
|
+
}
|
|
293
|
+
})(({
|
|
294
|
+
theme: i,
|
|
295
|
+
ownerState: o
|
|
296
|
+
}) => P({
|
|
297
|
+
display: "inline-block",
|
|
298
|
+
paddingLeft: `calc(${i.spacing(1)} * 1.2)`,
|
|
299
|
+
paddingRight: `calc(${i.spacing(1)} * 1.2)`
|
|
300
|
+
}, o.orientation === "vertical" && {
|
|
301
|
+
paddingTop: `calc(${i.spacing(1)} * 1.2)`,
|
|
302
|
+
paddingBottom: `calc(${i.spacing(1)} * 1.2)`
|
|
303
|
+
})), ci = /* @__PURE__ */ Q.forwardRef(function(o, e) {
|
|
304
|
+
const r = $i({
|
|
305
|
+
props: o,
|
|
306
|
+
name: "MuiDivider"
|
|
307
|
+
}), {
|
|
308
|
+
absolute: n = !1,
|
|
309
|
+
children: a,
|
|
310
|
+
className: t,
|
|
311
|
+
component: l = a ? "div" : "hr",
|
|
312
|
+
flexItem: s = !1,
|
|
313
|
+
light: d = !1,
|
|
314
|
+
orientation: u = "horizontal",
|
|
315
|
+
role: f = l !== "hr" ? "separator" : void 0,
|
|
316
|
+
textAlign: v = "center",
|
|
317
|
+
variant: p = "fullWidth"
|
|
318
|
+
} = r, c = Zi(r, We), h = P({}, r, {
|
|
319
|
+
absolute: n,
|
|
320
|
+
component: l,
|
|
321
|
+
flexItem: s,
|
|
322
|
+
light: d,
|
|
323
|
+
orientation: u,
|
|
324
|
+
role: f,
|
|
325
|
+
textAlign: v,
|
|
326
|
+
variant: p
|
|
327
|
+
}), b = Ne(h);
|
|
328
|
+
return /* @__PURE__ */ C(Be, P({
|
|
329
|
+
as: l,
|
|
330
|
+
className: Li(b.root, t),
|
|
331
|
+
role: f,
|
|
332
|
+
ref: e,
|
|
333
|
+
ownerState: h
|
|
334
|
+
}, c, {
|
|
335
|
+
children: a ? /* @__PURE__ */ C(Re, {
|
|
336
|
+
className: b.wrapper,
|
|
337
|
+
ownerState: h,
|
|
338
|
+
children: a
|
|
339
|
+
}) : null
|
|
340
|
+
}));
|
|
341
|
+
});
|
|
342
|
+
ci.muiSkipListHighlight = !0;
|
|
343
|
+
process.env.NODE_ENV !== "production" && (ci.propTypes = {
|
|
344
|
+
// ----------------------------- Warning --------------------------------
|
|
345
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
346
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
347
|
+
// ----------------------------------------------------------------------
|
|
348
|
+
/**
|
|
349
|
+
* Absolutely position the element.
|
|
350
|
+
* @default false
|
|
351
|
+
*/
|
|
352
|
+
absolute: m.bool,
|
|
353
|
+
/**
|
|
354
|
+
* The content of the component.
|
|
355
|
+
*/
|
|
356
|
+
children: m.node,
|
|
357
|
+
/**
|
|
358
|
+
* Override or extend the styles applied to the component.
|
|
359
|
+
*/
|
|
360
|
+
classes: m.object,
|
|
361
|
+
/**
|
|
362
|
+
* @ignore
|
|
363
|
+
*/
|
|
364
|
+
className: m.string,
|
|
365
|
+
/**
|
|
366
|
+
* The component used for the root node.
|
|
367
|
+
* Either a string to use a HTML element or a component.
|
|
368
|
+
*/
|
|
369
|
+
component: m.elementType,
|
|
370
|
+
/**
|
|
371
|
+
* If `true`, a vertical divider will have the correct height when used in flex container.
|
|
372
|
+
* (By default, a vertical divider will have a calculated height of `0px` if it is the child of a flex container.)
|
|
373
|
+
* @default false
|
|
374
|
+
*/
|
|
375
|
+
flexItem: m.bool,
|
|
376
|
+
/**
|
|
377
|
+
* If `true`, the divider will have a lighter color.
|
|
378
|
+
* @default false
|
|
379
|
+
*/
|
|
380
|
+
light: m.bool,
|
|
381
|
+
/**
|
|
382
|
+
* The component orientation.
|
|
383
|
+
* @default 'horizontal'
|
|
384
|
+
*/
|
|
385
|
+
orientation: m.oneOf(["horizontal", "vertical"]),
|
|
386
|
+
/**
|
|
387
|
+
* @ignore
|
|
388
|
+
*/
|
|
389
|
+
role: m.string,
|
|
390
|
+
/**
|
|
391
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
392
|
+
*/
|
|
393
|
+
sx: m.oneOfType([m.arrayOf(m.oneOfType([m.func, m.object, m.bool])), m.func, m.object]),
|
|
394
|
+
/**
|
|
395
|
+
* The text alignment.
|
|
396
|
+
* @default 'center'
|
|
397
|
+
*/
|
|
398
|
+
textAlign: m.oneOf(["center", "left", "right"]),
|
|
399
|
+
/**
|
|
400
|
+
* The variant to use.
|
|
401
|
+
* @default 'fullWidth'
|
|
402
|
+
*/
|
|
403
|
+
variant: m.oneOfType([m.oneOf(["fullWidth", "inset", "middle"]), m.string])
|
|
404
|
+
});
|
|
405
|
+
const Xi = ci;
|
|
406
|
+
var Y = function(i, o) {
|
|
407
|
+
return Number(i.toFixed(o));
|
|
408
|
+
}, ke = function(i, o) {
|
|
409
|
+
return typeof i == "number" ? i : o;
|
|
410
|
+
}, S = function(i, o, e) {
|
|
411
|
+
e && typeof e == "function" && e(i, o);
|
|
412
|
+
}, Me = function(i) {
|
|
413
|
+
return -Math.cos(i * Math.PI) / 2 + 0.5;
|
|
414
|
+
}, Ze = function(i) {
|
|
415
|
+
return i;
|
|
416
|
+
}, $e = function(i) {
|
|
417
|
+
return i * i;
|
|
418
|
+
}, Le = function(i) {
|
|
419
|
+
return i * (2 - i);
|
|
420
|
+
}, je = function(i) {
|
|
421
|
+
return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
|
|
422
|
+
}, He = function(i) {
|
|
423
|
+
return i * i * i;
|
|
424
|
+
}, Ve = function(i) {
|
|
425
|
+
return --i * i * i + 1;
|
|
426
|
+
}, Fe = function(i) {
|
|
427
|
+
return i < 0.5 ? 4 * i * i * i : (i - 1) * (2 * i - 2) * (2 * i - 2) + 1;
|
|
428
|
+
}, Ke = function(i) {
|
|
429
|
+
return i * i * i * i;
|
|
430
|
+
}, Qe = function(i) {
|
|
431
|
+
return 1 - --i * i * i * i;
|
|
432
|
+
}, qe = function(i) {
|
|
433
|
+
return i < 0.5 ? 8 * i * i * i * i : 1 - 8 * --i * i * i * i;
|
|
434
|
+
}, Ue = function(i) {
|
|
435
|
+
return i * i * i * i * i;
|
|
436
|
+
}, Ge = function(i) {
|
|
437
|
+
return 1 + --i * i * i * i * i;
|
|
438
|
+
}, Je = function(i) {
|
|
439
|
+
return i < 0.5 ? 16 * i * i * i * i * i : 1 + 16 * --i * i * i * i * i;
|
|
440
|
+
}, Vi = {
|
|
441
|
+
easeOut: Me,
|
|
442
|
+
linear: Ze,
|
|
443
|
+
easeInQuad: $e,
|
|
444
|
+
easeOutQuad: Le,
|
|
445
|
+
easeInOutQuad: je,
|
|
446
|
+
easeInCubic: He,
|
|
447
|
+
easeOutCubic: Ve,
|
|
448
|
+
easeInOutCubic: Fe,
|
|
449
|
+
easeInQuart: Ke,
|
|
450
|
+
easeOutQuart: Qe,
|
|
451
|
+
easeInOutQuart: qe,
|
|
452
|
+
easeInQuint: Ue,
|
|
453
|
+
easeOutQuint: Ge,
|
|
454
|
+
easeInOutQuint: Je
|
|
455
|
+
}, Fi = function(i) {
|
|
456
|
+
typeof i == "number" && cancelAnimationFrame(i);
|
|
457
|
+
}, _ = function(i) {
|
|
458
|
+
i.mounted && (Fi(i.animation), i.animate = !1, i.animation = null, i.velocity = null);
|
|
459
|
+
};
|
|
460
|
+
function Ki(i, o, e, r) {
|
|
461
|
+
if (i.mounted) {
|
|
462
|
+
var n = (/* @__PURE__ */ new Date()).getTime(), a = 1;
|
|
463
|
+
_(i), i.animation = function() {
|
|
464
|
+
if (!i.mounted)
|
|
465
|
+
return Fi(i.animation);
|
|
466
|
+
var t = (/* @__PURE__ */ new Date()).getTime() - n, l = t / e, s = Vi[o], d = s(l);
|
|
467
|
+
t >= e ? (r(a), i.animation = null) : i.animation && (r(d), requestAnimationFrame(i.animation));
|
|
468
|
+
}, requestAnimationFrame(i.animation);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function xe(i) {
|
|
472
|
+
var o = i.scale, e = i.positionX, r = i.positionY;
|
|
473
|
+
return !(Number.isNaN(o) || Number.isNaN(e) || Number.isNaN(r));
|
|
474
|
+
}
|
|
475
|
+
function X(i, o, e, r) {
|
|
476
|
+
var n = xe(o);
|
|
477
|
+
if (!(!i.mounted || !n)) {
|
|
478
|
+
var a = i.setTransformState, t = i.transformState, l = t.scale, s = t.positionX, d = t.positionY, u = o.scale - l, f = o.positionX - s, v = o.positionY - d;
|
|
479
|
+
e === 0 ? a(o.scale, o.positionX, o.positionY) : Ki(i, r, e, function(p) {
|
|
480
|
+
var c = l + u * p, h = s + f * p, b = d + v * p;
|
|
481
|
+
a(c, h, b);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function Ie(i, o, e) {
|
|
486
|
+
var r = i.offsetWidth, n = i.offsetHeight, a = o.offsetWidth, t = o.offsetHeight, l = a * e, s = t * e, d = r - l, u = n - s;
|
|
487
|
+
return {
|
|
488
|
+
wrapperWidth: r,
|
|
489
|
+
wrapperHeight: n,
|
|
490
|
+
newContentWidth: l,
|
|
491
|
+
newDiffWidth: d,
|
|
492
|
+
newContentHeight: s,
|
|
493
|
+
newDiffHeight: u
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
var ir = function(i, o, e, r, n, a, t) {
|
|
497
|
+
var l = i > o ? e * (t ? 1 : 0.5) : 0, s = r > n ? a * (t ? 1 : 0.5) : 0, d = i - o - l, u = l, f = r - n - s, v = s;
|
|
498
|
+
return { minPositionX: d, maxPositionX: u, minPositionY: f, maxPositionY: v };
|
|
499
|
+
}, hi = function(i, o) {
|
|
500
|
+
var e = i.wrapperComponent, r = i.contentComponent, n = i.setup.centerZoomedOut;
|
|
501
|
+
if (!e || !r)
|
|
502
|
+
throw new Error("Components are not mounted");
|
|
503
|
+
var a = Ie(e, r, o), t = a.wrapperWidth, l = a.wrapperHeight, s = a.newContentWidth, d = a.newDiffWidth, u = a.newContentHeight, f = a.newDiffHeight, v = ir(t, s, d, l, u, f, !!n);
|
|
504
|
+
return v;
|
|
505
|
+
}, di = function(i, o, e, r) {
|
|
506
|
+
return r ? i < o ? Y(o, 2) : i > e ? Y(e, 2) : Y(i, 2) : Y(i, 2);
|
|
507
|
+
}, R = function(i, o) {
|
|
508
|
+
var e = hi(i, o);
|
|
509
|
+
return i.bounds = e, e;
|
|
510
|
+
};
|
|
511
|
+
function ii(i, o, e, r, n, a, t) {
|
|
512
|
+
var l = e.minPositionX, s = e.minPositionY, d = e.maxPositionX, u = e.maxPositionY, f = 0, v = 0;
|
|
513
|
+
t && (f = n, v = a);
|
|
514
|
+
var p = di(i, l - f, d + f, r), c = di(o, s - v, u + v, r);
|
|
515
|
+
return { x: p, y: c };
|
|
516
|
+
}
|
|
517
|
+
function ei(i, o, e, r, n, a) {
|
|
518
|
+
var t = i.transformState, l = t.scale, s = t.positionX, d = t.positionY, u = r - l;
|
|
519
|
+
if (typeof o != "number" || typeof e != "number")
|
|
520
|
+
return console.error("Mouse X and Y position were not provided!"), { x: s, y: d };
|
|
521
|
+
var f = s - o * u, v = d - e * u, p = ii(f, v, n, a, 0, 0, null);
|
|
522
|
+
return p;
|
|
523
|
+
}
|
|
524
|
+
function L(i, o, e, r, n) {
|
|
525
|
+
var a = n ? r : 0, t = o - a;
|
|
526
|
+
return !Number.isNaN(e) && i >= e ? e : !Number.isNaN(o) && i <= t ? t : i;
|
|
527
|
+
}
|
|
528
|
+
var Ei = function(i, o) {
|
|
529
|
+
var e = i.setup.panning.excluded, r = i.isInitialized, n = i.wrapperComponent, a = o.target, t = n == null ? void 0 : n.contains(a), l = r && a && t;
|
|
530
|
+
if (!l)
|
|
531
|
+
return !1;
|
|
532
|
+
var s = ri(a, e);
|
|
533
|
+
return !s;
|
|
534
|
+
}, Oi = function(i) {
|
|
535
|
+
var o = i.isInitialized, e = i.isPanning, r = i.setup, n = r.panning.disabled, a = o && e && !n;
|
|
536
|
+
return !!a;
|
|
537
|
+
}, er = function(i, o) {
|
|
538
|
+
var e = i.transformState, r = e.positionX, n = e.positionY;
|
|
539
|
+
i.isPanning = !0;
|
|
540
|
+
var a = o.clientX, t = o.clientY;
|
|
541
|
+
i.startCoords = { x: a - r, y: t - n };
|
|
542
|
+
}, rr = function(i, o) {
|
|
543
|
+
var e = o.touches, r = i.transformState, n = r.positionX, a = r.positionY;
|
|
544
|
+
i.isPanning = !0;
|
|
545
|
+
var t = e.length === 1;
|
|
546
|
+
if (t) {
|
|
547
|
+
var l = e[0].clientX, s = e[0].clientY;
|
|
548
|
+
i.startCoords = { x: l - n, y: s - a };
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
function or(i) {
|
|
552
|
+
var o = i.transformState, e = o.positionX, r = o.positionY, n = o.scale, a = i.setup, t = a.disabled, l = a.limitToBounds, s = a.centerZoomedOut, d = i.wrapperComponent;
|
|
553
|
+
if (!(t || !d || !i.bounds)) {
|
|
554
|
+
var u = i.bounds, f = u.maxPositionX, v = u.minPositionX, p = u.maxPositionY, c = u.minPositionY, h = e > f || e < v, b = r > p || r < c, y = e > f ? d.offsetWidth : i.setup.minPositionX || 0, T = r > p ? d.offsetHeight : i.setup.minPositionY || 0, w = ei(i, y, T, n, i.bounds, l || s), E = w.x, A = w.y;
|
|
555
|
+
return {
|
|
556
|
+
scale: n,
|
|
557
|
+
positionX: h ? E : e,
|
|
558
|
+
positionY: b ? A : r
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
function nr(i, o, e, r, n) {
|
|
563
|
+
var a = i.setup.limitToBounds, t = i.wrapperComponent, l = i.bounds, s = i.transformState, d = s.scale, u = s.positionX, f = s.positionY;
|
|
564
|
+
if (!(t === null || l === null || o === u && e === f)) {
|
|
565
|
+
var v = ii(o, e, l, a, r, n, t), p = v.x, c = v.y;
|
|
566
|
+
i.setTransformState(d, p, c);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
var ar = function(i, o, e) {
|
|
570
|
+
var r = i.startCoords, n = i.transformState, a = i.setup.panning, t = a.lockAxisX, l = a.lockAxisY, s = n.positionX, d = n.positionY;
|
|
571
|
+
if (!r)
|
|
572
|
+
return { x: s, y: d };
|
|
573
|
+
var u = o - r.x, f = e - r.y, v = t ? s : u, p = l ? d : f;
|
|
574
|
+
return { x: v, y: p };
|
|
575
|
+
}, U = function(i, o) {
|
|
576
|
+
var e = i.setup, r = i.transformState, n = r.scale, a = e.minScale, t = e.disablePadding;
|
|
577
|
+
return o > 0 && n >= a && !t ? o : 0;
|
|
578
|
+
}, tr = function(i) {
|
|
579
|
+
var o = i.mounted, e = i.setup, r = e.disabled, n = e.velocityAnimation, a = i.transformState.scale, t = n.disabled, l = !t || a > 1 || !r || o;
|
|
580
|
+
return !!l;
|
|
581
|
+
}, lr = function(i) {
|
|
582
|
+
var o = i.mounted, e = i.velocity, r = i.bounds, n = i.setup, a = n.disabled, t = n.velocityAnimation, l = i.transformState.scale, s = t.disabled, d = !s || l > 1 || !a || o;
|
|
583
|
+
return !(!d || !e || !r);
|
|
584
|
+
};
|
|
585
|
+
function sr(i, o) {
|
|
586
|
+
var e = i.setup.velocityAnimation, r = e.equalToMove, n = e.animationTime, a = e.sensitivity;
|
|
587
|
+
return r ? n * o * a : n;
|
|
588
|
+
}
|
|
589
|
+
function Di(i, o, e, r, n, a, t, l, s, d) {
|
|
590
|
+
if (n) {
|
|
591
|
+
if (o > t && e > t) {
|
|
592
|
+
var u = t + (i - t) * d;
|
|
593
|
+
return u > s ? s : u < t ? t : u;
|
|
594
|
+
}
|
|
595
|
+
if (o < a && e < a) {
|
|
596
|
+
var u = a + (i - a) * d;
|
|
597
|
+
return u < l ? l : u > a ? a : u;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return r ? o : di(i, a, t, n);
|
|
601
|
+
}
|
|
602
|
+
function ur(i, o) {
|
|
603
|
+
var e = 1;
|
|
604
|
+
return o ? Math.min(e, i.offsetWidth / window.innerWidth) : e;
|
|
605
|
+
}
|
|
606
|
+
function dr(i, o) {
|
|
607
|
+
var e = tr(i);
|
|
608
|
+
if (e) {
|
|
609
|
+
var r = i.lastMousePosition, n = i.velocityTime, a = i.setup, t = i.wrapperComponent, l = a.velocityAnimation.equalToMove, s = Date.now();
|
|
610
|
+
if (r && n && t) {
|
|
611
|
+
var d = ur(t, l), u = o.x - r.x, f = o.y - r.y, v = u / d, p = f / d, c = s - n, h = u * u + f * f, b = Math.sqrt(h) / c;
|
|
612
|
+
i.velocity = { velocityX: v, velocityY: p, total: b };
|
|
613
|
+
}
|
|
614
|
+
i.lastMousePosition = o, i.velocityTime = s;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function fr(i) {
|
|
618
|
+
var o = i.velocity, e = i.bounds, r = i.setup, n = i.wrapperComponent, a = lr(i);
|
|
619
|
+
if (!(!a || !o || !e || !n)) {
|
|
620
|
+
var t = o.velocityX, l = o.velocityY, s = o.total, d = e.maxPositionX, u = e.minPositionX, f = e.maxPositionY, v = e.minPositionY, p = r.limitToBounds, c = r.alignmentAnimation, h = r.zoomAnimation, b = r.panning, y = b.lockAxisY, T = b.lockAxisX, w = h.animationType, E = c.sizeX, A = c.sizeY, k = c.velocityAlignmentTime, O = k, M = sr(i, s), W = Math.max(M, O), N = U(i, E), Z = U(i, A), j = N * n.offsetWidth / 100, Pi = Z * n.offsetHeight / 100, le = d + j, se = u - j, ue = f + Pi, de = v - Pi, yi = i.transformState, fe = (/* @__PURE__ */ new Date()).getTime();
|
|
621
|
+
Ki(i, w, W, function(ve) {
|
|
622
|
+
var ni = i.transformState, pe = ni.scale, ai = ni.positionX, ti = ni.positionY, me = (/* @__PURE__ */ new Date()).getTime() - fe, ce = me / O, he = Vi[c.animationType], Ti = 1 - he(Math.min(1, ce)), Yi = 1 - ve, Ai = ai + t * Yi, _i = ti + l * Yi, ge = Di(Ai, yi.positionX, ai, T, p, u, d, se, le, Ti), be = Di(_i, yi.positionY, ti, y, p, v, f, de, ue, Ti);
|
|
623
|
+
(ai !== Ai || ti !== _i) && i.setTransformState(pe, ge, be);
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function Wi(i, o) {
|
|
628
|
+
var e = i.transformState.scale;
|
|
629
|
+
_(i), R(i, e), window.TouchEvent !== void 0 && o instanceof TouchEvent ? rr(i, o) : er(i, o);
|
|
630
|
+
}
|
|
631
|
+
function Qi(i) {
|
|
632
|
+
var o = i.transformState.scale, e = i.setup, r = e.minScale, n = e.alignmentAnimation, a = n.disabled, t = n.sizeX, l = n.sizeY, s = n.animationTime, d = n.animationType, u = a || o < r || !t && !l;
|
|
633
|
+
if (!u) {
|
|
634
|
+
var f = or(i);
|
|
635
|
+
f && X(i, f, s, d);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function Ni(i, o, e) {
|
|
639
|
+
var r = i.startCoords, n = i.setup, a = n.alignmentAnimation, t = a.sizeX, l = a.sizeY;
|
|
640
|
+
if (r) {
|
|
641
|
+
var s = ar(i, o, e), d = s.x, u = s.y, f = U(i, t), v = U(i, l);
|
|
642
|
+
dr(i, { x: d, y: u }), nr(i, d, u, f, v);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function vr(i) {
|
|
646
|
+
if (i.isPanning) {
|
|
647
|
+
var o = i.setup.panning.velocityDisabled, e = i.velocity, r = i.wrapperComponent, n = i.contentComponent;
|
|
648
|
+
i.isPanning = !1, i.animate = !1, i.animation = null;
|
|
649
|
+
var a = r == null ? void 0 : r.getBoundingClientRect(), t = n == null ? void 0 : n.getBoundingClientRect(), l = (a == null ? void 0 : a.width) || 0, s = (a == null ? void 0 : a.height) || 0, d = (t == null ? void 0 : t.width) || 0, u = (t == null ? void 0 : t.height) || 0, f = l < d || s < u, v = !o && e && (e == null ? void 0 : e.total) > 0.1 && f;
|
|
650
|
+
v ? fr(i) : Qi(i);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
function gi(i, o, e, r) {
|
|
654
|
+
var n = i.setup, a = n.minScale, t = n.maxScale, l = n.limitToBounds, s = L(Y(o, 2), a, t, 0, !1), d = R(i, s), u = ei(i, e, r, s, d, l), f = u.x, v = u.y;
|
|
655
|
+
return { scale: s, positionX: f, positionY: v };
|
|
656
|
+
}
|
|
657
|
+
function qi(i, o, e) {
|
|
658
|
+
var r = i.transformState.scale, n = i.wrapperComponent, a = i.setup, t = a.minScale, l = a.limitToBounds, s = a.zoomAnimation, d = s.disabled, u = s.animationTime, f = s.animationType, v = d || r >= t;
|
|
659
|
+
if ((r >= 1 || l) && Qi(i), !(v || !n || !i.mounted)) {
|
|
660
|
+
var p = o || n.offsetWidth / 2, c = e || n.offsetHeight / 2, h = gi(i, t, p, c);
|
|
661
|
+
h && X(i, h, u, f);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
var z = function() {
|
|
665
|
+
return z = Object.assign || function(o) {
|
|
666
|
+
for (var e, r = 1, n = arguments.length; r < n; r++) {
|
|
667
|
+
e = arguments[r];
|
|
668
|
+
for (var a in e)
|
|
669
|
+
Object.prototype.hasOwnProperty.call(e, a) && (o[a] = e[a]);
|
|
670
|
+
}
|
|
671
|
+
return o;
|
|
672
|
+
}, z.apply(this, arguments);
|
|
673
|
+
};
|
|
674
|
+
function Bi(i, o, e) {
|
|
675
|
+
if (e || arguments.length === 2)
|
|
676
|
+
for (var r = 0, n = o.length, a; r < n; r++)
|
|
677
|
+
(a || !(r in o)) && (a || (a = Array.prototype.slice.call(o, 0, r)), a[r] = o[r]);
|
|
678
|
+
return i.concat(a || Array.prototype.slice.call(o));
|
|
679
|
+
}
|
|
680
|
+
var F = {
|
|
681
|
+
previousScale: 1,
|
|
682
|
+
scale: 1,
|
|
683
|
+
positionX: 0,
|
|
684
|
+
positionY: 0
|
|
685
|
+
}, $ = {
|
|
686
|
+
disabled: !1,
|
|
687
|
+
minPositionX: null,
|
|
688
|
+
maxPositionX: null,
|
|
689
|
+
minPositionY: null,
|
|
690
|
+
maxPositionY: null,
|
|
691
|
+
minScale: 1,
|
|
692
|
+
maxScale: 8,
|
|
693
|
+
limitToBounds: !0,
|
|
694
|
+
centerZoomedOut: !1,
|
|
695
|
+
centerOnInit: !1,
|
|
696
|
+
disablePadding: !1,
|
|
697
|
+
smooth: !0,
|
|
698
|
+
wheel: {
|
|
699
|
+
step: 0.2,
|
|
700
|
+
disabled: !1,
|
|
701
|
+
smoothStep: 1e-3,
|
|
702
|
+
wheelDisabled: !1,
|
|
703
|
+
touchPadDisabled: !1,
|
|
704
|
+
activationKeys: [],
|
|
705
|
+
excluded: []
|
|
706
|
+
},
|
|
707
|
+
panning: {
|
|
708
|
+
disabled: !1,
|
|
709
|
+
velocityDisabled: !1,
|
|
710
|
+
lockAxisX: !1,
|
|
711
|
+
lockAxisY: !1,
|
|
712
|
+
activationKeys: [],
|
|
713
|
+
excluded: []
|
|
714
|
+
},
|
|
715
|
+
pinch: {
|
|
716
|
+
step: 5,
|
|
717
|
+
disabled: !1,
|
|
718
|
+
excluded: []
|
|
719
|
+
},
|
|
720
|
+
doubleClick: {
|
|
721
|
+
disabled: !1,
|
|
722
|
+
step: 0.7,
|
|
723
|
+
mode: "zoomIn",
|
|
724
|
+
animationType: "easeOut",
|
|
725
|
+
animationTime: 200,
|
|
726
|
+
excluded: []
|
|
727
|
+
},
|
|
728
|
+
zoomAnimation: {
|
|
729
|
+
disabled: !1,
|
|
730
|
+
size: 0.4,
|
|
731
|
+
animationTime: 200,
|
|
732
|
+
animationType: "easeOut"
|
|
733
|
+
},
|
|
734
|
+
alignmentAnimation: {
|
|
735
|
+
disabled: !1,
|
|
736
|
+
sizeX: 100,
|
|
737
|
+
sizeY: 100,
|
|
738
|
+
animationTime: 200,
|
|
739
|
+
velocityAlignmentTime: 400,
|
|
740
|
+
animationType: "easeOut"
|
|
741
|
+
},
|
|
742
|
+
velocityAnimation: {
|
|
743
|
+
disabled: !1,
|
|
744
|
+
sensitivity: 1,
|
|
745
|
+
animationTime: 400,
|
|
746
|
+
animationType: "easeOut",
|
|
747
|
+
equalToMove: !0
|
|
748
|
+
}
|
|
749
|
+
}, Ui = function(i) {
|
|
750
|
+
var o, e, r, n;
|
|
751
|
+
return {
|
|
752
|
+
previousScale: (o = i.initialScale) !== null && o !== void 0 ? o : F.scale,
|
|
753
|
+
scale: (e = i.initialScale) !== null && e !== void 0 ? e : F.scale,
|
|
754
|
+
positionX: (r = i.initialPositionX) !== null && r !== void 0 ? r : F.positionX,
|
|
755
|
+
positionY: (n = i.initialPositionY) !== null && n !== void 0 ? n : F.positionY
|
|
756
|
+
};
|
|
757
|
+
}, Ri = function(i) {
|
|
758
|
+
var o = z({}, $);
|
|
759
|
+
return Object.keys(i).forEach(function(e) {
|
|
760
|
+
var r = typeof i[e] < "u", n = typeof $[e] < "u";
|
|
761
|
+
if (n && r) {
|
|
762
|
+
var a = Object.prototype.toString.call($[e]), t = a === "[object Object]", l = a === "[object Array]";
|
|
763
|
+
t ? o[e] = z(z({}, $[e]), i[e]) : l ? o[e] = Bi(Bi([], $[e], !0), i[e], !0) : o[e] = i[e];
|
|
764
|
+
}
|
|
765
|
+
}), o;
|
|
766
|
+
}, Gi = function(i, o, e) {
|
|
767
|
+
var r = i.transformState.scale, n = i.wrapperComponent, a = i.setup, t = a.maxScale, l = a.minScale, s = a.zoomAnimation, d = a.smooth, u = s.size;
|
|
768
|
+
if (!n)
|
|
769
|
+
throw new Error("Wrapper is not mounted");
|
|
770
|
+
var f = d ? r * Math.exp(o * e) : r + o * e, v = L(Y(f, 3), l, t, u, !1);
|
|
771
|
+
return v;
|
|
772
|
+
};
|
|
773
|
+
function Ji(i, o, e, r, n) {
|
|
774
|
+
var a = i.wrapperComponent, t = i.transformState, l = t.scale, s = t.positionX, d = t.positionY;
|
|
775
|
+
if (!a)
|
|
776
|
+
return console.error("No WrapperComponent found");
|
|
777
|
+
var u = a.offsetWidth, f = a.offsetHeight, v = (u / 2 - s) / l, p = (f / 2 - d) / l, c = Gi(i, o, e), h = gi(i, c, v, p);
|
|
778
|
+
if (!h)
|
|
779
|
+
return console.error("Error during zoom event. New transformation state was not calculated.");
|
|
780
|
+
X(i, h, r, n);
|
|
781
|
+
}
|
|
782
|
+
function xi(i, o, e, r) {
|
|
783
|
+
var n = i.setup, a = i.wrapperComponent, t = n.limitToBounds, l = Ui(i.props), s = i.transformState, d = s.scale, u = s.positionX, f = s.positionY;
|
|
784
|
+
if (a) {
|
|
785
|
+
var v = hi(i, l.scale), p = ii(l.positionX, l.positionY, v, t, 0, 0, a), c = {
|
|
786
|
+
scale: l.scale,
|
|
787
|
+
positionX: p.x,
|
|
788
|
+
positionY: p.y
|
|
789
|
+
};
|
|
790
|
+
d === l.scale && u === l.positionX && f === l.positionY || (r == null || r(), X(i, c, o, e));
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
function pr(i, o, e, r) {
|
|
794
|
+
var n = i.getBoundingClientRect(), a = o.getBoundingClientRect(), t = e.getBoundingClientRect(), l = a.x * r.scale, s = a.y * r.scale;
|
|
795
|
+
return {
|
|
796
|
+
x: (n.x - t.x + l) / r.scale,
|
|
797
|
+
y: (n.y - t.y + s) / r.scale
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function mr(i, o, e) {
|
|
801
|
+
var r = i.wrapperComponent, n = i.contentComponent, a = i.transformState, t = i.setup, l = t.limitToBounds, s = t.minScale, d = t.maxScale;
|
|
802
|
+
if (!r || !n)
|
|
803
|
+
return a;
|
|
804
|
+
var u = r.getBoundingClientRect(), f = o.getBoundingClientRect(), v = pr(o, r, n, a), p = v.x, c = v.y, h = f.width / a.scale, b = f.height / a.scale, y = r.offsetWidth / h, T = r.offsetHeight / b, w = L(e || Math.min(y, T), s, d, 0, !1), E = (u.width - h * w) / 2, A = (u.height - b * w) / 2, k = (u.left - p) * w + E, O = (u.top - c) * w + A, M = hi(i, w), W = ii(k, O, M, l, 0, 0, r), N = W.x, Z = W.y;
|
|
805
|
+
return { positionX: N, positionY: Z, scale: w };
|
|
806
|
+
}
|
|
807
|
+
var cr = function(i) {
|
|
808
|
+
return function(o, e, r) {
|
|
809
|
+
o === void 0 && (o = 0.5), e === void 0 && (e = 300), r === void 0 && (r = "easeOut"), Ji(i, 1, o, e, r);
|
|
810
|
+
};
|
|
811
|
+
}, hr = function(i) {
|
|
812
|
+
return function(o, e, r) {
|
|
813
|
+
o === void 0 && (o = 0.5), e === void 0 && (e = 300), r === void 0 && (r = "easeOut"), Ji(i, -1, o, e, r);
|
|
814
|
+
};
|
|
815
|
+
}, gr = function(i) {
|
|
816
|
+
return function(o, e, r, n, a) {
|
|
817
|
+
n === void 0 && (n = 300), a === void 0 && (a = "easeOut");
|
|
818
|
+
var t = i.transformState, l = t.positionX, s = t.positionY, d = t.scale, u = i.wrapperComponent, f = i.contentComponent, v = i.setup.disabled;
|
|
819
|
+
if (!(v || !u || !f)) {
|
|
820
|
+
var p = {
|
|
821
|
+
positionX: Number.isNaN(o) ? l : o,
|
|
822
|
+
positionY: Number.isNaN(e) ? s : e,
|
|
823
|
+
scale: Number.isNaN(r) ? d : r
|
|
824
|
+
};
|
|
825
|
+
X(i, p, n, a);
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
}, br = function(i) {
|
|
829
|
+
return function(o, e) {
|
|
830
|
+
o === void 0 && (o = 200), e === void 0 && (e = "easeOut"), xi(i, o, e);
|
|
831
|
+
};
|
|
832
|
+
}, Sr = function(i) {
|
|
833
|
+
return function(o, e, r) {
|
|
834
|
+
e === void 0 && (e = 200), r === void 0 && (r = "easeOut");
|
|
835
|
+
var n = i.transformState, a = i.wrapperComponent, t = i.contentComponent;
|
|
836
|
+
if (a && t) {
|
|
837
|
+
var l = Ii(o || n.scale, a, t);
|
|
838
|
+
X(i, l, e, r);
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
}, wr = function(i) {
|
|
842
|
+
return function(o, e, r, n) {
|
|
843
|
+
r === void 0 && (r = 600), n === void 0 && (n = "easeOut"), _(i);
|
|
844
|
+
var a = i.wrapperComponent, t = typeof o == "string" ? document.getElementById(o) : o;
|
|
845
|
+
if (a && t && a.contains(t)) {
|
|
846
|
+
var l = mr(i, t, e);
|
|
847
|
+
X(i, l, r, n);
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
}, G = function(i) {
|
|
851
|
+
return {
|
|
852
|
+
instance: i,
|
|
853
|
+
zoomIn: cr(i),
|
|
854
|
+
zoomOut: hr(i),
|
|
855
|
+
setTransform: gr(i),
|
|
856
|
+
resetTransform: br(i),
|
|
857
|
+
centerView: Sr(i),
|
|
858
|
+
zoomToElement: wr(i)
|
|
859
|
+
};
|
|
860
|
+
}, Cr = function(i) {
|
|
861
|
+
return {
|
|
862
|
+
instance: i,
|
|
863
|
+
state: i.transformState
|
|
864
|
+
};
|
|
865
|
+
}, g = function(i) {
|
|
866
|
+
var o = {};
|
|
867
|
+
return Object.assign(o, Cr(i)), Object.assign(o, G(i)), o;
|
|
868
|
+
}, li = !1;
|
|
869
|
+
function si() {
|
|
870
|
+
try {
|
|
871
|
+
var i = {
|
|
872
|
+
get passive() {
|
|
873
|
+
return li = !0, !1;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
return i;
|
|
877
|
+
} catch {
|
|
878
|
+
return li = !1, li;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
var ri = function(i, o) {
|
|
882
|
+
var e = i.tagName.toUpperCase(), r = o.find(function(a) {
|
|
883
|
+
return a.toUpperCase() === e;
|
|
884
|
+
});
|
|
885
|
+
if (r)
|
|
886
|
+
return !0;
|
|
887
|
+
var n = o.find(function(a) {
|
|
888
|
+
return i.classList.contains(a);
|
|
889
|
+
});
|
|
890
|
+
return !!n;
|
|
891
|
+
}, fi = function(i) {
|
|
892
|
+
i && clearTimeout(i);
|
|
893
|
+
}, Pr = function(i, o, e) {
|
|
894
|
+
return "translate(".concat(i, "px, ").concat(o, "px) scale(").concat(e, ")");
|
|
895
|
+
}, Ii = function(i, o, e) {
|
|
896
|
+
var r = e.offsetWidth * i, n = e.offsetHeight * i, a = (o.offsetWidth - r) / 2, t = (o.offsetHeight - n) / 2;
|
|
897
|
+
return {
|
|
898
|
+
scale: i,
|
|
899
|
+
positionX: a,
|
|
900
|
+
positionY: t
|
|
901
|
+
};
|
|
902
|
+
};
|
|
903
|
+
function yr(i) {
|
|
904
|
+
return function(o) {
|
|
905
|
+
i.forEach(function(e) {
|
|
906
|
+
typeof e == "function" ? e(o) : e != null && (e.current = o);
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
var Tr = function(i, o) {
|
|
911
|
+
var e = i.setup.wheel, r = e.disabled, n = e.wheelDisabled, a = e.touchPadDisabled, t = e.excluded, l = i.isInitialized, s = i.isPanning, d = o.target, u = l && !s && !r && d;
|
|
912
|
+
if (!u || n && !o.ctrlKey || a && o.ctrlKey)
|
|
913
|
+
return !1;
|
|
914
|
+
var f = ri(d, t);
|
|
915
|
+
return !f;
|
|
916
|
+
}, Yr = function(i) {
|
|
917
|
+
return i ? i.deltaY < 0 ? 1 : -1 : 0;
|
|
918
|
+
};
|
|
919
|
+
function Ar(i, o) {
|
|
920
|
+
var e = Yr(i), r = ke(o, e);
|
|
921
|
+
return r;
|
|
922
|
+
}
|
|
923
|
+
function ie(i, o, e) {
|
|
924
|
+
var r = o.getBoundingClientRect(), n = 0, a = 0;
|
|
925
|
+
if ("clientX" in i)
|
|
926
|
+
n = (i.clientX - r.left) / e, a = (i.clientY - r.top) / e;
|
|
927
|
+
else {
|
|
928
|
+
var t = i.touches[0];
|
|
929
|
+
n = (t.clientX - r.left) / e, a = (t.clientY - r.top) / e;
|
|
930
|
+
}
|
|
931
|
+
return (Number.isNaN(n) || Number.isNaN(a)) && console.error("No mouse or touch offset found"), {
|
|
932
|
+
x: n,
|
|
933
|
+
y: a
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
var _r = function(i, o, e, r, n) {
|
|
937
|
+
var a = i.transformState.scale, t = i.wrapperComponent, l = i.setup, s = l.maxScale, d = l.minScale, u = l.zoomAnimation, f = l.disablePadding, v = u.size, p = u.disabled;
|
|
938
|
+
if (!t)
|
|
939
|
+
throw new Error("Wrapper is not mounted");
|
|
940
|
+
var c = a + o * e;
|
|
941
|
+
if (n)
|
|
942
|
+
return c;
|
|
943
|
+
var h = r ? !1 : !p, b = L(Y(c, 3), d, s, v, h && !f);
|
|
944
|
+
return b;
|
|
945
|
+
}, zr = function(i, o) {
|
|
946
|
+
var e = i.previousWheelEvent, r = i.transformState.scale, n = i.setup, a = n.maxScale, t = n.minScale;
|
|
947
|
+
return e ? r < a || r > t || Math.sign(e.deltaY) !== Math.sign(o.deltaY) || e.deltaY > 0 && e.deltaY < o.deltaY || e.deltaY < 0 && e.deltaY > o.deltaY || Math.sign(e.deltaY) !== Math.sign(o.deltaY) : !1;
|
|
948
|
+
}, Xr = function(i, o) {
|
|
949
|
+
var e = i.setup.pinch, r = e.disabled, n = e.excluded, a = i.isInitialized, t = o.target, l = a && !r && t;
|
|
950
|
+
if (!l)
|
|
951
|
+
return !1;
|
|
952
|
+
var s = ri(t, n);
|
|
953
|
+
return !s;
|
|
954
|
+
}, Er = function(i) {
|
|
955
|
+
var o = i.setup.pinch.disabled, e = i.isInitialized, r = i.pinchStartDistance, n = e && !o && r;
|
|
956
|
+
return !!n;
|
|
957
|
+
}, Or = function(i, o, e) {
|
|
958
|
+
var r = e.getBoundingClientRect(), n = i.touches, a = Y(n[0].clientX - r.left, 5), t = Y(n[0].clientY - r.top, 5), l = Y(n[1].clientX - r.left, 5), s = Y(n[1].clientY - r.top, 5);
|
|
959
|
+
return {
|
|
960
|
+
x: (a + l) / 2 / o,
|
|
961
|
+
y: (t + s) / 2 / o
|
|
962
|
+
};
|
|
963
|
+
}, ee = function(i) {
|
|
964
|
+
return Math.sqrt(Math.pow(i.touches[0].pageX - i.touches[1].pageX, 2) + Math.pow(i.touches[0].pageY - i.touches[1].pageY, 2));
|
|
965
|
+
}, Dr = function(i, o) {
|
|
966
|
+
var e = i.pinchStartScale, r = i.pinchStartDistance, n = i.setup, a = n.maxScale, t = n.minScale, l = n.zoomAnimation, s = n.disablePadding, d = l.size, u = l.disabled;
|
|
967
|
+
if (!e || r === null || !o)
|
|
968
|
+
throw new Error("Pinch touches distance was not provided");
|
|
969
|
+
if (o < 0)
|
|
970
|
+
return i.transformState.scale;
|
|
971
|
+
var f = o / r, v = f * e;
|
|
972
|
+
return L(Y(v, 2), t, a, d, !u && !s);
|
|
973
|
+
}, Wr = 160, Nr = 100, Br = function(i, o) {
|
|
974
|
+
var e = i.props, r = e.onWheelStart, n = e.onZoomStart;
|
|
975
|
+
i.wheelStopEventTimer || (_(i), S(g(i), o, r), S(g(i), o, n));
|
|
976
|
+
}, Rr = function(i, o) {
|
|
977
|
+
var e = i.props, r = e.onWheel, n = e.onZoom, a = i.contentComponent, t = i.setup, l = i.transformState, s = l.scale, d = t.limitToBounds, u = t.centerZoomedOut, f = t.zoomAnimation, v = t.wheel, p = t.disablePadding, c = t.smooth, h = f.size, b = f.disabled, y = v.step, T = v.smoothStep;
|
|
978
|
+
if (!a)
|
|
979
|
+
throw new Error("Component not mounted");
|
|
980
|
+
o.preventDefault(), o.stopPropagation();
|
|
981
|
+
var w = Ar(o, null), E = c ? T * Math.abs(o.deltaY) : y, A = _r(i, w, E, !o.ctrlKey);
|
|
982
|
+
if (s !== A) {
|
|
983
|
+
var k = R(i, A), O = ie(o, a, s), M = b || h === 0 || u || p, W = d && M, N = ei(i, O.x, O.y, A, k, W), Z = N.x, j = N.y;
|
|
984
|
+
i.previousWheelEvent = o, i.setTransformState(A, Z, j), S(g(i), o, r), S(g(i), o, n);
|
|
985
|
+
}
|
|
986
|
+
}, kr = function(i, o) {
|
|
987
|
+
var e = i.props, r = e.onWheelStop, n = e.onZoomStop;
|
|
988
|
+
fi(i.wheelAnimationTimer), i.wheelAnimationTimer = setTimeout(function() {
|
|
989
|
+
i.mounted && (qi(i, o.x, o.y), i.wheelAnimationTimer = null);
|
|
990
|
+
}, Nr);
|
|
991
|
+
var a = zr(i, o);
|
|
992
|
+
a && (fi(i.wheelStopEventTimer), i.wheelStopEventTimer = setTimeout(function() {
|
|
993
|
+
i.mounted && (i.wheelStopEventTimer = null, S(g(i), o, r), S(g(i), o, n));
|
|
994
|
+
}, Wr));
|
|
995
|
+
}, Mr = function(i, o) {
|
|
996
|
+
var e = ee(o);
|
|
997
|
+
i.pinchStartDistance = e, i.lastDistance = e, i.pinchStartScale = i.transformState.scale, i.isPanning = !1, _(i);
|
|
998
|
+
}, Zr = function(i, o) {
|
|
999
|
+
var e = i.contentComponent, r = i.pinchStartDistance, n = i.transformState.scale, a = i.setup, t = a.limitToBounds, l = a.centerZoomedOut, s = a.zoomAnimation, d = s.disabled, u = s.size;
|
|
1000
|
+
if (!(r === null || !e)) {
|
|
1001
|
+
var f = Or(o, n, e);
|
|
1002
|
+
if (!(!Number.isFinite(f.x) || !Number.isFinite(f.y))) {
|
|
1003
|
+
var v = ee(o), p = Dr(i, v);
|
|
1004
|
+
if (p !== n) {
|
|
1005
|
+
var c = R(i, p), h = d || u === 0 || l, b = t && h, y = ei(i, f.x, f.y, p, c, b), T = y.x, w = y.y;
|
|
1006
|
+
i.pinchMidpoint = f, i.lastDistance = v, i.setTransformState(p, T, w);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}, $r = function(i) {
|
|
1011
|
+
var o = i.pinchMidpoint;
|
|
1012
|
+
i.velocity = null, i.lastDistance = null, i.pinchMidpoint = null, i.pinchStartScale = null, i.pinchStartDistance = null, qi(i, o == null ? void 0 : o.x, o == null ? void 0 : o.y);
|
|
1013
|
+
}, re = function(i, o) {
|
|
1014
|
+
var e = i.props.onZoomStop, r = i.setup.doubleClick.animationTime;
|
|
1015
|
+
fi(i.doubleClickStopEventTimer), i.doubleClickStopEventTimer = setTimeout(function() {
|
|
1016
|
+
i.doubleClickStopEventTimer = null, S(g(i), o, e);
|
|
1017
|
+
}, r);
|
|
1018
|
+
}, Lr = function(i, o) {
|
|
1019
|
+
var e = i.props, r = e.onZoomStart, n = e.onZoom, a = i.setup.doubleClick, t = a.animationTime, l = a.animationType;
|
|
1020
|
+
S(g(i), o, r), xi(i, t, l, function() {
|
|
1021
|
+
return S(g(i), o, n);
|
|
1022
|
+
}), re(i, o);
|
|
1023
|
+
};
|
|
1024
|
+
function jr(i, o) {
|
|
1025
|
+
var e = i.setup, r = i.doubleClickStopEventTimer, n = i.transformState, a = i.contentComponent, t = n.scale, l = i.props, s = l.onZoomStart, d = l.onZoom, u = e.doubleClick, f = u.disabled, v = u.mode, p = u.step, c = u.animationTime, h = u.animationType;
|
|
1026
|
+
if (!f && !r) {
|
|
1027
|
+
if (v === "reset")
|
|
1028
|
+
return Lr(i, o);
|
|
1029
|
+
if (!a)
|
|
1030
|
+
return console.error("No ContentComponent found");
|
|
1031
|
+
var b = v === "zoomOut" ? -1 : 1, y = Gi(i, b, p);
|
|
1032
|
+
if (t !== y) {
|
|
1033
|
+
S(g(i), o, s);
|
|
1034
|
+
var T = ie(o, a, t), w = gi(i, y, T.x, T.y);
|
|
1035
|
+
if (!w)
|
|
1036
|
+
return console.error("Error during zoom event. New transformation state was not calculated.");
|
|
1037
|
+
S(g(i), o, d), X(i, w, c, h), re(i, o);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
var Hr = function(i, o) {
|
|
1042
|
+
var e = i.isInitialized, r = i.setup, n = i.wrapperComponent, a = r.doubleClick, t = a.disabled, l = a.excluded, s = o.target, d = n == null ? void 0 : n.contains(s), u = e && s && d && !t;
|
|
1043
|
+
if (!u)
|
|
1044
|
+
return !1;
|
|
1045
|
+
var f = ri(s, l);
|
|
1046
|
+
return !f;
|
|
1047
|
+
}, Vr = (
|
|
1048
|
+
/** @class */
|
|
1049
|
+
function() {
|
|
1050
|
+
function i(o) {
|
|
1051
|
+
var e = this;
|
|
1052
|
+
this.mounted = !0, this.onChangeCallbacks = /* @__PURE__ */ new Set(), this.onInitCallbacks = /* @__PURE__ */ new Set(), this.wrapperComponent = null, this.contentComponent = null, this.isInitialized = !1, this.bounds = null, this.previousWheelEvent = null, this.wheelStopEventTimer = null, this.wheelAnimationTimer = null, this.isPanning = !1, this.startCoords = null, this.lastTouch = null, this.distance = null, this.lastDistance = null, this.pinchStartDistance = null, this.pinchStartScale = null, this.pinchMidpoint = null, this.doubleClickStopEventTimer = null, this.velocity = null, this.velocityTime = null, this.lastMousePosition = null, this.animate = !1, this.animation = null, this.maxBounds = null, this.pressedKeys = {}, this.mount = function() {
|
|
1053
|
+
e.initializeWindowEvents();
|
|
1054
|
+
}, this.unmount = function() {
|
|
1055
|
+
e.cleanupWindowEvents();
|
|
1056
|
+
}, this.update = function(r) {
|
|
1057
|
+
R(e, e.transformState.scale), e.setup = Ri(r);
|
|
1058
|
+
}, this.initializeWindowEvents = function() {
|
|
1059
|
+
var r, n = si(), a = (r = e.wrapperComponent) === null || r === void 0 ? void 0 : r.ownerDocument, t = a == null ? void 0 : a.defaultView;
|
|
1060
|
+
t == null || t.addEventListener("mousedown", e.onPanningStart, n), t == null || t.addEventListener("mousemove", e.onPanning, n), t == null || t.addEventListener("mouseup", e.onPanningStop, n), a == null || a.addEventListener("mouseleave", e.clearPanning, n), t == null || t.addEventListener("keyup", e.setKeyUnPressed, n), t == null || t.addEventListener("keydown", e.setKeyPressed, n);
|
|
1061
|
+
}, this.cleanupWindowEvents = function() {
|
|
1062
|
+
var r, n, a = si(), t = (r = e.wrapperComponent) === null || r === void 0 ? void 0 : r.ownerDocument, l = t == null ? void 0 : t.defaultView;
|
|
1063
|
+
l == null || l.removeEventListener("mousedown", e.onPanningStart, a), l == null || l.removeEventListener("mousemove", e.onPanning, a), l == null || l.removeEventListener("mouseup", e.onPanningStop, a), t == null || t.removeEventListener("mouseleave", e.clearPanning, a), l == null || l.removeEventListener("keyup", e.setKeyUnPressed, a), l == null || l.removeEventListener("keydown", e.setKeyPressed, a), document.removeEventListener("mouseleave", e.clearPanning, a), _(e), (n = e.observer) === null || n === void 0 || n.disconnect();
|
|
1064
|
+
}, this.handleInitializeWrapperEvents = function(r) {
|
|
1065
|
+
var n = si();
|
|
1066
|
+
r.addEventListener("wheel", e.onWheelZoom, n), r.addEventListener("dblclick", e.onDoubleClick, n), r.addEventListener("touchstart", e.onTouchPanningStart, n), r.addEventListener("touchmove", e.onTouchPanning, n), r.addEventListener("touchend", e.onTouchPanningStop, n);
|
|
1067
|
+
}, this.handleInitialize = function(r) {
|
|
1068
|
+
var n = e.setup.centerOnInit;
|
|
1069
|
+
e.applyTransformation(), e.onInitCallbacks.forEach(function(a) {
|
|
1070
|
+
return a(g(e));
|
|
1071
|
+
}), n && (e.setCenter(), e.observer = new ResizeObserver(function() {
|
|
1072
|
+
var a;
|
|
1073
|
+
e.onInitCallbacks.forEach(function(t) {
|
|
1074
|
+
return t(g(e));
|
|
1075
|
+
}), e.setCenter(), (a = e.observer) === null || a === void 0 || a.disconnect();
|
|
1076
|
+
}), e.observer.observe(r));
|
|
1077
|
+
}, this.onWheelZoom = function(r) {
|
|
1078
|
+
var n = e.setup.disabled;
|
|
1079
|
+
if (!n) {
|
|
1080
|
+
var a = Tr(e, r);
|
|
1081
|
+
if (a) {
|
|
1082
|
+
var t = e.isPressingKeys(e.setup.wheel.activationKeys);
|
|
1083
|
+
t && (Br(e, r), Rr(e, r), kr(e, r));
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}, this.onPanningStart = function(r) {
|
|
1087
|
+
var n = e.setup.disabled, a = e.props.onPanningStart;
|
|
1088
|
+
if (!n) {
|
|
1089
|
+
var t = Ei(e, r);
|
|
1090
|
+
if (t) {
|
|
1091
|
+
var l = e.isPressingKeys(e.setup.panning.activationKeys);
|
|
1092
|
+
l && (r.preventDefault(), r.stopPropagation(), _(e), Wi(e, r), S(g(e), r, a));
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}, this.onPanning = function(r) {
|
|
1096
|
+
var n = e.setup.disabled, a = e.props.onPanning;
|
|
1097
|
+
if (!n) {
|
|
1098
|
+
var t = Oi(e);
|
|
1099
|
+
if (t) {
|
|
1100
|
+
var l = e.isPressingKeys(e.setup.panning.activationKeys);
|
|
1101
|
+
l && (r.preventDefault(), r.stopPropagation(), Ni(e, r.clientX, r.clientY), S(g(e), r, a));
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}, this.onPanningStop = function(r) {
|
|
1105
|
+
var n = e.props.onPanningStop;
|
|
1106
|
+
e.isPanning && (vr(e), S(g(e), r, n));
|
|
1107
|
+
}, this.onPinchStart = function(r) {
|
|
1108
|
+
var n = e.setup.disabled, a = e.props, t = a.onPinchingStart, l = a.onZoomStart;
|
|
1109
|
+
if (!n) {
|
|
1110
|
+
var s = Xr(e, r);
|
|
1111
|
+
s && (Mr(e, r), _(e), S(g(e), r, t), S(g(e), r, l));
|
|
1112
|
+
}
|
|
1113
|
+
}, this.onPinch = function(r) {
|
|
1114
|
+
var n = e.setup.disabled, a = e.props, t = a.onPinching, l = a.onZoom;
|
|
1115
|
+
if (!n) {
|
|
1116
|
+
var s = Er(e);
|
|
1117
|
+
s && (r.preventDefault(), r.stopPropagation(), Zr(e, r), S(g(e), r, t), S(g(e), r, l));
|
|
1118
|
+
}
|
|
1119
|
+
}, this.onPinchStop = function(r) {
|
|
1120
|
+
var n = e.props, a = n.onPinchingStop, t = n.onZoomStop;
|
|
1121
|
+
e.pinchStartScale && ($r(e), S(g(e), r, a), S(g(e), r, t));
|
|
1122
|
+
}, this.onTouchPanningStart = function(r) {
|
|
1123
|
+
var n = e.setup.disabled, a = e.props.onPanningStart;
|
|
1124
|
+
if (!n) {
|
|
1125
|
+
var t = Ei(e, r);
|
|
1126
|
+
if (t) {
|
|
1127
|
+
var l = e.lastTouch && +/* @__PURE__ */ new Date() - e.lastTouch < 200;
|
|
1128
|
+
if (l && r.touches.length === 1)
|
|
1129
|
+
e.onDoubleClick(r);
|
|
1130
|
+
else {
|
|
1131
|
+
e.lastTouch = +/* @__PURE__ */ new Date(), _(e);
|
|
1132
|
+
var s = r.touches, d = s.length === 1, u = s.length === 2;
|
|
1133
|
+
d && (_(e), Wi(e, r), S(g(e), r, a)), u && e.onPinchStart(r);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}, this.onTouchPanning = function(r) {
|
|
1138
|
+
var n = e.setup.disabled, a = e.props.onPanning;
|
|
1139
|
+
if (e.isPanning && r.touches.length === 1) {
|
|
1140
|
+
if (n)
|
|
1141
|
+
return;
|
|
1142
|
+
var t = Oi(e);
|
|
1143
|
+
if (!t)
|
|
1144
|
+
return;
|
|
1145
|
+
r.preventDefault(), r.stopPropagation();
|
|
1146
|
+
var l = r.touches[0];
|
|
1147
|
+
Ni(e, l.clientX, l.clientY), S(g(e), r, a);
|
|
1148
|
+
} else
|
|
1149
|
+
r.touches.length > 1 && e.onPinch(r);
|
|
1150
|
+
}, this.onTouchPanningStop = function(r) {
|
|
1151
|
+
e.onPanningStop(r), e.onPinchStop(r);
|
|
1152
|
+
}, this.onDoubleClick = function(r) {
|
|
1153
|
+
var n = e.setup.disabled;
|
|
1154
|
+
if (!n) {
|
|
1155
|
+
var a = Hr(e, r);
|
|
1156
|
+
a && jr(e, r);
|
|
1157
|
+
}
|
|
1158
|
+
}, this.clearPanning = function(r) {
|
|
1159
|
+
e.isPanning && e.onPanningStop(r);
|
|
1160
|
+
}, this.setKeyPressed = function(r) {
|
|
1161
|
+
e.pressedKeys[r.key] = !0;
|
|
1162
|
+
}, this.setKeyUnPressed = function(r) {
|
|
1163
|
+
e.pressedKeys[r.key] = !1;
|
|
1164
|
+
}, this.isPressingKeys = function(r) {
|
|
1165
|
+
return r.length ? !!r.find(function(n) {
|
|
1166
|
+
return e.pressedKeys[n];
|
|
1167
|
+
}) : !0;
|
|
1168
|
+
}, this.setTransformState = function(r, n, a) {
|
|
1169
|
+
var t = e.props.onTransformed;
|
|
1170
|
+
if (!Number.isNaN(r) && !Number.isNaN(n) && !Number.isNaN(a)) {
|
|
1171
|
+
r !== e.transformState.scale && (e.transformState.previousScale = e.transformState.scale, e.transformState.scale = r), e.transformState.positionX = n, e.transformState.positionY = a, e.applyTransformation();
|
|
1172
|
+
var l = g(e);
|
|
1173
|
+
e.onChangeCallbacks.forEach(function(s) {
|
|
1174
|
+
return s(l);
|
|
1175
|
+
}), S(l, { scale: r, positionX: n, positionY: a }, t);
|
|
1176
|
+
} else
|
|
1177
|
+
console.error("Detected NaN set state values");
|
|
1178
|
+
}, this.setCenter = function() {
|
|
1179
|
+
if (e.wrapperComponent && e.contentComponent) {
|
|
1180
|
+
var r = Ii(e.transformState.scale, e.wrapperComponent, e.contentComponent);
|
|
1181
|
+
e.setTransformState(r.scale, r.positionX, r.positionY);
|
|
1182
|
+
}
|
|
1183
|
+
}, this.handleTransformStyles = function(r, n, a) {
|
|
1184
|
+
return e.props.customTransform ? e.props.customTransform(r, n, a) : Pr(r, n, a);
|
|
1185
|
+
}, this.applyTransformation = function() {
|
|
1186
|
+
if (!(!e.mounted || !e.contentComponent)) {
|
|
1187
|
+
var r = e.transformState, n = r.scale, a = r.positionX, t = r.positionY, l = e.handleTransformStyles(a, t, n);
|
|
1188
|
+
e.contentComponent.style.transform = l;
|
|
1189
|
+
}
|
|
1190
|
+
}, this.getContext = function() {
|
|
1191
|
+
return g(e);
|
|
1192
|
+
}, this.onChange = function(r) {
|
|
1193
|
+
return e.onChangeCallbacks.has(r) || e.onChangeCallbacks.add(r), function() {
|
|
1194
|
+
e.onChangeCallbacks.delete(r);
|
|
1195
|
+
};
|
|
1196
|
+
}, this.onInit = function(r) {
|
|
1197
|
+
return e.onInitCallbacks.has(r) || e.onInitCallbacks.add(r), function() {
|
|
1198
|
+
e.onInitCallbacks.delete(r);
|
|
1199
|
+
};
|
|
1200
|
+
}, this.init = function(r, n) {
|
|
1201
|
+
e.cleanupWindowEvents(), e.wrapperComponent = r, e.contentComponent = n, R(e, e.transformState.scale), e.handleInitializeWrapperEvents(r), e.handleInitialize(n), e.initializeWindowEvents(), e.isInitialized = !0;
|
|
1202
|
+
var a = g(e);
|
|
1203
|
+
S(a, void 0, e.props.onInit);
|
|
1204
|
+
}, this.props = o, this.setup = Ri(this.props), this.transformState = Ui(this.props);
|
|
1205
|
+
}
|
|
1206
|
+
return i;
|
|
1207
|
+
}()
|
|
1208
|
+
), oi = D.createContext(null), Fr = function(i, o) {
|
|
1209
|
+
return typeof i == "function" ? i(o) : i;
|
|
1210
|
+
}, yo = D.forwardRef(function(i, o) {
|
|
1211
|
+
var e = q(new Vr(i)).current, r = Fr(i.children, G(e));
|
|
1212
|
+
return we(o, function() {
|
|
1213
|
+
return G(e);
|
|
1214
|
+
}, [e]), vi(function() {
|
|
1215
|
+
e.update(i);
|
|
1216
|
+
}, [e, i]), D.createElement(oi.Provider, { value: e }, r);
|
|
1217
|
+
});
|
|
1218
|
+
D.forwardRef(function(i, o) {
|
|
1219
|
+
var e = q(null), r = pi(oi);
|
|
1220
|
+
return vi(function() {
|
|
1221
|
+
return r.onChange(function(n) {
|
|
1222
|
+
if (e.current) {
|
|
1223
|
+
var a = 0, t = 0;
|
|
1224
|
+
e.current.style.transform = r.handleTransformStyles(a, t, 1 / n.instance.transformState.scale);
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
}, [r]), D.createElement("div", z({}, i, { ref: yr([e, o]) }));
|
|
1228
|
+
});
|
|
1229
|
+
function Kr(i, o) {
|
|
1230
|
+
o === void 0 && (o = {});
|
|
1231
|
+
var e = o.insertAt;
|
|
1232
|
+
if (!(!i || typeof document > "u")) {
|
|
1233
|
+
var r = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
|
|
1234
|
+
n.type = "text/css", e === "top" && r.firstChild ? r.insertBefore(n, r.firstChild) : r.appendChild(n), n.styleSheet ? n.styleSheet.cssText = i : n.appendChild(document.createTextNode(i));
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
var Qr = `.transform-component-module_wrapper__SPB86 {
|
|
1238
|
+
position: relative;
|
|
1239
|
+
width: -moz-fit-content;
|
|
1240
|
+
width: fit-content;
|
|
1241
|
+
height: -moz-fit-content;
|
|
1242
|
+
height: fit-content;
|
|
1243
|
+
overflow: hidden;
|
|
1244
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
1245
|
+
-webkit-user-select: none; /* Safari */
|
|
1246
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
1247
|
+
-moz-user-select: none; /* Firefox */
|
|
1248
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
1249
|
+
user-select: none;
|
|
1250
|
+
margin: 0;
|
|
1251
|
+
padding: 0;
|
|
1252
|
+
}
|
|
1253
|
+
.transform-component-module_content__FBWxo {
|
|
1254
|
+
display: flex;
|
|
1255
|
+
flex-wrap: wrap;
|
|
1256
|
+
width: -moz-fit-content;
|
|
1257
|
+
width: fit-content;
|
|
1258
|
+
height: -moz-fit-content;
|
|
1259
|
+
height: fit-content;
|
|
1260
|
+
margin: 0;
|
|
1261
|
+
padding: 0;
|
|
1262
|
+
transform-origin: 0% 0%;
|
|
1263
|
+
}
|
|
1264
|
+
.transform-component-module_content__FBWxo img {
|
|
1265
|
+
pointer-events: none;
|
|
1266
|
+
}
|
|
1267
|
+
`, ki = { wrapper: "transform-component-module_wrapper__SPB86", content: "transform-component-module_content__FBWxo" };
|
|
1268
|
+
Kr(Qr);
|
|
1269
|
+
var To = function(i) {
|
|
1270
|
+
var o = i.children, e = i.wrapperClass, r = e === void 0 ? "" : e, n = i.contentClass, a = n === void 0 ? "" : n, t = i.wrapperStyle, l = i.contentStyle, s = i.wrapperProps, d = s === void 0 ? {} : s, u = i.contentProps, f = u === void 0 ? {} : u, v = pi(oi).init, p = q(null), c = q(null);
|
|
1271
|
+
return vi(function() {
|
|
1272
|
+
var h = p.current, b = c.current;
|
|
1273
|
+
h !== null && b !== null && v && v(h, b);
|
|
1274
|
+
}, []), D.createElement(
|
|
1275
|
+
"div",
|
|
1276
|
+
z({}, d, { ref: p, className: "react-transform-wrapper ".concat(ki.wrapper, " ").concat(r), style: t }),
|
|
1277
|
+
D.createElement("div", z({}, f, { ref: c, className: "react-transform-component ".concat(ki.content, " ").concat(a), style: l }), o)
|
|
1278
|
+
);
|
|
1279
|
+
}, qr = function() {
|
|
1280
|
+
var i = pi(oi);
|
|
1281
|
+
if (!i)
|
|
1282
|
+
throw new Error("Transform context must be placed inside TransformWrapper");
|
|
1283
|
+
return i;
|
|
1284
|
+
}, Ur = function() {
|
|
1285
|
+
var i = qr();
|
|
1286
|
+
return G(i);
|
|
1287
|
+
}, bi = {}, Gr = I;
|
|
1288
|
+
Object.defineProperty(bi, "__esModule", {
|
|
1289
|
+
value: !0
|
|
1290
|
+
});
|
|
1291
|
+
var oe = bi.default = void 0, Jr = Gr(x()), xr = J, Ir = (0, Jr.default)(/* @__PURE__ */ (0, xr.jsx)("path", {
|
|
1292
|
+
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
|
1293
|
+
}), "Add");
|
|
1294
|
+
oe = bi.default = Ir;
|
|
1295
|
+
var Si = {}, io = I;
|
|
1296
|
+
Object.defineProperty(Si, "__esModule", {
|
|
1297
|
+
value: !0
|
|
1298
|
+
});
|
|
1299
|
+
var ne = Si.default = void 0, eo = io(x()), ro = J, oo = (0, eo.default)(/* @__PURE__ */ (0, ro.jsx)("path", {
|
|
1300
|
+
d: "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
|
|
1301
|
+
}), "Refresh");
|
|
1302
|
+
ne = Si.default = oo;
|
|
1303
|
+
var wi = {}, no = I;
|
|
1304
|
+
Object.defineProperty(wi, "__esModule", {
|
|
1305
|
+
value: !0
|
|
1306
|
+
});
|
|
1307
|
+
var ae = wi.default = void 0, ao = no(x()), to = J, lo = (0, ao.default)(/* @__PURE__ */ (0, to.jsx)("path", {
|
|
1308
|
+
d: "M19 13H5v-2h14v2z"
|
|
1309
|
+
}), "Remove");
|
|
1310
|
+
ae = wi.default = lo;
|
|
1311
|
+
var Ci = {}, so = I;
|
|
1312
|
+
Object.defineProperty(Ci, "__esModule", {
|
|
1313
|
+
value: !0
|
|
1314
|
+
});
|
|
1315
|
+
var te = Ci.default = void 0, uo = so(x()), fo = J, vo = (0, uo.default)(/* @__PURE__ */ (0, fo.jsx)("path", {
|
|
1316
|
+
d: "m4 7.59 5-5c.78-.78 2.05-.78 2.83 0L20.24 11h-2.83L10.4 4 5.41 9H8v2H2V5h2v2.59zM20 19h2v-6h-6v2h2.59l-4.99 5-7.01-7H3.76l8.41 8.41c.78.78 2.05.78 2.83 0l5-5V19z"
|
|
1317
|
+
}), "ScreenRotationAlt");
|
|
1318
|
+
te = Ci.default = vo;
|
|
1319
|
+
const po = {
|
|
1320
|
+
position: "absolute",
|
|
1321
|
+
zIndex: 1,
|
|
1322
|
+
right: "2rem",
|
|
1323
|
+
bottom: "2rem",
|
|
1324
|
+
width: "fit-content",
|
|
1325
|
+
display: "flex",
|
|
1326
|
+
flexDirection: "column",
|
|
1327
|
+
justifyContent: "flex-end",
|
|
1328
|
+
backgroundColor: "#0F0E0E4D",
|
|
1329
|
+
borderRadius: "5rem"
|
|
1330
|
+
}, Mi = {
|
|
1331
|
+
backgroundColor: "#0000000D",
|
|
1332
|
+
height: "0.0625rem"
|
|
1333
|
+
}, K = {
|
|
1334
|
+
color: "white",
|
|
1335
|
+
"&:focus": {
|
|
1336
|
+
outline: "none"
|
|
1337
|
+
}
|
|
1338
|
+
}, mo = {
|
|
1339
|
+
...K,
|
|
1340
|
+
position: "absolute",
|
|
1341
|
+
zIndex: 1,
|
|
1342
|
+
right: "2rem",
|
|
1343
|
+
bottom: "10rem",
|
|
1344
|
+
background: "#0F0E0E4D",
|
|
1345
|
+
color: "white",
|
|
1346
|
+
padding: "0.55rem"
|
|
1347
|
+
}, Yo = ({
|
|
1348
|
+
controllerContainerProps: i,
|
|
1349
|
+
zoomInButtonProps: o,
|
|
1350
|
+
zoomOutButtonProps: e,
|
|
1351
|
+
resetTransformButtonProps: r,
|
|
1352
|
+
dividerProps: n,
|
|
1353
|
+
handleRotate: a,
|
|
1354
|
+
rotateButtonProps: t
|
|
1355
|
+
}) => {
|
|
1356
|
+
const { zoomIn: l, zoomOut: s, resetTransform: d } = Ur();
|
|
1357
|
+
function u() {
|
|
1358
|
+
l();
|
|
1359
|
+
}
|
|
1360
|
+
function f() {
|
|
1361
|
+
s();
|
|
1362
|
+
}
|
|
1363
|
+
function v() {
|
|
1364
|
+
d();
|
|
1365
|
+
}
|
|
1366
|
+
return /* @__PURE__ */ zi(Se, { children: [
|
|
1367
|
+
/* @__PURE__ */ C(H, { title: "Rotate", placement: "left", children: /* @__PURE__ */ C(
|
|
1368
|
+
V,
|
|
1369
|
+
{
|
|
1370
|
+
disableRipple: !0,
|
|
1371
|
+
disableFocusRipple: !0,
|
|
1372
|
+
"aria-label": "Rotate",
|
|
1373
|
+
onClick: a,
|
|
1374
|
+
sx: mo,
|
|
1375
|
+
...t,
|
|
1376
|
+
children: /* @__PURE__ */ C(te, {})
|
|
1377
|
+
}
|
|
1378
|
+
) }),
|
|
1379
|
+
/* @__PURE__ */ zi(
|
|
1380
|
+
Pe,
|
|
1381
|
+
{
|
|
1382
|
+
sx: po,
|
|
1383
|
+
...i,
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ C(H, { title: "Zoom In", placement: "left", children: /* @__PURE__ */ C(
|
|
1386
|
+
V,
|
|
1387
|
+
{
|
|
1388
|
+
disableRipple: !0,
|
|
1389
|
+
disableFocusRipple: !0,
|
|
1390
|
+
"aria-label": "Zoom In",
|
|
1391
|
+
onClick: u,
|
|
1392
|
+
sx: K,
|
|
1393
|
+
...o,
|
|
1394
|
+
children: /* @__PURE__ */ C(oe, {})
|
|
1395
|
+
}
|
|
1396
|
+
) }),
|
|
1397
|
+
/* @__PURE__ */ C(Xi, { sx: Mi, ...n }),
|
|
1398
|
+
/* @__PURE__ */ C(H, { title: "Zoom Out", placement: "left", children: /* @__PURE__ */ C(
|
|
1399
|
+
V,
|
|
1400
|
+
{
|
|
1401
|
+
disableFocusRipple: !0,
|
|
1402
|
+
disableRipple: !0,
|
|
1403
|
+
"aria-label": "Zoom Out",
|
|
1404
|
+
onClick: f,
|
|
1405
|
+
sx: K,
|
|
1406
|
+
...e,
|
|
1407
|
+
children: /* @__PURE__ */ C(ae, {})
|
|
1408
|
+
}
|
|
1409
|
+
) }),
|
|
1410
|
+
/* @__PURE__ */ C(Xi, { sx: Mi, ...n }),
|
|
1411
|
+
/* @__PURE__ */ C(H, { title: "Reset", placement: "left", children: /* @__PURE__ */ C(
|
|
1412
|
+
V,
|
|
1413
|
+
{
|
|
1414
|
+
disableFocusRipple: !0,
|
|
1415
|
+
disableRipple: !0,
|
|
1416
|
+
"aria-label": "Reset",
|
|
1417
|
+
onClick: v,
|
|
1418
|
+
sx: K,
|
|
1419
|
+
...r,
|
|
1420
|
+
children: /* @__PURE__ */ C(ne, {})
|
|
1421
|
+
}
|
|
1422
|
+
) })
|
|
1423
|
+
]
|
|
1424
|
+
}
|
|
1425
|
+
)
|
|
1426
|
+
] });
|
|
1427
|
+
};
|
|
1428
|
+
export {
|
|
1429
|
+
yo as T,
|
|
1430
|
+
Yo as Z,
|
|
1431
|
+
To as a
|
|
1432
|
+
};
|