solid-panes 5.1.0-3 → 5.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/dist/RDFXMLPane.d.ts.map +1 -1
- package/dist/RDFXMLPane2.cjs.js +1 -1
- package/dist/RDFXMLPane2.cjs.js.map +1 -1
- package/dist/RDFXMLPane2.esm.js +3 -3
- package/dist/RDFXMLPane2.esm.js.map +1 -1
- package/dist/components/editor-card/EditorCard.cjs.js +2 -2
- package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
- package/dist/components/editor-card/EditorCard.d.ts +2 -0
- package/dist/components/editor-card/EditorCard.d.ts.map +1 -1
- package/dist/components/editor-card/EditorCard.esm.js +68 -43
- package/dist/components/editor-card/EditorCard.esm.js.map +1 -1
- package/dist/components/editor-card/EditorCard.styles.cjs.js.map +1 -1
- package/dist/components/editor-card/EditorCard.styles.esm.js.map +1 -1
- package/dist/components/header/Header.cjs.js.map +1 -1
- package/dist/components/header/Header.esm.js.map +1 -1
- package/dist/components/header/Header.styles.cjs.js.map +1 -1
- package/dist/components/header/Header.styles.esm.js.map +1 -1
- package/dist/components/navbar/Navbar.cjs.js.map +1 -1
- package/dist/components/navbar/Navbar.esm.js.map +1 -1
- package/dist/components/navbar/Navbar.styles.cjs.js.map +1 -1
- package/dist/components/navbar/Navbar.styles.esm.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.cjs.js +4 -4
- package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.d.ts +4 -0
- package/dist/components/profile-heading/ProfileHeading.d.ts.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.esm.js +123 -107
- package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +19 -19
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +86 -86
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/dateHelpers.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/imageHelpers.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/imagePreview.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js +1 -1
- package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +61 -61
- package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/phoneCountries.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rowState.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/textUtils.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/textUtils.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/dialogTexts.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/messageTexts.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/messageTexts.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.esm.js +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
- package/dist/components/profile-heading/friendActions.cjs.js +1 -1
- package/dist/components/profile-heading/friendActions.cjs.js.map +1 -1
- package/dist/components/profile-heading/friendActions.esm.js +5 -5
- package/dist/components/profile-heading/profileHeadingData.cjs.js.map +1 -1
- package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js +33 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts +16 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js +309 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js +2 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js +6 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js.map +1 -0
- package/dist/dataContentPane.d.ts.map +1 -1
- package/dist/dataContentPane2.cjs.js +1 -1
- package/dist/dataContentPane2.cjs.js.map +1 -1
- package/dist/dataContentPane2.esm.js +90 -78
- package/dist/dataContentPane2.esm.js.map +1 -1
- package/dist/humanReadablePane.d.ts +1 -0
- package/dist/humanReadablePane.d.ts.map +1 -1
- package/dist/humanReadablePane2.cjs.js +147 -15
- package/dist/humanReadablePane2.cjs.js.map +1 -1
- package/dist/humanReadablePane2.esm.js +281 -114
- package/dist/humanReadablePane2.esm.js.map +1 -1
- package/dist/imagePane.d.ts.map +1 -1
- package/dist/imagePane2.cjs.js +1 -1
- package/dist/imagePane2.cjs.js.map +1 -1
- package/dist/imagePane2.esm.js +9 -7
- package/dist/imagePane2.esm.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/internal/internalPane.d.ts.map +1 -1
- package/dist/internal/internalPane2.cjs.js +1 -1
- package/dist/internal/internalPane2.cjs.js.map +1 -1
- package/dist/internal/internalPane2.esm.js +55 -60
- package/dist/internal/internalPane2.esm.js.map +1 -1
- package/dist/mainPage/header.cjs.js +1 -1
- package/dist/mainPage/header.esm.js +2 -2
- package/dist/mainPage/index.cjs.js +1 -1
- package/dist/mainPage/index.cjs.js.map +1 -1
- package/dist/mainPage/index.d.ts.map +1 -1
- package/dist/mainPage/index.esm.js +35 -26
- package/dist/mainPage/index.esm.js.map +1 -1
- package/dist/mainPage/navbar.cjs.js +1 -1
- package/dist/mainPage/navbar.cjs.js.map +1 -1
- package/dist/mainPage/navbar.esm.js +15 -15
- package/dist/mainPage/navigation.cjs.js +1 -1
- package/dist/mainPage/navigation.cjs.js.map +1 -1
- package/dist/mainPage/navigation.esm.js +4 -4
- package/dist/mainPage/profileHeading.d.ts.map +1 -1
- package/dist/mainPage/profileHeading2.cjs.js +1 -1
- package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
- package/dist/mainPage/profileHeading2.esm.js +14 -14
- package/dist/mainPage/profileHeading2.esm.js.map +1 -1
- package/dist/n3Pane.d.ts.map +1 -1
- package/dist/n3Pane2.cjs.js +1 -1
- package/dist/n3Pane2.cjs.js.map +1 -1
- package/dist/n3Pane2.esm.js +1 -1
- package/dist/n3Pane2.esm.js.map +1 -1
- package/dist/navigation/browserEvents.cjs.js +1 -1
- package/dist/navigation/browserEvents.cjs.js.map +1 -1
- package/dist/navigation/browserEvents.d.ts.map +1 -1
- package/dist/navigation/browserEvents.esm.js +17 -17
- package/dist/navigation/browserEvents.esm.js.map +1 -1
- package/dist/navigation/chrome.cjs.js +1 -1
- package/dist/navigation/chrome.cjs.js.map +1 -1
- package/dist/navigation/chrome.d.ts +2 -2
- package/dist/navigation/chrome.d.ts.map +1 -1
- package/dist/navigation/chrome.esm.js +2 -2
- package/dist/navigation/chrome.esm.js.map +1 -1
- package/dist/navigation/controller.cjs.js +1 -1
- package/dist/navigation/controller.cjs.js.map +1 -1
- package/dist/navigation/controller.esm.js +37 -37
- package/dist/navigation/podContext.cjs.js +1 -1
- package/dist/navigation/podContext.cjs.js.map +1 -1
- package/dist/navigation/podContext.esm.js +5 -5
- package/dist/navigation/state.cjs.js +1 -1
- package/dist/navigation/state.cjs.js.map +1 -1
- package/dist/navigation/state.d.ts +4 -0
- package/dist/navigation/state.d.ts.map +1 -1
- package/dist/navigation/state.esm.js +18 -5
- package/dist/navigation/state.esm.js.map +1 -1
- package/dist/outline/fileExplorerHelpers.cjs.js +1 -1
- package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -1
- package/dist/outline/fileExplorerHelpers.d.ts +2 -5
- package/dist/outline/fileExplorerHelpers.d.ts.map +1 -1
- package/dist/outline/fileExplorerHelpers.esm.js +11 -13
- package/dist/outline/fileExplorerHelpers.esm.js.map +1 -1
- package/dist/outline/manager2.cjs.js +1 -1
- package/dist/outline/manager2.cjs.js.map +1 -1
- package/dist/outline/manager2.esm.js +355 -327
- package/dist/outline/manager2.esm.js.map +1 -1
- package/dist/registerPanes.cjs.js +1 -1
- package/dist/registerPanes.cjs.js.map +1 -1
- package/dist/registerPanes.esm.js +1 -1
- package/dist/registerPanes.esm.js.map +1 -1
- package/dist/slideshow/slideshowPane.cjs.js +1 -1
- package/dist/slideshow/slideshowPane.cjs.js.map +1 -1
- package/dist/slideshow/slideshowPane.esm.js +30 -30
- package/dist/slideshow/slideshowPane.esm.js.map +1 -1
- package/dist/social/socialPane2.cjs.js +1 -1
- package/dist/social/socialPane2.esm.js +1 -1
- package/dist/social/socialSections.cjs.js +1 -1
- package/dist/social/socialSections.esm.js +1 -1
- package/dist/utils/paneUtils.cjs.js +1 -1
- package/dist/utils/paneUtils.cjs.js.map +1 -1
- package/dist/utils/paneUtils.esm.js +15 -15
- package/dist/versionInfo.cjs.js +1 -1
- package/dist/versionInfo.cjs.js.map +1 -1
- package/dist/versionInfo.esm.js +9 -9
- package/dist/versionInfo.esm.js.map +1 -1
- package/package.json +11 -12
|
@@ -40,8 +40,8 @@ function c(e) {
|
|
|
40
40
|
function l(e) {
|
|
41
41
|
return e.isRootResource || e.isWebId ? !1 : !e.viewerPodOnly || e.inViewerPod;
|
|
42
42
|
}
|
|
43
|
-
function u(e, n, r) {
|
|
44
|
-
return n === "folder"
|
|
43
|
+
function u(e, n, r, i = !1) {
|
|
44
|
+
return n === "folder" || n === "basicPreferences" || n === "home" || n === "dashboard" ? !1 : e && !t(n);
|
|
45
45
|
}
|
|
46
46
|
export { e as PERSON_PANES, l as deriveExplorerHeader, r as deriveHeading, i as deriveNavbarSelection, c as deriveStorageView, u as explorerHeaderForPane, s as isNavbarHidden, a as isNavbarItemSelected, t as isPersonPane, n as offersFriendAction, o as pickNavbarItem };
|
|
47
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.esm.js","names":["PERSON_PANES","isPersonPane","paneName","offersFriendAction","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","deriveStorageView","deriveExplorerHeader","explorerHeaderForPane","
|
|
1
|
+
{"version":3,"file":"chrome.esm.js","names":["PERSON_PANES","isPersonPane","paneName","offersFriendAction","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","deriveStorageView","deriveExplorerHeader","explorerHeaderForPane","resourceHeader"],"sources":["../../src/navigation/chrome.ts"],"sourcesContent":["/*\n * The rules for what the page chrome shows, as pure functions.\n *\n * What the user sees depends on the page URL, the pane that was last opened, whether the\n * account menu opened it, who is logged in and whose pod the URL is in. These functions\n * decide it from those inputs alone: they read no history, DOM or session, so every rule\n * can be tested in one place. The heading, navbar, outline and file explorer provider\n * only apply the result.\n */\n\nimport { type NavigationView } from './state'\nimport type { FolderView } from './options'\n\n/** Registry names of the panes that present a person rather than a resource. */\nexport const PERSON_PANES = ['profile', 'social']\n\nexport function isPersonPane (paneName?: string): boolean {\n return paneName !== undefined && PERSON_PANES.includes(paneName)\n}\n\n/** Whether the heading over this pane offers to add its person as a friend: on the Profile and Friends tabs. */\nexport function offersFriendAction (paneName?: string): boolean {\n return isPersonPane(paneName)\n}\n\n/** The parts of a navbar item that the rules look at. */\nexport interface NavbarItemRef {\n paneName?: string\n paneUri?: string\n}\n\n// Profile heading\n\nexport type HeadingDecision =\n | { mode: 'none' }\n | {\n /** Full on the profile pane, compact everywhere else. */\n mode: 'full' | 'compact'\n /** The profile (WebID or document) to present. */\n subjectUri: string\n paneName?: string\n }\n\nexport interface HeadingInput {\n view: NavigationView\n viaAccountMenu: boolean\n /** WebID of the logged-in user. */\n viewer?: string\n pageUrl: string\n /** WebID of the person whose pod the page is in, if known. */\n owner?: string\n /** URIs of the storages of that pod. */\n storageUris: string[]\n}\n\n/**\n * Profile and friends panes present their own subject. Any other pane shows the owner of\n * the pod the page is in, unless that is the viewer, or the view came from the account menu\n * and so shows the viewer's own content.\n */\nexport function deriveHeading (input: HeadingInput): HeadingDecision {\n const { view, viaAccountMenu, viewer, pageUrl, owner, storageUris } = input\n const paneName = view.pane\n\n // Whether the pod owner's navbar has an item for the displayed pane: Profile and Friends\n // whenever there is an owner, and a storage by its URI (any of them when the view names none).\n const ownerHasPane = paneName === 'profile' || paneName === 'social'\n ? owner !== undefined\n : paneName === 'folder' && storageUris.some(uri => !view.subject || uri === view.subject)\n const ownerUri = ownerHasPane || !viaAccountMenu ? owner : undefined\n\n if (!isPersonPane(paneName)) {\n if (!ownerUri || ownerUri === viewer) return { mode: 'none' }\n return { mode: 'compact', subjectUri: ownerUri, paneName }\n }\n\n return {\n mode: paneName === 'profile' ? 'full' : 'compact',\n subjectUri: view.subject || (ownerHasPane ? owner : undefined) || pageUrl,\n paneName\n }\n}\n\n// Navbar\n\nexport interface NavbarSelection {\n paneName?: string\n paneUri?: string\n}\n\n/** What the navbar should have selected: the displayed pane, or Profile on a WebID. */\nexport function deriveNavbarSelection (view: NavigationView, pageIsWebId: boolean): NavbarSelection {\n return {\n paneName: view.pane ?? (pageIsWebId ? 'profile' : undefined),\n paneUri: view.subject\n }\n}\n\n/**\n * @param storageItemCount how many storage items the navbar has; a single storage is\n * selected even when the view does not say which one it was\n */\nexport function isNavbarItemSelected (\n item: NavbarItemRef,\n selection: NavbarSelection,\n storageItemCount: number\n): boolean {\n if (!selection.paneName || item.paneName !== selection.paneName) return false\n if (item.paneName === 'folder') {\n return selection.paneUri ? selection.paneUri === item.paneUri : storageItemCount === 1\n }\n return true\n}\n\n/** The item to select for a pane: the one for that subject, else the first for that pane. */\nexport function pickNavbarItem<Item extends NavbarItemRef> (\n items: Item[],\n paneName: string,\n paneUri?: string\n): Item | undefined {\n const forPane = items.filter(item => item.paneName === paneName)\n return forPane.find(item => item.paneUri === paneUri) ?? forPane[0]\n}\n\n/** The navbar is not offered in the viewer's own pod, nor over account-menu content. */\nexport function isNavbarHidden (input: { viaAccountMenu: boolean, ownProfile: boolean, inViewerPod: boolean }): boolean {\n return input.viaAccountMenu || input.ownProfile || input.inViewerPod\n}\n\n// Storage\n\nexport interface StorageViewInput {\n viaAccountMenu: boolean\n /** The storage is one of the viewer's own. */\n inViewerPod: boolean\n /** The storage belongs to a person whose profile was found; the server root has none. */\n hasOwner: boolean\n}\n\n/**\n * The viewer's own storage, and the server root, come with the folder pane's storage header.\n * Someone else's storage sits under the navbar of their pod, which already says whose it is.\n */\nexport function deriveStorageView (input: StorageViewInput): Extract<FolderView, 'explorer' | 'storage'> {\n return input.viaAccountMenu || input.inViewerPod || !input.hasOwner ? 'explorer' : 'storage'\n}\n\n// File explorer header\n\nexport interface ExplorerHeaderInput {\n isRootResource: boolean\n isWebId: boolean\n /**\n * The view shows a person's own subject or the viewer's content, not the resource the\n * page URL points at, so the resource header only fits inside the viewer's own pod.\n */\n viewerPodOnly: boolean\n inViewerPod: boolean\n}\n\n/** Whether the header describing a resource fits the view. */\nexport function deriveExplorerHeader (input: ExplorerHeaderInput): boolean {\n if (input.isRootResource || input.isWebId) return false\n return !input.viewerPodOnly || input.inViewerPod\n}\n\n/**\n * The header is never shown over profile, friends, preferences or dashboard panes,\n * nor over a storage view, which has its own header or the navbar.\n */\nexport function explorerHeaderForPane (\n resourceHeader: boolean,\n paneName?: string,\n folderView?: FolderView,\n solo = false\n): boolean {\n if (paneName === 'folder' || paneName === 'basicPreferences' || paneName === 'home' || paneName === 'dashboard') return false\n return resourceHeader && !isPersonPane(paneName)\n}\n"],"mappings":";AAcA,IAAaA,IAAe,CAAC,WAAW,QAAQ;AAEhD,SAAgBC,EAAc,GAA4B;CACxD,OAAOC,MAAa,KAAA,KAAaF,EAAa,SAASE,CAAQ;AACjE;AAGA,SAAgBC,EAAoB,GAA4B;CAC9D,OAAOF,EAAaC,CAAQ;AAC9B;AAqCA,SAAgBE,EAAe,GAAsC;CACnE,IAAM,EAAE,SAAM,mBAAgB,WAAQ,YAAS,UAAO,mBAAgBC,GAChEH,IAAWI,EAAK,MAIhBC,IAAeL,MAAa,aAAaA,MAAa,WACxDM,MAAU,KAAA,IACVN,MAAa,YAAYO,EAAY,MAAK,MAAO,CAACH,EAAK,WAAWI,MAAQJ,EAAK,OAAO,GACpFK,IAAWJ,KAAgB,CAACK,IAAiBJ,IAAQ,KAAA;CAO3D,OALKP,EAAaC,CAAQ,IAKnB;EACL,MAAMA,MAAa,YAAY,SAAS;EACxC,YAAYI,EAAK,YAAYC,IAAeC,IAAQ,KAAA,MAAcK;EAClE;CACF,IARM,CAACF,KAAYA,MAAaG,IAAe,EAAE,MAAM,OAAO,IACrD;EAAE,MAAM;EAAW,YAAYH;EAAU;CAAS;AAQ7D;AAUA,SAAgBI,EAAuB,GAAsB,GAAuC;CAClG,OAAO;EACL,UAAUT,EAAK,SAASU,IAAc,YAAY,KAAA;EAClD,SAASV,EAAK;CAChB;AACF;AAMA,SAAgBW,EACd,GACA,GACA,GACS;CAKT,OAJI,CAACC,EAAU,YAAYC,EAAK,aAAaD,EAAU,WAAiB,KACpEC,EAAK,aAAa,WACbD,EAAU,UAAUA,EAAU,YAAYC,EAAK,UAAUC,MAAqB,IAEhF;AACT;AAGA,SAAgBC,EACd,GACA,GACA,GACkB;CAClB,IAAMC,IAAUC,EAAM,QAAO,MAAQJ,EAAK,aAAajB,CAAQ;CAC/D,OAAOoB,EAAQ,MAAK,MAAQH,EAAK,YAAYK,CAAO,KAAKF,EAAQ;AACnE;AAGA,SAAgBG,EAAgB,GAAwF;CACtH,OAAOpB,EAAM,kBAAkBA,EAAM,cAAcA,EAAM;AAC3D;AAgBA,SAAgBqB,EAAmB,GAAsE;CACvG,OAAOrB,EAAM,kBAAkBA,EAAM,eAAe,CAACA,EAAM,WAAW,aAAa;AACrF;AAgBA,SAAgBsB,EAAsB,GAAqC;CAEzE,OADItB,EAAM,kBAAkBA,EAAM,UAAgB,KAC3C,CAACA,EAAM,iBAAiBA,EAAM;AACvC;AAMA,SAAgBuB,EACd,GACA,GACA,GACA,IAAO,IACE;CAET,OADI1B,MAAa,YAAYA,MAAa,sBAAsBA,MAAa,UAAUA,MAAa,cAAoB,KACjH2B,KAAkB,CAAC5B,EAAaC,CAAQ;AACjD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../utils/
|
|
1
|
+
const e=require("../utils/paneUtils.cjs.js"),t=require("./navbarVisibility.cjs.js"),n=require("./state.cjs.js"),r=require("../utils/webIdUtils.cjs.js"),i=require("./chrome.cjs.js"),a=require("./podContext.cjs.js");function o(o){let{store:s,outliner:c,byName:l,effects:u,podContextOf:d=a.getPodContext}=o,f=0;async function p(t){if(!t.uri.endsWith(`/`))return;let n=t.site().uri===t.uri,{storagePanes:r,viewerStorages:i}=await d(t.uri),a=r.some(e=>e.subject.uri===t.uri)||i.includes(t.uri);return n||a?e.getFolderPaneForStorage(t):void 0}async function m(e,t){let n=t?void 0:await d(e);return i.deriveStorageView({viaAccountMenu:t,inViewerPod:!!n&&a.isInViewerPod(n,e),hasOwner:!!n?.owner})}async function h(t,n){if(n.subject){let t=s.sym(n.subject);if(n.kind===`profile`)return e.getProfilePaneFromURI(t,l);if(n.kind===`friends`)return e.getSocialPaneFromURI(t,l);if(n.kind===`storage`)return e.getFolderPaneForStorage(t)}return n.pane?l(n.pane)??void 0:r.isWebIdUri(t)?e.getProfilePaneFromURI(t,l):p(t)}async function g(t,n,r){switch(t.kind){case`restore`:return h(n,r.view);case`profile`:return e.getProfilePaneFromURI(s.sym(t.subject),l);case`friends`:return e.getSocialPaneFromURI(s.sym(t.subject),l);case`storage`:return t.pane;case`app`:return l(t.pane)}}return{async show(e){let r=++f,i=n.readNavigationState(),a=e.kind===`restore`?i.viaAccountMenu?`accountMenu`:`default`:e.source??`default`;a===`accountMenu`&&t.setNavbarHidden(!0);let o=s.sym(e.kind===`restore`&&e.subject?e.subject:window.location.href),l=await g(e,o,i);if(r!==f)return;if(!l&&e.kind!==`restore`){console.warn(`Could not open the requested view for the logged-in user.`);return}let d=l&&l.name===`folder`?l.subject?.uri:void 0,p=d?await m(d,a===`accountMenu`):void 0;if(r===f){if(c.GotoSubject(o,!0,l??void 0,!0,void 0,void 0,p?{source:a,folderView:p}:{source:a}),a!==`accountMenu`){let{view:e}=n.readNavigationState();e.pane&&u.selectNavbarPane(e.pane,e.subject)}await u.refreshHeading(e.kind===`restore`&&e.forceHeading===!0)}}}}exports.createNavigationController=o;
|
|
2
2
|
//# sourceMappingURL=controller.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.cjs.js","names":["getPodContext","getFolderPaneForStorage","deriveStorageView","isInViewerPod","getProfilePaneFromURI","getSocialPaneFromURI","isWebIdUri","readNavigationState","
|
|
1
|
+
{"version":3,"file":"controller.cjs.js","names":["getPodContext","getFolderPaneForStorage","deriveStorageView","isInViewerPod","getProfilePaneFromURI","getSocialPaneFromURI","isWebIdUri","readNavigationState","require_paneUtils","require_navbarVisibility","require_state","require_webIdUtils","require_chrome","require_podContext","createNavigationController","deps","latest","storageAt","subject","isServerRoot","podContextOf","isStorage","storagePanes","pane","viewerStorages","folderViewFor","context","viaAccountMenu","storage","paneForView","view","paneSubject","store","byName","paneFor","intent","state","request","source","folderView","outliner","effects"],"sources":["../../src/navigation/controller.ts"],"sourcesContent":["/*\n * The one place that displays a view and brings the page chrome in line with it.\n *\n * The account menu, the navbar, a page load, Enter in the address bar, back and forward and a\n * layout change used to each resolve a pane, call `GotoSubject` and then do some of the follow-up\n * themselves. Now each describes what it wants as an intent, and the follow-up is always the same:\n * navbar visibility and selection, then the profile heading.\n */\n\nimport type { LiveStore, NamedNode } from 'rdflib'\nimport type { PaneDefinition } from 'pane-registry'\nimport type { OutlineManager } from '../outline/manager'\nimport { getFolderPaneForStorage, getProfilePaneFromURI, getSocialPaneFromURI, type PaneItem } from '../utils/paneUtils'\nimport { setNavbarHidden } from './navbarVisibility'\nimport { readNavigationState, type NavigationState, type NavigationView } from './state'\nimport type { FolderView, NavigationSource } from './options'\nimport { isWebIdUri } from '../utils/webIdUtils'\nimport { deriveStorageView } from './chrome'\nimport { getPodContext, isInViewerPod, type PodContext } from './podContext'\n\nexport type NavigationIntent =\n /** Display what the current history entry says was displayed, for the page's own URL. */\n | {\n kind: 'restore'\n /** The page subject, when it is not the current URL. */\n subject?: string\n /** Redo the heading even if it believes it already shows the right profile. */\n forceHeading?: boolean\n }\n /** A person's profile or friends, by WebID. */\n | { kind: 'profile' | 'friends', subject: string, source?: NavigationSource }\n /** A storage, as the navbar or the account menu offers it. */\n | { kind: 'storage', pane: PaneItem, source?: NavigationSource }\n /** A pane of the application itself, by registry name (dashboard, preferences). */\n | { kind: 'app', pane: string, source?: NavigationSource }\n\nexport interface NavigationEffects {\n selectNavbarPane: (paneName: string, paneUri?: string) => void\n refreshHeading: (force: boolean) => Promise<void>\n}\n\nexport interface NavigationDeps {\n store: LiveStore\n outliner: OutlineManager\n byName: (name: string) => PaneDefinition | null | undefined\n effects: NavigationEffects\n /** Whose pod a URL is in; `getPodContext` unless a test supplies its own. */\n podContextOf?: (url: string) => Promise<PodContext>\n}\n\nexport interface NavigationController {\n /**\n * Display what the intent asks for. If another intent arrives while this one is still\n * resolving its pane, only the later one is displayed.\n */\n show: (intent: NavigationIntent) => Promise<void>\n}\n\ntype DisplayedPane = PaneItem | PaneDefinition | null | undefined\n\nexport function createNavigationController (deps: NavigationDeps): NavigationController {\n const { store, outliner, byName, effects, podContextOf = getPodContext } = deps\n let latest = 0\n\n /** The storage pane for a page that is a storage of its pod, or the server root. */\n async function storageAt (subject: NamedNode): Promise<PaneItem | null | undefined> {\n if (!subject.uri.endsWith('/')) return undefined\n const isServerRoot = subject.site().uri === subject.uri\n const { storagePanes, viewerStorages } = await podContextOf(subject.uri)\n const isStorage = storagePanes.some(pane => pane.subject.uri === subject.uri) ||\n viewerStorages.includes(subject.uri)\n return isServerRoot || isStorage ? getFolderPaneForStorage(subject) : undefined\n }\n\n async function folderViewFor (storage: string, viaAccountMenu: boolean): Promise<FolderView> {\n const context = viaAccountMenu ? undefined : await podContextOf(storage)\n return deriveStorageView({\n viaAccountMenu,\n inViewerPod: !!context && isInViewerPod(context, storage),\n hasOwner: !!context?.owner\n })\n }\n\n async function paneForView (subject: NamedNode, view: NavigationView): Promise<DisplayedPane> {\n // These panes render a subject other than the page URL.\n if (view.subject) {\n const paneSubject = store.sym(view.subject)\n if (view.kind === 'profile') return getProfilePaneFromURI(paneSubject, byName)\n if (view.kind === 'friends') return getSocialPaneFromURI(paneSubject, byName)\n if (view.kind === 'storage') return getFolderPaneForStorage(paneSubject)\n }\n if (view.pane) return byName(view.pane) ?? undefined\n // With nothing recorded, the URL decides: a WebID shows its profile, a storage its storage view\n return isWebIdUri(subject) ? getProfilePaneFromURI(subject, byName) : storageAt(subject)\n }\n\n async function paneFor (intent: NavigationIntent, subject: NamedNode, state: NavigationState): Promise<DisplayedPane> {\n switch (intent.kind) {\n case 'restore': return paneForView(subject, state.view)\n case 'profile': return getProfilePaneFromURI(store.sym(intent.subject), byName)\n case 'friends': return getSocialPaneFromURI(store.sym(intent.subject), byName)\n case 'storage': return intent.pane\n case 'app': return byName(intent.pane)\n }\n }\n\n return {\n async show (intent) {\n const request = ++latest\n const state = readNavigationState()\n const source: NavigationSource = intent.kind === 'restore'\n ? (state.viaAccountMenu ? 'accountMenu' : 'default')\n : intent.source ?? 'default'\n // The account menu shows the viewer's own content, so the navbar for the page is not offered\n if (source === 'accountMenu') setNavbarHidden(true)\n\n const subject = store.sym(intent.kind === 'restore' && intent.subject ? intent.subject : window.location.href)\n const pane = await paneFor(intent, subject, state)\n if (request !== latest) return\n\n // Without a pane the outline would fall back to the page URL's own default view, which\n // is only right when restoring an entry that displayed nothing in particular.\n if (!pane && intent.kind !== 'restore') {\n console.warn('Could not open the requested view for the logged-in user.')\n return\n }\n\n const storage = pane && pane.name === 'folder' ? (pane as PaneItem).subject?.uri : undefined\n const folderView = storage ? await folderViewFor(storage, source === 'accountMenu') : undefined\n if (request !== latest) return\n\n outliner.GotoSubject(subject, true, pane ?? undefined, true, undefined, undefined, folderView ? { source, folderView } : { source })\n\n if (source !== 'accountMenu') {\n const { view } = readNavigationState()\n if (view.pane) effects.selectNavbarPane(view.pane, view.subject)\n }\n await effects.refreshHeading(intent.kind === 'restore' && intent.forceHeading === true)\n }\n }\n}\n"],"mappings":"A,sNA4DA,SAAgBc,EAA4B,EAA4C,CACtF,GAAM,CAAE,QAAO,WAAU,SAAQ,UAAS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,CAN6C,CAOrI,CACF,CACF,C"}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { getFolderPaneForStorage as e, getProfilePaneFromURI as t, getSocialPaneFromURI as n } from "../utils/paneUtils.esm.js";
|
|
2
|
+
import { setNavbarHidden as r } from "./navbarVisibility.esm.js";
|
|
3
|
+
import { readNavigationState as i } from "./state.esm.js";
|
|
4
|
+
import { isWebIdUri as a } from "../utils/webIdUtils.esm.js";
|
|
5
|
+
import { deriveStorageView as o } from "./chrome.esm.js";
|
|
6
|
+
import { getPodContext as s, isInViewerPod as c } from "./podContext.esm.js";
|
|
7
7
|
// src/navigation/controller.ts
|
|
8
8
|
function l(l) {
|
|
9
|
-
let { store: u, outliner: d, byName: f, effects: p, podContextOf: m =
|
|
10
|
-
async function g(
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
13
|
-
return
|
|
9
|
+
let { store: u, outliner: d, byName: f, effects: p, podContextOf: m = s } = l, h = 0;
|
|
10
|
+
async function g(t) {
|
|
11
|
+
if (!t.uri.endsWith("/")) return;
|
|
12
|
+
let n = t.site().uri === t.uri, { storagePanes: r, viewerStorages: i } = await m(t.uri), a = r.some((e) => e.subject.uri === t.uri) || i.includes(t.uri);
|
|
13
|
+
return n || a ? e(t) : void 0;
|
|
14
14
|
}
|
|
15
|
-
async function _(e,
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
viaAccountMenu:
|
|
19
|
-
inViewerPod: !!
|
|
20
|
-
hasOwner: !!
|
|
15
|
+
async function _(e, t) {
|
|
16
|
+
let n = t ? void 0 : await m(e);
|
|
17
|
+
return o({
|
|
18
|
+
viaAccountMenu: t,
|
|
19
|
+
inViewerPod: !!n && c(n, e),
|
|
20
|
+
hasOwner: !!n?.owner
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
async function v(
|
|
24
|
-
if (
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
23
|
+
async function v(r, i) {
|
|
24
|
+
if (i.subject) {
|
|
25
|
+
let r = u.sym(i.subject);
|
|
26
|
+
if (i.kind === "profile") return t(r, f);
|
|
27
|
+
if (i.kind === "friends") return n(r, f);
|
|
28
|
+
if (i.kind === "storage") return e(r);
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return i.pane ? f(i.pane) ?? void 0 : a(r) ? t(r, f) : g(r);
|
|
31
31
|
}
|
|
32
|
-
async function y(e,
|
|
32
|
+
async function y(e, r, i) {
|
|
33
33
|
switch (e.kind) {
|
|
34
|
-
case "restore": return v(
|
|
35
|
-
case "profile": return
|
|
36
|
-
case "friends": return
|
|
34
|
+
case "restore": return v(r, i.view);
|
|
35
|
+
case "profile": return t(u.sym(e.subject), f);
|
|
36
|
+
case "friends": return n(u.sym(e.subject), f);
|
|
37
37
|
case "storage": return e.pane;
|
|
38
38
|
case "app": return f(e.pane);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
return { async show(e) {
|
|
42
|
-
let t = ++h, n =
|
|
43
|
-
|
|
44
|
-
let
|
|
42
|
+
let t = ++h, n = i(), a = e.kind === "restore" ? n.viaAccountMenu ? "accountMenu" : "default" : e.source ?? "default";
|
|
43
|
+
a === "accountMenu" && r(!0);
|
|
44
|
+
let o = u.sym(e.kind === "restore" && e.subject ? e.subject : window.location.href), s = await y(e, o, n);
|
|
45
45
|
if (t !== h) return;
|
|
46
|
-
if (!
|
|
46
|
+
if (!s && e.kind !== "restore") {
|
|
47
47
|
console.warn("Could not open the requested view for the logged-in user.");
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
let
|
|
50
|
+
let c = s && s.name === "folder" ? s.subject?.uri : void 0, l = c ? await _(c, a === "accountMenu") : void 0;
|
|
51
51
|
if (t === h) {
|
|
52
|
-
if (d.GotoSubject(
|
|
53
|
-
source:
|
|
52
|
+
if (d.GotoSubject(o, !0, s ?? void 0, !0, void 0, void 0, l ? {
|
|
53
|
+
source: a,
|
|
54
54
|
folderView: l
|
|
55
|
-
} : { source:
|
|
56
|
-
let { view: e } =
|
|
55
|
+
} : { source: a }), a !== "accountMenu") {
|
|
56
|
+
let { view: e } = i();
|
|
57
57
|
e.pane && p.selectNavbarPane(e.pane, e.subject);
|
|
58
58
|
}
|
|
59
59
|
await p.refreshHeading(e.kind === "restore" && e.forceHeading === !0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../utils/webIdUtils.cjs.js"),t=require("../utils/
|
|
1
|
+
const e=require("../utils/webIdUtils.cjs.js"),t=require("../utils/paneUtils.cjs.js"),n=require("../utils/podUtils.cjs.js");let r=require("solid-logic"),i=require("rdflib");var a=500,o=new Map,s=new Map,c=new Map;function l(e){try{let t=new URL(e),[n=``]=t.pathname.split(`/`).filter(Boolean);return`${t.origin}|${n}`}catch{return e}}function u(e){return(0,i.sym)(e).doc().uri}function d(e,t,n,r,i){let o=e.get(t);if(o)return o;let s=r().catch(r=>(console.warn(`Could not load the ${n} for ${t}`,r),e.get(t)===s&&e.delete(t),i));return e.set(t,s),e.size>a&&e.delete(e.keys().next().value),s}function f(t){return d(o,u(t),`owner of the pod`,async()=>{let n=(0,i.sym)(t),r=await e.loadProfileFromURI(n);return r.uri===n.uri&&!e.isWebIdUri(n)?void 0:r.value},void 0)}function p(e,n){let r=n?(0,i.sym)(n):(0,i.sym)(e);return d(s,l(e),`storages of the pod`,()=>t.getFolderPanesFromURI(r),[])}function m(e){return e?d(c,e,`storages of the viewer`,async()=>(await n.getPodStorages((0,i.sym)(e))).map(e=>e.uri),[]):Promise.resolve([])}async function h(e=window.location.href){let t=r.authn.currentUser()?.value,[n,i]=await Promise.all([f(e),m(t)]);return{viewer:t,owner:n,storagePanes:await p(e,n),viewerStorages:i}}function g(){o.clear(),s.clear(),c.clear()}function _(e,t){return e.owner===t.owner&&e.viewer===t.viewer&&e.storagePanes.map(e=>e.subject.value).join()===t.storagePanes.map(e=>e.subject.value).join()}function v(e,t){return e.viewerStorages.some(e=>t.startsWith(e))}async function y(e){return v(await h(e),e)}exports.getPodContext=h,exports.isInViewerPod=v,exports.isPageInViewerPod=y,exports.isSamePod=_,exports.resetPodContexts=g;
|
|
2
2
|
//# sourceMappingURL=podContext.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"podContext.cjs.js","names":["sym","loadProfileFromURI","isWebIdUri","getFolderPanesFromURI","getPodStorages","authn","require_webIdUtils","
|
|
1
|
+
{"version":3,"file":"podContext.cjs.js","names":["sym","loadProfileFromURI","isWebIdUri","getFolderPanesFromURI","getPodStorages","authn","require_webIdUtils","require_paneUtils","require_podUtils","solid_logic","rdflib","MAX_REMEMBERED","owners","storages","viewerStorages","podKey","url","pageUrl","first","documentKey","remember","existing","cache","key","created","load","what","error","fallback","ownerOf","subject","webId","storagesOf","storageSubject","owner","storagesOfViewer","viewer","storage","getPodContext","ownStorages","resetPodContexts","isSamePod","a","b","pane","isInViewerPod","context","isPageInViewerPod"],"sources":["../../src/navigation/podContext.ts"],"sourcesContent":["/*\n * Whose pod the page is in, and which storages the viewer owns.\n *\n * Several parts of the page need this: the navbar builds its items from it, the profile heading\n * shows the owner, and the outline decides whether the file explorer header fits. Each part is\n * looked up once and cached, so they no longer each look it up, or read it back from each\n * other's DOM.\n */\n\nimport { authn } from 'solid-logic'\nimport { sym } from 'rdflib'\nimport { isWebIdUri, loadProfileFromURI } from '../utils/webIdUtils'\nimport { getFolderPanesFromURI, type PaneItem } from '../utils/paneUtils'\nimport { getPodStorages } from '../utils/podUtils'\n\nexport interface PodContext {\n /** WebID of the logged-in user. */\n viewer?: string\n /** WebID of the person whose pod the page is in; unknown when no profile could be found. */\n owner?: string\n /** The storages of that pod, as panes the navbar can open. */\n storagePanes: PaneItem[]\n /** The storages the viewer owns. */\n viewerStorages: string[]\n}\n\nconst MAX_REMEMBERED = 500\n\n// What was found depends on different parts of the URL, so each part is remembered on its own:\n// - the owner depends on the document: the profile lookup can end with that document's own\n// foaf:primaryTopic, so two pages of one pod may not share an owner\n// - the storages depend on the pod, derived from the origin and the first path segment\n// - the viewer's storages depend only on who the viewer is\nconst owners = new Map<string, Promise<string | undefined>>()\nconst storages = new Map<string, Promise<PaneItem[]>>()\nconst viewerStorages = new Map<string, Promise<string[]>>()\n\nfunction podKey (pageUrl: string): string {\n try {\n const url = new URL(pageUrl)\n const [first = ''] = url.pathname.split('/').filter(Boolean)\n return `${url.origin}|${first}`\n } catch {\n return pageUrl\n }\n}\n\nfunction documentKey (pageUrl: string): string {\n return sym(pageUrl).doc().uri\n}\n\n/**\n * Remembers a lookup, unless it failed: a failure is not kept, so that the next request asks again.\n */\nfunction remember<T> (\n cache: Map<string, Promise<T>>,\n key: string,\n what: string,\n load: () => Promise<T>,\n fallback: T\n): Promise<T> {\n const existing = cache.get(key)\n if (existing) return existing\n\n const created: Promise<T> = load().catch(error => {\n console.warn(`Could not load the ${what} for ${key}`, error)\n if (cache.get(key) === created) cache.delete(key)\n return fallback\n })\n cache.set(key, created)\n if (cache.size > MAX_REMEMBERED) cache.delete(cache.keys().next().value as string)\n return created\n}\n\nfunction ownerOf (pageUrl: string): Promise<string | undefined> {\n return remember(owners, documentKey(pageUrl), 'owner of the pod', async () => {\n const subject = sym(pageUrl)\n const webId = await loadProfileFromURI(subject)\n // The lookup falls back to the URL itself when it finds no profile\n return webId.uri === subject.uri && !isWebIdUri(subject) ? undefined : webId.value\n }, undefined)\n}\n\nfunction storagesOf (pageUrl: string, owner?: string): Promise<PaneItem[]> {\n const storageSubject = owner ? sym(owner) : sym(pageUrl)\n return remember(storages, podKey(pageUrl), 'storages of the pod', () => getFolderPanesFromURI(storageSubject), [])\n}\n\nfunction storagesOfViewer (viewer: string | undefined): Promise<string[]> {\n if (!viewer) return Promise.resolve([])\n return remember(viewerStorages, viewer, 'storages of the viewer', async () => {\n return (await getPodStorages(sym(viewer))).map(storage => storage.uri)\n }, [])\n}\n\n/** The context for the pod a URL is in; the page's own URL by default. */\nexport async function getPodContext (pageUrl: string = window.location.href): Promise<PodContext> {\n const viewer = authn.currentUser()?.value\n const [owner, ownStorages] = await Promise.all([\n ownerOf(pageUrl), storagesOfViewer(viewer)\n ])\n const storagePanes = await storagesOf(pageUrl, owner)\n return { viewer, owner, storagePanes, viewerStorages: ownStorages }\n}\n\n/** Forget what was loaded, for example when tests start over. */\nexport function resetPodContexts (): void {\n owners.clear()\n storages.clear()\n viewerStorages.clear()\n}\n\n/** Whether two contexts describe the same pod, so that a navbar built from one fits the other. */\nexport function isSamePod (a: PodContext, b: PodContext): boolean {\n return a.owner === b.owner && a.viewer === b.viewer &&\n a.storagePanes.map(pane => pane.subject.value).join() === b.storagePanes.map(pane => pane.subject.value).join()\n}\n\nexport function isInViewerPod (context: PodContext, url: string): boolean {\n return context.viewerStorages.some(storage => url.startsWith(storage))\n}\n\n/** Whether the URL lies within one of the viewer's own storages. */\nexport async function isPageInViewerPod (url: string): Promise<boolean> {\n return isInViewerPod(await getPodContext(url), url)\n}\n"],"mappings":"A,4KA0BA,IAAMW,EAAiB,IAOjBC,EAAS,IAAI,IACbC,EAAW,IAAI,IACfC,EAAiB,IAAI,IAE3B,SAASC,EAAQ,EAAyB,CACxC,GAAI,CACF,IAAMC,EAAM,IAAI,IAAIC,CAAO,EACrB,CAACC,EAAQ,IAAMF,EAAI,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,EAC3D,MAAO,GAAGA,EAAI,OAAO,GAAGE,GAC1B,MAAQ,CACN,OAAOD,CACT,CACF,CAEA,SAASE,EAAa,EAAyB,CAC7C,OAAA,EAAOnB,EAAAA,IAAAA,CAAIiB,CAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAC5B,CAKA,SAASG,EACP,EACA,EACA,EACA,EACA,EACY,CACZ,IAAMC,EAAWC,EAAM,IAAIC,CAAG,EAC9B,GAAIF,EAAU,OAAOA,EAErB,IAA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AAOK,GAAe,MAAM,QAAQ,IAAI,CAC7CV,EAAQZ,CAAO,EAAGkB,EAAiBC,CAAM,CAC3C,CAAC,EAED,MAAO,CAAE,SAAQ,QAAO,aAAA,MADGJ,EAAWf,EAASiB,CAAK,EACd,eAAgBK,CAAY,CACpE,CAGA,SAAgBC,GAA0B,CACxC5B,EAAO,MAAM,EACbC,EAAS,MAAM,EACfC,EAAe,MAAM,CACvB,CAGA,SAAgB2B,EAAW,EAAe,EAAwB,CAChE,OAAOC,EAAE,QAAUC,EAAE,OAASD,EAAE,SAAWC,EAAE,QAC3CD,EAAE,aAAa,IAAI,GAAQE,EAAK,QAAQ,KAAK,CAAC,CAAC,KAAK,IAAMD,EAAE,aAAa,IAAI,GAAQC,EAAK,QAAQ,KAAK,CAAC,CAAC,KAAK,CAClH,CAEA,SAAgBC,EAAe,EAAqB,EAAsB,CACxE,OAAOC,EAAQ,eAAe,KAAK,GAAW9B,EAAI,WAAWqB,CAAO,CAAC,CACvE,CAGA,eAAsBU,EAAmB,EAA+B,CACtE,OAAOF,EAAc,MAAMP,EAActB,CAAG,EAAGA,CAAG,CACpD,C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isWebIdUri as e, loadProfileFromURI as t } from "../utils/webIdUtils.esm.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getFolderPanesFromURI as n } from "../utils/paneUtils.esm.js";
|
|
3
|
+
import { getPodStorages as r } from "../utils/podUtils.esm.js";
|
|
4
4
|
import { authn as i } from "solid-logic";
|
|
5
5
|
import { sym as a } from "rdflib";
|
|
6
6
|
// src/navigation/podContext.ts
|
|
@@ -29,11 +29,11 @@ function p(n) {
|
|
|
29
29
|
}, void 0);
|
|
30
30
|
}
|
|
31
31
|
function m(e, t) {
|
|
32
|
-
let
|
|
33
|
-
return f(c, u(e), "storages of the pod", () => r
|
|
32
|
+
let r = a(t || e);
|
|
33
|
+
return f(c, u(e), "storages of the pod", () => n(r), []);
|
|
34
34
|
}
|
|
35
35
|
function h(e) {
|
|
36
|
-
return e ? f(l, e, "storages of the viewer", async () => (await
|
|
36
|
+
return e ? f(l, e, "storages of the viewer", async () => (await r(a(e))).map((e) => e.uri), []) : Promise.resolve([]);
|
|
37
37
|
}
|
|
38
38
|
async function g(e = window.location.href) {
|
|
39
39
|
let t = i.currentUser()?.value, [n, r] = await Promise.all([p(e), h(t)]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={profile:`profile`,social:`friends`,folder:`storage`};function t(e){return typeof e==`object`&&e?e:{}}function n(t,n){return t?{kind:e[t]??`pane`,pane:t,...n?{subject:n}:{}}:{kind:`default`}}function r(e){let{paneName:r,paneUri:i,viaAccountMenu:a}=t(e);return{view:n(typeof r==`string`&&r?r:void 0,typeof i==`string`&&i?i:void 0),viaAccountMenu:a===!0}}function i(){return r(window.history.state)}function a(e,n){let r={...t(e)};return n.pane&&(r.paneName=n.pane.name,typeof n.pane.subject==`string`&&(r.paneUri=n.pane.subject)),n.leavingPage&&!n.pane&&delete r.paneName,(n.leavingPage&&!n.pane||n.pane&&!n.pane.subject)&&delete r.paneUri,n.viaAccountMenu?r.viaAccountMenu=!0:delete r.viaAccountMenu,r}function
|
|
1
|
+
var e={profile:`profile`,social:`friends`,folder:`storage`};function t(e){return typeof e==`object`&&e?e:{}}function n(t,n){return t?{kind:e[t]??`pane`,pane:t,...n?{subject:n}:{}}:{kind:`default`}}function r(e){let{paneName:r,paneUri:i,viaAccountMenu:a}=t(e);return{view:n(typeof r==`string`&&r?r:void 0,typeof i==`string`&&i?i:void 0),viaAccountMenu:a===!0}}function i(){return r(window.history.state)}var a=new WeakMap;function o(e){return(a.get(e)??0)>0}function s(e,t,n,r,i){a.set(e,(a.get(e)??0)+1);try{e[t](n,r,i)}finally{let t=(a.get(e)??1)-1;t?a.set(e,t):a.delete(e)}}function c(e,n){let r={...t(e)};return n.pane&&(r.paneName=n.pane.name,typeof n.pane.subject==`string`&&(r.paneUri=n.pane.subject)),n.leavingPage&&!n.pane&&delete r.paneName,(n.leavingPage&&!n.pane||n.pane&&!n.pane.subject)&&delete r.paneUri,n.viaAccountMenu?r.viaAccountMenu=!0:delete r.viaAccountMenu,r}function l(e){let{paneName:n,paneUri:r,viaAccountMenu:i,...a}=t(e);return a}function u(){s(window.history,`replaceState`,l(window.history.state),``,window.location.href)}exports.clearPaneState=u,exports.isWritingNavigationHistory=o,exports.nextHistoryState=c,exports.parseNavigationState=r,exports.readNavigationState=i,exports.viewFromPane=n,exports.withoutPaneState=l,exports.writeNavigationHistory=s;
|
|
2
2
|
//# sourceMappingURL=state.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.cjs.js","names":["KIND_BY_PANE","asRecord","raw","viewFromPane","pane","subject","parseNavigationState","paneName","paneUri","viaAccountMenu","readNavigationState","nextHistoryState","next","current","change","withoutPaneState","rest","clearPaneState"],"sources":["../../src/navigation/state.ts"],"sourcesContent":["/*\n * What a history entry records about the view that was displayed.\n *\n * This is the only module that knows how that is stored in `history.state`; everything\n * else works with `NavigationState`. The stored fields are `paneName`, `paneUri` and\n * `viaAccountMenu`, next to whatever other keys the entry carries.\n */\n\nexport type ViewKind = 'default' | 'profile' | 'friends' | 'storage' | 'pane'\n\nexport interface NavigationView {\n kind: ViewKind\n /** Registry name of the displayed pane. Always set unless the kind is `default`. */\n pane?: string\n /** What the pane displays when that is not the page URL (a profile, friends list or storage). */\n subject?: string\n}\n\nexport interface NavigationState {\n view: NavigationView\n /** The account menu opened the view: it shows the viewer's own content under the page URL. */\n viaAccountMenu: boolean\n}\n\nconst KIND_BY_PANE: Record<string, ViewKind> = {\n profile: 'profile',\n social: 'friends',\n folder: 'storage'\n}\n\nfunction asRecord (raw: unknown): Record<string, unknown> {\n return raw !== null && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n}\n\nexport function viewFromPane (pane?: string, subject?: string): NavigationView {\n if (!pane) return { kind: 'default' }\n return { kind: KIND_BY_PANE[pane] ?? 'pane', pane, ...(subject ? { subject } : {}) }\n}\n\nexport function parseNavigationState (raw: unknown): NavigationState {\n const { paneName, paneUri, viaAccountMenu } = asRecord(raw)\n return {\n view: viewFromPane(\n typeof paneName === 'string' && paneName ? paneName : undefined,\n typeof paneUri === 'string' && paneUri ? paneUri : undefined\n ),\n viaAccountMenu: viaAccountMenu === true\n }\n}\n\nexport function readNavigationState (): NavigationState {\n return parseNavigationState(window.history.state)\n}\n\nexport interface HistoryStateChange {\n /** The pane that is being displayed, and its own subject if it has one. */\n pane?: { name: string, subject?: string }\n /** The entry is for a different URL than the current one. */\n leavingPage: boolean\n /** The account menu is displaying it. */\n viaAccountMenu: boolean\n}\n\n/**\n * The state to store for an entry after displaying something.\n *\n * Pane details describe what was displayed, so they must not leak into the entry of\n * another URL, nor outlive the pane they were saved for. The account-menu marker\n * keeps a later page load from restoring the viewer's content over the URL's subject.\n */\nexport function nextHistoryState (current: unknown, change: HistoryStateChange): Record<string, unknown> {\n const next: Record<string, unknown> = { ...asRecord(current) }\n\n if (change.pane) {\n next.paneName = change.pane.name\n if (typeof change.pane.subject === 'string') next.paneUri = change.pane.subject\n }\n if (change.leavingPage && !change.pane) delete next.paneName\n if ((change.leavingPage && !change.pane) || (change.pane && !change.pane.subject)) delete next.paneUri\n\n if (change.viaAccountMenu) next.viaAccountMenu = true\n else delete next.viaAccountMenu\n\n return next\n}\n\n/** The state without anything about the displayed pane. */\nexport function withoutPaneState (raw: unknown): Record<string, unknown> {\n const { paneName, paneUri, viaAccountMenu, ...rest } = asRecord(raw)\n return rest\n}\n\n/** Forget what the current entry displayed, so the URL alone decides what to show. */\nexport function clearPaneState (): void {\n window.history
|
|
1
|
+
{"version":3,"file":"state.cjs.js","names":["KIND_BY_PANE","asRecord","raw","viewFromPane","pane","subject","parseNavigationState","paneName","paneUri","viaAccountMenu","readNavigationState","historyWrites","isWritingNavigationHistory","history","writeNavigationHistory","method","state","title","url","remaining","nextHistoryState","next","current","change","withoutPaneState","rest","clearPaneState"],"sources":["../../src/navigation/state.ts"],"sourcesContent":["/*\n * What a history entry records about the view that was displayed.\n *\n * This is the only module that knows how that is stored in `history.state`; everything\n * else works with `NavigationState`. The stored fields are `paneName`, `paneUri` and\n * `viaAccountMenu`, next to whatever other keys the entry carries.\n */\n\nexport type ViewKind = 'default' | 'profile' | 'friends' | 'storage' | 'pane'\n\nexport interface NavigationView {\n kind: ViewKind\n /** Registry name of the displayed pane. Always set unless the kind is `default`. */\n pane?: string\n /** What the pane displays when that is not the page URL (a profile, friends list or storage). */\n subject?: string\n}\n\nexport interface NavigationState {\n view: NavigationView\n /** The account menu opened the view: it shows the viewer's own content under the page URL. */\n viaAccountMenu: boolean\n}\n\nconst KIND_BY_PANE: Record<string, ViewKind> = {\n profile: 'profile',\n social: 'friends',\n folder: 'storage'\n}\n\nfunction asRecord (raw: unknown): Record<string, unknown> {\n return raw !== null && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n}\n\nexport function viewFromPane (pane?: string, subject?: string): NavigationView {\n if (!pane) return { kind: 'default' }\n return { kind: KIND_BY_PANE[pane] ?? 'pane', pane, ...(subject ? { subject } : {}) }\n}\n\nexport function parseNavigationState (raw: unknown): NavigationState {\n const { paneName, paneUri, viaAccountMenu } = asRecord(raw)\n return {\n view: viewFromPane(\n typeof paneName === 'string' && paneName ? paneName : undefined,\n typeof paneUri === 'string' && paneUri ? paneUri : undefined\n ),\n viaAccountMenu: viaAccountMenu === true\n }\n}\n\nexport function readNavigationState (): NavigationState {\n return parseNavigationState(window.history.state)\n}\n\nconst historyWrites = new WeakMap<History, number>()\n\n/** Whether a synchronous history write is being made by this application. */\nexport function isWritingNavigationHistory (history: History): boolean {\n return (historyWrites.get(history) ?? 0) > 0\n}\n\n/** Write an entry without treating its synchronous Navigation API event as browser navigation. */\nexport function writeNavigationHistory (\n history: History,\n method: 'pushState' | 'replaceState',\n state: unknown,\n title: string,\n url?: string\n): void {\n historyWrites.set(history, (historyWrites.get(history) ?? 0) + 1)\n try {\n history[method](state, title, url)\n } finally {\n const remaining = (historyWrites.get(history) ?? 1) - 1\n if (remaining) historyWrites.set(history, remaining)\n else historyWrites.delete(history)\n }\n}\n\nexport interface HistoryStateChange {\n /** The pane that is being displayed, and its own subject if it has one. */\n pane?: { name: string, subject?: string }\n /** The entry is for a different URL than the current one. */\n leavingPage: boolean\n /** The account menu is displaying it. */\n viaAccountMenu: boolean\n}\n\n/**\n * The state to store for an entry after displaying something.\n *\n * Pane details describe what was displayed, so they must not leak into the entry of\n * another URL, nor outlive the pane they were saved for. The account-menu marker\n * keeps a later page load from restoring the viewer's content over the URL's subject.\n */\nexport function nextHistoryState (current: unknown, change: HistoryStateChange): Record<string, unknown> {\n const next: Record<string, unknown> = { ...asRecord(current) }\n\n if (change.pane) {\n next.paneName = change.pane.name\n if (typeof change.pane.subject === 'string') next.paneUri = change.pane.subject\n }\n if (change.leavingPage && !change.pane) delete next.paneName\n if ((change.leavingPage && !change.pane) || (change.pane && !change.pane.subject)) delete next.paneUri\n\n if (change.viaAccountMenu) next.viaAccountMenu = true\n else delete next.viaAccountMenu\n\n return next\n}\n\n/** The state without anything about the displayed pane. */\nexport function withoutPaneState (raw: unknown): Record<string, unknown> {\n const { paneName, paneUri, viaAccountMenu, ...rest } = asRecord(raw)\n return rest\n}\n\n/** Forget what the current entry displayed, so the URL alone decides what to show. */\nexport function clearPaneState (): void {\n writeNavigationHistory(window.history, 'replaceState', withoutPaneState(window.history.state), '', window.location.href)\n}\n"],"mappings":"AAwBA,IAAMA,EAAyC,CAC7C,QAAS,UACT,OAAQ,UACR,OAAQ,SACV,EAEA,SAASC,EAAU,EAAuC,CACxD,OAAuB,OAAOC,GAAQ,UAA/BA,EAA0CA,EAAiC,CAAC,CACrF,CAEA,SAAgBC,EAAc,EAAe,EAAkC,CAE7E,OADKC,EACE,CAAE,KAAMJ,EAAaI,IAAS,OAAQ,OAAM,GAAIC,EAAU,CAAE,SAAQ,EAAI,CAAC,CAAG,EADjE,CAAE,KAAM,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CAAG,EACnE,OAAOuB,CACT,CAGA,SAAgBC,GAAwB,CACtCZ,EAAuB,OAAO,QAAS,eAAgBU,EAAiB,OAAO,QAAQ,KAAK,EAAG,GAAI,OAAO,SAAS,IAAI,CACzH,C"}
|
|
@@ -14,6 +14,10 @@ export interface NavigationState {
|
|
|
14
14
|
export declare function viewFromPane(pane?: string, subject?: string): NavigationView;
|
|
15
15
|
export declare function parseNavigationState(raw: unknown): NavigationState;
|
|
16
16
|
export declare function readNavigationState(): NavigationState;
|
|
17
|
+
/** Whether a synchronous history write is being made by this application. */
|
|
18
|
+
export declare function isWritingNavigationHistory(history: History): boolean;
|
|
19
|
+
/** Write an entry without treating its synchronous Navigation API event as browser navigation. */
|
|
20
|
+
export declare function writeNavigationHistory(history: History, method: 'pushState' | 'replaceState', state: unknown, title: string, url?: string): void;
|
|
17
21
|
export interface HistoryStateChange {
|
|
18
22
|
/** The pane that is being displayed, and its own subject if it has one. */
|
|
19
23
|
pane?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/navigation/state.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAE7E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAA;IACd,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAA;IACpB,8FAA8F;IAC9F,cAAc,EAAE,OAAO,CAAA;CACxB;AAYD,wBAAgB,YAAY,CAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAG7E;AAED,wBAAgB,oBAAoB,CAAE,GAAG,EAAE,OAAO,GAAG,eAAe,CASnE;AAED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A6E;AAC7E,wBAAgB,0BAA0B,CAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAErE;AAED,kGAAkG;AAClG,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,GAAG,cAAc,EACpC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,GACX,IAAI,CASN;AAED,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,6DAA6D;IAC7D,WAAW,EAAE,OAAO,CAAA;IACpB,yCAAyC;IACzC,cAAc,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAcvG;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGvE;AAED,sFAAsF;AACtF,wBAAgB,cAAc,IAAK,IAAI,CAEtC"}
|
|
@@ -24,17 +24,30 @@ function r(e) {
|
|
|
24
24
|
function i() {
|
|
25
25
|
return r(window.history.state);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
var a = /* @__PURE__ */ new WeakMap();
|
|
28
|
+
function o(e) {
|
|
29
|
+
return (a.get(e) ?? 0) > 0;
|
|
30
|
+
}
|
|
31
|
+
function s(e, t, n, r, i) {
|
|
32
|
+
a.set(e, (a.get(e) ?? 0) + 1);
|
|
33
|
+
try {
|
|
34
|
+
e[t](n, r, i);
|
|
35
|
+
} finally {
|
|
36
|
+
let t = (a.get(e) ?? 1) - 1;
|
|
37
|
+
t ? a.set(e, t) : a.delete(e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function c(e, n) {
|
|
28
41
|
let r = { ...t(e) };
|
|
29
42
|
return n.pane && (r.paneName = n.pane.name, typeof n.pane.subject == "string" && (r.paneUri = n.pane.subject)), n.leavingPage && !n.pane && delete r.paneName, (n.leavingPage && !n.pane || n.pane && !n.pane.subject) && delete r.paneUri, n.viaAccountMenu ? r.viaAccountMenu = !0 : delete r.viaAccountMenu, r;
|
|
30
43
|
}
|
|
31
|
-
function
|
|
44
|
+
function l(e) {
|
|
32
45
|
let { paneName: n, paneUri: r, viaAccountMenu: i, ...a } = t(e);
|
|
33
46
|
return a;
|
|
34
47
|
}
|
|
35
|
-
function
|
|
36
|
-
window.history
|
|
48
|
+
function u() {
|
|
49
|
+
s(window.history, "replaceState", l(window.history.state), "", window.location.href);
|
|
37
50
|
}
|
|
38
|
-
export {
|
|
51
|
+
export { u as clearPaneState, o as isWritingNavigationHistory, c as nextHistoryState, r as parseNavigationState, i as readNavigationState, n as viewFromPane, l as withoutPaneState, s as writeNavigationHistory };
|
|
39
52
|
|
|
40
53
|
//# sourceMappingURL=state.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.esm.js","names":["KIND_BY_PANE","asRecord","raw","viewFromPane","pane","subject","parseNavigationState","paneName","paneUri","viaAccountMenu","readNavigationState","nextHistoryState","next","current","change","withoutPaneState","rest","clearPaneState"],"sources":["../../src/navigation/state.ts"],"sourcesContent":["/*\n * What a history entry records about the view that was displayed.\n *\n * This is the only module that knows how that is stored in `history.state`; everything\n * else works with `NavigationState`. The stored fields are `paneName`, `paneUri` and\n * `viaAccountMenu`, next to whatever other keys the entry carries.\n */\n\nexport type ViewKind = 'default' | 'profile' | 'friends' | 'storage' | 'pane'\n\nexport interface NavigationView {\n kind: ViewKind\n /** Registry name of the displayed pane. Always set unless the kind is `default`. */\n pane?: string\n /** What the pane displays when that is not the page URL (a profile, friends list or storage). */\n subject?: string\n}\n\nexport interface NavigationState {\n view: NavigationView\n /** The account menu opened the view: it shows the viewer's own content under the page URL. */\n viaAccountMenu: boolean\n}\n\nconst KIND_BY_PANE: Record<string, ViewKind> = {\n profile: 'profile',\n social: 'friends',\n folder: 'storage'\n}\n\nfunction asRecord (raw: unknown): Record<string, unknown> {\n return raw !== null && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n}\n\nexport function viewFromPane (pane?: string, subject?: string): NavigationView {\n if (!pane) return { kind: 'default' }\n return { kind: KIND_BY_PANE[pane] ?? 'pane', pane, ...(subject ? { subject } : {}) }\n}\n\nexport function parseNavigationState (raw: unknown): NavigationState {\n const { paneName, paneUri, viaAccountMenu } = asRecord(raw)\n return {\n view: viewFromPane(\n typeof paneName === 'string' && paneName ? paneName : undefined,\n typeof paneUri === 'string' && paneUri ? paneUri : undefined\n ),\n viaAccountMenu: viaAccountMenu === true\n }\n}\n\nexport function readNavigationState (): NavigationState {\n return parseNavigationState(window.history.state)\n}\n\nexport interface HistoryStateChange {\n /** The pane that is being displayed, and its own subject if it has one. */\n pane?: { name: string, subject?: string }\n /** The entry is for a different URL than the current one. */\n leavingPage: boolean\n /** The account menu is displaying it. */\n viaAccountMenu: boolean\n}\n\n/**\n * The state to store for an entry after displaying something.\n *\n * Pane details describe what was displayed, so they must not leak into the entry of\n * another URL, nor outlive the pane they were saved for. The account-menu marker\n * keeps a later page load from restoring the viewer's content over the URL's subject.\n */\nexport function nextHistoryState (current: unknown, change: HistoryStateChange): Record<string, unknown> {\n const next: Record<string, unknown> = { ...asRecord(current) }\n\n if (change.pane) {\n next.paneName = change.pane.name\n if (typeof change.pane.subject === 'string') next.paneUri = change.pane.subject\n }\n if (change.leavingPage && !change.pane) delete next.paneName\n if ((change.leavingPage && !change.pane) || (change.pane && !change.pane.subject)) delete next.paneUri\n\n if (change.viaAccountMenu) next.viaAccountMenu = true\n else delete next.viaAccountMenu\n\n return next\n}\n\n/** The state without anything about the displayed pane. */\nexport function withoutPaneState (raw: unknown): Record<string, unknown> {\n const { paneName, paneUri, viaAccountMenu, ...rest } = asRecord(raw)\n return rest\n}\n\n/** Forget what the current entry displayed, so the URL alone decides what to show. */\nexport function clearPaneState (): void {\n window.history
|
|
1
|
+
{"version":3,"file":"state.esm.js","names":["KIND_BY_PANE","asRecord","raw","viewFromPane","pane","subject","parseNavigationState","paneName","paneUri","viaAccountMenu","readNavigationState","historyWrites","isWritingNavigationHistory","history","writeNavigationHistory","method","state","title","url","remaining","nextHistoryState","next","current","change","withoutPaneState","rest","clearPaneState"],"sources":["../../src/navigation/state.ts"],"sourcesContent":["/*\n * What a history entry records about the view that was displayed.\n *\n * This is the only module that knows how that is stored in `history.state`; everything\n * else works with `NavigationState`. The stored fields are `paneName`, `paneUri` and\n * `viaAccountMenu`, next to whatever other keys the entry carries.\n */\n\nexport type ViewKind = 'default' | 'profile' | 'friends' | 'storage' | 'pane'\n\nexport interface NavigationView {\n kind: ViewKind\n /** Registry name of the displayed pane. Always set unless the kind is `default`. */\n pane?: string\n /** What the pane displays when that is not the page URL (a profile, friends list or storage). */\n subject?: string\n}\n\nexport interface NavigationState {\n view: NavigationView\n /** The account menu opened the view: it shows the viewer's own content under the page URL. */\n viaAccountMenu: boolean\n}\n\nconst KIND_BY_PANE: Record<string, ViewKind> = {\n profile: 'profile',\n social: 'friends',\n folder: 'storage'\n}\n\nfunction asRecord (raw: unknown): Record<string, unknown> {\n return raw !== null && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n}\n\nexport function viewFromPane (pane?: string, subject?: string): NavigationView {\n if (!pane) return { kind: 'default' }\n return { kind: KIND_BY_PANE[pane] ?? 'pane', pane, ...(subject ? { subject } : {}) }\n}\n\nexport function parseNavigationState (raw: unknown): NavigationState {\n const { paneName, paneUri, viaAccountMenu } = asRecord(raw)\n return {\n view: viewFromPane(\n typeof paneName === 'string' && paneName ? paneName : undefined,\n typeof paneUri === 'string' && paneUri ? paneUri : undefined\n ),\n viaAccountMenu: viaAccountMenu === true\n }\n}\n\nexport function readNavigationState (): NavigationState {\n return parseNavigationState(window.history.state)\n}\n\nconst historyWrites = new WeakMap<History, number>()\n\n/** Whether a synchronous history write is being made by this application. */\nexport function isWritingNavigationHistory (history: History): boolean {\n return (historyWrites.get(history) ?? 0) > 0\n}\n\n/** Write an entry without treating its synchronous Navigation API event as browser navigation. */\nexport function writeNavigationHistory (\n history: History,\n method: 'pushState' | 'replaceState',\n state: unknown,\n title: string,\n url?: string\n): void {\n historyWrites.set(history, (historyWrites.get(history) ?? 0) + 1)\n try {\n history[method](state, title, url)\n } finally {\n const remaining = (historyWrites.get(history) ?? 1) - 1\n if (remaining) historyWrites.set(history, remaining)\n else historyWrites.delete(history)\n }\n}\n\nexport interface HistoryStateChange {\n /** The pane that is being displayed, and its own subject if it has one. */\n pane?: { name: string, subject?: string }\n /** The entry is for a different URL than the current one. */\n leavingPage: boolean\n /** The account menu is displaying it. */\n viaAccountMenu: boolean\n}\n\n/**\n * The state to store for an entry after displaying something.\n *\n * Pane details describe what was displayed, so they must not leak into the entry of\n * another URL, nor outlive the pane they were saved for. The account-menu marker\n * keeps a later page load from restoring the viewer's content over the URL's subject.\n */\nexport function nextHistoryState (current: unknown, change: HistoryStateChange): Record<string, unknown> {\n const next: Record<string, unknown> = { ...asRecord(current) }\n\n if (change.pane) {\n next.paneName = change.pane.name\n if (typeof change.pane.subject === 'string') next.paneUri = change.pane.subject\n }\n if (change.leavingPage && !change.pane) delete next.paneName\n if ((change.leavingPage && !change.pane) || (change.pane && !change.pane.subject)) delete next.paneUri\n\n if (change.viaAccountMenu) next.viaAccountMenu = true\n else delete next.viaAccountMenu\n\n return next\n}\n\n/** The state without anything about the displayed pane. */\nexport function withoutPaneState (raw: unknown): Record<string, unknown> {\n const { paneName, paneUri, viaAccountMenu, ...rest } = asRecord(raw)\n return rest\n}\n\n/** Forget what the current entry displayed, so the URL alone decides what to show. */\nexport function clearPaneState (): void {\n writeNavigationHistory(window.history, 'replaceState', withoutPaneState(window.history.state), '', window.location.href)\n}\n"],"mappings":";AAwBA,I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A,EAAO,KAAK,WAEtEA,EAAO,eAAe,CAACA,EAAO,QAAM,OAAOF,EAAK,WAC/CE,EAAO,eAAe,CAACA,EAAO,QAAUA,EAAO,QAAQ,CAACA,EAAO,KAAK,YAAU,OAAOF,EAAK,SAE3FE,EAAO,iBAAgB,EAAK,iBAAiB,KAC5C,OAAOF,EAAK,gBAEVA;AACT;AAGA,SAAgBG,EAAkB,GAAuC;CACvE,IAAM,EAAE,aAAU,YAAS,mBAAgB,GAAGC,MAASxB,EAASC,CAAG;CACnE,OAAOuB;AACT;AAGA,SAAgBC,IAAwB;CACtC,EAAuB,OAAO,SAAS,gBAAgBF,EAAiB,OAAO,QAAQ,KAAK,GAAG,IAAI,OAAO,SAAS,IAAI;AACzH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_virtual/_rolldown/runtime.cjs.js"),t=require("../icons/person.cjs.js"),n=require("../icons/friends.cjs.js");let r=require("solid-ui");r=e.__toESM(r);function i(e,t,n){if(e)return typeof e.icon==`function`?e.icon(t,n):e.icon}async function a(e,a,o
|
|
1
|
+
const e=require("../_virtual/_rolldown/runtime.cjs.js"),t=require("../icons/person.cjs.js"),n=require("../icons/friends.cjs.js");let r=require("solid-ui");r=e.__toESM(r);function i(e,t,n){if(e)return typeof e.icon==`function`?e.icon(t,n):e.icon}async function a(e,i,a,o){return typeof o==`function`?r.preparePaneMenuItems({subject:e,context:i,panes:a,iconOverrides:{profile:()=>t.default,social:()=>n.default},openPane:(e,t)=>o(e,t)}):[]}exports.getPaneIcon=i,exports.getPaneItems=a;
|
|
2
2
|
//# sourceMappingURL=fileExplorerHelpers.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileExplorerHelpers.cjs.js","names":["
|
|
1
|
+
{"version":3,"file":"fileExplorerHelpers.cjs.js","names":["UI","personIcon","friendsIcon","require_runtime","require_person","require_friends","solid_ui","getPaneIcon","pane","subject","context","getPaneItems","dispatchOpenPane","relevantPanes","paneSubject","paneName"],"sources":["../../src/outline/fileExplorerHelpers.ts"],"sourcesContent":["import * as UI from 'solid-ui'\nimport type { DataBrowserContext, PaneDefinition } from 'pane-registry'\nimport type { NamedNode } from 'rdflib'\nimport personIcon from '../icons/person.svg'\nimport friendsIcon from '../icons/friends.svg'\n\ntype ExplorerPane = Omit<PaneDefinition, 'icon'> & {\n icon: string | ((subject: NamedNode, context: DataBrowserContext) => string | undefined)\n}\n\nexport function getPaneIcon (\n pane: ExplorerPane | undefined,\n subject: NamedNode,\n context: DataBrowserContext\n) {\n if (!pane) return undefined\n\n return typeof pane.icon === 'function'\n ? pane.icon(subject, context)\n : pane.icon\n}\n\nexport async function getPaneItems (\n subject: NamedNode,\n context: DataBrowserContext,\n relevantPanes: ExplorerPane[],\n dispatchOpenPane: ((subject: NamedNode, paneName: string) => void) | undefined\n) {\n if (typeof dispatchOpenPane !== 'function') return []\n\n return UI.preparePaneMenuItems({\n subject,\n context,\n panes: relevantPanes,\n iconOverrides: {\n profile: () => personIcon,\n social: () => friendsIcon\n },\n openPane: (paneSubject, paneName) => dispatchOpenPane(paneSubject, paneName)\n })\n}\n"],"mappings":"A,0KAUA,SAAgBO,EACd,EACA,EACA,EACA,CACA,GAAKC,EAEL,OAAO,OAAOA,EAAK,MAAS,WACxBA,EAAK,KAAKC,EAASC,CAAO,EAC1BF,EAAK,IACX,CAEA,eAAsBG,EACpB,EACA,EACA,EACA,EACA,CAGA,OAFI,OAAOC,GAAqB,WAEzBZ,EAAG,qBAAqB,CAC7B,UACA,UACA,MAAOa,EACP,cAAe,CACb,YAAeZ,EAAAA,QACf,WAAcC,EAAAA,OAChB,EACA,UAAW,EAAa,IAAaU,EAAiBE,EAAaC,CAAQ,CAC7E,CAAC,EAXkD,CAAC,CAYtD,C"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { DataBrowserContext, PaneDefinition } from '../../node_modules/pane-registry';
|
|
2
2
|
import { NamedNode } from '../../node_modules/rdflib';
|
|
3
|
+
import * as UI from 'solid-ui';
|
|
3
4
|
type ExplorerPane = Omit<PaneDefinition, 'icon'> & {
|
|
4
5
|
icon: string | ((subject: NamedNode, context: DataBrowserContext) => string | undefined);
|
|
5
6
|
};
|
|
6
7
|
export declare function getPaneIcon(pane: ExplorerPane | undefined, subject: NamedNode, context: DataBrowserContext): string | undefined;
|
|
7
|
-
export declare function getPaneItems(subject: NamedNode, context: DataBrowserContext, relevantPanes: ExplorerPane[], dispatchOpenPane: ((subject: NamedNode, paneName: string) => void) | undefined): Promise<
|
|
8
|
-
label: string;
|
|
9
|
-
icon: any;
|
|
10
|
-
action: () => void;
|
|
11
|
-
}[]>;
|
|
8
|
+
export declare function getPaneItems(subject: NamedNode, context: DataBrowserContext, relevantPanes: ExplorerPane[], dispatchOpenPane: ((subject: NamedNode, paneName: string) => void) | undefined): Promise<UI.PaneMenuItem[]>;
|
|
12
9
|
export {};
|
|
13
10
|
//# sourceMappingURL=fileExplorerHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileExplorerHelpers.d.ts","sourceRoot":"","sources":["../../src/outline/fileExplorerHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fileExplorerHelpers.d.ts","sourceRoot":"","sources":["../../src/outline/fileExplorerHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIvC,KAAK,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IACjD,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,KAAK,MAAM,GAAG,SAAS,CAAC,CAAA;CACzF,CAAA;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,YAAY,GAAG,SAAS,EAC9B,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,kBAAkB,sBAO5B;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,kBAAkB,EAC3B,aAAa,EAAE,YAAY,EAAE,EAC7B,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,8BAc/E"}
|
|
@@ -5,19 +5,17 @@ import * as n from "solid-ui";
|
|
|
5
5
|
function r(e, t, n) {
|
|
6
6
|
if (e) return typeof e.icon == "function" ? e.icon(t, n) : e.icon;
|
|
7
7
|
}
|
|
8
|
-
async function i(i, a, o
|
|
9
|
-
return typeof
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
}))).filter((e) => e !== void 0) : [];
|
|
8
|
+
async function i(r, i, a, o) {
|
|
9
|
+
return typeof o == "function" ? n.preparePaneMenuItems({
|
|
10
|
+
subject: r,
|
|
11
|
+
context: i,
|
|
12
|
+
panes: a,
|
|
13
|
+
iconOverrides: {
|
|
14
|
+
profile: () => e,
|
|
15
|
+
social: () => t
|
|
16
|
+
},
|
|
17
|
+
openPane: (e, t) => o(e, t)
|
|
18
|
+
}) : [];
|
|
21
19
|
}
|
|
22
20
|
export { r as getPaneIcon, i as getPaneItems };
|
|
23
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileExplorerHelpers.esm.js","names":["personIcon","friendsIcon","person_default","friends_default","UI","getPaneIcon","pane","subject","context","getPaneItems","dispatchOpenPane","relevantPanes","
|
|
1
|
+
{"version":3,"file":"fileExplorerHelpers.esm.js","names":["personIcon","friendsIcon","person_default","friends_default","UI","getPaneIcon","pane","subject","context","getPaneItems","dispatchOpenPane","relevantPanes","paneSubject","paneName"],"sources":["../../src/outline/fileExplorerHelpers.ts"],"sourcesContent":["import * as UI from 'solid-ui'\nimport type { DataBrowserContext, PaneDefinition } from 'pane-registry'\nimport type { NamedNode } from 'rdflib'\nimport personIcon from '../icons/person.svg'\nimport friendsIcon from '../icons/friends.svg'\n\ntype ExplorerPane = Omit<PaneDefinition, 'icon'> & {\n icon: string | ((subject: NamedNode, context: DataBrowserContext) => string | undefined)\n}\n\nexport function getPaneIcon (\n pane: ExplorerPane | undefined,\n subject: NamedNode,\n context: DataBrowserContext\n) {\n if (!pane) return undefined\n\n return typeof pane.icon === 'function'\n ? pane.icon(subject, context)\n : pane.icon\n}\n\nexport async function getPaneItems (\n subject: NamedNode,\n context: DataBrowserContext,\n relevantPanes: ExplorerPane[],\n dispatchOpenPane: ((subject: NamedNode, paneName: string) => void) | undefined\n) {\n if (typeof dispatchOpenPane !== 'function') return []\n\n return UI.preparePaneMenuItems({\n subject,\n context,\n panes: relevantPanes,\n iconOverrides: {\n profile: () => personIcon,\n social: () => friendsIcon\n },\n openPane: (paneSubject, paneName) => dispatchOpenPane(paneSubject, paneName)\n })\n}\n"],"mappings":";;;;AAUA,SAAgBK,EACd,GACA,GACA,GACA;CACA,IAAKC,GAEL,OAAO,OAAOA,EAAK,QAAS,aACxBA,EAAK,KAAKC,GAASC,CAAO,IAC1BF,EAAK;AACX;AAEA,eAAsBG,EACpB,GACA,GACA,GACA,GACA;CAGA,OAFI,OAAOC,KAAqB,aAEzBN,EAAG,qBAAqB;EAC7B;EACA;EACA,OAAOO;EACP,eAAe;GACb,eAAeX;GACf,cAAcC;EAChB;EACA,WAAW,GAAa,MAAaS,EAAiBE,GAAaC,CAAQ;CAC7E,CAAC,IAXkD,CAAC;AAYtD"}
|