@inkandswitch/patchwork-pkg-base 0.0.107 → 0.0.108

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.
@@ -1,2 +1,2 @@
1
- import"./chunk-FW4363Y4.js";function a(){return new Promise(t=>setTimeout(t))}async function e(t){let{renderPatchworkFrame:o}=await import("./PatchworkFrame-FEFTB5UT.js");return await a(),o(t)}var n=[{type:"patchwork:datatype",id:"account",name:"Patchwork Account",icon:"UserCircle",unlisted:!0,async load(){let{AccountDatatype:t}=await import("./datatypes-YDAECNBI.js");return t}},{type:"patchwork:datatype",id:"threepane:config",name:"Threepane Config",icon:"Settings",unlisted:!0,async load(){let{ThreepaneConfigDatatype:t}=await import("./datatypes-YDAECNBI.js");return t}},{type:"patchwork:tool",id:"threepane",tags:["frame-tool"],name:"Threepane",icon:"Window",supportedDatatypes:["account"],load:e},{type:"patchwork:tool",id:"threepane-wild-west",tags:["frame-tool"],name:"Threepane",icon:"Window",supportedDatatypes:["account"],load:e,unlisted:!0},{type:"patchwork:tool",id:"threepane-isolation",tags:["frame-tool"],name:"Threepane (isolate)",icon:"Window",supportedDatatypes:["account"],load:()=>e(!0),unlisted:!0},{type:"patchwork:component",id:"threepane-isolation-root",name:"Threepane Isolation Root",async load(){let{mountIsolationRoot:t}=await import("./IsolatedDocumentArea-RT2UPRAG.js");return await a(),t}},{type:"patchwork:tool",id:"patchwork-frame",name:"Patchwork Frame",icon:"Window",supportedDatatypes:["account"],unlisted:!0,load:e}];export{n as plugins};
1
+ import"./chunk-FW4363Y4.js";function a(){return new Promise(t=>setTimeout(t))}async function e(t){let{renderPatchworkFrame:o}=await import("./PatchworkFrame-U2TVLGCZ.js");return await a(),o(t)}var n=[{type:"patchwork:datatype",id:"account",name:"Patchwork Account",icon:"UserCircle",unlisted:!0,async load(){let{AccountDatatype:t}=await import("./datatypes-YDAECNBI.js");return t}},{type:"patchwork:datatype",id:"threepane:config",name:"Threepane Config",icon:"Settings",unlisted:!0,async load(){let{ThreepaneConfigDatatype:t}=await import("./datatypes-YDAECNBI.js");return t}},{type:"patchwork:tool",id:"threepane",tags:["frame-tool"],name:"Threepane",icon:"Window",supportedDatatypes:["account"],load:e},{type:"patchwork:tool",id:"threepane-wild-west",tags:["frame-tool"],name:"Threepane",icon:"Window",supportedDatatypes:["account"],load:e,unlisted:!0},{type:"patchwork:tool",id:"threepane-isolation",tags:["frame-tool"],name:"Threepane (isolate)",icon:"Window",supportedDatatypes:["account"],load:()=>e(!0),unlisted:!0},{type:"patchwork:component",id:"threepane-isolation-root",name:"Threepane Isolation Root",async load(){let{mountIsolationRoot:t}=await import("./IsolatedDocumentArea-UTNJADQ7.js");return await a(),t}},{type:"patchwork:tool",id:"patchwork-frame",name:"Patchwork Frame",icon:"Window",supportedDatatypes:["account"],unlisted:!0,load:e}];export{n as plugins};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- automerge:3DryLVA4FgK77aYB5CGyu6fYYHpo
1
+ automerge:2U4QbnHZ3HEBhoxUqybAywBMhL2R
@@ -1,2 +0,0 @@
1
- import{accept as u}from"@inkandswitch/patchwork-providers";const E="patchwork:selected-doc",m="patchwork:selected-view",L=r=>{let o=w();const c=new Set,n=new Set,h=()=>{const e=w();e&&s(e)},s=e=>{if(!(o?.url===e.url&&o?.toolId===e.toolId)){o=e;for(const t of c)t(i());for(const t of n)t(o)}},i=()=>o?[o.url]:[],a=e=>{const t=e.detail.url;t&&s({url:t,toolId:e.detail.toolId??null})},d=()=>{h()},l=e=>{e.detail.selector.type===E&&u(e,t=>(t(i()),c.add(t),()=>c.delete(t))),e.detail.selector.type===m&&u(e,t=>(t(o),n.add(t),()=>n.delete(t)))};return r.addEventListener("patchwork:open-document",a),r.addEventListener("patchwork:subscribe",l),window.addEventListener("hashchange",d),()=>{r.removeEventListener("patchwork:open-document",a),r.removeEventListener("patchwork:subscribe",l),window.removeEventListener("hashchange",d),c.clear(),n.clear()}},w=()=>{const r=new URLSearchParams(window.location.hash.slice(1)),o=r.get("doc");return o?{url:o.startsWith("automerge:")?o:`automerge:${o}`,toolId:r.get("tool")}:null};export{L as SelectedDocProvider};
2
- //# sourceMappingURL=SelectedDocProvider-CLztU54U.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectedDocProvider-CLztU54U.js","sources":["../../src/SelectedDocProvider.ts"],"sourcesContent":["import { type AutomergeUrl } from \"@automerge/automerge-repo/slim\";\nimport { accept, type SubscribeEvent } from \"@inkandswitch/patchwork-providers\";\nimport type { OpenDocumentEvent } from \"@inkandswitch/patchwork-elements\";\n\nconst SELECTED_DOC_SELECTOR = \"patchwork:selected-doc\";\nconst SELECTED_VIEW_SELECTOR = \"patchwork:selected-view\";\n\ntype SelectedView = {\n url: AutomergeUrl;\n toolId: string | null;\n};\n\n/**\n * Broadcasts the set of currently-selected document urls to any\n * `patchwork:selected-doc` subscriber, and the primary selected view\n * (`{ url, toolId }`) to any `patchwork:selected-view` subscriber.\n *\n * Selection is driven by `patchwork:open-document` events bubbling up from\n * descendant views (the sidebar, links inside the main view, etc). Opening a\n * document replaces the selection with that single url; `[0]` is the primary\n * selection.\n *\n * Selection is transient UI state, so it lives only in memory here — it is\n * never written to an Automerge doc (and therefore never synced to peers).\n */\nexport const SelectedDocProvider = (element: HTMLElement) => {\n let selectedView = selectedViewFromLocation();\n const docSubscribers = new Set<(urls: AutomergeUrl[]) => void>();\n const viewSubscribers = new Set<(view: SelectedView | null) => void>();\n\n const updateSelectedViewFromLocation = () => {\n const next = selectedViewFromLocation();\n if (!next) return;\n updateSelectedView(next);\n };\n\n const updateSelectedView = (next: SelectedView) => {\n if (\n selectedView?.url === next.url &&\n selectedView?.toolId === next.toolId\n ) {\n return;\n }\n selectedView = next;\n for (const emit of docSubscribers) emit(selectedDocUrls());\n for (const emit of viewSubscribers) emit(selectedView);\n };\n\n const selectedDocUrls = (): AutomergeUrl[] => {\n return selectedView ? [selectedView.url] : [];\n };\n\n const onOpenDocument = (event: OpenDocumentEvent) => {\n const url = event.detail.url;\n if (!url) return;\n updateSelectedView({\n url,\n toolId: event.detail.toolId ?? null,\n });\n };\n\n const onHashChange = () => {\n updateSelectedViewFromLocation();\n };\n\n const onSubscribe = (event: SubscribeEvent) => {\n if (event.detail.selector.type === SELECTED_DOC_SELECTOR) {\n accept<AutomergeUrl[]>(event, (respond) => {\n respond(selectedDocUrls());\n docSubscribers.add(respond);\n return () => docSubscribers.delete(respond);\n });\n }\n if (event.detail.selector.type === SELECTED_VIEW_SELECTOR) {\n accept<SelectedView | null>(event, (respond) => {\n respond(selectedView);\n viewSubscribers.add(respond);\n return () => viewSubscribers.delete(respond);\n });\n }\n };\n\n element.addEventListener(\n \"patchwork:open-document\",\n onOpenDocument as EventListener\n );\n element.addEventListener(\"patchwork:subscribe\", onSubscribe);\n window.addEventListener(\"hashchange\", onHashChange);\n\n return () => {\n element.removeEventListener(\n \"patchwork:open-document\",\n onOpenDocument as EventListener\n );\n element.removeEventListener(\"patchwork:subscribe\", onSubscribe);\n window.removeEventListener(\"hashchange\", onHashChange);\n docSubscribers.clear();\n viewSubscribers.clear();\n };\n};\n\nconst selectedViewFromLocation = (): SelectedView | null => {\n const params = new URLSearchParams(window.location.hash.slice(1));\n const doc = params.get(\"doc\");\n if (!doc) return null;\n const url = doc.startsWith(\"automerge:\") ? doc : `automerge:${doc}`;\n return {\n url: url as AutomergeUrl,\n toolId: params.get(\"tool\"),\n };\n};\n"],"names":["SELECTED_DOC_SELECTOR","SELECTED_VIEW_SELECTOR","SelectedDocProvider","element","selectedView","selectedViewFromLocation","docSubscribers","viewSubscribers","updateSelectedViewFromLocation","next","updateSelectedView","emit","selectedDocUrls","onOpenDocument","event","url","onHashChange","onSubscribe","accept","respond","params","doc"],"mappings":"2DAIA,MAAMA,EAAwB,yBACxBC,EAAyB,0BAoBlBC,EAAuBC,GAAyB,CAC3D,IAAIC,EAAeC,EAAA,EACnB,MAAMC,MAAqB,IACrBC,MAAsB,IAEtBC,EAAiC,IA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AC5B,OAAKC,EAEE,CACL,IAFUA,EAAI,WAAW,YAAY,EAAIA,EAAM,aAAaA,CAAG,GAG/D,OAAQD,EAAO,IAAI,MAAM,CAAA,EAJV,IAMnB"}
@@ -1,2 +0,0 @@
1
- import{r as a,s as b}from"./chunk-2TJAL7D5.js";import"./chunk-FW4363Y4.js";export{a as IsolatedDocumentArea,b as mountIsolationRoot};
2
- //# sourceMappingURL=IsolatedDocumentArea-RT2UPRAG.js.map