@inkandswitch/patchwork-pkg-base 0.0.106 → 0.0.107

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.
Files changed (43) hide show
  1. package/module-settings-url +1 -1
  2. package/package.json +1 -1
  3. package/packages/llm-host/dist/{LlmConfigTray-CjW04jeT.js → LlmConfigTray-CsVpZoou.js} +160 -150
  4. package/packages/llm-host/dist/index.js +1 -1
  5. package/packages/sideboard/dist/{chunk-RZPTJTVZ.js → chunk-3A65VAIS.js} +2 -2
  6. package/packages/sideboard/dist/chunk-B2O2X2JP.js +13 -0
  7. package/packages/sideboard/dist/chunk-B2O2X2JP.js.map +7 -0
  8. package/packages/sideboard/dist/chunk-PVIUDN4Q.js +2 -0
  9. package/packages/sideboard/dist/chunk-PVIUDN4Q.js.map +7 -0
  10. package/packages/sideboard/dist/chunk-WIFOKAHN.js +2 -0
  11. package/packages/sideboard/dist/chunk-WIFOKAHN.js.map +7 -0
  12. package/packages/sideboard/dist/chunk-WPHECYLJ.js +15 -0
  13. package/packages/sideboard/dist/chunk-WPHECYLJ.js.map +7 -0
  14. package/packages/sideboard/dist/{create-new-menu-4VNS2UFI.js → create-new-menu-JPICLPWM.js} +2 -2
  15. package/packages/sideboard/dist/document-list-panel-VFY2RV33.js +2 -0
  16. package/packages/sideboard/dist/index.css +1 -1
  17. package/packages/sideboard/dist/index.css.map +2 -2
  18. package/packages/sideboard/dist/index.js +1 -1
  19. package/packages/sideboard/dist/item-menu-C37UJBFI.js +2 -0
  20. package/packages/sideboard/dist/{item-menu-3JUJN3MS.js.map → item-menu-C37UJBFI.js.map} +1 -1
  21. package/packages/sideboard/dist/sideboard/sideboard.js +1 -1
  22. package/packages/threepane/dist/IsolatedDocumentArea-RT2UPRAG.js +2 -0
  23. package/packages/threepane/dist/{PatchworkFrame-X4GBBC46.js → PatchworkFrame-FEFTB5UT.js} +2 -2
  24. package/packages/threepane/dist/{chunk-MWFQHDD3.js → chunk-2TJAL7D5.js} +5 -5
  25. package/packages/threepane/dist/{chunk-MWFQHDD3.js.map → chunk-2TJAL7D5.js.map} +3 -3
  26. package/packages/threepane/dist/index.js +1 -1
  27. package/plugin-registry-url +1 -1
  28. package/packages/sideboard/dist/chunk-73XN2I2U.js +0 -15
  29. package/packages/sideboard/dist/chunk-73XN2I2U.js.map +0 -7
  30. package/packages/sideboard/dist/chunk-NS3ADG2Z.js +0 -2
  31. package/packages/sideboard/dist/chunk-NS3ADG2Z.js.map +0 -7
  32. package/packages/sideboard/dist/chunk-OFWMAVKQ.js +0 -13
  33. package/packages/sideboard/dist/chunk-OFWMAVKQ.js.map +0 -7
  34. package/packages/sideboard/dist/chunk-YZ573CYO.js +0 -2
  35. package/packages/sideboard/dist/chunk-YZ573CYO.js.map +0 -7
  36. package/packages/sideboard/dist/document-list-panel-SCICIJCF.js +0 -2
  37. package/packages/sideboard/dist/item-menu-3JUJN3MS.js +0 -2
  38. package/packages/threepane/dist/IsolatedDocumentArea-W7IBHNIS.js +0 -2
  39. /package/packages/sideboard/dist/{chunk-RZPTJTVZ.js.map → chunk-3A65VAIS.js.map} +0 -0
  40. /package/packages/sideboard/dist/{create-new-menu-4VNS2UFI.js.map → create-new-menu-JPICLPWM.js.map} +0 -0
  41. /package/packages/sideboard/dist/{document-list-panel-SCICIJCF.js.map → document-list-panel-VFY2RV33.js.map} +0 -0
  42. /package/packages/threepane/dist/{IsolatedDocumentArea-W7IBHNIS.js.map → IsolatedDocumentArea-RT2UPRAG.js.map} +0 -0
  43. /package/packages/threepane/dist/{PatchworkFrame-X4GBBC46.js.map → PatchworkFrame-FEFTB5UT.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/sideboard/lib/doc-link.ts", "../src/sideboard/dnd/dnd.ts"],
4
- "sourcesContent": ["import type { AutomergeUrl, Repo } from \"@automerge/automerge-repo/slim\";\nimport { getRegistry, isLoadedPlugin } from \"@inkandswitch/patchwork-plugins\";\nimport type {\n DocLink,\n HasPatchworkMetadata,\n} from \"@inkandswitch/patchwork-filesystem\";\n\n// Resolve a bare automerge url into a DocLink by reading the doc's\n// patchwork metadata and asking its datatype for a title\nexport async function docLinkFromUrl(\n repo: Repo,\n url: AutomergeUrl\n): Promise<DocLink> {\n const handle = await repo.find<Partial<HasPatchworkMetadata>>(url);\n const doc = handle.doc();\n const type = doc?.[\"@patchwork\"]?.type ?? \"\";\n let name = \"Untitled\";\n\n if (type) {\n const registry = getRegistry(\"patchwork:datatype\");\n const datatype = registry.get(type);\n if (datatype) {\n await registry.load(datatype.id);\n if (isLoadedPlugin(datatype)) {\n name = datatype.module.getTitle(doc) || name;\n }\n }\n }\n\n return { name, type, url };\n}\n", "import { createSignal } from \"solid-js\";\nimport type { AutomergeUrl } from \"@automerge/automerge-repo/slim\";\n\nexport const [dragging, setDragging] = createSignal(false);\nexport const [copyMode, setCopyMode] = createSignal(false);\n\n// Dragging the \"new document\" button. Carries no document \u2014 on drop it asks the\n// list to open a pending-doc placeholder at the drop location instead of moving\n// anything.\nexport const NEW_DOC_DND_TYPE = \"application/x-patchwork-new-doc\";\nexport const [newDocDragging, setNewDocDragging] = createSignal(false);\n\nexport function isNewDocDrag(event: DragEvent) {\n return event.dataTransfer?.types.includes(NEW_DOC_DND_TYPE) ?? false;\n}\n\n/**\n * Where a drop will land. It's the one answer both the drop line (while\n * dragging) and the drop itself use, so the picture can't disagree with the\n * result: `folderUrl` + `index` is the insertion point, and `id` + `position`\n * say what to draw.\n *\n * - above/below: a line on the row whose `data-dnd-item` is `id`\n * - inside: the folder whose `data-dnd-container` is `id` lights up\n * - end: a line after the last row of the list whose container is `id`\n */\nexport type DropSpot = {\n id: string;\n position: \"above\" | \"below\" | \"inside\" | \"end\";\n folderUrl: AutomergeUrl;\n index: number;\n};\n\n/** The spot for a row: above/below go into its parent, inside into itself. */\nexport function rowSpot(\n row: { id: string; url: AutomergeUrl; parentUrl: AutomergeUrl; index: number },\n position: \"above\" | \"below\" | \"inside\"\n): DropSpot {\n if (position === \"inside\") {\n return { id: row.id, position, folderUrl: row.url, index: 0 };\n }\n return {\n id: row.id,\n position,\n folderUrl: row.parentUrl,\n index: position === \"above\" ? row.index : row.index + 1,\n };\n}\n\n/** The spot after the last row of a folder's list. */\nexport function endSpot(folderUrl: AutomergeUrl, length: number): DropSpot {\n return { id: folderUrl, position: \"end\", folderUrl, index: length };\n}\n\n// Drop target is a plain variable \u2014 not a SolidJS signal.\n// Visual state is updated via direct DOM manipulation to avoid\n// O(n) reactive updates across all items on every dragover.\nlet currentDropTarget: DropSpot | null = null;\n\nexport function getDropTarget() {\n return currentDropTarget;\n}\n\n// Every mounted copy of a row shares its id (the same folder can be open in\n// two places, or in two panels), and they all stand for the same docref, so\n// every copy gets the mark \u2014 not just whichever one comes first in the DOM.\nfunction marked(attribute: string, id: string) {\n return document.querySelectorAll(`[${attribute}=\"${CSS.escape(id)}\"]`);\n}\n\nfunction updateDropTargetDOM(\n oldTarget: DropSpot | null,\n newTarget: DropSpot | null\n) {\n if (oldTarget) {\n for (const item of marked(\"data-dnd-item\", oldTarget.id))\n item.removeAttribute(\"data-dnd-droplist-state\");\n for (const container of marked(\"data-dnd-container\", oldTarget.id))\n container.removeAttribute(\"data-drop-state\");\n }\n if (newTarget) {\n if (newTarget.position === \"inside\" || newTarget.position === \"end\") {\n for (const container of marked(\"data-dnd-container\", newTarget.id))\n container.setAttribute(\"data-drop-state\", newTarget.position);\n }\n if (newTarget.position !== \"end\") {\n for (const item of marked(\"data-dnd-item\", newTarget.id))\n item.setAttribute(\"data-dnd-droplist-state\", newTarget.position);\n }\n }\n}\n\n// Identity for the \"did this drag start and end in the same view?\" question.\n// The answer decides move (\u2192 in-view) vs add-link (\u2192 cross-view or external).\n//\n// The tool id can't answer it: the sideboard is shown through patchwork-view's\n// *fallback* path, which never sets the `tool-id` attribute, so element.toolId\n// is null \u2014 and even when set it names the tool *type*, not the instance, so\n// two side-by-side views would collide. The <patchwork-view> element itself is\n// the instance identity. We're single-context on the web (dragstart and drop\n// run in the same window), so plain reference equality is all we need: remember\n// the origin element on dragstart, compare it on drop, clear it on dragend.\nlet dragOriginView: object | null = null;\nexport function setDragOriginView(element: object | null) {\n dragOriginView = element;\n}\nexport function isSameDragOriginView(element: object): boolean {\n return dragOriginView != null && dragOriginView === element;\n}\n\nexport type SideboardDragAndDropItem = {\n id: string;\n url: AutomergeUrl;\n type: string;\n name: string;\n source: string;\n};\n\n// Plain Map \u2014 not reactive. aria-checked is updated via DOM manipulation\n// to avoid O(n) reactive updates when selection changes.\nexport const dragstack = new Map<string, SideboardDragAndDropItem>();\n\nfunction setDragChecked(id: string, checked: boolean) {\n for (const el of marked(\"data-dnd-item\", id)) {\n if (checked) {\n el.setAttribute(\"aria-checked\", \"true\");\n } else {\n el.removeAttribute(\"aria-checked\");\n }\n }\n}\n\nexport function addToDragstack(id: string, item: SideboardDragAndDropItem) {\n dragstack.set(id, item);\n setDragChecked(id, true);\n}\n\nexport function removeFromDragstack(id: string) {\n dragstack.delete(id);\n setDragChecked(id, false);\n}\n\nexport function clearDragstack() {\n for (const id of dragstack.keys()) {\n setDragChecked(id, false);\n }\n dragstack.clear();\n}\n\nexport function setDragSourceItems(ids: string[]) {\n for (const id of ids) {\n for (const el of marked(\"data-dnd-item\", id))\n el.setAttribute(\"data-dnd-dragging\", \"\");\n }\n}\n\nexport function clearDragSourceItems() {\n for (const el of document.querySelectorAll(\"[data-dnd-dragging]\")) {\n el.removeAttribute(\"data-dnd-dragging\");\n }\n}\n\nexport function isAbove(clientY: number, element: Element) {\n const rect = element.getBoundingClientRect();\n const offset = clientY - rect.top;\n return offset < rect.height / 2;\n}\n\nexport function clearDropTarget() {\n updateDropTargetDOM(currentDropTarget, null);\n currentDropTarget = null;\n}\n\nexport function setDropTarget(target: DropSpot | null) {\n // Only update if actually changed\n const current = currentDropTarget;\n if (!current && !target) return;\n if (\n current &&\n target &&\n current.id === target.id &&\n current.position === target.position &&\n current.folderUrl === target.folderUrl &&\n current.index === target.index\n ) {\n return;\n }\n\n updateDropTargetDOM(current, target);\n currentDropTarget = target;\n}\n"],
5
- "mappings": "AACA,OAAS,eAAAA,EAAa,kBAAAC,MAAsB,kCAQ5C,eAAsBC,EACpBC,EACAC,EACkB,CAElB,IAAMC,GADS,MAAMF,EAAK,KAAoCC,CAAG,GAC9C,IAAI,EACjBE,EAAOD,IAAM,YAAY,GAAG,MAAQ,GACtCE,EAAO,WAEX,GAAID,EAAM,CACR,IAAME,EAAWR,EAAY,oBAAoB,EAC3CS,EAAWD,EAAS,IAAIF,CAAI,EAC9BG,IACF,MAAMD,EAAS,KAAKC,EAAS,EAAE,EAC3BR,EAAeQ,CAAQ,IACzBF,EAAOE,EAAS,OAAO,SAASJ,CAAG,GAAKE,GAG9C,CAEA,MAAO,CAAE,KAAAA,EAAM,KAAAD,EAAM,IAAAF,CAAI,CAC3B,CC9BA,OAAS,gBAAAM,MAAoB,WAGtB,GAAM,CAACC,EAAUC,CAAW,EAAIF,EAAa,EAAK,EAC5C,CAACG,EAAUC,CAAW,EAAIJ,EAAa,EAAK,EAK5CK,EAAmB,kCACnB,CAACC,EAAgBC,CAAiB,EAAIP,EAAa,EAAK,EAE9D,SAASQ,EAAaC,EAAkB,CAC7C,OAAOA,EAAM,cAAc,MAAM,SAASJ,CAAgB,GAAK,EACjE,CAoBO,SAASK,EACdC,EACAC,EACU,CACV,OAAIA,IAAa,SACR,CAAE,GAAID,EAAI,GAAI,SAAAC,EAAU,UAAWD,EAAI,IAAK,MAAO,CAAE,EAEvD,CACL,GAAIA,EAAI,GACR,SAAAC,EACA,UAAWD,EAAI,UACf,MAAOC,IAAa,QAAUD,EAAI,MAAQA,EAAI,MAAQ,CACxD,CACF,CAGO,SAASE,EAAQC,EAAyBC,EAA0B,CACzE,MAAO,CAAE,GAAID,EAAW,SAAU,MAAO,UAAAA,EAAW,MAAOC,CAAO,CACpE,CAKA,IAAIC,EAAqC,KAElC,SAASC,GAAgB,CAC9B,OAAOD,CACT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EAAmBC,EAAe,CAChD,QAAWlB,KAAMkB,EACf,QAAWL,KAAMf,EAAO,gBAAiBE,CAAE,EACzCa,EAAG,aAAa,oBAAqB,EAAE,CAE7C,CAEO,SAASM,GAAuB,CACrC,QAAWN,KAAM,SAAS,iBAAiB,qBAAqB,EAC9DA,EAAG,gBAAgB,mBAAmB,CAE1C,CAEO,SAASO,EAAQC,EAAiBb,EAAkB,CACzD,IAAMc,EAAOd,EAAQ,sBAAsB,EAE3C,OADea,EAAUC,EAAK,IACdA,EAAK,OAAS,CAChC,CAEO,SAASC,GAAkB,CAChCtB,EAAoBL,EAAmB,IAAI,EAC3CA,EAAoB,IACtB,CAEO,SAAS4B,EAAcC,EAAyB,CAErD,IAAMC,EAAU9B,EACZ,CAAC8B,GAAW,CAACD,GAEfC,GACAD,GACAC,EAAQ,KAAOD,EAAO,IACtBC,EAAQ,WAAaD,EAAO,UAC5BC,EAAQ,YAAcD,EAAO,WAC7BC,EAAQ,QAAUD,EAAO,QAK3BxB,EAAoByB,EAASD,CAAM,EACnC7B,EAAoB6B,EACtB",
6
- "names": ["getRegistry", "isLoadedPlugin", "docLinkFromUrl", "repo", "url", "doc", "type", "name", "registry", "datatype", "createSignal", "dragging", "setDragging", "copyMode", "setCopyMode", "NEW_DOC_DND_TYPE", "newDocDragging", "setNewDocDragging", "isNewDocDrag", "event", "rowSpot", "row", "position", "endSpot", "folderUrl", "length", "currentDropTarget", "getDropTarget", "marked", "attribute", "id", "updateDropTargetDOM", "oldTarget", "newTarget", "item", "container", "dragOriginView", "setDragOriginView", "element", "isSameDragOriginView", "dragstack", "setDragChecked", "checked", "el", "addToDragstack", "removeFromDragstack", "clearDragstack", "setDragSourceItems", "ids", "clearDragSourceItems", "isAbove", "clientY", "rect", "clearDropTarget", "setDropTarget", "target", "current"]
7
- }
@@ -1,2 +0,0 @@
1
- import{b as a,c as b}from"./chunk-73XN2I2U.js";import"./chunk-OFWMAVKQ.js";import"./chunk-RZPTJTVZ.js";import"./chunk-YZ573CYO.js";import"./chunk-FEMULUBJ.js";import"./chunk-TCL6SLDB.js";import"./chunk-FW4363Y4.js";export{a as DocumentListPanel,b as renderDocumentListPanel};
2
- //# sourceMappingURL=document-list-panel-SCICIJCF.js.map
@@ -1,2 +0,0 @@
1
- import{a as f,b as w,c as v,d as o,e as a}from"./chunk-NS3ADG2Z.js";import{h as m,i as g,o as S}from"./chunk-RZPTJTVZ.js";import{m as c,p}from"./chunk-YZ573CYO.js";import"./chunk-TCL6SLDB.js";import"./chunk-FW4363Y4.js";import{memo as $}from"solid-js/web";import{createComponent as e}from"solid-js/web";import{For as d,Show as u}from"solid-js";import{parseAutomergeUrl as I}from"@automerge/automerge-repo/slim";function A(l){let n=()=>{let r=m();return r&&l.element.contains(r.element)?r:null};function i(r){m()===r&&g(null),r.element.isConnected&&r.element.focus({preventScroll:!0})}return e(u,{get when(){return n()},keyed:!0,children:r=>e(v,{get anchor(){return{x:r.x,y:r.y}},placement:"right-start",onClose:()=>i(r),get children(){return e(T,{target:r,get repo(){return l.repo},get rootFolderHandle(){return l.rootFolderHandle}})}})})}function T(l){let n=l.target,i=w(n.type),r=f(t=>!t.unlisted),h=()=>c.has(n.id)&&c.size>1,s=()=>`${location.protocol}//${location.host}/#doc=${I(n.url).documentId}`;async function b(){if(!h()){n.remove();return}let t=[...c.values()].map(y=>y.url);confirm(`Remove ${t.length} items from the sidebar?`)&&(p(),await S(l.repo,l.rootFolderHandle,t))}return[e(u,{get when(){return n.createInside},get children(){return e(a,{label:"Create",get children(){return e(d,{each:r,children:t=>e(o,{onSelect:()=>n.createInside(t),get children(){return t.name}})})}})}}),e(u,{get when(){return i.length},get children(){return e(a,{label:"Open with...",get children(){return e(d,{each:i,children:t=>e(o,{onSelect:()=>n.openWith(t.id),get children(){return t.name}})})}})}}),e(a,{label:"Copy",get children(){return[e(o,{onSelect:()=>navigator.clipboard.writeText(n.url),children:"Automerge url"}),e(o,{onSelect:()=>navigator.clipboard.writeText(s()),children:"Patchwork url"}),e(u,{get when(){return i.length},get children(){return e(a,{label:"Patchwork url with...",get children(){return e(d,{each:i,children:t=>e(o,{onSelect:()=>navigator.clipboard.writeText(`${s()}&tool=${t.id}`),get children(){return t.name}})})}})}})]}}),e(o,{onSelect:()=>n.startRenaming(),children:"Rename"}),e(o,{onSelect:b,get children(){return $(()=>!!h())()?`Remove ${c.size} items`:"Remove"}})]}export{A as ItemMenu};
2
- //# sourceMappingURL=item-menu-3JUJN3MS.js.map
@@ -1,2 +0,0 @@
1
- import{r as a,s as b}from"./chunk-MWFQHDD3.js";import"./chunk-FW4363Y4.js";export{a as IsolatedDocumentArea,b as mountIsolationRoot};
2
- //# sourceMappingURL=IsolatedDocumentArea-W7IBHNIS.js.map