@svgrid/enterprise 3.1.64 → 3.1.65
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/cdn/svgrid-enterprise.svelte-external.js +1 -1
- package/dist/designer/assets/{index-C1IclnOu.js → index-wvhd95j1.js} +1 -1
- package/dist/designer/index.html +1 -1
- package/dist/fields/AttachmentPreview.svelte +15 -2
- package/dist/fields/attachments.d.ts +10 -0
- package/dist/fields/attachments.js +1 -1
- package/dist/node/studio.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wc/sv-base-element.js +81 -81
- package/package.json +1 -1
|
@@ -1527,7 +1527,7 @@ ${O}
|
|
|
1527
1527
|
@keyframes st-home-spin { to { transform: rotate(360deg); } }
|
|
1528
1528
|
</style>
|
|
1529
1529
|
`}}function $S(t){for(let a of t)ss(a);let r=new Map(t.map(a=>[a.name,a])),n=t.map(a=>{let l=xse(a,r);return{schema:kse(a,l),infos:l}});return{entries:n,seed:_se(n)}}function ED(t,r={}){let{entries:n,seed:a}=$S(t),{file:l,needs:i}=Vse(n,a,r.sources,r.supabaseConn,r.serverMemory),o=[Cse(n),l];(i.supabase||r.supabaseAuth)&&!i.supabaseUrl&&(r.supabaseConn?.url||r.supabaseConn?.key)&&(i.supabaseUrl=r.supabaseConn.url,i.supabaseKey=r.supabaseConn.key),(i.supabase||r.supabaseAuth)&&o.push(Hse(i));for(let s of i.sqlRoutes)o.push(Fse(s.schema,s.table,s.dialect,{access:r.accessEnabled,audit:r.auditEnabled,screenIds:r.screensByEntity?.get(s.schema.name)??[],triggers:r.triggers?.[s.schema.name],dbSchema:s.dbSchema,tenantField:r.tenantField&&r.tenantScoped?.(s.schema.name)!==!1?r.tenantField:void 0}));if(i.memoryRoutes.length){o.push(Lse(i.memoryRoutes));for(let s of i.memoryRoutes)o.push(Ose(s.schema,{access:r.accessEnabled,audit:r.auditEnabled,screenIds:r.screensByEntity?.get(s.schema.name)??[],triggers:r.triggers?.[s.schema.name],tenantField:r.tenantField&&r.tenantScoped?.(s.schema.name)!==!1?r.tenantField:void 0}))}return{files:o,prepared:n.map(s=>s.schema)}}function Kse(t){if(t.length===0)throw Error("emitStudioApp: no schemas to emit");let{files:r,prepared:n}=ED(t),a=n.map(i=>{let o=Oa(i);return{href:`/${o.route}`,label:o.label}}),l={path:"src/custom.css",description:"Your custom styles (imported after app.css so it overrides).",userOwned:!0,contents:`/* Your custom styles. Imported after app.css, so these rules override the defaults. */
|
|
1530
|
-
`};return[...r,...n.map(i=>Wse(i)),AD(a),MD(a),l]}var Gse="3.1.
|
|
1530
|
+
`};return[...r,...n.map(i=>Wse(i)),AD(a),MD(a),l]}var Gse="3.1.65",Yse="3.0.39",hl=(t,r)=>t.some(n=>n.config.kind===r),RD=t=>`activeTab_${t.replace(/[^a-zA-Z0-9_$]/g,"_")}`,Zm=(t,r)=>`${t}-${r}`,ID=t=>`accOpen_${t.replace(/[^a-zA-Z0-9_$]/g,"_")}`,Qm=(t,r)=>`${t}-s${r}`,ev=t=>`md_${t.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function Xse(t){switch(t.type){case"number":{let r=t.decimals;return r==null?"{ type: 'number' }":`{ type: 'number', options: { minimumFractionDigits: ${r}, maximumFractionDigits: ${r} } }`}case"currency":return`{ type: 'currency', currency: ${en(t.currency||"USD")} }`;case"percent":{let r=["type: 'percent'"];return t.valueIsPercentPoints&&r.push("valueIsPercentPoints: true"),t.decimals!=null&&r.push(`options: { minimumFractionDigits: ${t.decimals}, maximumFractionDigits: ${t.decimals} }`),`{ ${r.join(", ")} }`}case"date":case"datetime":return t.pattern?`{ type: '${t.type}', pattern: ${en(t.pattern)} }`:`{ type: '${t.type}' }`}}function Jse(t,r,n,a){if(r.config.kind!=="grid")return`schemaToColumns(${t})`;let l=r.config,i=r.id.replace(/-/g,"_"),o=l.columns.filter(b=>b.show),s=new Set(o.map(b=>b.field)),c=new Set,d=o.map(b=>{let w=a?.get(b.field);return{c:b,col:w&&!s.has(w)?w:b.field}}).filter(b=>!c.has(b.col)&&!!c.add(b.col)),u=l.editing==="inline"?"":", editable: false";if(d.length===0)return u?`schemaToColumns(${t}).map((c) => ({ ...c${u} }))`:`schemaToColumns(${t})`;let p=d.map(b=>`'${b.col}'`),f=d.map(({c:b,col:w})=>{let v=[];return b.header&&v.push(`header: ${JSON.stringify(b.header)}`),b.width!=null&&v.push(`width: ${b.width}`),b.align&&v.push(`align: '${b.align}'`),b.aggregate&&v.push(`aggregate: '${b.aggregate}'`),l.treeData&&b.field===l.treeData.labelField&&n?v.push(`cell: (ctx: CellContext<${n}>) => renderSnippet(treeCell_${i}, { value: ctx.getValue(), row: ctx.row.original })`):b.cellType&&n?v.push(`cell: (ctx: CellContext<${n}>) => renderSnippet(${zD(i,b.field)}, { value: ctx.getValue() })`):b.format&&v.push(`format: ${Xse(b.format)}`),v.length?`'${w}': { ${v.join(", ")} }`:null}).filter(b=>!!b),y=f.length?` const ov: Record<string, Partial<(typeof all)[number]>> = { ${f.join(", ")} };`:"",h=f.length?", ...(ov[String(c.field)] ?? {})":"",_=`[${p.join(", ")}].map((f) => all.find((c) => c.field === f)).filter((c): c is (typeof all)[number] => !!c)`;return`(() => { const all = schemaToColumns(${t});${y} return ${u||h?`${_}.map((c) => ({ ...c${u}${h} }))`:_} })()`}function tc(t,r){let n=[`grid-column: span ${Xie(t)}`,"min-width: 0"];r&&n.push(r);let a=Zie(t.style);return a&&n.push(a),`style="${n.join("; ")}"`}var Zse=t=>t&&t.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function Nu(t,r){let n=[r,Yie(t)].filter(Boolean).join(" ");return n?` class="${n}"`:""}function n1(t){let r=cS(t.className);return r?` ${r}`:""}function Qse(t){let r=Af(t);if(r==="grid"){let n=goe(t),a=n.maxWidth?` max-width: ${n.maxWidth}px; margin-inline: auto;`:"";return` .st-screen { grid-template-columns: repeat(12, 1fr); gap: ${n.rowGap}px ${n.colGap}px; align-items: ${n.align};${a} }
|
|
1531
1531
|
@media (max-width: ${n.mobileBreakpoint}px) { .st-screen { grid-template-columns: 1fr; gap: 12px; } }
|
|
1532
1532
|
`}if(r==="stack"){let n=foe(t),a=n.maxWidth?` max-width: ${n.maxWidth}px;${n.align==="center"?" margin-inline: auto;":""}`:"",l=n.minHeight?`
|
|
1533
1533
|
.st-stack > * { min-height: ${n.minHeight}px; }`:"",i=n.dividers?`
|
|
@@ -76332,7 +76332,7 @@ ${st}
|
|
|
76332
76332
|
.st-home a { color: var(--sg-accent, #6366f1); font-weight: 600; }
|
|
76333
76333
|
@keyframes st-home-spin { to { transform: rotate(360deg); } }
|
|
76334
76334
|
</style>
|
|
76335
|
-
`}}function s2e(a){for(let p of a)G4(p);let i=new Map(a.map(p=>[p.name,p])),l=a.map(p=>{let f=kpr(p,i);return{schema:Ppr(p,f),infos:f}});return{entries:l,seed:Cpr(l)}}function rur(a,i={}){let{entries:l,seed:p}=s2e(a),{file:f,needs:g}=Ypr(l,p,i.sources,i.supabaseConn,i.serverMemory),_=[Opr(l),f];(g.supabase||i.supabaseAuth)&&!g.supabaseUrl&&(i.supabaseConn?.url||i.supabaseConn?.key)&&(g.supabaseUrl=i.supabaseConn.url,g.supabaseKey=i.supabaseConn.key),(g.supabase||i.supabaseAuth)&&_.push(Zpr(g));for(let S of g.sqlRoutes)_.push(Upr(S.schema,S.table,S.dialect,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],dbSchema:S.dbSchema,tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}));if(g.memoryRoutes.length){_.push(Hpr(g.memoryRoutes));for(let S of g.memoryRoutes)_.push(Vpr(S.schema,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}))}return{files:_,prepared:l.map(S=>S.schema)}}var nur="3.1.
|
|
76335
|
+
`}}function s2e(a){for(let p of a)G4(p);let i=new Map(a.map(p=>[p.name,p])),l=a.map(p=>{let f=kpr(p,i);return{schema:Ppr(p,f),infos:f}});return{entries:l,seed:Cpr(l)}}function rur(a,i={}){let{entries:l,seed:p}=s2e(a),{file:f,needs:g}=Ypr(l,p,i.sources,i.supabaseConn,i.serverMemory),_=[Opr(l),f];(g.supabase||i.supabaseAuth)&&!g.supabaseUrl&&(i.supabaseConn?.url||i.supabaseConn?.key)&&(g.supabaseUrl=i.supabaseConn.url,g.supabaseKey=i.supabaseConn.key),(g.supabase||i.supabaseAuth)&&_.push(Zpr(g));for(let S of g.sqlRoutes)_.push(Upr(S.schema,S.table,S.dialect,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],dbSchema:S.dbSchema,tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}));if(g.memoryRoutes.length){_.push(Hpr(g.memoryRoutes));for(let S of g.memoryRoutes)_.push(Vpr(S.schema,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}))}return{files:_,prepared:l.map(S=>S.schema)}}var nur="3.1.65",our="3.0.39",sb=(a,i)=>a.some(l=>l.config.kind===i),qit=a=>`activeTab_${a.replace(/[^a-zA-Z0-9_$]/g,"_")}`,XZ=(a,i)=>`${a}-${i}`,Kit=a=>`accOpen_${a.replace(/[^a-zA-Z0-9_$]/g,"_")}`,JZ=(a,i)=>`${a}-s${i}`,YZ=a=>`md_${a.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function aur(a){switch(a.type){case"number":{let i=a.decimals;return i==null?"{ type: 'number' }":`{ type: 'number', options: { minimumFractionDigits: ${i}, maximumFractionDigits: ${i} } }`}case"currency":return`{ type: 'currency', currency: ${cu(a.currency||"USD")} }`;case"percent":{let i=["type: 'percent'"];return a.valueIsPercentPoints&&i.push("valueIsPercentPoints: true"),a.decimals!=null&&i.push(`options: { minimumFractionDigits: ${a.decimals}, maximumFractionDigits: ${a.decimals} }`),`{ ${i.join(", ")} }`}case"date":case"datetime":return a.pattern?`{ type: '${a.type}', pattern: ${cu(a.pattern)} }`:`{ type: '${a.type}' }`}}function iur(a,i,l,p){if(i.config.kind!=="grid")return`schemaToColumns(${a})`;let f=i.config,g=i.id.replace(/-/g,"_"),_=f.columns.filter(be=>be.show),S=new Set(_.map(be=>be.field)),A=new Set,k=_.map(be=>{let Be=p?.get(be.field);return{c:be,col:Be&&!S.has(Be)?Be:be.field}}).filter(be=>!A.has(be.col)&&!!A.add(be.col)),L=f.editing==="inline"?"":", editable: false";if(k.length===0)return L?`schemaToColumns(${a}).map((c) => ({ ...c${L} }))`:`schemaToColumns(${a})`;let F=k.map(be=>`'${be.col}'`),ee=k.map(({c:be,col:Be})=>{let Ue=[];return be.header&&Ue.push(`header: ${JSON.stringify(be.header)}`),be.width!=null&&Ue.push(`width: ${be.width}`),be.align&&Ue.push(`align: '${be.align}'`),be.aggregate&&Ue.push(`aggregate: '${be.aggregate}'`),f.treeData&&be.field===f.treeData.labelField&&l?Ue.push(`cell: (ctx: CellContext<${l}>) => renderSnippet(treeCell_${g}, { value: ctx.getValue(), row: ctx.row.original })`):be.cellType&&l?Ue.push(`cell: (ctx: CellContext<${l}>) => renderSnippet(${est(g,be.field)}, { value: ctx.getValue() })`):be.format&&Ue.push(`format: ${aur(be.format)}`),Ue.length?`'${Be}': { ${Ue.join(", ")} }`:null}).filter(be=>!!be),J=ee.length?` const ov: Record<string, Partial<(typeof all)[number]>> = { ${ee.join(", ")} };`:"",te=ee.length?", ...(ov[String(c.field)] ?? {})":"",Ie=`[${F.join(", ")}].map((f) => all.find((c) => c.field === f)).filter((c): c is (typeof all)[number] => !!c)`;return`(() => { const all = schemaToColumns(${a});${J} return ${L||te?`${Ie}.map((c) => ({ ...c${L}${te} }))`:Ie} })()`}function eW(a,i){let l=[`grid-column: span ${yM(a)}`,"min-width: 0"];i&&l.push(i);let p=vit(a.style);return p&&l.push(p),`style="${l.join("; ")}"`}var sur=a=>a&&a.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function z8(a,i){let l=[i,LH(a)].filter(Boolean).join(" ");return l?` class="${l}"`:""}function ofe(a){let i=WZ(a.className);return i?` ${i}`:""}function lur(a){let i=iR(a);if(i==="grid"){let l=qDe(a),p=l.maxWidth?` max-width: ${l.maxWidth}px; margin-inline: auto;`:"";return` .st-screen { grid-template-columns: repeat(12, 1fr); gap: ${l.rowGap}px ${l.colGap}px; align-items: ${l.align};${p} }
|
|
76336
76336
|
@media (max-width: ${l.mobileBreakpoint}px) { .st-screen { grid-template-columns: 1fr; gap: 12px; } }
|
|
76337
76337
|
`}if(i==="stack"){let l=que(a),p=l.maxWidth?` max-width: ${l.maxWidth}px;${l.align==="center"?" margin-inline: auto;":""}`:"",f=l.minHeight?`
|
|
76338
76338
|
.st-stack > * { min-height: ${l.minHeight}px; }`:"",g=l.dividers?`
|
package/dist/designer/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>SvGrid Studio - Designer</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-wvhd95j1.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-Dd_uD5pT.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/index-client-CwjHmKgT.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/disclose-version-xihTtKlq.js">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{SvModal}from"@svgrid/grid";import{formatBytes,isImage,isPdf,pdfFrameUrl,safeUrl}from"./attachments";import{bm}from"./messages.svelte";let{items,index=$bindable()}=$props();let open=$state(true);const item=$derived(index==null?null:items[index]??null);const src=$derived(item?safeUrl(item.url,isImage(item)):null);let frame=$state(null);$effect(()=>{const url=item&&src&&isPdf(item)?src:null;frame=null;if(!url)return;let gone=false;let copy=null;void pdfFrameUrl(url).then(found=>{copy=found;if(gone){if(copy)URL.revokeObjectURL(copy)}else frame=found});return()=>{gone=true;if(copy)URL.revokeObjectURL(copy)}});function step(d){if(index==null||items.length<2)return;index=(index+d+items.length)%items.length}function close(){open=false;index=null}let box=$state(null);let pdf=$state(null);let overFile=false;let tabbedAt=0;function takeFocusBack(loading=false){if(overFile&&!loading||Date.now()-tabbedAt<500||!pdf||document.activeElement!==pdf)return;const dialog=box?.closest('[role="dialog"]');(dialog?.querySelector(".sv-attp-btn:not(:disabled)")??dialog?.querySelector("button:not(:disabled)"))?.focus()}const soon=()=>void setTimeout(takeFocusBack);const loaded=()=>{for(const ms of[0,200,600,1500])setTimeout(()=>takeFocusBack(true),ms)};
|
|
2
|
+
import{SvModal}from"@svgrid/grid";import{formatBytes,isAudio,isImage,isPdf,isVideo,pdfFrameUrl,safeUrl}from"./attachments";import{bm}from"./messages.svelte";let{items,index=$bindable()}=$props();let open=$state(true);const item=$derived(index==null?null:items[index]??null);const src=$derived(item?safeUrl(item.url,isImage(item)):null);let frame=$state(null);$effect(()=>{const url=item&&src&&isPdf(item)?src:null;frame=null;if(!url)return;let gone=false;let copy=null;void pdfFrameUrl(url).then(found=>{copy=found;if(gone){if(copy)URL.revokeObjectURL(copy)}else frame=found});return()=>{gone=true;if(copy)URL.revokeObjectURL(copy)}});function step(d){if(index==null||items.length<2)return;index=(index+d+items.length)%items.length}function close(){open=false;index=null}let box=$state(null);let pdf=$state(null);let overFile=false;let tabbedAt=0;function takeFocusBack(loading=false){if(overFile&&!loading||Date.now()-tabbedAt<500||!pdf||document.activeElement!==pdf)return;const dialog=box?.closest('[role="dialog"]');(dialog?.querySelector(".sv-attp-btn:not(:disabled)")??dialog?.querySelector("button:not(:disabled)"))?.focus()}const soon=()=>void setTimeout(takeFocusBack);const loaded=()=>{for(const ms of[0,200,600,1500])setTimeout(()=>takeFocusBack(true),ms)};
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<SvModal bind:open title={item ? `${item.name}${item.size ? ` (${formatBytes(item.size)})` : ''}` : ''} width={900} onClose={close}>
|
|
@@ -8,6 +8,17 @@ import{SvModal}from"@svgrid/grid";import{formatBytes,isImage,isPdf,pdfFrameUrl,s
|
|
|
8
8
|
{#if item && src && isImage(item)}
|
|
9
9
|
|
|
10
10
|
{#key src}<img class="sv-attp-img" {src} alt={item.name} />{/key}
|
|
11
|
+
{:else if item && src && isVideo(item)}
|
|
12
|
+
|
|
13
|
+
{#key src}<video class="sv-attp-video" {src} controls playsinline preload="metadata" aria-label={item.name}><track kind="captions" /></video>{/key}
|
|
14
|
+
{:else if item && src && isAudio(item)}
|
|
15
|
+
{#key src}
|
|
16
|
+
<div class="sv-attp-file">
|
|
17
|
+
<span class="sv-attp-name">{item.name}</span>
|
|
18
|
+
<audio class="sv-attp-audio" {src} controls preload="metadata" aria-label={item.name}></audio>
|
|
19
|
+
<a class="sv-attp-download" href={src} download={item.name} target="_blank" rel="noopener noreferrer">{bm('record.download')}</a>
|
|
20
|
+
</div>
|
|
21
|
+
{/key}
|
|
11
22
|
{:else if item && src && frame}
|
|
12
23
|
<iframe
|
|
13
24
|
class="sv-attp-pdf"
|
|
@@ -41,6 +52,8 @@ import{SvModal}from"@svgrid/grid";import{formatBytes,isImage,isPdf,pdfFrameUrl,s
|
|
|
41
52
|
onblur={soon}
|
|
42
53
|
onkeydown={(e) => {
|
|
43
54
|
if (!open) return
|
|
55
|
+
// In a player the arrows seek: they are its, not Previous and Next.
|
|
56
|
+
if ((e.key === 'ArrowRight' || e.key === 'ArrowLeft') && (e.target as Element | null)?.closest?.('video, audio')) return
|
|
44
57
|
if (e.key === 'ArrowRight') step(1)
|
|
45
58
|
else if (e.key === 'ArrowLeft') step(-1)
|
|
46
59
|
else if (e.key === 'Tab') tabbedAt = Date.now()
|
|
@@ -48,5 +61,5 @@ import{SvModal}from"@svgrid/grid";import{formatBytes,isImage,isPdf,pdfFrameUrl,s
|
|
|
48
61
|
/>
|
|
49
62
|
|
|
50
63
|
<style>
|
|
51
|
-
.sv-attp{display:flex;align-items:center;justify-content:center;min-height:360px;max-height:70vh}.sv-attp-img{max-width:100%;max-height:70vh;object-fit:contain;border-radius:6px}.sv-attp-pdf{width:100%;height:70vh;border:0;border-radius:6px}.sv-attp-file{display:flex;flex-direction:column;align-items:center;gap:12px}.sv-attp-name{font-size:15px}.sv-attp-download{color:inherit;text-decoration:underline}.sv-attp-footer{display:flex;align-items:center;justify-content:center;gap:12px;width:100%}.sv-attp-count{font-size:13px;color:var(--sg-muted, #64748b)}.sv-attp-btn{height:30px;padding:0 12px;font:inherit;font-size:13px;cursor:pointer;border:1px solid var(--sg-border, #e2e8f0);border-radius:6px;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a)}.sv-attp-btn:disabled{opacity:.5;cursor:default}
|
|
64
|
+
.sv-attp{display:flex;align-items:center;justify-content:center;min-height:360px;max-height:70vh}.sv-attp-img{max-width:100%;max-height:70vh;object-fit:contain;border-radius:6px}.sv-attp-pdf{width:100%;height:70vh;border:0;border-radius:6px}.sv-attp-video{max-width:100%;max-height:70vh;border-radius:6px;background:#000}.sv-attp-audio{width:min(420px,100%)}.sv-attp-file{display:flex;flex-direction:column;align-items:center;gap:12px}.sv-attp-name{font-size:15px}.sv-attp-download{color:inherit;text-decoration:underline}.sv-attp-footer{display:flex;align-items:center;justify-content:center;gap:12px;width:100%}.sv-attp-count{font-size:13px;color:var(--sg-muted, #64748b)}.sv-attp-btn{height:30px;padding:0 12px;font:inherit;font-size:13px;cursor:pointer;border:1px solid var(--sg-border, #e2e8f0);border-radius:6px;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a)}.sv-attp-btn:disabled{opacity:.5;cursor:default}
|
|
52
65
|
</style>
|
|
@@ -137,6 +137,16 @@ export declare const isPdf: (a: {
|
|
|
137
137
|
type?: string;
|
|
138
138
|
name?: string;
|
|
139
139
|
}) => boolean;
|
|
140
|
+
/** A film the browser plays: mp4, webm, mov (QuickTime plays where the browser has its codec), ogv. */
|
|
141
|
+
export declare const isVideo: (a: {
|
|
142
|
+
type?: string;
|
|
143
|
+
name?: string;
|
|
144
|
+
}) => boolean;
|
|
145
|
+
/** A sound the browser plays: mp3, wav, m4a, ogg, aac. */
|
|
146
|
+
export declare const isAudio: (a: {
|
|
147
|
+
type?: string;
|
|
148
|
+
name?: string;
|
|
149
|
+
}) => boolean;
|
|
140
150
|
export declare function formatBytes(n: number | undefined): string;
|
|
141
151
|
/** The cell value as a clean array: anything that is not an attachment is dropped. */
|
|
142
152
|
export declare function toAttachments(value: unknown): Attachment[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let
|
|
1
|
+
let s=[];export function setAttachmentSources(t){s=t??[]}export function attachmentSources(t){return t.sources??s}let p=null;export function setAttachmentUploader(t){p=t}let m=0;export const newAttachmentId=()=>`att-${Date.now().toString(36)}-${(m++).toString(36)}`;export async function uploadAttachment(t,e,n){const o=e.upload??p;return o?o(t,n):(n.onProgress(1),{id:newAttachmentId(),url:URL.createObjectURL(t),name:t.name,type:t.type||guessType(t.name),size:t.size})}export function takesImages(t){return!t.accept||t.accept.split(",").some(e=>/^\s*(image\/|\.(jpe?g|png|webp|heic|gif)\b)/i.test(e))}export async function shrinkPhoto(t,e=2e3,n=.85){if(!/^image\/(jpeg|png|webp)$/.test(t.type)||typeof createImageBitmap!="function"||typeof document>"u")return t;try{const o=await createImageBitmap(t),a=Math.min(1,e/Math.max(o.width,o.height));if(a>=1)return o.close?.(),t;const r=document.createElement("canvas");r.width=Math.round(o.width*a),r.height=Math.round(o.height*a),r.getContext("2d")?.drawImage(o,0,0,r.width,r.height),o.close?.();const i=await new Promise(u=>r.toBlob(u,"image/jpeg",n));if(!i)return t;const c=t.name.replace(/\.[^.]+$/,"")+".jpg";return new File([i],c,{type:"image/jpeg",lastModified:t.lastModified})}catch{return t}}export const tooManyFiles=t=>`At most ${t} ${t===1?"file":"files"}`;export function rejectReason(t,e,n){const o=e.maxFiles??20,a=e.maxSize??25*1024*1024;return n>=o?tooManyFiles(o):t.size!=null&&t.size>a?`Larger than ${formatBytes(a)}`:e.accept&&!accepts(e.accept,t)?"Not an accepted type":null}export function limitAttachments(t,e,n=0){const o=[],a=[];for(const r of t){const i=rejectReason(r,e,n+o.length);i?a.push(`${r.name}: ${i}`):o.push(r)}return{kept:o,rejected:a}}export function parseAttachments(t,e){const n=Array.isArray(t)?toAttachments(t):attachmentsFromText(String(t??""));return limitAttachments(n,e).kept}export function accepts(t,e){const n=e.name.toLowerCase(),o=(e.type||guessType(e.name)).toLowerCase();return t.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean).some(a=>a.startsWith(".")?n.endsWith(a):a.endsWith("/*")?o.startsWith(a.slice(0,-1)):o===a)}const l={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",avif:"image/avif",pdf:"application/pdf",txt:"text/plain",csv:"text/csv",json:"application/json",zip:"application/zip",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/mp4",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",aac:"audio/aac"};export function guessType(t){const e=t.split(/[?#]/)[0].split(".").pop()?.toLowerCase()??"";return l[e]??"application/octet-stream"}export const isImage=t=>(t.type||guessType(t.name??"")).startsWith("image/"),isPdf=t=>(t.type||guessType(t.name??""))==="application/pdf",isVideo=t=>(t.type||guessType(t.name??"")).toLowerCase().startsWith("video/"),isAudio=t=>(t.type||guessType(t.name??"")).toLowerCase().startsWith("audio/");export function formatBytes(t){if(t==null||!Number.isFinite(t))return"";if(t<1024)return`${t} B`;const e=n=>n<10?n.toFixed(1).replace(/\.0$/,""):String(Math.round(n));return t<1024*1024?`${e(t/1024)} KB`:t<1024*1024*1024?`${e(t/1024/1024)} MB`:`${e(t/1024/1024/1024)} GB`}export function toAttachments(t){return Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&typeof e.url=="string"):[]}export function attachmentsText(t){return toAttachments(t).map(e=>e.name).join(", ")}export function attachmentsFromText(t){const e=[];for(const n of t.split(/[\s,]+/)){let o;try{o=new URL(n)}catch{continue}if(o.protocol!=="http:"&&o.protocol!=="https:")continue;const a=decodeURIComponent(o.pathname.split("/").filter(Boolean).pop()??o.hostname);e.push({id:newAttachmentId(),url:o.href,name:a,type:guessType(a)})}return e}export async function pdfFrameUrl(t,e=fetch){try{const n=await e(t);if(!n.ok)return null;const o=new Uint8Array(await n.arrayBuffer());return String.fromCharCode(...o.subarray(0,1024)).includes("%PDF-")?URL.createObjectURL(new Blob([o],{type:"application/pdf"})):null}catch{return null}}export function safeUrl(t,e=!1){if(typeof t!="string")return null;if(e&&/^data:image\/(png|jpeg|gif|webp|avif|svg\+xml)[;,]/i.test(t))return t;try{const n=new URL(t,typeof location<"u"?location.href:"https://x.invalid/");return n.protocol==="http:"||n.protocol==="https:"||n.protocol==="blob:"?n.href:null}catch{return null}}
|
package/dist/node/studio.js
CHANGED
|
@@ -913,7 +913,7 @@ ${E}
|
|
|
913
913
|
@keyframes st-home-spin { to { transform: rotate(360deg); } }
|
|
914
914
|
</style>
|
|
915
915
|
`}}function Ka(e){for(const r of e)je(r);const t=new Map(e.map(r=>[r.name,r])),a=e.map(r=>{const o=Eu(r,t);return{schema:Fu(r,o),infos:o}});return{entries:a,seed:Du(a)}}function fo(e,t={}){const{entries:a,seed:r}=Ka(e),{file:o,needs:n}=em(a,r,t.sources,t.supabaseConn,t.serverMemory),i=[Lu(a),o];(n.supabase||t.supabaseAuth)&&!n.supabaseUrl&&(t.supabaseConn?.url||t.supabaseConn?.key)&&(n.supabaseUrl=t.supabaseConn.url,n.supabaseKey=t.supabaseConn.key),(n.supabase||t.supabaseAuth)&&i.push(tm(n));for(const s of n.sqlRoutes)i.push(Hu(s.schema,s.table,s.dialect,{access:t.accessEnabled,audit:t.auditEnabled,screenIds:t.screensByEntity?.get(s.schema.name)??[],triggers:t.triggers?.[s.schema.name],dbSchema:s.dbSchema,tenantField:t.tenantField&&t.tenantScoped?.(s.schema.name)!==!1?t.tenantField:void 0}));if(n.memoryRoutes.length){i.push(Gu(n.memoryRoutes));for(const s of n.memoryRoutes)i.push(Vu(s.schema,{access:t.accessEnabled,audit:t.auditEnabled,screenIds:t.screensByEntity?.get(s.schema.name)??[],triggers:t.triggers?.[s.schema.name],tenantField:t.tenantField&&t.tenantScoped?.(s.schema.name)!==!1?t.tenantField:void 0}))}return{files:i,prepared:a.map(s=>s.schema)}}function am(e){if(e.length===0)throw new Error("emitStudioApp: no schemas to emit");const{files:t,prepared:a}=fo(e),r=a.map(n=>{const i=z(n);return{href:`/${i.route}`,label:i.label}}),o={path:"src/custom.css",description:"Your custom styles (imported after app.css so it overrides).",userOwned:!0,contents:`/* Your custom styles. Imported after app.css, so these rules override the defaults. */
|
|
916
|
-
`};return[...t,...a.map(n=>Ni(n)),Mi(r),ji(r),o]}function rm(e){return e.fields.some(t=>!!t.when&&(!!t.when.visible||!!t.when.disabled||!!t.when.required))}var om="3.1.
|
|
916
|
+
`};return[...t,...a.map(n=>Ni(n)),Mi(r),ji(r),o]}function rm(e){return e.fields.some(t=>!!t.when&&(!!t.when.visible||!!t.when.disabled||!!t.when.required))}var om="3.1.65",nm="3.0.39",V=(e,t)=>e.some(a=>a.config.kind===t),qi=e=>`activeTab_${e.replace(/[^a-zA-Z0-9_$]/g,"_")}`,aa=(e,t)=>`${e}-${t}`,zi=e=>`accOpen_${e.replace(/[^a-zA-Z0-9_$]/g,"_")}`,ra=(e,t)=>`${e}-s${t}`,oa=e=>`md_${e.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function im(e){switch(e.type){case"number":{const t=e.decimals;return t!=null?`{ type: 'number', options: { minimumFractionDigits: ${t}, maximumFractionDigits: ${t} } }`:"{ type: 'number' }"}case"currency":return`{ type: 'currency', currency: ${S(e.currency||"USD")} }`;case"percent":{const t=["type: 'percent'"];return e.valueIsPercentPoints&&t.push("valueIsPercentPoints: true"),e.decimals!=null&&t.push(`options: { minimumFractionDigits: ${e.decimals}, maximumFractionDigits: ${e.decimals} }`),`{ ${t.join(", ")} }`}case"date":case"datetime":return e.pattern?`{ type: '${e.type}', pattern: ${S(e.pattern)} }`:`{ type: '${e.type}' }`}}function sm(e,t,a,r){if(t.config.kind!=="grid")return`schemaToColumns(${e})`;const o=t.config,n=t.id.replace(/-/g,"_"),i=o.columns.filter(b=>b.show),s=new Set(i.map(b=>b.field)),d=new Set,l=i.map(b=>{const y=r?.get(b.field);return{c:b,col:y&&!s.has(y)?y:b.field}}).filter(b=>!d.has(b.col)&&!!d.add(b.col)),c=o.editing==="inline"?"":", editable: false";if(l.length===0)return c?`schemaToColumns(${e}).map((c) => ({ ...c${c} }))`:`schemaToColumns(${e})`;const p=l.map(b=>`'${b.col}'`),u=l.map(({c:b,col:y})=>{const w=[];return b.header&&w.push(`header: ${JSON.stringify(b.header)}`),b.width!=null&&w.push(`width: ${b.width}`),b.align&&w.push(`align: '${b.align}'`),b.aggregate&&w.push(`aggregate: '${b.aggregate}'`),o.treeData&&b.field===o.treeData.labelField&&a?w.push(`cell: (ctx: CellContext<${a}>) => renderSnippet(treeCell_${n}, { value: ctx.getValue(), row: ctx.row.original })`):b.cellType&&a?w.push(`cell: (ctx: CellContext<${a}>) => renderSnippet(${Gi(n,b.field)}, { value: ctx.getValue() })`):b.format&&w.push(`format: ${im(b.format)}`),w.length?`'${y}': { ${w.join(", ")} }`:null}).filter(b=>!!b),m=u.length?` const ov: Record<string, Partial<(typeof all)[number]>> = { ${u.join(", ")} };`:"",g=u.length?", ...(ov[String(c.field)] ?? {})":"",h=`[${p.join(", ")}].map((f) => all.find((c) => c.field === f)).filter((c): c is (typeof all)[number] => !!c)`;return`(() => { const all = schemaToColumns(${e});${m} return ${c||g?`${h}.map((c) => ({ ...c${c}${g} }))`:h} })()`}function Ae(e,t){const a=[`grid-column: span ${ei(e)}`,"min-width: 0"];t&&a.push(t);const r=ti(e.style);return r&&a.push(r),`style="${a.join("; ")}"`}var lm=e=>e&&e.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function Ue(e,t){const a=[t,Xn(e)].filter(Boolean).join(" ");return a?` class="${a}"`:""}function Ha(e){const t=Ta(e.className);return t?` ${t}`:""}function dm(e){const t=Fe(e);if(t==="grid"){const a=ui(e),r=a.maxWidth?` max-width: ${a.maxWidth}px; margin-inline: auto;`:"";return` .st-screen { grid-template-columns: repeat(12, 1fr); gap: ${a.rowGap}px ${a.colGap}px; align-items: ${a.align};${r} }
|
|
917
917
|
@media (max-width: ${a.mobileBreakpoint}px) { .st-screen { grid-template-columns: 1fr; gap: 12px; } }
|
|
918
918
|
`}if(t==="stack"){const a=mi(e),r=a.maxWidth?` max-width: ${a.maxWidth}px;${a.align==="center"?" margin-inline: auto;":""}`:"",o=a.minHeight?`
|
|
919
919
|
.st-stack > * { min-height: ${a.minHeight}px; }`:"",n=a.dividers?`
|
package/dist/version.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
|
|
12
12
|
*/
|
|
13
|
-
export declare const SVGRID_VERSION = "3.1.
|
|
13
|
+
export declare const SVGRID_VERSION = "3.1.65";
|
|
14
14
|
/**
|
|
15
15
|
* The version of `@svgrid/grid`, which releases on its own line: enterprise is
|
|
16
16
|
* on 3.1.x while the grid is on 3.0.x.
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SVGRID_VERSION="3.1.
|
|
1
|
+
export const SVGRID_VERSION="3.1.65",GRID_VERSION="3.0.39";
|