folder-pane 4.0.1-2 → 4.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.
Files changed (65) hide show
  1. package/README.md +4 -0
  2. package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js +14 -5
  3. package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js.map +1 -1
  4. package/dist/components/folder-pane-container/FolderPaneContainer.d.ts +11 -1
  5. package/dist/components/folder-pane-container/FolderPaneContainer.d.ts.map +1 -1
  6. package/dist/components/folder-pane-container/FolderPaneContainer.esm.js +174 -121
  7. package/dist/components/folder-pane-container/FolderPaneContainer.esm.js.map +1 -1
  8. package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js +1 -1
  9. package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js.map +1 -1
  10. package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js +1 -1
  11. package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js.map +1 -1
  12. package/dist/components/folder-pane-content/FolderPaneContent.cjs.js.map +1 -1
  13. package/dist/components/folder-pane-content/FolderPaneContent.esm.js.map +1 -1
  14. package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js.map +1 -1
  15. package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js.map +1 -1
  16. package/dist/components/folder-pane-provider/FolderPaneProvider.cjs.js.map +1 -1
  17. package/dist/components/folder-pane-provider/FolderPaneProvider.esm.js.map +1 -1
  18. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.cjs.js.map +1 -1
  19. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.esm.js.map +1 -1
  20. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js +8 -7
  21. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js.map +1 -1
  22. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts +2 -0
  23. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts.map +1 -1
  24. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js +84 -77
  25. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js.map +1 -1
  26. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js +1 -1
  27. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js.map +1 -1
  28. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js +1 -1
  29. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js.map +1 -1
  30. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.cjs.js.map +1 -1
  31. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.esm.js.map +1 -1
  32. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.cjs.js.map +1 -1
  33. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.esm.js.map +1 -1
  34. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js +5 -5
  35. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js.map +1 -1
  36. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts +1 -0
  37. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts.map +1 -1
  38. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js +16 -10
  39. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js.map +1 -1
  40. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js +1 -1
  41. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js.map +1 -1
  42. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js +1 -1
  43. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js.map +1 -1
  44. package/dist/components/folder-pane-view/FolderPaneView.cjs.js +2 -2
  45. package/dist/components/folder-pane-view/FolderPaneView.cjs.js.map +1 -1
  46. package/dist/components/folder-pane-view/FolderPaneView.d.ts +6 -0
  47. package/dist/components/folder-pane-view/FolderPaneView.d.ts.map +1 -1
  48. package/dist/components/folder-pane-view/FolderPaneView.esm.js +164 -118
  49. package/dist/components/folder-pane-view/FolderPaneView.esm.js.map +1 -1
  50. package/dist/folderPane.cjs.js +2 -2
  51. package/dist/folderPane.cjs.js.map +1 -1
  52. package/dist/folderPane.d.ts.map +1 -1
  53. package/dist/folderPane.esm.js +17 -15
  54. package/dist/folderPane.esm.js.map +1 -1
  55. package/dist/helpers.cjs.js.map +1 -1
  56. package/dist/helpers.d.ts +1 -1
  57. package/dist/helpers.d.ts.map +1 -1
  58. package/dist/helpers.esm.js.map +1 -1
  59. package/dist/resourceActionItems.cjs.js +1 -1
  60. package/dist/resourceActionItems.cjs.js.map +1 -1
  61. package/dist/resourceActionItems.d.ts +4 -5
  62. package/dist/resourceActionItems.d.ts.map +1 -1
  63. package/dist/resourceActionItems.esm.js +14 -14
  64. package/dist/resourceActionItems.esm.js.map +1 -1
  65. package/package.json +4 -4
