dinocollab-core 2.1.16 → 2.1.17

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.
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e,toConsumableArray as t,objectSpread2 as i}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";import o,{useState as a,useCallback as l,useEffect as u}from"react";import{styled as s,Box as d,Stack as c,Dialog as f,DialogTitle as p,DialogContent as h,DialogContentText as m,DialogActions as g,Button as v}from"@mui/material";import x from"@mui/material/Alert";var y=o.forwardRef((function(e,t){return n(x,i(i({elevation:6,ref:t,variant:"standard"},e),{},{style:{minWidth:"300px"}}))})),C={};function A(){var r,o,s=a([]),d=e(s,2),f=d[0],p=d[1],h=l((function(e){p((function(i){return[].concat(t(i),[e])}))}),[]),m=l((function(e){var i=f.findIndex((function(t){return t.id===e.id}));f.splice(i,1),p(t(f))}),[f]);return u((function(){C.ApiAlert=i(i({},C.ApiAlert?C.ApiAlert:{}),{},{PushMessage:h,PushError:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"error",duration:(null==t?void 0:t.duration)||15e3})},PushInfo:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"info",duration:(null==t?void 0:t.duration)||6e3})},PushWarning:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"warning",duration:(null==t?void 0:t.duration)||6e3})},PushSuccess:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"success",duration:(null==t?void 0:t.duration)||3e3})}})}),[h]),n(b,{children:n(c,{spacing:2,sx:{maxWidth:"300px"},children:(r=f,o=m,r.map((function(e,t){return n(P,{data:e,IsOpen:!0,handleClose:o,autoDurationHide:e.duration},e.id+t)})))})})}var P=function(e){var t=l((function(){return e.handleClose(e.data)}),[e]);return u((function(){var t=null;return e.autoDurationHide&&(t=setTimeout((function(){e.handleClose(e.data)}),e.autoDurationHide)),function(){clearTimeout(t)}}),[e]),n(y,{onClose:t,severity:e.data.type,children:e.data.text})},b=s(d)({position:"fixed",top:"calc(var(--height-header) + 20px)",right:"50px",zIndex:2e3,display:"flex",justifyContent:"flex-start",alignItems:"center"}),I=function(t){var i=o.useState(t.IsOpen),a=e(i,2),l=a[0],u=a[1];o.useEffect((function(){u(t.IsOpen)}),[t.IsOpen]);var s=o.useCallback((function(){u(!1),t.onClose&&t.onClose()}),[t]);return n("div",{children:r(f,{open:l,onClose:s,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[n(p,{id:"alert-dialog-title",children:t.Title}),n(h,{children:n(m,{id:"alert-dialog-description",children:t.Message})}),r(g,{children:[n(v,{onClick:t.onAccept,autoFocus:!0,color:"info",children:"Ok"}),n(v,{onClick:s,color:"error",children:"Cancel"})]})]})})};export{I as AlertDialog,C as ApiAlertContext,A as default};
1
+ import{slicedToArray as e,toConsumableArray as t,objectSpread2 as i}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";import a,{useState as o,useCallback as l,useEffect as u}from"react";import{styled as s,Box as d,Stack as c,Dialog as f,DialogTitle as p,DialogContent as h,DialogContentText as m,DialogActions as g,Button as x}from"@mui/material";import v from"@mui/material/Alert";var y=a.forwardRef((function(e,t){return n(v,i(i({elevation:6,ref:t,variant:"standard"},e),{},{style:{minWidth:"300px"}}))})),C={};function A(){var r,a,s=o([]),d=e(s,2),f=d[0],p=d[1],h=l((function(e){p((function(i){return[].concat(t(i),[e])}))}),[]),m=l((function(e){var i=f.findIndex((function(t){return t.id===e.id}));f.splice(i,1),p(t(f))}),[f]);return u((function(){C.ApiAlert=i(i({},C.ApiAlert?C.ApiAlert:{}),{},{PushMessage:h,PushError:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"error",duration:(null==t?void 0:t.duration)||15e3})},PushInfo:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"info",duration:(null==t?void 0:t.duration)||6e3})},PushWarning:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"warning",duration:(null==t?void 0:t.duration)||6e3})},PushSuccess:function(e,t){this.PushMessage({id:(new Date).getTime().toString(),text:e,type:"success",duration:(null==t?void 0:t.duration)||3e3})}})}),[h]),n(S,{children:n(c,{spacing:2,sx:{maxWidth:"300px"},children:(r=f,a=m,r.map((function(e,t){return n(P,{data:e,IsOpen:!0,handleClose:a,autoDurationHide:e.duration},e.id+t)})))})})}var P=function(e){var t=l((function(){return e.handleClose(e.data)}),[e]);return u((function(){var t=null;return e.autoDurationHide&&(t=setTimeout((function(){e.handleClose(e.data)}),e.autoDurationHide)),function(){clearTimeout(t)}}),[e]),n(y,{sx:{whiteSpace:"pre-line"},onClose:t,severity:e.data.type,children:e.data.text})},S=s(d)({position:"fixed",top:"calc(var(--height-header) + 20px)",right:"50px",zIndex:2e3,display:"flex",justifyContent:"flex-start",alignItems:"center"}),b=function(t){var i=a.useState(t.IsOpen),o=e(i,2),l=o[0],u=o[1];a.useEffect((function(){u(t.IsOpen)}),[t.IsOpen]);var s=a.useCallback((function(){u(!1),t.onClose&&t.onClose()}),[t]);return n("div",{children:r(f,{open:l,onClose:s,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[n(p,{id:"alert-dialog-title",children:t.Title}),n(h,{children:n(m,{id:"alert-dialog-description",sx:{whiteSpace:"pre-line"},children:t.Message})}),r(g,{children:[n(x,{onClick:t.onAccept,autoFocus:!0,color:"info",children:"Ok"}),n(x,{onClick:s,color:"error",children:"Cancel"})]})]})})};export{b as AlertDialog,C as ApiAlertContext,A as default};
2
2
  //# sourceMappingURL=alert-global.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert-global.js","sources":["../../src/api-context/alert-global.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useState } from 'react'\r\nimport { Box, Stack, styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'\r\nimport MuiAlert, { AlertProps, AlertColor } from '@mui/material/Alert'\r\n\r\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(props, ref) {\r\n return <MuiAlert elevation={6} ref={ref} variant='standard' {...props} style={{ minWidth: '300px' }} />\r\n})\r\n\r\ninterface MessageData {\r\n id: string\r\n text: string\r\n type: AlertColor\r\n duration?: number\r\n}\r\n\r\ninterface IOptions {\r\n duration?: number\r\n}\r\n\r\ninterface IApiAlert {\r\n PushMessage: (data: MessageData) => void\r\n PushInfo: (data: string) => void\r\n PushError: (data: string) => void\r\n PushWarning: (data: string) => void\r\n PushSuccess: (data: string) => void\r\n}\r\n\r\nexport interface IApiContext {\r\n ApiAlert?: IApiAlert\r\n}\r\n\r\nexport const ApiAlertContext: IApiContext = {}\r\n\r\nconst RenderArea = (messages: MessageData[], onClose: (data: MessageData) => void) => {\r\n return messages.map((x, i) => {\r\n return <Message key={x.id + i} data={x} IsOpen={true} handleClose={onClose} autoDurationHide={x.duration} />\r\n })\r\n}\r\n\r\nfunction AlertGlobal() {\r\n const [Messages, setMessages] = useState<MessageData[]>([])\r\n const _PushMessage = useCallback((data: MessageData) => {\r\n setMessages((st) => [...st, data])\r\n }, [])\r\n const _HandleClose = useCallback(\r\n (data: MessageData) => {\r\n const index = Messages.findIndex((x) => x.id === data.id)\r\n Messages.splice(index, 1)\r\n setMessages([...Messages])\r\n },\r\n [Messages]\r\n )\r\n\r\n useEffect(() => {\r\n ApiAlertContext.ApiAlert = {\r\n ...(ApiAlertContext.ApiAlert ? ApiAlertContext.ApiAlert : {}),\r\n PushMessage: _PushMessage,\r\n PushError: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'error',\r\n duration: options?.duration || 15000\r\n })\r\n },\r\n PushInfo: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'info',\r\n duration: options?.duration || 6000\r\n })\r\n },\r\n PushWarning: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'warning',\r\n duration: options?.duration || 6000\r\n })\r\n },\r\n PushSuccess: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'success',\r\n duration: options?.duration || 3000\r\n })\r\n }\r\n }\r\n }, [_PushMessage])\r\n\r\n return (\r\n <Wrap>\r\n <Stack spacing={2} sx={{ maxWidth: '300px' }}>\r\n {RenderArea(Messages, _HandleClose)}\r\n </Stack>\r\n </Wrap>\r\n )\r\n}\r\nexport default AlertGlobal\r\n\r\ninterface MessageProps {\r\n IsOpen: boolean\r\n handleClose: (data: MessageData) => void\r\n data: MessageData\r\n autoDurationHide?: number\r\n}\r\nconst Message: FC<MessageProps> = (props) => {\r\n const _handleClose = useCallback(() => props.handleClose(props.data), [props])\r\n\r\n useEffect(() => {\r\n let Timer: any = null\r\n if (props.autoDurationHide) {\r\n Timer = setTimeout(() => {\r\n props.handleClose(props.data)\r\n }, props.autoDurationHide)\r\n }\r\n return () => {\r\n clearTimeout(Timer as any)\r\n }\r\n }, [props])\r\n return (\r\n <Alert onClose={_handleClose} severity={props.data.type}>\r\n {props.data.text}\r\n </Alert>\r\n )\r\n}\r\n\r\nconst Wrap = styled(Box)({\r\n position: 'fixed',\r\n top: 'calc(var(--height-header) + 20px)',\r\n right: '50px',\r\n zIndex: 2000,\r\n display: 'flex',\r\n justifyContent: 'flex-start',\r\n alignItems: 'center'\r\n})\r\n\r\ninterface AlertDialogProps {\r\n IsOpen: boolean\r\n onClose?: () => void\r\n onAccept?: () => void\r\n Title: string\r\n Message: string\r\n}\r\nexport const AlertDialog: React.FC<AlertDialogProps> = (props) => {\r\n const [Open, setOpen] = React.useState(props.IsOpen)\r\n React.useEffect(() => {\r\n setOpen(props.IsOpen)\r\n }, [props.IsOpen])\r\n const _handleClose = React.useCallback(() => {\r\n setOpen(false)\r\n props.onClose && props.onClose()\r\n }, [props])\r\n return (\r\n <div>\r\n <Dialog open={Open} onClose={_handleClose} aria-labelledby='alert-dialog-title' aria-describedby='alert-dialog-description'>\r\n <DialogTitle id='alert-dialog-title'>{props.Title}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id='alert-dialog-description'>{props.Message}</DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button onClick={props.onAccept} autoFocus color='info'>\r\n Ok\r\n </Button>\r\n <Button onClick={_handleClose} color='error'>\r\n Cancel\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n </div>\r\n )\r\n}\r\n"],"names":["Alert","React","forwardRef","props","ref","_jsx","MuiAlert","_objectSpread","elevation","variant","style","minWidth","ApiAlertContext","AlertGlobal","messages","onClose","_useState","useState","_useState2","_slicedToArray","Messages","setMessages","_PushMessage","useCallback","data","st","concat","_toConsumableArray","_HandleClose","index","findIndex","x","id","splice","useEffect","ApiAlert","PushMessage","PushError","options","this","Date","getTime","toString","text","type","duration","PushInfo","PushWarning","PushSuccess","Wrap","children","Stack","spacing","sx","maxWidth","map","i","Message","IsOpen","handleClose","autoDurationHide","_handleClose","Timer","setTimeout","clearTimeout","severity","styled","Box","position","top","right","zIndex","display","justifyContent","alignItems","AlertDialog","_React$useState","_React$useState2","Open","setOpen","_jsxs","Dialog","open","DialogTitle","Title","DialogContent","DialogContentText","DialogActions","Button","onClick","onAccept","autoFocus","color"],"mappings":"6aAIA,IAAMA,EAAQC,EAAMC,YAAuC,SAAeC,EAAOC,GAC/E,OAAOC,EAACC,EAAQC,EAAAA,EAAA,CAACC,UAAW,EAAGJ,IAAKA,EAAKK,QAAQ,YAAeN,GAAK,GAAA,CAAEO,MAAO,CAAEC,SAAU,WAC5F,IAyBaC,EAA+B,CAAA,EAQ5C,SAASC,IACP,IAPkBC,EAAyBC,EAO3CC,EAAgCC,EAAwB,IAAGC,EAAAC,EAAAH,EAAA,GAApDI,EAAQF,EAAA,GAAEG,EAAWH,EAAA,GACtBI,E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EAAkB,CAAAtD,GAAG,2BAA0BkB,SAAE/C,EAAMsD,YAE1DuB,EAACO,EACC,CAAArC,SAAA,CAAA7C,EAACmF,EAAM,CAACC,QAAStF,EAAMuF,SAAUC,WAAU,EAAAC,MAAM,uBAGjDvF,EAACmF,EAAM,CAACC,QAAS5B,EAAc+B,MAAM,QAAO1C,SAAA,kBAOtD"}
