@powerhousedao/connect 5.3.0-staging.7 → 5.3.0-staging.9
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/assets/AddDriveModal-D1EDjohH.js +1 -0
- package/dist/assets/{ClearStorageModal-D5LOX04p.js → ClearStorageModal-DrhkuEXG.js} +1 -1
- package/dist/assets/CookiesPolicyModal-CMbZr1no.js +1 -0
- package/dist/assets/CreateDocumentModal-CS47bDJu.js +1 -0
- package/dist/assets/{DebugSettingsModal-I7yR_3oi.js → DebugSettingsModal-BWvKoPNN.js} +1 -1
- package/dist/assets/{DeleteDriveModal-B4QfcDk6.js → DeleteDriveModal-CEnBULBI.js} +1 -1
- package/dist/assets/DeleteItemModal-B5vxIAm9.js +1 -0
- package/dist/assets/DisclaimerModal-Dqnyn4E9.js +1 -0
- package/dist/assets/DriveSettingsModal-DOb3cPPh.js +1 -0
- package/dist/assets/{ExportDocumentWithErrorsModal-C8Jtlp0J.js → ExportDocumentWithErrorsModal-DZRX4gck.js} +1 -1
- package/dist/assets/{SettingsModal-ByFpmjTo.js → SettingsModal-BxV4zTok.js} +1 -1
- package/dist/assets/UpgradeDriveModal-75Jo1Yw0.js +1 -0
- package/dist/assets/{design_system-DfVL_FZc.js → design_system-ClQ4FtNC.js} +1 -1
- package/dist/assets/{design_system_connect-C91kKc0e.js → design_system_connect-CUji_3Pw.js} +39 -39
- package/dist/assets/design_system_ui-DfdBkwUp.js +1 -0
- package/dist/assets/{document_engineering-D90Y-RfL.js → document_engineering-CQhVW-ji.js} +1 -1
- package/dist/assets/{document_model_editor-CXACiWAv.js → document_model_editor-Cb1z4ouf.js} +4 -4
- package/dist/assets/{drive_explorer-Bozg8MaV.js → drive_explorer-CDL55tX_.js} +2 -2
- package/dist/assets/{graphql-editor-BF7FxaNF.js → graphql-editor-DNvTU-1d.js} +2 -2
- package/dist/assets/{hooks-B1zJOWPM.js → hooks-DlD1Jrq8.js} +1 -1
- package/dist/assets/index-D98gKrdU.js +18 -0
- package/dist/assets/index-DASmOUL6.js +28 -0
- package/dist/assets/json-editor-B0BXeqRs.js +1 -0
- package/dist/assets/nodefs-B9YBto6h.js +1 -0
- package/dist/assets/opfs-ahp-C4Vp0vGx.js +3 -0
- package/dist/assets/{reactor_browser-BTgjuWjW.js → reactor_browser-ByY3H2i6.js} +4 -4
- package/dist/assets/state-schemas-Cg4mRxWO.js +2 -0
- package/dist/index.html +7 -7
- package/lib/package.copy.json +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.copy.json +1 -1
- package/package.json +10 -10
- package/dist/assets/AddDriveModal-71XbQdJU.js +0 -1
- package/dist/assets/CookiesPolicyModal-CquGgpF8.js +0 -1
- package/dist/assets/CreateDocumentModal-MbuPVxEY.js +0 -1
- package/dist/assets/DeleteItemModal-Cw_YiIir.js +0 -1
- package/dist/assets/DisclaimerModal-B3w9x8Ik.js +0 -1
- package/dist/assets/DriveSettingsModal-CoUrWxgx.js +0 -1
- package/dist/assets/UpgradeDriveModal-DA5WHfZ0.js +0 -1
- package/dist/assets/design_system_ui-BgwEPVXh.js +0 -1
- package/dist/assets/index-C4XBoltP.js +0 -28
- package/dist/assets/index-DRkoQonG.js +0 -18
- package/dist/assets/json-editor-CtcOgk_2.js +0 -1
- package/dist/assets/nodefs-CsC2qQ7j.js +0 -1
- package/dist/assets/opfs-ahp-DkgKnuqi.js +0 -3
- package/dist/assets/state-schemas-D2F46JyQ.js +0 -2
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{bd as H,be as m,bf as o,bg as s,bh as A,bc as C,bi as P,bj as x}from"./reactor_browser-BTgjuWjW.js";import"./document_model-Ce4lCkNT.js";import"./zod-9j67vCAu.js";import"./react-DQSxOgtG.js";import"./document_drive-BckABlJR.js";import"./graphql-AKTCpY7l.js";import"./config-CU-aFfVJ.js";import"./sentry_react-cODD7zWc.js";import"./sentry_browser-B4YoBIIG.js";import"./drive_explorer-Bozg8MaV.js";import"./document_model_editor-CXACiWAv.js";import"./react/jsx-runtime-DldvXD6N.js";import"./design_system-DfVL_FZc.js";import"./tailwind_merge-Dr4f9Rms.js";import"./react-dom-D6zQJsh6.js";import"./design_system_connect-C91kKc0e.js";import"./design_system_ui-BgwEPVXh.js";import"./react-dom/client-BVPiT_FE.js";C();var B="state.txt",L="data",$={DIR:16384,FILE:32768},T,I,E,_,w,k,y,j,N,b,S,l,v,O,M,g,f,D,R,W,ht=class extends H{constructor(t,{initialPoolSize:e=1e3,maintainedPoolSize:a=100,debug:i=!1}={}){super(t,{debug:i}),m(this,l),m(this,T),m(this,I),m(this,E),m(this,_),m(this,w),m(this,k,new Map),m(this,y,new Map),m(this,j,0),m(this,N,new Map),m(this,b,new Map),this.lastCheckpoint=0,this.checkpointInterval=1e3*60,this.poolCounter=0,m(this,S,new Set),this.initialPoolSize=e,this.maintainedPoolSize=a}async init(t,e){return await o(this,l,v).call(this),super.init(t,e)}async syncToFs(t=!1){await this.maybeCheckpointState(),await this.maintainPool(),t||this.flush()}async closeFs(){for(let t of s(this,y).values())t.close();s(this,w).flush(),s(this,w).close(),this.pg.Module.FS.quit()}async maintainPool(t){t=t||this.maintainedPoolSize;let e=t-this.state.pool.length,a=[];for(let i=0;i<e;i++)a.push(new Promise(async h=>{++this.poolCounter;let r=`${(Date.now()-1704063600).toString(16).padStart(8,"0")}-${this.poolCounter.toString(16).padStart(8,"0")}`,c=await s(this,E).getFileHandle(r,{create:!0}),d=await c.createSyncAccessHandle();s(this,k).set(r,c),s(this,y).set(r,d),o(this,l,M).call(this,{opp:"createPoolFile",args:[r]}),this.state.pool.push(r),h()}));for(let i=0;i>e;i--)a.push(new Promise(async h=>{let r=this.state.pool.pop();o(this,l,M).call(this,{opp:"deletePoolFile",args:[r]});let c=s(this,k).get(r);s(this,y).get(r)?.close(),await s(this,E).removeEntry(c.name),s(this,k).delete(r),s(this,y).delete(r),h()}));await Promise.all(a)}_createPoolFileState(t){this.state.pool.push(t)}_deletePoolFileState(t){let e=this.state.pool.indexOf(t);e>-1&&this.state.pool.splice(e,1)}async maybeCheckpointState(){Date.now()-this.lastCheckpoint>this.checkpointInterval&&await this.checkpointState()}async checkpointState(){let t=new TextEncoder().encode(JSON.stringify(this.state));s(this,w).truncate(0),s(this,w).write(t,{at:0}),s(this,w).flush(),this.lastCheckpoint=Date.now()}flush(){for(let t of s(this,S))try{t.flush()}catch{}s(this,S).clear()}chmod(t,e){o(this,l,O).call(this,{opp:"chmod",args:[t,e]},()=>{this._chmodState(t,e)})}_chmodState(t,e){let a=o(this,l,f).call(this,t);a.mode=e}close(t){let e=o(this,l,D).call(this,t);s(this,N).delete(t),s(this,b).delete(e)}fstat(t){let e=o(this,l,D).call(this,t);return this.lstat(e)}lstat(t){let e=o(this,l,f).call(this,t),a=e.type==="file"?s(this,y).get(e.backingFilename).getSize():0,i=4096;return{dev:0,ino:0,mode:e.mode,nlink:1,uid:0,gid:0,rdev:0,size:a,blksize:i,blocks:Math.ceil(a/i),atime:e.lastModified,mtime:e.lastModified,ctime:e.lastModified}}mkdir(t,e){o(this,l,O).call(this,{opp:"mkdir",args:[t,e]},()=>{this._mkdirState(t,e)})}_mkdirState(t,e){let a=o(this,l,g).call(this,t),i=a.pop(),h=[],r=this.state.root;for(let d of a){if(h.push(t),!Object.prototype.hasOwnProperty.call(r.children,d))if(e?.recursive)this.mkdir(h.join("/"));else throw new p("ENOENT","No such file or directory");if(r.children[d].type!=="directory")throw new p("ENOTDIR","Not a directory");r=r.children[d]}if(Object.prototype.hasOwnProperty.call(r.children,i))throw new p("EEXIST","File exists");let c={type:"directory",lastModified:Date.now(),mode:e?.mode||$.DIR,children:{}};r.children[i]=c}open(t,e,a){if(o(this,l,f).call(this,t).type!=="file")throw new p("EISDIR","Is a directory");let i=o(this,l,R).call(this);return s(this,N).set(i,t),s(this,b).set(t,i),i}readdir(t){let e=o(this,l,f).call(this,t);if(e.type!=="directory")throw new p("ENOTDIR","Not a directory");return Object.keys(e.children)}read(t,e,a,i,h){let r=o(this,l,D).call(this,t),c=o(this,l,f).call(this,r);if(c.type!=="file")throw new p("EISDIR","Is a directory");return s(this,y).get(c.backingFilename).read(new Uint8Array(e.buffer,a,i),{at:h})}rename(t,e){o(this,l,O).call(this,{opp:"rename",args:[t,e]},()=>{this._renameState(t,e,!0)})}_renameState(t,e,a=!1){let i=o(this,l,g).call(this,t),h=i.pop(),r=o(this,l,f).call(this,i.join("/"));if(!Object.prototype.hasOwnProperty.call(r.children,h))throw new p("ENOENT","No such file or directory");let c=o(this,l,g).call(this,e),d=c.pop(),n=o(this,l,f).call(this,c.join("/"));if(a&&Object.prototype.hasOwnProperty.call(n.children,d)){let u=n.children[d];s(this,y).get(u.backingFilename).truncate(0),this.state.pool.push(u.backingFilename)}n.children[d]=r.children[h],delete r.children[h]}rmdir(t){o(this,l,O).call(this,{opp:"rmdir",args:[t]},()=>{this._rmdirState(t)})}_rmdirState(t){let e=o(this,l,g).call(this,t),a=e.pop(),i=o(this,l,f).call(this,e.join("/"));if(!Object.prototype.hasOwnProperty.call(i.children,a))throw new p("ENOENT","No such file or directory");let h=i.children[a];if(h.type!=="directory")throw new p("ENOTDIR","Not a directory");if(Object.keys(h.children).length>0)throw new p("ENOTEMPTY","Directory not empty");delete i.children[a]}truncate(t,e=0){let a=o(this,l,f).call(this,t);if(a.type!=="file")throw new p("EISDIR","Is a directory");let i=s(this,y).get(a.backingFilename);if(!i)throw new p("ENOENT","No such file or directory");i.truncate(e),s(this,S).add(i)}unlink(t){o(this,l,O).call(this,{opp:"unlink",args:[t]},()=>{this._unlinkState(t,!0)})}_unlinkState(t,e=!1){let a=o(this,l,g).call(this,t),i=a.pop(),h=o(this,l,f).call(this,a.join("/"));if(!Object.prototype.hasOwnProperty.call(h.children,i))throw new p("ENOENT","No such file or directory");let r=h.children[i];if(r.type!=="file")throw new p("EISDIR","Is a directory");if(delete h.children[i],e){let c=s(this,y).get(r.backingFilename);c?.truncate(0),s(this,S).add(c),s(this,b).has(t)&&(s(this,N).delete(s(this,b).get(t)),s(this,b).delete(t))}this.state.pool.push(r.backingFilename)}utimes(t,e,a){o(this,l,O).call(this,{opp:"utimes",args:[t,e,a]},()=>{this._utimesState(t,e,a)})}_utimesState(t,e,a){let i=o(this,l,f).call(this,t);i.lastModified=a}writeFile(t,e,a){let i=o(this,l,g).call(this,t),h=i.pop(),r=o(this,l,f).call(this,i.join("/"));if(Object.prototype.hasOwnProperty.call(r.children,h)){let n=r.children[h];n.lastModified=Date.now(),o(this,l,M).call(this,{opp:"setLastModified",args:[t,n.lastModified]})}else{if(this.state.pool.length===0)throw new Error("No more file handles available in the pool");let n={type:"file",lastModified:Date.now(),mode:a?.mode||$.FILE,backingFilename:this.state.pool.pop()};r.children[h]=n,o(this,l,M).call(this,{opp:"createFileNode",args:[t,n]})}let c=r.children[h],d=s(this,y).get(c.backingFilename);e.length>0&&(d.write(typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e),{at:0}),t.startsWith("/pg_wal")&&s(this,S).add(d))}_createFileNodeState(t,e){let a=o(this,l,g).call(this,t),i=a.pop(),h=o(this,l,f).call(this,a.join("/"));h.children[i]=e;let r=this.state.pool.indexOf(e.backingFilename);return r>-1&&this.state.pool.splice(r,1),e}_setLastModifiedState(t,e){let a=o(this,l,f).call(this,t);a.lastModified=e}write(t,e,a,i,h){let r=o(this,l,D).call(this,t),c=o(this,l,f).call(this,r);if(c.type!=="file")throw new p("EISDIR","Is a directory");let d=s(this,y).get(c.backingFilename);if(!d)throw new p("EBADF","Bad file descriptor");let n=d.write(new Uint8Array(e,a,i),{at:h});return r.startsWith("/pg_wal")&&s(this,S).add(d),n}};T=new WeakMap,I=new WeakMap,E=new WeakMap,_=new WeakMap,w=new WeakMap,k=new WeakMap,y=new WeakMap,j=new WeakMap,N=new WeakMap,b=new WeakMap,S=new WeakMap,l=new WeakSet,v=async function(){P(this,T,await navigator.storage.getDirectory()),P(this,I,await o(this,l,W).call(this,this.dataDir,{create:!0})),P(this,E,await o(this,l,W).call(this,L,{from:s(this,I),create:!0})),P(this,_,await s(this,I).getFileHandle(B,{create:!0})),P(this,w,await s(this,_).createSyncAccessHandle());let t=new ArrayBuffer(s(this,w).getSize());s(this,w).read(t,{at:0});let e,a=new TextDecoder().decode(t).split(`
|
|
2
|
-
`),i=!1;try{e=JSON.parse(a[0])}catch{e={root:{type:"directory",lastModified:Date.now(),mode:$.DIR,children:{}},pool:[]},s(this,w).truncate(0),s(this,w).write(new TextEncoder().encode(JSON.stringify(e)),{at:0}),i=!0}this.state=e;let h=a.slice(1).filter(Boolean).map(n=>JSON.parse(n));for(let n of h){let u=`_${n.opp}State`;if(typeof this[u]=="function")try{this[u].bind(this)(...n.args)}catch(F){console.warn("Error applying OPFS AHP WAL entry",n,F)}}let r=[],c=async n=>{if(n.type==="file")try{let u=await s(this,E).getFileHandle(n.backingFilename),F=await u.createSyncAccessHandle();s(this,k).set(n.backingFilename,u),s(this,y).set(n.backingFilename,F)}catch(u){console.error("Error opening file handle for node",n,u)}else for(let u of Object.values(n.children))r.push(c(u))};await c(this.state.root);let d=[];for(let n of this.state.pool)d.push(new Promise(async u=>{s(this,k).has(n)&&console.warn("File handle already exists for pool file",n);let F=await s(this,E).getFileHandle(n),z=await F.createSyncAccessHandle();s(this,k).set(n,F),s(this,y).set(n,z),u()}));await Promise.all([...r,...d]),await this.maintainPool(i?this.initialPoolSize:this.maintainedPoolSize)},O=function(t,e){let a=o(this,l,M).call(this,t);try{e()}catch(i){throw s(this,w).truncate(a),i}},M=function(t){let e=JSON.stringify(t),a=new TextEncoder().encode(`
|
|
3
|
-
${e}`),i=s(this,w).getSize();return s(this,w).write(a,{at:i}),s(this,S).add(s(this,w)),i},g=function(t){return t.split("/").filter(Boolean)},f=function(t,e){let a=o(this,l,g).call(this,t),i=e||this.state.root;for(let h of a){if(i.type!=="directory")throw new p("ENOTDIR","Not a directory");if(!Object.prototype.hasOwnProperty.call(i.children,h))throw new p("ENOENT","No such file or directory");i=i.children[h]}return i},D=function(t){let e=s(this,N).get(t);if(!e)throw new p("EBADF","Bad file descriptor");return e},R=function(){let t=++x(this,j)._;for(;s(this,N).has(t);)x(this,j)._++;return t},W=async function(t,e){let a=o(this,l,g).call(this,t),i=e?.from||s(this,T);for(let h of a)i=await i.getDirectoryHandle(h,{create:e?.create});return i};var p=class extends Error{constructor(t,e){super(e),typeof t=="number"?this.code=t:typeof t=="string"&&(this.code=A[t])}};export{ht as OpfsAhpFS};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graphql-editor-BF7FxaNF.js","assets/document_model_editor-CXACiWAv.js","assets/graphql-AKTCpY7l.js","assets/drive_explorer-Bozg8MaV.js","assets/sentry_react-cODD7zWc.js","assets/react-DQSxOgtG.js","assets/sentry_browser-B4YoBIIG.js","assets/react/jsx-runtime-DldvXD6N.js","assets/document_model-Ce4lCkNT.js","assets/zod-9j67vCAu.js","assets/design_system-DfVL_FZc.js","assets/tailwind_merge-Dr4f9Rms.js","assets/react-dom-D6zQJsh6.js","assets/reactor_browser-BTgjuWjW.js","assets/document_drive-BckABlJR.js","assets/config-CU-aFfVJ.js","assets/design_system_connect-C91kKc0e.js","assets/design_system_ui-BgwEPVXh.js","assets/react-dom/client-BVPiT_FE.js","assets/hooks-B1zJOWPM.js","assets/json-editor-CtcOgk_2.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as L}from"./drive_explorer-Bozg8MaV.js";import{j as e,m as g,p as A,q as B,t as C,v as U,w as G,x as Y,y as J,z as K,A as W}from"./document_model_editor-CXACiWAv.js";import{C as Z}from"./design_system_ui-BgwEPVXh.js";import{r}from"./sentry_react-cODD7zWc.js";import{M as q,N as I,O as k,Q as O}from"./design_system_connect-C91kKc0e.js";import{K as E}from"./graphql-AKTCpY7l.js";import{c as Q}from"./design_system-DfVL_FZc.js";import"./react/jsx-runtime-DldvXD6N.js";import"./document_model-Ce4lCkNT.js";import"./zod-9j67vCAu.js";import"./react-DQSxOgtG.js";import"./tailwind_merge-Dr4f9Rms.js";import"./react-dom-D6zQJsh6.js";import"./reactor_browser-BTgjuWjW.js";import"./document_drive-BckABlJR.js";import"./config-CU-aFfVJ.js";import"./react-dom/client-BVPiT_FE.js";import"./sentry_browser-B4YoBIIG.js";const V=r.forwardRef((a,s)=>{const{className:n,...c}=a;return e.jsx("button",{ref:s,...c,className:g("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",n)})});function $({error:a}){const{payload:s}=a;switch(s.kind){case"MISSING":return e.jsxs("span",{children:["Field ",e.jsx("strong",{children:s.field})," is missing."]});case"MISSING_OPTIONAL":return e.jsxs("span",{children:["Optional field ",e.jsx("strong",{children:s.field})," is not defined."]});case"UNKNOWN_FIELD":return e.jsxs("span",{children:["Field ",e.jsx("strong",{children:s.field})," is not a known field."]});case"NON_NULL":return e.jsxs("span",{children:["Field ",e.jsx("strong",{children:s.field})," cannot be null."]});case"TYPE":return e.jsxs("span",{children:["Field ",e.jsx("strong",{children:s.field}),s.expectedType?e.jsxs(e.Fragment,{children:[" ","must be a"," ",e.jsx("strong",{children:s.expectedType.replace(/!/g,"")}),"."]}):e.jsx(e.Fragment,{children:" has an invalid value."})]});case"RECURSIVE_TYPE":return e.jsxs("span",{children:["Field ",e.jsx("strong",{children:s.typeName})," has a recursive type. It must be optional."]});default:return e.jsx("span",{children:"Invalid value."})}}const X=q,D=r.forwardRef(({className:a,...s},n)=>e.jsx(I,{ref:n,className:g("flex items-center justify-center rounded-xl bg-slate-50 p-1 shadow-[inset_0px_0px_2px_rgba(255,255,255,0.50)]",a),...s}));D.displayName=I.displayName;const v=r.forwardRef(({className:a,...s},n)=>e.jsx(k,{ref:n,className:g("flex w-full items-center justify-center whitespace-nowrap rounded-lg p-1 text-sm text-gray-500 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-gray-50 data-[state=active]:text-gray-800 data-[state=active]:shadow-[0px_16px_16px_-4px_rgba(0,0,0,0.10)]",a),...s}));v.displayName=k.displayName;const y=r.forwardRef(({className:a,...s},n)=>e.jsx(O,{ref:n,className:g("",a),...s}));y.displayName=O.displayName;const _=r.lazy(()=>L(()=>import("./graphql-editor-BF7FxaNF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),ee=r.lazy(()=>L(()=>import("./json-editor-CtcOgk_2.js"),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])));function T({modelName:a,stateSchema:s,initialValue:n,setStateSchema:c,setInitialState:d,scope:t}){const{sharedSchema:l,error:x}=B(),[h,j]=r.useState(!1),[o,F]=r.useState(!0),M=r.useCallback(i=>C(i,a,t),[a,t]),N=r.useMemo(()=>{const i=C(s,a,t);return x?[...i,x]:i},[s,a,t,x]),R=r.useCallback(()=>{j(i=>!i)},[]),P=r.useCallback(i=>c(i,t),[c,t]),H=r.useCallback(i=>d(i,t),[d,t]),b=r.useRef(!1),{initialValueErrors:z,fixedState:f}=r.useMemo(()=>{const i=n||"{}",m=U(l);if(!m)return{initialValueErrors:[],fixedState:null};const S=G(a,t);if(!S)return{initialValueErrors:[],fixedState:null};const p=m.definitions.find(u=>u.kind===E.OBJECT_TYPE_DEFINITION&&u.name.value===S);if(!p||p.kind!==E.OBJECT_TYPE_DEFINITION)return{initialValueErrors:[],fixedState:null};const w=Y(m,p,i);if(w.length&&o){const u=J({sharedSchemaDocumentNode:m,stateTypeDefinitionNode:p,existingValue:i});if(n!==u)return{initialValueErrors:[],fixedState:u}}return{initialValueErrors:w,fixedState:null}},[l,n,o,t,a]);return r.useEffect(()=>{f&&!b.current?(b.current=!0,d(f,t)):f||(b.current=!1)},[f,d,t]),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"mb-2 text-lg capitalize",children:[t," state schema *"]}),e.jsxs(V,{onClick:R,className:"mb-2 flex w-fit items-center gap-2",children:[h?"Hide":"Show"," standard library",e.jsx("svg",{className:Q("inline-block transition-transform",h?"rotate-180":"rotate-0"),xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z",fill:"black"})})]}),e.jsxs(r.Suspense,{children:[h&&e.jsx(_,{doc:K,readonly:!0}),e.jsx(_,{doc:s,updateDocumentInModel:P,customLinter:M}),N.length>0&&e.jsx("p",{className:"mt-2 text-sm text-red-600",children:N[0].message})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsxs("h3",{className:"mb-2 text-right text-lg capitalize",children:[t," state initial value *"]}),e.jsx(Z,{value:o,onChange:F,className:"mb-2 w-fit whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 pl-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",label:e.jsxs("div",{className:"flex items-center gap-2 py-2 pr-2",children:["Sync with schema"," ",e.jsx("svg",{className:"inline-block",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z",fill:"#343839"})})]})})]}),e.jsxs(r.Suspense,{children:[e.jsx(ee,{doc:n,updateDocumentInModel:H}),z.map((i,m)=>e.jsx("p",{className:"mt-2 text-sm text-red-600",children:i instanceof W?e.jsx($,{error:i}):i.message},m))]})]})]})}function be({modelName:a,globalStateSchema:s,localStateSchema:n,globalStateInitialValue:c,localStateInitialValue:d,setStateSchema:t,setInitialState:l,currentScope:x,onScopeChange:h}){const j=r.useCallback(()=>{const o=A(a,"local");t(o,"local"),l("","local")},[a,t,l]);return e.jsxs(X,{className:"pb-8",activationMode:"manual",value:x,onValueChange:o=>h(o),children:[e.jsx("div",{className:"my-6",children:e.jsxs(D,{className:"mx-auto flex max-w-sm",children:[e.jsx(v,{value:"global",children:"Global"}),e.jsx(v,{value:"local",children:"Local"})]})}),e.jsx(y,{value:"global",tabIndex:-1,children:e.jsx(T,{modelName:a,stateSchema:s,initialValue:c,setStateSchema:t,setInitialState:l,scope:"global"})}),e.jsx(y,{value:"local",tabIndex:-1,children:n?e.jsx(T,{modelName:a,stateSchema:n,initialValue:d,setStateSchema:t,setInitialState:l,scope:"local"}):e.jsxs("div",{className:"",children:[e.jsx("h3",{className:"mb-2 text-lg capitalize",children:"local state schema *"}),e.jsx(V,{onClick:j,children:"Add local state"})]})})]})}export{be as default};
|