@@ -1,20 +1,20 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.folder-pane{box-sizing:border-box;text-align:left;flex-direction:column;align-self:stretch;width:100%;max-width:none;height:100%;min-height:0;margin-left:0;margin-right:0;display:flex;overflow:hidden}.folder-pane-package-div{text-align:left;width:100%;max-width:none;margin-left:0;margin-right:0;display:block;overflow-x:auto}.folder-pane--storage folder-pane-storage-header{--folder-pane-storage-toolbar-right-padding:8px;--folder-pane-storage-header-mobile-gap:0;--folder-pane-storage-header-mobile-padding:0 0 10px}folder-pane-view{flex-direction:column;flex:auto;width:100%;height:100%;min-height:0;display:flex}.folder-pane-main-content{box-sizing:border-box;border:1px solid var(--solid-ui-color-gray-200,#cbd5e1);background:var(--solid-ui-color-white,#fff);border-radius:5px;flex-direction:row;flex:auto;width:100%;min-width:0;height:80vh;min-height:32rem;display:flex;overflow:hidden}.folder-pane-view-controls{flex:none;justify-content:flex-end;align-items:center;gap:5.6px;padding:10px 0;display:flex}.folder-pane-view-controls button{width:var(--solid-ui-clickable-area,42px);height:var(--solid-ui-clickable-area,42px);color:var(--solid-ui-color-gray-500,#6a7282);cursor:pointer;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;padding:0;display:inline-flex}.folder-pane-view-controls button[aria-pressed=true],.folder-pane-view-controls button:hover{background:var(--solid-ui-color-primary-selected,#cbb9ff);color:var(--solid-ui-color-primary,#7c4dff)}.folder-pane-view-controls button:focus-visible{outline:2px solid var(--solid-ui-color-primary,#7c4dff);outline-offset:-2px}.folder-pane-view-controls icon-lucide-layout-grid,.folder-pane-view-controls icon-lucide-list{width:16px;height:16px}folder-pane-sidebar{flex-direction:column;flex:0 0 var(--folder-pane-sidebar-width,256px);width:var(--folder-pane-sidebar-width,256px);box-sizing:border-box;border-right:1px solid var(--solid-ui-color-gray-200,#cbd5e1);min-width:0;max-width:100%;min-height:0;display:flex;overflow:hidden}.folder-pane-sidebar-resizer{background:0 0;flex:0 0 4px;width:4px;position:relative}.folder-pane-sidebar-resize-handle{cursor:col-resize;touch-action:none;position:absolute;inset:0}.folder-pane-sidebar-resize-handle:focus-visible{outline:1px solid var(--solid-ui-color-lavender-300,#e6dcff);outline-offset:0}.folder-pane-sidebar-resizer[data-resizing=true]{background:var(--solid-ui-color-lavender-300,#e6dcff)}.folder-pane-main-content:has(.folder-pane-sidebar-resizer[data-resizing=true]){-webkit-user-select:none;user-select:none}.folder-pane-sidebar-toggle{box-sizing:border-box;color:var(--solid-ui-color-gray-900,#101828);background:var(--solid-ui-color-zinc-300,#d4d4d8);z-index:1;border:0;border-radius:20px;justify-content:center;align-items:center;width:25px;min-width:25px;height:25px;min-height:25px;padding:0;display:flex;position:absolute;top:75%;left:calc(50% - 2px);transform:translate(-50%,-50%)}.folder-pane-sidebar-toggle:hover{background:var(--solid-ui-color-primary-hover)}.folder-pane-sidebar-toggle:focus-visible{outline:1px solid var(--solid-ui-color-lavender-300,#e6dcff);outline-offset:1px}.folder-pane-sidebar-toggle-icon{flex:none;width:12.308px;height:12.308px;display:block;position:relative;top:-1px}.folder-pane-sidebar-toggle-icon-collapsed{transform:rotate(90deg)scaleX(-1)}.folder-pane-main-content[data-sidebar-collapsed=true]>folder-pane-sidebar{border-right:0;flex-basis:0;width:0;min-width:0;overflow:hidden}.folder-pane-main-content[data-sidebar-collapsed=true]>.folder-pane-sidebar-resizer{flex-basis:4px}.folder-pane-main-content[data-sidebar-collapsed=true]>.folder-pane-sidebar-resizer>.folder-pane-sidebar-toggle{left:calc(50% + 12.5px)}.folder-pane-content-column{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex;position:relative}@media (prefers-reduced-motion:reduce){.folder-pane-main-content,folder-pane-sidebar,.folder-pane-sidebar-toggle-icon,.resource-expand-button icon-lucide-chevron-right{transition:none}}.folder-pane-content-column>folder-pane-content{box-sizing:border-box;padding:16px}.folder-pane-content-column>folder-pane-content:has(>solid-ui-file-explorer-provider){padding:0}.folder-pane-full-view{flex-direction:column;flex:auto;width:100%;height:100%;min-height:0;display:flex;overflow:auto}.folder-pane-access-denied-message{box-sizing:border-box;text-align:center;flex:auto;justify-content:center;align-items:center;width:100%;min-width:0;max-width:100%;height:100%;min-height:0;padding:32px;display:flex;overflow:hidden}.folder-pane-access-denied-message-body{box-sizing:border-box;overflow-wrap:anywhere;width:100%;min-width:0;max-width:384px}.folder-pane-resource-error{box-sizing:border-box;background:0 0;border:0;flex:auto;justify-content:center;align-items:center;width:100%;min-width:0;min-height:0;padding:16px;display:flex}.folder-pane-resource-error>solid-ui-error-state{width:min(100%,640px);display:block}solid-ui-file-explorer-provider{flex-direction:column;gap:0;width:100%;min-width:0;height:100%;min-height:0;display:flex;overflow:hidden}solid-ui-file-explorer-provider>solid-ui-file-explorer-header{z-index:2;background:var(--solid-ui-color-white,#fff);width:100%;display:block;position:sticky;top:0}solid-ui-file-explorer-provider>.paneDiv,solid-ui-file-explorer-provider>.exceptionPane{box-sizing:border-box;flex:auto;width:100%;min-width:0;max-width:100%;min-height:0;margin:0;display:block;overflow:hidden auto}.folder-pane-predicate-cell{width:0;min-width:0;max-width:0;overflow:hidden;border:0!important;margin:0!important;padding:0!important}.folder-pane-status{border-top:1px solid var(--color-border,#ddd);text-align:left;flex-direction:column;flex:none;gap:8px;padding:8px 12px;display:flex}.folder-pane-status[data-status=progress]{accent-color:auto;text-align:center;outline:0;flex:none;justify-content:center;align-items:center;box-shadow:none!important;background:0 0!important;border:0!important}.folder-pane-status:empty{display:none}.folder-pane-status-message{align-items:center;gap:12px;padding-right:40px;display:flex;position:relative}.folder-pane-status-message>solid-ui-button{position:absolute;top:-6px;right:-4px}.folder-pane-status-message[data-status=error]{color:var(--color-error,#b00020)}.folder-pane-status-text{flex:auto}.folder-pane-status[data-status=progress] .folder-pane-status-message{width:100%;min-height:8rem;color:var(--solid-ui-color-gray-500,#6a7282);font-size:var(--solid-ui-font-size-sm,.875rem);outline:0;flex:auto;justify-content:center;align-items:center;box-shadow:none!important;background:0 0!important;border:0!important}.folder-pane-status[data-status=progress] .folder-pane-status-text{flex:0 auto}.folder-pane-drop-target{width:var(--icon-base,2em);min-width:var(--icon-base,2em);max-width:var(--icon-base,2em);height:var(--icon-base,2em);min-height:var(--icon-base,2em);max-height:var(--icon-base,2em);box-sizing:content-box;flex:0 0 var(--icon-base,2em);display:inline-block;margin:0!important;padding:0!important}.folder-pane-explicit-drop-icon{width:var(--icon-base,2em);height:var(--icon-base,2em)}@media (width<=768px){.folder-pane{height:auto;margin-top:var(--spacing-2xs,.25em);margin-bottom:var(--spacing-2xs,.25em);overflow:visible}folder-pane-view{height:auto}.folder-pane-main-content,.folder-pane-full-view{flex:none;height:auto;min-height:0;overflow:visible}.folder-pane-main-content{border:0}.folder-pane-content-column{min-height:0;overflow:visible}solid-ui-file-explorer-provider,solid-ui-file-explorer-provider>.paneDiv,solid-ui-file-explorer-provider>.exceptionPane{height:auto;min-height:0;overflow:visible}.folder-pane-explicit-drop-icon{width:var(--icon-sm,1.5em);height:var(--icon-sm,1.5em)}}
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.folder-pane{box-sizing:border-box;text-align:left;flex-direction:column;align-self:stretch;width:100%;max-width:none;height:100%;min-height:0;margin-left:0;margin-right:0;display:flex;overflow:hidden}.folder-pane-package-div{text-align:left;width:100%;max-width:none;margin-left:0;margin-right:0;display:block;overflow-x:auto}.folder-pane--storage folder-pane-storage-header{--folder-pane-storage-toolbar-right-padding:8px;--folder-pane-storage-header-mobile-gap:0;--folder-pane-storage-header-mobile-padding:0 0 10px}folder-pane-view{flex-direction:column;flex:auto;width:100%;height:100%;min-height:0;display:flex}.folder-pane-main-content{box-sizing:border-box;border:1px solid var(--solid-ui-color-gray-200,#cbd5e1);background:var(--solid-ui-color-white,#fff);border-radius:5px;flex-direction:row;flex:auto;width:100%;min-width:0;height:80vh;min-height:32rem;display:flex;overflow:hidden}.folder-pane-view-controls{flex:none;justify-content:flex-end;align-items:center;gap:5.6px;padding:10px 0;display:flex}.folder-pane-view-controls button{width:var(--solid-ui-clickable-area,42px);height:var(--solid-ui-clickable-area,42px);color:var(--solid-ui-color-gray-500,#6a7282);cursor:pointer;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;padding:0;display:inline-flex}.folder-pane-view-controls button[aria-pressed=true],.folder-pane-view-controls button:hover{background:var(--solid-ui-color-primary-selected,#cbb9ff);color:var(--solid-ui-color-primary,#7c4dff)}.folder-pane-view-controls button:focus-visible{outline:2px solid var(--solid-ui-color-primary,#7c4dff);outline-offset:-2px}.folder-pane-view-controls icon-lucide-layout-grid,.folder-pane-view-controls icon-lucide-list{width:16px;height:16px}folder-pane-sidebar{flex-direction:column;flex:0 0 var(--folder-pane-sidebar-width,256px);width:var(--folder-pane-sidebar-width,256px);box-sizing:border-box;border-right:1px solid var(--solid-ui-color-gray-200,#cbd5e1);min-width:0;max-width:100%;min-height:0;display:flex;overflow:hidden}.folder-pane-sidebar-resizer{background:0 0;flex:0 0 4px;width:4px;position:relative}.folder-pane-sidebar-resize-handle{cursor:col-resize;touch-action:none;position:absolute;inset:0}.folder-pane-sidebar-resize-handle:focus-visible{outline:1px solid var(--solid-ui-color-lavender-300,#e6dcff);outline-offset:0}.folder-pane-sidebar-resizer[data-resizing=true]{background:var(--solid-ui-color-lavender-300,#e6dcff)}.folder-pane-main-content:has(.folder-pane-sidebar-resizer[data-resizing=true]){-webkit-user-select:none;user-select:none}.folder-pane-sidebar-toggle{box-sizing:border-box;color:var(--solid-ui-color-gray-900,#101828);background:var(--solid-ui-color-zinc-300,#d4d4d8);z-index:1;border:0;border-radius:20px;justify-content:center;align-items:center;width:25px;min-width:25px;height:25px;min-height:25px;padding:0;display:flex;position:absolute;top:75%;left:calc(50% - 2px);transform:translate(-50%,-50%)}.folder-pane-sidebar-toggle:hover{background:var(--solid-ui-color-primary-hover)}.folder-pane-sidebar-toggle:focus-visible{outline:1px solid var(--solid-ui-color-lavender-300,#e6dcff);outline-offset:1px}.folder-pane-sidebar-toggle-icon{flex:none;width:12.308px;height:12.308px;display:block;position:relative;top:-1px}.folder-pane-sidebar-toggle-icon-collapsed{transform:rotate(90deg)scaleX(-1)}.folder-pane-main-content[data-sidebar-collapsed=true]>folder-pane-sidebar{border-right:0;flex-basis:0;width:0;min-width:0;overflow:hidden}.folder-pane-main-content[data-sidebar-collapsed=true]>.folder-pane-sidebar-resizer{flex-basis:4px}.folder-pane-main-content[data-sidebar-collapsed=true]>.folder-pane-sidebar-resizer>.folder-pane-sidebar-toggle{left:calc(50% + 12.5px)}.folder-pane-content-column{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex;position:relative}@media (prefers-reduced-motion:reduce){.folder-pane-main-content,folder-pane-sidebar,.folder-pane-sidebar-toggle-icon,.resource-expand-button icon-lucide-chevron-right{transition:none}}.folder-pane-content-column>folder-pane-content{box-sizing:border-box;padding:16px}.folder-pane-content-column>folder-pane-content:has(>solid-ui-file-explorer-provider){padding:0}.folder-pane-full-view{flex-direction:column;flex:auto;width:100%;height:100%;min-height:0;display:flex;overflow:auto}.folder-pane-access-denied-message{box-sizing:border-box;text-align:center;flex:auto;justify-content:center;align-items:center;width:100%;min-width:0;max-width:100%;height:100%;min-height:0;padding:32px;display:flex;overflow:hidden}.folder-pane-access-denied-message-body{box-sizing:border-box;overflow-wrap:anywhere;width:100%;min-width:0;max-width:384px}.folder-pane-resource-error{box-sizing:border-box;background:0 0;border:0;flex:auto;justify-content:center;align-items:center;width:100%;min-width:0;min-height:0;padding:16px;display:flex}.folder-pane-resource-error>solid-ui-error-state{width:min(100%,640px);display:block}solid-ui-file-explorer-provider{flex-direction:column;gap:0;width:100%;min-width:0;height:100%;min-height:0;display:flex;overflow:hidden}solid-ui-file-explorer-provider>solid-ui-file-explorer-header{z-index:2;background:var(--solid-ui-color-white,#fff);width:100%;display:block;position:sticky;top:0}solid-ui-file-explorer-provider>.paneDiv,solid-ui-file-explorer-provider>.exceptionPane{box-sizing:border-box;flex:auto;width:100%;min-width:0;max-width:100%;min-height:0;margin:0;display:block;overflow:hidden auto}.folder-pane-predicate-cell{width:0;min-width:0;max-width:0;overflow:hidden;border:0!important;margin:0!important;padding:0!important}.folder-pane-status{border-top:1px solid var(--color-border,#ddd);text-align:left;flex-direction:column;flex:none;gap:8px;padding:8px 12px;display:flex}.folder-pane-status[data-status=progress]{accent-color:auto;text-align:center;outline:0;flex:none;justify-content:center;align-items:center;box-shadow:none!important;background:0 0!important;border:0!important}.folder-pane-status:empty{display:none}.folder-pane-status-message{align-items:center;gap:12px;padding-right:40px;display:flex;position:relative}.folder-pane-status-message>solid-ui-button{position:absolute;top:-6px;right:-4px}.folder-pane-status-message[data-status=error]{color:var(--color-error,#b00020)}.folder-pane-status-text{flex:auto}.folder-pane-status[data-status=progress] .folder-pane-status-message{width:100%;min-height:8rem;color:var(--solid-ui-color-gray-500,#6a7282);font-size:var(--solid-ui-font-size-sm,.875rem);outline:0;flex:auto;justify-content:center;align-items:center;box-shadow:none!important;background:0 0!important;border:0!important}.folder-pane-status[data-status=progress] .folder-pane-status-text{flex:0 auto}.folder-pane-drop-target{width:var(--icon-base,2em);min-width:var(--icon-base,2em);max-width:var(--icon-base,2em);height:var(--icon-base,2em);min-height:var(--icon-base,2em);max-height:var(--icon-base,2em);box-sizing:content-box;flex:0 0 var(--icon-base,2em);display:inline-block;margin:0!important;padding:0!important}.folder-pane-explicit-drop-icon{width:var(--icon-base,2em);height:var(--icon-base,2em)}@media (width<=768px){.folder-pane{height:auto;margin-top:var(--spacing-2xs,.25em);margin-bottom:var(--spacing-2xs,.25em);overflow:visible}folder-pane-view{height:auto}.folder-pane-main-content,.folder-pane-full-view{flex:none;height:auto;min-height:0;overflow:visible}.folder-pane-main-content{border:0}folder-pane-sidebar,.folder-pane-sidebar-resizer{display:none}.folder-pane-content-column{width:100%;min-height:0;overflow:visible}solid-ui-file-explorer-provider,solid-ui-file-explorer-provider>.paneDiv,solid-ui-file-explorer-provider>.exceptionPane{height:auto;min-height:0;overflow:visible}.folder-pane-explicit-drop-icon{width:var(--icon-sm,1.5em);height:var(--icon-sm,1.5em)}}
2
2
  :root{--icon-base:2em}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();import "./components/folder-pane-view/index.esm.js";
3
3
  import "./components/folder-pane-provider/index.esm.js";
4
4
  import { isJavaScriptFile as e, isJsonFile as t } from "./helpers.esm.js";
5
5
 
6
6
 
7
- import { icons as n, ns as r } from "solid-ui";
7
+ import { icons as n } from "solid-ui";
8
8
  // src/folderPane.ts
9
- var i = [
9
+ var r = [
10
10
  "explorer",
11
11
  "storage",
12
12
  "container"
13
13
  ];
14
- function a(e) {
15
- return e.folderView && i.includes(e.folderView) ? e.folderView : e.fullView === !0 || e.solo === !0 ? "container" : "explorer";
14
+ function i(e) {
15
+ return e.folderView && r.includes(e.folderView) ? e.folderView : e.fullView === !0 || e.solo === !0 ? "container" : "explorer";
16
16
  }
17
- var o = {
17
+ var a = {
18
18
  icon: n.iconBase + "noun_973694_expanded.svg",
19
19
  name: "folder",
20
20
  mintNew: function(e, t) {
@@ -25,20 +25,22 @@ var o = {
25
25
  return t;
26
26
  });
27
27
  },
28
- label: function(n, i) {
28
+ label: function(n, r) {
29
29
  if (e(n) || t(n)) return null;
30
- let a = i.session.store, o = a.each(n, r.ldp("contains")).length;
31
- return o > 0 ? "Contents (" + o + ")" : a.holds(n, r.rdf("type"), r.ldp("Container")) ? "Container (0)" : null;
30
+ let i = r.session.logic.resource;
31
+ if (!i.isContainer(n)) return null;
32
+ let a = i.getContainerMemberCount(n);
33
+ return a > 0 ? "Contents (" + a + ")" : "Contents (0)";
32
34
  },
33
35
  render: function(e, t, n) {
34
- let r = t.dom, i = r.createElement("div");
35
- i.classList.add("instancePane", "folder-pane");
36
- let o = i.appendChild(r.createElement("folder-pane-view")), s = n && typeof n == "object" ? n : {};
36
+ let r = t.dom, a = r.createElement("div");
37
+ a.classList.add("instancePane", "folder-pane");
38
+ let o = a.appendChild(r.createElement("folder-pane-view")), s = n && typeof n == "object" ? n : {};
37
39
  o.browserContext = t, o.subject = e;
38
- let c = a(s);
39
- return i.classList.add(`folder-pane--${c}`), o.fullView = c === "container", i;
40
+ let c = i(s);
41
+ return a.classList.add(`folder-pane--${c}`), o.fullView = c === "container", a;
40
42
  }
41
43
  };
42
- export { o as default, a as folderViewFor };
44
+ export { a as default, i as folderViewFor };
43
45
 
44
46
  //# sourceMappingURL=folderPane.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"folderPane.esm.js","names":["FOLDER_VIEWS","folderViewFor","options","folderPane_default","icons","kb","context","u","newPaneOptions","normalizedInstance","isJavaScriptFile","subject","isJsonFile","n","ns","dom","div","folderPaneView","renderOptions","paneOptions","folderView"],"sources":["../src/folderPane.ts"],"sourcesContent":["/* Folder pane\n **\n ** This outline pane lists the members of a folder\n */\n\nimport './components/folder-pane-view'\nimport './components/folder-pane-provider'\nimport type FolderPaneView from './components/folder-pane-view/FolderPaneView'\nimport { icons, ns } from 'solid-ui'\nimport { isJavaScriptFile, isJsonFile } from './helpers'\nimport './styles/folderPane.css'\nimport './styles/utilities.css'\n\nexport { getCreationNoun, getCreationPanes, getPaneLabel } from './helpers'\n\n/**\n * How a folder is presented:\n * - `explorer`: storage header, sidebar and content (the viewer's own storage, the server root)\n * - `storage`: storage header, sidebar and content under the navbar of someone else's pod\n * - `container`: storage header and container contents, without a sidebar (a container URL opened on its own)\n */\nexport type FolderView = 'explorer' | 'storage' | 'container'\n\ntype FolderPaneRenderOptions = {\n folderView?: FolderView\n fullView?: boolean\n solo?: boolean\n}\n\nconst FOLDER_VIEWS: FolderView[] = ['explorer', 'storage', 'container']\n\nexport function folderViewFor (options: FolderPaneRenderOptions): FolderView {\n if (options.folderView && FOLDER_VIEWS.includes(options.folderView)) return options.folderView\n return options.fullView === true || options.solo === true ? 'container' : 'explorer'\n}\n\nexport default {\n icon: icons.iconBase + 'noun_973694_expanded.svg',\n name: 'folder',\n\n // Create a new folder in a Solid system,\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n const newInstance =\n newPaneOptions.newInstance || kb.sym(newPaneOptions.newBase)\n let u = newInstance.uri\n if (u.endsWith('/')) {\n u = u.slice(0, -1) // chop off trailer\n } // { throw new Error('URI of new folder must end in \"/\" :' + u) }\n const normalizedInstance = kb.sym(u + '/')\n newPaneOptions.newInstance = normalizedInstance\n\n return kb.fetcher\n .webOperation('PUT', normalizedInstance.uri)\n .then(function () {\n return newPaneOptions\n })\n },\n\n label: function (subject, context) {\n if (isJavaScriptFile(subject) || isJsonFile(subject)) return null\n const kb = context.session.store\n const n = kb.each(subject, ns.ldp('contains')).length\n if (n > 0) {\n return 'Contents (' + n + ')' // Show how many in hover text\n }\n if (kb.holds(subject, ns.rdf('type'), ns.ldp('Container'))) {\n // It is declared as being a container\n return 'Container (0)'\n }\n return null // Suppress pane otherwise\n },\n\n // Render a file folder in a LDP/solid system\n render: function (subject, context, paneOptions?: unknown) {\n\n const dom = context.dom\n const div = dom.createElement('div')\n div.classList.add('instancePane', 'folder-pane')\n const folderPaneView = div.appendChild(dom.createElement('folder-pane-view')) as FolderPaneView\n const renderOptions = paneOptions && typeof paneOptions === 'object'\n ? paneOptions as FolderPaneRenderOptions\n : {}\n folderPaneView.browserContext = context\n folderPaneView.subject = subject\n const folderView = folderViewFor(renderOptions)\n div.classList.add(`folder-pane--${folderView}`)\n folderPaneView.fullView = folderView === 'container'\n\n // The pane registry is needed to open the internal pane on Alt-click.\n // addDownstreamChangeListener is a high level function which when someone else changes the resource,\n // reloads it into the kb, then must call addDownstreamChangeListener to be able to update the folder pane.\n // SAM need to figure out how to add this line later kb.updater.addDownstreamChangeListener(subject, refresh) // Update store and call me if folder changes\n\n return div\n }\n}\n// ends\n"],"mappings":";;;;;;;AA6BA,IAAMA,IAA6B;CAAC;CAAY;CAAW;AAAW;AAEtE,SAAgBC,EAAe,GAA8C;CAE3E,OADIC,EAAQ,cAAcF,EAAa,SAASE,EAAQ,UAAU,IAAUA,EAAQ,aAC7EA,EAAQ,aAAa,MAAQA,EAAQ,SAAS,KAAO,cAAc;AAC5E;AAEA,IAAAC,IAAe;CACb,MAAMC,EAAM,WAAW;CACvB,MAAM;CAGN,SAAS,SAAU,GAAS,GAAgB;EAC1C,IAAMC,IAAKC,EAAQ,QAAQ,OAGvBC,KADFC,EAAe,eAAeH,EAAG,IAAIG,EAAe,OAAO,EAAA,CACzC;EACpB,AAAID,EAAE,SAAS,GAAG,MAChB,IAAIA,EAAE,MAAM,GAAG,EAAE;EAEnB,IAAME,IAAqBJ,EAAG,IAAIE,IAAI,GAAG;EAGzC,OAFA,EAAe,cAAcE,GAEtBJ,EAAG,QACP,aAAa,OAAOI,EAAmB,GAAG,CAAC,CAC3C,KAAK,WAAY;GAChB,OAAOD;EACT,CAAC;CACL;CAEA,OAAO,SAAU,GAAS,GAAS;EACjC,IAAIE,EAAiBC,CAAO,KAAKC,EAAWD,CAAO,GAAG,OAAO;EAC7D,IAAMN,IAAKC,EAAQ,QAAQ,OACrBO,IAAIR,EAAG,KAAKM,GAASG,EAAG,IAAI,UAAU,CAAC,CAAC,CAAC;EAQ/C,OAPID,IAAI,IACC,eAAeA,IAAI,MAExBR,EAAG,MAAMM,GAASG,EAAG,IAAI,MAAM,GAAGA,EAAG,IAAI,WAAW,CAAC,IAEhD,kBAEF;CACT;CAGA,QAAQ,SAAU,GAAS,GAAS,GAAuB;EAEzD,IAAMC,IAAMT,EAAQ,KACdU,IAAMD,EAAI,cAAc,KAAK;EACnC,EAAI,UAAU,IAAI,gBAAgB,aAAa;EAC/C,IAAME,IAAiBD,EAAI,YAAYD,EAAI,cAAc,kBAAkB,CAAC,GACtEG,IAAgBC,KAAe,OAAOA,KAAgB,WACxDA,IACA,CAAC;EAEL,AADA,EAAe,iBAAiBb,GAChC,EAAe,UAAUK;EACzB,IAAMS,IAAanB,EAAciB,CAAa;EAS9C,OARAF,EAAI,UAAU,IAAI,gBAAgBI,GAAY,GAC9C,EAAe,WAAWA,MAAe,aAOlCJ;CACT;AACF"}
1
+ {"version":3,"file":"folderPane.esm.js","names":["FOLDER_VIEWS","folderViewFor","options","folderPane_default","icons","kb","context","u","newPaneOptions","normalizedInstance","isJavaScriptFile","subject","isJsonFile","resourceLogic","n","dom","div","folderPaneView","renderOptions","paneOptions","folderView"],"sources":["../src/folderPane.ts"],"sourcesContent":["/* Folder pane\n **\n ** This outline pane lists the members of a folder\n */\n\nimport './components/folder-pane-view'\nimport './components/folder-pane-provider'\nimport type FolderPaneView from './components/folder-pane-view/FolderPaneView'\nimport { icons } from 'solid-ui'\nimport { isJavaScriptFile, isJsonFile } from './helpers'\nimport './styles/folderPane.css'\nimport './styles/utilities.css'\n\nexport { getCreationNoun, getCreationPanes, getPaneLabel } from './helpers'\n\n/**\n * How a folder is presented:\n * - `explorer`: storage header, sidebar and content (the viewer's own storage, the server root)\n * - `storage`: storage header, sidebar and content under the navbar of someone else's pod\n * - `container`: storage header and container contents, without a sidebar (a container URL opened on its own)\n */\nexport type FolderView = 'explorer' | 'storage' | 'container'\n\ntype FolderPaneRenderOptions = {\n folderView?: FolderView\n fullView?: boolean\n solo?: boolean\n}\n\nconst FOLDER_VIEWS: FolderView[] = ['explorer', 'storage', 'container']\n\nexport function folderViewFor (options: FolderPaneRenderOptions): FolderView {\n if (options.folderView && FOLDER_VIEWS.includes(options.folderView)) return options.folderView\n return options.fullView === true || options.solo === true ? 'container' : 'explorer'\n}\n\nexport default {\n icon: icons.iconBase + 'noun_973694_expanded.svg',\n name: 'folder',\n\n // Create a new folder in a Solid system,\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n const newInstance =\n newPaneOptions.newInstance || kb.sym(newPaneOptions.newBase)\n let u = newInstance.uri\n if (u.endsWith('/')) {\n u = u.slice(0, -1) // chop off trailer\n } // { throw new Error('URI of new folder must end in \"/\" :' + u) }\n const normalizedInstance = kb.sym(u + '/')\n newPaneOptions.newInstance = normalizedInstance\n\n return kb.fetcher\n .webOperation('PUT', normalizedInstance.uri)\n .then(function () {\n return newPaneOptions\n })\n },\n\n label: function (subject, context) {\n if (isJavaScriptFile(subject) || isJsonFile(subject)) return null\n const resourceLogic = context.session.logic.resource\n if (!resourceLogic.isContainer(subject)) return null\n const n = resourceLogic.getContainerMemberCount(subject)\n if (n > 0) {\n return 'Contents (' + n + ')' // Show how many in hover text\n }\n return 'Contents (0)'\n },\n\n // Render a file folder in a LDP/solid system\n render: function (subject, context, paneOptions?: unknown) {\n\n const dom = context.dom\n const div = dom.createElement('div')\n div.classList.add('instancePane', 'folder-pane')\n const folderPaneView = div.appendChild(dom.createElement('folder-pane-view')) as FolderPaneView\n const renderOptions = paneOptions && typeof paneOptions === 'object'\n ? paneOptions as FolderPaneRenderOptions\n : {}\n folderPaneView.browserContext = context\n folderPaneView.subject = subject\n const folderView = folderViewFor(renderOptions)\n div.classList.add(`folder-pane--${folderView}`)\n folderPaneView.fullView = folderView === 'container'\n\n // The pane registry is needed to open the internal pane on Alt-click.\n // addDownstreamChangeListener is a high level function which when someone else changes the resource,\n // reloads it into the kb, then must call addDownstreamChangeListener to be able to update the folder pane.\n // SAM need to figure out how to add this line later kb.updater.addDownstreamChangeListener(subject, refresh) // Update store and call me if folder changes\n\n return div\n }\n}\n// ends\n"],"mappings":";;;;;;;AA6BA,IAAMA,IAA6B;CAAC;CAAY;CAAW;AAAW;AAEtE,SAAgBC,EAAe,GAA8C;CAE3E,OADIC,EAAQ,cAAcF,EAAa,SAASE,EAAQ,UAAU,IAAUA,EAAQ,aAC7EA,EAAQ,aAAa,MAAQA,EAAQ,SAAS,KAAO,cAAc;AAC5E;AAEA,IAAAC,IAAe;CACb,MAAMC,EAAM,WAAW;CACvB,MAAM;CAGN,SAAS,SAAU,GAAS,GAAgB;EAC1C,IAAMC,IAAKC,EAAQ,QAAQ,OAGvBC,KADFC,EAAe,eAAeH,EAAG,IAAIG,EAAe,OAAO,EAAA,CACzC;EACpB,AAAID,EAAE,SAAS,GAAG,MAChB,IAAIA,EAAE,MAAM,GAAG,EAAE;EAEnB,IAAME,IAAqBJ,EAAG,IAAIE,IAAI,GAAG;EAGzC,OAFA,EAAe,cAAcE,GAEtBJ,EAAG,QACP,aAAa,OAAOI,EAAmB,GAAG,CAAC,CAC3C,KAAK,WAAY;GAChB,OAAOD;EACT,CAAC;CACL;CAEA,OAAO,SAAU,GAAS,GAAS;EACjC,IAAIE,EAAiBC,CAAO,KAAKC,EAAWD,CAAO,GAAG,OAAO;EAC7D,IAAME,IAAgBP,EAAQ,QAAQ,MAAM;EAC5C,IAAI,CAACO,EAAc,YAAYF,CAAO,GAAG,OAAO;EAChD,IAAMG,IAAID,EAAc,wBAAwBF,CAAO;EAIvD,OAHIG,IAAI,IACC,eAAeA,IAAI,MAErB;CACT;CAGA,QAAQ,SAAU,GAAS,GAAS,GAAuB;EAEzD,IAAMC,IAAMT,EAAQ,KACdU,IAAMD,EAAI,cAAc,KAAK;EACnC,EAAI,UAAU,IAAI,gBAAgB,aAAa;EAC/C,IAAME,IAAiBD,EAAI,YAAYD,EAAI,cAAc,kBAAkB,CAAC,GACtEG,IAAgBC,KAAe,OAAOA,KAAgB,WACxDA,IACA,CAAC;EAEL,AADA,EAAe,iBAAiBb,GAChC,EAAe,UAAUK;EACzB,IAAMS,IAAanB,EAAciB,CAAa;EAS9C,OARAF,EAAI,UAAU,IAAI,gBAAgBI,GAAY,GAC9C,EAAe,WAAWA,MAAe,aAOlCJ;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.cjs.js","names":["utils","solid_ui","isJavaScriptFile","resource","isTurtleFile","isJsonFile","getResourceAccessState","access","readStoredWacAllow","header","wacAllowValues","modes","entry","match","publicModes","getCreationNoun","paneName","getPaneLabel","pane","noun","getContainerMemberCountLabel","memberCount","getCreationPanes","panes","getCreationDialogText","displayLabel","paneLabel","isContainerResource","resourceLogic","isAccessDeniedError","response","error","getIndexedContainer","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\nfunction isTurtleFile (resource: NamedNode): boolean {\n return /\\.ttl$/i.test(new URL(resource.uri).pathname)\n}\n\nfunction isJsonFile (resource: NamedNode): boolean {\n return /\\.json$/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\n/**\n * Reads access from the WAC-Allow header of a stored response, so a resource\n * already loaded with GET does not need a separate HEAD.\n * Returns undefined when no stored header is available.\n */\nfunction readStoredWacAllow (wacAllowValues: string[] | undefined): { isPublic: boolean, canManageAccess: boolean } | undefined {\n const header = wacAllowValues?.filter(Boolean).join(',')\n if (!header) return undefined\n const modes = new Map<string, string[]>()\n for (const entry of header.split(',')) {\n const match = entry.trim().match(/^([A-Za-z]+)\\s*=\\s*\"([^\"]*)\"$/)\n if (match) modes.set(match[1].toLowerCase(), match[2].toLowerCase().split(/\\s+/).filter(Boolean))\n }\n const publicModes = modes.get('public') ?? []\n return {\n isPublic: publicModes.includes('read') || publicModes.includes('write'),\n canManageAccess: (modes.get('user') ?? []).includes('control')\n }\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('/') ||\n (!isJavaScriptFile(resource) && !isTurtleFile(resource) && !isJsonFile(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 isTurtleFile,\n isJsonFile,\n readStoredWacAllow\n}\n"],"mappings":"A,0BAWA,SAASE,EAAkB,EAA8B,CACvD,MAAO,cAAc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C,EAAsB,UAAU,GAASC,EAAM,SAASC,CAAiB,CAAC,IAAMC,CACxF,CAAC,CAAC,OAAQ,GAAa,CACtB,IAAMC,EAAeP,EAAU,IAAI,SAAS,GAAG,EAAIA,EAAU,IAAM,GAAGA,EAAU,IAAI,GACpF,OAAO/B,EAAS,MAAQ,GAAGsC,EAAa,eAC1C,CACqD,CAAA,CAAmB,IAAI,GAAqB,CAC/FzC,EAAAA,MAAM,MAAMuC,CAAiB,CAAC,CAAC,YAAY,EAC3CA,CACF,CAAC,EAGD,OAFAH,EAAiB,KAAK,EAEf,IAAI,IAAIA,EAAiB,KAAK,EAAGjC,KAAc,CAACA,EAAS,MAAO,CACrE,GAAIA,EAAS,MACb,QAASA,EACT,SAAU+B,EAAU,MACpB,YAAaP,EAAoBxB,EAAUyB,CAAa,CAC1D,CAAC,CAAC,CAAC,CACL,C"}
1
+ {"version":3,"file":"helpers.cjs.js","names":["utils","solid_ui","isJavaScriptFile","resource","isTurtleFile","isJsonFile","getResourceAccessState","access","readStoredWacAllow","header","wacAllowValues","modes","entry","match","publicModes","getCreationNoun","paneName","getPaneLabel","pane","noun","getContainerMemberCountLabel","memberCount","getCreationPanes","panes","getCreationDialogText","displayLabel","paneLabel","isContainerResource","resourceLogic","isAccessDeniedError","response","error","getIndexedContainer","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' | 'uploadFiles'\n>\n\nfunction isJavaScriptFile (resource: NamedNode): boolean {\n return /\\.[cm]?js$/i.test(new URL(resource.uri).pathname)\n}\n\nfunction isTurtleFile (resource: NamedNode): boolean {\n return /\\.ttl$/i.test(new URL(resource.uri).pathname)\n}\n\nfunction isJsonFile (resource: NamedNode): boolean {\n return /\\.json$/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\n/**\n * Reads access from the WAC-Allow header of a stored response, so a resource\n * already loaded with GET does not need a separate HEAD.\n * Returns undefined when no stored header is available.\n */\nfunction readStoredWacAllow (wacAllowValues: string[] | undefined): { isPublic: boolean, canManageAccess: boolean } | undefined {\n const header = wacAllowValues?.filter(Boolean).join(',')\n if (!header) return undefined\n const modes = new Map<string, string[]>()\n for (const entry of header.split(',')) {\n const match = entry.trim().match(/^([A-Za-z]+)\\s*=\\s*\"([^\"]*)\"$/)\n if (match) modes.set(match[1].toLowerCase(), match[2].toLowerCase().split(/\\s+/).filter(Boolean))\n }\n const publicModes = modes.get('public') ?? []\n return {\n isPublic: publicModes.includes('read') || publicModes.includes('write'),\n canManageAccess: (modes.get('user') ?? []).includes('control')\n }\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('/') ||\n (!isJavaScriptFile(resource) && !isTurtleFile(resource) && !isJsonFile(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 isTurtleFile,\n isJsonFile,\n readStoredWacAllow\n}\n"],"mappings":"A,0BAWA,SAASE,EAAkB,EAA8B,CACvD,MAAO,cAAc,KAAK,IAAI,IAAIC,EAAS,GAAG,CAAC,CAAC,QAAQ,CAC1D,CAEA,SAASC,EAAc,EAA8B,CACnD,MAAO,UAAU,KAAK,IAAI,IAAID,EAAS,GAAG,CAAC,CAAC,QAAQ,CACtD,CAEA,SAASE,EAAY,EAA8B,CACjD,MAAO,WAAW,KAAK,IAAI,IAAIF,EAAS,GAAG,CAAC,CAAC,QAAQ,CACvD,CAIA,SAASG,EAAwB,EAAkE,CAEjG,OADIC,EAAO,gBAAkB,GAAc,UACpCA,EAAO,SAAW,SAAW,SACtC,CAOA,SAASC,EAAoB,EAAmG,CAC9H,IAAMC,EAASC,GAAgB,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EACvD,GAAI,CAACD,EAAQ,OACb,IAAME,EAAQ,IAAI,IAClB,IAAK,IAAMC,KAASH,EAAO,MAAM,GAAG,EAAG,CACrC,IAAMI,EAAQD,EAAM,KAAK,CAAC,CAAC,MAAM,+BAA+B,EAC5DC,GAAOF,EAAM,IAAIE,EAAM,EAAE,CAAC,YAAY,EAAGA,EAAM,EAAE,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAClG,CACA,IAAMC,EAAcH,EAAM,IAAI,QAAQ,GAAK,CAAC,EAC5C,MAAO,CACL,SAAUG,EAAY,SAAS,MAAM,GAAKA,EAAY,SAAS,OAAO,EACtE,iBAAkBH,EAAM,IAAI,MAAM,GAAK,CAAC,EAAA,CAAG,SAAS,SAAS,CAC/D,CACF,CAEA,SAASI,EAAiB,EAA2B,CAEnD,OADIC,GAAU,Y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mBACjB,GAAGA,EAAU,IAAI,eACvB,CAEA,SAASC,EAA0B,EAAsB,EAA4D,CACnH,GAAI,CAACP,EAAe,OAAO,IAAI,IAU/B,IAAMQ,EARqBR,EAAc,oBAAoBM,CAAS,CAAC,CAAC,OACrE,GAAa,CAACN,EAAc,aAAazB,CAAQ,CACpD,CAAC,CAAC,QAAQ,EAAmB,EAAO,IAC3BkC,EAAsB,UAAU,GAASC,EAAM,SAASC,CAAiB,CAAC,IAAMC,CACxF,CAAC,CAAC,OAAQ,GAAa,CACtB,IAAMC,EAAeP,EAAU,IAAI,SAAS,GAAG,EAAIA,EAAU,IAAM,GAAGA,EAAU,IAAI,GACpF,OAAO/B,EAAS,MAAQ,GAAGsC,EAAa,eAC1C,CACqD,CAAA,CAAmB,IAAI,GAAqB,CAC/FzC,EAAAA,MAAM,MAAMuC,CAAiB,CAAC,CAAC,YAAY,EAC3CA,CACF,CAAC,EAGD,OAFAH,EAAiB,KAAK,EAEf,IAAI,IAAIA,EAAiB,KAAK,EAAGjC,KAAc,CAACA,EAAS,MAAO,CACrE,GAAIA,EAAS,MACb,QAASA,EACT,SAAU+B,EAAU,MACpB,YAAaP,EAAoBxB,EAAUyB,CAAa,CAC1D,CAAC,CAAC,CAAC,CACL,C"}
package/dist/helpers.d.ts CHANGED
@@ -2,7 +2,7 @@ import { NamedNode } from 'rdflib';
2
2
  import { ResourceLogic } from 'solid-logic';
3
3
  import { PaneDefinition } from 'pane-registry';
4
4
  import { ResourceMap } from './types';
5
- export type FolderPaneResourceLogic = Pick<ResourceLogic, 'getContainerMembers' | 'isHiddenFile' | 'isContainer' | 'containerHasIndexDocument' | 'getContainerIndexThing'>;
5
+ export type FolderPaneResourceLogic = Pick<ResourceLogic, 'getContainerMembers' | 'isHiddenFile' | 'isContainer' | 'containerHasIndexDocument' | 'getContainerIndexThing' | 'uploadFiles'>;
6
6
  declare function isJavaScriptFile(resource: NamedNode): boolean;
7
7
  declare function isTurtleFile(resource: NamedNode): boolean;
8
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OAAO,CAMrD;AAED;;;GAGG;AACH,iBAAS,mBAAmB,CAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,iBAAS,4BAA4B,CAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAItF;AAED,iBAAS,wBAAwB,CAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,uBAAuB,GAAG,IAAI,GAAG,WAAW,CAuBnH;AAED,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,kBAAkB,EACnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.esm.js","names":["isJavaScriptFile","resource","isTurtleFile","isJsonFile","getResourceAccessState","access","readStoredWacAllow","header","wacAllowValues","modes","entry","match","publicModes","getCreationNoun","paneName","getPaneLabel","pane","utils","noun","getContainerMemberCountLabel","memberCount","getCreationPanes","panes","getCreationDialogText","displayLabel","paneLabel","isContainerResource","resourceLogic","isAccessDeniedError","response","error","getIndexedContainer","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\nfunction isTurtleFile (resource: NamedNode): boolean {\n return /\\.ttl$/i.test(new URL(resource.uri).pathname)\n}\n\nfunction isJsonFile (resource: NamedNode): boolean {\n return /\\.json$/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\n/**\n * Reads access from the WAC-Allow header of a stored response, so a resource\n * already loaded with GET does not need a separate HEAD.\n * Returns undefined when no stored header is available.\n */\nfunction readStoredWacAllow (wacAllowValues: string[] | undefined): { isPublic: boolean, canManageAccess: boolean } | undefined {\n const header = wacAllowValues?.filter(Boolean).join(',')\n if (!header) return undefined\n const modes = new Map<string, string[]>()\n for (const entry of header.split(',')) {\n const match = entry.trim().match(/^([A-Za-z]+)\\s*=\\s*\"([^\"]*)\"$/)\n if (match) modes.set(match[1].toLowerCase(), match[2].toLowerCase().split(/\\s+/).filter(Boolean))\n }\n const publicModes = modes.get('public') ?? []\n return {\n isPublic: publicModes.includes('read') || publicModes.includes('write'),\n canManageAccess: (modes.get('user') ?? []).includes('control')\n }\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('/') ||\n (!isJavaScriptFile(resource) && !isTurtleFile(resource) && !isJsonFile(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 isTurtleFile,\n isJsonFile,\n readStoredWacAllow\n}\n"],"mappings":";;AAWA,SAASA,EAAkB,GAA8B;CACvD,OAAO,cAAc,KAAK,IAAI,IAAIC,EAAS,GAAG,CAAC,CAAC,QAAQ;AAC1D;AAEA,SAASC,EAAc,GAA8B;CACnD,OAAO,UAAU,KAAK,IAAI,IAAID,EAAS,GAAG,CAAC,CAAC,QAAQ;AACtD;AAEA,SAASE,EAAY,GAA8B;CACjD,OAAO,WAAW,KAAK,IAAI,IAAIF,EAAS,GAAG,CAAC,CAAC,QAAQ;AACvD;AAIA,SAASG,EAAwB,GAAkE;CAEjG,OADIC,EAAO,kBAAkB,KAAc,YACpCA,EAAO,WAAW,WAAW;AACtC;AAOA,SAASC,EAAoB,GAAmG;CAC9H,IAAMC,IAASC,GAAgB,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CACvD,IAAI,CAACD,GAAQ;CACb,IAAME,oBAAQ,IAAI,IAAsB;CACxC,KAAK,IAAMC,KAASH,EAAO,MAAM,GAAG,GAAG;EACrC,IAAMI,IAAQD,EAAM,KAAK,CAAC,CAAC,MAAM,+BAA+B;EAChE,AAAIC,KAAOF,EAAM,IAAIE,EAAM,EAAE,CAAC,YAAY,GAAGA,EAAM,EAAE,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC;CAClG;CACA,IAAMC,IAAcH,EAAM,IAAI,QAAQ,KAAK,CAAC;CAC5C,OAAO;EACL,UAAUG,EAAY,SAAS,MAAM,KAAKA,EAAY,SAAS,OAAO;EACtE,kBAAkBH,EAAM,IAAI,MAAM,KAAK,CAAC,EAAA,CAAG,SAAS,SAAS;CAC/D;AACF;AAEA,SAASI,EAAiB,GAA2B;CAEnD,OADIC,GAAU,YAAY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AAU,IAAI;AACvB;AAEA,SAASC,EAA0B,GAAsB,GAA4D;CACnH,IAAI,CAACP,GAAe,uBAAO,IAAI,IAAI;CAUnC,IAAMQ,IARqBR,EAAc,oBAAoBM,CAAS,CAAC,CAAC,QACrE,MAAa,CAACN,EAAc,aAAa1B,CAAQ,CACpD,CAAC,CAAC,QAAQ,GAAmB,GAAO,MAC3BmC,EAAsB,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,OAAOhC,EAAS,QAAQ,GAAGuC,EAAa;CAC1C,CACqD,CAAA,CAAmB,KAAI,MAAqB,CAC/FvB,EAAM,MAAMqB,CAAiB,CAAC,CAAC,YAAY,GAC3CA,CACF,CAAC;CAGD,OAFAH,EAAiB,KAAK,GAEf,IAAI,IAAIA,EAAiB,KAAK,GAAGlC,OAAc,CAACA,EAAS,OAAO;EACrE,IAAIA,EAAS;EACb,SAASA;EACT,UAAUgC,EAAU;EACpB,aAAaP,EAAoBzB,GAAU0B,CAAa;CAC1D,CAAC,CAAC,CAAC;AACL"}
1
+ {"version":3,"file":"helpers.esm.js","names":["isJavaScriptFile","resource","isTurtleFile","isJsonFile","getResourceAccessState","access","readStoredWacAllow","header","wacAllowValues","modes","entry","match","publicModes","getCreationNoun","paneName","getPaneLabel","pane","utils","noun","getContainerMemberCountLabel","memberCount","getCreationPanes","panes","getCreationDialogText","displayLabel","paneLabel","isContainerResource","resourceLogic","isAccessDeniedError","response","error","getIndexedContainer","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' | 'uploadFiles'\n>\n\nfunction isJavaScriptFile (resource: NamedNode): boolean {\n return /\\.[cm]?js$/i.test(new URL(resource.uri).pathname)\n}\n\nfunction isTurtleFile (resource: NamedNode): boolean {\n return /\\.ttl$/i.test(new URL(resource.uri).pathname)\n}\n\nfunction isJsonFile (resource: NamedNode): boolean {\n return /\\.json$/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\n/**\n * Reads access from the WAC-Allow header of a stored response, so a resource\n * already loaded with GET does not need a separate HEAD.\n * Returns undefined when no stored header is available.\n */\nfunction readStoredWacAllow (wacAllowValues: string[] | undefined): { isPublic: boolean, canManageAccess: boolean } | undefined {\n const header = wacAllowValues?.filter(Boolean).join(',')\n if (!header) return undefined\n const modes = new Map<string, string[]>()\n for (const entry of header.split(',')) {\n const match = entry.trim().match(/^([A-Za-z]+)\\s*=\\s*\"([^\"]*)\"$/)\n if (match) modes.set(match[1].toLowerCase(), match[2].toLowerCase().split(/\\s+/).filter(Boolean))\n }\n const publicModes = modes.get('public') ?? []\n return {\n isPublic: publicModes.includes('read') || publicModes.includes('write'),\n canManageAccess: (modes.get('user') ?? []).includes('control')\n }\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('/') ||\n (!isJavaScriptFile(resource) && !isTurtleFile(resource) && !isJsonFile(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 isTurtleFile,\n isJsonFile,\n readStoredWacAllow\n}\n"],"mappings":";;AAWA,SAASA,EAAkB,GAA8B;CACvD,OAAO,cAAc,KAAK,IAAI,IAAIC,EAAS,GAAG,CAAC,CAAC,QAAQ;AAC1D;AAEA,SAASC,EAAc,GAA8B;CACnD,OAAO,UAAU,KAAK,IAAI,IAAID,EAAS,GAAG,CAAC,CAAC,QAAQ;AACtD;AAEA,SAASE,EAAY,GAA8B;CACjD,OAAO,WAAW,KAAK,IAAI,IAAIF,EAAS,GAAG,CAAC,CAAC,QAAQ;AACvD;AAIA,SAASG,EAAwB,GAAkE;CAEjG,OADIC,EAAO,kBAAkB,KAAc,YACpCA,EAAO,WAAW,WAAW;AACtC;AAOA,SAASC,EAAoB,GAAmG;CAC9H,IAAMC,IAASC,GAAgB,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CACvD,IAAI,CAACD,GAAQ;CACb,IAAME,oBAAQ,IAAI,IAAsB;CACxC,KAAK,IAAMC,KAASH,EAAO,MAAM,GAAG,GAAG;EACrC,IAAMI,IAAQD,EAAM,KAAK,CAAC,CAAC,MAAM,+BAA+B;EAChE,AAAIC,KAAOF,EAAM,IAAIE,EAAM,EAAE,CAAC,YAAY,GAAGA,EAAM,EAAE,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC;CAClG;CACA,IAAMC,IAAcH,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AACzE;AAMA,SAASE,EAAqB,GAAoC;CAChE,IAAMpB,IAAQ,0BAA0B,KAAKV,EAAS,GAAG;CACzD,OAAOU,IAAQA,EAAM,KAAK;AAC5B;AAEA,SAASqB,EAA8B,GAAsB,GAA2B;CACtF,OAAOlB,GAAU,YAAY,MAAM,aAC/B,GAAGmB,EAAU,IAAI,qBACjB,GAAGA,EAAU,IAAI;AACvB;AAEA,SAASC,EAA0B,GAAsB,GAA4D;CACnH,IAAI,CAACP,GAAe,uBAAO,IAAI,IAAI;CAUnC,IAAMQ,IARqBR,EAAc,oBAAoBM,CAAS,CAAC,CAAC,QACrE,MAAa,CAACN,EAAc,aAAa1B,CAAQ,CACpD,CAAC,CAAC,QAAQ,GAAmB,GAAO,MAC3BmC,EAAsB,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,OAAOhC,EAAS,QAAQ,GAAGuC,EAAa;CAC1C,CACqD,CAAA,CAAmB,KAAI,MAAqB,CAC/FvB,EAAM,MAAMqB,CAAiB,CAAC,CAAC,YAAY,GAC3CA,CACF,CAAC;CAGD,OAFAH,EAAiB,KAAK,GAEf,IAAI,IAAIA,EAAiB,KAAK,GAAGlC,OAAc,CAACA,EAAS,OAAO;EACrE,IAAIA,EAAS;EACb,SAASA;EACT,UAAUgC,EAAU;EACpB,aAAaP,EAAoBzB,GAAU0B,CAAa;CAC1D,CAAC,CAAC,CAAC;AACL"}
@@ -1,2 +1,2 @@
1
- const e=require("./helpers.cjs.js"),t=require("./debug.cjs.js");let n=require("solid-ui");async function r(r){let{resource:i,context:a,isCurrent:o}=r,s=a.session.store;try{await s.fetcher.load(i)}catch(e){t.warn(`Unable to preload resource for folder-pane action menu`,e)}if(!o())return;let c=i;if(r.isContainer&&r.resourceLogic?.containerHasIndexDocument(i)){c=s.sym(e.getIndexedApplicationSubject(i));try{await s.fetcher.load(c.doc())}catch(e){t.warn(`Unable to preload index document for folder-pane action menu`,e)}if(!o())return}let l=await(0,n.getRelevantPanes)(c,a,{excludedPaneNames:[`sharing`],fallbackPaneName:`internal`});if(!o())return;let u=(0,n.getPreferredPane)(c,a,l),d=l.filter(e=>e.name!==`folder`),f=u&&u.name!==`folder`?[u,...d.filter(e=>e!==u)]:d,p=r.includeFolderPane&&r.isContainer?u?.name===`folder`?[u,...d]:[...d,...l.filter(e=>e.name===`folder`)]:f,m=await(0,n.preparePaneMenuItems)({subject:c,context:a,panes:p,openPane:(e,t,n)=>r.openPane(t,n)});if(r.includeFolderPane){let e=m.find(e=>e.key===`folder`);e&&(e.label=`Contents`)}return o()?m:void 0}exports.loadResourcePaneMenuItems=r;
1
+ const e=require("./helpers.cjs.js"),t=require("./debug.cjs.js");let n=require("solid-ui");async function r(r){let{resource:i,context:a,isCurrent:o}=r,s=a.session.store;try{await s.fetcher.load(i)}catch(e){t.warn(`Unable to preload resource for folder-pane action menu`,e)}if(!o())return;let c=i;if(r.isContainer&&r.resourceLogic?.containerHasIndexDocument(i)){c=s.sym(e.getIndexedApplicationSubject(i));try{await s.fetcher.load(c.doc())}catch(e){t.warn(`Unable to preload index document for folder-pane action menu`,e)}if(!o())return}let l={excludedPaneNames:[`sharing`]},u=await(0,n.getRelevantPanes)(i,a,l),d=c.sameTerm(i)?[]:await(0,n.getRelevantPanes)(c,a,l);if(!o())return;let f=(0,n.getPreferredPane)(c,a,d),p=new Map(u.map(e=>[e,i]));f&&p.set(f,c);let m=a.session.paneRegistry.list.filter(e=>p.has(e));m.length||(m=await(0,n.getRelevantPanes)(i,a,{...l,fallbackPaneName:`internal`}));let h=f||(0,n.getPreferredPane)(i,a,u),g=h?[h,...m.filter(e=>e!==h)]:m,_=(await Promise.all(g.map(e=>(0,n.preparePaneMenuItems)({subject:p.get(e)??i,context:a,panes:[e],openPane:(e,t,n)=>r.openPane(e,t,n)})))).flat();return o()?_:void 0}exports.loadResourcePaneMenuItems=r;
2
2
  //# sourceMappingURL=resourceActionItems.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceActionItems.cjs.js","names":["getIndexedApplicationSubject","getRelevantPanes","getPreferredPane","preparePaneMenuItems","require_helpers","require_debug","solid_ui","loadResourcePaneMenuItems","options","store","context","resource","error","isCurrent","paneSubject","panes","preferredPane","nonFolderPanes","pane","orderedPanes","menuPanes","items","paneName","event","folderItem","item"],"sources":["../src/resourceActionItems.ts"],"sourcesContent":["import type { DataBrowserContext } from 'pane-registry'\nimport type { NamedNode } from 'rdflib'\nimport { getPreferredPane, getRelevantPanes, preparePaneMenuItems } from 'solid-ui'\nimport type { PaneMenuItem, PaneMenuPane } from 'solid-ui'\nimport { getIndexedApplicationSubject, type FolderPaneResourceLogic } from './helpers'\nimport * as debug from './debug'\n\nexport type ResourcePaneMenuOptions = {\n resource: NamedNode\n isContainer: boolean\n context: DataBrowserContext\n resourceLogic?: Pick<FolderPaneResourceLogic, 'containerHasIndexDocument'> | null\n includeFolderPane?: boolean\n openPane: (paneName: string, event: Event) => void\n isCurrent: () => boolean\n}\n\n/**\n * Builds the pane entries for a resource's three-dots menu: the preferred\n * pane first, folder excluded, and indexed containers resolved to their\n * application subject. Returns undefined when the request became stale.\n */\nexport async function loadResourcePaneMenuItems (\n options: ResourcePaneMenuOptions\n): Promise<PaneMenuItem[] | undefined> {\n const { resource, context, isCurrent } = options\n const store = context.session.store\n try {\n await store.fetcher.load(resource)\n } catch (error) {\n debug.warn('Unable to preload resource for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n\n let paneSubject = resource\n if (options.isContainer && options.resourceLogic?.containerHasIndexDocument(resource)) {\n paneSubject = store.sym(getIndexedApplicationSubject(resource))\n try {\n await store.fetcher.load(paneSubject.doc())\n } catch (error) {\n debug.warn('Unable to preload index document for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n }\n\n const panes = await getRelevantPanes(paneSubject, context, {\n excludedPaneNames: ['sharing'],\n fallbackPaneName: 'internal'\n })\n if (!isCurrent()) return undefined\n\n const preferredPane = getPreferredPane(paneSubject, context, panes)\n const nonFolderPanes = panes.filter(pane => pane.name !== 'folder')\n const orderedPanes = preferredPane && preferredPane.name !== 'folder'\n ? [preferredPane, ...nonFolderPanes.filter(pane => pane !== preferredPane)]\n : nonFolderPanes\n const menuPanes = options.includeFolderPane && options.isContainer\n ? (preferredPane?.name === 'folder' ? [preferredPane, ...nonFolderPanes] : [...nonFolderPanes, ...panes.filter(pane => pane.name === 'folder')])\n : orderedPanes\n const items = await preparePaneMenuItems({\n subject: paneSubject,\n context,\n panes: menuPanes as PaneMenuPane[],\n openPane: (_subject, paneName, event) => options.openPane(paneName, event)\n })\n if (options.includeFolderPane) {\n const folderItem = items.find(item => item.key === 'folder')\n if (folderItem) folderItem.label = 'Contents'\n }\n return isCurrent() ? items : undefined\n}\n"],"mappings":"A,0FAsBA,eAAsBO,EACpB,EACqC,CACrC,GAAM,CAAE,WAAU,UAAS,aAAcC,EACnCC,EAAQC,EAAQ,QAAQ,MAC9B,GAAI,CACF,MAAMD,EAAM,QAAQ,KAAKE,CAAQ,CACnC,OAASC,EAAO,CACdP,EAAA,KAAW,yDAA0DO,CAAK,CAC5E,CACA,GAAI,CAACC,EAAU,EAAG,OAElB,IAAIC,EAAcH,EAClB,GAAIH,EAAQ,aAAeA,EAAQ,eAAe,0BAA0BG,CAAQ,EAAG,CACrF,EAAcF,EAAM,IAAIT,EAAAA,6BAA6BW,CAAQ,CAAC,EAC9D,GAAI,CACF,MAAMF,EAAM,QAAQ,KAAKK,EAAY,IAAI,CAAC,CAC5C,OAASF,EAAO,CACdP,EAAA,KAAW,+DAAgEO,CAAK,CAClF,CACA,GAAI,CAACC,EAAU,EAAG,MACpB,CAEA,IAAME,EAAQ,MAAA,EAAMd,EAAAA,iBAAAA,CAAiBa,EAAaJ,EAAS,CACzD,kBAAmB,CAAC,SAAS,EAC7B,iBAAkB,UACpB,CAAC,EACD,GAAI,CAACG,EAAU,EAAG,OAElB,IAAMG,GAAA,EAAgBd,EAAAA,iBAAAA,CAAiBY,EAAaJ,EAASK,CAAK,EAC5DE,EAAiBF,EAAM,OAAO,GAAQG,EAAK,OAAS,QAAQ,EAC5DC,EAAeH,GAAiBA,EAAc,OAAS,SACzD,CAACA,EAAe,GAAGC,EAAe,OAAO,GAAQC,IAASF,CAAa,CAAC,EACxEC,EACEG,EAAYZ,EAAQ,mBAAqBA,EAAQ,YAClDQ,GAAe,OAAS,SAAW,CAACA,EAAe,GAAGC,CAAc,EAAI,CAAC,GAAGA,EAAgB,GAAGF,EAAM,OAAO,GAAQG,EAAK,OAAS,QAAQ,CAAC,EAC5IC,EACEE,EAAQ,MAAA,EAAMlB,EAAAA,qBAAAA,CAAqB,CACvC,QAASW,EACT,UACA,MAAOM,EACP,UAAW,EAAU,EAAU,IAAUZ,EAAQ,SAASc,EAAUC,CAAK,CAC3E,CAAC,EACD,GAAIf,EAAQ,kBAAmB,CAC7B,IAAMgB,EAAaH,EAAM,KAAK,GAAQI,EAAK,MAAQ,QAAQ,EACvDD,IAAY,EAAW,MAAQ,WACrC,CACA,OAAOX,EAAU,EAAIQ,EAAQ,IAAA,EAC/B,C"}
1
+ {"version":3,"file":"resourceActionItems.cjs.js","names":["getIndexedApplicationSubject","getRelevantPanes","getPreferredPane","preparePaneMenuItems","require_helpers","require_debug","solid_ui","loadResourcePaneMenuItems","options","store","context","resource","error","isCurrent","paneSubject","relevanceOptions","resourcePanes","applicationPanes","primaryApplicationPane","paneSubjects","pane","panes","preferredPane","orderedPanes","items","subject","paneName","event"],"sources":["../src/resourceActionItems.ts"],"sourcesContent":["import type { DataBrowserContext, PaneDefinition } from 'pane-registry'\nimport type { NamedNode } from 'rdflib'\nimport { getPreferredPane, getRelevantPanes, preparePaneMenuItems } from 'solid-ui'\nimport type { PaneMenuItem, PaneMenuPane } from 'solid-ui'\nimport { getIndexedApplicationSubject, type FolderPaneResourceLogic } from './helpers'\nimport * as debug from './debug'\n\nexport type ResourcePaneMenuOptions = {\n resource: NamedNode\n isContainer: boolean\n context: DataBrowserContext\n resourceLogic?: Pick<FolderPaneResourceLogic, 'containerHasIndexDocument'> | null\n openPane: (subject: NamedNode, paneName: string, event: Event) => void\n isCurrent: () => boolean\n}\n\n/**\n * Builds pane entries from the loaded resource and its application index.\n * The preferred pane comes first; the rest retain registry order.\n * Returns undefined when the request became stale.\n */\nexport async function loadResourcePaneMenuItems (\n options: ResourcePaneMenuOptions\n): Promise<PaneMenuItem[] | undefined> {\n const { resource, context, isCurrent } = options\n const store = context.session.store\n try {\n await store.fetcher.load(resource)\n } catch (error) {\n debug.warn('Unable to preload resource for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n\n let paneSubject = resource\n if (options.isContainer && options.resourceLogic?.containerHasIndexDocument(resource)) {\n paneSubject = store.sym(getIndexedApplicationSubject(resource))\n try {\n await store.fetcher.load(paneSubject.doc())\n } catch (error) {\n debug.warn('Unable to preload index document for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n }\n\n const relevanceOptions = { excludedPaneNames: ['sharing'] }\n const resourcePanes = await getRelevantPanes(resource, context, relevanceOptions)\n const applicationPanes = paneSubject.sameTerm(resource)\n ? []\n : await getRelevantPanes(paneSubject, context, relevanceOptions)\n if (!isCurrent()) return undefined\n const primaryApplicationPane = getPreferredPane(paneSubject, context, applicationPanes)\n const paneSubjects = new Map<PaneDefinition, NamedNode>(\n resourcePanes.map(pane => [pane, resource])\n )\n if (primaryApplicationPane) paneSubjects.set(primaryApplicationPane, paneSubject)\n let panes = context.session.paneRegistry.list.filter(pane => paneSubjects.has(pane))\n if (!panes.length) {\n panes = await getRelevantPanes(resource, context, {\n ...relevanceOptions,\n fallbackPaneName: 'internal'\n })\n }\n const preferredPane = primaryApplicationPane || getPreferredPane(resource, context, resourcePanes)\n const orderedPanes = preferredPane\n ? [preferredPane, ...panes.filter(pane => pane !== preferredPane)]\n : panes\n const items = (await Promise.all(orderedPanes.map(pane => preparePaneMenuItems({\n subject: paneSubjects.get(pane) ?? resource,\n context,\n panes: [pane as PaneMenuPane],\n openPane: (subject, paneName, event) => options.openPane(subject, paneName, event)\n })))).flat()\n return isCurrent() ? items : undefined\n}\n"],"mappings":"A,0FAqBA,eAAsBO,EACpB,EACqC,CACrC,GAAM,CAAE,WAAU,UAAS,aAAcC,EACnCC,EAAQC,EAAQ,QAAQ,MAC9B,GAAI,CACF,MAAMD,EAAM,QAAQ,KAAKE,CAAQ,CACnC,OAASC,EAAO,CACdP,EAAA,KAAW,yDAA0DO,CAAK,CAC5E,CACA,GAAI,CAACC,EAAU,EAAG,OAElB,IAAIC,EAAcH,EAClB,GAAIH,EAAQ,aAAeA,EAAQ,eAAe,0BAA0BG,CAAQ,EAAG,CACrF,EAAcF,EAAM,IAAIT,EAAAA,6BAA6BW,CAAQ,CAAC,EAC9D,GAAI,CACF,MAAMF,EAAM,QAAQ,KAAKK,EAAY,IAAI,CAAC,CAC5C,OAASF,EAAO,CACdP,EAAA,KAAW,+DAAgEO,CAAK,CAClF,CACA,GAAI,CAACC,EAAU,EAAG,MACpB,CAEA,IAAME,EAAmB,CAAE,kBAAmB,CAAC,SAAS,CAAE,EACpDC,EAAgB,MAAA,EAAMf,EAAAA,iBAAAA,CAAiBU,EAAUD,EAASK,CAAgB,EAC1EE,EAAmBH,EAAY,SAASH,CAAQ,EAClD,CAAC,EACD,MAAA,EAAMV,EAAAA,iBAAAA,CAAiBa,EAAaJ,EAASK,CAAgB,EACjE,GAAI,CAACF,EAAU,EAAG,OAClB,IAAMK,GAAA,EAAyBhB,EAAAA,iBAAAA,CAAiBY,EAAaJ,EAASO,CAAgB,EAChFE,EAAe,IAAI,IACvBH,EAAc,IAAI,GAAQ,CAACI,EAAMT,CAAQ,CAAC,CAC5C,EACIO,GAAwBC,EAAa,IAAID,EAAwBJ,CAAW,EAChF,IAAIO,EAAQX,EAAQ,QAAQ,aAAa,KAAK,OAAO,GAAQS,EAAa,IAAIC,CAAI,CAAC,EAC9EC,EAAM,SACT,EAAQ,MAAA,EAAMpB,EAAAA,iBAAAA,CAAiBU,EAAUD,EAAS,CAChD,GAAGK,EACH,iBAAkB,UACpB,CAAC,GAEH,IAAMO,EAAgBJ,IAAA,EAA0BhB,EAAAA,iBAAAA,CAAiBS,EAAUD,EAASM,CAAa,EAC3FO,EAAeD,EACjB,CAACA,EAAe,GAAGD,EAAM,OAAO,GAAQD,IAASE,CAAa,CAAC,EAC/DD,EACEG,GAAS,MAAM,QAAQ,IAAID,EAAa,IAAI,IAAA,EAAQpB,EAAAA,qBAAAA,CAAqB,CAC7E,QAASgB,EAAa,IAAIC,CAAI,GAAKT,EACnC,UACA,MAAO,CAACS,CAAoB,EAC5B,UAAW,EAAS,EAAU,IAAUZ,EAAQ,SAASiB,EAASC,EAAUC,CAAK,CACnF,CAAC,CAAC,CAAC,EAAA,CAAG,KAAK,EACX,OAAOd,EAAU,EAAIW,EAAQ,IAAA,EAC/B,C"}
@@ -7,14 +7,13 @@ export type ResourcePaneMenuOptions = {
7
7
  isContainer: boolean;
8
8
  context: DataBrowserContext;
9
9
  resourceLogic?: Pick<FolderPaneResourceLogic, 'containerHasIndexDocument'> | null;
10
- includeFolderPane?: boolean;
11
- openPane: (paneName: string, event: Event) => void;
10
+ openPane: (subject: NamedNode, paneName: string, event: Event) => void;
12
11
  isCurrent: () => boolean;
13
12
  };
14
13
  /**
15
- * Builds the pane entries for a resource's three-dots menu: the preferred
16
- * pane first, folder excluded, and indexed containers resolved to their
17
- * application subject. Returns undefined when the request became stale.
14
+ * Builds pane entries from the loaded resource and its application index.
15
+ * The preferred pane comes first; the rest retain registry order.
16
+ * Returns undefined when the request became stale.
18
17
  */
19
18
  export declare function loadResourcePaneMenuItems(options: ResourcePaneMenuOptions): Promise<PaneMenuItem[] | undefined>;
20
19
  //# sourceMappingURL=resourceActionItems.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceActionItems.d.ts","sourceRoot":"","sources":["../src/resourceActionItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAA;AAC1D,OAAO,EAAgC,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAGtF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,kBAAkB,CAAA;IAC3B,aAAa,CAAC,EAAE,IAAI,CAAC,uBAAuB,EAAE,2BAA2B,CAAC,GAAG,IAAI,CAAA;IACjF,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAClD,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,CA8CrC"}
1
+ {"version":3,"file":"resourceActionItems.d.ts","sourceRoot":"","sources":["../src/resourceActionItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,eAAe,CAAA;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAA;AAC1D,OAAO,EAAgC,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAGtF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,kBAAkB,CAAA;IAC3B,aAAa,CAAC,EAAE,IAAI,CAAC,uBAAuB,EAAE,2BAA2B,CAAC,GAAG,IAAI,CAAA;IACjF,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACtE,SAAS,EAAE,MAAM,OAAO,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,CAkDrC"}
@@ -20,22 +20,22 @@ async function a(a) {
20
20
  }
21
21
  if (!c()) return;
22
22
  }
23
- let d = await r(u, s, {
24
- excludedPaneNames: ["sharing"],
25
- fallbackPaneName: "internal"
26
- });
23
+ let d = { excludedPaneNames: ["sharing"] }, f = await r(o, s, d), p = u.sameTerm(o) ? [] : await r(u, s, d);
27
24
  if (!c()) return;
28
- let f = n(u, s, d), p = d.filter((e) => e.name !== "folder"), m = f && f.name !== "folder" ? [f, ...p.filter((e) => e !== f)] : p, h = a.includeFolderPane && a.isContainer ? f?.name === "folder" ? [f, ...p] : [...p, ...d.filter((e) => e.name === "folder")] : m, g = await i({
29
- subject: u,
25
+ let m = n(u, s, p), h = new Map(f.map((e) => [e, o]));
26
+ m && h.set(m, u);
27
+ let g = s.session.paneRegistry.list.filter((e) => h.has(e));
28
+ g.length || (g = await r(o, s, {
29
+ ...d,
30
+ fallbackPaneName: "internal"
31
+ }));
32
+ let _ = m || n(o, s, f), v = _ ? [_, ...g.filter((e) => e !== _)] : g, y = (await Promise.all(v.map((e) => i({
33
+ subject: h.get(e) ?? o,
30
34
  context: s,
31
- panes: h,
32
- openPane: (e, t, n) => a.openPane(t, n)
33
- });
34
- if (a.includeFolderPane) {
35
- let e = g.find((e) => e.key === "folder");
36
- e && (e.label = "Contents");
37
- }
38
- return c() ? g : void 0;
35
+ panes: [e],
36
+ openPane: (e, t, n) => a.openPane(e, t, n)
37
+ })))).flat();
38
+ return c() ? y : void 0;
39
39
  }
40
40
  export { a as loadResourcePaneMenuItems };
41
41
 
@@ -1 +1 @@
1
- {"version":3,"file":"resourceActionItems.esm.js","names":["loadResourcePaneMenuItems","options","store","context","resource","error","isCurrent","paneSubject","getIndexedApplicationSubject","panes","getRelevantPanes","preferredPane","getPreferredPane","nonFolderPanes","pane","orderedPanes","menuPanes","items","preparePaneMenuItems","paneName","event","folderItem","item"],"sources":["../src/resourceActionItems.ts"],"sourcesContent":["import type { DataBrowserContext } from 'pane-registry'\nimport type { NamedNode } from 'rdflib'\nimport { getPreferredPane, getRelevantPanes, preparePaneMenuItems } from 'solid-ui'\nimport type { PaneMenuItem, PaneMenuPane } from 'solid-ui'\nimport { getIndexedApplicationSubject, type FolderPaneResourceLogic } from './helpers'\nimport * as debug from './debug'\n\nexport type ResourcePaneMenuOptions = {\n resource: NamedNode\n isContainer: boolean\n context: DataBrowserContext\n resourceLogic?: Pick<FolderPaneResourceLogic, 'containerHasIndexDocument'> | null\n includeFolderPane?: boolean\n openPane: (paneName: string, event: Event) => void\n isCurrent: () => boolean\n}\n\n/**\n * Builds the pane entries for a resource's three-dots menu: the preferred\n * pane first, folder excluded, and indexed containers resolved to their\n * application subject. Returns undefined when the request became stale.\n */\nexport async function loadResourcePaneMenuItems (\n options: ResourcePaneMenuOptions\n): Promise<PaneMenuItem[] | undefined> {\n const { resource, context, isCurrent } = options\n const store = context.session.store\n try {\n await store.fetcher.load(resource)\n } catch (error) {\n debug.warn('Unable to preload resource for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n\n let paneSubject = resource\n if (options.isContainer && options.resourceLogic?.containerHasIndexDocument(resource)) {\n paneSubject = store.sym(getIndexedApplicationSubject(resource))\n try {\n await store.fetcher.load(paneSubject.doc())\n } catch (error) {\n debug.warn('Unable to preload index document for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n }\n\n const panes = await getRelevantPanes(paneSubject, context, {\n excludedPaneNames: ['sharing'],\n fallbackPaneName: 'internal'\n })\n if (!isCurrent()) return undefined\n\n const preferredPane = getPreferredPane(paneSubject, context, panes)\n const nonFolderPanes = panes.filter(pane => pane.name !== 'folder')\n const orderedPanes = preferredPane && preferredPane.name !== 'folder'\n ? [preferredPane, ...nonFolderPanes.filter(pane => pane !== preferredPane)]\n : nonFolderPanes\n const menuPanes = options.includeFolderPane && options.isContainer\n ? (preferredPane?.name === 'folder' ? [preferredPane, ...nonFolderPanes] : [...nonFolderPanes, ...panes.filter(pane => pane.name === 'folder')])\n : orderedPanes\n const items = await preparePaneMenuItems({\n subject: paneSubject,\n context,\n panes: menuPanes as PaneMenuPane[],\n openPane: (_subject, paneName, event) => options.openPane(paneName, event)\n })\n if (options.includeFolderPane) {\n const folderItem = items.find(item => item.key === 'folder')\n if (folderItem) folderItem.label = 'Contents'\n }\n return isCurrent() ? items : undefined\n}\n"],"mappings":";;;;AAsBA,eAAsBA,EACpB,GACqC;CACrC,IAAM,EAAE,aAAU,YAAS,iBAAcC,GACnCC,IAAQC,EAAQ,QAAQ;CAC9B,IAAI;EACF,MAAMD,EAAM,QAAQ,KAAKE,CAAQ;CACnC,SAASC,GAAO;EACd,EAAW,0DAA0DA,CAAK;CAC5E;CACA,IAAI,CAACC,EAAU,GAAG;CAElB,IAAIC,IAAcH;CAClB,IAAIH,EAAQ,eAAeA,EAAQ,eAAe,0BAA0BG,CAAQ,GAAG;EACrF,IAAcF,EAAM,IAAIM,EAA6BJ,CAAQ,CAAC;EAC9D,IAAI;GACF,MAAMF,EAAM,QAAQ,KAAKK,EAAY,IAAI,CAAC;EAC5C,SAASF,GAAO;GACd,EAAW,gEAAgEA,CAAK;EAClF;EACA,IAAI,CAACC,EAAU,GAAG;CACpB;CAEA,IAAMG,IAAQ,MAAMC,EAAiBH,GAAaJ,GAAS;EACzD,mBAAmB,CAAC,SAAS;EAC7B,kBAAkB;CACpB,CAAC;CACD,IAAI,CAACG,EAAU,GAAG;CAElB,IAAMK,IAAgBC,EAAiBL,GAAaJ,GAASM,CAAK,GAC5DI,IAAiBJ,EAAM,QAAO,MAAQK,EAAK,SAAS,QAAQ,GAC5DC,IAAeJ,KAAiBA,EAAc,SAAS,WACzD,CAACA,GAAe,GAAGE,EAAe,QAAO,MAAQC,MAASH,CAAa,CAAC,IACxEE,GACEG,IAAYf,EAAQ,qBAAqBA,EAAQ,cAClDU,GAAe,SAAS,WAAW,CAACA,GAAe,GAAGE,CAAc,IAAI,CAAC,GAAGA,GAAgB,GAAGJ,EAAM,QAAO,MAAQK,EAAK,SAAS,QAAQ,CAAC,IAC5IC,GACEE,IAAQ,MAAMC,EAAqB;EACvC,SAASX;EACT;EACA,OAAOS;EACP,WAAW,GAAU,GAAU,MAAUf,EAAQ,SAASkB,GAAUC,CAAK;CAC3E,CAAC;CACD,IAAInB,EAAQ,mBAAmB;EAC7B,IAAMoB,IAAaJ,EAAM,MAAK,MAAQK,EAAK,QAAQ,QAAQ;EAC3D,AAAID,MAAY,EAAW,QAAQ;CACrC;CACA,OAAOf,EAAU,IAAIW,IAAQ,KAAA;AAC/B"}
1
+ {"version":3,"file":"resourceActionItems.esm.js","names":["loadResourcePaneMenuItems","options","store","context","resource","error","isCurrent","paneSubject","getIndexedApplicationSubject","relevanceOptions","resourcePanes","getRelevantPanes","applicationPanes","primaryApplicationPane","getPreferredPane","paneSubjects","pane","panes","preferredPane","orderedPanes","items","preparePaneMenuItems","subject","paneName","event"],"sources":["../src/resourceActionItems.ts"],"sourcesContent":["import type { DataBrowserContext, PaneDefinition } from 'pane-registry'\nimport type { NamedNode } from 'rdflib'\nimport { getPreferredPane, getRelevantPanes, preparePaneMenuItems } from 'solid-ui'\nimport type { PaneMenuItem, PaneMenuPane } from 'solid-ui'\nimport { getIndexedApplicationSubject, type FolderPaneResourceLogic } from './helpers'\nimport * as debug from './debug'\n\nexport type ResourcePaneMenuOptions = {\n resource: NamedNode\n isContainer: boolean\n context: DataBrowserContext\n resourceLogic?: Pick<FolderPaneResourceLogic, 'containerHasIndexDocument'> | null\n openPane: (subject: NamedNode, paneName: string, event: Event) => void\n isCurrent: () => boolean\n}\n\n/**\n * Builds pane entries from the loaded resource and its application index.\n * The preferred pane comes first; the rest retain registry order.\n * Returns undefined when the request became stale.\n */\nexport async function loadResourcePaneMenuItems (\n options: ResourcePaneMenuOptions\n): Promise<PaneMenuItem[] | undefined> {\n const { resource, context, isCurrent } = options\n const store = context.session.store\n try {\n await store.fetcher.load(resource)\n } catch (error) {\n debug.warn('Unable to preload resource for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n\n let paneSubject = resource\n if (options.isContainer && options.resourceLogic?.containerHasIndexDocument(resource)) {\n paneSubject = store.sym(getIndexedApplicationSubject(resource))\n try {\n await store.fetcher.load(paneSubject.doc())\n } catch (error) {\n debug.warn('Unable to preload index document for folder-pane action menu', error)\n }\n if (!isCurrent()) return undefined\n }\n\n const relevanceOptions = { excludedPaneNames: ['sharing'] }\n const resourcePanes = await getRelevantPanes(resource, context, relevanceOptions)\n const applicationPanes = paneSubject.sameTerm(resource)\n ? []\n : await getRelevantPanes(paneSubject, context, relevanceOptions)\n if (!isCurrent()) return undefined\n const primaryApplicationPane = getPreferredPane(paneSubject, context, applicationPanes)\n const paneSubjects = new Map<PaneDefinition, NamedNode>(\n resourcePanes.map(pane => [pane, resource])\n )\n if (primaryApplicationPane) paneSubjects.set(primaryApplicationPane, paneSubject)\n let panes = context.session.paneRegistry.list.filter(pane => paneSubjects.has(pane))\n if (!panes.length) {\n panes = await getRelevantPanes(resource, context, {\n ...relevanceOptions,\n fallbackPaneName: 'internal'\n })\n }\n const preferredPane = primaryApplicationPane || getPreferredPane(resource, context, resourcePanes)\n const orderedPanes = preferredPane\n ? [preferredPane, ...panes.filter(pane => pane !== preferredPane)]\n : panes\n const items = (await Promise.all(orderedPanes.map(pane => preparePaneMenuItems({\n subject: paneSubjects.get(pane) ?? resource,\n context,\n panes: [pane as PaneMenuPane],\n openPane: (subject, paneName, event) => options.openPane(subject, paneName, event)\n })))).flat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,GAAGD,EAAM,QAAO,MAAQD,MAASE,CAAa,CAAC,IAC/DD,GACEG,KAAS,MAAM,QAAQ,IAAID,EAAa,KAAI,MAAQE,EAAqB;EAC7E,SAASN,EAAa,IAAIC,CAAI,KAAKZ;EACnC;EACA,OAAO,CAACY,CAAoB;EAC5B,WAAW,GAAS,GAAU,MAAUf,EAAQ,SAASqB,GAASC,GAAUC,CAAK;CACnF,CAAC,CAAC,CAAC,EAAA,CAAG,KAAK;CACX,OAAOlB,EAAU,IAAIc,IAAQ,KAAA;AAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "folder-pane",
3
- "version": "4.0.1-2",
3
+ "version": "4.1.0",
4
4
  "description": "Solid-compatible Panes: File browser",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -75,10 +75,10 @@
75
75
  "dependencies": {
76
76
  "@lit/context": "^1.1.6",
77
77
  "lit": "^3.3.3",
78
- "pane-registry": "5.0.2-2",
78
+ "pane-registry": "5.1.1",
79
79
  "rdflib": "2.4.1",
80
- "solid-logic": "6.0.1-5",
81
- "solid-ui": "5.0.2-7"
80
+ "solid-logic": "6.2.0",
81
+ "solid-ui": "5.1.0"
82
82
  },
83
83
  "solidosDependencies": [
84
84
  "rdflib",