1
+ {"version":3,"file":"alert-global.js","sources":["../../src/api-context/alert-global.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useState } from 'react'\r\nimport { Box, Stack, styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'\r\nimport MuiAlert, { AlertProps, AlertColor } from '@mui/material/Alert'\r\n\r\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(props, ref) {\r\n return <MuiAlert elevation={6} ref={ref} variant='standard' {...props} style={{ minWidth: '300px' }} />\r\n})\r\n\r\ninterface MessageData {\r\n id: string\r\n text: string\r\n type: AlertColor\r\n duration?: number\r\n}\r\n\r\ninterface IOptions {\r\n duration?: number\r\n}\r\n\r\ninterface IApiAlert {\r\n PushMessage: (data: MessageData) => void\r\n PushInfo: (data: string) => void\r\n PushError: (data: string) => void\r\n PushWarning: (data: string) => void\r\n PushSuccess: (data: string) => void\r\n}\r\n\r\nexport interface IApiContext {\r\n ApiAlert?: IApiAlert\r\n}\r\n\r\nexport const ApiAlertContext: IApiContext = {}\r\n\r\nconst RenderArea = (messages: MessageData[], onClose: (data: MessageData) => void) => {\r\n return messages.map((x, i) => {\r\n return <Message key={x.id + i} data={x} IsOpen={true} handleClose={onClose} autoDurationHide={x.duration} />\r\n })\r\n}\r\n\r\nfunction AlertGlobal() {\r\n const [Messages, setMessages] = useState<MessageData[]>([])\r\n const _PushMessage = useCallback((data: MessageData) => {\r\n setMessages((st) => [...st, data])\r\n }, [])\r\n const _HandleClose = useCallback(\r\n (data: MessageData) => {\r\n const index = Messages.findIndex((x) => x.id === data.id)\r\n Messages.splice(index, 1)\r\n setMessages([...Messages])\r\n },\r\n [Messages]\r\n )\r\n\r\n useEffect(() => {\r\n ApiAlertContext.ApiAlert = {\r\n ...(ApiAlertContext.ApiAlert ? ApiAlertContext.ApiAlert : {}),\r\n PushMessage: _PushMessage,\r\n PushError: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'error',\r\n duration: options?.duration || 15000\r\n })\r\n },\r\n PushInfo: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'info',\r\n duration: options?.duration || 6000\r\n })\r\n },\r\n PushWarning: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'warning',\r\n duration: options?.duration || 6000\r\n })\r\n },\r\n PushSuccess: function (data: string, options?: IOptions) {\r\n this.PushMessage({\r\n id: new Date().getTime().toString(),\r\n text: data,\r\n type: 'success',\r\n duration: options?.duration || 3000\r\n })\r\n }\r\n }\r\n }, [_PushMessage])\r\n\r\n return (\r\n <Wrap>\r\n <Stack spacing={2} sx={{ maxWidth: '300px' }}>\r\n {RenderArea(Messages, _HandleClose)}\r\n </Stack>\r\n </Wrap>\r\n )\r\n}\r\nexport default AlertGlobal\r\n\r\ninterface MessageProps {\r\n IsOpen: boolean\r\n handleClose: (data: MessageData) => void\r\n data: MessageData\r\n autoDurationHide?: number\r\n}\r\nconst Message: FC<MessageProps> = (props) => {\r\n const _handleClose = useCallback(() => props.handleClose(props.data), [props])\r\n\r\n useEffect(() => {\r\n let Timer: any = null\r\n if (props.autoDurationHide) {\r\n Timer = setTimeout(() => {\r\n props.handleClose(props.data)\r\n }, props.autoDurationHide)\r\n }\r\n return () => {\r\n clearTimeout(Timer as any)\r\n }\r\n }, [props])\r\n return (\r\n <Alert sx={{ whiteSpace: 'pre-line' }} onClose={_handleClose} severity={props.data.type}>\r\n {props.data.text}\r\n </Alert>\r\n )\r\n}\r\n\r\nconst Wrap = styled(Box)({\r\n position: 'fixed',\r\n top: 'calc(var(--height-header) + 20px)',\r\n right: '50px',\r\n zIndex: 2000,\r\n display: 'flex',\r\n justifyContent: 'flex-start',\r\n alignItems: 'center'\r\n})\r\n\r\ninterface AlertDialogProps {\r\n IsOpen: boolean\r\n onClose?: () => void\r\n onAccept?: () => void\r\n Title: string\r\n Message: string\r\n}\r\nexport const AlertDialog: React.FC<AlertDialogProps> = (props) => {\r\n const [Open, setOpen] = React.useState(props.IsOpen)\r\n React.useEffect(() => {\r\n setOpen(props.IsOpen)\r\n }, [props.IsOpen])\r\n const _handleClose = React.useCallback(() => {\r\n setOpen(false)\r\n props.onClose && props.onClose()\r\n }, [props])\r\n return (\r\n <div>\r\n <Dialog open={Open} onClose={_handleClose} aria-labelledby='alert-dialog-title' aria-describedby='alert-dialog-description'>\r\n <DialogTitle id='alert-dialog-title'>{props.Title}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id='alert-dialog-description' sx={{ whiteSpace: 'pre-line' }}>\r\n {props.Message}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button onClick={props.onAccept} autoFocus color='info'>\r\n Ok\r\n </Button>\r\n <Button onClick={_handleClose} color='error'>\r\n Cancel\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n </div>\r\n )\r\n}\r\n"],"names":["Alert","React","forwardRef","props","ref","_jsx","MuiAlert","_objectSpread","elevation","variant","style","minWidth","ApiAlertContext","AlertGlobal","messages","onClose","_useState","useState","_useState2","_slicedToArray","Messages","setMessages","_PushMessage","useCallback","data","st","concat","_toConsumableArray","_HandleClose","index","findIndex","x","id","splice","useEffect","ApiAlert","PushMessage","PushError","options","this","Date","getTime","toString","text","type","duration","PushInfo","PushWarning","PushSuccess","Wrap","children","Stack","spacing","sx","maxWidth","map","i","Message","IsOpen","handleClose","autoDurationHide","_handleClose","Timer","setTimeout","clearTimeout","whiteSpace","severity","styled","Box","position","top","right","zIndex","display","justifyContent","alignItems","AlertDialog","_React$useState","_React$useState2","Open","setOpen","_jsxs","Dialog","open","DialogTitle","Title","DialogContent","DialogContentText","DialogActions","Button","onClick","onAccept","autoFocus","color"],"mappings":"6aAIA,IAAMA,EAAQC,EAAMC,YAAuC,SAAeC,EAAOC,GAC/E,OAAOC,EAACC,EAAQC,EAAAA,EAAA,CAACC,UAAW,EAAGJ,IAAKA,EAAKK,QAAQ,YAAeN,GAAK,GAAA,CAAEO,MAAO,CAAEC,SAAU,WAC5F,IAyBaC,EAA+B,CAAA,EAQ5C,SAASC,IACP,IAPkBC,EAAyBC,EAO3CC,EAAgCC,EAAwB,IAAGC,EAAAC,EAAAH,EAAA,GAApDI,EAAQF,EAAA,GAAEG,EAAWH,EAAA,GACtBI,EAAeC,GAAY,SAACC,GAChCH,GAAY,SAACI,GAAE,MAAA,GAAAC,OAAAC,EAASF,IAAID,GAAI,GACjC,GAAE,IACGI,EAAeL,GACnB,SAACC,GACC,IAAMK,EAAQT,EAASU,WAAU,SAACC,GAAC,OAAKA,EAAEC,KAAOR,EAAKQ,MACtDZ,EAASa,OAAOJ,EAAO,GACvBR,EAAWM,EAAKP,GAClB,GACA,CAACA,IA0CH,OAvCAc,GAAU,WACRtB,EAAgBuB,SAAQ5B,EAAAA,EAClBK,CAAAA,EAAAA,EAAgBuB,SAAWvB,EAAgBuB,SAAW,CAAE,GAAA,CAAA,EAAA,CAC5DC,YAAad,EACbe,UAAW,SAAUb,EAAcc,GACjCC,KAAKH,YAAY,CACfJ,IAAI,IAAIQ,MAAOC,UAAUC,WACzBC,KAAMnB,EACNoB,KAAM,QACNC,UAAUP,aAAAA,EAAAA,EAASO,WAAY,MAElC,EACDC,SAAU,SAAUtB,EAAcc,GAChCC,KAAKH,YAAY,CACfJ,IAAI,IAAIQ,MAAOC,UAAUC,WACzBC,KAAMnB,EACNoB,KAAM,OACNC,UAAUP,aAAAA,EAAAA,EAASO,WAAY,KAElC,EACDE,YAAa,SAAUvB,EAAcc,GACnCC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AASd,EAAMuD,QAAOoB,EAAA3D,EAAA0D,EAAA,GAA7CE,EAAID,EAAA,GAAEE,EAAOF,EAAA,GACpB7E,EAAMiC,WAAU,WACd8C,EAAQ7E,EAAMuD,OAChB,GAAG,CAACvD,EAAMuD,SACV,IAAMG,EAAe5D,EAAMsB,aAAY,WACrCyD,GAAQ,GACR7E,EAAMY,SAAWZ,EAAMY,SACzB,GAAG,CAACZ,IACJ,OACEE,EACE,MAAA,CAAA6C,SAAA+B,EAACC,EAAO,CAAAC,KAAMJ,EAAMhE,QAAS8C,EAA8B,kBAAA,wCAAsC,2BAA0BX,SAAA,CACzH7C,EAAC+E,EAAW,CAACpD,GAAG,qBAAsBkB,SAAA/C,EAAMkF,QAC5ChF,EAACiF,YACCjF,EAACkF,GAAkBvD,GAAG,2BAA2BqB,GAAI,CAAEY,WAAY,YAChEf,SAAA/C,EAAMsD,YAGXwB,EAACO,EACC,CAAAtC,SAAA,CAAA7C,EAACoF,EAAO,CAAAC,QAASvF,EAAMwF,SAAUC,WAAU,EAAAC,MAAM,OAAM3C,SAAA,OAGvD7C,EAACoF,GAAOC,QAAS7B,EAAcgC,MAAM,QAAO3C,SAAA,kBAOtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinocollab-core",
3
- "version": "2.1.16",
3
+ "version": "2.1.17",
4
4
  "description": "Dinocollab core - libraries for building collaborative applications with React 18",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",