solid-panes 5.1.0-2 → 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/README.md +6 -0
- 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 +6 -6
- 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 +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.esm.js +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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +16 -15
- package/dist/index.esm.js.map +1 -1
- 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 +44 -24
- 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 +2 -1
- 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 +76 -76
- 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 +20 -2
- package/dist/navigation/chrome.d.ts.map +1 -1
- package/dist/navigation/chrome.esm.js +14 -8
- 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.d.ts +3 -0
- package/dist/navigation/controller.d.ts.map +1 -1
- package/dist/navigation/controller.esm.js +50 -29
- package/dist/navigation/controller.esm.js.map +1 -1
- package/dist/navigation/options.cjs.js +1 -1
- package/dist/navigation/options.cjs.js.map +1 -1
- package/dist/navigation/options.d.ts +12 -0
- package/dist/navigation/options.d.ts.map +1 -1
- package/dist/navigation/options.esm.js +4 -1
- package/dist/navigation/options.esm.js.map +1 -1
- package/dist/navigation/podContext.cjs.js +1 -1
- package/dist/navigation/podContext.cjs.js.map +1 -1
- package/dist/navigation/podContext.d.ts.map +1 -1
- package/dist/navigation/podContext.esm.js +17 -17
- package/dist/navigation/podContext.esm.js.map +1 -1
- 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 -296
- 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
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { clearPaneState as e } from "./state.esm.js";
|
|
1
|
+
import { clearPaneState as e, isWritingNavigationHistory as t } from "./state.esm.js";
|
|
2
2
|
// src/navigation/browserEvents.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
return
|
|
3
|
+
var n, r = !1;
|
|
4
|
+
function i() {
|
|
5
|
+
return r;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function a(e) {
|
|
8
8
|
console.error("Failed to show the page after browser navigation.", e);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
let
|
|
10
|
+
function o(i) {
|
|
11
|
+
if (n = i, r) return;
|
|
12
|
+
r = !0;
|
|
13
|
+
let o = () => (e(), (n?.show({
|
|
14
14
|
kind: "restore",
|
|
15
15
|
forceHeading: !0
|
|
16
|
-
}) ?? Promise.resolve()).catch(
|
|
17
|
-
|
|
18
|
-
e.canIntercept && e.userInitiated && e.navigationType === "replace" && e.destination.url === window.location.href && e.intercept({
|
|
16
|
+
}) ?? Promise.resolve()).catch(a)), s = window.navigation;
|
|
17
|
+
s ? (s.addEventListener("navigate", (e) => {
|
|
18
|
+
!t(window.history) && (e.hashChange || e.destination.sameDocument === !1 || e.destination.url !== window.location.href) && e.canIntercept && e.userInitiated && e.navigationType === "replace" && e.destination.url === window.location.href && e.intercept({
|
|
19
19
|
scroll: "manual",
|
|
20
20
|
focusReset: "manual",
|
|
21
|
-
handler:
|
|
21
|
+
handler: o
|
|
22
22
|
});
|
|
23
|
-
}),
|
|
24
|
-
e.navigationType === "traverse" &&
|
|
23
|
+
}), s.addEventListener("currententrychange", (e) => {
|
|
24
|
+
e.navigationType === "traverse" && o();
|
|
25
25
|
})) : window.addEventListener("popstate", () => {
|
|
26
|
-
|
|
26
|
+
o();
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
export {
|
|
29
|
+
export { i as isHandlingBrowserNavigation, o as registerBrowserNavigation };
|
|
30
30
|
|
|
31
31
|
//# sourceMappingURL=browserEvents.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserEvents.esm.js","names":["navigation","listenersRegistered","isHandlingBrowserNavigation","reportError","error","registerBrowserNavigation","controller","showUrl","clearPaneState","navigationApi","event"],"sources":["../../src/navigation/browserEvents.ts"],"sourcesContent":["/*\n * What the page does when the browser changes the URL or the history entry without reloading.\n *\n * Like a reload, both cases show what the URL is, not what the entry last displayed through the\n * navbar or the account menu:\n * - Enter on the current URL (typically one ending in #me)\n * - back and forward\n */\n\nimport type { NavigationController } from './controller'\nimport { clearPaneState } from './state'\n\ninterface NavigationEvent extends Event {\n canIntercept: boolean\n userInitiated: boolean\n navigationType: string\n destination: { url: string }\n intercept: (options: { handler: () => Promise<void>, scroll: 'manual', focusReset: 'manual' }) => void\n}\n\ninterface NavigationApi {\n addEventListener: (type: 'navigate' | 'currententrychange', listener: (event: NavigationEvent) => void) => void\n}\n\nlet navigation: NavigationController | undefined\nlet listenersRegistered = false\n\n/**\n * Whether the main page handles back and forward itself. Packages that used to re-render on\n * `popstate` (mashlib) ask this and leave it to the main page.\n */\nexport function isHandlingBrowserNavigation (): boolean {\n return listenersRegistered\n}\n\nfunction reportError (error: unknown) {\n console.error('Failed to show the page after browser navigation.', error)\n}\n\n/**\n * Starts handling Enter, back and forward for a controller. The listeners are added once;\n * calling this again only changes which controller they use.\n *\n * The Navigation API is used where the browser has it; the places that fall back to an older\n * mechanism are marked NAVIGATION API FALLBACK. See \"Browser support\" in docs/navigation-design.md.\n */\nexport function registerBrowserNavigation (controller: NavigationController): void {\n navigation = controller\n if (listenersRegistered) return\n listenersRegistered = true\n\n const showUrl = () => {\n clearPaneState()\n return (navigation?.show({ kind: 'restore', forceHeading: true }) ?? Promise.resolve()).catch(reportError)\n }\n\n const navigationApi = (window as unknown as { navigation?: NavigationApi }).navigation\n if (!navigationApi) {\n // NAVIGATION API FALLBACK (Firefox before 147, Safari before 26.2, older Chromium).\n // Back and forward use `popstate`, which cannot tell them from in-page `#` links, so a\n // fragment link also re-renders the page. Enter on the current URL is not handled at all\n // here: without a fragment the browser reloads the page, and `initMainPage` shows the URL.\n window.addEventListener('popstate', () => { showUrl() })\n return\n }\n\n // NAVIGATION API: Enter on the current URL (typically one ending in #me) is a same-URL\n // \"replace\" navigation; intercepting it shows the URL without reloading. Without the API\n // there is no equivalent, see the fallback above.\n navigationApi.addEventListener('navigate', event => {\n if (!event.canIntercept || !event.userInitiated || event.navigationType !== 'replace' ||\n event.destination.url !== window.location.href) return\n\n event.intercept({\n scroll: 'manual',\n focusReset: 'manual',\n handler: showUrl\n })\n })\n\n // NAVIGATION API: unlike the `popstate` fallback above, this does not fire for in-page\n // fragment links.\n navigationApi.addEventListener('currententrychange', event => {\n if (event.navigationType === 'traverse') showUrl()\n })\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"browserEvents.esm.js","names":["navigation","listenersRegistered","isHandlingBrowserNavigation","reportError","error","registerBrowserNavigation","controller","showUrl","clearPaneState","navigationApi","event"],"sources":["../../src/navigation/browserEvents.ts"],"sourcesContent":["/*\n * What the page does when the browser changes the URL or the history entry without reloading.\n *\n * Like a reload, both cases show what the URL is, not what the entry last displayed through the\n * navbar or the account menu:\n * - Enter on the current URL (typically one ending in #me)\n * - back and forward\n */\n\nimport type { NavigationController } from './controller'\nimport { clearPaneState, isWritingNavigationHistory } from './state'\n\ninterface NavigationEvent extends Event {\n canIntercept: boolean\n userInitiated: boolean\n navigationType: string\n hashChange: boolean\n destination: { url: string, sameDocument: boolean }\n intercept: (options: { handler: () => Promise<void>, scroll: 'manual', focusReset: 'manual' }) => void\n}\n\ninterface NavigationApi {\n addEventListener: (type: 'navigate' | 'currententrychange', listener: (event: NavigationEvent) => void) => void\n}\n\nlet navigation: NavigationController | undefined\nlet listenersRegistered = false\n\n/**\n * Whether the main page handles back and forward itself. Packages that used to re-render on\n * `popstate` (mashlib) ask this and leave it to the main page.\n */\nexport function isHandlingBrowserNavigation (): boolean {\n return listenersRegistered\n}\n\nfunction reportError (error: unknown) {\n console.error('Failed to show the page after browser navigation.', error)\n}\n\n/**\n * Starts handling Enter, back and forward for a controller. The listeners are added once;\n * calling this again only changes which controller they use.\n *\n * The Navigation API is used where the browser has it; the places that fall back to an older\n * mechanism are marked NAVIGATION API FALLBACK. See \"Browser support\" in docs/navigation-design.md.\n */\nexport function registerBrowserNavigation (controller: NavigationController): void {\n navigation = controller\n if (listenersRegistered) return\n listenersRegistered = true\n\n const showUrl = () => {\n clearPaneState()\n return (navigation?.show({ kind: 'restore', forceHeading: true }) ?? Promise.resolve()).catch(reportError)\n }\n\n const navigationApi = (window as unknown as { navigation?: NavigationApi }).navigation\n if (!navigationApi) {\n // NAVIGATION API FALLBACK (Firefox before 147, Safari before 26.2, older Chromium).\n // Back and forward use `popstate`, which cannot tell them from in-page `#` links, so a\n // fragment link also re-renders the page. Enter on the current URL is not handled at all\n // here: without a fragment the browser reloads the page, and `initMainPage` shows the URL.\n window.addEventListener('popstate', () => { showUrl() })\n return\n }\n\n // NAVIGATION API: Enter on the current URL (typically one ending in #me) is a same-URL\n // \"replace\" navigation; intercepting it shows the URL without reloading. Without the API\n // there is no equivalent, see the fallback above.\n //\n // Enter is either a fragment navigation (`hashChange`) or a cross-document one. A replacement\n // to the current URL without a hash change is a `history.replaceState` write. Safari marks the\n // application's own writes as `userInitiated` during a tap and can dispatch them after\n // `writeNavigationHistory` returns, so that guard alone does not stop them. Use the URL and hash\n // rather than `sameDocument` here because WebKit versions differ in whether they report that\n // property for a history API write.\n navigationApi.addEventListener('navigate', event => {\n if (isWritingNavigationHistory(window.history) ||\n (!event.hashChange && event.destination.sameDocument !== false &&\n event.destination.url === window.location.href) ||\n !event.canIntercept || !event.userInitiated || event.navigationType !== 'replace' ||\n event.destination.url !== window.location.href) return\n\n event.intercept({\n scroll: 'manual',\n focusReset: 'manual',\n handler: showUrl\n })\n })\n\n // NAVIGATION API: unlike the `popstate` fallback above, this does not fire for in-page\n // fragment links.\n navigationApi.addEventListener('currententrychange', event => {\n if (event.navigationType === 'traverse') showUrl()\n })\n}\n"],"mappings":";;AAyBA,IAAIA,GACAC,IAAsB;AAM1B,SAAgBC,IAAwC;CACtD,OAAOD;AACT;AAEA,SAASE,EAAa,GAAgB;CACpC,QAAQ,MAAM,qDAAqDC,CAAK;AAC1E;AASA,SAAgBC,EAA2B,GAAwC;CAEjF,IADA,IAAaC,GACTL,GAAqB;CACzB,IAAsB;CAEtB,IAAMM,WACJC,EAAe,IACPR,GAAY,KAAK;EAAE,MAAM;EAAW,cAAc;CAAK,CAAC,KAAK,QAAQ,QAAQ,EAAA,CAAG,MAAMG,CAAW,IAGrGM,IAAiB,OAAqD;CAC5E,AAAKA,KAmBLA,EAAc,iBAAiB,aAAY,MAAS;EAClD,AAAI,GAA2B,OAAO,OAAO,MACvCC,EAAM,cAAcA,EAAM,YAAY,iBAAiB,MACvDA,EAAM,YAAY,QAAQ,OAAO,SAAS,SAC3CA,EAAM,gBAAiBA,EAAM,iBAAiBA,EAAM,mBAAmB,aACxEA,EAAM,YAAY,QAAQ,OAAO,SAAS,QAE9CA,EAAM,UAAU;GACd,QAAQ;GACR,YAAY;GACZ,SAASH;EACX,CAAC;CACH,CAAC,GAIDE,EAAc,iBAAiB,uBAAsB,MAAS;EAC5D,AAAIC,EAAM,mBAAmB,cAAYH,EAAQ;CACnD,CAAC,KAhCC,OAAO,iBAAiB,kBAAkB;EAAE,EAAQ;CAAE,CAAC;AAiC3D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=[`profile`,`social`];function t(t){return t!==void 0&&e.includes(t)}function n(e){let{view:n,viaAccountMenu:r,viewer:i,pageUrl:a,owner:o,storageUris:s}=e,c=n.pane,l=c===`profile`||c===`social`?o!==void 0:c===`folder`&&s.some(e=>!n.subject||e===n.subject),u=l||!r?o:void 0;return t(c)?{mode:c===`profile`?`full`:`compact`,subjectUri:n.subject||(l?o:void 0)||a,paneName:c}:!u||u===i?{mode:`none`}:{mode:`compact`,subjectUri:u,paneName:c}}function
|
|
1
|
+
var e=[`profile`,`social`];function t(t){return t!==void 0&&e.includes(t)}function n(e){return t(e)}function r(e){let{view:n,viaAccountMenu:r,viewer:i,pageUrl:a,owner:o,storageUris:s}=e,c=n.pane,l=c===`profile`||c===`social`?o!==void 0:c===`folder`&&s.some(e=>!n.subject||e===n.subject),u=l||!r?o:void 0;return t(c)?{mode:c===`profile`?`full`:`compact`,subjectUri:n.subject||(l?o:void 0)||a,paneName:c}:!u||u===i?{mode:`none`}:{mode:`compact`,subjectUri:u,paneName:c}}function i(e,t){return{paneName:e.pane??(t?`profile`:void 0),paneUri:e.subject}}function a(e,t,n){return!t.paneName||e.paneName!==t.paneName?!1:e.paneName===`folder`?t.paneUri?t.paneUri===e.paneUri:n===1:!0}function o(e,t,n){let r=e.filter(e=>e.paneName===t);return r.find(e=>e.paneUri===n)??r[0]}function s(e){return e.viaAccountMenu||e.ownProfile||e.inViewerPod}function c(e){return e.viaAccountMenu||e.inViewerPod||!e.hasOwner?`explorer`:`storage`}function l(e){return e.isRootResource||e.isWebId?!1:!e.viewerPodOnly||e.inViewerPod}function u(e,n,r,i=!1){return n===`folder`||n===`basicPreferences`||n===`home`||n===`dashboard`?!1:e&&!t(n)}exports.PERSON_PANES=e,exports.deriveExplorerHeader=l,exports.deriveHeading=r,exports.deriveNavbarSelection=i,exports.deriveStorageView=c,exports.explorerHeaderForPane=u,exports.isNavbarHidden=s,exports.isNavbarItemSelected=a,exports.isPersonPane=t,exports.offersFriendAction=n,exports.pickNavbarItem=o;
|
|
2
2
|
//# sourceMappingURL=chrome.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.cjs.js","names":["PERSON_PANES","isPersonPane","paneName","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","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'\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/** 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// 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
|
|
1
|
+
{"version":3,"file":"chrome.cjs.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,EAAe,CAAC,UAAW,QAAQ,EAEhD,SAAgBC,EAAc,EAA4B,CACxD,OAAOC,IAAa,IAAA,IAAaF,EAAa,SAASE,CAAQ,CACjE,CAGA,SAAgBC,EAAoB,EAA4B,CAC9D,OAAOF,EAAaC,CAAQ,CAC9B,CAqCA,SAAgBE,EAAe,EAAsC,CACnE,GAAM,CAAE,OAAM,iBAAgB,SAAQ,UAAS,QAAO,eAAgBC,EAChEH,EAAWI,EAAK,KAIhBC,EAAeL,IAAa,WAAaA,IAAa,SACxDM,IAAU,IAAA,GACVN,IAAa,UAAYO,EAAY,KAAK,GAAO,CAACH,EAAK,SAAWI,IAAQJ,EAAK,OAAO,EACpFK,EAAWJ,GAAgB,CAACK,EAAiBJ,EAAQ,IAAA,GAO3D,OALKP,EAAaC,CAAQ,EAKnB,CACL,KAAMA,IAAa,UAAY,OAAS,UACxC,WAAYI,EAAK,UAAYC,EAAeC,EAAQ,IAAA,KAAcK,EAClE,UACF,EARM,CAACF,GAAYA,IAAaG,EAAe,CAAE,KAAM,MAAO,EACrD,CAAE,KAAM,UAAW,WAAYH,EAAU,UAAS,CAQ7D,CAUA,SAAgBI,EAAuB,EAAsB,EAAuC,CAClG,MAAO,CACL,SAAUT,EAAK,OAASU,EAAc,UAAY,IAAA,IAClD,QAASV,EAAK,OAChB,CACF,CAMA,SAAgBW,EACd,EACA,EACA,EACS,CAKT,MAJI,CAACC,EAAU,UAAYC,EAAK,WAAaD,EAAU,SAAiB,GACpEC,EAAK,WAAa,SACbD,EAAU,QAAUA,EAAU,UAAYC,EAAK,QAAUC,IAAqB,EAEhF,EACT,CAGA,SAAgBC,EACd,EACA,EACA,EACkB,CAClB,IAAMC,EAAUC,EAAM,OAAO,GAAQJ,EAAK,WAAajB,CAAQ,EAC/D,OAAOoB,EAAQ,KAAK,GAAQH,EAAK,UAAYK,CAAO,GAAKF,EAAQ,EACnE,CAGA,SAAgBG,EAAgB,EAAwF,CACtH,OAAOpB,EAAM,gBAAkBA,EAAM,YAAcA,EAAM,WAC3D,CAgBA,SAAgBqB,EAAmB,EAAsE,CACvG,OAAOrB,EAAM,gBAAkBA,EAAM,aAAe,CAACA,EAAM,SAAW,WAAa,SACrF,CAgBA,SAAgBsB,EAAsB,EAAqC,CAEzE,OADItB,EAAM,gBAAkBA,EAAM,QAAgB,GAC3C,CAACA,EAAM,eAAiBA,EAAM,WACvC,CAMA,SAAgBuB,EACd,EACA,EACA,EACA,EAAO,GACE,CAET,OADI1B,IAAa,UAAYA,IAAa,oBAAsBA,IAAa,QAAUA,IAAa,YAAoB,GACjH2B,GAAkB,CAAC5B,EAAaC,CAAQ,CACjD,C"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { NavigationView } from './state';
|
|
2
|
+
import { FolderView } from './options';
|
|
2
3
|
/** Registry names of the panes that present a person rather than a resource. */
|
|
3
4
|
export declare const PERSON_PANES: string[];
|
|
4
5
|
export declare function isPersonPane(paneName?: string): boolean;
|
|
6
|
+
/** Whether the heading over this pane offers to add its person as a friend: on the Profile and Friends tabs. */
|
|
7
|
+
export declare function offersFriendAction(paneName?: string): boolean;
|
|
5
8
|
/** The parts of a navbar item that the rules look at. */
|
|
6
9
|
export interface NavbarItemRef {
|
|
7
10
|
paneName?: string;
|
|
@@ -52,6 +55,18 @@ export declare function isNavbarHidden(input: {
|
|
|
52
55
|
ownProfile: boolean;
|
|
53
56
|
inViewerPod: boolean;
|
|
54
57
|
}): boolean;
|
|
58
|
+
export interface StorageViewInput {
|
|
59
|
+
viaAccountMenu: boolean;
|
|
60
|
+
/** The storage is one of the viewer's own. */
|
|
61
|
+
inViewerPod: boolean;
|
|
62
|
+
/** The storage belongs to a person whose profile was found; the server root has none. */
|
|
63
|
+
hasOwner: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The viewer's own storage, and the server root, come with the folder pane's storage header.
|
|
67
|
+
* Someone else's storage sits under the navbar of their pod, which already says whose it is.
|
|
68
|
+
*/
|
|
69
|
+
export declare function deriveStorageView(input: StorageViewInput): Extract<FolderView, 'explorer' | 'storage'>;
|
|
55
70
|
export interface ExplorerHeaderInput {
|
|
56
71
|
isRootResource: boolean;
|
|
57
72
|
isWebId: boolean;
|
|
@@ -64,6 +79,9 @@ export interface ExplorerHeaderInput {
|
|
|
64
79
|
}
|
|
65
80
|
/** Whether the header describing a resource fits the view. */
|
|
66
81
|
export declare function deriveExplorerHeader(input: ExplorerHeaderInput): boolean;
|
|
67
|
-
/**
|
|
68
|
-
|
|
82
|
+
/**
|
|
83
|
+
* The header is never shown over profile, friends, preferences or dashboard panes,
|
|
84
|
+
* nor over a storage view, which has its own header or the navbar.
|
|
85
|
+
*/
|
|
86
|
+
export declare function explorerHeaderForPane(resourceHeader: boolean, paneName?: string, folderView?: FolderView, solo?: boolean): boolean;
|
|
69
87
|
//# sourceMappingURL=chrome.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/navigation/chrome.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/navigation/chrome.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,6 +4,9 @@ function t(t) {
|
|
|
4
4
|
return t !== void 0 && e.includes(t);
|
|
5
5
|
}
|
|
6
6
|
function n(e) {
|
|
7
|
+
return t(e);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
7
10
|
let { view: n, viaAccountMenu: r, viewer: i, pageUrl: a, owner: o, storageUris: s } = e, c = n.pane, l = c === "profile" || c === "social" ? o !== void 0 : c === "folder" && s.some((e) => !n.subject || e === n.subject), u = l || !r ? o : void 0;
|
|
8
11
|
return t(c) ? {
|
|
9
12
|
mode: c === "profile" ? "full" : "compact",
|
|
@@ -15,28 +18,31 @@ function n(e) {
|
|
|
15
18
|
paneName: c
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
|
-
function
|
|
21
|
+
function i(e, t) {
|
|
19
22
|
return {
|
|
20
23
|
paneName: e.pane ?? (t ? "profile" : void 0),
|
|
21
24
|
paneUri: e.subject
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
|
-
function
|
|
27
|
+
function a(e, t, n) {
|
|
25
28
|
return !t.paneName || e.paneName !== t.paneName ? !1 : e.paneName === "folder" ? t.paneUri ? t.paneUri === e.paneUri : n === 1 : !0;
|
|
26
29
|
}
|
|
27
|
-
function
|
|
30
|
+
function o(e, t, n) {
|
|
28
31
|
let r = e.filter((e) => e.paneName === t);
|
|
29
32
|
return r.find((e) => e.paneUri === n) ?? r[0];
|
|
30
33
|
}
|
|
31
|
-
function
|
|
34
|
+
function s(e) {
|
|
32
35
|
return e.viaAccountMenu || e.ownProfile || e.inViewerPod;
|
|
33
36
|
}
|
|
34
|
-
function
|
|
37
|
+
function c(e) {
|
|
38
|
+
return e.viaAccountMenu || e.inViewerPod || !e.hasOwner ? "explorer" : "storage";
|
|
39
|
+
}
|
|
40
|
+
function l(e) {
|
|
35
41
|
return e.isRootResource || e.isWebId ? !1 : !e.viewerPodOnly || e.inViewerPod;
|
|
36
42
|
}
|
|
37
|
-
function
|
|
38
|
-
return e && !t(n);
|
|
43
|
+
function u(e, n, r, i = !1) {
|
|
44
|
+
return n === "folder" || n === "basicPreferences" || n === "home" || n === "dashboard" ? !1 : e && !t(n);
|
|
39
45
|
}
|
|
40
|
-
export { e as PERSON_PANES,
|
|
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 };
|
|
41
47
|
|
|
42
48
|
//# sourceMappingURL=chrome.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.esm.js","names":["PERSON_PANES","isPersonPane","paneName","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","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'\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/** 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// 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
|
|
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":["
|
|
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":"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"}
|
|
@@ -3,6 +3,7 @@ import { PaneDefinition } from '../../node_modules/pane-registry';
|
|
|
3
3
|
import { OutlineManager } from '../outline/manager';
|
|
4
4
|
import { PaneItem } from '../utils/paneUtils';
|
|
5
5
|
import { NavigationSource } from './options';
|
|
6
|
+
import { PodContext } from './podContext';
|
|
6
7
|
export type NavigationIntent =
|
|
7
8
|
/** Display what the current history entry says was displayed, for the page's own URL. */
|
|
8
9
|
{
|
|
@@ -39,6 +40,8 @@ export interface NavigationDeps {
|
|
|
39
40
|
outliner: OutlineManager;
|
|
40
41
|
byName: (name: string) => PaneDefinition | null | undefined;
|
|
41
42
|
effects: NavigationEffects;
|
|
43
|
+
/** Whose pod a URL is in; `getPodContext` unless a test supplies its own. */
|
|
44
|
+
podContextOf?: (url: string) => Promise<PodContext>;
|
|
42
45
|
}
|
|
43
46
|
export interface NavigationController {
|
|
44
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/navigation/controller.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAwE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAGxH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/navigation/controller.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAwE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAGxH,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAG7D,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAE5E,MAAM,MAAM,gBAAgB;AAC1B,yFAAyF;AACvF;IACA,IAAI,EAAE,SAAS,CAAA;IACf,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AACD,+CAA+C;GAC7C;IAAE,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE;AAC7E,8DAA8D;GAC5D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE;AAChE,mFAAmF;GACjF;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAE5D,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9D,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,SAAS,CAAA;IAChB,QAAQ,EAAE,cAAc,CAAA;IACxB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,IAAI,GAAG,SAAS,CAAA;IAC3D,OAAO,EAAE,iBAAiB,CAAA;IAC1B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;CACpD;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAClD;AAID,wBAAgB,0BAA0B,CAAE,IAAI,EAAE,cAAc,GAAG,oBAAoB,CAgFtF"}
|
|
@@ -1,44 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
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
3
|
import { readNavigationState as i } from "./state.esm.js";
|
|
4
|
-
import {
|
|
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";
|
|
5
7
|
// src/navigation/controller.ts
|
|
6
|
-
function
|
|
7
|
-
let { store:
|
|
8
|
-
async function
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
function l(l) {
|
|
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
|
+
}
|
|
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
|
+
});
|
|
22
|
+
}
|
|
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);
|
|
14
29
|
}
|
|
15
|
-
return
|
|
30
|
+
return i.pane ? f(i.pane) ?? void 0 : a(r) ? t(r, f) : g(r);
|
|
16
31
|
}
|
|
17
|
-
async function
|
|
32
|
+
async function y(e, r, i) {
|
|
18
33
|
switch (e.kind) {
|
|
19
|
-
case "restore": return
|
|
20
|
-
case "profile": return
|
|
21
|
-
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);
|
|
22
37
|
case "storage": return e.pane;
|
|
23
|
-
case "app": return
|
|
38
|
+
case "app": return f(e.pane);
|
|
24
39
|
}
|
|
25
40
|
}
|
|
26
41
|
return { async show(e) {
|
|
27
|
-
let t = ++
|
|
28
|
-
|
|
29
|
-
let o =
|
|
30
|
-
if (t
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
if (t !== h) return;
|
|
46
|
+
if (!s && e.kind !== "restore") {
|
|
47
|
+
console.warn("Could not open the requested view for the logged-in user.");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let c = s && s.name === "folder" ? s.subject?.uri : void 0, l = c ? await _(c, a === "accountMenu") : void 0;
|
|
51
|
+
if (t === h) {
|
|
52
|
+
if (d.GotoSubject(o, !0, s ?? void 0, !0, void 0, void 0, l ? {
|
|
53
|
+
source: a,
|
|
54
|
+
folderView: l
|
|
55
|
+
} : { source: a }), a !== "accountMenu") {
|
|
56
|
+
let { view: e } = i();
|
|
57
|
+
e.pane && p.selectNavbarPane(e.pane, e.subject);
|
|
38
58
|
}
|
|
59
|
+
await p.refreshHeading(e.kind === "restore" && e.forceHeading === !0);
|
|
39
60
|
}
|
|
40
61
|
} };
|
|
41
62
|
}
|
|
42
|
-
export {
|
|
63
|
+
export { l as createNavigationController };
|
|
43
64
|
|
|
44
65
|
//# sourceMappingURL=controller.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.esm.js","names":["createNavigationController","deps","latest","paneForView","view","paneSubject","store","getProfilePaneFromURI","byName","getSocialPaneFromURI","
|
|
1
|
+
{"version":3,"file":"controller.esm.js","names":["createNavigationController","getPodContext","deps","latest","storageAt","subject","isServerRoot","podContextOf","isStorage","storagePanes","pane","viewerStorages","getFolderPaneForStorage","folderViewFor","context","viaAccountMenu","storage","deriveStorageView","isInViewerPod","paneForView","view","paneSubject","store","getProfilePaneFromURI","byName","getSocialPaneFromURI","isWebIdUri","paneFor","intent","state","request","readNavigationState","source","setNavbarHidden","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":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e){return typeof e==`object`&&e?e.source??`default`:e===void 0||e?`default`:`accountMenu`}exports.resolveSource=
|
|
1
|
+
function e(e){return typeof e==`object`&&e?e.folderView:void 0}function t(e){return typeof e==`object`&&e?e.source??`default`:e===void 0||e?`default`:`accountMenu`}exports.resolveFolderView=e,exports.resolveSource=t;
|
|
2
2
|
//# sourceMappingURL=options.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.cjs.js","names":["
|
|
1
|
+
{"version":3,"file":"options.cjs.js","names":["resolveFolderView","argument","resolveSource"],"sources":["../../src/navigation/options.ts"],"sourcesContent":["/**\n * Who asked for a view to be displayed. `GotoSubject` takes it as its seventh argument.\n *\n * - `default`: the page's own navigation (URL, navbar, links)\n * - `accountMenu`: the viewer's own content, shown while the page URL keeps pointing elsewhere\n */\nexport type NavigationSource = 'default' | 'accountMenu'\n\n/**\n * How the folder pane presents a container, when the caller decides it:\n * - `explorer`: storage header, sidebar and content\n * - `storage`: sidebar and content, under the navbar of someone else's pod\n * - `container`: the container alone\n */\nexport type FolderView = 'explorer' | 'storage' | 'container'\n\nexport interface GotoSubjectOptions {\n source?: NavigationSource\n folderView?: FolderView\n /** Keep the caller's document URL while displaying a different subject. */\n preserveUrl?: boolean\n}\n\n/** The folder view a `GotoSubject` caller asked for, if any. */\nexport function resolveFolderView (argument?: boolean | GotoSubjectOptions | null): FolderView | undefined {\n return typeof argument === 'object' && argument !== null ? argument.folderView : undefined\n}\n\n/**\n * The seventh argument used to be `showNavbar`: `false` meant \"opened by the account menu\"\n * and anything else meant the page's own navigation. That form is still accepted.\n */\nexport function resolveSource (argument?: boolean | GotoSubjectOptions | null): NavigationSource {\n if (typeof argument === 'object' && argument !== null) return argument.source ?? 'default'\n if (argument === undefined) return 'default'\n return argument ? 'default' : 'accountMenu'\n}\n"],"mappings":"AAwBA,SAAgBA,EAAmB,EAAwE,CACzG,OAAO,OAAOC,GAAa,UAAYA,EAAoBA,EAAS,WAAa,IAAA,EACnF,CAMA,SAAgBC,EAAe,EAAkE,CAG/F,OAFI,OAAOD,GAAa,UAAYA,EAA0BA,EAAS,QAAU,UAC7EA,IAAa,IAAA,IACVA,EAD4B,UACL,aAChC,C"}
|
|
@@ -5,9 +5,21 @@
|
|
|
5
5
|
* - `accountMenu`: the viewer's own content, shown while the page URL keeps pointing elsewhere
|
|
6
6
|
*/
|
|
7
7
|
export type NavigationSource = 'default' | 'accountMenu';
|
|
8
|
+
/**
|
|
9
|
+
* How the folder pane presents a container, when the caller decides it:
|
|
10
|
+
* - `explorer`: storage header, sidebar and content
|
|
11
|
+
* - `storage`: sidebar and content, under the navbar of someone else's pod
|
|
12
|
+
* - `container`: the container alone
|
|
13
|
+
*/
|
|
14
|
+
export type FolderView = 'explorer' | 'storage' | 'container';
|
|
8
15
|
export interface GotoSubjectOptions {
|
|
9
16
|
source?: NavigationSource;
|
|
17
|
+
folderView?: FolderView;
|
|
18
|
+
/** Keep the caller's document URL while displaying a different subject. */
|
|
19
|
+
preserveUrl?: boolean;
|
|
10
20
|
}
|
|
21
|
+
/** The folder view a `GotoSubject` caller asked for, if any. */
|
|
22
|
+
export declare function resolveFolderView(argument?: boolean | GotoSubjectOptions | null): FolderView | undefined;
|
|
11
23
|
/**
|
|
12
24
|
* The seventh argument used to be `showNavbar`: `false` meant "opened by the account menu"
|
|
13
25
|
* and anything else meant the page's own navigation. That form is still accepted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/navigation/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,aAAa,CAAA;AAExD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/navigation/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,aAAa,CAAA;AAExD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAA;AAE7D,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,CAEzG;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,GAAG,gBAAgB,CAI/F"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// src/navigation/options.ts
|
|
2
2
|
function e(e) {
|
|
3
|
+
return typeof e == "object" && e ? e.folderView : void 0;
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
3
6
|
return typeof e == "object" && e ? e.source ?? "default" : e === void 0 || e ? "default" : "accountMenu";
|
|
4
7
|
}
|
|
5
|
-
export { e as resolveSource };
|
|
8
|
+
export { e as resolveFolderView, t as resolveSource };
|
|
6
9
|
|
|
7
10
|
//# sourceMappingURL=options.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.esm.js","names":["
|
|
1
|
+
{"version":3,"file":"options.esm.js","names":["resolveFolderView","argument","resolveSource"],"sources":["../../src/navigation/options.ts"],"sourcesContent":["/**\n * Who asked for a view to be displayed. `GotoSubject` takes it as its seventh argument.\n *\n * - `default`: the page's own navigation (URL, navbar, links)\n * - `accountMenu`: the viewer's own content, shown while the page URL keeps pointing elsewhere\n */\nexport type NavigationSource = 'default' | 'accountMenu'\n\n/**\n * How the folder pane presents a container, when the caller decides it:\n * - `explorer`: storage header, sidebar and content\n * - `storage`: sidebar and content, under the navbar of someone else's pod\n * - `container`: the container alone\n */\nexport type FolderView = 'explorer' | 'storage' | 'container'\n\nexport interface GotoSubjectOptions {\n source?: NavigationSource\n folderView?: FolderView\n /** Keep the caller's document URL while displaying a different subject. */\n preserveUrl?: boolean\n}\n\n/** The folder view a `GotoSubject` caller asked for, if any. */\nexport function resolveFolderView (argument?: boolean | GotoSubjectOptions | null): FolderView | undefined {\n return typeof argument === 'object' && argument !== null ? argument.folderView : undefined\n}\n\n/**\n * The seventh argument used to be `showNavbar`: `false` meant \"opened by the account menu\"\n * and anything else meant the page's own navigation. That form is still accepted.\n */\nexport function resolveSource (argument?: boolean | GotoSubjectOptions | null): NavigationSource {\n if (typeof argument === 'object' && argument !== null) return argument.source ?? 'default'\n if (argument === undefined) return 'default'\n return argument ? 'default' : 'accountMenu'\n}\n"],"mappings":";AAwBA,SAAgBA,EAAmB,GAAwE;CACzG,OAAO,OAAOC,KAAa,YAAYA,IAAoBA,EAAS,aAAa,KAAA;AACnF;AAMA,SAAgBC,EAAe,GAAkE;CAG/F,OAFI,OAAOD,KAAa,YAAYA,IAA0BA,EAAS,UAAU,YAC7EA,MAAa,KAAA,KACVA,IAD4B,YACL;AAChC"}
|