@e280/quay 0.0.0-15 → 0.0.0-17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/s/dom/components/browser/component.ts +1 -1
- package/s/logic/group.ts +1 -0
- package/x/demo/main.bundle.min.js +2 -2
- package/x/demo/main.bundle.min.js.map +2 -2
- package/x/dom/components/browser/component.js +1 -1
- package/x/dom/components/browser/component.js.map +1 -1
- package/x/index.html +2 -2
- package/x/logic/group.js +2 -1
- package/x/logic/group.js.map +1 -1
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export const QuayBrowser = shadowElement(() => {
|
|
|
18
18
|
const [viewMode, setViewMode] = useState<'details' | 'tiles'>('tiles')
|
|
19
19
|
|
|
20
20
|
useMount(() => {
|
|
21
|
-
const dispose = group.on.
|
|
21
|
+
const dispose = group.on.refresh.sub(() => render())
|
|
22
22
|
return () => dispose()
|
|
23
23
|
})
|
|
24
24
|
|
package/s/logic/group.ts
CHANGED
|
@@ -25,7 +25,7 @@ var Ir=Object.defineProperty;var Et=(r,e)=>{for(var t in e)Ir(r,t,{get:e[t],enum
|
|
|
25
25
|
font-family: monospace;
|
|
26
26
|
color: red;
|
|
27
27
|
}
|
|
28
|
-
`;function O(r,e){return(t,o)=>nr(t,{pending:r,err:e,ok:o})}var Fl=O(z(10,[" "," ",". ",".. ","..."," .."," ."]),P);var Kl=O(z(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),P);var eu=O(z(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),P);var nu=O(z(16,["|","/","-","\\"]),P);var uu=O(z(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),P);var M=Object.freeze({eq(r,e){if(r.length!==e.length)return!1;for(let t=0;t<=r.length;t++)if(r.at(t)!==e.at(t))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var q=Object.freeze({fromBytes(r){return[...r].map(e=>e.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t/2]=parseInt(r.slice(t,t+2),16);return e},random(r=32){return this.fromBytes(M.random(r))},string(r){return q.fromBytes(r)},bytes(r){return q.toBytes(r)}});var wt=58,Ke="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",$t=Object.freeze({fromBytes(r){let e=BigInt("0x"+q.fromBytes(r)),t="";for(;e>0;){let o=e%BigInt(wt);e=e/BigInt(wt),t=Ke[Number(o)]+t}for(let o of r)if(o===0)t=Ke[0]+t;else break;return t},toBytes(r){let e=BigInt(0);for(let i of r){let l=Ke.indexOf(i);if(l===-1)throw new Error(`Invalid character '${i}' in base58 string`);e=e*BigInt(wt)+BigInt(l)}let t=e.toString(16);t.length%2!==0&&(t="0"+t);let o=q.toBytes(t),s=0;for(let i of r)if(i===Ke[0])s++;else break;let n=new Uint8Array(s+o.length);return n.set(o,s),n},random(r=32){return this.fromBytes(M.random(r))},string(r){return $t.fromBytes(r)},bytes(r){return $t.toBytes(r)}});var vr=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef"},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(e){this.lexicon=e,this.lookup=Object.fromEntries([...e.characters].map((t,o)=>[t,o])),this.negativePrefix=e.negativePrefix??"-"}toBytes(e){let t=Math.log2(this.lexicon.characters.length);if(Number.isInteger(t)){let l=0,a=0,c=[];for(let u of e){if(u===this.lexicon.padding?.character)continue;let f=this.lookup[u];if(f===void 0)throw new Error(`Invalid character: ${u}`);for(l=l<<t|f,a+=t;a>=8;)a-=8,c.push(l>>a&255)}return new Uint8Array(c)}let o=0n,s=BigInt(this.lexicon.characters.length),n=!1;e.startsWith(this.negativePrefix)&&(e=e.slice(this.negativePrefix.length),n=!0);for(let l of e){let a=this.lookup[l];if(a===void 0)throw new Error(`Invalid character: ${l}`);o=o*s+BigInt(a)}let i=[];for(;o>0n;)i.unshift(Number(o%256n)),o=o/256n;return new Uint8Array(i)}fromBytes(e){let t=Math.log2(this.lexicon.characters.length);if(Number.isInteger(t)){let i=0,l=0,a="";for(let c of e)for(i=i<<8|c,l+=8;l>=t;){l-=t;let u=i>>l&(1<<t)-1;a+=this.lexicon.characters[u]}if(l>0){let c=i<<t-l&(1<<t)-1;a+=this.lexicon.characters[c]}if(this.lexicon.padding)for(;a.length%this.lexicon.padding.size!==0;)a+=this.lexicon.padding.character;return a}let o=0n;for(let i of e)o=(o<<8n)+BigInt(i);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return n}toInteger(e){if(!e)return 0;let t=0n,o=!1,s=BigInt(this.lexicon.characters.length);e.startsWith(this.negativePrefix)&&(e=e.slice(this.negativePrefix.length),o=!0);for(let n of e){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);t=t*s+BigInt(i)}return Number(o?-t:t)}fromInteger(e){e=Math.floor(e);let t=e<0,o=BigInt(t?-e:e);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return t?`${this.negativePrefix}${n}`:n}random(e=32){return this.fromBytes(M.random(e))}};var At=Object.freeze({fromBytes(r){return typeof btoa=="function"?btoa(String.fromCharCode(...r)):Buffer.from(r).toString("base64")},toBytes(r){return typeof atob=="function"?Uint8Array.from(atob(r),e=>e.charCodeAt(0)):Uint8Array.from(Buffer.from(r,"base64"))},random(r=32){return this.fromBytes(M.random(r))},string(r){return At.fromBytes(r)},bytes(r){return At.toBytes(r)}});var wr=Object.freeze({fromBytes(r){return new TextDecoder().decode(r)},toBytes(r){return new TextEncoder().encode(r)},string(r){return wr.fromBytes(r)},bytes(r){return wr.toBytes(r)}});var St=Object.freeze({set:r=>r!=null,unset:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});function $r(){let r,e,t=new Promise((s,n)=>{r=s,e=n});function o(s){return s.then(r).catch(e),t}return{promise:t,resolve:r,reject:e,entangle:o}}var A=class r extends Map{static require(e,t){let o=e.get(t);if(o===void 0)throw new Error(`required key not found: "${t}"`);return o}static guarantee(e,t,o){let s=e.get(t);return s===void 0&&(s=o(),e.set(t,s)),s}array(){return[...this]}require(e){return r.require(this,e)}guarantee(e,t){return r.guarantee(this,e,t)}};function wo(r){return{map:e=>Ar(r,e),filter:e=>Sr(r,e)}}wo.pipe=Object.freeze({map:r=>(e=>Ar(e,r)),filter:r=>(e=>Sr(e,r))});var Ar=(r,e)=>Object.fromEntries(Object.entries(r).map(([t,o])=>[t,e(o,t)])),Sr=(r,e)=>Object.fromEntries(Object.entries(r).filter(([t,o])=>e(o,t)));function $o(){let r=new Set;function e(n){return r.add(n),()=>{r.delete(n)}}async function t(...n){await Promise.all([...r].map(i=>i(...n)))}async function o(){let{promise:n,resolve:i}=$r(),l=e((...a)=>{i(a),l()});return n}function s(){r.clear()}return e.pub=t,e.sub=e,e.on=e,e.once=o,e.clear=s,t.pub=t,t.sub=e,t.on=e,t.once=o,t.clear=s,[t,e]}function j(r){let e=$o()[1];return r&&e.sub(r),e}var Ze=class{#e=new A;setGroup(e,t){return this.#e.set(e,t),t}getGroup(e){return this.#e.require(e)}};var Je=new Ze;var Ye=class{group;#e=new Ne.DragAndDrops({acceptDrop:(e,t,o)=>this.group.move(t,o)});constructor(e){this.group=e}#t=h(void 0);get grabbed(){return this.#e.dragging}get hovering(){return this.#e.hovering??this.#t()}dragenter=(e,t)=>{e.preventDefault(),this.#e.dropzone(()=>t).dragenter(e),this.#t(t)};dragleave=e=>{let t=this.hovering;t&&this.#e.dropzone(()=>t).dragleave(e),this.#t(void 0)};dragstart=(e,t)=>{e.stopPropagation(),this.#e.dragzone(()=>t).dragstart(e)};dragover=(e,t)=>{e.preventDefault(),this.#e.dropzone(()=>t).dragover(e)};dragend=e=>{this.#e.$draggy(void 0),this.#e.$droppy(void 0),this.#t(void 0)};drop=(e,t)=>{e.preventDefault();let o=Array.from(e.dataTransfer?.files||[]);o.length&&this.group.upload(o,t);let s=this.grabbed?.id===this.hovering?.id,n=this.grabbed?.children.some(l=>this.hovering?.id===l.id),i=this.grabbed?.parent?.id===this.hovering?.id;!s&&!n&&!i&&this.#e.dropzone(()=>t).drop(e),this.#t(void 0)};change=(e,t)=>{let o=e.currentTarget,s=Array.from(o.files??[]);s.length&&this.group.upload(s,t)}};var Xe=class{signal=h([]);constructor(e){this.signal([e])}setTrail(e,t){if(e.target!==e.currentTarget)return;let o=[],s=t.kind==="folder"?t:t.parent;for(;s;)o.unshift(s),s=s.parent;this.signal(o)}get currentFolder(){return this.signal().at(-1)?.children??[]}};var et=class{config;trail;dropzone=new Ye(this);searchText=h("");selectedFilter=h("");selectedSort=h("");on={newFolder:j(),move:j(),delete:j(),rename:j(),upload:j(),search:j(),refresh:j()};constructor(e){this.config=e,this.selectedFilter(e.defaultFilter),this.selectedSort(e.defaultSort),this.trail=new Xe(e.root)}get permissions(){return this.config.permissions}getFilterFn(e){return this.config.filters.get(e)??(()=>!0)}getSearchFn(e){let t=e.trim().toLowerCase().split(/\s+/);return o=>this.config.search(t,o)}getSortFn(e){return this.config.sorts?.get(e)??(()=>0)}sort(e){let t=this.getSortFn(this.selectedSort());return[...e].sort(t)}matches(e){let t=this.getFilterFn(this.selectedFilter()),o=this.getSearchFn(this.searchText());return t(e)&&o(e)}move(e,t){if(!this.permissions(e).move)throw new Error("move permission not granted");e.detach(),t.attach(e),this.on.move.pub({item:e,target:t})}delete(e){if(!this.permissions(e).delete)throw new Error("delete permission not granted");let t=[...e.crawl()].map(([o])=>o);return e.destroy(),this.on.delete.pub({items:t})}rename(e,t){if(!this.permissions(e).rename)throw new Error("rename permission not granted");this.on.rename.pub({item:e,newName:t})}upload(e,t){if(!this.permissions(t).upload)throw new Error("upload permission not granted");return this.on.upload.pub({files:e,target:t})}addFolder(e){if(!this.permissions(e).newFolder)throw new Error("add folder permission not granted");this.on.newFolder.pub({parent:e})}components=()=>this.components};var be;(function(r){r.rename="rename",r.move="move",r.delete="delete",r.refresh="refresh",r.newFolder="newFolder",r.search="search",r.upload="upload"})(be||(be={}));var Ao=Object.values(be);function _t(r,e={}){let t={};for(let o of Ao)t[o]=o in e?e[o]:r;return t}var _r={all:_t(!0),readOnly:_t(!1,{[be.refresh]:!0,[be.search]:!0}),none:_t(!1)};var tt=class{taxonomy;onChange=j();#e=new A;constructor(e){this.taxonomy=e}getSpecimen(e){return this.#e.require(e)}setSpecimen(e,t,o){this.#e.set(e,[t,o]),this.onChange.pub()}query(e){let[t,o]=this.getSpecimen(e),s=this.taxonomy.taxon(t);return{kind:t,taxon:s,specimen:o}}};var rt=class{#e=new A;constructor(e){for(let[t,o]of Object.entries(e))this.#e.set(t,o)}taxon(e){return this.#e.require(e)}};var ot=class{#e=new A;#t=new A;has(e){return this.#e.has(e)}getChildren(e){return this.#e.require(e)}getParent(e){return this.#t.get(e)}establishRoot(e){this.#e.set(e,new Set)}attach(e,...t){let o=this.getChildren(e);for(let s of t){if(this.getParent(s))throw new Error("child already has parent");o.add(s),this.#t.set(s,e),this.#e.set(s,new Set)}}detach(e){if(!this.has(e))return;let t=this.getParent(e);t&&(this.getChildren(t).delete(e),this.#t.delete(e))}destroy(e){this.detach(e);let t=[...this.crawl(e)];for(let[o]of t)this.#e.delete(o),this.#t.delete(o)}*crawl(e,t=()=>!0){let o=[[e,[]]],s=new Set;for(;o.length;){let[n,i]=o.shift();if(!(s.has(n)||!t(n,i))){s.add(n),yield[n,i];for(let l of this.getChildren(n))o.push([l,[...i,n]])}}}};var st=class{codex;id;signal=h(this);constructor(e,t){this.codex=e,this.id=t}get kind(){return this.codex.clade.query(this.id).kind}isKind(e){return e===this.kind}get taxon(){return this.codex.clade.query(this.id).taxon}get specimen(){return this.codex.clade.query(this.id).specimen}get parent(){let e=this.codex.hierarchy.getParent(this.id);return e?this.codex.require(e):void 0}get children(){return[...this.codex.hierarchy.getChildren(this.id)].map(e=>this.codex.require(e))}attach(...e){return this.codex.hierarchy.attach(this.id,...e.map(t=>t.id)),this.signal(this),this}detach(){this.codex.hierarchy.detach(this.id),this.signal(this)}create(e,t){let o=this.codex.create(e,t);return this.attach(o),o}destroy(){this.codex.hierarchy.destroy(this.id),this.signal(this)}*crawl(e=()=>!0){let t=this.codex.hierarchy.crawl(this.id,(o,s)=>e(this.codex.require(o),s.map(n=>this.codex.require(n))));for(let[o,s]of t)yield[this.codex.require(o),s.map(n=>this.codex.require(n))]}};function Er(){return q.random()}var nt=class{clade;hierarchy;static setup(e){let t=new rt(e),o=new tt(t),s=new ot;return new this(o,s)}#e=new A;constructor(e,t){this.clade=e,this.hierarchy=t}create(e,t){let o=Er();this.clade.setSpecimen(o,e,t);let s=new st(this,o);return this.#e.set(o,s),s.signal()}root(e){return this.hierarchy.establishRoot(e.id),e.signal()}require(e){return this.#e.require(e).signal()}};var it=class r extends et{static config=()=>{let e=new A().set("audio",p`<sl-icon name=music-note-beamed></sl-icon>`).set("video",p`<sl-icon name=film></sl-icon>`).set("image",p`<sl-icon name=image></sl-icon>`).set("other",p`<sl-icon name=file-earmark></sl-icon>`),t=new Map().set("all",()=>!0).set("video",a=>a.isKind("folder")||a.isKind("file")&&a.specimen.format==="video").set("audio",a=>a.isKind("folder")||a.isKind("file")&&a.specimen.format==="audio"),o=new Map().set("label",(a,c)=>a.specimen.label.localeCompare(c.specimen.label)).set("format",(a,c)=>a.isKind("file")&&c.isKind("file")?a.specimen.format.localeCompare(c.specimen.format):a.isKind("file")?-1:c.isKind("file")?1:0),s=(a,c)=>{let u=a.join(" ").trim().toLowerCase();return u===""?!0:c.kind==="folder"?c.children.some(f=>s(a,f)):c.specimen.label.toLowerCase().includes(u)},n=nt.setup({folder:{icon:p`<sl-icon name="folder"></sl-icon>`},file:{icon:p`<sl-icon name="file"></sl-icon>`}}),i=n.root(n.create("folder",{label:"project"})),l=(a,c)=>a.isKind("file")?e.require(a.specimen.format):c?p`<sl-icon name="folder2-open"></sl-icon>`:a.taxon.icon;return{codex:n,root:i,sorts:o,filters:t,defaultFilter:"all",defaultSort:"label",search:(a,c)=>a.some(u=>c.kind.includes(u)||c.id.includes(u)||c.specimen.label.includes(u))||s(a,c),renderIcon:l,renderLabel:a=>a.specimen.label,renderPreview:a=>a.isKind("file")&&a.specimen.previewUrl?p`<img src=${a.specimen.previewUrl}>`:l(a,!1),permissions:a=>_r.all}};constructor(){super(r.config())}};var $=d`@layer theme, view; @layer theme {
|
|
28
|
+
`;function O(r,e){return(t,o)=>nr(t,{pending:r,err:e,ok:o})}var Fl=O(z(10,[" "," ",". ",".. ","..."," .."," ."]),P);var Kl=O(z(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),P);var eu=O(z(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),P);var nu=O(z(16,["|","/","-","\\"]),P);var uu=O(z(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),P);var M=Object.freeze({eq(r,e){if(r.length!==e.length)return!1;for(let t=0;t<=r.length;t++)if(r.at(t)!==e.at(t))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var q=Object.freeze({fromBytes(r){return[...r].map(e=>e.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t/2]=parseInt(r.slice(t,t+2),16);return e},random(r=32){return this.fromBytes(M.random(r))},string(r){return q.fromBytes(r)},bytes(r){return q.toBytes(r)}});var wt=58,Ke="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",$t=Object.freeze({fromBytes(r){let e=BigInt("0x"+q.fromBytes(r)),t="";for(;e>0;){let o=e%BigInt(wt);e=e/BigInt(wt),t=Ke[Number(o)]+t}for(let o of r)if(o===0)t=Ke[0]+t;else break;return t},toBytes(r){let e=BigInt(0);for(let i of r){let l=Ke.indexOf(i);if(l===-1)throw new Error(`Invalid character '${i}' in base58 string`);e=e*BigInt(wt)+BigInt(l)}let t=e.toString(16);t.length%2!==0&&(t="0"+t);let o=q.toBytes(t),s=0;for(let i of r)if(i===Ke[0])s++;else break;let n=new Uint8Array(s+o.length);return n.set(o,s),n},random(r=32){return this.fromBytes(M.random(r))},string(r){return $t.fromBytes(r)},bytes(r){return $t.toBytes(r)}});var vr=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef"},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(e){this.lexicon=e,this.lookup=Object.fromEntries([...e.characters].map((t,o)=>[t,o])),this.negativePrefix=e.negativePrefix??"-"}toBytes(e){let t=Math.log2(this.lexicon.characters.length);if(Number.isInteger(t)){let l=0,a=0,c=[];for(let u of e){if(u===this.lexicon.padding?.character)continue;let f=this.lookup[u];if(f===void 0)throw new Error(`Invalid character: ${u}`);for(l=l<<t|f,a+=t;a>=8;)a-=8,c.push(l>>a&255)}return new Uint8Array(c)}let o=0n,s=BigInt(this.lexicon.characters.length),n=!1;e.startsWith(this.negativePrefix)&&(e=e.slice(this.negativePrefix.length),n=!0);for(let l of e){let a=this.lookup[l];if(a===void 0)throw new Error(`Invalid character: ${l}`);o=o*s+BigInt(a)}let i=[];for(;o>0n;)i.unshift(Number(o%256n)),o=o/256n;return new Uint8Array(i)}fromBytes(e){let t=Math.log2(this.lexicon.characters.length);if(Number.isInteger(t)){let i=0,l=0,a="";for(let c of e)for(i=i<<8|c,l+=8;l>=t;){l-=t;let u=i>>l&(1<<t)-1;a+=this.lexicon.characters[u]}if(l>0){let c=i<<t-l&(1<<t)-1;a+=this.lexicon.characters[c]}if(this.lexicon.padding)for(;a.length%this.lexicon.padding.size!==0;)a+=this.lexicon.padding.character;return a}let o=0n;for(let i of e)o=(o<<8n)+BigInt(i);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return n}toInteger(e){if(!e)return 0;let t=0n,o=!1,s=BigInt(this.lexicon.characters.length);e.startsWith(this.negativePrefix)&&(e=e.slice(this.negativePrefix.length),o=!0);for(let n of e){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);t=t*s+BigInt(i)}return Number(o?-t:t)}fromInteger(e){e=Math.floor(e);let t=e<0,o=BigInt(t?-e:e);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return t?`${this.negativePrefix}${n}`:n}random(e=32){return this.fromBytes(M.random(e))}};var At=Object.freeze({fromBytes(r){return typeof btoa=="function"?btoa(String.fromCharCode(...r)):Buffer.from(r).toString("base64")},toBytes(r){return typeof atob=="function"?Uint8Array.from(atob(r),e=>e.charCodeAt(0)):Uint8Array.from(Buffer.from(r,"base64"))},random(r=32){return this.fromBytes(M.random(r))},string(r){return At.fromBytes(r)},bytes(r){return At.toBytes(r)}});var wr=Object.freeze({fromBytes(r){return new TextDecoder().decode(r)},toBytes(r){return new TextEncoder().encode(r)},string(r){return wr.fromBytes(r)},bytes(r){return wr.toBytes(r)}});var St=Object.freeze({set:r=>r!=null,unset:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});function $r(){let r,e,t=new Promise((s,n)=>{r=s,e=n});function o(s){return s.then(r).catch(e),t}return{promise:t,resolve:r,reject:e,entangle:o}}var A=class r extends Map{static require(e,t){let o=e.get(t);if(o===void 0)throw new Error(`required key not found: "${t}"`);return o}static guarantee(e,t,o){let s=e.get(t);return s===void 0&&(s=o(),e.set(t,s)),s}array(){return[...this]}require(e){return r.require(this,e)}guarantee(e,t){return r.guarantee(this,e,t)}};function wo(r){return{map:e=>Ar(r,e),filter:e=>Sr(r,e)}}wo.pipe=Object.freeze({map:r=>(e=>Ar(e,r)),filter:r=>(e=>Sr(e,r))});var Ar=(r,e)=>Object.fromEntries(Object.entries(r).map(([t,o])=>[t,e(o,t)])),Sr=(r,e)=>Object.fromEntries(Object.entries(r).filter(([t,o])=>e(o,t)));function $o(){let r=new Set;function e(n){return r.add(n),()=>{r.delete(n)}}async function t(...n){await Promise.all([...r].map(i=>i(...n)))}async function o(){let{promise:n,resolve:i}=$r(),l=e((...a)=>{i(a),l()});return n}function s(){r.clear()}return e.pub=t,e.sub=e,e.on=e,e.once=o,e.clear=s,t.pub=t,t.sub=e,t.on=e,t.once=o,t.clear=s,[t,e]}function j(r){let e=$o()[1];return r&&e.sub(r),e}var Ze=class{#e=new A;setGroup(e,t){return this.#e.set(e,t),t}getGroup(e){return this.#e.require(e)}};var Je=new Ze;var Ye=class{group;#e=new Ne.DragAndDrops({acceptDrop:(e,t,o)=>this.group.move(t,o)});constructor(e){this.group=e}#t=h(void 0);get grabbed(){return this.#e.dragging}get hovering(){return this.#e.hovering??this.#t()}dragenter=(e,t)=>{e.preventDefault(),this.#e.dropzone(()=>t).dragenter(e),this.#t(t)};dragleave=e=>{let t=this.hovering;t&&this.#e.dropzone(()=>t).dragleave(e),this.#t(void 0)};dragstart=(e,t)=>{e.stopPropagation(),this.#e.dragzone(()=>t).dragstart(e)};dragover=(e,t)=>{e.preventDefault(),this.#e.dropzone(()=>t).dragover(e)};dragend=e=>{this.#e.$draggy(void 0),this.#e.$droppy(void 0),this.#t(void 0)};drop=(e,t)=>{e.preventDefault();let o=Array.from(e.dataTransfer?.files||[]);o.length&&this.group.upload(o,t);let s=this.grabbed?.id===this.hovering?.id,n=this.grabbed?.children.some(l=>this.hovering?.id===l.id),i=this.grabbed?.parent?.id===this.hovering?.id;!s&&!n&&!i&&this.#e.dropzone(()=>t).drop(e),this.#t(void 0)};change=(e,t)=>{let o=e.currentTarget,s=Array.from(o.files??[]);s.length&&this.group.upload(s,t)}};var Xe=class{signal=h([]);constructor(e){this.signal([e])}setTrail(e,t){if(e.target!==e.currentTarget)return;let o=[],s=t.kind==="folder"?t:t.parent;for(;s;)o.unshift(s),s=s.parent;this.signal(o)}get currentFolder(){return this.signal().at(-1)?.children??[]}};var et=class{config;trail;dropzone=new Ye(this);searchText=h("");selectedFilter=h("");selectedSort=h("");on={newFolder:j(),move:j(),delete:j(),rename:j(),upload:j(),search:j(),refresh:j()};constructor(e){this.config=e,this.selectedFilter(e.defaultFilter),this.selectedSort(e.defaultSort),this.trail=new Xe(e.root)}get permissions(){return this.config.permissions}getFilterFn(e){return this.config.filters.get(e)??(()=>!0)}getSearchFn(e){let t=e.trim().toLowerCase().split(/\s+/);return o=>this.config.search(t,o)}getSortFn(e){return this.config.sorts?.get(e)??(()=>0)}sort(e){let t=this.getSortFn(this.selectedSort());return[...e].sort(t)}matches(e){let t=this.getFilterFn(this.selectedFilter()),o=this.getSearchFn(this.searchText());return t(e)&&o(e)}move(e,t){if(!this.permissions(e).move)throw new Error("move permission not granted");e.detach(),t.attach(e),this.on.move.pub({item:e,target:t})}delete(e){if(!this.permissions(e).delete)throw new Error("delete permission not granted");let t=[...e.crawl()].map(([o])=>o);return e.destroy(),this.on.delete.pub({items:t})}rename(e,t){if(!this.permissions(e).rename)throw new Error("rename permission not granted");this.on.rename.pub({item:e,newName:t})}upload(e,t){if(!this.permissions(t).upload)throw new Error("upload permission not granted");return this.on.upload.pub({files:e,target:t}).then(()=>this.on.refresh.pub({}))}addFolder(e){if(!this.permissions(e).newFolder)throw new Error("add folder permission not granted");this.on.newFolder.pub({parent:e})}components=()=>this.components};var be;(function(r){r.rename="rename",r.move="move",r.delete="delete",r.refresh="refresh",r.newFolder="newFolder",r.search="search",r.upload="upload"})(be||(be={}));var Ao=Object.values(be);function _t(r,e={}){let t={};for(let o of Ao)t[o]=o in e?e[o]:r;return t}var _r={all:_t(!0),readOnly:_t(!1,{[be.refresh]:!0,[be.search]:!0}),none:_t(!1)};var tt=class{taxonomy;onChange=j();#e=new A;constructor(e){this.taxonomy=e}getSpecimen(e){return this.#e.require(e)}setSpecimen(e,t,o){this.#e.set(e,[t,o]),this.onChange.pub()}query(e){let[t,o]=this.getSpecimen(e),s=this.taxonomy.taxon(t);return{kind:t,taxon:s,specimen:o}}};var rt=class{#e=new A;constructor(e){for(let[t,o]of Object.entries(e))this.#e.set(t,o)}taxon(e){return this.#e.require(e)}};var ot=class{#e=new A;#t=new A;has(e){return this.#e.has(e)}getChildren(e){return this.#e.require(e)}getParent(e){return this.#t.get(e)}establishRoot(e){this.#e.set(e,new Set)}attach(e,...t){let o=this.getChildren(e);for(let s of t){if(this.getParent(s))throw new Error("child already has parent");o.add(s),this.#t.set(s,e),this.#e.set(s,new Set)}}detach(e){if(!this.has(e))return;let t=this.getParent(e);t&&(this.getChildren(t).delete(e),this.#t.delete(e))}destroy(e){this.detach(e);let t=[...this.crawl(e)];for(let[o]of t)this.#e.delete(o),this.#t.delete(o)}*crawl(e,t=()=>!0){let o=[[e,[]]],s=new Set;for(;o.length;){let[n,i]=o.shift();if(!(s.has(n)||!t(n,i))){s.add(n),yield[n,i];for(let l of this.getChildren(n))o.push([l,[...i,n]])}}}};var st=class{codex;id;signal=h(this);constructor(e,t){this.codex=e,this.id=t}get kind(){return this.codex.clade.query(this.id).kind}isKind(e){return e===this.kind}get taxon(){return this.codex.clade.query(this.id).taxon}get specimen(){return this.codex.clade.query(this.id).specimen}get parent(){let e=this.codex.hierarchy.getParent(this.id);return e?this.codex.require(e):void 0}get children(){return[...this.codex.hierarchy.getChildren(this.id)].map(e=>this.codex.require(e))}attach(...e){return this.codex.hierarchy.attach(this.id,...e.map(t=>t.id)),this.signal(this),this}detach(){this.codex.hierarchy.detach(this.id),this.signal(this)}create(e,t){let o=this.codex.create(e,t);return this.attach(o),o}destroy(){this.codex.hierarchy.destroy(this.id),this.signal(this)}*crawl(e=()=>!0){let t=this.codex.hierarchy.crawl(this.id,(o,s)=>e(this.codex.require(o),s.map(n=>this.codex.require(n))));for(let[o,s]of t)yield[this.codex.require(o),s.map(n=>this.codex.require(n))]}};function Er(){return q.random()}var nt=class{clade;hierarchy;static setup(e){let t=new rt(e),o=new tt(t),s=new ot;return new this(o,s)}#e=new A;constructor(e,t){this.clade=e,this.hierarchy=t}create(e,t){let o=Er();this.clade.setSpecimen(o,e,t);let s=new st(this,o);return this.#e.set(o,s),s.signal()}root(e){return this.hierarchy.establishRoot(e.id),e.signal()}require(e){return this.#e.require(e).signal()}};var it=class r extends et{static config=()=>{let e=new A().set("audio",p`<sl-icon name=music-note-beamed></sl-icon>`).set("video",p`<sl-icon name=film></sl-icon>`).set("image",p`<sl-icon name=image></sl-icon>`).set("other",p`<sl-icon name=file-earmark></sl-icon>`),t=new Map().set("all",()=>!0).set("video",a=>a.isKind("folder")||a.isKind("file")&&a.specimen.format==="video").set("audio",a=>a.isKind("folder")||a.isKind("file")&&a.specimen.format==="audio"),o=new Map().set("label",(a,c)=>a.specimen.label.localeCompare(c.specimen.label)).set("format",(a,c)=>a.isKind("file")&&c.isKind("file")?a.specimen.format.localeCompare(c.specimen.format):a.isKind("file")?-1:c.isKind("file")?1:0),s=(a,c)=>{let u=a.join(" ").trim().toLowerCase();return u===""?!0:c.kind==="folder"?c.children.some(f=>s(a,f)):c.specimen.label.toLowerCase().includes(u)},n=nt.setup({folder:{icon:p`<sl-icon name="folder"></sl-icon>`},file:{icon:p`<sl-icon name="file"></sl-icon>`}}),i=n.root(n.create("folder",{label:"project"})),l=(a,c)=>a.isKind("file")?e.require(a.specimen.format):c?p`<sl-icon name="folder2-open"></sl-icon>`:a.taxon.icon;return{codex:n,root:i,sorts:o,filters:t,defaultFilter:"all",defaultSort:"label",search:(a,c)=>a.some(u=>c.kind.includes(u)||c.id.includes(u)||c.specimen.label.includes(u))||s(a,c),renderIcon:l,renderLabel:a=>a.specimen.label,renderPreview:a=>a.isKind("file")&&a.specimen.previewUrl?p`<img src=${a.specimen.previewUrl}>`:l(a,!1),permissions:a=>_r.all}};constructor(){super(r.config())}};var $=d`@layer theme, view; @layer theme {
|
|
29
29
|
|
|
30
30
|
:host {
|
|
31
31
|
--surface: var(--quay-surface, #0f0f11);
|
|
@@ -270,7 +270,7 @@ sl-tooltip {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
`;var zr=S(()=>{m($,Tr);let r=x(),e=Y(),t=_(r),{trail:o,config:s}=t,[n,i]=yr("tiles");R(()=>{let u=t.on.
|
|
273
|
+
`;var zr=S(()=>{m($,Tr);let r=x(),e=Y(),t=_(r),{trail:o,config:s}=t,[n,i]=yr("tiles");R(()=>{let u=t.on.refresh.sub(()=>e());return()=>u()});let l=()=>t.sort(o.currentFolder).filter(u=>t.matches(u));return p`
|
|
274
274
|
<div class="toolbar">
|
|
275
275
|
<sl-button-group label="View mode">
|
|
276
276
|
<sl-tooltip content="Tiles">
|