graview 0.1.30 → 0.1.32
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/preview/chunk.2NIOHEMX.js +1 -0
- package/dist/preview/{chunk.XRJBLH4N.js → chunk.3AGY4QVS.js} +1 -1
- package/dist/preview/chunk.3HXN4BOY.js +1 -0
- package/dist/preview/{chunk.2CIBWZJG.js → chunk.3K6YSVHC.js} +1 -1
- package/dist/preview/{chunk.FWCOJDOD.js → chunk.3TVXGJTU.js} +1 -1
- package/dist/preview/{chunk.NDADLJE6.js → chunk.3TY5NFLY.js} +1 -1
- package/dist/preview/{chunk.UWGWXFWZ.js → chunk.47STJVRV.js} +1 -1
- package/dist/preview/{chunk.34ZMMURV.js → chunk.4HRAQNJO.js} +6 -6
- package/dist/preview/{chunk.QTMWHE5O.js → chunk.4HZ7QTXZ.js} +1 -1
- package/dist/preview/{chunk.3JGGBLRB.js → chunk.4MERAWS2.js} +1 -1
- package/dist/preview/chunk.52W7WYME.js +1 -0
- package/dist/preview/chunk.5A4AOFOA.js +1 -0
- package/dist/preview/chunk.5H4VXLZF.js +88 -0
- package/dist/preview/{chunk.XS7YFNDU.js → chunk.5T5XGILP.js} +1 -1
- package/dist/preview/chunk.5TVB6BUY.js +1 -0
- package/dist/preview/chunk.5UL7YDUD.js +1 -0
- package/dist/preview/chunk.63GXY2ME.js +1 -0
- package/dist/preview/chunk.6QWV5MVH.js +25 -0
- package/dist/preview/{chunk.PAVR5TK5.js → chunk.6UGEYZAC.js} +1 -1
- package/dist/preview/chunk.6YCBYL2Y.js +2 -0
- package/dist/preview/{chunk.ZYKAS4BT.js → chunk.7GKUVQVF.js} +1 -1
- package/dist/preview/{chunk.T3VPD7JQ.js → chunk.7T7NZZTC.js} +1 -1
- package/dist/preview/chunk.AKFKM4SW.js +3 -0
- package/dist/preview/chunk.AOSMJKLH.js +1 -0
- package/dist/preview/{chunk.D3IECJ2S.js → chunk.ASCLIM2P.js} +1 -1
- package/dist/preview/chunk.B2GLDIAS.js +1 -0
- package/dist/preview/chunk.BNV77BQZ.js +4 -0
- package/dist/preview/chunk.BOO6WVM4.js +117 -0
- package/dist/preview/chunk.BQ3JHEHV.js +1 -0
- package/dist/preview/chunk.CAVBSL27.js +1 -0
- package/dist/preview/{chunk.YLQB3KBA.js → chunk.CDP2XL66.js} +1 -1
- package/dist/preview/chunk.CIPS2OGR.js +1 -0
- package/dist/preview/chunk.CJJLJ3KW.js +2 -0
- package/dist/preview/chunk.CN3UEF5N.js +90 -0
- package/dist/preview/{chunk.6XMEU2Q2.js → chunk.COQKECUH.js} +1 -1
- package/dist/preview/{chunk.QTA4ROAK.js → chunk.CWHRDBOF.js} +1 -1
- package/dist/preview/chunk.CX3KL2C5.js +1 -0
- package/dist/preview/{chunk.AK3IHFCF.js → chunk.D75KC3LL.js} +1 -1
- package/dist/preview/chunk.DAZ2VSRD.js +1 -0
- package/dist/preview/{chunk.RIEHYQLK.js → chunk.DHIUSUCL.js} +50 -24
- package/dist/preview/{chunk.3ADPAGPY.js → chunk.DYSPCGXX.js} +1 -1
- package/dist/preview/chunk.E2YEOMPH.js +1 -0
- package/dist/preview/chunk.EBGAYL32.js +1 -0
- package/dist/preview/chunk.EF3XNU4O.js +1 -0
- package/dist/preview/chunk.EJPI3ST6.js +1 -0
- package/dist/preview/chunk.EKPRNDUV.js +1 -0
- package/dist/preview/chunk.ERIT3R6N.js +1 -0
- package/dist/preview/chunk.EYTBDMTW.js +1 -0
- package/dist/preview/chunk.F6EH7HI2.js +1 -0
- package/dist/preview/{chunk.3URFMWXZ.js → chunk.F6ZK7RMB.js} +2 -2
- package/dist/preview/chunk.FSTCX2AI.js +1 -0
- package/dist/preview/{chunk.HHPGWJDO.js → chunk.FWTIUYXH.js} +1 -1
- package/dist/preview/{chunk.6T2Q6NLO.js → chunk.G5NZVPJU.js} +1 -1
- package/dist/preview/{chunk.VG56IUIQ.js → chunk.GO4XBWJO.js} +1 -1
- package/dist/preview/chunk.GV2CQVKV.js +1 -0
- package/dist/preview/chunk.GYICGZMG.js +3 -0
- package/dist/preview/chunk.H7BST3XO.js +1 -0
- package/dist/preview/chunk.H7EPE74C.js +1 -0
- package/dist/preview/{chunk.26CZTUY4.js → chunk.HAIG6NVX.js} +1 -1
- package/dist/preview/{chunk.V7BDAGDE.js → chunk.HLTRQU4Y.js} +1 -1
- package/dist/preview/{chunk.VS7K3SCD.js → chunk.I6FPNX43.js} +1 -1
- package/dist/preview/chunk.IDVAR5HM.js +1 -0
- package/dist/preview/chunk.J25KOSNW.js +1 -0
- package/dist/preview/chunk.JDUJDAGA.js +1 -0
- package/dist/preview/{chunk.X37L5TN5.js → chunk.JFAOHHJJ.js} +1 -1
- package/dist/preview/chunk.JOOQUWLT.js +341 -0
- package/dist/preview/{chunk.4SJUTBDV.js → chunk.JQU5GEU3.js} +1 -1
- package/dist/preview/chunk.K5ME5GCG.js +1 -0
- package/dist/preview/chunk.K7PMDSOL.js +1 -0
- package/dist/preview/chunk.KSES5U5B.js +1 -0
- package/dist/preview/{chunk.DT7LHWU2.js → chunk.LLLZEGRK.js} +1 -1
- package/dist/preview/chunk.LR3VDXPI.js +1 -0
- package/dist/preview/{chunk.WYTIOLPP.js → chunk.LXBOVRFI.js} +1 -1
- package/dist/preview/{chunk.42YX6NOY.js → chunk.MAF7C3VM.js} +1 -1
- package/dist/preview/chunk.MNP4JI33.js +5 -0
- package/dist/preview/{chunk.O2LK2AO7.js → chunk.MWGGV7DE.js} +1 -1
- package/dist/preview/chunk.N6OX4NEQ.js +1 -0
- package/dist/preview/chunk.NM6MZYFN.js +47 -0
- package/dist/preview/chunk.NRAYZY3X.js +1 -0
- package/dist/preview/chunk.NTF7FVB2.js +1 -0
- package/dist/preview/{chunk.DZRTOURR.js → chunk.OC6IWRQ3.js} +1 -1
- package/dist/preview/chunk.OF34OZ4V.js +1 -0
- package/dist/preview/chunk.OJGHDWI6.js +1 -0
- package/dist/preview/chunk.OKRNJXTV.js +1 -0
- package/dist/preview/chunk.PBSMLINK.js +1 -0
- package/dist/preview/chunk.PHKSMUIA.js +1 -0
- package/dist/preview/{chunk.JN7DIFR3.js → chunk.PIP6Z563.js} +1 -1
- package/dist/preview/chunk.QGTSHKJL.js +1 -0
- package/dist/preview/chunk.QVVJRSRM.js +1 -0
- package/dist/preview/{chunk.L6OMEYL6.js → chunk.QYZNAUIR.js} +1 -1
- package/dist/preview/chunk.R6K6GF5R.js +1 -0
- package/dist/preview/{chunk.JTNWD2CN.js → chunk.RCKTBOY2.js} +1 -1
- package/dist/preview/{chunk.QNGWEV47.js → chunk.RIJUCHP4.js} +1 -1
- package/dist/preview/chunk.SHTJZ6UX.js +1 -0
- package/dist/preview/{chunk.PKK6FRZR.js → chunk.SYAEBGDC.js} +1 -1
- package/dist/preview/chunk.T5VG5A6V.js +1 -0
- package/dist/preview/{chunk.ERXSYPYL.js → chunk.TAQ764IQ.js} +1 -1
- package/dist/preview/chunk.TCNBCTWO.js +1 -0
- package/dist/preview/{chunk.HHI65WFZ.js → chunk.UATVTXZY.js} +1 -1
- package/dist/preview/{chunk.XSTXV6FP.js → chunk.UBFNZMUX.js} +2 -2
- package/dist/preview/{chunk.WAFDCOOG.js → chunk.UGFJKSHU.js} +1 -1
- package/dist/preview/chunk.UHUGOTUU.js +19 -0
- package/dist/preview/chunk.ULRW47RP.js +1 -0
- package/dist/preview/chunk.UNL2HIF2.js +1 -0
- package/dist/preview/chunk.UZGRRDHD.js +1 -0
- package/dist/preview/{chunk.BPWNWE7N.js → chunk.VG3O4LWB.js} +1 -1
- package/dist/preview/chunk.WAZ7OGBD.js +1 -0
- package/dist/preview/{chunk.3JNMSOFG.js → chunk.XANVHJQ4.js} +1 -1
- package/dist/preview/chunk.XKABS745.js +1 -0
- package/dist/preview/chunk.XMC7YDWT.js +1 -0
- package/dist/preview/chunk.XNJEFUF7.js +3 -0
- package/dist/preview/chunk.Y6ZNFQK3.js +6 -0
- package/dist/preview/{chunk.J2ITFGN3.js → chunk.YIR7PPF3.js} +1 -1
- package/dist/preview/index.html +51 -0
- package/dist/preview/page.js +6 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2EXGG6BB.js +0 -1
- package/dist/preview/chunk.2NBYNZRD.js +0 -1
- package/dist/preview/chunk.2XAONC66.js +0 -1
- package/dist/preview/chunk.3R4W2P5X.js +0 -1
- package/dist/preview/chunk.3SKKIHU3.js +0 -4
- package/dist/preview/chunk.3VL5WECB.js +0 -1
- package/dist/preview/chunk.4ALKPNXM.js +0 -1
- package/dist/preview/chunk.4HP7UWA2.js +0 -1
- package/dist/preview/chunk.5U5J3ISK.js +0 -1
- package/dist/preview/chunk.6V2RG5JG.js +0 -5
- package/dist/preview/chunk.7BWT5L2L.js +0 -1
- package/dist/preview/chunk.C5CYZNSJ.js +0 -1
- package/dist/preview/chunk.CM6LOIQE.js +0 -88
- package/dist/preview/chunk.FDELO7NY.js +0 -116
- package/dist/preview/chunk.FGVKJWNS.js +0 -6
- package/dist/preview/chunk.GFF2FB2J.js +0 -25
- package/dist/preview/chunk.GLBHQFJ2.js +0 -1
- package/dist/preview/chunk.HSCTWAUV.js +0 -1
- package/dist/preview/chunk.INZUEWC5.js +0 -1
- package/dist/preview/chunk.JH6MU6TX.js +0 -2
- package/dist/preview/chunk.JISMMIMX.js +0 -1
- package/dist/preview/chunk.JPHNKWTY.js +0 -1
- package/dist/preview/chunk.K75FUIZI.js +0 -1
- package/dist/preview/chunk.K776HO42.js +0 -2
- package/dist/preview/chunk.KN3ULTGF.js +0 -1
- package/dist/preview/chunk.KOB6N3SL.js +0 -1
- package/dist/preview/chunk.KQT7WAQE.js +0 -1
- package/dist/preview/chunk.L4DECHXR.js +0 -327
- package/dist/preview/chunk.LQ7V6KEE.js +0 -1
- package/dist/preview/chunk.MD74YVRN.js +0 -3
- package/dist/preview/chunk.MGNP4LAM.js +0 -1
- package/dist/preview/chunk.NCTOBUCT.js +0 -1
- package/dist/preview/chunk.NO52VON3.js +0 -1
- package/dist/preview/chunk.OAF7TUMI.js +0 -1
- package/dist/preview/chunk.OQ4KFN6W.js +0 -1
- package/dist/preview/chunk.OQDETV4X.js +0 -1
- package/dist/preview/chunk.OXQMNIRO.js +0 -1
- package/dist/preview/chunk.OZNW5W4Z.js +0 -1
- package/dist/preview/chunk.QIAKO27D.js +0 -1
- package/dist/preview/chunk.R26DREVU.js +0 -1
- package/dist/preview/chunk.RI3PYG5T.js +0 -19
- package/dist/preview/chunk.RRVIXV7W.js +0 -1
- package/dist/preview/chunk.RYT5U3QM.js +0 -1
- package/dist/preview/chunk.SE5SKFQH.js +0 -1
- package/dist/preview/chunk.SOBC3CTN.js +0 -47
- package/dist/preview/chunk.SOD3PBJM.js +0 -1
- package/dist/preview/chunk.UDSEJKCY.js +0 -1
- package/dist/preview/chunk.UZWWDAGM.js +0 -14
- package/dist/preview/chunk.V5ZYUVMH.js +0 -1
- package/dist/preview/chunk.VOAZBHCG.js +0 -1
- package/dist/preview/chunk.VSZQXB4Q.js +0 -3
- package/dist/preview/chunk.W3S6UXNA.js +0 -1
- package/dist/preview/chunk.Y4UXEL6Y.js +0 -1
- package/dist/preview/chunk.YJUB4OD7.js +0 -1
- package/dist/preview/chunk.YNQDVGZM.js +0 -1
- package/dist/preview/chunk.YV2LJFGS.js +0 -1
- package/dist/preview/chunk.Z2YUYZT4.js +0 -1
- /package/dist/preview/{chunk.EYZ7MHBZ.js → chunk.GZHZLJBF.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as v,C,D as S,J as G,y as O}from"./chunk.JOOQUWLT.js";import{A as E,F as I,Y as m,d as V,k as y,m as p,n as g,o as u,p as D,w as B}from"./chunk.6QWV5MVH.js";import{Ac as k,Cc as R,Dc as T,aa as M,zc as P}from"./chunk.MNP4JI33.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as $}from"./chunk.SYAEBGDC.js";import{a as C}from"./chunk.XANVHJQ4.js";import{g as M}from"./chunk.B2GLDIAS.js";import{X as k,Y as v,_ as j,jb as x}from"./chunk.MNP4JI33.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
|
|
@@ -0,0 +1 @@
|
|
|
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{b as j}from"./chunk.GYICGZMG.js";import{a as _,b as de,e as pe,f as ue,g as me}from"./chunk.SHTJZ6UX.js";import{b as le}from"./chunk.ULRW47RP.js";import{n as B}from"./chunk.XMC7YDWT.js";import{i as x,j as re,k as ie,q as oe,r as se}from"./chunk.B2GLDIAS.js";import{d as ne,e as ae}from"./chunk.6YCBYL2Y.js";import{b as ee,f as te}from"./chunk.UGFJKSHU.js";import{$ as U,F as fe,Q as X,Y as O,Z as Y,a as Q,xa as Z}from"./chunk.6QWV5MVH.js";import{Z as W,ca as J}from"./chunk.MNP4JI33.js";import{b as D}from"./chunk.AJZBJBMO.js";var p=D(fe(),1);var he=Z(Q(()=>(__graviewPreload(import.meta.url,["./chunk.3HXN4BOY.js","./chunk.GYICGZMG.js","./chunk.SHTJZ6UX.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.CX3KL2C5.js")))),ce=he.part((i,a)=>i.drawAppLink(a),{quiet:!0});var e=D(X(),1);function G({nodeId:i,field:a,value:l,stored:s=l,said:c}){let{fields:m,commit:o}=B(i),t=m.find(r=>r.field===a),{store:y,principal:E}=O(),u=y.graph.getNode(i)?.kind,g=y.schema.definitions.find(r=>r.kind===u),k=J(g,a),b=k.toLowerCase(),n=c??`${k.charAt(0).toUpperCase()}${k.slice(1)}: ${l}`,[w,I]=(0,p.useState)(!1),d=t?.shape.type==="number"?t.shape.amount:void 0,f=d&&s!==""&&Number.isFinite(Number(s))?re(Number(s),d):s,[v,M]=(0,p.useState)(f),C=(0,p.useRef)(null),K=(0,p.useRef)(null),z=(0,p.useRef)(!1),S=r=>{z.current=r,I(!1)};(0,p.useEffect)(()=>M(f),[f,w]);let q=t?.shape.type==="date";if((0,p.useEffect)(()=>{q&&me()},[q]),(0,p.useEffect)(()=>{w?C.current?.focus():z.current&&(z.current=!1,K.current?.focus())},[w]),!t)return(0,e.jsx)("span",{"data-graview-field":a,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${b}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:l});if(!w)return(0,e.jsx)("button",{ref:K,type:"button","data-graview-field":a,"data-graview-editable":t.mutation,...n===l?{}:{"aria-label":n},title:`${t.title} \u2014 changes the ${b}, and can be undone`,onClick:()=>I(!0),style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:"var(--graview-ink)"},children:l});let R=(r,{left:h=!1}={})=>{S(!h),!(r===s||r===""||r===void 0)&&(t.shape.type==="date"&&typeof r=="string"&&ge(r)||o(t,r))},ge=r=>{if(t.shape.type!=="date")return!1;let h=m.filter(L=>L.shape.type==="date"&&L.takesValue),T=se(h.map(L=>L.field),g?.fieldRoles??{}),A=T?.start===a?h.find(L=>L.field===T.end):void 0,N=y.graph.getNode(i)?.[T?.end??""];if(!A||typeof N!="string")return!1;let F=oe(s===""?void 0:s,r,N,{time:t.shape.time===!0,instant:t.shape.instant===!0});if(F===void 0||F===N)return!1;let $=t.call(r),V=A.call(F);return y.applyAll($.name===V.name?[{name:$.name,args:{...$.args,...V.args}}]:[$,V],{author:E}),!0};if(!t.takesValue){let r=[t,...t.alternatives];return(0,e.jsx)("span",{role:"group","aria-label":`Change ${W(a).toLowerCase()}`,"data-graview-field":a,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:h=>{h.key==="Escape"&&S(!0)},children:r.map((h,T)=>(0,e.jsx)("button",{type:"button",ref:T===0?C:void 0,"data-graview-act":h.mutation,onClick:()=>{S(!0),o(h,void 0)},onBlur:A=>{let H=A.relatedTarget;(!H||!A.currentTarget.parentElement?.contains(H))&&S(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:h.title},h.mutation))})}return(0,e.jsxs)("form",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,maxWidth:"100%"},onSubmit:r=>{r.preventDefault(),R(ye(t,v))},children:[t.shape.type==="choice"?(0,e.jsx)("select",{ref:C,"aria-label":W(a),"data-graview-field":a,value:v,onChange:r=>R(r.target.value),onBlur:()=>S(!1),style:{font:"inherit",fontSize:"inherit"},children:t.shape.options.map(r=>(0,e.jsx)("option",{value:r,children:ee(g,a,r)},r))}):t.shape.type==="date"?(0,e.jsx)(ue,{inputRef:C,label:W(a),value:v===""?void 0:v,time:t.shape.time===!0,instant:t.shape.instant===!0,onChange:r=>M(r??""),onLeave:r=>R(r,{left:!0}),onCancel:()=>S(!0),autoSelect:!0,boxStyle:{fontSize:"inherit",minHeight:24,padding:"0 3px"}}):(0,e.jsxs)(e.Fragment,{children:[d&&x(d).prefix?(0,e.jsx)("span",{"aria-hidden":"true",children:x(d).prefix}):null,(0,e.jsx)("input",{ref:C,"aria-label":d?`${W(a)}, ${x(d).hint}`:W(a),"data-graview-field":a,...d?{inputMode:"decimal",placeholder:x(d).placeholder,"data-graview-amount":d.format??"unit"}:{},type:d?"text":t.shape.type==="number"&&!t.shape.duration?"number":"text",...t.shape.type==="number"&&t.shape.duration?{placeholder:"1h 30m"}:{},...t.shape.type==="text"&&t.shape.holds==="phone"?{inputMode:"tel",autoComplete:"tel"}:{},...t.shape.type==="number"&&t.shape.min!==void 0&&!d?{min:t.shape.min}:{},...t.shape.type==="number"&&t.shape.max!==void 0&&!d?{max:t.shape.max}:{},...t.shape.type==="number"&&t.shape.step!==void 0&&!d?{step:t.shape.step}:{},value:v,onChange:r=>M(r.target.value),onBlur:()=>R(ye(t,v),{left:!0}),onKeyDown:r=>{r.key==="Escape"&&S(!0)},style:{font:"inherit",fontSize:"inherit",width:`min(${Math.max(6,v.length+1)}ch, 100%)`,maxWidth:"100%",minWidth:0,boxSizing:"border-box",minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),d&&x(d).suffix?(0,e.jsx)("span",{"aria-hidden":"true",children:x(d).suffix}):null]}),t.open.length>0?(0,e.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",t.open.map(r=>r.name).join(", ")]}):null]})}function ye(i,a){return i.shape.type==="number"&&i.shape.amount?ie(a,i.shape.amount):i.shape.type==="number"?i.shape.duration?te(a)??a:Number(a):i.shape.type==="text"&&i.shape.holds?a.trim():a}function ke({href:i,field:a,value:l,stored:s,nodeId:c}){let m=i.startsWith("tel:"),o=(t,y)=>(0,e.jsx)("a",{href:i,"data-graview-link":a,...y?{"aria-label":y}:{},...m?{}:{target:"_blank",rel:"noopener noreferrer"},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",color:"var(--graview-accent)"},children:t});return c===void 0?o(l):(0,e.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",gap:"0 10px",maxWidth:"100%"},children:[(0,e.jsx)(G,{nodeId:c,field:a,value:l,...s===void 0?{}:{stored:s}}),o(m?"Call":"Map",m?`Call ${l}`:`Open ${l} in maps`)]})}function Ve({id:i,hide:a=[],limit:l=10,labels:s={},shown:c=[]}){let{store:m}=O(),o=U(i);if(!o)return null;let t=m.schema.tryDefinition(o.kind),y=ne(o,t,{limit:l,said:c}).filter(u=>!a.includes(u.key)),E=le(t).length>0;return y.length===0&&!E?null:(0,e.jsxs)("div",{"data-graview-fields":o.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[ae(t,y).map((u,g)=>{let k=(0,e.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:u.fields.map(n=>n.files?(0,e.jsx)(_,{as:"field",nodeId:o.id,field:n.key,label:s[n.key]??n.label,files:n.files,labelStyle:P,style:{marginTop:6}},n.key):n.long?(0,e.jsx)(be,{nodeId:o.id,field:n.key,label:s[n.key]??n.label,value:n.value,markdown:n.markdown,labelStyle:P,style:{gridColumn:"1 / -1",marginTop:6}},n.key):(0,e.jsxs)("div",{style:{display:"contents"},children:[(0,e.jsx)("dt",{style:{...P,whiteSpace:"nowrap"},children:s[n.key]??n.label}),(0,e.jsxs)("dd",{style:{margin:0,minWidth:0},children:[n.linked?(0,e.jsx)(de,{relation:n.linked.relation,refs:n.linked.refs,nodeId:o.id,field:n.key}):n.app?(0,e.jsx)(ce,{address:n.app,as:"record",nodeId:o.id,field:n.key}):n.href?(0,e.jsx)(ke,{href:n.href,field:n.key,value:n.value,stored:n.stored,nodeId:o.id}):(0,e.jsx)(G,{nodeId:o.id,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,e.jsx)(pe,{nodeId:o.id,field:n.key,start:o[n.key],value:o[`${n.key}Repeat`],label:`${s[n.key]??n.label} repeats`}):null]})]},n.key))});if(!u.title)return(0,e.jsx)("div",{children:k},g);let b=`graview-field-group-${o.id}-${g}`;return(0,e.jsxs)("div",{role:"group","aria-labelledby":b,style:{display:"grid",gap:6,minWidth:0},children:[(0,e.jsx)("p",{id:b,"data-graview-field-group":u.title,style:ve,children:u.title}),k]},g)}),E?(0,e.jsx)(_,{as:"unfilled",nodeId:o.id,skip:a,labels:s,labelStyle:P}):null]})}var P={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},ve={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function be(i){return Y()?(0,e.jsx)(Se,{...i}):(0,e.jsx)(we,{...i})}function we({field:i,label:a,value:l,labelStyle:s,valueStyle:c,style:m,markdown:o}){return(0,e.jsxs)("div",{"data-graview-long":i,style:{display:"grid",gap:6,minWidth:0,...m},children:[(0,e.jsx)("dt",{style:s,children:a}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...c},children:(0,e.jsx)("div",{"data-graview-field":i,children:(0,e.jsx)(j,{text:l,markdown:o})})})]})}function Se({nodeId:i,field:a,label:l,value:s,labelStyle:c,valueStyle:m,style:o,markdown:t}){let{fields:y,commit:E}=B(i),u=y.find(f=>f.field===a&&f.takesValue),[g,k]=(0,p.useState)(!1),b=(0,p.useRef)(null),n=(0,p.useRef)(!1);(0,p.useEffect)(()=>{!g&&n.current&&(n.current=!1,b.current?.focus())},[g]);let w=f=>{n.current=f,k(!1)},I=l.toLowerCase(),d=(0,e.jsx)(j,{text:s,markdown:t});return(0,e.jsxs)("div",{"data-graview-long":a,style:{display:"grid",gap:6,minWidth:0,...o},children:[(0,e.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...c},children:[(0,e.jsx)("span",{children:l}),u&&!g?(0,e.jsx)("button",{ref:b,type:"button","data-graview-editable":u.mutation,"aria-label":`Edit the ${I}`,title:`${u.title} \u2014 changes the ${I}, and can be undone`,onClick:()=>k(!0),style:Ee,children:"Edit"}):null]}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...m},children:g&&u?(0,e.jsx)(p.Suspense,{fallback:d,children:(0,e.jsx)(xe,{field:a,label:l,value:s,...t?{markdown:!0}:{},onCancel:()=>w(!0),onSave:(f,v)=>{w(!v),f!==s&&E(u,f)}})}):(0,e.jsx)("div",{"data-graview-field":a,...u?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${I}`},...u?{onClick:()=>k(!0)}:{},style:{cursor:u?"text":"default",minWidth:0},children:d})})]})}var xe=(0,p.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.GYICGZMG.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.3TVXGJTU.js"))),Ee={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function De({nodeId:i,children:a}){let{fields:l}=B(i),s=U(i);if(!s)return(0,e.jsx)(e.Fragment,{children:a});let c=l.find(m=>{let o=s[m.field];return typeof o=="string"&&o===a});return c?(0,e.jsx)(G,{nodeId:i,field:c.field,value:a,said:a}):(0,e.jsx)(e.Fragment,{children:a})}export{ce as a,G as b,ke as c,Ve as d,be as e,De as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m as y}from"./chunk.JOOQUWLT.js";import{F as N,Q as u,S as f}from"./chunk.6QWV5MVH.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var n=g(u(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,a]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);a(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let a=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:a||r,above:a&&e.scrollTop>1,below:a&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:a,children:r}){if(e===void 0)return(0,n.jsx)("strong",{style:a,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,n.jsx)(t,{style:{margin:0,...a},children:r})}function E({title:e,subtitle:l,meta:a,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:h,heading:w}){let c=(0,p.useRef)(null),{overflowing:b,above:x,below:S}=H(c),P=f(),o=(h??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),v=(0,p.useContext)(I);return(0,n.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":o?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:o?12:"var(--graview-gap, 7px)",height:o||s?"auto":"100%",maxHeight:o?"none":"100%",padding:o?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:o?0:"var(--graview-radius, 12px)",border:o?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:o?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:o?"visible":"hidden",...R[t],...o?{background:"transparent"}:{},...i},children:[t==="warning"?(0,n.jsx)("span",{"data-graview-broken":"",style:y,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,n.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,n.jsx)(O,{level:w,said:v===null||e!==v,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:o?"1.5625rem":"0.9375rem",lineHeight:o?1.15:1.25,fontWeight:o?600:560,letterSpacing:o?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),a===void 0?null:(0,n.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:a})]}),l===void 0?null:(0,n.jsx)("div",{style:{fontSize:o?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,n.jsx)("div",{ref:c,className:o?void 0:"graview-scroll",...b&&!o?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:o?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...o?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"}},"data-graview-more-above":x&&!o?"":void 0,"data-graview-more-below":S&&!o?"":void 0,children:d})]})}function m({label:e,hue:l,selected:a,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,n.jsxs)("span",{"data-graview-primitive":"chip","data-selected":a||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${a?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:a?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,n.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:a=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,n.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,n.jsx)(m,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:a.includes(i.id)},i.id)),d>0?(0,n.jsx)(m,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:a,onExpand:r,flagged:t,problems:d}){return(0,n.jsx)(E,{title:e,meta:d?(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,n.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:a&&a.length>0?(0,n.jsx)(L,{items:a,max:6,pick:!0}):null})}export{A as a,I as b,E as c,m as d,L as e,F as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y}from"./chunk.
|
|
1
|
+
import{b as y}from"./chunk.GYICGZMG.js";import"./chunk.JOOQUWLT.js";import{F as w,Q as c}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as l}from"./chunk.AJZBJBMO.js";var r=l(w(),1);var t=l(c(),1);function x({field:d,label:p,value:m,markdown:b,onSave:n,onCancel:u}){let[a,v]=(0,r.useState)(m),[i,h]=(0,r.useState)(!1),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>o.current?.focus(),[i]),(0,r.useLayoutEffect)(()=>{let e=o.current;if(!e||i||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let f=()=>{e.style.height="auto";let g=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(g.borderTopWidth)+parseFloat(g.borderBottomWidth)}px`};f();let S=requestAnimationFrame(f);return()=>cancelAnimationFrame(S)},[a,i]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),n(a,!1)},children:[i?(0,t.jsx)("div",{"data-graview-preview":d,"aria-label":`${p}, as it will read`,role:"region",style:C,children:(0,t.jsx)(y,{text:a,markdown:!0})}):(0,t.jsx)("textarea",{ref:o,"aria-label":p,"data-graview-field":d,value:a,rows:3,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),u()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n(a,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||n(a,!0)},style:E}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:s,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:u,style:s,children:"Cancel"}),b?(0,t.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>h(!i),style:s,children:i?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var C={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},s={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},E={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S,b as $,c as w,d as R,e as V}from"./chunk.HHPGWJDO.js";import{h as l,i as F}from"./chunk.42YX6NOY.js";import{va as b,wa as A}from"./chunk.6V2RG5JG.js";var O=["card","row","page"],E=["good","warn","bad","neutral","accent"],P=["money","percent","date","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],H=["card","row"],M=1e3,ue=100;function U(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},C=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Z=e=>/^(image|file)$/.test(e?.of??e?.type??"");function fe(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var X={field:()=>!1,relation:()=>!1,figure:!1},Y=e=>e.kind??"the home",p=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function z(e,n,o){let t=S(e);for(let d of t.unknownFunctions)o.findings.push(l("unknown-function",n,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let d of t.names){if(o.kind===null){o.findings.push(l("view-name",n,`"${d}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}d==="id"||o.spec.field(d)||o.spec.relation(d)||o.findings.push(l("view-name",n,`${o.kind} has no field or relation called "${d}"`))}for(let d of t.edges)o.edges.has(d)||o.findings.push(l("view-edge",n,`"${d}" is not a relation any kind declares`));for(let d of t.sweeps)o.kinds.has(d)||o.findings.push(l("view-kind",n,`"${d}" is not a kind this document declares`))}function k(e,n,o){if(typeof e!="string"||e.length===0||e.length>2e3){o.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{z(w(e),n,o)}catch(t){if(!(t instanceof $))throw t;o.findings.push(l("expression",n,`${t.sentence} (at character ${t.at+1})`))}}function j(e,n,o,t=!1){if(typeof e!="string"||e.length===0||e.length>300){o.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(a){if(a instanceof R||a instanceof $){o.findings.push(l("template",n,a.sentence));return}throw a}for(let a of d)if(a.expr&&(z(a.expr,n,o),t&&!a.format&&a.expr.t==="ident"&&(o.slot==="card"||o.slot==="row")&&o.spec.prose?.(a.expr.name))){let r=a.expr.name;o.findings.push(F("view-whole-text",n,`${o.kind} ${o.slot} shows ${r} whole; it will be clamped. Use {${r}|excerpt} or move it to the page.`,`write {${r}|excerpt}, or {${r}|excerpt: 80} for fewer characters`))}}function q(e,n,o){if(typeof e=="string"){E.includes(e)||o.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${E.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,o);return}o.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${E.join(", ")}`))}function x(e,n,o,t){if(!Array.isArray(e)){t.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(o>_){t.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((d,a)=>J(d,`${n}.${a}`,o,t))}function J(e,n,o,t){if(o===1&&t.count++,t.all++,!g(e)){t.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let d=Object.keys(e),a=d.filter(s=>C.includes(s)&&!(s==="group"&&d.includes("list")));if(a.length===0){t.findings.push(l("view-block",n,`${d.length>0?d.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(a.length>1){t.findings.push(l("view-block",n,`a block is one thing, and this says ${a.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=a[0];for(let s of d)s!==r&&s!="key"&&!v[r].includes(s)&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(u=>`"${u}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${n}.${r}`,t,r==="text"),"tone"in e&&q(e.tone,`${n}.tone`,t);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?t.spec.files?.(i):t.spec.field(i))){let f=typeof i=="string"&&t.spec.relation(i);t.findings.push(l(`view-${r}`,`${n}.${r}`,`${t.kind} has no ${s?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,f?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let u=s?["thumb","gallery"]:P;"as"in e&&!u.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${u.join(", ")}`)),s||N(e,n,t,"field"),"label"in e&&ie(e.label,`${n}.label`,t);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?t.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,t),k(i.max,`${n}.progress.max`,t)),"label"in e&&j(e.label,`${n}.label`,t);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&t.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,o+1,t);return;case"when":k(i,`${n}.when`,t),"show"in e?x(e.show,`${n}.show`,o+1,t):t.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,t);for(let s of["as","currency","label","emphasis"])s in e&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?t.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):t.spec.figure||t.findings.push(l("view-figure",`${n}.figure`,`${Y(t)} has no figure to show`,t.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,t);case"divider":i!==!0&&t.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,o){k(e.figure,`${n}.figure`,o),"as"in e&&!L.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),N(e,n,o,"figure"),"label"in e&&j(e.label,`${n}.label`,o),"emphasis"in e&&!B.includes(e.emphasis)&&o.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(t=>`"${t}"`).join(", ")}, or leave it out for the figure's own size`))}function N(e,n,o,t){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?o.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&o.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${t} shown as money`,'add "as": "money"')))}function ee(e,n){let o=[...n.kinds],t=(a,r)=>{let i=new Set;for(let s of a){let u=n.vocabulary.namesOf(s)?.targets?.(r);if(u==="*")return o;for(let f of u??[])i.add(f)}return i.size>0?[...i]:void 0},d=a=>{switch(a.t){case"ident":return n.kind!==null&&n.spec.relation(a.name)?t([n.kind],a.name):void 0;case"member":{let r=d(a.object);return r?t(r,a.name):void 0}case"where":return d(a.set);case"call":{let r=a.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(a.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=a.args.length===2&&a.args[1]?.t==="lit"&&typeof a.args[1].value=="string"?a.args[1].value:void 0;if(a.fn==="out"&&s!==void 0){let u=d(r);return u?t(u,s):void 0}if(a.fn==="out")return i!==void 0&&n.kind!==null?t([n.kind],i):void 0;if(a.fn==="in"){let u=s??i,f=s!==void 0?d(r):n.kind!==null?[n.kind]:void 0,c=u!==void 0?n.vocabulary.sources(u).filter(m=>{let y=n.vocabulary.namesOf(m)?.targets?.(u);return!f||y==="*"||f.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((a.fn==="sort"||a.fn==="first")&&r)return d(r);if(a.fn==="either"){let u=a.args.map(d);return u.every(f=>f!==void 0)?[...new Set(u.flatMap(f=>f??[]))]:void 0}return}default:return}};return d(e)}function K(e,n,o,t){let d;try{d=w(e)}catch(r){if(!(r instanceof $))throw r;t.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let a=S(d);for(let r of a.unknownFunctions)t.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of a.edges)t.edges.has(r)||t.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(o)for(let r of a.names)r==="id"||o.some(i=>t.vocabulary.namesOf(i)?.field(r)||t.vocabulary.namesOf(i)?.relation(r))||t.findings.push(l("view-name",n,`${o.join(" and ")} ${o.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,o){let t=e.list;k(t,`${n}.list`,o);let d;if(typeof t=="string")try{d=ee(w(t),o)}catch{d=void 0}let a=i=>{if(!d)return[...o.kinds].map(u=>o.vocabulary.namesOf(u)?.choices?.(i)).find(u=>u!==void 0);let s=d.map(u=>o.vocabulary.namesOf(u)?.choices?.(i));return s.every(u=>u!==void 0)?[...new Set(s.flatMap(u=>u??[]))]:void 0},r=d?d.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,d,o);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?o.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?a(i.by)===void 0&&o.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,d,o)}else o.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&o.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(f=>f==="by"||f==="headings"))||s===void 0)o.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let f=a(s),c=f===void 0?U(s):void 0,m=c!==void 0&&(c.way!==void 0?o.edges.has(c.edge):d?d.every(y=>o.vocabulary.namesOf(y)?.relation(c.edge)):o.edges.has(c.edge));if(f===void 0&&!m&&o.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))o.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(f)for(let h of Object.keys(y))f.includes(h)||o.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${f.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&o.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!H.includes(e.as)&&o.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,o){(typeof e!="string"||e.length===0||e.length>60)&&o.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function W(e,n,o,t,d,a,r){let i={kind:null,spec:X,kinds:t,edges:d,vocabulary:o,findings:a,count:0,all:0};Array.isArray(e)&&e.length===0&&a.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),D(i,n,r,"show less")}function D(e,n,o,t){e.count>T?e.findings.push(l("view-size",n,`${o} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${t}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${o} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,t))}function oe(e,n,o,t,d){Array.isArray(e)&&e.forEach((a,r)=>{if(!g(a)||a.name!=="blocks"||!g(a.options)||!("blocks"in a.options))return;let i=[];W(a.options.blocks,`lenses.${r}.options.blocks`,n,o,t,i,`the lens "${String(a.title??r)}"`);for(let s of i)d.push({...s,severity:"warning"})})}function te(e,n,o,t,d,a,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,u]of Object.entries(e)){if(s==="home"&&Array.isArray(u)){W(u,`${n}.home`,r,t,d,i,"the home");continue}let f=o(s);if(!f){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${a} declares`));continue}if(!g(u)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(u))O.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${O.map(m=>`"${m}"`).join(", ")}`));for(let c of O){let m=u[c];if(m===void 0)continue;let y={kind:s,spec:f,kinds:t,edges:d,vocabulary:r,findings:i,count:0,all:0,slot:c};x(m,`${n}.${s}.${c}`,1,y),D(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),o=new Set(Object.values(e.kinds).flatMap(r=>Object.keys(b(r.edges)))),t=r=>{let i=p(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>p(i.fields,s)||p(i.computed,s)||A(i.edges).has(s),relation:s=>p(b(i.edges),s),figure:i.figure!==void 0,files:s=>p(i.fields,s)&&Z(i.fields[s]),choices:s=>p(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>p(b(i.edges),s)?i.edges[s].to:void 0,prose:s=>p(i.fields,s)&&i.fields[s].type==="text"}:void 0},d={namesOf:t,sources:r=>Object.keys(e.kinds).filter(i=>p(e.kinds[i].edges,r))},a=te(e.views,"views",t,n,o,"document",d);return oe(e.lenses,d,n,o,a),a}export{E as a,P as b,L as c,B as d,M as e,ue as f,U as g,fe as h,ce as i,ge as j};
|
|
1
|
+
import{a as S,b as $,c as w,d as R,e as V}from"./chunk.FWTIUYXH.js";import{h as l,i as F}from"./chunk.MAF7C3VM.js";import{wa as b,xa as A}from"./chunk.MNP4JI33.js";var O=["card","row","page"],E=["good","warn","bad","neutral","accent"],P=["money","percent","date","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],H=["card","row"],M=1e3,ue=100;function U(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},C=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Z=e=>/^(image|file)$/.test(e?.of??e?.type??"");function fe(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var X={field:()=>!1,relation:()=>!1,figure:!1},Y=e=>e.kind??"the home",p=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function z(e,n,o){let t=S(e);for(let d of t.unknownFunctions)o.findings.push(l("unknown-function",n,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let d of t.names){if(o.kind===null){o.findings.push(l("view-name",n,`"${d}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}d==="id"||o.spec.field(d)||o.spec.relation(d)||o.findings.push(l("view-name",n,`${o.kind} has no field or relation called "${d}"`))}for(let d of t.edges)o.edges.has(d)||o.findings.push(l("view-edge",n,`"${d}" is not a relation any kind declares`));for(let d of t.sweeps)o.kinds.has(d)||o.findings.push(l("view-kind",n,`"${d}" is not a kind this document declares`))}function k(e,n,o){if(typeof e!="string"||e.length===0||e.length>2e3){o.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{z(w(e),n,o)}catch(t){if(!(t instanceof $))throw t;o.findings.push(l("expression",n,`${t.sentence} (at character ${t.at+1})`))}}function j(e,n,o,t=!1){if(typeof e!="string"||e.length===0||e.length>300){o.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(a){if(a instanceof R||a instanceof $){o.findings.push(l("template",n,a.sentence));return}throw a}for(let a of d)if(a.expr&&(z(a.expr,n,o),t&&!a.format&&a.expr.t==="ident"&&(o.slot==="card"||o.slot==="row")&&o.spec.prose?.(a.expr.name))){let r=a.expr.name;o.findings.push(F("view-whole-text",n,`${o.kind} ${o.slot} shows ${r} whole; it will be clamped. Use {${r}|excerpt} or move it to the page.`,`write {${r}|excerpt}, or {${r}|excerpt: 80} for fewer characters`))}}function q(e,n,o){if(typeof e=="string"){E.includes(e)||o.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${E.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,o);return}o.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${E.join(", ")}`))}function x(e,n,o,t){if(!Array.isArray(e)){t.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(o>_){t.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((d,a)=>J(d,`${n}.${a}`,o,t))}function J(e,n,o,t){if(o===1&&t.count++,t.all++,!g(e)){t.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let d=Object.keys(e),a=d.filter(s=>C.includes(s)&&!(s==="group"&&d.includes("list")));if(a.length===0){t.findings.push(l("view-block",n,`${d.length>0?d.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(a.length>1){t.findings.push(l("view-block",n,`a block is one thing, and this says ${a.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=a[0];for(let s of d)s!==r&&s!="key"&&!v[r].includes(s)&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(u=>`"${u}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${n}.${r}`,t,r==="text"),"tone"in e&&q(e.tone,`${n}.tone`,t);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?t.spec.files?.(i):t.spec.field(i))){let f=typeof i=="string"&&t.spec.relation(i);t.findings.push(l(`view-${r}`,`${n}.${r}`,`${t.kind} has no ${s?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,f?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let u=s?["thumb","gallery"]:P;"as"in e&&!u.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${u.join(", ")}`)),s||N(e,n,t,"field"),"label"in e&&ie(e.label,`${n}.label`,t);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?t.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,t),k(i.max,`${n}.progress.max`,t)),"label"in e&&j(e.label,`${n}.label`,t);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&t.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,o+1,t);return;case"when":k(i,`${n}.when`,t),"show"in e?x(e.show,`${n}.show`,o+1,t):t.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,t);for(let s of["as","currency","label","emphasis"])s in e&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?t.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):t.spec.figure||t.findings.push(l("view-figure",`${n}.figure`,`${Y(t)} has no figure to show`,t.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,t);case"divider":i!==!0&&t.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,o){k(e.figure,`${n}.figure`,o),"as"in e&&!L.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),N(e,n,o,"figure"),"label"in e&&j(e.label,`${n}.label`,o),"emphasis"in e&&!B.includes(e.emphasis)&&o.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(t=>`"${t}"`).join(", ")}, or leave it out for the figure's own size`))}function N(e,n,o,t){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?o.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&o.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${t} shown as money`,'add "as": "money"')))}function ee(e,n){let o=[...n.kinds],t=(a,r)=>{let i=new Set;for(let s of a){let u=n.vocabulary.namesOf(s)?.targets?.(r);if(u==="*")return o;for(let f of u??[])i.add(f)}return i.size>0?[...i]:void 0},d=a=>{switch(a.t){case"ident":return n.kind!==null&&n.spec.relation(a.name)?t([n.kind],a.name):void 0;case"member":{let r=d(a.object);return r?t(r,a.name):void 0}case"where":return d(a.set);case"call":{let r=a.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(a.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=a.args.length===2&&a.args[1]?.t==="lit"&&typeof a.args[1].value=="string"?a.args[1].value:void 0;if(a.fn==="out"&&s!==void 0){let u=d(r);return u?t(u,s):void 0}if(a.fn==="out")return i!==void 0&&n.kind!==null?t([n.kind],i):void 0;if(a.fn==="in"){let u=s??i,f=s!==void 0?d(r):n.kind!==null?[n.kind]:void 0,c=u!==void 0?n.vocabulary.sources(u).filter(m=>{let y=n.vocabulary.namesOf(m)?.targets?.(u);return!f||y==="*"||f.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((a.fn==="sort"||a.fn==="first")&&r)return d(r);if(a.fn==="either"){let u=a.args.map(d);return u.every(f=>f!==void 0)?[...new Set(u.flatMap(f=>f??[]))]:void 0}return}default:return}};return d(e)}function K(e,n,o,t){let d;try{d=w(e)}catch(r){if(!(r instanceof $))throw r;t.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let a=S(d);for(let r of a.unknownFunctions)t.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of a.edges)t.edges.has(r)||t.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(o)for(let r of a.names)r==="id"||o.some(i=>t.vocabulary.namesOf(i)?.field(r)||t.vocabulary.namesOf(i)?.relation(r))||t.findings.push(l("view-name",n,`${o.join(" and ")} ${o.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,o){let t=e.list;k(t,`${n}.list`,o);let d;if(typeof t=="string")try{d=ee(w(t),o)}catch{d=void 0}let a=i=>{if(!d)return[...o.kinds].map(u=>o.vocabulary.namesOf(u)?.choices?.(i)).find(u=>u!==void 0);let s=d.map(u=>o.vocabulary.namesOf(u)?.choices?.(i));return s.every(u=>u!==void 0)?[...new Set(s.flatMap(u=>u??[]))]:void 0},r=d?d.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,d,o);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?o.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?a(i.by)===void 0&&o.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,d,o)}else o.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&o.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(f=>f==="by"||f==="headings"))||s===void 0)o.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let f=a(s),c=f===void 0?U(s):void 0,m=c!==void 0&&(c.way!==void 0?o.edges.has(c.edge):d?d.every(y=>o.vocabulary.namesOf(y)?.relation(c.edge)):o.edges.has(c.edge));if(f===void 0&&!m&&o.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))o.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(f)for(let h of Object.keys(y))f.includes(h)||o.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${f.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&o.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!H.includes(e.as)&&o.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,o){(typeof e!="string"||e.length===0||e.length>60)&&o.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function W(e,n,o,t,d,a,r){let i={kind:null,spec:X,kinds:t,edges:d,vocabulary:o,findings:a,count:0,all:0};Array.isArray(e)&&e.length===0&&a.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),D(i,n,r,"show less")}function D(e,n,o,t){e.count>T?e.findings.push(l("view-size",n,`${o} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${t}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${o} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,t))}function oe(e,n,o,t,d){Array.isArray(e)&&e.forEach((a,r)=>{if(!g(a)||a.name!=="blocks"||!g(a.options)||!("blocks"in a.options))return;let i=[];W(a.options.blocks,`lenses.${r}.options.blocks`,n,o,t,i,`the lens "${String(a.title??r)}"`);for(let s of i)d.push({...s,severity:"warning"})})}function te(e,n,o,t,d,a,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,u]of Object.entries(e)){if(s==="home"&&Array.isArray(u)){W(u,`${n}.home`,r,t,d,i,"the home");continue}let f=o(s);if(!f){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${a} declares`));continue}if(!g(u)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(u))O.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${O.map(m=>`"${m}"`).join(", ")}`));for(let c of O){let m=u[c];if(m===void 0)continue;let y={kind:s,spec:f,kinds:t,edges:d,vocabulary:r,findings:i,count:0,all:0,slot:c};x(m,`${n}.${s}.${c}`,1,y),D(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),o=new Set(Object.values(e.kinds).flatMap(r=>Object.keys(b(r.edges)))),t=r=>{let i=p(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>p(i.fields,s)||p(i.computed,s)||A(i.edges).has(s),relation:s=>p(b(i.edges),s),figure:i.figure!==void 0,files:s=>p(i.fields,s)&&Z(i.fields[s]),choices:s=>p(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>p(b(i.edges),s)?i.edges[s].to:void 0,prose:s=>p(i.fields,s)&&i.fields[s].type==="text"}:void 0},d={namesOf:t,sources:r=>Object.keys(e.kinds).filter(i=>p(e.kinds[i].edges,r))},a=te(e.views,"views",t,n,o,"document",d);return oe(e.lenses,d,n,o,a),a}export{E as a,P as b,L as c,B as d,M as e,ue as f,U as g,fe as h,ce as i,ge as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./chunk.
|
|
1
|
+
import{e as a}from"./chunk.EBGAYL32.js";import{m as i}from"./chunk.6QWV5MVH.js";import{Gc as o}from"./chunk.MNP4JI33.js";function p(t){let r=t.within??{};return o({...r.sort?{sort:r.sort}:{},...r.filter?{filter:r.filter}:{},...r.group?{group:r.group}:{},...r.q?{q:r.q}:{},...r.archived?{archived:r.archived}:{}})}function c(t,r){let m=a(r),e=t;for(let n of["sort","filter","group","q","archived"])e=i(e,n,m[n]??null);return e}export{p as a,c as b};
|