graview 0.1.58 → 0.1.60
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 +4 -2
- package/dist/preview/chunk.2K4TT2BV.js +1 -0
- package/dist/preview/{chunk.OHQ3JH65.js → chunk.2USDHXB4.js} +1 -1
- package/dist/preview/{chunk.F7SF6EP2.js → chunk.37TVS7CA.js} +1 -1
- package/dist/preview/chunk.3IZ3ABII.js +1 -0
- package/dist/preview/{chunk.NKC3JILT.js → chunk.3MOJF7BA.js} +1 -1
- package/dist/preview/{chunk.IDJPBWL2.js → chunk.3UOKUF5Z.js} +1 -1
- package/dist/preview/{chunk.2VYNNWW5.js → chunk.3V4WP7RY.js} +3 -3
- package/dist/preview/{chunk.WNSC3RWD.js → chunk.3XGA65Y3.js} +1 -1
- package/dist/preview/{chunk.D5KTGX7F.js → chunk.3ZT5WQYL.js} +1 -1
- package/dist/preview/{chunk.IULQRCEE.js → chunk.4LR64TPU.js} +1 -1
- package/dist/preview/chunk.4MP72LPR.js +25 -0
- package/dist/preview/{chunk.GQBJVCSM.js → chunk.4TCKEG6I.js} +1 -1
- package/dist/preview/chunk.5DD62IOW.js +21 -0
- package/dist/preview/{chunk.KJ264E6K.js → chunk.5YOLUDVO.js} +1 -1
- package/dist/preview/{chunk.EB4NVTJL.js → chunk.67U6M7OV.js} +1 -1
- package/dist/preview/{chunk.XU34T2H4.js → chunk.6C2MHWSX.js} +1 -1
- package/dist/preview/{chunk.ILRCNTGT.js → chunk.6HF6POIX.js} +1 -1
- package/dist/preview/{chunk.U6O3MMQR.js → chunk.6WHAWOO7.js} +1 -1
- package/dist/preview/{chunk.GKSUTAIX.js → chunk.6ZQAR5ZA.js} +1 -1
- package/dist/preview/{chunk.EPPXZZPK.js → chunk.7MHCGVGM.js} +1 -1
- package/dist/preview/{chunk.MQ5HBUBL.js → chunk.7N32AVIJ.js} +1 -1
- package/dist/preview/{chunk.7V23SXGJ.js → chunk.7OPM55I2.js} +1 -1
- package/dist/preview/chunk.7TFLRR7D.js +1 -0
- package/dist/preview/{chunk.LDAYDCUO.js → chunk.7VKSXGTX.js} +1 -1
- package/dist/preview/{chunk.KJHPDL4N.js → chunk.A3ZXDG6V.js} +1 -1
- package/dist/preview/{chunk.27CW6SCT.js → chunk.A5PDXNY6.js} +1 -1
- package/dist/preview/chunk.AVBTPSQF.js +1 -0
- package/dist/preview/{chunk.YZZONE4M.js → chunk.BF6S5UE4.js} +1 -1
- package/dist/preview/chunk.BLPYNNR4.js +1 -0
- package/dist/preview/{chunk.LRUNFSHP.js → chunk.BQIHNT7C.js} +1 -1
- package/dist/preview/{chunk.O4CVKTPJ.js → chunk.BRT27WON.js} +1 -1
- package/dist/preview/{chunk.HMFJT4KO.js → chunk.BXDM3UMN.js} +1 -1
- package/dist/preview/chunk.BYKD5RLA.js +1 -0
- package/dist/preview/chunk.C7OLSEWK.js +1 -0
- package/dist/preview/{chunk.3OYGXYQY.js → chunk.CC5BJH5A.js} +1 -1
- package/dist/preview/{chunk.GCBZ3WE2.js → chunk.CFKZXLXS.js} +1 -1
- package/dist/preview/chunk.CMN6BBAD.js +1 -0
- package/dist/preview/{chunk.YP2F5UGY.js → chunk.CQT3W2SF.js} +1 -1
- package/dist/preview/chunk.D7YSL3NK.js +2 -0
- package/dist/preview/chunk.DCHQHKSA.js +1 -0
- package/dist/preview/{chunk.H3BFHI3G.js → chunk.EL5ICOOM.js} +1 -1
- package/dist/preview/{chunk.PZG3B7F4.js → chunk.ENL2JJ47.js} +1 -1
- package/dist/preview/chunk.EQXB7LKI.js +1 -0
- package/dist/preview/{chunk.ELAMMS2V.js → chunk.ERFT54HT.js} +1 -1
- package/dist/preview/{chunk.XN2RVXOI.js → chunk.F6V7RWDK.js} +1 -1
- package/dist/preview/{chunk.64R3K2OE.js → chunk.FBJARKDT.js} +1 -1
- package/dist/preview/{chunk.SDLUWRGI.js → chunk.FC6AF6CC.js} +1 -1
- package/dist/preview/{chunk.GZB6A6KF.js → chunk.FFTYMBBT.js} +1 -1
- package/dist/preview/chunk.FLUK3UXF.js +1 -0
- package/dist/preview/{chunk.KFQSYCY3.js → chunk.FRYBMS3W.js} +1 -1
- package/dist/preview/chunk.G3R4BTI7.js +1 -0
- package/dist/preview/chunk.G4YJPKRG.js +5 -0
- package/dist/preview/{chunk.BB33TI4S.js → chunk.GLWSVSQL.js} +1 -1
- package/dist/preview/{chunk.SDVPJYVF.js → chunk.GNBIVVL3.js} +1 -1
- package/dist/preview/{chunk.ZN5HTWSI.js → chunk.GTKJJYQH.js} +1 -1
- package/dist/preview/{chunk.TUUVVO5U.js → chunk.H45Q3O4F.js} +1 -1
- package/dist/preview/{chunk.M34CS7DI.js → chunk.HDP3PS7N.js} +1 -1
- package/dist/preview/{chunk.CCWPF5PK.js → chunk.HDUO2USQ.js} +1 -1
- package/dist/preview/{chunk.PBCNOFQH.js → chunk.HUJ6YTWE.js} +1 -1
- package/dist/preview/{chunk.JB7TTJXQ.js → chunk.I4XQBQRC.js} +1 -1
- package/dist/preview/chunk.IBOKXVWN.js +1 -0
- package/dist/preview/{chunk.4HSH2UIK.js → chunk.IGJZ4UH3.js} +2 -2
- package/dist/preview/{chunk.WNQFHMNR.js → chunk.IGVASEZU.js} +1 -1
- package/dist/preview/{chunk.7SQAKSJD.js → chunk.IHBUBZQT.js} +1 -1
- package/dist/preview/chunk.IOK4GVJC.js +1 -0
- package/dist/preview/{chunk.I3WWCPQ2.js → chunk.JEYQBH33.js} +1 -1
- package/dist/preview/{chunk.S2H7B6RG.js → chunk.JJGCTGWA.js} +1 -1
- package/dist/preview/{chunk.E5MSFXL6.js → chunk.JPONLMU7.js} +1 -1
- package/dist/preview/{chunk.QPXXY2DL.js → chunk.KBVTLNS5.js} +3 -3
- package/dist/preview/{chunk.HS3GHAUR.js → chunk.KDRLUBVF.js} +1 -1
- package/dist/preview/{chunk.YIA2EDVF.js → chunk.KGW75Z5L.js} +1 -1
- package/dist/preview/{chunk.KWJWAIQJ.js → chunk.KI37ZEV3.js} +1 -1
- package/dist/preview/chunk.L6AWE76F.js +1 -0
- package/dist/preview/{chunk.LY3YOWKV.js → chunk.LGEA5257.js} +1 -1
- package/dist/preview/{chunk.TF5I4VHX.js → chunk.LLYRFVIN.js} +1 -1
- package/dist/preview/{chunk.WQOI6BLM.js → chunk.LQVAABPS.js} +1 -1
- package/dist/preview/{chunk.POBMGM3X.js → chunk.LSY256J4.js} +1 -1
- package/dist/preview/{chunk.HEWVPXRE.js → chunk.LZIBQ3VX.js} +1 -1
- package/dist/preview/{chunk.7MSFDD7J.js → chunk.M4UD4ARP.js} +1 -1
- package/dist/preview/chunk.MDJWK5W2.js +1 -0
- package/dist/preview/{chunk.4AFFPYOK.js → chunk.MJVYWLQQ.js} +1 -1
- package/dist/preview/{chunk.3YZHZGTM.js → chunk.MSWWWLEA.js} +1 -1
- package/dist/preview/{chunk.BTVBZ6KE.js → chunk.MVWC3VR3.js} +2 -2
- package/dist/preview/{chunk.B2GVJD6H.js → chunk.NC7FXY2H.js} +1 -1
- package/dist/preview/{chunk.LCPGZK7G.js → chunk.NGTRL5U4.js} +1 -1
- package/dist/preview/{chunk.NOFWGDOT.js → chunk.NHUQ2N6J.js} +1 -1
- package/dist/preview/{chunk.LL2MLSPH.js → chunk.OLFJH4RK.js} +1 -1
- package/dist/preview/{chunk.WXIEQZLY.js → chunk.P6RORYOT.js} +1 -1
- package/dist/preview/{chunk.SPXRLO5K.js → chunk.PFSYXD6Q.js} +1 -1
- package/dist/preview/chunk.PHJ6WPWH.js +1 -0
- package/dist/preview/{chunk.QGV7H7RQ.js → chunk.PI44XMY2.js} +1 -1
- package/dist/preview/{chunk.ZOHMWSHD.js → chunk.PNW5K7BW.js} +1 -1
- package/dist/preview/chunk.Q355UPFG.js +1 -0
- package/dist/preview/{chunk.GEB2DFBU.js → chunk.QBLKTFF4.js} +1 -1
- package/dist/preview/{chunk.HXRV3WVJ.js → chunk.QDSEVPF3.js} +1 -1
- package/dist/preview/chunk.QFUMFQJU.js +1 -0
- package/dist/preview/{chunk.B3WZHPM3.js → chunk.QHDCTAD7.js} +1 -1
- package/dist/preview/{chunk.UAP5M3CD.js → chunk.QI4SLPQ4.js} +2 -2
- package/dist/preview/{chunk.HZB5F476.js → chunk.RQOX5YDW.js} +1 -1
- package/dist/preview/{chunk.TBW7CU4G.js → chunk.RXYNW5QB.js} +1 -1
- package/dist/preview/{chunk.RE7DELSR.js → chunk.SB2PZKN5.js} +1 -1
- package/dist/preview/{chunk.INZQ6WZM.js → chunk.SRVQJZRT.js} +1 -1
- package/dist/preview/{chunk.TJ647W6J.js → chunk.T7LQD67N.js} +2 -2
- package/dist/preview/chunk.TAT2IQUR.js +1 -0
- package/dist/preview/chunk.TFWIG6LL.js +6 -0
- package/dist/preview/{chunk.GP7F3PEF.js → chunk.TKVLNBRD.js} +1 -1
- package/dist/preview/{chunk.YHTE34RN.js → chunk.TLJOZSDD.js} +1 -1
- package/dist/preview/{chunk.6W7O5YLL.js → chunk.TLWT67ON.js} +1 -1
- package/dist/preview/{chunk.KKNDX4JT.js → chunk.TY4GQJKC.js} +1 -1
- package/dist/preview/{chunk.EQTSV7BK.js → chunk.UITT6JWW.js} +1 -1
- package/dist/preview/{chunk.LO3U3P55.js → chunk.UJTE7UAP.js} +1 -1
- package/dist/preview/{chunk.DBZHRYBK.js → chunk.ULL6ZIJJ.js} +1 -1
- package/dist/preview/{chunk.VUPLFUUS.js → chunk.UQWTZJBV.js} +1 -1
- package/dist/preview/{chunk.NFX24NUI.js → chunk.URWAFZHF.js} +1 -1
- package/dist/preview/{chunk.A6C4AGJJ.js → chunk.VADQ7ZGA.js} +1 -1
- package/dist/preview/chunk.VDMDPZ6U.js +1 -0
- package/dist/preview/{chunk.2EDC63RI.js → chunk.VFOON3Z3.js} +1 -1
- package/dist/preview/{chunk.4444RPWW.js → chunk.VMV464JK.js} +1 -1
- package/dist/preview/{chunk.4KC35UNR.js → chunk.VNDKKTED.js} +4 -2
- package/dist/preview/chunk.VSCIXAHN.js +5 -0
- package/dist/preview/{chunk.34TW32TB.js → chunk.VUBNBTJP.js} +2 -2
- package/dist/preview/{chunk.JUNMJYH5.js → chunk.VWJGQDCE.js} +1 -1
- package/dist/preview/{chunk.KXPRILAO.js → chunk.VZJWJ5XM.js} +1 -1
- package/dist/preview/{chunk.5ICIMQE6.js → chunk.W3W54DSX.js} +1 -1
- package/dist/preview/{chunk.YD3TKV6P.js → chunk.WC3DENU4.js} +2 -2
- package/dist/preview/chunk.WQ6RCEUQ.js +1 -0
- package/dist/preview/{chunk.YS6GVLIP.js → chunk.WXUFATY5.js} +1 -1
- package/dist/preview/chunk.X6A4VSSD.js +1 -0
- package/dist/preview/{chunk.VHSWBFXB.js → chunk.XGASJAV2.js} +1 -1
- package/dist/preview/{chunk.RRKYJYZJ.js → chunk.XR6YR6RV.js} +1 -1
- package/dist/preview/chunk.XZPKBHJT.js +1 -0
- package/dist/preview/{chunk.GDOTG7YA.js → chunk.Y5C4RXG7.js} +1 -1
- package/dist/preview/{chunk.JES77WXG.js → chunk.Y7G3OGDE.js} +1 -1
- package/dist/preview/{chunk.E34OQVSR.js → chunk.YEBGI6ED.js} +1 -1
- package/dist/preview/{chunk.TWKXSLYY.js → chunk.YFSBVZTG.js} +1 -1
- package/dist/preview/chunk.YFVJUHAK.js +1 -0
- package/dist/preview/chunk.YH63KQ2G.js +1 -0
- package/dist/preview/{chunk.LMN4TSAP.js → chunk.YZ7FUKAL.js} +1 -1
- package/dist/preview/{chunk.JGKA5QBX.js → chunk.Z2ERZ4S6.js} +1 -1
- package/dist/preview/{chunk.VG7OWV2H.js → chunk.ZP5RT2EK.js} +1 -1
- package/dist/preview/{chunk.ETBFD76E.js → chunk.ZXOT3IXJ.js} +1 -1
- package/dist/preview/{chunk.TJOXNEFU.js → chunk.ZYM2SSGW.js} +1 -1
- package/dist/preview/index.html +51 -51
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.32FMOHZK.js +0 -1
- package/dist/preview/chunk.3FCOFEGW.js +0 -1
- package/dist/preview/chunk.43OKZU73.js +0 -1
- package/dist/preview/chunk.47JQPYXL.js +0 -2
- package/dist/preview/chunk.4GGPPCMM.js +0 -1
- package/dist/preview/chunk.4Y2JTY6Q.js +0 -1
- package/dist/preview/chunk.6K7EN2YI.js +0 -1
- package/dist/preview/chunk.6VC6AGYV.js +0 -5
- package/dist/preview/chunk.7BBGRTXM.js +0 -5
- package/dist/preview/chunk.7ECBGIUK.js +0 -1
- package/dist/preview/chunk.ACYDJQRC.js +0 -1
- package/dist/preview/chunk.ARWBIBSI.js +0 -6
- package/dist/preview/chunk.BKVBX2YB.js +0 -1
- package/dist/preview/chunk.DM767F2Q.js +0 -21
- package/dist/preview/chunk.ELERUERU.js +0 -1
- package/dist/preview/chunk.GUEHKCWN.js +0 -1
- package/dist/preview/chunk.HT2BEOEV.js +0 -25
- package/dist/preview/chunk.JOAN54PN.js +0 -1
- package/dist/preview/chunk.L7V24JPO.js +0 -1
- package/dist/preview/chunk.LA4CPZ2N.js +0 -1
- package/dist/preview/chunk.MV3AJ7JH.js +0 -1
- package/dist/preview/chunk.MYNQWWCL.js +0 -1
- package/dist/preview/chunk.OASYYMG5.js +0 -1
- package/dist/preview/chunk.PM3SYXKB.js +0 -1
- package/dist/preview/chunk.QB25SMP6.js +0 -1
- package/dist/preview/chunk.R7LFO7KI.js +0 -1
- package/dist/preview/chunk.S5MGE2U5.js +0 -1
- package/dist/preview/chunk.TXGNPW76.js +0 -1
- package/dist/preview/chunk.UGFDSE37.js +0 -1
- package/dist/preview/chunk.UKMVJV6Q.js +0 -1
- package/dist/preview/chunk.UUG3BYVN.js +0 -1
- package/dist/preview/chunk.WJFQIE3Y.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.I3WWCPQ2.js";import"./chunk.BTVBZ6KE.js";import"./chunk.3OYGXYQY.js";import"./chunk.UAP5M3CD.js";import"./chunk.GCBZ3WE2.js";import"./chunk.GDOTG7YA.js";import"./chunk.EPPXZZPK.js";import"./chunk.KFQSYCY3.js";import"./chunk.WQOI6BLM.js";import"./chunk.LCPGZK7G.js";import"./chunk.NKC3JILT.js";import"./chunk.HEWVPXRE.js";import"./chunk.HJCQ6I3S.js";import"./chunk.HXRV3WVJ.js";import"./chunk.MQ5HBUBL.js";import"./chunk.7SQAKSJD.js";import"./chunk.43OKZU73.js";import"./chunk.WNSC3RWD.js";import"./chunk.ACYDJQRC.js";import"./chunk.S5MGE2U5.js";import"./chunk.34TW32TB.js";import"./chunk.LL2MLSPH.js";import"./chunk.EB4NVTJL.js";import"./chunk.VG7OWV2H.js";import"./chunk.KXPRILAO.js";import"./chunk.BB33TI4S.js";import"./chunk.2EDC63RI.js";import"./chunk.WVUJXDXZ.js";import"./chunk.LDAYDCUO.js";import"./chunk.KKNDX4JT.js";import"./chunk.GKSUTAIX.js";import"./chunk.5ICIMQE6.js";import"./chunk.QGV7H7RQ.js";import"./chunk.YIA2EDVF.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as B,g as ne,h as ie}from"./chunk.HS3GHAUR.js";import{a as Z,b as ee,c as te}from"./chunk.ZOHMWSHD.js";import{b}from"./chunk.PZG3B7F4.js";import{d as D}from"./chunk.WNSC3RWD.js";import{a as X}from"./chunk.KXPRILAO.js";import{a as I}from"./chunk.3YZHZGTM.js";import{j as Q}from"./chunk.YD3TKV6P.js";import{G as U,Ga as _,J as G,O,P as T,Ra as J,T as V,Va as K,ba as w,ja as Y}from"./chunk.HT2BEOEV.js";import{a as P}from"./chunk.SDO3U72B.js";import{$a as q,_a as z,da as E,ga as F,zb as x}from"./chunk.7BBGRTXM.js";import{b as L}from"./chunk.AJZBJBMO.js";var y=L(U(),1);var ae=L(U(),1);function re(){let{ai:i,aiDesk:n}=w(),{entries:r}=G(n),a=i.off===!0;return(0,ae.useEffect)(()=>{a||n.load()},[n,a]),a?[]:r}var e=L(V(),1),se=_(P(()=>(__graviewPreload(import.meta.url,["./chunk.E34OQVSR.js","./chunk.CCWPF5PK.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4GGPPCMM.js")))),he=se.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),ce=se.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),ye=i=>i.undoes===void 0&&i.primitives.some(n=>n.op==="remove-node"||n.op==="patch-node"&&n.after[q]===!0&&n.before[q]!==!0);function fe(i){let n=[...new Set(i.ops.filter(r=>!x(r)&&ye(r)).map(r=>r.intent))].filter(r=>r!==i.intent);return n.length===0?i.intent:`${i.intent} \u2014 ${n.join("; ")}`}var oe=(i,n,r=de(i,[n]))=>({intent:fe(n),author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:X(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!x(a)).flatMap(a=>a.writes))],...ve(n.ops.filter(a=>!x(a)).flatMap(a=>a.writes),r),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(x)?{withheld:!0}:{}});function me(i=4){let{store:n,principal:r}=w(),a=T(n,r),d=a.log.length;return(0,y.useMemo)(()=>{let s=a.batches(),l=de(a,s);return ee(s,o=>a.log.get(o)).reverse().slice(0,i).map(o=>{if("batch"in o){let p=oe(a,o.batch,l);return o.typed?{...p,intent:Z(o.typed,a.schema,a.graph),batches:o.typed.batches.filter(c=>!c.undone).map(c=>c.id)}:p}let u=[...o.digest.batches].reverse().map(p=>oe(a,p,l));return{intent:te(o.digest),author:o.digest.author.kind,...o.digest.author.id?{authorId:o.digest.author.id}:{},by:o.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[a,d,i])}function de(i,n){let r=new Map;for(let a of n)for(let d of a.ops)if(!x(d))for(let s of d.primitives)(s.op==="add-node"||s.op==="remove-node")&&s.node&&r.set(s.node.id,F(i.schema.tryDefinition(s.node.kind),s.node));return r}function ve(i,n){let r={};for(let a of i){let d=n.get(a);d!==void 0&&(r[a]=d)}return Object.keys(r).length>0?{named:r}:{}}function we({change:i}){let{store:n,principal:r,seats:a,people:d}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||r.id===void 0||i.authorId===r.id)?"you":z(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:a,people:d}),I(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(i.via)]}):null]})}function be({change:i,goes:n}){let{store:r}=w(),[a,d]=(0,y.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(we,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":a,onClick:()=>d(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:a?"Hide":"Show each"})]}),a?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(j,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:l.touched.slice(0,4).map(o=>(0,e.jsx)(M,{id:o,label:r.graph.has(o)?b(r,o):l.named?.[o]??b(r,o),go:n(o)},o))}):null]},l.batch))}):null]})}function j({batch:i}){let{store:n,principal:r,noteSeat:a}=w(),d=T(n,r),s=O()?.open??!1,l=d.log.length,[o,u]=(0,y.useState)(null),p=(0,y.useMemo)(()=>d.canUndo(i),[d,i,l]);if(s||!p.ok&&p.ops.length===0)return null;let c=!p.ok,k=c?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:c?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof i=="string"?[i]:i,S=d.log.all().find(C=>v.includes(C.batch)&&C.author.kind==="agent");d.undo(c?[...v,...k]:typeof i=="string"?i:[...i],{author:r}),S&&a({type:"home",author:S.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...c?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:c?`undo +${k.length}`:"undo"}),o?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:o}):null]})}function ke({seq:i,intent:n}){let r=O();if(!r)return null;let a=r.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":a,onPointerEnter:B,onFocus:B,onClick:()=>r.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function xe(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function M({id:i,label:n,go:r}){return r?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>r(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(D,{label:n})}):(0,e.jsx)(D,{label:n})}function Be({calls:i,seat:n,remembers:r=!1}){let a=me(),{store:d,principal:s,seats:l,people:o}=w(),u=re(),[p,c]=(0,y.useState)("all"),[k,v]=(0,y.useState)(!1),S=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,C=new Set(u.map(t=>t.id)),le=a.filter(t=>!(t.interaction!==void 0&&C.has(t.interaction))&&(!k||S(t.by))),pe=u.filter(t=>!k||S(t.by)).slice(0,4),R=[...p==="ai"?[]:le.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:pe.map(t=>({at:t.at,entry:t}))].sort((t,f)=>t.at<f.at?1:t.at>f.at?-1:0),m=T(d,s),H=i.some(t=>t.phase==="running"),ge=ne(),A=K("activity"),N=A.open,ue=Y(),$=O(),W=t=>m.graph.has(t)?f=>{A.setOpen(!1),$?.past&&$.show(null),ue.record(f)}:null;return n===void 0&&i.length===0&&a.length===0&&u.length===0&&!r&&ge===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...A.trigger,onClick:A.toggle,title:H?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:H?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[H?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!N&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,N?(0,e.jsxs)("section",{...A.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...J,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...Q,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||R.length>0?9:0,...i.length>0||R.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,f)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??E(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(M,{id:g,label:b(m,g),go:W(g)},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,h])=>(0,e.jsx)(M,{id:h,label:b(m,h),go:W(h)},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${f}`))}):null,u.length>0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(ce,{shows:p,onShows:c,mine:k,onMine:v})}):null,R.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:R.map(({change:t,entry:f},g)=>f!==void 0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(he,{entry:f,undo:h=>(0,e.jsx)(j,{batch:h})})},`ai:${f.id}`):t.digest?(0,e.jsx)(be,{change:t,goes:W},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":z(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:o}),I(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(ke,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(j,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(h=>(0,e.jsx)(M,{id:h,label:m.graph.has(h)?b(m,h):t.named?.[h]??b(m,h),go:W(h)},h))})]},`change:${g}`))}):null,(0,e.jsx)(ie,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),r?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(xe,{})]}):null]}):null]})}export{j as a,Be as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as k,Ga as o,T as n}from"./chunk.HT2BEOEV.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.LDAYDCUO.js","./chunk.KKNDX4JT.js","./chunk.GKSUTAIX.js","./chunk.5ICIMQE6.js","./chunk.QGV7H7RQ.js","./chunk.YIA2EDVF.js","./chunk.GZHZLJBF.js","./chunk.ELERUERU.js","./chunk.OJGHDWI6.js","./chunk.YHTE34RN.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.YZZONE4M.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.ELERUERU.js","./chunk.OJGHDWI6.js","./chunk.YHTE34RN.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.H3BFHI3G.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.ELERUERU.js","./chunk.OJGHDWI6.js","./chunk.YHTE34RN.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VUPLFUUS.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.B3WZHPM3.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk.R7LFO7KI.js";import"./chunk.HS3GHAUR.js";import"./chunk.ZOHMWSHD.js";import"./chunk.PZG3B7F4.js";import"./chunk.LRUNFSHP.js";import"./chunk.WNSC3RWD.js";import"./chunk.S5MGE2U5.js";import"./chunk.KXPRILAO.js";import{b as n}from"./chunk.E34OQVSR.js";import"./chunk.CCWPF5PK.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{T as i}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function d(e,n){if(e.past)return;let a=e.batches();for(let i=a.length-1;i>=0;i--){let t=a[i];if(t.undone||t.ops.length===0||t.ops.every(o=>o.undoes!==void 0))continue;let c=t.author;if(!(c.kind==="human"&&(n?.id===void 0||c.id===void 0||c.id===n.id)))continue;let r=e.canUndo(t.id);if(!(!r.ok||!r.ops.every(o=>!o.mutation||e.permits(o.mutation,n).ok)))return{batch:t.id,intent:t.intent}}}function f(e,n,a){let i=d(e,n);return i&&e.batches().slice(a).some(t=>t.id===i.batch)?i:void 0}var h=e=>`Take back \u201C${e.intent}\u201D`;function m(e,n){let a=d(e,n);return a&&e.undo(a.batch,n?{author:n}:{}),a}function l(e){let n=e.target;return!e.defaultPrevented&&!e.altKey&&!e.shiftKey&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&!(n instanceof HTMLElement&&(n.isContentEditable||n.matches("input, textarea, select")))}export{d as a,f as b,h as c,m as d,l as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{G as l,N as p,U as k,W as y,c}from"./chunk.TWKXSLYY.js";import"./chunk.6VC6AGYV.js";import{b as m}from"./chunk.IDJPBWL2.js";import"./chunk.UGFDSE37.js";import"./chunk.BTVBZ6KE.js";import"./chunk.3OYGXYQY.js";import"./chunk.GCBZ3WE2.js";import"./chunk.GDOTG7YA.js";import"./chunk.EPPXZZPK.js";import"./chunk.KFQSYCY3.js";import"./chunk.WQOI6BLM.js";import"./chunk.LCPGZK7G.js";import"./chunk.NKC3JILT.js";import"./chunk.HEWVPXRE.js";import"./chunk.LMN4TSAP.js";import"./chunk.HS3GHAUR.js";import"./chunk.LRUNFSHP.js";import"./chunk.43OKZU73.js";import"./chunk.WNSC3RWD.js";import"./chunk.ACYDJQRC.js";import"./chunk.S5MGE2U5.js";import"./chunk.34TW32TB.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.LDAYDCUO.js";import"./chunk.KKNDX4JT.js";import"./chunk.GKSUTAIX.js";import"./chunk.5ICIMQE6.js";import"./chunk.QGV7H7RQ.js";import"./chunk.YIA2EDVF.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{G as S,H as s,I as d,T as f,ca as g}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.7SQAKSJD.js";import"./chunk.EB4NVTJL.js";import"./chunk.BB33TI4S.js";import"./chunk.LDAYDCUO.js";import"./chunk.KKNDX4JT.js";import"./chunk.GKSUTAIX.js";import"./chunk.5ICIMQE6.js";import"./chunk.QGV7H7RQ.js";import"./chunk.YIA2EDVF.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Ee,b as Ve,c as qe,d as me,e as R,f as ge,h as Be}from"./chunk.GUEHKCWN.js";import{h as Ze,i as We,j as Ye}from"./chunk.GKSUTAIX.js";import{a as re,b as ae,c as J,d as Ue,e as X,g as oe,h as He}from"./chunk.QGV7H7RQ.js";import{c as Ce,h as z,i as Le,j as ue}from"./chunk.YIA2EDVF.js";import{A as De,Ca as Ne,Db as bn,Ja as Te,Ka as te,La as pe,Ub as Me,Vb as fe,Wb as Ke,Xb as _e,Yb as Ie,b as W,c as U,e as de,f as Re,g as K,h as S,k as G,l as ee,m as _,n as Fe,nc as Pe,o as Z,oc as Ge,p as N,r as w,s as ne,t as x,u as A,v as V,w as I,x as t,y as T,z as Y}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var ze=e=>Object.entries(e).map(([o,s])=>[o,Object.keys(te(s?.edges))]),ye=(e,o)=>Ke(e,ze(o));function Je(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(o=>Me(o)),..._e(ze(e.kinds))]}var B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Xe(e){if(!B(e)||!B(e.kinds))return e;let o;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,a])=>[g,B(a)&&B(a.edges)?{edges:a.edges}:{}]));o=Je({acts:B(e.acts)?e.acts:{},kinds:f})}catch{return e}let s=new Set(o),n=!1,r=f=>{if(typeof f!="string"||s.has(f))return f;let g=Pe(f,o);return g===void 0?f:(n=!0,g)},l=B(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>B(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(r)}:f)}:void 0,u=B(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,B(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(a=>B(a)?{...a,act:r(a.act)}:a)}:g])):void 0;return n?{...e,...l?{policy:l}:{},...u?{rules:u}:{}}:e}function he(e,o){let s=Ge(e,Je(o));return s&&s!==e?`did you mean "${s}"?`:void 0}var $e="graview-document",we=1,Se=256*1024,se=64*1024,ke=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,be=/^[a-z][A-Za-z0-9]*$/,$n=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,Qe=12,wn=new Set(["id","kind"]),Sn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,On=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function jn(){let e=$=>$ in Object.prototype,o=Y($=>!e($),"every object already has this name \u2014 choose another"),s=($,L)=>[...$===void 0?[]:[Re($)],...L===void 0?[]:[de(L)]],n=($,L)=>S().check(...s($,L)),r=($,L,Q)=>N($).check(...s(L,Q)),l=$=>S().check(K(ke,`${$} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=S().check(K(Sn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),o),f=S().check(K(be,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y($=>!wn.has($),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),o),g=n(1,500),a=S().check(de(40),K($n,'an alias is up to three lower-case words, like "supplier"')),i=n(1,2e3),d=n(1,300),h=w({type:V(On),required:t(_()),description:t(g),label:t(n(1,60)),aliases:t(r(a,1,Qe)),options:t(r(n(1,80),1,100)),optionLabels:t(A(n(1,80),n(1,80))),of:t(V(["string","number","date","image","video","file"])),default:t(Z()),unit:t(n(void 0,12)),format:t(V(["money","percent","duration","markdown"])),min:t(G()),max:t(G()),step:t(G()),renamedFrom:t(S().check(K(be))),repeats:t(_()),collaborative:t(_())}).check(De(($,L)=>{$.type==="enum"&&!$.options&&L.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),$.type!=="enum"&&$.options&&L.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]});for(let Q of Object.keys($.optionLabels??{}))$.options?.includes(Q)||L.addIssue({code:"custom",message:`"${Q}" is labeled, and is none of the field's options`,path:["optionLabels",Q]});$.type!=="list"&&$.of&&L.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),$.repeats&&$.type!=="date"&&$.type!=="datetime"&&L.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=S().check(K(new RegExp(`${ke.source}|${Ne.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),p=w({to:x([r(m,1),I("*")]),cardinality:t(V(["one","many"])),description:t(g),inverse:t(n(1,80)),appendOnly:t(_()),renamedFrom:t(S()),tidying:t(I("never"))}),c=x([i,w({expr:i,label:t(n(1,60)),description:t(g),format:t(V(["money","percent","duration"])),unit:t(n(1,12)),hidden:t(_())})]),j=w({noun:t(n(1,40)),plural:t(n(1,40)),aliases:t(r(a,1,Qe)),description:t(g),fields:A(f,h).check(Y($=>Object.keys($).length>0,"a kind has at least one field")),label:t(d),describe:t(d),lifecycle:t(w({field:f,retired:r(x([S(),G(),_()]),1)})),figure:t(n(void 0,2e4)),glance:t(r(f,1,20)),page:t(w({fields:t(r(f,1,40)),groups:t(r(w({title:n(1,60),fields:r(f,1,40)}),1,12))})),edges:t(A(u,p)),computed:t(A(S(),c).check(Y($=>Object.keys($).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:t(A(S(),S())),renamedFrom:t(S().check(K(ke))),people:t(_()),archives:t(I(!1)),tidying:t(V(["never","no-links"]))}),k=x([S(),G(),_(),Fe(),N(Z()),w({expr:i})]),O=S().check(K(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),E=x([w({create:l("kind"),as:t(S().check(K(be))),set:t(A(f,k))}),w({set:A(f,k),target:t(O)}),w({connect:u,from:O,to:O}),w({sever:u,from:O,to:O}),w({remove:O})]),b=w({title:t(n(1,80)),description:t(g),fromTheOtherEnd:t(n(1,80)),on:t(x([l("kind"),r(l("kind"),1)])),creates:t(l("kind")),sets:t(A(f,k)),writes:t(r(f,1)),connects:t(u),severs:t(u),setsOther:t(A(f,k)),replaces:t(x([I(!0),r(u,1,10)])),removes:t(I(!0)),args:t(A(f,h)),effects:t(r(E,1,20)),allowedWhen:t(i),refusal:t(d),destructive:t(_())}),F=w({act:l("act"),label:t(n(1,80)),args:t(A(S(),k))}),M=w({title:t(n(1,120)),description:t(g),over:x([I("graph"),l("kind")]),when:t(i),require:i,says:t(d),repairs:t(r(F,void 0,10))}),C=w({roles:x([r(l("role"),1),I("*")]),mutations:x([r(l("act"),1),I("*")]),kinds:t(x([N(l("kind")),I("*")])),describe:t(g),self:t(_()),ownEnd:t(_())}),y=t(r(l("field"),1)),v=w({roles:x([r(l("role"),1),I("*")]),kinds:r(l("kind"),1),own:t(_()),via:t(u),fields:y,hide:y}),D=w({grants:N(C),sees:t(N(v))}),ie=w({accent:t(S().check(K(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:t(x([S().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),w({light:t(S().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:t(S().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:t(n(1,60)),currency:t(S().check(K(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:t(n(2,35)),timeZone:t(n(1,64)),logo:t(x([n(1,se),w({src:n(1,se),alt:t(n(1,120))}),w({light:n(1,se),dark:t(n(1,se)),alt:t(n(1,120)),darkFallback:t(I("invert"))})])),favicon:t(x([n(1,se),w({emoji:S()})])),typography:t(w({display:t(n(1,200)),body:t(n(1,200)),mono:t(n(1,200))})),shape:t(w({radius:t(G().check(U(0),W(32))),density:t(G().check(U(.75),W(1.5)))})),accents:t(A(S(),G().check(U(0),W(360)))),scheme:t(V(["light","dark","auto"])),subtitle:t(I(!1))}),q=A(S(),Z()),H=x([n(1,120),w({by:n(1,120),direction:t(V(["asc","desc"]))})]),xe=G().check(ee(),U(1),W(9999)),mn=ne({create:t(_()),options:t(ne({sort:t(H),columnSort:t(H),search:t(r(n(1,120),void 0,40)),filters:t(r(n(1,120),void 0,40)),horizon:t(x([G().check(ee(),U(1),W(200)),ne({years:G().check(ee(),U(1),W(200)),title:n(1,80),from:t(xe),to:t(xe)})]))}))}),gn=w({card:t(N(Z())),row:t(N(Z())),page:t(N(Z()))}),zn=()=>{let $=t(V(["asc","desc"]));return x([n(1,120),w({by:n(1,120),direction:$,then:t(x([n(1,120),w({by:n(1,120),direction:$})]))})])},yn=()=>x([n(1,120),w({by:n(1,120),order:t(r(n(1,80),void 0,40)),closed:t(r(n(1,80),void 0,40))})]),Ae=ne({order:t(N(S())),hide:t(N(S())),first:t(S()),primary:t(r(n(1,80),void 0,40)),scene:t(n(1,40)),pages:t(n(1,40)),lists:t(A(S(),w({filters:t(r(n(1,120),void 0,40)),sort:t(zn()),group:t(yn()),export:t(_())})))}),hn=w({act:l("act"),title:t(n(1,80)),intro:t(g),fields:t(r(f,1,40)),say:t(g),submit:t(n(1,80)),role:t(l("role"))}),kn=w({$schema:t(S()),format:I($e),formatVersion:I(we),name:n(1,80),description:t(g),version:t(G().check(ee(),U(1))),kinds:A(l("kind"),j).check(Y($=>Object.keys($).length>0,"a document declares at least one kind"),Y($=>Object.keys($).length<=40,"a document declares at most 40 kinds")),computed:t(A(S(),c)),acts:t(A(l("act"),b)),rules:t(A(l("rule"),M)),roles:t(N(l("role"))),policy:t(D),modules:t(q),lenses:t(N(mn)),pages:t(Ae),views:t(A(S(),x([gn,N(Z())]))),brand:t(ie),settings:t(N(q)),migrations:t(N(q)),connections:t(A(l("connection"),q)),purpose:t(q),forms:t(A(l("form"),hn)),publishing:t(w({mode:V(["live","on-publish"]),working:r(l("role"),void 0,40),publishers:t(r(l("role"),1,40))}))});return{FieldSpec:h,EdgeSpec:p,ComputedSpec:c,KindSpec:j,ValueSpec:k,EffectSpec:E,ActSpec:b,RepairSpec:F,RuleSpec:M,GrantSpec:C,SightSpec:v,PolicySpec:D,BrandSpec:ie,PagesSpec:Ae,DocumentSpec:kn}}var vn,P=()=>vn??=jn(),Un=T(()=>P().FieldSpec),Zn=T(()=>P().EdgeSpec),Wn=T(()=>P().ComputedSpec),Yn=T(()=>P().KindSpec),Hn=T(()=>P().ValueSpec),Jn=T(()=>P().EffectSpec),Xn=T(()=>P().ActSpec),Qn=T(()=>P().RepairSpec),et=T(()=>P().RuleSpec),nt=T(()=>P().GrantSpec),tt=T(()=>P().SightSpec),ot=T(()=>P().PolicySpec),st=T(()=>P().BrandSpec),it=T(()=>P().PagesSpec),en=T(()=>P().DocumentSpec);var xn={};function nn(e,o=xn,s=we){let{document:n,respelled:r}=Ee(e),l=r.length>0?{respelled:r}:{};if(!n||typeof n!="object"||Array.isArray(n))return{document:n};let u=n;if(u.format!==$e||typeof u.formatVersion!="number"||u.formatVersion>=s)return{document:n,...l};let f=u.formatVersion,g=structuredClone(u);for(let a=f;a<s;a++){let i=o[a];if(!i)throw new Error(`there is no upgrade from format ${a} to ${a+1}`);g={...i(g),formatVersion:a+1}}return{document:g,from:f,...l}}function tn(e,o,s){let n=Object.keys(e).filter(f=>e[f].edges?.[o]!==void 0);if(n.length===0)return;let r=n.map(f=>e[f].edges[o].to),l=r.some(f=>f==="*")?"*":[...new Set(r.flatMap(f=>f))];if(s.length===0||s.some(f=>n.includes(f)))return{reversed:!1,kinds:l};let u=n.filter(f=>{let g=e[f].edges[o].to;return g==="*"||s.every(a=>g.includes(a))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var rn=(e,o)=>{let s=e?.fields[o];return s!==void 0&&(s.type==="duration"||(s.type==="number"||s.type==="integer")&&s.format==="duration")};function on(e,o,s,n){if(n==="out"){let r=e[o]?.edges?.[s]?.to;return r===void 0?[]:r==="*"?Object.keys(e):r}return Object.entries(e).filter(([,r])=>{let l=r.edges?.[s]?.to;return l!==void 0&&(l==="*"||l.includes(o))}).map(([r])=>r)}function Oe(e,o,s){if(s.t==="ident")return e[o]?.edges?.[s.name]?on(e,o,s.name,"out"):void 0;if(s.t==="where")return Oe(e,o,s.set);if(s.t==="call"&&(s.fn==="out"||s.fn==="in")&&s.args[0]?.t==="lit"&&typeof s.args[0].value=="string")return on(e,o,s.args[0].value,s.fn)}var sn=(e,o,s)=>{let n=o.filter(r=>e[r]?.fields[s]!==void 0);return n.length>0&&n.every(r=>rn(e[r],s))};function an(e,o,s){let n=e.kinds,r=n[o],l=new Map(s),u=new Map,f=(a,i)=>{if(i>8)return!1;switch(a.t){case"ident":return rn(r,a.name)||g(a.name,i+1);case"member":{let d=Oe(n,o,a.object);return d!==void 0&&sn(n,d,a.name)}case"call":{if(a.fn!=="sum"&&a.fn!=="min"&&a.fn!=="max")return!1;let[d,h]=a.args,m=d&&Oe(n,o,d);return m!==void 0&&h?.t==="ident"&&sn(n,m,h.name)}case"binary":return(a.op==="+"||a.op==="-")&&f(a.left,i)&&f(a.right,i);case"unary":return a.op==="-"&&f(a.operand,i);default:return!1}},g=(a,i)=>{if(r?.computed?.[a]===void 0)return!1;if(u.has(a))return u.get(a);u.set(a,!1);let d=l.get(a),h=d!==void 0&&f(d,i);return u.set(a,h),h};return s.map(([a])=>a).filter(a=>g(a,0))}var An={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list"],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var cn=new Set(Object.values(An).flat());function ln(e,o){let s=new Map;if(!e||typeof e!="object")return new Map;for(let n of Object.values(e)){if(!n||typeof n!="object"||typeof n.kind!="string")continue;let r=o[n.kind]?.fields;if(!r)continue;let l=[];n.system==="google-calendar"&&n.fields&&typeof n.fields=="object"?l=Object.values(n.fields).filter(f=>typeof f=="string"):n.system==="notion"&&(l=n.properties&&typeof n.properties=="object"?Object.keys(n.properties):Object.keys(r).filter(f=>cn.has(r[f].type)));let u=s.get(n.kind)??new Set;for(let f of l)Object.hasOwn(r,f)&&u.add(f);s.set(n.kind,u)}return new Map([...s].filter(([,n])=>n.size>0).map(([n,r])=>[n,Object.keys(o[n].fields).filter(l=>r.has(l))]))}function dn(e,o,s=`kinds.${e}.page`){let n=o.page;if(!n)return[];let r=[],l=[...Object.keys(o.fields),...Object.keys(o.computed??{})],u=new Set,f=(a,i)=>{l.includes(a)?u.has(a)&&r.push(z("page-field-twice",i,`"${a}" is on ${e}'s page twice; name each field once`)):r.push(z("page-field",i,`${e}'s page is to show "${a}", and ${e} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(a)};(n.fields??[]).forEach((a,i)=>f(a,`${s}.fields.${i}`));let g=new Set;return(n.groups??[]).forEach((a,i)=>{let d=a.title.trim().toLowerCase();g.has(d)&&r.push(z("page-group-twice",`${s}.groups.${i}.title`,`${e}'s page has two groups called "${a.title}"; give each its own title`)),g.add(d),a.fields.forEach((h,m)=>f(h,`${s}.groups.${i}.fields.${m}`))}),r}function pn(e,o=[]){return Ie({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(s=>s.fields)],must:s=>!!e.fields[s].required&&e.fields[s].default===void 0,naming:o})}var En=new Set(["subject","now","today","me"]);function Rn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>Se)return{findings:[z("too-large","",`a document may be at most ${Se/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(n){return{findings:[z("not-json","",`this is not JSON: ${n.message}`)]}}try{e=nn(e).document}catch(n){return{findings:[z("format","formatVersion",n.message)]}}e=Xe(e);let o=en.safeParse(e);if(!o.success)return{findings:o.error.issues.map(n=>{let r=n.path.map(String).join(".");if(n.code==="unrecognized_keys")return z("unknown-key",r,`${n.keys.map(l=>`"${l}"`).join(", ")} ${n.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(n.code==="invalid_union"&&/\.effects\.\d+$/.test(r))return z("effect-shape",r,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(n.code==="invalid_key"){let l=n.issues?.[0]?.message;return z("shape",r,`the name "${String(n.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return z("shape",r,n.message)})};let s=o.data;return{document:s,findings:Fn(s)}}var le=e=>[e??[]].flat();function fn(e){let o=new Map;for(let[s,n]of Object.entries(e.kinds))for(let[r,l]of Object.entries(te(n.edges))){let u=o.get(r);o.set(r,{name:r,from:[...u?.from??[],s],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return o}function It(e){let o=new Map;for(let[n,r]of Object.entries(e.kinds)){let l=oe(r),u=pe(r.edges);o.set(n,{fields:new Set([...Object.keys(r.fields),...u.keys()]),edges:new Map(Object.entries(te(r.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let s=oe(e);return s&&o.set(Ce,{computed:s}),o}function un(e,o){let s=[],n=le(e.on),r=(l,u)=>{let f=tn(o.kinds,l,n)?.reversed===!0,[g,a]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:g,to:a}:{sever:l,from:g,to:a}};if(e.creates){let l=o.kinds[e.creates],u={};for(let f of Object.keys(l?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);s.push({create:e.creates,as:"new",set:u})}return e.sets&&s.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&s.push({set:Object.fromEntries(e.writes.map(l=>[l,`$${l}`]))}),e.connects&&(e.replaces&&s.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),s.push(r(e.connects,"connect"))),e.severs&&s.push(r(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&s.push({set:e.setsOther,target:"$to"}),e.removes&&s.push({remove:"$subject"}),e.effects&&s.push(...e.effects.filter(l=>!(e.creates&&"set"in l&&!("create"in l)&&R(l.target)==="new"))),s}function je(e,o,s){try{let n=J(e),r=re(n);for(let l of r.unknownFunctions)s.push(z("unknown-function",o,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return n}catch(n){if(n instanceof ae){s.push(z("expression",o,n.sentence+` (at character ${n.at+1})`));return}throw n}}function ve(e,o,s){try{return X(e)}catch(n){if(n instanceof Ue||n instanceof ae){s.push(z("template",o,(n instanceof ae,n.sentence)));return}throw n}}function Fn(e){let o=[],s=new Set(Object.keys(e.kinds)),n=fn(e),r=e.acts??{},l=new Set(e.roles??[]),u=(a,i)=>pe(e.kinds[a]?.edges).has(i),f=a=>Object.keys(e.kinds).some(i=>u(i,a));for(let[a,i]of Object.entries(e.kinds)){let d=`kinds.${a}`;for(let[m,p]of Object.entries(i.edges??{})){if(!Te(p)&&p.to!=="*")for(let c of p.to)s.has(c)||o.push(z("edge-target",`${d}.edges.${m}.to`,`"${c}" is not a kind this document declares`));i.fields[m]&&o.push(z("edge-field-clash",`${d}.edges.${m}`,`"${m}" is both a field and a relation of ${a}`,"rename one of them"))}i.lifecycle&&!i.fields[i.lifecycle.field]&&o.push(z("lifecycle-field",`${d}.lifecycle.field`,`${a} has no field "${i.lifecycle.field}"`));let h=m=>i.computed!==void 0&&Object.hasOwn(i.computed,m);for(let m of i.glance??[])!i.fields[m]&&!h(m)&&o.push(z("glance-field",`${d}.glance`,`a glance at ${a} is to say "${m}", and ${a} has no field or computed field called that`,`use one of: ${[...Object.keys(i.fields),...Object.keys(i.computed??{})].join(", ")}`));o.push(...dn(a,i));for(let m of["label","describe"]){let p=i[m];if(!p)continue;let c=ve(p,`${d}.${m}`,o);for(let j of c??[])if(j.expr){for(let k of re(j.expr).names)if(!i.fields[k]){if(h(k)){He(i,k)||o.push(z("template-field",`${d}.${m}`,`${a}'s ${k} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${a}'s own fields`));continue}o.push(z("template-field",`${d}.${m}`,`${a} has no field "${k}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,p]of Object.entries(i.fields)){p.default!==void 0&&p.type==="enum"&&!p.options?.includes(String(p.default))&&o.push(z("default-option",`${d}.fields.${m}.default`,`"${String(p.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;p.repeats&&(i.fields[c]||i.edges?.[c]||i.computed?.[c])&&o.push(z("repeat-clash",`${d}.fields.${m}.repeats`,`${a} already has "${c}", where how ${m} repeats is kept`))}}for(let[a,i]of Object.entries(r)){let d=`acts.${a}`;for(let c of le(i.on))s.has(c)||o.push(z("act-kind",`${d}.on`,`"${c}" is not a kind this document declares`));let h=le(i.on),m=un(i,e);if(i.creates&&i.on===void 0&&i.writes&&s.has(i.creates)){for(let c of i.writes)if(!e.kinds[i.creates].fields[c])if(e.kinds[i.creates].computed?.[c]!==void 0)o.push(z("computed-written",`${d}.writes`,`${i.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(i.creates,c))continue;o.push(z("act-field",`${d}.writes`,`${i.creates} has no field "${c}"`))}}m.length===0&&o.push(z("act-empty",d,`"${a}" does nothing`,"give it effects or a shorthand such as sets or creates"));let p=new Map;m.forEach((c,j)=>{let k=m.length-(i.effects?.length??0),O=i.effects&&j>=k?`${d}.effects.${j-k}`:d;if("create"in c){if(!s.has(c.create))o.push(z("act-kind",`${O}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?o.push(z("computed-written",`${O}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):o.push(z("act-field",`${O}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&p.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!n.has(b)&&!f(b)&&o.push(z("act-edge",`${O}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&h.length===0&&o.push(z("act-subject",`${d}.on`,`"${a}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),F=b==="subject"?h:p.has(b??"")?[p.get(b)]:[];b==="subject"&&h.length===0&&o.push(z("act-subject",`${d}.on`,`"${a}" changes "$subject" but does not say which kinds it is "on"`));for(let M of Object.keys(c.set))for(let C of F)if(!(!s.has(C)||e.kinds[C].fields[M]))if(e.kinds[C].computed?.[M]!==void 0)o.push(z("computed-written",`${O}.set.${M}`,`${C}'s ${M} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(C,M))continue;o.push(z("act-field",`${O}.set.${M}`,`${C} has no field "${M}"`))}}else"remove"in c&&R(c.remove)==="subject"&&h.length===0&&o.push(z("act-subject",`${d}.on`,`"${a}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&je(b.expr,`${O}.set`,o)})}),i.allowedWhen&&je(i.allowedWhen,`${d}.allowedWhen`,o),i.refusal&&ve(i.refusal,`${d}.refusal`,o)}for(let[a,i]of Object.entries(e.rules??{})){let d=`rules.${a}`;i.over!=="graph"&&!s.has(i.over)&&o.push(z("rule-kind",`${d}.over`,`"${i.over}" is not a kind this document declares`));let h=i.over==="graph"?void 0:e.kinds[i.over];for(let m of["when","require"]){let p=i[m];if(!p)continue;let c=je(p,`${d}.${m}`,o);if(!c)continue;let j=re(c);for(let k of j.names)if(i.over==="graph")o.push(z("rule-name",`${d}.${m}`,`"${k}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(h&&!h.fields[k]&&!h.edges?.[k]&&h.computed?.[k]===void 0){let O=Object.keys(h.edges??{}).find(E=>E.includes("-")&&E.split("-").includes(k));o.push(z("rule-name",`${d}.${m}`,`${i.over} has no field or relation called "${k}"`,O?`"${O}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${O.replace(/-([a-z0-9])/g,(E,b)=>b.toUpperCase())}"`:void 0))}for(let k of j.edges)!n.has(k)&&!f(k)&&o.push(z("rule-edge",`${d}.${m}`,`"${k}" is not a relation any kind declares`));for(let k of j.sweeps)s.has(k)?i.over!=="graph"&&o.push(Le("rule-cost",`${d}.${m}`,`this rule looks at every ${k} for every ${i.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):o.push(z("rule-kind",`${d}.${m}`,`"${k}" is not a kind this document declares`))}i.says&&ve(i.says,`${d}.says`,o),(i.repairs??[]).forEach((m,p)=>{!r[m.act]&&!fe(m.act)&&!ye(m.act,e.kinds)&&o.push(z("repair-act",`${d}.repairs.${p}.act`,`"${m.act}" is not an act this document declares`,he(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((a,i)=>{if(a.roles!=="*"&&l.size>0)for(let d of a.roles)l.has(d)||o.push(z("grant-role",`policy.grants.${i}.roles`,`"${d}" is not one of the document's roles`));if(a.mutations!=="*")for(let d of a.mutations)!r[d]&&!fe(d)&&!ye(d,e.kinds)&&o.push(z("grant-act",`policy.grants.${i}.mutations`,`"${d}" is not an act this document declares`,he(d,e)))}),(g.sees??[]).forEach((a,i)=>{for(let d of a.kinds)s.has(d)||o.push(z("sight-kind",`policy.sees.${i}.kinds`,`"${d}" is not a kind this document declares`));if(a.roles!=="*"&&l.size>0)for(let d of a.roles)l.has(d)||o.push(z("sight-role",`policy.sees.${i}.roles`,`"${d}" is not one of the document's roles`))})),o.push(...Ye(e)),o}function Dn(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(o=>o[1]):[ge(e)??[]].flat()}function Nn(e,o,s,n){let r=new Map,l=le(e.on),u=new Map,f=new Map;(l.length>0||o.some(p=>"remove"in p&&R(p.remove)==="subject"||"from"in p&&(R(p.from)==="subject"||R(p.to)==="subject")||"set"in p&&!("create"in p)&&R(p.target??"$subject")==="subject"))&&r.set(me,{ref:l.length>0?l:"*",required:!0});let a=e.args??{},i=e.writes?.length===1,d=(p,c)=>c&&p.type===c.type&&p.min===void 0&&p.max===void 0&&p.step===void 0?{...p,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:p,h=(p,c)=>c&&p.type===c.type&&p.format===void 0&&p.unit===void 0?{...d(p,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:d(p,c),m=(p,c,j)=>{if(p===me||En.has(p)||u.has(p)||r.has(p))return;let k=a[p]?h(a[p],j):void 0;r.set(p,k?{field:k,optional:!k.required,required:!!k.required}:c())};for(let p of o)if("create"in p){let c=s.kinds[p.create],j=c?pn(c,Dn(c)):[],k=O=>j.includes(O)?j.indexOf(O):j.length;for(let[O,E]of Object.entries(p.set??{}).sort(([b],[F])=>k(b)-k(F))){let b=R(E),F=c?.fields[O];if(b&&F){let M=!!F.required&&F.default===void 0;m(b,()=>({field:F,optional:!M,required:M}),F)}}p.as&&u.set(p.as,p.create)}else if("connect"in p||"sever"in p){let c=n.get("connect"in p?p.connect:p.sever);for(let[j,k]of[["from",p.from],["to",p.to]]){let O=R(k);if(!O)continue;let E=j==="to"?c?.to??"*":c?.from??"*";E!=="*"&&!f.has(O)&&f.set(O,E),m(O,()=>({ref:E,required:!0}))}}else if("set"in p){let c=R(p.target??"$subject"),j=c==="subject"?l[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[k,O]of Object.entries(p.set)){let E=R(O);if(!E)continue;let b=j?s.kinds[j]?.fields[k]:void 0;m(E,()=>b?{field:b,optional:!i,required:i}:{any:!0,required:!1},b)}}else if("remove"in p){let c=R(p.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[p,c]of Object.entries(a))r.has(p)||r.set(p,{field:c,optional:!c.required,required:!!c.required});return r}function Pt(e,o={}){let s=Rn(e);if(!s.document||ue(s.findings))return{ok:!1,findings:s.findings};let n=s.document,r=[...s.findings];o.previous&&r.push(...Mn(n,o.previous));let l=Tn(n,r);return ue(l.findings)?{ok:!1,findings:l.findings}:Be(l,o)}function ce(e,o){return e.map(s=>{let n=!s.format&&s.expr?.t==="ident"?o?.[s.expr.name]?.format:void 0;return n==="money"||n==="percent"?{...s,format:n}:s})}function Tn(e,o){let s=fn(e),n={},r=ln(e.connections,e.kinds);for(let[i,d]of Object.entries(e.kinds)){let h=ge(d),m=d.label??(h?`{${h}}`:void 0),p=oe(d),c=p?an(e,i,[...p]):[];n[i]={...m?{label:ce(X(m),d.fields)}:{},...d.describe?{describe:ce(X(d.describe),d.fields)}:{},...p?{computed:[...p]}:{},...c.length>0?{durations:c}:{},...r.has(i)?{keptInStep:r.get(i)}:{}}}let l={};for(let[i,d]of Object.entries(e.acts??{})){let h=un(d,e),m=Nn(d,h,e,s),p=d.destructive??h.some(y=>"remove"in y||"sever"in y||"replace"in y),c=[...new Set(h.flatMap(y=>"create"in y?[y.create]:[]))],j=[...new Set(h.flatMap(y=>"connect"in y?[y.connect]:[]))],k=[...new Set(h.flatMap(y=>"sever"in y?[y.sever]:"replace"in y?y.replace:[]))],O=[...new Set(h.flatMap(y=>"set"in y&&!("create"in y)&&R(y.target??"$subject")==="subject"?Object.keys(y.set):[]))],E=new Map;for(let y of h){if(!("connect"in y)&&!("sever"in y))continue;let v=s.get("connect"in y?y.connect:y.sever);for(let[D,ie]of[["from",y.from],["to",y.to]]){let q=R(ie),H=D==="to"?v?.to:v?.from;q&&q!=="subject"&&H&&H!=="*"&&E.set(q,[...new Set([...E.get(q)??[],...H])])}}let b={};for(let y of h){if(!("set"in y)||"create"in y)continue;let v=R(y.target??"$subject");for(let D of v&&v!=="subject"&&E.get(v)||[])b[D]=[...new Set([...b[D]??[],...Object.keys(y.set)])]}let F={};for(let y of h)if(!(!("set"in y)||"create"in y||R(y.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(y.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?F[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete F[v];let M=c.length===0&&h.every(y=>!("set"in y)||!y.set||Object.values(y.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),C=new Map;for(let y of h)if(!(!("set"in y)||!y.set))for(let v of Object.values(y.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&C.set(v.expr,J(v.expr));l[i]={title:d.title??i.replace(/-/g," "),effects:h,args:[...m],...d.allowedWhen?{guard:J(d.allowedWhen)}:{},...d.refusal?{refusal:ce(X(d.refusal),e.kinds[[d.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...C],destructive:p,idempotent:M,creates:c,connects:j,severs:k,writes:O,writesOther:b,sets:F}}let u={};for(let[i,d]of Object.entries(e.rules??{}))u[i]={title:d.title??i.replace(/-/g," "),require:J(d.require),...d.when?{when:J(d.when)}:{},...d.says?{says:ce(X(d.says),e.kinds[d.over]?.fields)}:{}};let f=Ve(e,o),g=Ze(e),a=We(e);return{format:qe,document:e,findings:o,kinds:n,...e.computed?{facts:[...oe(e)??[]]}:{},edges:[...s].map(([i,{from:d,to:h,cardinality:m}])=>[i,{from:d,to:h,cardinality:m}]),acts:l,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...a?{home:a}:{}}}function Gt(e,o,s){let n=/^defineNode\("([^"]+)"\)/.exec(o)?.[1],r=n?s.kinds[n]:void 0;if(!n||!r)return e;let l=Object.keys(r.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${n}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${n} \u2014 the facts a person compares one by, at a glance.`}}function Mn(e,o){let s=[],n=new Set(Object.values(o.kinds).flatMap(r=>Object.keys(r.edges??{})));for(let[r,l]of Object.entries(e.kinds)){let u=l.renamedFrom;u&&!o.kinds[u]&&s.push(z("renamed-from-nothing",`kinds.${r}.renamedFrom`,`${r} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=o.kinds[u??r];for(let[g,a]of Object.entries(l.fields)){let i=a.renamedFrom;i&&!f?.fields[i]&&s.push(z("renamed-from-nothing",`kinds.${r}.fields.${g}.renamedFrom`,`${g} says it was ${i}, and the previous ${u??r} has no field called ${i}`,"name the field it was, or drop renamedFrom"))}for(let[g,a]of Object.entries(l.edges??{})){let i=a.renamedFrom;i&&!n.has(i)&&s.push(z("renamed-from-nothing",`kinds.${r}.edges.${g}.renamedFrom`,`${g} says it was ${i}, and the previous version has no relation called ${i}`,"name the relation it was, or drop renamedFrom"))}}return s}export{bn as ActRefusal,Pt as compileDocumentWithoutCheck,un as effectsOf,Gt as inDocumentWords,It as kindShapes,Rn as readDocument};
|