folder-pane 4.0.0-0 → 4.0.1-0
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/declarations.d.ts +4 -4
- package/dist/_virtual/~icons/lucide/chevron-down.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/chevron-down.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/chevron-down.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/chevron-down.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/chevron-right.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/chevron-right.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/chevron-right.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/chevron-right.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/circle-small.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/circle-small.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/circle-small.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/circle-small.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/file-box.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/file-box.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/file-box.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/file-box.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/file.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/file.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/file.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/file.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/folder-open.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/folder-open.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/folder-open.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/folder-open.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/folder.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/folder.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/folder.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/folder.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/globe.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/globe.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/globe.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/globe.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/layout-grid.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/layout-grid.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/layout-grid.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/layout-grid.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/list.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/list.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/list.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/list.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/lock-keyhole.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/lock-keyhole.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/lock-keyhole.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/lock-keyhole.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/plus.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/plus.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/plus.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/plus.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/search.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/search.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/search.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/search.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/trash-2.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/trash-2.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/trash-2.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/trash-2.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/upload.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/upload.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/upload.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/upload.esm.js.map +1 -0
- package/dist/_virtual/~icons/lucide/x.cjs.js +2 -0
- package/dist/_virtual/~icons/lucide/x.cjs.js.map +1 -0
- package/dist/_virtual/~icons/lucide/x.esm.js +10 -0
- package/dist/_virtual/~icons/lucide/x.esm.js.map +1 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js +91 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js.map +1 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.d.ts +44 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.d.ts.map +1 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.esm.js +585 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.esm.js.map +1 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js +2 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js.map +1 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js +6 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js.map +1 -0
- package/dist/components/folder-pane-container/index.cjs.js +1 -0
- package/dist/components/folder-pane-container/index.d.ts +2 -0
- package/dist/components/folder-pane-container/index.d.ts.map +1 -0
- package/dist/components/folder-pane-container/index.esm.js +1 -0
- package/dist/components/folder-pane-content/FolderPaneContent.cjs.js +4 -0
- package/dist/components/folder-pane-content/FolderPaneContent.cjs.js.map +1 -0
- package/dist/components/folder-pane-content/FolderPaneContent.d.ts +6 -0
- package/dist/components/folder-pane-content/FolderPaneContent.d.ts.map +1 -0
- package/dist/components/folder-pane-content/FolderPaneContent.esm.js +176 -0
- package/dist/components/folder-pane-content/FolderPaneContent.esm.js.map +1 -0
- package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js +2 -0
- package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js.map +1 -0
- package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js +6 -0
- package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js.map +1 -0
- package/dist/components/folder-pane-content/index.cjs.js +1 -0
- package/dist/components/folder-pane-content/index.d.ts +2 -0
- package/dist/components/folder-pane-content/index.d.ts.map +1 -0
- package/dist/components/folder-pane-content/index.esm.js +1 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js +53 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js.map +1 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts +33 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts.map +1 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js +429 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js.map +1 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js +2 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js.map +1 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js +6 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js.map +1 -0
- package/dist/components/folder-pane-sidebar/index.cjs.js +1 -0
- package/dist/components/folder-pane-sidebar/index.d.ts +2 -0
- package/dist/components/folder-pane-sidebar/index.d.ts.map +1 -0
- package/dist/components/folder-pane-sidebar/index.esm.js +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.cjs.js +32 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.cjs.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.d.ts +15 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.d.ts.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.esm.js +290 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.esm.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.cjs.js +2 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.cjs.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.esm.js +6 -0
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.esm.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js +79 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts +27 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js +437 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js +2 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js.map +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js +6 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js.map +1 -0
- package/dist/components/folder-pane-storage-header/index.cjs.js +1 -0
- package/dist/components/folder-pane-storage-header/index.d.ts +2 -0
- package/dist/components/folder-pane-storage-header/index.d.ts.map +1 -0
- package/dist/components/folder-pane-storage-header/index.esm.js +1 -0
- package/dist/components/folder-pane-view/FolderPaneView.cjs.js +51 -0
- package/dist/components/folder-pane-view/FolderPaneView.cjs.js.map +1 -0
- package/dist/components/folder-pane-view/FolderPaneView.d.ts +82 -0
- package/dist/components/folder-pane-view/FolderPaneView.d.ts.map +1 -0
- package/dist/components/folder-pane-view/FolderPaneView.esm.js +728 -0
- package/dist/components/folder-pane-view/FolderPaneView.esm.js.map +1 -0
- package/dist/components/folder-pane-view/index.cjs.js +1 -0
- package/dist/components/folder-pane-view/index.d.ts +2 -0
- package/dist/components/folder-pane-view/index.d.ts.map +1 -0
- package/dist/components/folder-pane-view/index.esm.js +1 -0
- package/dist/components/folder-pane-view/renderRequest.cjs.js +2 -0
- package/dist/components/folder-pane-view/renderRequest.cjs.js.map +1 -0
- package/dist/components/folder-pane-view/renderRequest.d.ts +8 -0
- package/dist/components/folder-pane-view/renderRequest.d.ts.map +1 -0
- package/dist/components/folder-pane-view/renderRequest.esm.js +10 -0
- package/dist/components/folder-pane-view/renderRequest.esm.js.map +1 -0
- package/dist/creationSafety.cjs.js +2 -0
- package/dist/creationSafety.cjs.js.map +1 -0
- package/dist/creationSafety.d.ts +9 -0
- package/dist/creationSafety.d.ts.map +1 -0
- package/dist/creationSafety.esm.js +17 -0
- package/dist/creationSafety.esm.js.map +1 -0
- package/dist/folderPane.cjs.js +2 -2
- package/dist/folderPane.cjs.js.map +1 -1
- package/dist/folderPane.d.ts +2 -1
- package/dist/folderPane.d.ts.map +1 -1
- package/dist/folderPane.esm.js +23 -60
- package/dist/folderPane.esm.js.map +1 -1
- package/dist/helpers.cjs.js +2 -0
- package/dist/helpers.cjs.js.map +1 -0
- package/dist/helpers.d.ts +30 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.esm.js +59 -0
- package/dist/helpers.esm.js.map +1 -0
- package/dist/index.esm.js +1 -2
- package/dist/mintPaneInstance.cjs.js +2 -0
- package/dist/mintPaneInstance.cjs.js.map +1 -0
- package/dist/mintPaneInstance.d.ts +43 -0
- package/dist/mintPaneInstance.d.ts.map +1 -0
- package/dist/mintPaneInstance.esm.js +104 -0
- package/dist/mintPaneInstance.esm.js.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +9 -6
- package/dist/_virtual/_rolldown/runtime.cjs.js +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { utils as e } from "solid-ui";
|
|
2
|
+
// src/helpers.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return /\.[cm]?js$/i.test(new URL(e.uri).pathname);
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return e.isPublicKnown === !1 ? "unknown" : e.isPublic ? "public" : "private";
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return e?.toLowerCase() === "source" ? "file" : e || "item";
|
|
11
|
+
}
|
|
12
|
+
function i(t) {
|
|
13
|
+
if (t.mintClass) return e.label(t.mintClass);
|
|
14
|
+
let n = r(t.name);
|
|
15
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
16
|
+
}
|
|
17
|
+
function a(e) {
|
|
18
|
+
return `${e} ${e === 1 ? "item" : "items"}`;
|
|
19
|
+
}
|
|
20
|
+
function o(e) {
|
|
21
|
+
return e.filter((e) => !!e.mintNew && e.name?.toLowerCase() !== "chat");
|
|
22
|
+
}
|
|
23
|
+
function s(e = "Container") {
|
|
24
|
+
let t = e.charAt(0).toUpperCase() + e.slice(1);
|
|
25
|
+
return {
|
|
26
|
+
title: `New ${t}`,
|
|
27
|
+
placeholder: `Enter ${t} name`
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function c(e, n) {
|
|
31
|
+
return e.uri.endsWith("/") || !t(e) && n.isContainer(e);
|
|
32
|
+
}
|
|
33
|
+
function l(e) {
|
|
34
|
+
let t = typeof e == "object" && e ? e : void 0;
|
|
35
|
+
return t?.status === 401 || t?.status === 403 || t?.response?.status === 401 || t?.response?.status === 403;
|
|
36
|
+
}
|
|
37
|
+
function u(e) {
|
|
38
|
+
let t = /^(.*\/)index\.ttl#this$/.exec(e.uri);
|
|
39
|
+
return t ? t[1] : null;
|
|
40
|
+
}
|
|
41
|
+
function d(e, t) {
|
|
42
|
+
return t?.toLowerCase() === "schedule" ? `${e.uri}details.ttl#event` : `${e.uri}index.ttl#this`;
|
|
43
|
+
}
|
|
44
|
+
function f(t, n) {
|
|
45
|
+
if (!n) return /* @__PURE__ */ new Map();
|
|
46
|
+
let r = n.getContainerMembers(t).filter((e) => !n.isHiddenFile(e)).filter((e, t, n) => n.findIndex((t) => t.sameTerm(e)) === t).filter((e) => {
|
|
47
|
+
let n = t.uri.endsWith("/") ? t.uri : `${t.uri}/`;
|
|
48
|
+
return e.uri !== `${n}index.ttl#this`;
|
|
49
|
+
}).map((t) => [e.label(t).toLowerCase(), t]);
|
|
50
|
+
return r.sort(), new Map(r.map(([, e]) => [e.value, {
|
|
51
|
+
id: e.value,
|
|
52
|
+
subject: e,
|
|
53
|
+
parentId: t.value,
|
|
54
|
+
isContainer: c(e, n)
|
|
55
|
+
}]));
|
|
56
|
+
}
|
|
57
|
+
export { a as getContainerMemberCountLabel, s as getCreationDialogText, r as getCreationNoun, o as getCreationPanes, d as getIndexedApplicationSubject, u as getIndexedContainer, i as getPaneLabel, n as getResourceAccessState, f as getResourcesForContainer, l as isAccessDeniedError, c as isContainerResource, t as isJavaScriptFile };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=helpers.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.esm.js","names":["isJavaScriptFile","resource","getResourceAccessState","access","getCreationNoun","paneName","getPaneLabel","pane","utils","noun","getContainerMemberCountLabel","memberCount","getCreationPanes","panes","getCreationDialogText","displayLabel","paneLabel","isContainerResource","resourceLogic","isAccessDeniedError","response","error","getIndexedContainer","match","getIndexedApplicationSubject","container","getResourcesForContainer","labeledResources","allContainedResources","other","containedResource","index","containerUri"],"sources":["../src/helpers.ts"],"sourcesContent":["import type { NamedNode } from 'rdflib'\nimport { utils } from 'solid-ui'\nimport type { ResourceLogic } from 'solid-logic'\nimport type { PaneDefinition } from 'pane-registry'\nimport type { ResourceMap } from './types'\n\nexport type FolderPaneResourceLogic = Pick<\n ResourceLogic,\n 'getContainerMembers' | 'isHiddenFile' | 'isContainer' | 'containerHasIndexDocument' | 'getContainerIndexThing'\n>\n\nfunction isJavaScriptFile (resource: NamedNode): boolean {\n return /\\.[cm]?js$/i.test(new URL(resource.uri).pathname)\n}\n\ntype ResourceAccessMetadata = { isPublic?: boolean, isPublicKnown?: boolean }\n\nfunction getResourceAccessState (access: ResourceAccessMetadata): 'public' | 'private' | 'unknown' {\n if (access.isPublicKnown === false) return 'unknown'\n return access.isPublic ? 'public' : 'private'\n}\n\nfunction getCreationNoun (paneName?: string): string {\n if (paneName?.toLowerCase() === 'source') return 'file'\n return paneName || 'item'\n}\n\nfunction getPaneLabel (pane: Pick<PaneDefinition, 'name' | 'mintClass'>): string {\n if (pane.mintClass) return utils.label(pane.mintClass)\n const noun = getCreationNoun(pane.name)\n return noun.charAt(0).toUpperCase() + noun.slice(1)\n}\n\nfunction getContainerMemberCountLabel (memberCount: number): string {\n return `${memberCount} ${memberCount === 1 ? 'item' : 'items'}`\n}\n\nfunction getCreationPanes (panes: PaneDefinition[]): PaneDefinition[] {\n // Keep pane-registry order: it is also the pane priority order.\n return panes.filter(pane => !!pane.mintNew && pane.name?.toLowerCase() !== 'chat')\n}\n\nfunction getCreationDialogText (paneLabel = 'Container'): { title: string, placeholder: string } {\n const displayLabel = paneLabel.charAt(0).toUpperCase() + paneLabel.slice(1)\n return {\n title: `New ${displayLabel}`,\n placeholder: `Enter ${displayLabel} name`\n }\n}\n\nfunction isContainerResource (resource: NamedNode, resourceLogic: FolderPaneResourceLogic): boolean {\n return resource.uri.endsWith('/') || (!isJavaScriptFile(resource) && resourceLogic.isContainer(resource))\n}\n\nfunction isAccessDeniedError (error: unknown): boolean {\n const response = typeof error === 'object' && error !== null\n ? error as { status?: number, response?: { status?: number } }\n : undefined\n return response?.status === 401 || response?.status === 403 ||\n response?.response?.status === 401 || response?.response?.status === 403\n}\n\n/**\n * A pane's `index.ttl#this` stands for its container: return that container so\n * routing can render the pane without the file-explorer header.\n */\nfunction getIndexedContainer (resource: NamedNode): string | null {\n const match = /^(.*\\/)index\\.ttl#this$/.exec(resource.uri)\n return match ? match[1] : null\n}\n\nfunction getIndexedApplicationSubject (container: NamedNode, paneName?: string): string {\n return paneName?.toLowerCase() === 'schedule'\n ? `${container.uri}details.ttl#event`\n : `${container.uri}index.ttl#this`\n}\n\nfunction getResourcesForContainer (container: NamedNode, resourceLogic: FolderPaneResourceLogic | null): ResourceMap {\n if (!resourceLogic) return new Map()\n\n const containedResources = resourceLogic.getContainerMembers(container).filter(\n (resource) => !resourceLogic.isHiddenFile(resource)\n ).filter((containedResource, index, allContainedResources) => {\n return allContainedResources.findIndex(other => other.sameTerm(containedResource)) === index\n }).filter((resource) => {\n const containerUri = container.uri.endsWith('/') ? container.uri : `${container.uri}/`\n return resource.uri !== `${containerUri}index.ttl#this`\n })\n const labeledResources: Array<[string, NamedNode]> = containedResources.map(containedResource => [\n utils.label(containedResource).toLowerCase(),\n containedResource\n ])\n labeledResources.sort()\n\n return new Map(labeledResources.map(([, resource]) => [resource.value, {\n id: resource.value,\n subject: resource,\n parentId: container.value,\n isContainer: isContainerResource(resource, resourceLogic)\n }]))\n}\n\nexport {\n getCreationNoun,\n getCreationPanes,\n getCreationDialogText,\n getContainerMemberCountLabel,\n getIndexedApplicationSubject,\n getIndexedContainer,\n getPaneLabel,\n getResourceAccessState,\n getResourcesForContainer,\n isAccessDeniedError,\n isContainerResource,\n isJavaScriptFile\n}\n"],"mappings":";;AAWA,SAASA,EAAkB,GAA8B;CACvD,OAAO,cAAc,KAAK,IAAI,IAAIC,EAAS,GAAG,CAAC,CAAC,QAAQ;AAC1D;AAIA,SAASC,EAAwB,GAAkE;CAEjG,OADIC,EAAO,kBAAkB,KAAc,YACpCA,EAAO,WAAW,WAAW;AACtC;AAEA,SAASC,EAAiB,GAA2B;CAEnD,OADIC,GAAU,YAAY,MAAM,WAAiB,SAC1CA,KAAY;AACrB;AAEA,SAASC,EAAc,GAA0D;CAC/E,IAAIC,EAAK,WAAW,OAAOC,EAAM,MAAMD,EAAK,SAAS;CACrD,IAAME,IAAOL,EAAgBG,EAAK,IAAI;CACtC,OAAOE,EAAK,OAAO,C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,WAAU,MAASC,EAAM,SAASC,CAAiB,CAAC,MAAMC,CACxF,CAAC,CAAC,QAAQ,MAAa;EACtB,IAAMC,IAAeP,EAAU,IAAI,SAAS,GAAG,IAAIA,EAAU,MAAM,GAAGA,EAAU,IAAI;EACpF,OAAOxB,EAAS,QAAQ,GAAG+B,EAAa;CAC1C,CACqD,CAAA,CAAmB,KAAI,MAAqB,CAC/FxB,EAAM,MAAMsB,CAAiB,CAAC,CAAC,YAAY,GAC3CA,CACF,CAAC;CAGD,OAFAH,EAAiB,KAAK,GAEf,IAAI,IAAIA,EAAiB,KAAK,GAAG1B,OAAc,CAACA,EAAS,OAAO;EACrE,IAAIA,EAAS;EACb,SAASA;EACT,UAAUwB,EAAU;EACpB,aAAaR,EAAoBhB,GAAUiB,CAAa;CAC1D,CAAC,CAAC,CAAC;AACL"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as default };
|
|
1
|
+
export { default } from "./folderPane.esm.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./creationSafety.cjs.js");var t=class extends Error{constructor(e,t){super(e),this.cause=t,this.name=`PaneMintError`}};function n(e,t,n){let r=e.session.store;if(typeof r.each!=`function`)return!1;let i=r.each(t,r.sym(`http://www.w3.org/ns/ldp#contains`)),a=n.endsWith(`/`)?n.slice(0,-1):n;return i.some(e=>e.uri===n||e.uri===a)}function r(t,n){let r=e.normalizeCreationName(n);return`${t.uri.endsWith(`/`)?t.uri:`${t.uri}/`}${encodeURIComponent(r)}/`}function i(e,t){if(e.name?.toLowerCase()!==`source`)return!1;let n=t.trim().split(`/`).pop()??``,r=n.lastIndexOf(`.`);return r<=0||r===n.length-1}function a(e,t,n,r){let i=e.uri.endsWith(`/`)?e.uri:`${e.uri}/`,a=n.uri.startsWith(i)?n.uri.slice(i.length):``;if(!a)return r(t);let o=a.indexOf(`/`);return o>=0&&o<a.length-1?r(t):r(n.doc().uri)}function o(e){let t=e.querySelector(`:scope > .folder-pane-status-message`);return t||(t=e.ownerDocument.createElement(`div`),t.className=`folder-pane-status-message`,e.prepend(t)),t}function s(e,t,n){let r=e.ownerDocument,i=o(e);if(e.dataset.status=t,i.dataset.status=t,i.setAttribute(`role`,t===`error`?`alert`:`status`),t===`error`){let t=r.createElement(`solid-ui-error-state`);return t.setAttribute(`title`,n),t.addEventListener(`close`,()=>e.replaceChildren()),i.replaceChildren(t),i}let a=r.createElement(`span`);if(a.className=t===`progress`?`folder-pane-status-text folder-pane-container-loading`:`folder-pane-status-text`,a.textContent=n,i.replaceChildren(a),t!==`progress`){let t=r.createElement(`solid-ui-button`);t.setAttribute(`variant`,`ghost`),t.setAttribute(`title`,`Dismiss`),t.setAttribute(`aria-label`,`Dismiss`);let n=r.createElement(`icon-lucide-x`);n.setAttribute(`slot`,`icon`),t.appendChild(n),t.addEventListener(`click`,()=>e.replaceChildren()),i.appendChild(t)}return i}async function c({context:o,container:c,pane:l,name:u,noun:d,statusArea:f,me:p,dom:m,mintTimeoutMs:h=9e4,allowReplacement:g=!1}){if(!l.mintNew)throw new t(`The ${d} pane cannot create new items.`);let _;try{_=e.normalizeCreationName(u)}catch(e){let n=e instanceof Error?e.message:String(e);throw s(f,`error`,n),new t(n,e)}if(f.replaceChildren(),i(l,_)){let e=`A new text file needs an extension, such as .txt, .ttl, or .json.`;throw s(f,`error`,e),new t(e)}s(f,`progress`,`Creating ${_} ${d}`);let v=f.appendChild(m.createElement(`div`));v.className=`folder-pane-status-pane-output`;let y=r(c,_);if(!g&&n(o,c,y)){let e=`A resource named "${_}" already exists in this folder. Choose a different name; replacement is not enabled.`;throw s(f,`error`,e),new t(e)}let b=`The ${d} pane did not finish creating the resource within ${h}ms. The result is uncertain; refresh the folder before retrying.`,x,S;try{let e={folder:c,newBase:y,title:_,pane:l,noun:d,div:v,dom:m,me:p,iconEle:m.createElement(`img`),noIndexHTML:!0},t=l.mintNew(o,e);S=await Promise.race([t,new Promise((e,t)=>{x=setTimeout(()=>t(Error(b)),h)})])}catch(e){let n=e instanceof Error?e.message:String(e);throw s(f,`error`,`Unable to create ${d} "${u}": ${n}`),new t(n,e)}finally{x&&clearTimeout(x)}if(!S?.newInstance){let e=v.textContent?.trim();throw s(f,`error`,e?`Unable to create ${d} "${u}". The ${d} pane reported:`:`Unable to create ${d} "${u}": the pane did not return a new resource.`),new t(e||`The pane did not return a new resource`)}return f.replaceChildren(),{newBase:y,newInstance:S.newInstance,containedResource:a(c,y,S.newInstance,e=>o.session.store.sym(e))}}exports.PaneMintError=t,exports.getContainedResource=a,exports.getNewInstanceBase=r,exports.isExtensionlessSourceFile=i,exports.mintPaneInstance=c,exports.setMintStatus=s;
|
|
2
|
+
//# sourceMappingURL=mintPaneInstance.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mintPaneInstance.cjs.js","names":["normalizeCreationName","require_creationSafety","PaneMintError","message","cause","hasKnownDestinationConflict","store","context","members","container","withoutSlash","newBase","member","getNewInstanceBase","normalizedName","name","isExtensionlessSourceFile","pane","fileName","extensionStart","getContainedResource","containerUri","tail","newInstance","sym","firstSlash","getStatusMessage","statusArea","setMintStatus","dom","kind","errorState","text","textElement","dismiss","icon","mintPaneInstance","noun","error","paneOutput","allowReplacement","timeoutMessage","mintTimeoutMs","timeout","result","mintOptions","mintPromise","reject","reason","paneMessage","uri"],"sources":["../src/mintPaneInstance.ts"],"sourcesContent":["import type { NamedNode } from 'rdflib'\nimport type { DataBrowserContext, PaneDefinition } from 'pane-registry'\nimport { normalizeCreationName } from './creationSafety'\n\nexport type MintPaneInstanceOptions = {\n context: DataBrowserContext\n container: NamedNode\n pane: PaneDefinition\n name: string\n noun: string\n statusArea: HTMLElement\n me?: NamedNode\n dom: HTMLDocument\n mintTimeoutMs?: number\n /** Replacement is opt-in; the normal create flow never overwrites a known member. */\n allowReplacement?: boolean\n}\n\nexport type MintedPaneInstance = {\n newBase: string\n newInstance: NamedNode\n /** The direct child of `container` that holds the new instance. */\n containedResource: NamedNode\n}\n\nexport class PaneMintError extends Error {\n constructor (message: string, readonly cause?: unknown) {\n super(message)\n this.name = 'PaneMintError'\n }\n}\n\nfunction hasKnownDestinationConflict (context: DataBrowserContext, container: NamedNode, newBase: string): boolean {\n const store = context.session.store\n if (typeof store.each !== 'function') return false\n const members = store.each(container, store.sym('http://www.w3.org/ns/ldp#contains')) as NamedNode[]\n const withoutSlash = newBase.endsWith('/') ? newBase.slice(0, -1) : newBase\n return members.some(member => member.uri === newBase || member.uri === withoutSlash)\n}\n\nfunction getNewInstanceBase (container: NamedNode, name: string): string {\n const normalizedName = normalizeCreationName(name)\n const containerUri = container.uri.endsWith('/') ? container.uri : `${container.uri}/`\n return `${containerUri}${encodeURIComponent(normalizedName)}/`\n}\n\nfunction isExtensionlessSourceFile (pane: PaneDefinition, name: string): boolean {\n if (pane.name?.toLowerCase() !== 'source') return false\n\n const fileName = name.trim().split('/').pop() ?? ''\n const extensionStart = fileName.lastIndexOf('.')\n return extensionStart <= 0 || extensionStart === fileName.length - 1\n}\n\n/**\n * Legacy newThingUI containment rule: apps that create a folder of files are\n * contained as `newBase`; single-file results (source, dokieli) as themselves.\n */\nfunction getContainedResource (\n container: NamedNode,\n newBase: string,\n newInstance: NamedNode,\n sym: (uri: string) => NamedNode\n): NamedNode {\n const containerUri = container.uri.endsWith('/') ? container.uri : `${container.uri}/`\n const tail = newInstance.uri.startsWith(containerUri)\n ? newInstance.uri.slice(containerUri.length)\n : ''\n if (!tail) return sym(newBase)\n const firstSlash = tail.indexOf('/')\n if (firstSlash >= 0 && firstSlash < tail.length - 1) return sym(newBase)\n return sym(newInstance.doc().uri)\n}\n\nfunction getStatusMessage (statusArea: HTMLElement): HTMLElement {\n let message = statusArea.querySelector(':scope > .folder-pane-status-message') as HTMLElement | null\n if (!message) {\n message = statusArea.ownerDocument.createElement('div')\n message.className = 'folder-pane-status-message'\n statusArea.prepend(message)\n }\n return message\n}\n\nfunction setMintStatus (\n statusArea: HTMLElement,\n kind: 'progress' | 'success' | 'error',\n text: string\n): HTMLElement {\n const dom = statusArea.ownerDocument\n const message = getStatusMessage(statusArea)\n statusArea.dataset.status = kind\n message.dataset.status = kind\n message.setAttribute('role', kind === 'error' ? 'alert' : 'status')\n if (kind === 'error') {\n const errorState = dom.createElement('solid-ui-error-state')\n errorState.setAttribute('title', text)\n errorState.addEventListener('close', () => statusArea.replaceChildren())\n message.replaceChildren(errorState)\n return message\n }\n const textElement = dom.createElement('span')\n textElement.className = kind === 'progress'\n ? 'folder-pane-status-text folder-pane-container-loading'\n : 'folder-pane-status-text'\n textElement.textContent = text\n message.replaceChildren(textElement)\n if (kind !== 'progress') {\n const dismiss = dom.createElement('solid-ui-button')\n dismiss.setAttribute('variant', 'ghost')\n dismiss.setAttribute('title', 'Dismiss')\n dismiss.setAttribute('aria-label', 'Dismiss')\n const icon = dom.createElement('icon-lucide-x')\n icon.setAttribute('slot', 'icon')\n dismiss.appendChild(icon)\n dismiss.addEventListener('click', () => statusArea.replaceChildren())\n message.appendChild(dismiss)\n }\n return message\n}\n\n/**\n * Run a pane's mintNew with the pane-registry contract used by the legacy\n * newThingUI and the folder-pane prototype. `newInstance` is deliberately not\n * supplied: panes derive their own documents (e.g. `index.ttl#this`) from\n * `newBase`, and a container URI passed as `newInstance` makes them write to\n * the container itself.\n */\nasync function mintPaneInstance ({\n context,\n container,\n pane,\n name,\n noun,\n statusArea,\n me,\n dom,\n mintTimeoutMs = 90_000,\n allowReplacement = false\n}: MintPaneInstanceOptions): Promise<MintedPaneInstance> {\n if (!pane.mintNew) throw new PaneMintError(`The ${noun} pane cannot create new items.`)\n\n let normalizedName: string\n try {\n normalizedName = normalizeCreationName(name)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n setMintStatus(statusArea, 'error', message)\n throw new PaneMintError(message, error)\n }\n\n statusArea.replaceChildren()\n if (isExtensionlessSourceFile(pane, normalizedName)) {\n const message = 'A new text file needs an extension, such as .txt, .ttl, or .json.'\n setMintStatus(statusArea, 'error', message)\n throw new PaneMintError(message)\n }\n\n setMintStatus(statusArea, 'progress', `Creating ${normalizedName} ${noun}`)\n // Pane-rendered messages and setup UI stay in the status area after minting.\n const paneOutput = statusArea.appendChild(dom.createElement('div'))\n paneOutput.className = 'folder-pane-status-pane-output'\n\n const newBase = getNewInstanceBase(container, normalizedName)\n if (!allowReplacement && hasKnownDestinationConflict(context, container, newBase)) {\n const message = `A resource named \"${normalizedName}\" already exists in this folder. Choose a different name; replacement is not enabled.`\n setMintStatus(statusArea, 'error', message)\n throw new PaneMintError(message)\n }\n const timeoutMessage = `The ${noun} pane did not finish creating the resource within ${mintTimeoutMs}ms. The result is uncertain; refresh the folder before retrying.`\n let timeout: ReturnType<typeof setTimeout> | undefined\n let result: Awaited<ReturnType<NonNullable<PaneDefinition['mintNew']>>> | undefined\n try {\n const mintOptions = {\n folder: container,\n newBase,\n title: normalizedName,\n pane,\n noun,\n div: paneOutput,\n dom,\n me,\n iconEle: dom.createElement('img'),\n noIndexHTML: true\n }\n const mintPromise = pane.mintNew(context, mintOptions)\n result = await Promise.race([\n mintPromise,\n new Promise<never>((_, reject) => {\n timeout = setTimeout(() => reject(new Error(timeoutMessage)), mintTimeoutMs)\n })\n ])\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n setMintStatus(statusArea, 'error', `Unable to create ${noun} \"${name}\": ${reason}`)\n throw new PaneMintError(reason, error)\n } finally {\n if (timeout) clearTimeout(timeout)\n }\n\n if (!result?.newInstance) {\n // Some panes (e.g. issue-pane) report failures into `div` and resolve undefined.\n const paneMessage = paneOutput.textContent?.trim()\n setMintStatus(statusArea, 'error', paneMessage\n ? `Unable to create ${noun} \"${name}\". The ${noun} pane reported:`\n : `Unable to create ${noun} \"${name}\": the pane did not return a new resource.`)\n throw new PaneMintError(paneMessage || 'The pane did not return a new resource')\n }\n\n statusArea.replaceChildren()\n\n const sym = (uri: string) => context.session.store.sym(uri)\n return {\n newBase,\n newInstance: result.newInstance,\n containedResource: getContainedResource(container, newBase, result.newInstance, sym)\n }\n}\n\nexport {\n getContainedResource,\n getNewInstanceBase,\n isExtensionlessSourceFile,\n mintPaneInstance,\n setMintStatus\n}\n"],"mappings":"A,2CAyBA,IAAaE,EAAb,cAAmC,KAAM,CACvC,YAAa,EAAiB,EAA0B,CACtD,MAAMC,CAAO,EADwB,KAAA,MAAAC,EAErC,KAAK,KAAO,eACd,CACF,EAEA,SAASC,EAA6B,EAA6B,EAAsB,EAA0B,CACjH,IAAMC,EAAQC,EAAQ,QAAQ,MAC9B,GAAI,OAAOD,EAAM,MAAS,WAAY,MAAO,GAC7C,IAAME,EAAUF,EAAM,KAAKG,EAAWH,EAAM,IAAI,mCAAmC,CAAC,EAC9EI,EAAeC,EAAQ,SAAS,GAAG,EAAIA,EAAQ,MAAM,EAAG,EAAE,EAAIA,EACpE,OAAOH,EAAQ,KAAK,GAAUI,EAAO,MAAQD,GAAWC,EAAO,MAAQF,CAAY,CACrF,CAEA,SAASG,EAAoB,EAAsB,EAAsB,CACvE,IAAMC,EAAiBd,EAAAA,sBAAsBe,CAAI,EAEjD,MAAO,GADcN,EAAU,IAAI,SAAS,GAAG,EAAIA,EAAU,IAAM,GAAGA,EAAU,IAAI,KAC3D,mBAAmBK,CAAc,EAAE,EAC9D,CAEA,SAASE,EAA2B,EAAsB,EAAuB,CAC/E,GAAIC,EAAK,MAAM,YAAY,IAAM,SAAU,MAAO,GAElD,IAAMC,EAAWH,EAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAK,GAC3CI,EAAiBD,EAAS,YAAY,GAAG,EAC/C,OAAOC,GAAkB,GAAKA,IAAmBD,EAAS,OAAS,CACrE,CAMA,SAASE,EACP,EACA,EACA,EACA,EACW,CACX,IAAMC,EAAeZ,EAAU,IAAI,SAAS,GAAG,EAAIA,EAAU,IAAM,GAAGA,EAAU,IAAI,GAC9Ea,EAAOC,EAAY,IAAI,WAAWF,CAAY,EAChDE,EAAY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ACrD,EAAS,MAAM,QAAQ,KAAK,CAC1BC,EACA,IAAI,SAAgB,EAAG,IAAW,CAChC,EAAU,eAAiBC,EAAW,MAAMN,CAAc,CAAC,EAAGC,CAAa,CAC7E,CAAC,CACH,CAAC,CACH,OAASJ,EAAO,CACd,IAAMU,EAASV,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EAEpE,MADAV,EAAcD,EAAY,QAAS,oBAAoBU,EAAK,IAAItB,EAAK,KAAKiC,GAAQ,EAC5E,IAAI9C,EAAc8C,EAAQV,CAAK,CACvC,QAAU,CACJK,GAAS,aAAaA,CAAO,CACnC,CAEA,GAAI,CAACC,GAAQ,YAAa,CAExB,IAAMK,EAAcV,EAAW,aAAa,KAAK,EAIjD,MAHAX,EAAcD,EAAY,QAASsB,EAC/B,oBAAoBZ,EAAK,IAAItB,EAAK,SAASsB,EAAK,iBAChD,oBAAoBA,EAAK,IAAItB,EAAK,2CAA2C,EAC3E,IAAIb,EAAc+C,GAAe,wCAAwC,CACjF,CAKA,OAHAtB,EAAW,gBAAgB,EAGpB,CACL,UACA,YAAaiB,EAAO,YACpB,kBAAmBxB,EAAqBX,EAAWE,EAASiC,EAAO,YAJxD,GAAgBrC,EAAQ,QAAQ,MAAM,IAAI2C,CAAG,CAI2B,CACrF,CACF,C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NamedNode } from 'rdflib';
|
|
2
|
+
import { DataBrowserContext, PaneDefinition } from 'pane-registry';
|
|
3
|
+
export type MintPaneInstanceOptions = {
|
|
4
|
+
context: DataBrowserContext;
|
|
5
|
+
container: NamedNode;
|
|
6
|
+
pane: PaneDefinition;
|
|
7
|
+
name: string;
|
|
8
|
+
noun: string;
|
|
9
|
+
statusArea: HTMLElement;
|
|
10
|
+
me?: NamedNode;
|
|
11
|
+
dom: HTMLDocument;
|
|
12
|
+
mintTimeoutMs?: number;
|
|
13
|
+
/** Replacement is opt-in; the normal create flow never overwrites a known member. */
|
|
14
|
+
allowReplacement?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type MintedPaneInstance = {
|
|
17
|
+
newBase: string;
|
|
18
|
+
newInstance: NamedNode;
|
|
19
|
+
/** The direct child of `container` that holds the new instance. */
|
|
20
|
+
containedResource: NamedNode;
|
|
21
|
+
};
|
|
22
|
+
export declare class PaneMintError extends Error {
|
|
23
|
+
readonly cause?: unknown | undefined;
|
|
24
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
25
|
+
}
|
|
26
|
+
declare function getNewInstanceBase(container: NamedNode, name: string): string;
|
|
27
|
+
declare function isExtensionlessSourceFile(pane: PaneDefinition, name: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Legacy newThingUI containment rule: apps that create a folder of files are
|
|
30
|
+
* contained as `newBase`; single-file results (source, dokieli) as themselves.
|
|
31
|
+
*/
|
|
32
|
+
declare function getContainedResource(container: NamedNode, newBase: string, newInstance: NamedNode, sym: (uri: string) => NamedNode): NamedNode;
|
|
33
|
+
declare function setMintStatus(statusArea: HTMLElement, kind: 'progress' | 'success' | 'error', text: string): HTMLElement;
|
|
34
|
+
/**
|
|
35
|
+
* Run a pane's mintNew with the pane-registry contract used by the legacy
|
|
36
|
+
* newThingUI and the folder-pane prototype. `newInstance` is deliberately not
|
|
37
|
+
* supplied: panes derive their own documents (e.g. `index.ttl#this`) from
|
|
38
|
+
* `newBase`, and a container URI passed as `newInstance` makes them write to
|
|
39
|
+
* the container itself.
|
|
40
|
+
*/
|
|
41
|
+
declare function mintPaneInstance({ context, container, pane, name, noun, statusArea, me, dom, mintTimeoutMs, allowReplacement }: MintPaneInstanceOptions): Promise<MintedPaneInstance>;
|
|
42
|
+
export { getContainedResource, getNewInstanceBase, isExtensionlessSourceFile, mintPaneInstance, setMintStatus };
|
|
43
|
+
//# sourceMappingURL=mintPaneInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mintPaneInstance.d.ts","sourceRoot":"","sources":["../src/mintPaneInstance.ts"],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,UAAU,GAAG,SAAS,GAAG,OAAO,EACtC,IAAI,EAAE,MAAM,GACX,WAAW,CA+Bb;AAED;;;;;;GAMG;AACH,iBAAe,gBAAgB,CAAE,EAC/B,OAAO,EACP,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,EAAE,EACF,GAAG,EACH,aAAsB,EACtB,gBAAwB,EACzB,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA8EvD;AAED,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACd,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { normalizeCreationName as e } from "./creationSafety.esm.js";
|
|
2
|
+
// src/mintPaneInstance.ts
|
|
3
|
+
var t = class extends Error {
|
|
4
|
+
constructor(e, t) {
|
|
5
|
+
super(e), this.cause = t, this.name = "PaneMintError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
function n(e, t, n) {
|
|
9
|
+
let r = e.session.store;
|
|
10
|
+
if (typeof r.each != "function") return !1;
|
|
11
|
+
let i = r.each(t, r.sym("http://www.w3.org/ns/ldp#contains")), a = n.endsWith("/") ? n.slice(0, -1) : n;
|
|
12
|
+
return i.some((e) => e.uri === n || e.uri === a);
|
|
13
|
+
}
|
|
14
|
+
function r(t, n) {
|
|
15
|
+
let r = e(n);
|
|
16
|
+
return `${t.uri.endsWith("/") ? t.uri : `${t.uri}/`}${encodeURIComponent(r)}/`;
|
|
17
|
+
}
|
|
18
|
+
function i(e, t) {
|
|
19
|
+
if (e.name?.toLowerCase() !== "source") return !1;
|
|
20
|
+
let n = t.trim().split("/").pop() ?? "", r = n.lastIndexOf(".");
|
|
21
|
+
return r <= 0 || r === n.length - 1;
|
|
22
|
+
}
|
|
23
|
+
function a(e, t, n, r) {
|
|
24
|
+
let i = e.uri.endsWith("/") ? e.uri : `${e.uri}/`, a = n.uri.startsWith(i) ? n.uri.slice(i.length) : "";
|
|
25
|
+
if (!a) return r(t);
|
|
26
|
+
let o = a.indexOf("/");
|
|
27
|
+
return o >= 0 && o < a.length - 1 ? r(t) : r(n.doc().uri);
|
|
28
|
+
}
|
|
29
|
+
function o(e) {
|
|
30
|
+
let t = e.querySelector(":scope > .folder-pane-status-message");
|
|
31
|
+
return t || (t = e.ownerDocument.createElement("div"), t.className = "folder-pane-status-message", e.prepend(t)), t;
|
|
32
|
+
}
|
|
33
|
+
function s(e, t, n) {
|
|
34
|
+
let r = e.ownerDocument, i = o(e);
|
|
35
|
+
if (e.dataset.status = t, i.dataset.status = t, i.setAttribute("role", t === "error" ? "alert" : "status"), t === "error") {
|
|
36
|
+
let t = r.createElement("solid-ui-error-state");
|
|
37
|
+
return t.setAttribute("title", n), t.addEventListener("close", () => e.replaceChildren()), i.replaceChildren(t), i;
|
|
38
|
+
}
|
|
39
|
+
let a = r.createElement("span");
|
|
40
|
+
if (a.className = t === "progress" ? "folder-pane-status-text folder-pane-container-loading" : "folder-pane-status-text", a.textContent = n, i.replaceChildren(a), t !== "progress") {
|
|
41
|
+
let t = r.createElement("solid-ui-button");
|
|
42
|
+
t.setAttribute("variant", "ghost"), t.setAttribute("title", "Dismiss"), t.setAttribute("aria-label", "Dismiss");
|
|
43
|
+
let n = r.createElement("icon-lucide-x");
|
|
44
|
+
n.setAttribute("slot", "icon"), t.appendChild(n), t.addEventListener("click", () => e.replaceChildren()), i.appendChild(t);
|
|
45
|
+
}
|
|
46
|
+
return i;
|
|
47
|
+
}
|
|
48
|
+
async function c({ context: o, container: c, pane: l, name: u, noun: d, statusArea: f, me: p, dom: m, mintTimeoutMs: h = 9e4, allowReplacement: g = !1 }) {
|
|
49
|
+
if (!l.mintNew) throw new t(`The ${d} pane cannot create new items.`);
|
|
50
|
+
let _;
|
|
51
|
+
try {
|
|
52
|
+
_ = e(u);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
let n = e instanceof Error ? e.message : String(e);
|
|
55
|
+
throw s(f, "error", n), new t(n, e);
|
|
56
|
+
}
|
|
57
|
+
if (f.replaceChildren(), i(l, _)) {
|
|
58
|
+
let e = "A new text file needs an extension, such as .txt, .ttl, or .json.";
|
|
59
|
+
throw s(f, "error", e), new t(e);
|
|
60
|
+
}
|
|
61
|
+
s(f, "progress", `Creating ${_} ${d}`);
|
|
62
|
+
let v = f.appendChild(m.createElement("div"));
|
|
63
|
+
v.className = "folder-pane-status-pane-output";
|
|
64
|
+
let y = r(c, _);
|
|
65
|
+
if (!g && n(o, c, y)) {
|
|
66
|
+
let e = `A resource named "${_}" already exists in this folder. Choose a different name; replacement is not enabled.`;
|
|
67
|
+
throw s(f, "error", e), new t(e);
|
|
68
|
+
}
|
|
69
|
+
let b = `The ${d} pane did not finish creating the resource within ${h}ms. The result is uncertain; refresh the folder before retrying.`, x, S;
|
|
70
|
+
try {
|
|
71
|
+
let e = {
|
|
72
|
+
folder: c,
|
|
73
|
+
newBase: y,
|
|
74
|
+
title: _,
|
|
75
|
+
pane: l,
|
|
76
|
+
noun: d,
|
|
77
|
+
div: v,
|
|
78
|
+
dom: m,
|
|
79
|
+
me: p,
|
|
80
|
+
iconEle: m.createElement("img"),
|
|
81
|
+
noIndexHTML: !0
|
|
82
|
+
}, t = l.mintNew(o, e);
|
|
83
|
+
S = await Promise.race([t, new Promise((e, t) => {
|
|
84
|
+
x = setTimeout(() => t(Error(b)), h);
|
|
85
|
+
})]);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
let n = e instanceof Error ? e.message : String(e);
|
|
88
|
+
throw s(f, "error", `Unable to create ${d} "${u}": ${n}`), new t(n, e);
|
|
89
|
+
} finally {
|
|
90
|
+
x && clearTimeout(x);
|
|
91
|
+
}
|
|
92
|
+
if (!S?.newInstance) {
|
|
93
|
+
let e = v.textContent?.trim();
|
|
94
|
+
throw s(f, "error", e ? `Unable to create ${d} "${u}". The ${d} pane reported:` : `Unable to create ${d} "${u}": the pane did not return a new resource.`), new t(e || "The pane did not return a new resource");
|
|
95
|
+
}
|
|
96
|
+
return f.replaceChildren(), {
|
|
97
|
+
newBase: y,
|
|
98
|
+
newInstance: S.newInstance,
|
|
99
|
+
containedResource: a(c, y, S.newInstance, (e) => o.session.store.sym(e))
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export { t as PaneMintError, a as getContainedResource, r as getNewInstanceBase, i as isExtensionlessSourceFile, c as mintPaneInstance, s as setMintStatus };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=mintPaneInstance.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mintPaneInstance.esm.js","names":["PaneMintError","message","cause","hasKnownDestinationConflict","store","context","members","container","withoutSlash","newBase","member","getNewInstanceBase","normalizedName","normalizeCreationName","name","isExtensionlessSourceFile","pane","fileName","extensionStart","getContainedResource","containerUri","tail","newInstance","sym","firstSlash","getStatusMessage","statusArea","setMintStatus","dom","kind","errorState","text","textElement","dismiss","icon","mintPaneInstance","noun","error","paneOutput","allowReplacement","timeoutMessage","mintTimeoutMs","timeout","result","mintOptions","mintPromise","reject","reason","paneMessage","uri"],"sources":["../src/mintPaneInstance.ts"],"sourcesContent":["import type { NamedNode } from 'rdflib'\nimport type { DataBrowserContext, PaneDefinition } from 'pane-registry'\nimport { normalizeCreationName } from './creationSafety'\n\nexport type MintPaneInstanceOptions = {\n context: DataBrowserContext\n container: NamedNode\n pane: PaneDefinition\n name: string\n noun: string\n statusArea: HTMLElement\n me?: NamedNode\n dom: HTMLDocument\n mintTimeoutMs?: number\n /** Replacement is opt-in; the normal create flow never overwrites a known member. */\n allowReplacement?: boolean\n}\n\nexport type MintedPaneInstance = {\n newBase: string\n newInstance: NamedNode\n /** The direct child of `container` that holds the new instance. */\n containedResource: NamedNode\n}\n\nexport class PaneMintError extends Error {\n constructor (message: string, readonly cause?: unknown) {\n super(message)\n this.name = 'PaneMintError'\n }\n}\n\nfunction hasKnownDestinationConflict (context: DataBrowserContext, container: NamedNode, newBase: string): boolean {\n const store = context.session.store\n if (typeof store.each !== 'function') return false\n const members = store.each(container, store.sym('http://www.w3.org/ns/ldp#contains')) as NamedNode[]\n const withoutSlash = newBase.endsWith('/') ? newBase.slice(0, -1) : newBase\n return members.some(member => member.uri === newBase || member.uri === withoutSlash)\n}\n\nfunction getNewInstanceBase (container: NamedNode, name: string): string {\n const normalizedName = normalizeCreationName(name)\n const containerUri = container.uri.endsWith('/') ? container.uri : `${container.uri}/`\n return `${containerUri}${encodeURIComponent(normalizedName)}/`\n}\n\nfunction isExtensionlessSourceFile (pane: PaneDefinition, name: string): boolean {\n if (pane.name?.toLowerCase() !== 'source') return false\n\n const fileName = name.trim().split('/').pop() ?? ''\n const extensionStart = fileName.lastIndexOf('.')\n return extensionStart <= 0 || extensionStart === fileName.length - 1\n}\n\n/**\n * Legacy newThingUI containment rule: apps that create a folder of files are\n * contained as `newBase`; single-file results (source, dokieli) as themselves.\n */\nfunction getContainedResource (\n container: NamedNode,\n newBase: string,\n newInstance: NamedNode,\n sym: (uri: string) => NamedNode\n): NamedNode {\n const containerUri = container.uri.endsWith('/') ? container.uri : `${container.uri}/`\n const tail = newInstance.uri.startsWith(containerUri)\n ? newInstance.uri.slice(containerUri.length)\n : ''\n if (!tail) return sym(newBase)\n const firstSlash = tail.indexOf('/')\n if (firstSlash >= 0 && firstSlash < tail.length - 1) return sym(newBase)\n return sym(newInstance.doc().uri)\n}\n\nfunction getStatusMessage (statusArea: HTMLElement): HTMLElement {\n let message = statusArea.querySelector(':scope > .folder-pane-status-message') as HTMLElement | null\n if (!message) {\n message = statusArea.ownerDocument.createElement('div')\n message.className = 'folder-pane-status-message'\n statusArea.prepend(message)\n }\n return message\n}\n\nfunction setMintStatus (\n statusArea: HTMLElement,\n kind: 'progress' | 'success' | 'error',\n text: string\n): HTMLElement {\n const dom = statusArea.ownerDocument\n const message = getStatusMessage(statusArea)\n statusArea.dataset.status = kind\n message.dataset.status = kind\n message.setAttribute('role', kind === 'error' ? 'alert' : 'status')\n if (kind === 'error') {\n const errorState = dom.createElement('solid-ui-error-state')\n errorState.setAttribute('title', text)\n errorState.addEventListener('close', () => statusArea.replaceChildren())\n message.replaceChildren(errorState)\n return message\n }\n const textElement = dom.createElement('span')\n textElement.className = kind === 'progress'\n ? 'folder-pane-status-text folder-pane-container-loading'\n : 'folder-pane-status-text'\n textElement.textContent = text\n message.replaceChildren(textElement)\n if (kind !== 'progress') {\n const dismiss = dom.createElement('solid-ui-button')\n dismiss.setAttribute('variant', 'ghost')\n dismiss.setAttribute('title', 'Dismiss')\n dismiss.setAttribute('aria-label', 'Dismiss')\n const icon = dom.createElement('icon-lucide-x')\n icon.setAttribute('slot', 'icon')\n dismiss.appendChild(icon)\n dismiss.addEventListener('click', () => statusArea.replaceChildren())\n message.appendChild(dismiss)\n }\n return message\n}\n\n/**\n * Run a pane's mintNew with the pane-registry contract used by the legacy\n * newThingUI and the folder-pane prototype. `newInstance` is deliberately not\n * supplied: panes derive their own documents (e.g. `index.ttl#this`) from\n * `newBase`, and a container URI passed as `newInstance` makes them write to\n * the container itself.\n */\nasync function mintPaneInstance ({\n context,\n container,\n pane,\n name,\n noun,\n statusArea,\n me,\n dom,\n mintTimeoutMs = 90_000,\n allowReplacement = false\n}: MintPaneInstanceOptions): Promise<MintedPaneInstance> {\n if (!pane.mintNew) throw new PaneMintError(`The ${noun} pane cannot create new items.`)\n\n let normalizedName: string\n try {\n normalizedName = normalizeCreationName(name)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n setMintStatus(statusArea, 'error', message)\n throw new PaneMintError(message, error)\n }\n\n statusArea.replaceChildren()\n if (isExtensionlessSourceFile(pane, normalizedName)) {\n const message = 'A new text file needs an extension, such as .txt, .ttl, or .json.'\n setMintStatus(statusArea, 'error', message)\n throw new PaneMintError(message)\n }\n\n setMintStatus(statusArea, 'progress', `Creating ${normalizedName} ${noun}`)\n // Pane-rendered messages and setup UI stay in the status area after minting.\n const paneOutput = statusArea.appendChild(dom.createElement('div'))\n paneOutput.className = 'folder-pane-status-pane-output'\n\n const newBase = getNewInstanceBase(container, normalizedName)\n if (!allowReplacement && hasKnownDestinationConflict(context, container, newBase)) {\n const message = `A resource named \"${normalizedName}\" already exists in this folder. Choose a different name; replacement is not enabled.`\n setMintStatus(statusArea, 'error', message)\n throw new PaneMintError(message)\n }\n const timeoutMessage = `The ${noun} pane did not finish creating the resource within ${mintTimeoutMs}ms. The result is uncertain; refresh the folder before retrying.`\n let timeout: ReturnType<typeof setTimeout> | undefined\n let result: Awaited<ReturnType<NonNullable<PaneDefinition['mintNew']>>> | undefined\n try {\n const mintOptions = {\n folder: container,\n newBase,\n title: normalizedName,\n pane,\n noun,\n div: paneOutput,\n dom,\n me,\n iconEle: dom.createElement('img'),\n noIndexHTML: true\n }\n const mintPromise = pane.mintNew(context, mintOptions)\n result = await Promise.race([\n mintPromise,\n new Promise<never>((_, reject) => {\n timeout = setTimeout(() => reject(new Error(timeoutMessage)), mintTimeoutMs)\n })\n ])\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n setMintStatus(statusArea, 'error', `Unable to create ${noun} \"${name}\": ${reason}`)\n throw new PaneMintError(reason, error)\n } finally {\n if (timeout) clearTimeout(timeout)\n }\n\n if (!result?.newInstance) {\n // Some panes (e.g. issue-pane) report failures into `div` and resolve undefined.\n const paneMessage = paneOutput.textContent?.trim()\n setMintStatus(statusArea, 'error', paneMessage\n ? `Unable to create ${noun} \"${name}\". The ${noun} pane reported:`\n : `Unable to create ${noun} \"${name}\": the pane did not return a new resource.`)\n throw new PaneMintError(paneMessage || 'The pane did not return a new resource')\n }\n\n statusArea.replaceChildren()\n\n const sym = (uri: string) => context.session.store.sym(uri)\n return {\n newBase,\n newInstance: result.newInstance,\n containedResource: getContainedResource(container, newBase, result.newInstance, sym)\n }\n}\n\nexport {\n getContainedResource,\n getNewInstanceBase,\n isExtensionlessSourceFile,\n mintPaneInstance,\n setMintStatus\n}\n"],"mappings":";;AAyBA,IAAaA,IAAb,cAAmC,MAAM;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,IAAMU,IAASV,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK;EAEpE,MADAV,EAAcD,GAAY,SAAS,oBAAoBU,EAAK,IAAItB,EAAK,KAAKiC,GAAQ,GAC5E,IAAI/C,EAAc+C,GAAQV,CAAK;CACvC,UAAU;EACR,AAAIK,KAAS,aAAaA,CAAO;CACnC;CAEA,IAAI,CAACC,GAAQ,aAAa;EAExB,IAAMK,IAAcV,EAAW,aAAa,KAAK;EAIjD,MAHAX,EAAcD,GAAY,SAASsB,IAC/B,oBAAoBZ,EAAK,IAAItB,EAAK,SAASsB,EAAK,mBAChD,oBAAoBA,EAAK,IAAItB,EAAK,2CAA2C,GAC3E,IAAId,EAAcgD,KAAe,wCAAwC;CACjF;CAKA,OAHAtB,EAAW,gBAAgB,GAGpB;EACL;EACA,aAAaiB,EAAO;EACpB,mBAAmBxB,EAAqBZ,GAAWE,GAASkC,EAAO,cAJxD,MAAgBtC,EAAQ,QAAQ,MAAM,IAAI4C,CAAG,CAI2B;CACrF;AACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,SAAS,CAAA;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "folder-pane",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1-0",
|
|
4
4
|
"description": "Solid-compatible Panes: File browser",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"sideEffects": [
|
|
15
|
-
"**/*.css"
|
|
15
|
+
"**/*.css",
|
|
16
|
+
"src/components/**/*.ts"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"clean": "rm -rf dist",
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
"lint": "eslint",
|
|
22
23
|
"lint-fix": "eslint --fix",
|
|
23
24
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"test": "
|
|
25
|
+
"test": "vitest run",
|
|
25
26
|
"ignore:prepublishOnly": "npm run build && npm run lint",
|
|
26
27
|
"preversion": "npm run typecheck && npm run lint",
|
|
27
28
|
"ignore:postpublish": "git push origin staging",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@eslint/eslintrc": "^3.3.3",
|
|
60
61
|
"@eslint/js": "^10.0.1",
|
|
62
|
+
"@iconify-json/lucide": "^1.2.116",
|
|
61
63
|
"@types/node": "^24.13.3",
|
|
62
64
|
"@typescript-eslint/parser": "^8.53.1",
|
|
63
65
|
"@vitest/coverage-v8": "^4.0.18",
|
|
@@ -67,9 +69,10 @@
|
|
|
67
69
|
"typescript": "^5.9.3"
|
|
68
70
|
},
|
|
69
71
|
"dependencies": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"solid-
|
|
72
|
+
"lit": "^3.3.3",
|
|
73
|
+
"rdflib": "2.4.1",
|
|
74
|
+
"solid-logic": "6.0.1-4",
|
|
75
|
+
"solid-ui": "5.0.2-3",
|
|
73
76
|
"vite": "^8.0.16",
|
|
74
77
|
"vitest": "^4.0.18",
|
|
75
78
|
"vitest-axe": "^0.1.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));exports.__toESM=s;
|