quantum-component-library 1.4.45-qa.2 → 1.4.45-qa.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/components.cjs +1 -1
- package/dist/components.js +13 -13
- package/dist/{dnd-core-vendor-DqnJnuNT.cjs → dnd-core-vendor-DFyhudg3.cjs} +1 -1
- package/dist/{dnd-core-vendor-D0LYcGmm.js → dnd-core-vendor-GeFJIrqw.js} +2 -2
- package/dist/framer-motion-vendor-BpR8WNZk.js +2945 -0
- package/dist/framer-motion-vendor-DmZv69_a.cjs +9 -0
- package/dist/{graphql-DiUes2Np.js → graphql-DZp5ePcc.js} +6 -6
- package/dist/graphql-vendor-Bp1AYkpN.cjs +19 -0
- package/dist/graphql-vendor-D5ETG7wB.js +1285 -0
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +11 -12
- package/dist/providers.cjs +1 -1
- package/dist/providers.js +5 -5
- package/dist/{react-dnd-vendor-DyqEbdFL.cjs → react-dnd-vendor-CQ6n_Iry.cjs} +1 -1
- package/dist/{react-dnd-vendor-DYGSQgr6.js → react-dnd-vendor-bl4guadi.js} +11 -11
- package/dist/{react-select-vendor-B1OQPh8Y.js → react-select-vendor-CM41In8Q.js} +2 -2
- package/dist/{react-select-vendor-Dcon15oq.cjs → react-select-vendor-qYWfPIoq.cjs} +1 -1
- package/dist/services.cjs +1 -1
- package/dist/services.js +1 -1
- package/dist/ui-vendor-CDpwLSe-.cjs +294 -0
- package/dist/{ui-vendor-C8K-cPdW.js → ui-vendor-CTkR2JkD.js} +34 -33
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/vendor-D0fSwmdY.cjs +90 -0
- package/dist/vendor-DxZbxm3m.js +13085 -0
- package/package.json +4 -4
- package/dist/graphql-vendor-CPuTFvxJ.cjs +0 -14
- package/dist/graphql-vendor-Dj6F1QIU.js +0 -669
- package/dist/ui-vendor-D_H9hnvk.cjs +0 -294
- package/dist/vendor-DIPzo8rL.js +0 -15069
- package/dist/vendor-Dmlu4NZO.cjs +0 -90
package/dist/components.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./vendor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./vendor-D0fSwmdY.cjs"),o=require("react"),xe=require("./styled-components-vendor-D09ATioU.cjs"),H=require("./react-select-vendor-qYWfPIoq.cjs"),de=require("./react-icons-vendor-D2s8zw9h.cjs"),t=require("./ui-vendor-CDpwLSe-.cjs"),G=require("./graphql-vendor-Bp1AYkpN.cjs"),R=require("./generated-ChsGaiYd.cjs"),w=require("./graphql-CqPvuCvr.cjs"),oe=require("./react-dnd-vendor-CQ6n_Iry.cjs"),V=require("./services.cjs"),J=require("./types.cjs"),X=require("./utils.cjs"),Re=require("./hooks.cjs"),fe=({setSearch:n,actions:s,updateUseCases:a})=>{const m=o.useMemo(()=>s?.flatMap(c=>c.useCases).filter((c,u,h)=>h.findIndex(f=>f.id===c.id)===u).map(c=>({label:c.name,value:c.id}))||[],[s]);return e.jsxRuntimeExports.jsxs(t.Flex,{width:"100%",alignContent:"space-evenly",gap:4,children:[e.jsxRuntimeExports.jsxs(t.InputGroup,{size:"md",children:[e.jsxRuntimeExports.jsx(t.InputLeftElement,{children:e.jsxRuntimeExports.jsx(t.Icon,{as:de.FaSearch,color:"gray.300"})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"Search by name...",maxW:"30rem",onChange:c=>n(c.target.value)})]}),e.jsxRuntimeExports.jsx(t.InputGroup,{size:"md",children:e.jsxRuntimeExports.jsx(H.st,{size:"md",chakraStyles:{container:c=>({...c,width:"100%"})},menuPortalTarget:document.body,placeholder:"Filter use case",isMulti:!0,options:m,onChange:c=>a(c.map(u=>u.value))})})]})},Y=({children:n})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:n}),be=({value:n,onChange:s})=>{const a=o.useState(()=>Math.random().toString(36).substring(2,15))[0],m=o.useCallback((c,u)=>{s(h=>{const f=[...h],[b]=f.splice(c,1);return f.splice(u,0,b),f})},[s]);return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsx(oe.DndProvider,{backend:oe.HTML5Backend,children:e.jsxRuntimeExports.jsx(t.TableContainer,{children:e.jsxRuntimeExports.jsxs(t.Table,{variant:"simple",size:"md",children:[e.jsxRuntimeExports.jsx(t.Thead,{children:e.jsxRuntimeExports.jsxs(t.Tr,{children:[e.jsxRuntimeExports.jsx(t.Th,{children:"Order"}),e.jsxRuntimeExports.jsx(t.Th,{children:"Name"})]})}),e.jsxRuntimeExports.jsx(t.Tbody,{children:n.map((c,u)=>e.jsxRuntimeExports.jsx(Ce,{listKey:a,index:u,id:c.id,name:c.name,move:m},c.id))})]})})})})},Ce=({listKey:n,index:s,id:a,name:m,move:c})=>{const u=o.useRef(null),[{handlerId:h},f]=oe.useDrop({accept:n,collect:E=>({handlerId:E.getHandlerId()?.toString()??""}),hover:(E,A)=>{if(!u.current)return;const d=E.index,l=s;if(d===l)return;const T=u.current?.getBoundingClientRect(),C=(T.bottom-T.top)/2,p=A.getClientOffset().y-T.top;d<l&&p<C||d>l&&p>C||(c(d,l),E.index=l)}}),[{isDragging:b},v]=oe.useDrag({type:n,item:()=>({id:a,index:s}),collect:E=>({isDragging:E.isDragging()})}),F=b?.6:1,g=b?"grabbing":"grab";return v(f(u)),e.jsxRuntimeExports.jsxs(t.Tr,{ref:u,style:{opacity:F,cursor:g},"data-handler-id":h,children:[e.jsxRuntimeExports.jsx(t.Td,{children:s+1}),e.jsxRuntimeExports.jsx(t.Td,{children:m})]})},le=({items:n,onChange:s,selectedItem:a,isDisabled:m,selectedProps:c,buttonProps:u})=>{const h=b=>b===a||b.value===a,f=b=>h(b)?{...u,...c}:u;return e.jsxRuntimeExports.jsx(t.ButtonGroup,{isAttached:!0,isDisabled:m,children:n.map((b,v)=>e.jsxRuntimeExports.jsx(t.Tooltip,{label:b.tooltip,openDelay:50,closeDelay:200,placement:"top",visibility:b.tooltip?"visible":"hidden",hasArrow:!0,children:e.jsxRuntimeExports.jsx(t.Button,{onClick:()=>h(b)?null:s(b,v),isDisabled:b.disabled,...f(b),children:b.label})},v))})},se=(n,s)=>s<0?-1*Math.abs(n):Math.abs(n),Se=({isReversed:n,min:s,max:a,value:m,onChange:c,inputProps:u,size:h,zeroMarker:f,formatValue:b,valueLabel:v,positiveNegativeLabels:F,isDisabled:g,...E})=>{const[A,d]=o.useState([void 0,void 0]),l=A[0],T=A[1],C=f&&s<-5&&a>5,S=Number(m?.[0]??T??s)>0?1:-1,p=Number(m?.[1]??T??a)<0?-1:1,j=F?.[0]===F?.[1],M=m?.[0],D=m?.[1];o.useEffect(()=>{M!==void 0&&D!==void 0&&d([M.toFixed(0),D.toFixed(0)])},[M,D,d]);const I=o.useCallback(([i,y])=>{i<y&&d([i.toFixed(0),y.toFixed(0)])},[d]),z=o.useCallback(([i,y])=>{i<y&&c([i,y])},[c]),k=o.useCallback(()=>{d(([i,y])=>{const L=isNaN(Number(i))?s:Number(i),_=isNaN(Number(y))?a:Number(y),W=se(Number(L),S),O=se(Number(_),p),q=S<0?Math.max(W,s):Math.min(W,a),B=p<0?Math.max(O,s):Math.min(O,a);return q>B?(c([B,q]),[B.toFixed(0),q.toFixed(0)]):(c([q,B]),[q.toFixed(0),B.toFixed(0)])})},[c,d,S,p,s,a]),U=o.useCallback(i=>{const y=i===""||isNaN(Number(i))?i:se(Number(i),S);d(([L,_])=>[y.toString(),_])},[d,S]),P=o.useCallback(i=>{const y=i===""||isNaN(Number(i))?i:se(Number(i),p);d(([L,_])=>[L,y.toString()])},[d,p]),x=o.useMemo(()=>h==="xs"?"0.75rem":void 0,[h]),r=o.useCallback((i,y)=>{const L=Number(y.target.value);if(!l||!T||![-1,1].includes(L))return;const _=q=>L<0?-1*Math.abs(q):Math.abs(q),W=i?_(Number(l)):Number(l),O=i?Number(T):_(Number(T));W>O?c([O,W]):c([W,O])},[l,T,c]);return e.jsxRuntimeExports.jsxs(t.Flex,{direction:"column",...E,children:[e.jsxRuntimeExports.jsx(t.Box,{pt:"1em",mb:"-0.5em",children:e.jsxRuntimeExports.jsxs(t.RangeSlider,{"aria-label":["min","max"],isReversed:n,value:[Number(l??s),Number(T??a)],max:a,min:s,minStepsBetweenThumbs:3,step:1,onChange:I,onChangeEnd:z,isDisabled:g,children:[e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:s,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:b?b?.(s):s})}),e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:a,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",style:{transform:"translateX(-100%)"},whiteSpace:"nowrap",children:b?b(a):a})}),C&&e.jsxRuntimeExports.jsxs(t.RangeSliderMark,{value:0,top:"-1em",pos:"relative",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:h,fontWeight:"semibold",children:b?.(0)??"0"}),e.jsxRuntimeExports.jsx(ye,{})]}),e.jsxRuntimeExports.jsx(t.RangeSliderTrack,{children:e.jsxRuntimeExports.jsx(t.RangeSliderFilledTrack,{})}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:0,w:x,h:x}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:1,w:x,h:x})]})}),v&&e.jsxRuntimeExports.jsxs(t.Flex,{direction:n?"row-reverse":"row",justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:v(s)}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:v(a)})]}),e.jsxRuntimeExports.jsxs(t.Flex,{direction:n?"row-reverse":"row",justifyContent:"center",alignItems:"center",gap:"0.125em",children:[F&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:h,fontWeight:"bold",value:S,onChange:i=>r(!0,i),isDisabled:j||g,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:F[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:F[1]})]}),e.jsxRuntimeExports.jsx(t.NumberInput,{precision:0,size:h??"sm",min:0,max:S<0?Math.abs(s):D??a,value:l===""?"":Math.abs(Number(l??s)),onChange:U,onBlur:k,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:g,...u,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),e.jsxRuntimeExports.jsx(t.NumberInput,{size:h??"sm",min:0,max:p<0?Math.abs(M??s):a,precision:0,value:T===""?"":Math.abs(Number(T??a)),onChange:P,onBlur:k,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:g,...u,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),F&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:h,fontWeight:"bold",value:p,onChange:i=>r(!1,i),isDisabled:j||g,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:F[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:F[1]})]})]})]})},ye=xe.dt(t.Box)`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 2px;
|
|
4
4
|
height: 1em;
|
package/dist/components.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { j as e, u as ls } from "./vendor-
|
|
1
|
+
import { j as e, u as ls } from "./vendor-DxZbxm3m.js";
|
|
2
2
|
import { useMemo as D, useState as F, useCallback as O, useRef as as, useEffect as Y, memo as ye } from "react";
|
|
3
3
|
import { d as We } from "./styled-components-vendor-Bvwhddj9.js";
|
|
4
|
-
import { s as se, y as cs } from "./react-select-vendor-
|
|
4
|
+
import { s as se, y as cs } from "./react-select-vendor-CM41In8Q.js";
|
|
5
5
|
import { F as ds, a as us } from "./react-icons-vendor-TETORdU9.js";
|
|
6
|
-
import { F as le, I as Pe, a as hs, b as $e, c as Ce, d as Qe, B, T as qe, e as He, f as Ye, g as Se, h as ie, i as Je, j as re, k as ce, l as Ke, m as $, R as ms, n as Ae, o as M, p as gs, q as ps, r as _e, S as ze, N as Ue, s as Ge, H as K, t as de, C as xs, u as Xe, V, v as G, A as be, w as ve, x as Ze, y as fs, M as js, z as bs, D as vs, E as ys, G as Cs, J as Ss, K as ws, L as Ms, O as Ie } from "./ui-vendor-
|
|
7
|
-
import {
|
|
6
|
+
import { F as le, I as Pe, a as hs, b as $e, c as Ce, d as Qe, B, T as qe, e as He, f as Ye, g as Se, h as ie, i as Je, j as re, k as ce, l as Ke, m as $, R as ms, n as Ae, o as M, p as gs, q as ps, r as _e, S as ze, N as Ue, s as Ge, H as K, t as de, C as xs, u as Xe, V, v as G, A as be, w as ve, x as Ze, y as fs, M as js, z as bs, D as vs, E as ys, G as Cs, J as Ss, K as ws, L as Ms, O as Ie } from "./ui-vendor-CTkR2JkD.js";
|
|
7
|
+
import { u as ee, a as oe, b as As } from "./graphql-vendor-D5ETG7wB.js";
|
|
8
8
|
import { g as W, T as je, S as k, A as ge, a as Te } from "./generated-GfcSQz21.js";
|
|
9
|
-
import { G as Ve, a as Is, C as De,
|
|
10
|
-
import { D as _s, H as zs, u as Us, a as Gs } from "./react-dnd-vendor-
|
|
9
|
+
import { A as ae, G as Ve, a as Is, C as De, b as es, c as Re, M as ss, d as Le, e as Ts, f as ts, S as Ns, g as Os, U as Rs, h as Ls, i as Fs, j as Ds, k as ks, l as Es, m as Ps } from "./graphql-DZp5ePcc.js";
|
|
10
|
+
import { D as _s, H as zs, u as Us, a as Gs } from "./react-dnd-vendor-bl4guadi.js";
|
|
11
11
|
import { getSegmentNameWithPlane as ns, getJointNameWithPlane as is, getJointAngleDirectionName as Bs, getSegmentAngleDirectionName as Ws, getNormativeJointRange as $s } from "./services.js";
|
|
12
12
|
import { availablePlanes as Be, getAnalysisPartIdNoSide as pe } from "./types.js";
|
|
13
13
|
import { thresholdsToParameters as Qs, parametersToThresholds as Ne, cn as qs } from "./utils.js";
|
|
@@ -825,14 +825,14 @@ const Ys = ({
|
|
|
825
825
|
variables: { groupId: j },
|
|
826
826
|
pause: !j
|
|
827
827
|
// Only run when group is selected
|
|
828
|
-
}), [, S] = oe(
|
|
828
|
+
}), [, S] = oe(ts), [, b] = oe(De), v = D(() => d.data?.groups ? d.data.groups.map(
|
|
829
829
|
(n) => W(es, n)
|
|
830
830
|
) : [], [d.data]), h = D(() => r.data?.modules ? W(
|
|
831
831
|
Re,
|
|
832
832
|
r.data?.modules
|
|
833
833
|
).map((i) => {
|
|
834
834
|
const y = W(
|
|
835
|
-
|
|
835
|
+
ss,
|
|
836
836
|
i.moduleActions
|
|
837
837
|
);
|
|
838
838
|
return {
|
|
@@ -1642,8 +1642,8 @@ const Ys = ({
|
|
|
1642
1642
|
setButtonDisabled: m,
|
|
1643
1643
|
quantumOwned: f
|
|
1644
1644
|
}) => {
|
|
1645
|
-
const j = As(), [{ fetching: C }, I] = oe(De), [{ fetching: p }, x] = oe(
|
|
1646
|
-
query:
|
|
1645
|
+
const j = As(), [{ fetching: C }, I] = oe(De), [{ fetching: p }, x] = oe(Rs), [{ data: A }] = ee({
|
|
1646
|
+
query: Ls,
|
|
1647
1647
|
variables: { id: t ?? "" },
|
|
1648
1648
|
pause: !t
|
|
1649
1649
|
}), d = W(
|
|
@@ -1674,7 +1674,7 @@ const Ys = ({
|
|
|
1674
1674
|
}, [d]);
|
|
1675
1675
|
const rs = O(
|
|
1676
1676
|
async (N) => (await j.query(
|
|
1677
|
-
f ?
|
|
1677
|
+
f ? Ns : Os,
|
|
1678
1678
|
{
|
|
1679
1679
|
query: N,
|
|
1680
1680
|
limit: 10
|
|
@@ -1976,10 +1976,10 @@ const Ys = ({
|
|
|
1976
1976
|
}), p = W(
|
|
1977
1977
|
Le,
|
|
1978
1978
|
I?.moduleCategories
|
|
1979
|
-
), [{ fetching: x }, A] = oe(Ps), [{ fetching: d }, r] = oe(
|
|
1979
|
+
), [{ fetching: x }, A] = oe(Ps), [{ fetching: d }, r] = oe(ts), S = W(
|
|
1980
1980
|
ae,
|
|
1981
1981
|
a ? j?.quantumOwnedActions : j?.actions
|
|
1982
|
-
) ?? [], b = W(Re, C?.module), v = W(
|
|
1982
|
+
) ?? [], b = W(Re, C?.module), v = W(ss, b?.moduleActions) ?? [], [h, g] = F([
|
|
1983
1983
|
...v.map((c) => c.actionId) ?? []
|
|
1984
1984
|
]), [w, P] = F(b?.name ?? ""), [T, q] = F([]), [R, Q] = F(b?.description ?? "");
|
|
1985
1985
|
Y(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const M=require("./vendor-Dmlu4NZO.cjs"),s=require("./react-dnd-vendor-DyqEbdFL.cjs");function j(t,e,r){return e.split(".").reduce((n,i)=>n&&n[i]?n[i]:r||null,t)}function H(t,e){return t.filter(r=>r!==e)}function U(t){return typeof t=="object"}function N(t,e){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};t.forEach(n),e.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function L(t,e){return t.filter(r=>e.indexOf(r)>-1)}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";function _(t,e){return{type:E,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const V={type:E,payload:{clientOffset:null,sourceClientOffset:null}};function k(t){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,c=t.getMonitor(),l=t.getRegistry();t.dispatch(_(o)),q(r,c,l);const f=X(r,c);if(f==null){t.dispatch(V);return}let D=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");B(a),D=a(f)}t.dispatch(_(o,D));const b=l.getSource(f).beginDrag(c,f);if(b==null)return;F(b),l.pinSource(f);const $=l.getSourceType(f);return{type:p,payload:{itemType:$,item:b,sourceId:f,clientOffset:o||null,sourceClientOffset:D||null,isSourcePublic:!!i}}}}function q(t,e,r){s.invariant(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(n){s.invariant(r.getSource(n),"Expected sourceIds to be registered.")})}function B(t){s.invariant(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function F(t){s.invariant(U(t),"Item must be an object.")}function X(t,e){let r=null;for(let n=t.length-1;n>=0;n--)if(e.canDragSource(t[n])){r=t[n];break}return r}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){W(t,i,r[i])})}return t}function J(t){return function(r={}){const n=t.getMonitor(),i=t.getRegistry();Q(n),K(n).forEach((a,c)=>{const l=Y(a,c,i,n),f={type:y,payload:{dropResult:z({},r,l)}};t.dispatch(f)})}}function Q(t){s.invariant(t.isDragging(),"Cannot call drop while not dragging."),s.invariant(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(t,e,r,n){const i=r.getTarget(t);let o=i?i.drop(n,t):void 0;return Z(o),typeof o>"u"&&(o=e===0?{}:n.getDropResult()),o}function Z(t){s.invariant(typeof t>"u"||U(t),"Drop result must either be an object or undefined.")}function K(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function ee(t){return function(){const r=t.getMonitor(),n=t.getRegistry();te(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:S}}}function te(t){s.invariant(t.isDragging(),"Cannot call endDrag while not dragging.")}function v(t,e){return e===null?t===null:Array.isArray(t)?t.some(r=>r===e):t===e}function re(t){return function(r,{clientOffset:n}={}){ne(r);const i=r.slice(0),o=t.getMonitor(),a=t.getRegistry(),c=o.getItemType();return oe(i,a,c),ie(i,o,a),se(i,o,a),{type:h,payload:{targetIds:i,clientOffset:n||null}}}}function ne(t){s.invariant(Array.isArray(t),"Expected targetIds to be an array.")}function ie(t,e,r){s.invariant(e.isDragging(),"Cannot call hover while not dragging."),s.invariant(!e.didDrop(),"Cannot call hover after drop.");for(let n=0;n<t.length;n++){const i=t[n];s.invariant(t.lastIndexOf(i)===n,"Expected targetIds to be unique in the passed array.");const o=r.getTarget(i);s.invariant(o,"Expected targetIds to be registered.")}}function oe(t,e,r){for(let n=t.length-1;n>=0;n--){const i=t[n],o=e.getTargetType(i);v(o,r)||t.splice(n,1)}}function se(t,e,r){t.forEach(function(n){r.getTarget(n).hover(e,n)})}function ae(t){return function(){if(t.getMonitor().isDragging())return{type:I}}}function ce(t){return{beginDrag:k(t),publishDragSource:ae(t),hover:re(t),drop:J(t),endDrag:ee(t)}}class ue{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const c=o.apply(e,a);typeof c<"u"&&r(c)}}const i=ce(this);return Object.keys(i).reduce((o,a)=>{const c=i[a];return o[a]=n(c),o},{})}dispatch(e){this.store.dispatch(e)}constructor(e,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}}function fe(t,e){return{x:t.x+e.x,y:t.y+e.y}}function G(t,e){return{x:t.x-e.x,y:t.y-e.y}}function le(t){const{clientOffset:e,initialClientOffset:r,initialSourceClientOffset:n}=t;return!e||!r||!n?null:G(fe(e,n),r)}function de(t){const{clientOffset:e,initialClientOffset:r}=t;return!e||!r?null:G(e,r)}const g=[],m=[];g.__IS_NONE__=!0;m.__IS_ALL__=!0;function ge(t,e){return t===g?!1:t===m||typeof e>"u"?!0:L(e,t).length>0}class pe{subscribeToStateChange(e,r={}){const{handlerIds:n}=r;s.invariant(typeof e=="function","listener must be a function."),s.invariant(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),c=a.stateId;try{c===i||c===i+1&&!ge(a.dirtyHandlerIds,n)||e()}finally{i=c}};return this.store.subscribe(o)}subscribeToOffsetChange(e){s.invariant(typeof e=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,e())};return this.store.subscribe(n)}canDragSource(e){if(!e)return!1;const r=this.registry.getSource(e);return s.invariant(r,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:r.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const r=this.registry.getTarget(e);if(s.invariant(r,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();return v(n,i)&&r.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const r=this.registry.getSource(e,!0);if(s.invariant(r,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(e),i=this.getItemType();return n!==i?!1:r.isDragging(this,e)}isOverTarget(e,r={shallow:!1}){if(!e)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(e),o=this.getItemType();if(o&&!v(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return n?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return le(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return de(this.store.getState().dragOffset)}constructor(e,r){this.store=e,this.registry=r}}const C="dnd-core/ADD_SOURCE",R="dnd-core/ADD_TARGET",x="dnd-core/REMOVE_SOURCE",O="dnd-core/REMOVE_TARGET";function he(t){return{type:C,payload:{sourceId:t}}}function ye(t){return{type:R,payload:{targetId:t}}}function Se(t){return{type:x,payload:{sourceId:t}}}function Oe(t){return{type:O,payload:{targetId:t}}}function De(t){s.invariant(typeof t.canDrag=="function","Expected canDrag to be a function."),s.invariant(typeof t.beginDrag=="function","Expected beginDrag to be a function."),s.invariant(typeof t.endDrag=="function","Expected endDrag to be a function.")}function be(t){s.invariant(typeof t.canDrop=="function","Expected canDrop to be a function."),s.invariant(typeof t.hover=="function","Expected hover to be a function."),s.invariant(typeof t.drop=="function","Expected beginDrag to be a function.")}function T(t,e){if(e&&Array.isArray(t)){t.forEach(r=>T(r,!1));return}s.invariant(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.")}var u;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(u||(u={}));let ve=0;function Te(){return ve++}function Ee(t){const e=Te().toString();switch(t){case u.SOURCE:return`S${e}`;case u.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function w(t){switch(t[0]){case"S":return u.SOURCE;case"T":return u.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function P(t,e){const r=t.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===e)return!0;n=!!i}while(!n);return!1}class Ie{addSource(e,r){T(e),De(r);const n=this.addHandler(u.SOURCE,e,r);return this.store.dispatch(he(n)),n}addTarget(e,r){T(e,!0),be(r);const n=this.addHandler(u.TARGET,e,r);return this.store.dispatch(ye(n)),n}containsHandler(e){return P(this.dragSources,e)||P(this.dropTargets,e)}getSource(e,r=!1){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),r&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return w(e)===u.SOURCE}isTargetId(e){return w(e)===u.TARGET}removeSource(e){s.invariant(this.getSource(e),"Expected an existing source."),this.store.dispatch(Se(e)),s.asap(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){s.invariant(this.getTarget(e),"Expected an existing target."),this.store.dispatch(Oe(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const r=this.getSource(e);s.invariant(r,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=r}unpinSource(){s.invariant(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,r,n){const i=Ee(e);return this.types.set(i,r),e===u.SOURCE?this.dragSources.set(i,n):e===u.TARGET&&this.dropTargets.set(i,n),i}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const me=(t,e)=>t===e;function Ce(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function Re(t,e,r=me){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!r(t[n],e[n]))return!1;return!0}function xe(t=g,e){switch(e.type){case h:break;case C:case R:case O:case x:return g;case p:case I:case S:case y:default:return m}const{targetIds:r=[],prevTargetIds:n=[]}=e.payload,i=N(r,n);if(!(i.length>0||!Re(r,n)))return g;const a=n[n.length-1],c=r[r.length-1];return a!==c&&(a&&i.push(a),c&&i.push(c)),i}function _e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){_e(t,i,r[i])})}return t}const A={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pe(t=A,e){const{payload:r}=e;switch(e.type){case E:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case h:return Ce(t.clientOffset,r.clientOffset)?t:we({},t,{clientOffset:r.clientOffset});case S:case y:return A;default:return t}}function Ae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){Ae(t,i,r[i])})}return t}const Ue={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ge(t=Ue,e){const{payload:r}=e;switch(e.type){case p:return d({},t,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case I:return d({},t,{isSourcePublic:!0});case h:return d({},t,{targetIds:r.targetIds});case O:return t.targetIds.indexOf(r.targetId)===-1?t:d({},t,{targetIds:H(t.targetIds,r.targetId)});case y:return d({},t,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case S:return d({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function $e(t=0,e){switch(e.type){case C:case R:return t+1;case x:case O:return t-1;default:return t}}function Me(t=0){return t+1}function je(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){je(t,i,r[i])})}return t}function Ne(t={},e){return{dirtyHandlerIds:xe(t.dirtyHandlerIds,{type:e.type,payload:He({},e.payload,{prevTargetIds:j(t,"dragOperation.targetIds",[])})}),dragOffset:Pe(t.dragOffset,e),refCount:$e(t.refCount,e),dragOperation:Ge(t.dragOperation,e),stateId:Me(t.stateId)}}function Le(t,e=void 0,r={},n=!1){const i=Ve(n),o=new pe(i,new Ie(i)),a=new ue(i,o),c=t(a,e,r);return a.receiveBackend(c),a}function Ve(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return M.createStore(Ne,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}exports.createDragDropManager=Le;
|
|
1
|
+
"use strict";const M=require("./vendor-D0fSwmdY.cjs"),s=require("./react-dnd-vendor-CQ6n_Iry.cjs");function j(t,e,r){return e.split(".").reduce((n,i)=>n&&n[i]?n[i]:r||null,t)}function H(t,e){return t.filter(r=>r!==e)}function U(t){return typeof t=="object"}function N(t,e){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};t.forEach(n),e.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function L(t,e){return t.filter(r=>e.indexOf(r)>-1)}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";function _(t,e){return{type:E,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const V={type:E,payload:{clientOffset:null,sourceClientOffset:null}};function k(t){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,c=t.getMonitor(),l=t.getRegistry();t.dispatch(_(o)),q(r,c,l);const f=X(r,c);if(f==null){t.dispatch(V);return}let D=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");B(a),D=a(f)}t.dispatch(_(o,D));const b=l.getSource(f).beginDrag(c,f);if(b==null)return;F(b),l.pinSource(f);const $=l.getSourceType(f);return{type:p,payload:{itemType:$,item:b,sourceId:f,clientOffset:o||null,sourceClientOffset:D||null,isSourcePublic:!!i}}}}function q(t,e,r){s.invariant(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(n){s.invariant(r.getSource(n),"Expected sourceIds to be registered.")})}function B(t){s.invariant(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function F(t){s.invariant(U(t),"Item must be an object.")}function X(t,e){let r=null;for(let n=t.length-1;n>=0;n--)if(e.canDragSource(t[n])){r=t[n];break}return r}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){W(t,i,r[i])})}return t}function J(t){return function(r={}){const n=t.getMonitor(),i=t.getRegistry();Q(n),K(n).forEach((a,c)=>{const l=Y(a,c,i,n),f={type:y,payload:{dropResult:z({},r,l)}};t.dispatch(f)})}}function Q(t){s.invariant(t.isDragging(),"Cannot call drop while not dragging."),s.invariant(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(t,e,r,n){const i=r.getTarget(t);let o=i?i.drop(n,t):void 0;return Z(o),typeof o>"u"&&(o=e===0?{}:n.getDropResult()),o}function Z(t){s.invariant(typeof t>"u"||U(t),"Drop result must either be an object or undefined.")}function K(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function ee(t){return function(){const r=t.getMonitor(),n=t.getRegistry();te(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:S}}}function te(t){s.invariant(t.isDragging(),"Cannot call endDrag while not dragging.")}function v(t,e){return e===null?t===null:Array.isArray(t)?t.some(r=>r===e):t===e}function re(t){return function(r,{clientOffset:n}={}){ne(r);const i=r.slice(0),o=t.getMonitor(),a=t.getRegistry(),c=o.getItemType();return oe(i,a,c),ie(i,o,a),se(i,o,a),{type:h,payload:{targetIds:i,clientOffset:n||null}}}}function ne(t){s.invariant(Array.isArray(t),"Expected targetIds to be an array.")}function ie(t,e,r){s.invariant(e.isDragging(),"Cannot call hover while not dragging."),s.invariant(!e.didDrop(),"Cannot call hover after drop.");for(let n=0;n<t.length;n++){const i=t[n];s.invariant(t.lastIndexOf(i)===n,"Expected targetIds to be unique in the passed array.");const o=r.getTarget(i);s.invariant(o,"Expected targetIds to be registered.")}}function oe(t,e,r){for(let n=t.length-1;n>=0;n--){const i=t[n],o=e.getTargetType(i);v(o,r)||t.splice(n,1)}}function se(t,e,r){t.forEach(function(n){r.getTarget(n).hover(e,n)})}function ae(t){return function(){if(t.getMonitor().isDragging())return{type:I}}}function ce(t){return{beginDrag:k(t),publishDragSource:ae(t),hover:re(t),drop:J(t),endDrag:ee(t)}}class ue{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const c=o.apply(e,a);typeof c<"u"&&r(c)}}const i=ce(this);return Object.keys(i).reduce((o,a)=>{const c=i[a];return o[a]=n(c),o},{})}dispatch(e){this.store.dispatch(e)}constructor(e,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}}function fe(t,e){return{x:t.x+e.x,y:t.y+e.y}}function G(t,e){return{x:t.x-e.x,y:t.y-e.y}}function le(t){const{clientOffset:e,initialClientOffset:r,initialSourceClientOffset:n}=t;return!e||!r||!n?null:G(fe(e,n),r)}function de(t){const{clientOffset:e,initialClientOffset:r}=t;return!e||!r?null:G(e,r)}const g=[],m=[];g.__IS_NONE__=!0;m.__IS_ALL__=!0;function ge(t,e){return t===g?!1:t===m||typeof e>"u"?!0:L(e,t).length>0}class pe{subscribeToStateChange(e,r={}){const{handlerIds:n}=r;s.invariant(typeof e=="function","listener must be a function."),s.invariant(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),c=a.stateId;try{c===i||c===i+1&&!ge(a.dirtyHandlerIds,n)||e()}finally{i=c}};return this.store.subscribe(o)}subscribeToOffsetChange(e){s.invariant(typeof e=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,e())};return this.store.subscribe(n)}canDragSource(e){if(!e)return!1;const r=this.registry.getSource(e);return s.invariant(r,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:r.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const r=this.registry.getTarget(e);if(s.invariant(r,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();return v(n,i)&&r.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const r=this.registry.getSource(e,!0);if(s.invariant(r,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(e),i=this.getItemType();return n!==i?!1:r.isDragging(this,e)}isOverTarget(e,r={shallow:!1}){if(!e)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(e),o=this.getItemType();if(o&&!v(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return n?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return le(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return de(this.store.getState().dragOffset)}constructor(e,r){this.store=e,this.registry=r}}const C="dnd-core/ADD_SOURCE",R="dnd-core/ADD_TARGET",x="dnd-core/REMOVE_SOURCE",O="dnd-core/REMOVE_TARGET";function he(t){return{type:C,payload:{sourceId:t}}}function ye(t){return{type:R,payload:{targetId:t}}}function Se(t){return{type:x,payload:{sourceId:t}}}function Oe(t){return{type:O,payload:{targetId:t}}}function De(t){s.invariant(typeof t.canDrag=="function","Expected canDrag to be a function."),s.invariant(typeof t.beginDrag=="function","Expected beginDrag to be a function."),s.invariant(typeof t.endDrag=="function","Expected endDrag to be a function.")}function be(t){s.invariant(typeof t.canDrop=="function","Expected canDrop to be a function."),s.invariant(typeof t.hover=="function","Expected hover to be a function."),s.invariant(typeof t.drop=="function","Expected beginDrag to be a function.")}function T(t,e){if(e&&Array.isArray(t)){t.forEach(r=>T(r,!1));return}s.invariant(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.")}var u;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(u||(u={}));let ve=0;function Te(){return ve++}function Ee(t){const e=Te().toString();switch(t){case u.SOURCE:return`S${e}`;case u.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function w(t){switch(t[0]){case"S":return u.SOURCE;case"T":return u.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function P(t,e){const r=t.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===e)return!0;n=!!i}while(!n);return!1}class Ie{addSource(e,r){T(e),De(r);const n=this.addHandler(u.SOURCE,e,r);return this.store.dispatch(he(n)),n}addTarget(e,r){T(e,!0),be(r);const n=this.addHandler(u.TARGET,e,r);return this.store.dispatch(ye(n)),n}containsHandler(e){return P(this.dragSources,e)||P(this.dropTargets,e)}getSource(e,r=!1){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),r&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return w(e)===u.SOURCE}isTargetId(e){return w(e)===u.TARGET}removeSource(e){s.invariant(this.getSource(e),"Expected an existing source."),this.store.dispatch(Se(e)),s.asap(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){s.invariant(this.getTarget(e),"Expected an existing target."),this.store.dispatch(Oe(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const r=this.getSource(e);s.invariant(r,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=r}unpinSource(){s.invariant(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,r,n){const i=Ee(e);return this.types.set(i,r),e===u.SOURCE?this.dragSources.set(i,n):e===u.TARGET&&this.dropTargets.set(i,n),i}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const me=(t,e)=>t===e;function Ce(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function Re(t,e,r=me){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!r(t[n],e[n]))return!1;return!0}function xe(t=g,e){switch(e.type){case h:break;case C:case R:case O:case x:return g;case p:case I:case S:case y:default:return m}const{targetIds:r=[],prevTargetIds:n=[]}=e.payload,i=N(r,n);if(!(i.length>0||!Re(r,n)))return g;const a=n[n.length-1],c=r[r.length-1];return a!==c&&(a&&i.push(a),c&&i.push(c)),i}function _e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){_e(t,i,r[i])})}return t}const A={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pe(t=A,e){const{payload:r}=e;switch(e.type){case E:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case h:return Ce(t.clientOffset,r.clientOffset)?t:we({},t,{clientOffset:r.clientOffset});case S:case y:return A;default:return t}}function Ae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){Ae(t,i,r[i])})}return t}const Ue={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ge(t=Ue,e){const{payload:r}=e;switch(e.type){case p:return d({},t,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case I:return d({},t,{isSourcePublic:!0});case h:return d({},t,{targetIds:r.targetIds});case O:return t.targetIds.indexOf(r.targetId)===-1?t:d({},t,{targetIds:H(t.targetIds,r.targetId)});case y:return d({},t,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case S:return d({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function $e(t=0,e){switch(e.type){case C:case R:return t+1;case x:case O:return t-1;default:return t}}function Me(t=0){return t+1}function je(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){je(t,i,r[i])})}return t}function Ne(t={},e){return{dirtyHandlerIds:xe(t.dirtyHandlerIds,{type:e.type,payload:He({},e.payload,{prevTargetIds:j(t,"dragOperation.targetIds",[])})}),dragOffset:Pe(t.dragOffset,e),refCount:$e(t.refCount,e),dragOperation:Ge(t.dragOperation,e),stateId:Me(t.stateId)}}function Le(t,e=void 0,r={},n=!1){const i=Ve(n),o=new pe(i,new Ie(i)),a=new ue(i,o),c=t(a,e,r);return a.receiveBackend(c),a}function Ve(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return M.createStore(Ne,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}exports.createDragDropManager=Le;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as j } from "./vendor-
|
|
2
|
-
import { i as s, b as M } from "./react-dnd-vendor-
|
|
1
|
+
import { c as j } from "./vendor-DxZbxm3m.js";
|
|
2
|
+
import { i as s, b as M } from "./react-dnd-vendor-bl4guadi.js";
|
|
3
3
|
function H(t, e, r) {
|
|
4
4
|
return e.split(".").reduce(
|
|
5
5
|
(n, i) => n && n[i] ? n[i] : r || null,
|