quantum-component-library 0.0.1 → 1.0.0-alpha.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/README.md +115 -69
- package/dist/babel-vendor-BOM86iTb.js +221 -0
- package/dist/babel-vendor-cKvSpnBp.cjs +3 -0
- package/dist/components/activity-list/index.d.ts +19 -0
- package/dist/components/copy-activity-form/index.d.ts +30 -0
- package/dist/components/copy-activity-form/index.stories.d.ts +6 -0
- package/dist/components/copy-module-form/index.d.ts +30 -0
- package/dist/components/copy-module-form/index.stories.d.ts +6 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/module-form/index.d.ts +15 -0
- package/dist/components/parameter-edit-list/index.d.ts +13 -0
- package/dist/components/parameter-edit-select/index.d.ts +16 -0
- package/dist/components/test-filter-panel/index.d.ts +7 -0
- package/dist/components/ui/form/index.d.ts +4 -0
- package/dist/components/ui/form/label/index.d.ts +4 -0
- package/dist/components/ui/form/list-order-input/index.d.ts +14 -0
- package/dist/components/ui/form/radio-buttons/index.d.ts +16 -0
- package/dist/components/ui/form/range-slider-input/index.d.ts +17 -0
- package/dist/components/ui/index.d.ts +2 -1
- package/dist/components/ui/tag-group/index.d.ts +7 -0
- package/dist/components/upsert-activity-form/index.d.ts +18 -0
- package/dist/components/upsert-activity-form/index.stories.d.ts +6 -0
- package/dist/components/upsert-module-form/index.d.ts +17 -0
- package/dist/components/upsert-module-form/index.stories.d.ts +6 -0
- package/dist/components.cjs +13 -0
- package/dist/components.js +2078 -0
- package/dist/dnd-core-vendor-bgjKfDi6.cjs +1 -0
- package/dist/dnd-core-vendor-q7mfiuVu.js +750 -0
- package/dist/generated/fragment-masking.d.ts +19 -0
- package/dist/generated/gql.d.ts +271 -0
- package/dist/generated/graphql.d.ts +2326 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated-ChsGaiYd.cjs +1 -0
- package/dist/generated-GfcSQz21.js +65 -0
- package/dist/graphql/fragments/actions.d.ts +1 -0
- package/dist/graphql/fragments/analysis.d.ts +12 -0
- package/dist/graphql/fragments/groups.d.ts +1 -0
- package/dist/graphql/fragments/index.d.ts +6 -0
- package/dist/graphql/fragments/modules.d.ts +3 -0
- package/dist/graphql/fragments/playback.d.ts +11 -0
- package/dist/graphql/fragments/session.d.ts +3 -0
- package/dist/graphql/index.d.ts +3 -0
- package/dist/graphql/mutations/actions.d.ts +7 -0
- package/dist/graphql/mutations/index.d.ts +2 -0
- package/dist/graphql/mutations/modules.d.ts +13 -0
- package/dist/graphql/queries/actions.d.ts +19 -0
- package/dist/graphql/queries/groups.d.ts +9 -0
- package/dist/graphql/queries/index.d.ts +3 -0
- package/dist/graphql/queries/modules.d.ts +9 -0
- package/dist/graphql-CqPvuCvr.cjs +679 -0
- package/dist/graphql-DiUes2Np.js +735 -0
- package/dist/graphql-vendor-JsvuUrRs.cjs +14 -0
- package/dist/graphql-vendor-YnA_qhJA.js +669 -0
- package/dist/hooks.cjs +1 -0
- package/dist/hooks.js +84 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +132 -3159
- package/dist/lib/hooks/index.d.ts +7 -0
- package/dist/lib/hooks/use-graphql-client.d.ts +5 -0
- package/dist/lib/hooks/use-joints-for-limb-ids.d.ts +2 -0
- package/dist/lib/hooks/use-joints-for-sensor-locations.d.ts +2 -0
- package/dist/lib/hooks/use-limbs-for-sensor-locations.d.ts +2 -0
- package/dist/lib/hooks/use-part-options-for-joints.d.ts +3 -0
- package/dist/lib/hooks/use-part-options-for-limbs.d.ts +3 -0
- package/dist/lib/hooks/use-part-options-for-sensor-locations.d.ts +3 -0
- package/dist/lib/services/human.d.ts +69 -0
- package/dist/lib/services/index.d.ts +1 -0
- package/dist/lib/services/rom.json.d.ts +226 -0
- package/dist/lib/types/activity.d.ts +19 -0
- package/dist/lib/types/analysis.d.ts +115 -0
- package/dist/lib/types/athlete.d.ts +8 -0
- package/dist/lib/types/catalog.d.ts +35 -0
- package/dist/lib/types/error.d.ts +4 -0
- package/dist/lib/types/human-part.d.ts +23 -0
- package/dist/lib/types/human.d.ts +147 -0
- package/dist/lib/types/index.d.ts +14 -0
- package/dist/lib/types/parameters.d.ts +10 -0
- package/dist/lib/types/playback.d.ts +20 -0
- package/dist/lib/types/recording.d.ts +5 -0
- package/dist/lib/types/sensor-info.d.ts +105 -0
- package/dist/lib/types/threshold.d.ts +30 -0
- package/dist/lib/types/tracking.d.ts +82 -0
- package/dist/lib/types/upload.d.ts +28 -0
- package/dist/lib/utils/conversion.d.ts +27 -0
- package/dist/lib/utils/index.d.ts +6 -0
- package/dist/lib/utils/memo.d.ts +7 -0
- package/dist/lib/utils/parameters.d.ts +6 -0
- package/dist/lib/utils/text.d.ts +2 -0
- package/dist/lodash-vendor-D5A6v3mw.cjs +1 -0
- package/dist/lodash-vendor-Dz4vW7Gd.js +1120 -0
- package/dist/other-CmpBz5tg.js +15 -0
- package/dist/other-TR0ap-t4.cjs +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/quantum-library-provider.d.ts +8 -0
- package/dist/providers.cjs +1 -0
- package/dist/providers.js +11 -0
- package/dist/quantum-component-library.css +1 -0
- package/dist/react-dnd-vendor-BWqlt2EC.cjs +2 -0
- package/dist/react-dnd-vendor-BZs2igAJ.js +1375 -0
- package/dist/react-icons-vendor-D2s8zw9h.cjs +1 -0
- package/dist/react-icons-vendor-TETORdU9.js +119 -0
- package/dist/react-select-vendor-By3h6JjH.cjs +4 -0
- package/dist/react-select-vendor-eBH7yy3O.js +2801 -0
- package/dist/services.cjs +1 -0
- package/dist/services.js +810 -0
- package/dist/styled-components-vendor-Bvwhddj9.js +1154 -0
- package/dist/styled-components-vendor-D09ATioU.cjs +60 -0
- package/dist/types.cjs +1 -0
- package/dist/types.js +316 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.js +128 -0
- package/dist/vendor-BeqUcSbw.cjs +45 -0
- package/dist/vendor-DvX9OX-j.js +7876 -0
- package/package.json +118 -60
- package/dist/components/ui/button.d.ts +0 -10
- package/dist/index.css +0 -1
- package/dist/index.umd.cjs +0 -22
- package/dist/lib/utils.d.ts +0 -2
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
import { c as j } from "./vendor-DvX9OX-j.js";
|
|
2
|
+
import { i as s, b as M } from "./react-dnd-vendor-BZs2igAJ.js";
|
|
3
|
+
function H(t, e, r) {
|
|
4
|
+
return e.split(".").reduce(
|
|
5
|
+
(n, i) => n && n[i] ? n[i] : r || null,
|
|
6
|
+
t
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
function N(t, e) {
|
|
10
|
+
return t.filter(
|
|
11
|
+
(r) => r !== e
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
function U(t) {
|
|
15
|
+
return typeof t == "object";
|
|
16
|
+
}
|
|
17
|
+
function L(t, e) {
|
|
18
|
+
const r = /* @__PURE__ */ new Map(), n = (o) => {
|
|
19
|
+
r.set(o, r.has(o) ? r.get(o) + 1 : 1);
|
|
20
|
+
};
|
|
21
|
+
t.forEach(n), e.forEach(n);
|
|
22
|
+
const i = [];
|
|
23
|
+
return r.forEach((o, c) => {
|
|
24
|
+
o === 1 && i.push(c);
|
|
25
|
+
}), i;
|
|
26
|
+
}
|
|
27
|
+
function k(t, e) {
|
|
28
|
+
return t.filter(
|
|
29
|
+
(r) => e.indexOf(r) > -1
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const E = "dnd-core/INIT_COORDS", p = "dnd-core/BEGIN_DRAG", I = "dnd-core/PUBLISH_DRAG_SOURCE", h = "dnd-core/HOVER", y = "dnd-core/DROP", S = "dnd-core/END_DRAG";
|
|
33
|
+
function _(t, e) {
|
|
34
|
+
return {
|
|
35
|
+
type: E,
|
|
36
|
+
payload: {
|
|
37
|
+
sourceClientOffset: e || null,
|
|
38
|
+
clientOffset: t || null
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const V = {
|
|
43
|
+
type: E,
|
|
44
|
+
payload: {
|
|
45
|
+
clientOffset: null,
|
|
46
|
+
sourceClientOffset: null
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function B(t) {
|
|
50
|
+
return function(r = [], n = {
|
|
51
|
+
publishSource: !0
|
|
52
|
+
}) {
|
|
53
|
+
const { publishSource: i = !0, clientOffset: o, getSourceClientOffset: c } = n, u = t.getMonitor(), l = t.getRegistry();
|
|
54
|
+
t.dispatch(_(o)), q(r, u, l);
|
|
55
|
+
const f = W(r, u);
|
|
56
|
+
if (f == null) {
|
|
57
|
+
t.dispatch(V);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let b = null;
|
|
61
|
+
if (o) {
|
|
62
|
+
if (!c)
|
|
63
|
+
throw new Error("getSourceClientOffset must be defined");
|
|
64
|
+
F(c), b = c(f);
|
|
65
|
+
}
|
|
66
|
+
t.dispatch(_(o, b));
|
|
67
|
+
const D = l.getSource(f).beginDrag(u, f);
|
|
68
|
+
if (D == null)
|
|
69
|
+
return;
|
|
70
|
+
X(D), l.pinSource(f);
|
|
71
|
+
const $ = l.getSourceType(f);
|
|
72
|
+
return {
|
|
73
|
+
type: p,
|
|
74
|
+
payload: {
|
|
75
|
+
itemType: $,
|
|
76
|
+
item: D,
|
|
77
|
+
sourceId: f,
|
|
78
|
+
clientOffset: o || null,
|
|
79
|
+
sourceClientOffset: b || null,
|
|
80
|
+
isSourcePublic: !!i
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function q(t, e, r) {
|
|
86
|
+
s(!e.isDragging(), "Cannot call beginDrag while dragging."), t.forEach(function(n) {
|
|
87
|
+
s(r.getSource(n), "Expected sourceIds to be registered.");
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function F(t) {
|
|
91
|
+
s(typeof t == "function", "When clientOffset is provided, getSourceClientOffset must be a function.");
|
|
92
|
+
}
|
|
93
|
+
function X(t) {
|
|
94
|
+
s(U(t), "Item must be an object.");
|
|
95
|
+
}
|
|
96
|
+
function W(t, e) {
|
|
97
|
+
let r = null;
|
|
98
|
+
for (let n = t.length - 1; n >= 0; n--)
|
|
99
|
+
if (e.canDragSource(t[n])) {
|
|
100
|
+
r = t[n];
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return r;
|
|
104
|
+
}
|
|
105
|
+
function z(t, e, r) {
|
|
106
|
+
return e in t ? Object.defineProperty(t, e, {
|
|
107
|
+
value: r,
|
|
108
|
+
enumerable: !0,
|
|
109
|
+
configurable: !0,
|
|
110
|
+
writable: !0
|
|
111
|
+
}) : t[e] = r, t;
|
|
112
|
+
}
|
|
113
|
+
function J(t) {
|
|
114
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
115
|
+
var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
|
|
116
|
+
typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
|
|
117
|
+
return Object.getOwnPropertyDescriptor(r, i).enumerable;
|
|
118
|
+
}))), n.forEach(function(i) {
|
|
119
|
+
z(t, i, r[i]);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return t;
|
|
123
|
+
}
|
|
124
|
+
function Q(t) {
|
|
125
|
+
return function(r = {}) {
|
|
126
|
+
const n = t.getMonitor(), i = t.getRegistry();
|
|
127
|
+
Y(n), ee(n).forEach((c, u) => {
|
|
128
|
+
const l = Z(c, u, i, n), f = {
|
|
129
|
+
type: y,
|
|
130
|
+
payload: {
|
|
131
|
+
dropResult: J({}, r, l)
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
t.dispatch(f);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function Y(t) {
|
|
139
|
+
s(t.isDragging(), "Cannot call drop while not dragging."), s(!t.didDrop(), "Cannot call drop twice during one drag operation.");
|
|
140
|
+
}
|
|
141
|
+
function Z(t, e, r, n) {
|
|
142
|
+
const i = r.getTarget(t);
|
|
143
|
+
let o = i ? i.drop(n, t) : void 0;
|
|
144
|
+
return K(o), typeof o > "u" && (o = e === 0 ? {} : n.getDropResult()), o;
|
|
145
|
+
}
|
|
146
|
+
function K(t) {
|
|
147
|
+
s(typeof t > "u" || U(t), "Drop result must either be an object or undefined.");
|
|
148
|
+
}
|
|
149
|
+
function ee(t) {
|
|
150
|
+
const e = t.getTargetIds().filter(t.canDropOnTarget, t);
|
|
151
|
+
return e.reverse(), e;
|
|
152
|
+
}
|
|
153
|
+
function te(t) {
|
|
154
|
+
return function() {
|
|
155
|
+
const r = t.getMonitor(), n = t.getRegistry();
|
|
156
|
+
re(r);
|
|
157
|
+
const i = r.getSourceId();
|
|
158
|
+
return i != null && (n.getSource(i, !0).endDrag(r, i), n.unpinSource()), {
|
|
159
|
+
type: S
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function re(t) {
|
|
164
|
+
s(t.isDragging(), "Cannot call endDrag while not dragging.");
|
|
165
|
+
}
|
|
166
|
+
function T(t, e) {
|
|
167
|
+
return e === null ? t === null : Array.isArray(t) ? t.some(
|
|
168
|
+
(r) => r === e
|
|
169
|
+
) : t === e;
|
|
170
|
+
}
|
|
171
|
+
function ne(t) {
|
|
172
|
+
return function(r, { clientOffset: n } = {}) {
|
|
173
|
+
ie(r);
|
|
174
|
+
const i = r.slice(0), o = t.getMonitor(), c = t.getRegistry(), u = o.getItemType();
|
|
175
|
+
return se(i, c, u), oe(i, o, c), ce(i, o, c), {
|
|
176
|
+
type: h,
|
|
177
|
+
payload: {
|
|
178
|
+
targetIds: i,
|
|
179
|
+
clientOffset: n || null
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function ie(t) {
|
|
185
|
+
s(Array.isArray(t), "Expected targetIds to be an array.");
|
|
186
|
+
}
|
|
187
|
+
function oe(t, e, r) {
|
|
188
|
+
s(e.isDragging(), "Cannot call hover while not dragging."), s(!e.didDrop(), "Cannot call hover after drop.");
|
|
189
|
+
for (let n = 0; n < t.length; n++) {
|
|
190
|
+
const i = t[n];
|
|
191
|
+
s(t.lastIndexOf(i) === n, "Expected targetIds to be unique in the passed array.");
|
|
192
|
+
const o = r.getTarget(i);
|
|
193
|
+
s(o, "Expected targetIds to be registered.");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function se(t, e, r) {
|
|
197
|
+
for (let n = t.length - 1; n >= 0; n--) {
|
|
198
|
+
const i = t[n], o = e.getTargetType(i);
|
|
199
|
+
T(o, r) || t.splice(n, 1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function ce(t, e, r) {
|
|
203
|
+
t.forEach(function(n) {
|
|
204
|
+
r.getTarget(n).hover(e, n);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function ue(t) {
|
|
208
|
+
return function() {
|
|
209
|
+
if (t.getMonitor().isDragging())
|
|
210
|
+
return {
|
|
211
|
+
type: I
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function ae(t) {
|
|
216
|
+
return {
|
|
217
|
+
beginDrag: B(t),
|
|
218
|
+
publishDragSource: ue(t),
|
|
219
|
+
hover: ne(t),
|
|
220
|
+
drop: Q(t),
|
|
221
|
+
endDrag: te(t)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
class fe {
|
|
225
|
+
receiveBackend(e) {
|
|
226
|
+
this.backend = e;
|
|
227
|
+
}
|
|
228
|
+
getMonitor() {
|
|
229
|
+
return this.monitor;
|
|
230
|
+
}
|
|
231
|
+
getBackend() {
|
|
232
|
+
return this.backend;
|
|
233
|
+
}
|
|
234
|
+
getRegistry() {
|
|
235
|
+
return this.monitor.registry;
|
|
236
|
+
}
|
|
237
|
+
getActions() {
|
|
238
|
+
const e = this, { dispatch: r } = this.store;
|
|
239
|
+
function n(o) {
|
|
240
|
+
return (...c) => {
|
|
241
|
+
const u = o.apply(e, c);
|
|
242
|
+
typeof u < "u" && r(u);
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
const i = ae(this);
|
|
246
|
+
return Object.keys(i).reduce((o, c) => {
|
|
247
|
+
const u = i[c];
|
|
248
|
+
return o[c] = n(u), o;
|
|
249
|
+
}, {});
|
|
250
|
+
}
|
|
251
|
+
dispatch(e) {
|
|
252
|
+
this.store.dispatch(e);
|
|
253
|
+
}
|
|
254
|
+
constructor(e, r) {
|
|
255
|
+
this.isSetUp = !1, this.handleRefCountChange = () => {
|
|
256
|
+
const n = this.store.getState().refCount > 0;
|
|
257
|
+
this.backend && (n && !this.isSetUp ? (this.backend.setup(), this.isSetUp = !0) : !n && this.isSetUp && (this.backend.teardown(), this.isSetUp = !1));
|
|
258
|
+
}, this.store = e, this.monitor = r, e.subscribe(this.handleRefCountChange);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function le(t, e) {
|
|
262
|
+
return {
|
|
263
|
+
x: t.x + e.x,
|
|
264
|
+
y: t.y + e.y
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function G(t, e) {
|
|
268
|
+
return {
|
|
269
|
+
x: t.x - e.x,
|
|
270
|
+
y: t.y - e.y
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function de(t) {
|
|
274
|
+
const { clientOffset: e, initialClientOffset: r, initialSourceClientOffset: n } = t;
|
|
275
|
+
return !e || !r || !n ? null : G(le(e, n), r);
|
|
276
|
+
}
|
|
277
|
+
function ge(t) {
|
|
278
|
+
const { clientOffset: e, initialClientOffset: r } = t;
|
|
279
|
+
return !e || !r ? null : G(e, r);
|
|
280
|
+
}
|
|
281
|
+
const g = [], C = [];
|
|
282
|
+
g.__IS_NONE__ = !0;
|
|
283
|
+
C.__IS_ALL__ = !0;
|
|
284
|
+
function pe(t, e) {
|
|
285
|
+
return t === g ? !1 : t === C || typeof e > "u" ? !0 : k(e, t).length > 0;
|
|
286
|
+
}
|
|
287
|
+
class he {
|
|
288
|
+
subscribeToStateChange(e, r = {}) {
|
|
289
|
+
const { handlerIds: n } = r;
|
|
290
|
+
s(typeof e == "function", "listener must be a function."), s(typeof n > "u" || Array.isArray(n), "handlerIds, when specified, must be an array of strings.");
|
|
291
|
+
let i = this.store.getState().stateId;
|
|
292
|
+
const o = () => {
|
|
293
|
+
const c = this.store.getState(), u = c.stateId;
|
|
294
|
+
try {
|
|
295
|
+
u === i || u === i + 1 && !pe(c.dirtyHandlerIds, n) || e();
|
|
296
|
+
} finally {
|
|
297
|
+
i = u;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
return this.store.subscribe(o);
|
|
301
|
+
}
|
|
302
|
+
subscribeToOffsetChange(e) {
|
|
303
|
+
s(typeof e == "function", "listener must be a function.");
|
|
304
|
+
let r = this.store.getState().dragOffset;
|
|
305
|
+
const n = () => {
|
|
306
|
+
const i = this.store.getState().dragOffset;
|
|
307
|
+
i !== r && (r = i, e());
|
|
308
|
+
};
|
|
309
|
+
return this.store.subscribe(n);
|
|
310
|
+
}
|
|
311
|
+
canDragSource(e) {
|
|
312
|
+
if (!e)
|
|
313
|
+
return !1;
|
|
314
|
+
const r = this.registry.getSource(e);
|
|
315
|
+
return s(r, `Expected to find a valid source. sourceId=${e}`), this.isDragging() ? !1 : r.canDrag(this, e);
|
|
316
|
+
}
|
|
317
|
+
canDropOnTarget(e) {
|
|
318
|
+
if (!e)
|
|
319
|
+
return !1;
|
|
320
|
+
const r = this.registry.getTarget(e);
|
|
321
|
+
if (s(r, `Expected to find a valid target. targetId=${e}`), !this.isDragging() || this.didDrop())
|
|
322
|
+
return !1;
|
|
323
|
+
const n = this.registry.getTargetType(e), i = this.getItemType();
|
|
324
|
+
return T(n, i) && r.canDrop(this, e);
|
|
325
|
+
}
|
|
326
|
+
isDragging() {
|
|
327
|
+
return !!this.getItemType();
|
|
328
|
+
}
|
|
329
|
+
isDraggingSource(e) {
|
|
330
|
+
if (!e)
|
|
331
|
+
return !1;
|
|
332
|
+
const r = this.registry.getSource(e, !0);
|
|
333
|
+
if (s(r, `Expected to find a valid source. sourceId=${e}`), !this.isDragging() || !this.isSourcePublic())
|
|
334
|
+
return !1;
|
|
335
|
+
const n = this.registry.getSourceType(e), i = this.getItemType();
|
|
336
|
+
return n !== i ? !1 : r.isDragging(this, e);
|
|
337
|
+
}
|
|
338
|
+
isOverTarget(e, r = {
|
|
339
|
+
shallow: !1
|
|
340
|
+
}) {
|
|
341
|
+
if (!e)
|
|
342
|
+
return !1;
|
|
343
|
+
const { shallow: n } = r;
|
|
344
|
+
if (!this.isDragging())
|
|
345
|
+
return !1;
|
|
346
|
+
const i = this.registry.getTargetType(e), o = this.getItemType();
|
|
347
|
+
if (o && !T(i, o))
|
|
348
|
+
return !1;
|
|
349
|
+
const c = this.getTargetIds();
|
|
350
|
+
if (!c.length)
|
|
351
|
+
return !1;
|
|
352
|
+
const u = c.indexOf(e);
|
|
353
|
+
return n ? u === c.length - 1 : u > -1;
|
|
354
|
+
}
|
|
355
|
+
getItemType() {
|
|
356
|
+
return this.store.getState().dragOperation.itemType;
|
|
357
|
+
}
|
|
358
|
+
getItem() {
|
|
359
|
+
return this.store.getState().dragOperation.item;
|
|
360
|
+
}
|
|
361
|
+
getSourceId() {
|
|
362
|
+
return this.store.getState().dragOperation.sourceId;
|
|
363
|
+
}
|
|
364
|
+
getTargetIds() {
|
|
365
|
+
return this.store.getState().dragOperation.targetIds;
|
|
366
|
+
}
|
|
367
|
+
getDropResult() {
|
|
368
|
+
return this.store.getState().dragOperation.dropResult;
|
|
369
|
+
}
|
|
370
|
+
didDrop() {
|
|
371
|
+
return this.store.getState().dragOperation.didDrop;
|
|
372
|
+
}
|
|
373
|
+
isSourcePublic() {
|
|
374
|
+
return !!this.store.getState().dragOperation.isSourcePublic;
|
|
375
|
+
}
|
|
376
|
+
getInitialClientOffset() {
|
|
377
|
+
return this.store.getState().dragOffset.initialClientOffset;
|
|
378
|
+
}
|
|
379
|
+
getInitialSourceClientOffset() {
|
|
380
|
+
return this.store.getState().dragOffset.initialSourceClientOffset;
|
|
381
|
+
}
|
|
382
|
+
getClientOffset() {
|
|
383
|
+
return this.store.getState().dragOffset.clientOffset;
|
|
384
|
+
}
|
|
385
|
+
getSourceClientOffset() {
|
|
386
|
+
return de(this.store.getState().dragOffset);
|
|
387
|
+
}
|
|
388
|
+
getDifferenceFromInitialOffset() {
|
|
389
|
+
return ge(this.store.getState().dragOffset);
|
|
390
|
+
}
|
|
391
|
+
constructor(e, r) {
|
|
392
|
+
this.store = e, this.registry = r;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
const R = "dnd-core/ADD_SOURCE", v = "dnd-core/ADD_TARGET", x = "dnd-core/REMOVE_SOURCE", O = "dnd-core/REMOVE_TARGET";
|
|
396
|
+
function ye(t) {
|
|
397
|
+
return {
|
|
398
|
+
type: R,
|
|
399
|
+
payload: {
|
|
400
|
+
sourceId: t
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function Se(t) {
|
|
405
|
+
return {
|
|
406
|
+
type: v,
|
|
407
|
+
payload: {
|
|
408
|
+
targetId: t
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function Oe(t) {
|
|
413
|
+
return {
|
|
414
|
+
type: x,
|
|
415
|
+
payload: {
|
|
416
|
+
sourceId: t
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function be(t) {
|
|
421
|
+
return {
|
|
422
|
+
type: O,
|
|
423
|
+
payload: {
|
|
424
|
+
targetId: t
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function De(t) {
|
|
429
|
+
s(typeof t.canDrag == "function", "Expected canDrag to be a function."), s(typeof t.beginDrag == "function", "Expected beginDrag to be a function."), s(typeof t.endDrag == "function", "Expected endDrag to be a function.");
|
|
430
|
+
}
|
|
431
|
+
function Te(t) {
|
|
432
|
+
s(typeof t.canDrop == "function", "Expected canDrop to be a function."), s(typeof t.hover == "function", "Expected hover to be a function."), s(typeof t.drop == "function", "Expected beginDrag to be a function.");
|
|
433
|
+
}
|
|
434
|
+
function m(t, e) {
|
|
435
|
+
if (e && Array.isArray(t)) {
|
|
436
|
+
t.forEach(
|
|
437
|
+
(r) => m(r, !1)
|
|
438
|
+
);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
s(typeof t == "string" || typeof t == "symbol", e ? "Type can only be a string, a symbol, or an array of either." : "Type can only be a string or a symbol.");
|
|
442
|
+
}
|
|
443
|
+
var a;
|
|
444
|
+
(function(t) {
|
|
445
|
+
t.SOURCE = "SOURCE", t.TARGET = "TARGET";
|
|
446
|
+
})(a || (a = {}));
|
|
447
|
+
let me = 0;
|
|
448
|
+
function Ee() {
|
|
449
|
+
return me++;
|
|
450
|
+
}
|
|
451
|
+
function Ie(t) {
|
|
452
|
+
const e = Ee().toString();
|
|
453
|
+
switch (t) {
|
|
454
|
+
case a.SOURCE:
|
|
455
|
+
return `S${e}`;
|
|
456
|
+
case a.TARGET:
|
|
457
|
+
return `T${e}`;
|
|
458
|
+
default:
|
|
459
|
+
throw new Error(`Unknown Handler Role: ${t}`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function w(t) {
|
|
463
|
+
switch (t[0]) {
|
|
464
|
+
case "S":
|
|
465
|
+
return a.SOURCE;
|
|
466
|
+
case "T":
|
|
467
|
+
return a.TARGET;
|
|
468
|
+
default:
|
|
469
|
+
throw new Error(`Cannot parse handler ID: ${t}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function P(t, e) {
|
|
473
|
+
const r = t.entries();
|
|
474
|
+
let n = !1;
|
|
475
|
+
do {
|
|
476
|
+
const { done: i, value: [, o] } = r.next();
|
|
477
|
+
if (o === e)
|
|
478
|
+
return !0;
|
|
479
|
+
n = !!i;
|
|
480
|
+
} while (!n);
|
|
481
|
+
return !1;
|
|
482
|
+
}
|
|
483
|
+
class Ce {
|
|
484
|
+
addSource(e, r) {
|
|
485
|
+
m(e), De(r);
|
|
486
|
+
const n = this.addHandler(a.SOURCE, e, r);
|
|
487
|
+
return this.store.dispatch(ye(n)), n;
|
|
488
|
+
}
|
|
489
|
+
addTarget(e, r) {
|
|
490
|
+
m(e, !0), Te(r);
|
|
491
|
+
const n = this.addHandler(a.TARGET, e, r);
|
|
492
|
+
return this.store.dispatch(Se(n)), n;
|
|
493
|
+
}
|
|
494
|
+
containsHandler(e) {
|
|
495
|
+
return P(this.dragSources, e) || P(this.dropTargets, e);
|
|
496
|
+
}
|
|
497
|
+
getSource(e, r = !1) {
|
|
498
|
+
return s(this.isSourceId(e), "Expected a valid source ID."), r && e === this.pinnedSourceId ? this.pinnedSource : this.dragSources.get(e);
|
|
499
|
+
}
|
|
500
|
+
getTarget(e) {
|
|
501
|
+
return s(this.isTargetId(e), "Expected a valid target ID."), this.dropTargets.get(e);
|
|
502
|
+
}
|
|
503
|
+
getSourceType(e) {
|
|
504
|
+
return s(this.isSourceId(e), "Expected a valid source ID."), this.types.get(e);
|
|
505
|
+
}
|
|
506
|
+
getTargetType(e) {
|
|
507
|
+
return s(this.isTargetId(e), "Expected a valid target ID."), this.types.get(e);
|
|
508
|
+
}
|
|
509
|
+
isSourceId(e) {
|
|
510
|
+
return w(e) === a.SOURCE;
|
|
511
|
+
}
|
|
512
|
+
isTargetId(e) {
|
|
513
|
+
return w(e) === a.TARGET;
|
|
514
|
+
}
|
|
515
|
+
removeSource(e) {
|
|
516
|
+
s(this.getSource(e), "Expected an existing source."), this.store.dispatch(Oe(e)), M(() => {
|
|
517
|
+
this.dragSources.delete(e), this.types.delete(e);
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
removeTarget(e) {
|
|
521
|
+
s(this.getTarget(e), "Expected an existing target."), this.store.dispatch(be(e)), this.dropTargets.delete(e), this.types.delete(e);
|
|
522
|
+
}
|
|
523
|
+
pinSource(e) {
|
|
524
|
+
const r = this.getSource(e);
|
|
525
|
+
s(r, "Expected an existing source."), this.pinnedSourceId = e, this.pinnedSource = r;
|
|
526
|
+
}
|
|
527
|
+
unpinSource() {
|
|
528
|
+
s(this.pinnedSource, "No source is pinned at the time."), this.pinnedSourceId = null, this.pinnedSource = null;
|
|
529
|
+
}
|
|
530
|
+
addHandler(e, r, n) {
|
|
531
|
+
const i = Ie(e);
|
|
532
|
+
return this.types.set(i, r), e === a.SOURCE ? this.dragSources.set(i, n) : e === a.TARGET && this.dropTargets.set(i, n), i;
|
|
533
|
+
}
|
|
534
|
+
constructor(e) {
|
|
535
|
+
this.types = /* @__PURE__ */ new Map(), this.dragSources = /* @__PURE__ */ new Map(), this.dropTargets = /* @__PURE__ */ new Map(), this.pinnedSourceId = null, this.pinnedSource = null, this.store = e;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const Re = (t, e) => t === e;
|
|
539
|
+
function ve(t, e) {
|
|
540
|
+
return !t && !e ? !0 : !t || !e ? !1 : t.x === e.x && t.y === e.y;
|
|
541
|
+
}
|
|
542
|
+
function xe(t, e, r = Re) {
|
|
543
|
+
if (t.length !== e.length)
|
|
544
|
+
return !1;
|
|
545
|
+
for (let n = 0; n < t.length; ++n)
|
|
546
|
+
if (!r(t[n], e[n]))
|
|
547
|
+
return !1;
|
|
548
|
+
return !0;
|
|
549
|
+
}
|
|
550
|
+
function _e(t = g, e) {
|
|
551
|
+
switch (e.type) {
|
|
552
|
+
case h:
|
|
553
|
+
break;
|
|
554
|
+
case R:
|
|
555
|
+
case v:
|
|
556
|
+
case O:
|
|
557
|
+
case x:
|
|
558
|
+
return g;
|
|
559
|
+
case p:
|
|
560
|
+
case I:
|
|
561
|
+
case S:
|
|
562
|
+
case y:
|
|
563
|
+
default:
|
|
564
|
+
return C;
|
|
565
|
+
}
|
|
566
|
+
const { targetIds: r = [], prevTargetIds: n = [] } = e.payload, i = L(r, n);
|
|
567
|
+
if (!(i.length > 0 || !xe(r, n)))
|
|
568
|
+
return g;
|
|
569
|
+
const c = n[n.length - 1], u = r[r.length - 1];
|
|
570
|
+
return c !== u && (c && i.push(c), u && i.push(u)), i;
|
|
571
|
+
}
|
|
572
|
+
function we(t, e, r) {
|
|
573
|
+
return e in t ? Object.defineProperty(t, e, {
|
|
574
|
+
value: r,
|
|
575
|
+
enumerable: !0,
|
|
576
|
+
configurable: !0,
|
|
577
|
+
writable: !0
|
|
578
|
+
}) : t[e] = r, t;
|
|
579
|
+
}
|
|
580
|
+
function Pe(t) {
|
|
581
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
582
|
+
var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
|
|
583
|
+
typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
|
|
584
|
+
return Object.getOwnPropertyDescriptor(r, i).enumerable;
|
|
585
|
+
}))), n.forEach(function(i) {
|
|
586
|
+
we(t, i, r[i]);
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
return t;
|
|
590
|
+
}
|
|
591
|
+
const A = {
|
|
592
|
+
initialSourceClientOffset: null,
|
|
593
|
+
initialClientOffset: null,
|
|
594
|
+
clientOffset: null
|
|
595
|
+
};
|
|
596
|
+
function Ae(t = A, e) {
|
|
597
|
+
const { payload: r } = e;
|
|
598
|
+
switch (e.type) {
|
|
599
|
+
case E:
|
|
600
|
+
case p:
|
|
601
|
+
return {
|
|
602
|
+
initialSourceClientOffset: r.sourceClientOffset,
|
|
603
|
+
initialClientOffset: r.clientOffset,
|
|
604
|
+
clientOffset: r.clientOffset
|
|
605
|
+
};
|
|
606
|
+
case h:
|
|
607
|
+
return ve(t.clientOffset, r.clientOffset) ? t : Pe({}, t, {
|
|
608
|
+
clientOffset: r.clientOffset
|
|
609
|
+
});
|
|
610
|
+
case S:
|
|
611
|
+
case y:
|
|
612
|
+
return A;
|
|
613
|
+
default:
|
|
614
|
+
return t;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function Ue(t, e, r) {
|
|
618
|
+
return e in t ? Object.defineProperty(t, e, {
|
|
619
|
+
value: r,
|
|
620
|
+
enumerable: !0,
|
|
621
|
+
configurable: !0,
|
|
622
|
+
writable: !0
|
|
623
|
+
}) : t[e] = r, t;
|
|
624
|
+
}
|
|
625
|
+
function d(t) {
|
|
626
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
627
|
+
var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
|
|
628
|
+
typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
|
|
629
|
+
return Object.getOwnPropertyDescriptor(r, i).enumerable;
|
|
630
|
+
}))), n.forEach(function(i) {
|
|
631
|
+
Ue(t, i, r[i]);
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
return t;
|
|
635
|
+
}
|
|
636
|
+
const Ge = {
|
|
637
|
+
itemType: null,
|
|
638
|
+
item: null,
|
|
639
|
+
sourceId: null,
|
|
640
|
+
targetIds: [],
|
|
641
|
+
dropResult: null,
|
|
642
|
+
didDrop: !1,
|
|
643
|
+
isSourcePublic: null
|
|
644
|
+
};
|
|
645
|
+
function $e(t = Ge, e) {
|
|
646
|
+
const { payload: r } = e;
|
|
647
|
+
switch (e.type) {
|
|
648
|
+
case p:
|
|
649
|
+
return d({}, t, {
|
|
650
|
+
itemType: r.itemType,
|
|
651
|
+
item: r.item,
|
|
652
|
+
sourceId: r.sourceId,
|
|
653
|
+
isSourcePublic: r.isSourcePublic,
|
|
654
|
+
dropResult: null,
|
|
655
|
+
didDrop: !1
|
|
656
|
+
});
|
|
657
|
+
case I:
|
|
658
|
+
return d({}, t, {
|
|
659
|
+
isSourcePublic: !0
|
|
660
|
+
});
|
|
661
|
+
case h:
|
|
662
|
+
return d({}, t, {
|
|
663
|
+
targetIds: r.targetIds
|
|
664
|
+
});
|
|
665
|
+
case O:
|
|
666
|
+
return t.targetIds.indexOf(r.targetId) === -1 ? t : d({}, t, {
|
|
667
|
+
targetIds: N(t.targetIds, r.targetId)
|
|
668
|
+
});
|
|
669
|
+
case y:
|
|
670
|
+
return d({}, t, {
|
|
671
|
+
dropResult: r.dropResult,
|
|
672
|
+
didDrop: !0,
|
|
673
|
+
targetIds: []
|
|
674
|
+
});
|
|
675
|
+
case S:
|
|
676
|
+
return d({}, t, {
|
|
677
|
+
itemType: null,
|
|
678
|
+
item: null,
|
|
679
|
+
sourceId: null,
|
|
680
|
+
dropResult: null,
|
|
681
|
+
didDrop: !1,
|
|
682
|
+
isSourcePublic: null,
|
|
683
|
+
targetIds: []
|
|
684
|
+
});
|
|
685
|
+
default:
|
|
686
|
+
return t;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
function je(t = 0, e) {
|
|
690
|
+
switch (e.type) {
|
|
691
|
+
case R:
|
|
692
|
+
case v:
|
|
693
|
+
return t + 1;
|
|
694
|
+
case x:
|
|
695
|
+
case O:
|
|
696
|
+
return t - 1;
|
|
697
|
+
default:
|
|
698
|
+
return t;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
function Me(t = 0) {
|
|
702
|
+
return t + 1;
|
|
703
|
+
}
|
|
704
|
+
function He(t, e, r) {
|
|
705
|
+
return e in t ? Object.defineProperty(t, e, {
|
|
706
|
+
value: r,
|
|
707
|
+
enumerable: !0,
|
|
708
|
+
configurable: !0,
|
|
709
|
+
writable: !0
|
|
710
|
+
}) : t[e] = r, t;
|
|
711
|
+
}
|
|
712
|
+
function Ne(t) {
|
|
713
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
714
|
+
var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
|
|
715
|
+
typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
|
|
716
|
+
return Object.getOwnPropertyDescriptor(r, i).enumerable;
|
|
717
|
+
}))), n.forEach(function(i) {
|
|
718
|
+
He(t, i, r[i]);
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
return t;
|
|
722
|
+
}
|
|
723
|
+
function Le(t = {}, e) {
|
|
724
|
+
return {
|
|
725
|
+
dirtyHandlerIds: _e(t.dirtyHandlerIds, {
|
|
726
|
+
type: e.type,
|
|
727
|
+
payload: Ne({}, e.payload, {
|
|
728
|
+
prevTargetIds: H(t, "dragOperation.targetIds", [])
|
|
729
|
+
})
|
|
730
|
+
}),
|
|
731
|
+
dragOffset: Ae(t.dragOffset, e),
|
|
732
|
+
refCount: je(t.refCount, e),
|
|
733
|
+
dragOperation: $e(t.dragOperation, e),
|
|
734
|
+
stateId: Me(t.stateId)
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function Fe(t, e = void 0, r = {}, n = !1) {
|
|
738
|
+
const i = ke(n), o = new he(i, new Ce(i)), c = new fe(i, o), u = t(c, e, r);
|
|
739
|
+
return c.receiveBackend(u), c;
|
|
740
|
+
}
|
|
741
|
+
function ke(t) {
|
|
742
|
+
const e = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
743
|
+
return j(Le, t && e && e({
|
|
744
|
+
name: "dnd-core",
|
|
745
|
+
instanceId: "dnd-core"
|
|
746
|
+
}));
|
|
747
|
+
}
|
|
748
|
+
export {
|
|
749
|
+
Fe as c
|
|
750
|
+
};
|