solid-panes 5.1.0-3 → 5.1.1
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 +12 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.cjs.js","names":["paneRegistry","createNavigationController","refreshProfileHeading","require_runtime","
|
|
1
|
+
{"version":3,"file":"navigation.cjs.js","names":["paneRegistry","createNavigationController","refreshProfileHeading","require_runtime","require_controller","require_navbar","require_profileHeading","pane_registry","controllers","navigationFor","controller","outliner","registry","byName"],"sources":["../../src/mainPage/navigation.ts"],"sourcesContent":["import type { LiveStore } from 'rdflib'\nimport * as paneRegistry from 'pane-registry'\nimport type { OutlineManager } from '../outline/manager'\nimport { createNavigationController, type NavigationController } from '../navigation/controller'\nimport { selectNavbarPane } from './navbar'\nimport { refreshProfileHeading } from './profileHeading'\n\nconst controllers = new WeakMap<OutlineManager, NavigationController>()\n\n/** The page's navigation controller for an outliner, created on first use. */\nexport function navigationFor (outliner: OutlineManager, store: LiveStore): NavigationController {\n let controller = controllers.get(outliner)\n if (!controller) {\n const registry = (outliner as any).context?.session?.paneRegistry\n const byName = typeof registry?.byName === 'function'\n ? registry.byName.bind(registry)\n : paneRegistry.byName\n controller = createNavigationController({\n store,\n outliner,\n byName,\n effects: { selectNavbarPane, refreshHeading: refreshProfileHeading }\n })\n controllers.set(outliner, controller)\n }\n return controller\n}\n"],"mappings":"A,sNAOA,IAAMQ,EAAc,IAAI,QAGxB,SAAgBC,EAAe,EAA0B,EAAwC,CAC/F,IAAIC,EAAaF,EAAY,IAAIG,CAAQ,EACzC,GAAI,CAACD,EAAY,CACf,IAAME,EAAYD,EAAiB,SAAS,SAAS,aAC/CE,EAAS,OAAOD,GAAU,QAAW,WACvCA,EAAS,OAAO,KAAKA,CAAQ,EAC7BZ,EAAa,OACjB,EAAaC,EAAAA,2BAA2B,CACtC,QACA,WACA,SACA,QAAS,CAAE,iBAAAI,EAAA,iBAAkB,eAAgBH,EAAAA,qBAAsB,CACrE,CAAC,EACDM,EAAY,IAAIG,EAAUD,CAAU,CACtC,CACA,OAAOA,CACT,C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createNavigationController as e } from "../navigation/controller.esm.js";
|
|
2
|
+
import { selectNavbarPane as t } from "./navbar.esm.js";
|
|
3
3
|
import { refreshProfileHeading as n } from "./profileHeading2.esm.js";
|
|
4
4
|
import * as r from "pane-registry";
|
|
5
5
|
// src/mainPage/navigation.ts
|
|
@@ -8,12 +8,12 @@ function a(a, o) {
|
|
|
8
8
|
let s = i.get(a);
|
|
9
9
|
if (!s) {
|
|
10
10
|
let c = a.context?.session?.paneRegistry, l = typeof c?.byName == "function" ? c.byName.bind(c) : r.byName;
|
|
11
|
-
s =
|
|
11
|
+
s = e({
|
|
12
12
|
store: o,
|
|
13
13
|
outliner: a,
|
|
14
14
|
byName: l,
|
|
15
15
|
effects: {
|
|
16
|
-
selectNavbarPane:
|
|
16
|
+
selectNavbarPane: t,
|
|
17
17
|
refreshHeading: n
|
|
18
18
|
}
|
|
19
19
|
}), i.set(a, s);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileHeading.d.ts","sourceRoot":"","sources":["../../src/mainPage/profileHeading.ts"],"names":[],"mappings":"AAOA,OAAO,+BAA+B,CAAA;AACtC,OAAO,sBAAsB,CAAA;AA8I7B,wBAAsB,qBAAqB,CAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"profileHeading.d.ts","sourceRoot":"","sources":["../../src/mainPage/profileHeading.ts"],"names":[],"mappings":"AAOA,OAAO,+BAA+B,CAAA;AACtC,OAAO,sBAAsB,CAAA;AA8I7B,wBAAsB,qBAAqB,CAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FzE;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,IAAK,IAAI,CAE3C;AAED,2FAA2F;AAC3F,wBAAgB,wBAAwB,CAAE,UAAU,eAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAuDhG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`#profile-heading-mount{margin-top:18px;margin-bottom:20px}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();const e=require("../
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`#profile-heading-mount{margin-top:18px;margin-bottom:20px}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();const e=require("../components/profile-heading/profileHeadingData.cjs.js"),t=require("../utils/webIdUtils.cjs.js");require("../components/profile-heading/index.cjs.js");const n=require("../navigation/chrome.cjs.js"),r=require("../navigation/podContext.cjs.js"),i=require("../navigation/events.cjs.js"),a=require("../navigation/state.cjs.js");let o=require("solid-logic");var s=`solid-panes-profile-heading`,c=`profile-heading-mount`,l=0,u=!1,d=!1,f=!1,p,m=``,h=``,g=``,_=()=>window.location.href,v=new WeakMap,y=new WeakMap;function b(e){if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||typeof e.animate!=`function`)return;let t=getComputedStyle(e),n=t.marginTop||`18px`,r=t.marginBottom||`20px`,i=e.animate([{height:`0px`,opacity:0,marginTop:`0px`,marginBottom:`0px`,overflow:`hidden`},{height:`${e.getBoundingClientRect().height}px`,opacity:1,marginTop:n,marginBottom:r,overflow:`hidden`}],{duration:300,easing:`ease`,fill:`both`});y.set(e,i);let a=()=>{y.get(e)===i&&(y.delete(e),i.cancel())};i.finished.then(a,t=>{y.get(e)===i&&(console.error(`Failed to animate profile heading appearance.`,t),a())})}function x(e){let t=v.get(e);v.delete(e),t?.cancel(),e.inert=!1,e.removeAttribute(`aria-hidden`)}function S(e){if(v.has(e))return;let t=getComputedStyle(e),n=e.getBoundingClientRect().height,r=t.opacity,i=t.marginTop,a=t.marginBottom,o=y.get(e);y.delete(e),o?.cancel();let s=()=>{e.hidden=!0,e.replaceChildren()};if(e.inert=!0,e.setAttribute(`aria-hidden`,`true`),e.hidden||!e.firstElementChild||window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||typeof e.animate!=`function`){s();return}let c=e.animate([{height:`${n}px`,opacity:r,marginTop:i,marginBottom:a,overflow:`hidden`},{height:`0px`,opacity:0,marginTop:`0px`,marginBottom:`0px`,overflow:`hidden`}],{duration:300,easing:`ease`,fill:`forwards`});v.set(e,c),c.finished.then(()=>{v.get(e)===c&&(s(),v.delete(e),c.cancel())},t=>{v.get(e)===c&&(console.error(`Failed to animate profile heading disappearance.`,t),s(),v.delete(e),c.cancel())})}function C(){T(!0).catch(e=>{console.error(`Failed to refresh profile heading after an authentication change.`,e)})}function w(){let e=document.getElementById(`MainContent`);if(!e)return null;let t=document.getElementById(c);t||(t=document.createElement(`div`),t.id=c,t.setAttribute(`aria-label`,`Profile heading`));let n=document.querySelector(`solid-panes-navbar`),r=document.getElementById(`OutlineView`),i=n?.parentNode===e?n:r?.parentNode===e?r:null;return i&&t.nextSibling!==i?e.insertBefore(t,i):!i&&t.parentNode!==e&&e.appendChild(t),t}async function T(i=!1){await p;let c=_(),u=await r.getPodContext(c),d=w();if(!d)return;i&&(l++,m=``,g=``);let{view:f,viaAccountMenu:y}=a.readNavigationState(),C=n.deriveHeading({view:f,viaAccountMenu:y,viewer:o.authn.currentUser()?.value,pageUrl:c,owner:u.owner,storageUris:u.storagePanes.map(e=>e.subject.value)});if(C.mode===`none`){l++,g=``,m=``,h=``,S(d);return}let{subjectUri:E}=C,D=C.mode===`full`;x(d);let O=`${C.paneName}:${E}`;if(O===m||O===g)return;let k=++l;g=O;let A,j,M,N;try{A=await t.loadProfileFromURI(o.store.sym(E)),j=e.presentProfile(A,o.store),N=D?await e.getViewerMode(A):`anonymous`,M=N===`owner`}catch(e){throw k===l&&(g=``),e}if(k!==l)return;let P=d.querySelector(s)||document.createElement(s);P.profileData=j,P.subject=A;let F=o.authn.currentUser();P.friendSubject=n.offersFriendAction(C.paneName)&&F&&!F.sameTerm(A)?A:void 0,P.editContext=M?{subject:A,profileData:j,viewerMode:N,onSaved:()=>T(!0)}:void 0,P.compact=!D;let I=d.hidden||!d.firstElementChild;d.hidden=!1,P.parentNode!==d&&d.replaceChildren(P),m=O,h=A.value,g=``,I&&(await P.updateComplete,k===l&&d.isConnected&&!d.hidden&&!v.has(d)&&b(d))}function E(){w()}function D(e=()=>window.location.href){_=e,w(),f||=(document.addEventListener(`profile-pane-saved`,e=>{if(!(e instanceof CustomEvent)||e.detail?.subjectUri!==h)return;let t=document.querySelector(`#${c} ${s}`);t&&e.detail.profileData?(l++,g=``,t.profileData=e.detail.profileData,t.editContext&&={...t.editContext,profileData:e.detail.profileData}):T(!0).catch(e=>{console.error(`Failed to refresh profile heading after saving profile information.`,e)})}),!0);let t=p??o.authn.checkUser().then(()=>void 0);return p=t,d||=(o.authSession.events.on(`login`,C),o.authSession.events.on(`sessionRestore`,C),o.authSession.events.on(`logout`,C),o.authSession.events.on(`sessionChange`,C),o.authSession.events.on(`identityReplaced`,C),!0),u||=(i.onNavigated(()=>{T().catch(e=>{console.error(`Failed to refresh profile heading.`,e)})}),!0),t.then(()=>T(!0)).catch(e=>{console.error(`Failed to refresh profile heading.`,e)}),t}exports.initializeProfileHeading=D,exports.placeProfileHeading=E,exports.refreshProfileHeading=T;
|
|
2
2
|
//# sourceMappingURL=profileHeading2.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileHeading2.cjs.js","names":["getPodContext","readNavigationState","deriveHeading","authn","loadProfileFromURI","store","presentProfile","getViewerMode","offersFriendAction","require_webIdUtils","require_chrome","require_podContext","require_state","require_events","require_profileHeadingData","solid_logic","PROFILE_HEADING_TAG","PROFILE_HEADING_MOUNT_ID","refreshRequest","navigatedListenerRegistered","authListenersRegistered","profileSavedListenerRegistered","authReady","displayedPaneKey","displayedSubjectUri","loadingPaneKey","headingPageUrl","hideAnimations","showAnimations","showHeading","mount","style","marginTop","marginBottom","animation","finish","error","cancelHeadingHide","hideHeading","height","opacity","showing","refreshAfterAuthChange","refreshProfileHeading","ensureMountPoint","mainContent","navbar","outlineView","insertionPoint","pageUrl","pod","force","decision","pane","isProfilePane","paneKey","subjectUri","request","subject","profileData","canEdit","viewerMode","heading","viewer","appearing","placeProfileHeading","initializeProfileHeading","getPageUrl","event","readiness"],"sources":["../../src/mainPage/profileHeading.ts"],"sourcesContent":["import { authn, authSession, store } from 'solid-logic'\nimport { NamedNode } from 'rdflib'\nimport type { ProfileDetails } from '../components/profile-heading/editor/sections/heading/types'\nimport type { ProfileHeadingEditContext } from '../components/profile-heading/ProfileHeading'\nimport { getViewerMode, presentProfile } from '../components/profile-heading/profileHeadingData'\nimport type { ViewerMode } from '../types'\nimport { loadProfileFromURI } from '../utils/webIdUtils'\nimport '../components/profile-heading'\nimport './profileHeading.css'\nimport { deriveHeading, offersFriendAction } from '../navigation/chrome'\nimport { getPodContext } from '../navigation/podContext'\nimport { onNavigated } from '../navigation/events'\nimport { readNavigationState } from '../navigation/state'\n\nconst PROFILE_HEADING_TAG = 'solid-panes-profile-heading'\nconst PROFILE_HEADING_MOUNT_ID = 'profile-heading-mount'\n\nlet refreshRequest = 0\nlet navigatedListenerRegistered = false\nlet authListenersRegistered = false\nlet profileSavedListenerRegistered = false\nlet authReady: Promise<void> | undefined\nlet displayedPaneKey = ''\nlet displayedSubjectUri = ''\nlet loadingPaneKey = ''\nlet headingPageUrl = () => window.location.href\nconst hideAnimations = new WeakMap<HTMLElement, Animation>()\nconst showAnimations = new WeakMap<HTMLElement, Animation>()\n\nfunction showHeading (mount: HTMLElement): void {\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') return\n\n const style = getComputedStyle(mount)\n const marginTop = style.marginTop || '18px'\n const marginBottom = style.marginBottom || '20px'\n const animation = mount.animate([\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' },\n {\n height: `${mount.getBoundingClientRect().height}px`,\n opacity: 1,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n }\n ], { duration: 300, easing: 'ease', fill: 'both' })\n showAnimations.set(mount, animation)\n const finish = () => {\n if (showAnimations.get(mount) !== animation) return\n showAnimations.delete(mount)\n animation.cancel()\n }\n animation.finished.then(finish, (error: unknown) => {\n if (showAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading appearance.', error)\n finish()\n })\n}\n\nfunction cancelHeadingHide (mount: HTMLElement): void {\n const animation = hideAnimations.get(mount)\n hideAnimations.delete(mount)\n animation?.cancel()\n mount.inert = false\n mount.removeAttribute('aria-hidden')\n}\n\nfunction hideHeading (mount: HTMLElement): void {\n if (hideAnimations.has(mount)) return\n\n const style = getComputedStyle(mount)\n const height = mount.getBoundingClientRect().height\n const opacity = style.opacity\n const marginTop = style.marginTop\n const marginBottom = style.marginBottom\n const showing = showAnimations.get(mount)\n showAnimations.delete(mount)\n showing?.cancel()\n\n const finish = () => {\n mount.hidden = true\n mount.replaceChildren()\n }\n mount.inert = true\n mount.setAttribute('aria-hidden', 'true')\n\n if (mount.hidden || !mount.firstElementChild ||\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') {\n finish()\n return\n }\n\n const animation = mount.animate([\n {\n height: `${height}px`,\n opacity,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n },\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' }\n ], { duration: 300, easing: 'ease', fill: 'forwards' })\n hideAnimations.set(mount, animation)\n animation.finished.then(() => {\n if (hideAnimations.get(mount) !== animation) return\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n }, (error: unknown) => {\n if (hideAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading disappearance.', error)\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n })\n}\n\nfunction refreshAfterAuthChange (): void {\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after an authentication change.', error)\n })\n}\n\nfunction ensureMountPoint (): HTMLElement | null {\n const mainContent = document.getElementById('MainContent')\n if (!mainContent) return null\n\n let mount = document.getElementById(PROFILE_HEADING_MOUNT_ID)\n if (!mount) {\n mount = document.createElement('div')\n mount.id = PROFILE_HEADING_MOUNT_ID\n mount.setAttribute('aria-label', 'Profile heading')\n }\n\n const navbar = document.querySelector('solid-panes-navbar')\n const outlineView = document.getElementById('OutlineView')\n const insertionPoint = navbar?.parentNode === mainContent\n ? navbar\n : outlineView?.parentNode === mainContent\n ? outlineView\n : null\n if (insertionPoint && mount.nextSibling !== insertionPoint) {\n mainContent.insertBefore(mount, insertionPoint)\n } else if (!insertionPoint && mount.parentNode !== mainContent) {\n mainContent.appendChild(mount)\n }\n return mount\n}\n\nexport async function refreshProfileHeading (force = false): Promise<void> {\n await authReady\n\n const pageUrl = headingPageUrl()\n const pod = await getPodContext(pageUrl)\n const mount = ensureMountPoint()\n if (!mount) return\n\n if (force) {\n refreshRequest++\n displayedPaneKey = ''\n loadingPaneKey = ''\n }\n\n const { view, viaAccountMenu } = readNavigationState()\n const decision = deriveHeading({\n view,\n viaAccountMenu,\n viewer: authn.currentUser()?.value,\n pageUrl,\n owner: pod.owner,\n storageUris: pod.storagePanes.map(pane => pane.subject.value)\n })\n\n if (decision.mode === 'none') {\n refreshRequest++\n loadingPaneKey = ''\n displayedPaneKey = ''\n displayedSubjectUri = ''\n hideHeading(mount)\n return\n }\n\n const { subjectUri } = decision\n const isProfilePane = decision.mode === 'full'\n cancelHeadingHide(mount)\n const paneKey = `${decision.paneName}:${subjectUri}`\n if (paneKey === displayedPaneKey || paneKey === loadingPaneKey) return\n\n const request = ++refreshRequest\n loadingPaneKey = paneKey\n let subject: NamedNode\n let profileData: ProfileDetails\n let canEdit: boolean\n let viewerMode: ViewerMode\n try {\n subject = await loadProfileFromURI(store.sym(subjectUri))\n profileData = presentProfile(subject, store)\n viewerMode = isProfilePane ? await getViewerMode(subject) : 'anonymous'\n canEdit = viewerMode === 'owner'\n } catch (error) {\n if (request === refreshRequest) loadingPaneKey = ''\n throw error\n }\n if (request !== refreshRequest) return\n\n const heading = (mount.querySelector(PROFILE_HEADING_TAG) ||\n document.createElement(PROFILE_HEADING_TAG)) as HTMLElement & {\n profileData?: ProfileDetails\n editContext?: ProfileHeadingEditContext\n friendSubject?: NamedNode\n compact?: boolean\n updateComplete?: Promise<unknown>\n }\n heading.profileData = profileData\n const viewer = authn.currentUser()\n heading.friendSubject = offersFriendAction(decision.paneName) && viewer && !viewer.sameTerm(subject)\n ? subject\n : undefined\n heading.editContext = canEdit\n ? {\n subject,\n profileData,\n viewerMode,\n onSaved: () => refreshProfileHeading(true)\n }\n : undefined\n heading.compact = !isProfilePane\n const appearing = mount.hidden || !mount.firstElementChild\n mount.hidden = false\n if (heading.parentNode !== mount) mount.replaceChildren(heading)\n displayedPaneKey = paneKey\n displayedSubjectUri = subject.value\n loadingPaneKey = ''\n if (appearing) {\n await heading.updateComplete\n if (request === refreshRequest && mount.isConnected && !mount.hidden && !hideAnimations.has(mount)) {\n showHeading(mount)\n }\n }\n}\n\n/** Put the heading where it belongs, above the navbar, after the navbar has been added. */\nexport function placeProfileHeading (): void {\n ensureMountPoint()\n}\n\n/** Shells browsing another resource can supply its current URL instead of the page URL. */\nexport function initializeProfileHeading (getPageUrl = () => window.location.href): Promise<void> {\n headingPageUrl = getPageUrl\n ensureMountPoint()\n\n if (!profileSavedListenerRegistered) {\n document.addEventListener('profile-pane-saved', (event) => {\n if (!(event instanceof CustomEvent) || event.detail?.subjectUri !== displayedSubjectUri) return\n\n const heading = document.querySelector<HTMLElement & {\n profileData?: ProfileDetails\n editContext?: ProfileHeadingEditContext\n }>(`#${PROFILE_HEADING_MOUNT_ID} ${PROFILE_HEADING_TAG}`)\n if (heading && event.detail.profileData) {\n refreshRequest++\n loadingPaneKey = ''\n heading.profileData = event.detail.profileData\n if (heading.editContext) {\n heading.editContext = { ...heading.editContext, profileData: event.detail.profileData }\n }\n return\n }\n\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after saving profile information.', error)\n })\n })\n profileSavedListenerRegistered = true\n }\n\n const readiness = authReady ?? authn.checkUser().then(() => undefined)\n authReady = readiness\n\n if (!authListenersRegistered) {\n authSession.events.on('login', refreshAfterAuthChange)\n authSession.events.on('sessionRestore', refreshAfterAuthChange)\n authSession.events.on('logout', refreshAfterAuthChange)\n authSession.events.on('sessionChange', refreshAfterAuthChange)\n authSession.events.on('identityReplaced', refreshAfterAuthChange)\n authListenersRegistered = true\n }\n\n // Navigations the page's own navigation does not make, such as links and buttons in solid-ui\n if (!navigatedListenerRegistered) {\n onNavigated(() => {\n refreshProfileHeading().catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n })\n navigatedListenerRegistered = true\n }\n\n readiness.then(() => refreshProfileHeading(true)).catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n return readiness\n}\n"],"mappings":"A,gZAcA,IAAMgB,EAAsB,8BACtBC,EAA2B,wBAE7BC,EAAiB,EACjBC,EAA8B,GAC9BC,EAA0B,GAC1BC,EAAiC,GACjCC,EACAC,EAAmB,GACnBC,EAAsB,GACtBC,EAAiB,GACjBC,MAAuB,OAAO,SAAS,KACrCC,EAAiB,IAAI,QACrBC,EAAiB,IAAI,QAE3B,SAASC,EAAa,EAA0B,CAC9C,GAAI,OAAO,aAAa,kCAAkC,CAAC,CAAC,SACxD,OAAOC,EAAM,SAAY,WAAY,OAEzC,IAAMC,EAAQ,iBAAiBD,CAAK,EAC9BE,EAAYD,EAAM,WAAa,OAC/BE,EA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AAsB,EACrD3B,EAAA,YAAY,OAAO,GAAG,iBAAkB2B,CAAsB,EAC9D3B,EAAA,YAAY,OAAO,GAAG,SAAU2B,CAAsB,EACtD3B,EAAA,YAAY,OAAO,GAAG,gBAAiB2B,CAAsB,EAC7D3B,EAAA,YAAY,OAAO,GAAG,mBAAoB2B,CAAsB,EACtC,IAI5B,AAMEvB,KALAN,EAAA,gBAAkB,CAChB8B,EAAsB,CAAC,CAAC,MAAO,GAAmB,CAChD,QAAQ,MAAM,qCAAsCP,CAAK,CAC3D,CAAC,CACH,CAAC,EAC6B,IAGhCiC,EAAU,SAAW1B,EAAsB,EAAI,CAAC,CAAC,CAAC,MAAO,GAAmB,CAC1E,QAAQ,MAAM,qCAAsCP,CAAK,CAC3D,CAAC,EACMiC,CACT,C"}
|
|
1
|
+
{"version":3,"file":"profileHeading2.cjs.js","names":["getPodContext","readNavigationState","deriveHeading","authn","loadProfileFromURI","store","presentProfile","getViewerMode","offersFriendAction","require_profileHeadingData","require_webIdUtils","require_chrome","require_podContext","require_events","require_state","solid_logic","PROFILE_HEADING_TAG","PROFILE_HEADING_MOUNT_ID","refreshRequest","navigatedListenerRegistered","authListenersRegistered","profileSavedListenerRegistered","authReady","displayedPaneKey","displayedSubjectUri","loadingPaneKey","headingPageUrl","hideAnimations","showAnimations","showHeading","mount","style","marginTop","marginBottom","animation","finish","error","cancelHeadingHide","hideHeading","height","opacity","showing","refreshAfterAuthChange","refreshProfileHeading","ensureMountPoint","mainContent","navbar","outlineView","insertionPoint","pageUrl","pod","force","decision","pane","isProfilePane","paneKey","subjectUri","request","subject","profileData","canEdit","viewerMode","heading","viewer","appearing","placeProfileHeading","initializeProfileHeading","getPageUrl","event","readiness"],"sources":["../../src/mainPage/profileHeading.ts"],"sourcesContent":["import { authn, authSession, store } from 'solid-logic'\nimport { NamedNode } from 'rdflib'\nimport type { ProfileDetails } from '../components/profile-heading/editor/sections/heading/types'\nimport type { ProfileHeadingEditContext } from '../components/profile-heading/ProfileHeading'\nimport { getViewerMode, presentProfile } from '../components/profile-heading/profileHeadingData'\nimport type { ViewerMode } from '../types'\nimport { loadProfileFromURI } from '../utils/webIdUtils'\nimport '../components/profile-heading'\nimport './profileHeading.css'\nimport { deriveHeading, offersFriendAction } from '../navigation/chrome'\nimport { getPodContext } from '../navigation/podContext'\nimport { onNavigated } from '../navigation/events'\nimport { readNavigationState } from '../navigation/state'\n\nconst PROFILE_HEADING_TAG = 'solid-panes-profile-heading'\nconst PROFILE_HEADING_MOUNT_ID = 'profile-heading-mount'\n\nlet refreshRequest = 0\nlet navigatedListenerRegistered = false\nlet authListenersRegistered = false\nlet profileSavedListenerRegistered = false\nlet authReady: Promise<void> | undefined\nlet displayedPaneKey = ''\nlet displayedSubjectUri = ''\nlet loadingPaneKey = ''\nlet headingPageUrl = () => window.location.href\nconst hideAnimations = new WeakMap<HTMLElement, Animation>()\nconst showAnimations = new WeakMap<HTMLElement, Animation>()\n\nfunction showHeading (mount: HTMLElement): void {\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') return\n\n const style = getComputedStyle(mount)\n const marginTop = style.marginTop || '18px'\n const marginBottom = style.marginBottom || '20px'\n const animation = mount.animate([\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' },\n {\n height: `${mount.getBoundingClientRect().height}px`,\n opacity: 1,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n }\n ], { duration: 300, easing: 'ease', fill: 'both' })\n showAnimations.set(mount, animation)\n const finish = () => {\n if (showAnimations.get(mount) !== animation) return\n showAnimations.delete(mount)\n animation.cancel()\n }\n animation.finished.then(finish, (error: unknown) => {\n if (showAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading appearance.', error)\n finish()\n })\n}\n\nfunction cancelHeadingHide (mount: HTMLElement): void {\n const animation = hideAnimations.get(mount)\n hideAnimations.delete(mount)\n animation?.cancel()\n mount.inert = false\n mount.removeAttribute('aria-hidden')\n}\n\nfunction hideHeading (mount: HTMLElement): void {\n if (hideAnimations.has(mount)) return\n\n const style = getComputedStyle(mount)\n const height = mount.getBoundingClientRect().height\n const opacity = style.opacity\n const marginTop = style.marginTop\n const marginBottom = style.marginBottom\n const showing = showAnimations.get(mount)\n showAnimations.delete(mount)\n showing?.cancel()\n\n const finish = () => {\n mount.hidden = true\n mount.replaceChildren()\n }\n mount.inert = true\n mount.setAttribute('aria-hidden', 'true')\n\n if (mount.hidden || !mount.firstElementChild ||\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') {\n finish()\n return\n }\n\n const animation = mount.animate([\n {\n height: `${height}px`,\n opacity,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n },\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' }\n ], { duration: 300, easing: 'ease', fill: 'forwards' })\n hideAnimations.set(mount, animation)\n animation.finished.then(() => {\n if (hideAnimations.get(mount) !== animation) return\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n }, (error: unknown) => {\n if (hideAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading disappearance.', error)\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n })\n}\n\nfunction refreshAfterAuthChange (): void {\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after an authentication change.', error)\n })\n}\n\nfunction ensureMountPoint (): HTMLElement | null {\n const mainContent = document.getElementById('MainContent')\n if (!mainContent) return null\n\n let mount = document.getElementById(PROFILE_HEADING_MOUNT_ID)\n if (!mount) {\n mount = document.createElement('div')\n mount.id = PROFILE_HEADING_MOUNT_ID\n mount.setAttribute('aria-label', 'Profile heading')\n }\n\n const navbar = document.querySelector('solid-panes-navbar')\n const outlineView = document.getElementById('OutlineView')\n const insertionPoint = navbar?.parentNode === mainContent\n ? navbar\n : outlineView?.parentNode === mainContent\n ? outlineView\n : null\n if (insertionPoint && mount.nextSibling !== insertionPoint) {\n mainContent.insertBefore(mount, insertionPoint)\n } else if (!insertionPoint && mount.parentNode !== mainContent) {\n mainContent.appendChild(mount)\n }\n return mount\n}\n\nexport async function refreshProfileHeading (force = false): Promise<void> {\n await authReady\n\n const pageUrl = headingPageUrl()\n const pod = await getPodContext(pageUrl)\n const mount = ensureMountPoint()\n if (!mount) return\n\n if (force) {\n refreshRequest++\n displayedPaneKey = ''\n loadingPaneKey = ''\n }\n\n const { view, viaAccountMenu } = readNavigationState()\n const decision = deriveHeading({\n view,\n viaAccountMenu,\n viewer: authn.currentUser()?.value,\n pageUrl,\n owner: pod.owner,\n storageUris: pod.storagePanes.map(pane => pane.subject.value)\n })\n\n if (decision.mode === 'none') {\n refreshRequest++\n loadingPaneKey = ''\n displayedPaneKey = ''\n displayedSubjectUri = ''\n hideHeading(mount)\n return\n }\n\n const { subjectUri } = decision\n const isProfilePane = decision.mode === 'full'\n cancelHeadingHide(mount)\n const paneKey = `${decision.paneName}:${subjectUri}`\n if (paneKey === displayedPaneKey || paneKey === loadingPaneKey) return\n\n const request = ++refreshRequest\n loadingPaneKey = paneKey\n let subject: NamedNode\n let profileData: ProfileDetails\n let canEdit: boolean\n let viewerMode: ViewerMode\n try {\n subject = await loadProfileFromURI(store.sym(subjectUri))\n profileData = presentProfile(subject, store)\n viewerMode = isProfilePane ? await getViewerMode(subject) : 'anonymous'\n canEdit = viewerMode === 'owner'\n } catch (error) {\n if (request === refreshRequest) loadingPaneKey = ''\n throw error\n }\n if (request !== refreshRequest) return\n\n const heading = (mount.querySelector(PROFILE_HEADING_TAG) ||\n document.createElement(PROFILE_HEADING_TAG)) as HTMLElement & {\n profileData?: ProfileDetails\n subject?: NamedNode\n editContext?: ProfileHeadingEditContext\n friendSubject?: NamedNode\n compact?: boolean\n updateComplete?: Promise<unknown>\n }\n heading.profileData = profileData\n heading.subject = subject\n const viewer = authn.currentUser()\n heading.friendSubject = offersFriendAction(decision.paneName) && viewer && !viewer.sameTerm(subject)\n ? subject\n : undefined\n heading.editContext = canEdit\n ? {\n subject,\n profileData,\n viewerMode,\n onSaved: () => refreshProfileHeading(true)\n }\n : undefined\n heading.compact = !isProfilePane\n const appearing = mount.hidden || !mount.firstElementChild\n mount.hidden = false\n if (heading.parentNode !== mount) mount.replaceChildren(heading)\n displayedPaneKey = paneKey\n displayedSubjectUri = subject.value\n loadingPaneKey = ''\n if (appearing) {\n await heading.updateComplete\n if (request === refreshRequest && mount.isConnected && !mount.hidden && !hideAnimations.has(mount)) {\n showHeading(mount)\n }\n }\n}\n\n/** Put the heading where it belongs, above the navbar, after the navbar has been added. */\nexport function placeProfileHeading (): void {\n ensureMountPoint()\n}\n\n/** Shells browsing another resource can supply its current URL instead of the page URL. */\nexport function initializeProfileHeading (getPageUrl = () => window.location.href): Promise<void> {\n headingPageUrl = getPageUrl\n ensureMountPoint()\n\n if (!profileSavedListenerRegistered) {\n document.addEventListener('profile-pane-saved', (event) => {\n if (!(event instanceof CustomEvent) || event.detail?.subjectUri !== displayedSubjectUri) return\n\n const heading = document.querySelector<HTMLElement & {\n profileData?: ProfileDetails\n editContext?: ProfileHeadingEditContext\n }>(`#${PROFILE_HEADING_MOUNT_ID} ${PROFILE_HEADING_TAG}`)\n if (heading && event.detail.profileData) {\n refreshRequest++\n loadingPaneKey = ''\n heading.profileData = event.detail.profileData\n if (heading.editContext) {\n heading.editContext = { ...heading.editContext, profileData: event.detail.profileData }\n }\n return\n }\n\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after saving profile information.', error)\n })\n })\n profileSavedListenerRegistered = true\n }\n\n const readiness = authReady ?? authn.checkUser().then(() => undefined)\n authReady = readiness\n\n if (!authListenersRegistered) {\n authSession.events.on('login', refreshAfterAuthChange)\n authSession.events.on('sessionRestore', refreshAfterAuthChange)\n authSession.events.on('logout', refreshAfterAuthChange)\n authSession.events.on('sessionChange', refreshAfterAuthChange)\n authSession.events.on('identityReplaced', refreshAfterAuthChange)\n authListenersRegistered = true\n }\n\n // Navigations the page's own navigation does not make, such as links and buttons in solid-ui\n if (!navigatedListenerRegistered) {\n onNavigated(() => {\n refreshProfileHeading().catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n })\n navigatedListenerRegistered = true\n }\n\n readiness.then(() => refreshProfileHeading(true)).catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n return readiness\n}\n"],"mappings":"A,sZAcA,IAAMgB,EAAsB,8BACtBC,EAA2B,wBAE7BC,EAAiB,EACjBC,EAA8B,GAC9BC,EAA0B,GAC1BC,EAAiC,GACjCC,EACAC,EAAmB,GACnBC,EAAsB,GACtBC,EAAiB,GACjBC,MAAuB,OAAO,SAAS,KACrCC,EAAiB,IAAI,QACrBC,EAAiB,IAAI,QAE3B,SAASC,EAAa,EAA0B,CAC9C,GAAI,OAAO,aAAa,kCAAkC,CAAC,CAAC,SACxD,OAAOC,EAAM,SAAY,WAAY,OAEzC,IAAMC,EAAQ,iBAAiBD,CAAK,EAC9BE,EAAYD,EAAM,WAAa,OAC/BE,EAAeF,EAAM,cAAgB,OACrCG,EAAYJ,EAAM,QAAQ,CAC9B,CAAE,OAAQ,MAAO,QAAS,EAAG,UAAW,MAAO,aAAc,MAAO,SAAU,QAAS,EACvF,CACE,OAAQ,GAAGA,EAAM,sBAAsB,CAAC,CAAC,OAAO,IAChD,QAAS,EACT,YACA,eACA,SAAU,QACZ,CACF,EAAG,CAAE,SAAU,IAAK,OAAQ,OAAQ,KAAM,MAAO,CAAC,EAClDF,EAAe,IAAIE,EAAOI,CAAS,EACnC,IAAMC,MAAe,CACfP,EAAe,IAAIE,CAAK,IAAMI,IAClCN,EAAe,OAAOE,CAAK,EAC3BI,EAAU,OAAO,EACnB,EACAA,EAAU,SAAS,KAAKC,EAAS,GAAmB,CAC9CP,EAAe,IAAIE,CAAK,IAAMI,IAClC,QAAQ,MAAM,gDAAiDE,CAAK,EACpED,EAAO,EACT,CAAC,CACH,CAEA,SAASE,EAAmB,EAA0B,CACpD,IAAMH,EAAYP,EAAe,IA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profile-heading-mount{margin-top:18px;margin-bottom:20px}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();import {
|
|
2
|
-
import {
|
|
3
|
-
import { getPodContext as r } from "../navigation/podContext.esm.js";
|
|
4
|
-
import { readNavigationState as i } from "../navigation/state.esm.js";
|
|
5
|
-
import { onNavigated as a } from "../navigation/events.esm.js";
|
|
6
|
-
import { getViewerMode as o, presentProfile as s } from "../components/profile-heading/profileHeadingData.esm.js";
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`#profile-heading-mount{margin-top:18px;margin-bottom:20px}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();import { getViewerMode as e, presentProfile as t } from "../components/profile-heading/profileHeadingData.esm.js";
|
|
2
|
+
import { loadProfileFromURI as n } from "../utils/webIdUtils.esm.js";
|
|
7
3
|
import "../components/profile-heading/index.esm.js";
|
|
8
4
|
|
|
5
|
+
import { deriveHeading as r, offersFriendAction as i } from "../navigation/chrome.esm.js";
|
|
6
|
+
import { getPodContext as a } from "../navigation/podContext.esm.js";
|
|
7
|
+
import { onNavigated as o } from "../navigation/events.esm.js";
|
|
8
|
+
import { readNavigationState as s } from "../navigation/state.esm.js";
|
|
9
9
|
import { authSession as c, authn as l, store as u } from "solid-logic";
|
|
10
10
|
// src/mainPage/profileHeading.ts
|
|
11
11
|
var d = "solid-panes-profile-heading", f = "profile-heading-mount", p = 0, m = !1, h = !1, g = !1, _, v = "", y = "", b = "", x = () => window.location.href, S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap();
|
|
@@ -87,12 +87,12 @@ function O() {
|
|
|
87
87
|
let n = document.querySelector("solid-panes-navbar"), r = document.getElementById("OutlineView"), i = n?.parentNode === e ? n : r?.parentNode === e ? r : null;
|
|
88
88
|
return i && t.nextSibling !== i ? e.insertBefore(t, i) : !i && t.parentNode !== e && e.appendChild(t), t;
|
|
89
89
|
}
|
|
90
|
-
async function k(
|
|
90
|
+
async function k(o = !1) {
|
|
91
91
|
await _;
|
|
92
|
-
let c = x(), f = await
|
|
92
|
+
let c = x(), f = await a(c), m = O();
|
|
93
93
|
if (!m) return;
|
|
94
|
-
|
|
95
|
-
let { view: h, viaAccountMenu: g } =
|
|
94
|
+
o && (p++, v = "", b = "");
|
|
95
|
+
let { view: h, viaAccountMenu: g } = s(), C = r({
|
|
96
96
|
view: h,
|
|
97
97
|
viaAccountMenu: g,
|
|
98
98
|
viewer: l.currentUser()?.value,
|
|
@@ -112,15 +112,15 @@ async function k(a = !1) {
|
|
|
112
112
|
b = j;
|
|
113
113
|
let N, P, F, I;
|
|
114
114
|
try {
|
|
115
|
-
N = await
|
|
115
|
+
N = await n(u.sym(D)), P = t(N, u), I = A ? await e(N) : "anonymous", F = I === "owner";
|
|
116
116
|
} catch (e) {
|
|
117
117
|
throw M === p && (b = ""), e;
|
|
118
118
|
}
|
|
119
119
|
if (M !== p) return;
|
|
120
120
|
let L = m.querySelector(d) || document.createElement(d);
|
|
121
|
-
L.profileData = P;
|
|
121
|
+
L.profileData = P, L.subject = N;
|
|
122
122
|
let R = l.currentUser();
|
|
123
|
-
L.friendSubject =
|
|
123
|
+
L.friendSubject = i(C.paneName) && R && !R.sameTerm(N) ? N : void 0, L.editContext = F ? {
|
|
124
124
|
subject: N,
|
|
125
125
|
profileData: P,
|
|
126
126
|
viewerMode: I,
|
|
@@ -144,7 +144,7 @@ function j(e = () => window.location.href) {
|
|
|
144
144
|
});
|
|
145
145
|
}), !0);
|
|
146
146
|
let t = _ ?? l.checkUser().then(() => void 0);
|
|
147
|
-
return _ = t, h ||= (c.events.on("login", D), c.events.on("sessionRestore", D), c.events.on("logout", D), c.events.on("sessionChange", D), c.events.on("identityReplaced", D), !0), m ||= (
|
|
147
|
+
return _ = t, h ||= (c.events.on("login", D), c.events.on("sessionRestore", D), c.events.on("logout", D), c.events.on("sessionChange", D), c.events.on("identityReplaced", D), !0), m ||= (o(() => {
|
|
148
148
|
k().catch((e) => {
|
|
149
149
|
console.error("Failed to refresh profile heading.", e);
|
|
150
150
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileHeading2.esm.js","names":["PROFILE_HEADING_TAG","PROFILE_HEADING_MOUNT_ID","refreshRequest","navigatedListenerRegistered","authListenersRegistered","profileSavedListenerRegistered","authReady","displayedPaneKey","displayedSubjectUri","loadingPaneKey","headingPageUrl","hideAnimations","showAnimations","showHeading","mount","style","marginTop","marginBottom","animation","finish","error","cancelHeadingHide","hideHeading","height","opacity","showing","refreshAfterAuthChange","ensureMountPoint","mainContent","navbar","outlineView","insertionPoint","refreshProfileHeading","pageUrl","pod","getPodContext","force","readNavigationState","decision","deriveHeading","authn","pane","isProfilePane","paneKey","subjectUri","request","subject","profileData","canEdit","viewerMode","loadProfileFromURI","store","presentProfile","getViewerMode","heading","viewer","offersFriendAction","appearing","placeProfileHeading","initializeProfileHeading","getPageUrl","event","readiness","authSession","onNavigated"],"sources":["../../src/mainPage/profileHeading.ts"],"sourcesContent":["import { authn, authSession, store } from 'solid-logic'\nimport { NamedNode } from 'rdflib'\nimport type { ProfileDetails } from '../components/profile-heading/editor/sections/heading/types'\nimport type { ProfileHeadingEditContext } from '../components/profile-heading/ProfileHeading'\nimport { getViewerMode, presentProfile } from '../components/profile-heading/profileHeadingData'\nimport type { ViewerMode } from '../types'\nimport { loadProfileFromURI } from '../utils/webIdUtils'\nimport '../components/profile-heading'\nimport './profileHeading.css'\nimport { deriveHeading, offersFriendAction } from '../navigation/chrome'\nimport { getPodContext } from '../navigation/podContext'\nimport { onNavigated } from '../navigation/events'\nimport { readNavigationState } from '../navigation/state'\n\nconst PROFILE_HEADING_TAG = 'solid-panes-profile-heading'\nconst PROFILE_HEADING_MOUNT_ID = 'profile-heading-mount'\n\nlet refreshRequest = 0\nlet navigatedListenerRegistered = false\nlet authListenersRegistered = false\nlet profileSavedListenerRegistered = false\nlet authReady: Promise<void> | undefined\nlet displayedPaneKey = ''\nlet displayedSubjectUri = ''\nlet loadingPaneKey = ''\nlet headingPageUrl = () => window.location.href\nconst hideAnimations = new WeakMap<HTMLElement, Animation>()\nconst showAnimations = new WeakMap<HTMLElement, Animation>()\n\nfunction showHeading (mount: HTMLElement): void {\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') return\n\n const style = getComputedStyle(mount)\n const marginTop = style.marginTop || '18px'\n const marginBottom = style.marginBottom || '20px'\n const animation = mount.animate([\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' },\n {\n height: `${mount.getBoundingClientRect().height}px`,\n opacity: 1,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n }\n ], { duration: 300, easing: 'ease', fill: 'both' })\n showAnimations.set(mount, animation)\n const finish = () => {\n if (showAnimations.get(mount) !== animation) return\n showAnimations.delete(mount)\n animation.cancel()\n }\n animation.finished.then(finish, (error: unknown) => {\n if (showAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading appearance.', error)\n finish()\n })\n}\n\nfunction cancelHeadingHide (mount: HTMLElement): void {\n const animation = hideAnimations.get(mount)\n hideAnimations.delete(mount)\n animation?.cancel()\n mount.inert = false\n mount.removeAttribute('aria-hidden')\n}\n\nfunction hideHeading (mount: HTMLElement): void {\n if (hideAnimations.has(mount)) return\n\n const style = getComputedStyle(mount)\n const height = mount.getBoundingClientRect().height\n const opacity = style.opacity\n const marginTop = style.marginTop\n const marginBottom = style.marginBottom\n const showing = showAnimations.get(mount)\n showAnimations.delete(mount)\n showing?.cancel()\n\n const finish = () => {\n mount.hidden = true\n mount.replaceChildren()\n }\n mount.inert = true\n mount.setAttribute('aria-hidden', 'true')\n\n if (mount.hidden || !mount.firstElementChild ||\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') {\n finish()\n return\n }\n\n const animation = mount.animate([\n {\n height: `${height}px`,\n opacity,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n },\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' }\n ], { duration: 300, easing: 'ease', fill: 'forwards' })\n hideAnimations.set(mount, animation)\n animation.finished.then(() => {\n if (hideAnimations.get(mount) !== animation) return\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n }, (error: unknown) => {\n if (hideAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading disappearance.', error)\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n })\n}\n\nfunction refreshAfterAuthChange (): void {\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after an authentication change.', error)\n })\n}\n\nfunction ensureMountPoint (): HTMLElement | null {\n const mainContent = document.getElementById('MainContent')\n if (!mainContent) return null\n\n let mount = document.getElementById(PROFILE_HEADING_MOUNT_ID)\n if (!mount) {\n mount = document.createElement('div')\n mount.id = PROFILE_HEADING_MOUNT_ID\n mount.setAttribute('aria-label', 'Profile heading')\n }\n\n const navbar = document.querySelector('solid-panes-navbar')\n const outlineView = document.getElementById('OutlineView')\n const insertionPoint = navbar?.parentNode === mainContent\n ? navbar\n : outlineView?.parentNode === mainContent\n ? outlineView\n : null\n if (insertionPoint && mount.nextSibling !== insertionPoint) {\n mainContent.insertBefore(mount, insertionPoint)\n } else if (!insertionPoint && mount.parentNode !== mainContent) {\n mainContent.appendChild(mount)\n }\n return mount\n}\n\nexport async function refreshProfileHeading (force = false): Promise<void> {\n await authReady\n\n const pageUrl = headingPageUrl()\n const pod = await getPodContext(pageUrl)\n const mount = ensureMountPoint()\n if (!mount) return\n\n if (force) {\n refreshRequest++\n displayedPaneKey = ''\n loadingPaneKey = ''\n }\n\n const { view, viaAccountMenu } = readNavigationState()\n const decision = deriveHeading({\n view,\n viaAccountMenu,\n viewer: authn.currentUser()?.value,\n pageUrl,\n owner: pod.owner,\n storageUris: pod.storagePanes.map(pane => pane.subject.value)\n })\n\n if (decision.mode === 'none') {\n refreshRequest++\n loadingPaneKey = ''\n displayedPaneKey = ''\n displayedSubjectUri = ''\n hideHeading(mount)\n return\n }\n\n const { subjectUri } = decision\n const isProfilePane = decision.mode === 'full'\n cancelHeadingHide(mount)\n const paneKey = `${decision.paneName}:${subjectUri}`\n if (paneKey === displayedPaneKey || paneKey === loadingPaneKey) return\n\n const request = ++refreshRequest\n loadingPaneKey = paneKey\n let subject: NamedNode\n let profileData: ProfileDetails\n let canEdit: boolean\n let viewerMode: ViewerMode\n try {\n subject = await loadProfileFromURI(store.sym(subjectUri))\n profileData = presentProfile(subject, store)\n viewerMode = isProfilePane ? await getViewerMode(subject) : 'anonymous'\n canEdit = viewerMode === 'owner'\n } catch (error) {\n if (request === refreshRequest) loadingPaneKey = ''\n throw error\n }\n if (request !== refreshRequest) return\n\n const heading = (mount.querySelector(PROFILE_HEADING_TAG) ||\n document.createElement(PROFILE_HEADING_TAG)) as HTMLElement & {\n profileData?: ProfileDetails\n editContext?: ProfileHeadingEditContext\n friendSubject?: NamedNode\n compact?: boolean\n updateComplete?: Promise<unknown>\n }\n heading.profileData = profileData\n const viewer = authn.currentUser()\n heading.friendSubject = offersFriendAction(decision.paneName) && viewer && !viewer.sameTerm(subject)\n ? subject\n : undefined\n heading.editContext = canEdit\n ? {\n subject,\n profileData,\n viewerMode,\n onSaved: () => refreshProfileHeading(true)\n }\n : undefined\n heading.compact = !isProfilePane\n const appearing = mount.hidden || !mount.firstElementChild\n mount.hidden = false\n if (heading.parentNode !== mount) mount.replaceChildren(heading)\n displayedPaneKey = paneKey\n displayedSubjectUri = subject.value\n loadingPaneKey = ''\n if (appearing) {\n await heading.updateComplete\n if (request === refreshRequest && mount.isConnected && !mount.hidden && !hideAnimations.has(mount)) {\n showHeading(mount)\n }\n }\n}\n\n/** Put the heading where it belongs, above the navbar, after the navbar has been added. */\nexport function placeProfileHeading (): void {\n ensureMountPoint()\n}\n\n/** Shells browsing another resource can supply its current URL instead of the page URL. */\nexport function initializeProfileHeading (getPageUrl = () => window.location.href): Promise<void> {\n headingPageUrl = getPageUrl\n ensureMountPoint()\n\n if (!profileSavedListenerRegistered) {\n document.addEventListener('profile-pane-saved', (event) => {\n if (!(event instanceof CustomEvent) || event.detail?.subjectUri !== displayedSubjectUri) return\n\n const heading = document.querySelector<HTMLElement & {\n profileData?: ProfileDetails\n editContext?: ProfileHeadingEditContext\n }>(`#${PROFILE_HEADING_MOUNT_ID} ${PROFILE_HEADING_TAG}`)\n if (heading && event.detail.profileData) {\n refreshRequest++\n loadingPaneKey = ''\n heading.profileData = event.detail.profileData\n if (heading.editContext) {\n heading.editContext = { ...heading.editContext, profileData: event.detail.profileData }\n }\n return\n }\n\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after saving profile information.', error)\n })\n })\n profileSavedListenerRegistered = true\n }\n\n const readiness = authReady ?? authn.checkUser().then(() => undefined)\n authReady = readiness\n\n if (!authListenersRegistered) {\n authSession.events.on('login', refreshAfterAuthChange)\n authSession.events.on('sessionRestore', refreshAfterAuthChange)\n authSession.events.on('logout', refreshAfterAuthChange)\n authSession.events.on('sessionChange', refreshAfterAuthChange)\n authSession.events.on('identityReplaced', refreshAfterAuthChange)\n authListenersRegistered = true\n }\n\n // Navigations the page's own navigation does not make, such as links and buttons in solid-ui\n if (!navigatedListenerRegistered) {\n onNavigated(() => {\n refreshProfileHeading().catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n })\n navigatedListenerRegistered = true\n }\n\n readiness.then(() => refreshProfileHeading(true)).catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n return readiness\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAMA,IAAsB,+BACtBC,IAA2B,yBAE7BC,IAAiB,GACjBC,IAA8B,IAC9BC,IAA0B,IAC1BC,IAAiC,IACjCC,GACAC,IAAmB,IACnBC,IAAsB,IACtBC,IAAiB,IACjBC,UAAuB,OAAO,SAAS,MACrCC,oBAAiB,IAAI,QAAgC,GACrDC,oB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AAuEZ,CAAK;EAC5F,CAAC;CACH,CAAC,GACgC;CAGnC,IAAM0C,IAAYxD,KAAakC,EAAM,UAAU,CAAC,CAAC,WAAW,KAAA,CAAS;CAyBrE,OAxBA,IAAYsB,GAEZ,AAME1D,OALA2D,EAAY,OAAO,GAAG,SAASrC,CAAsB,GACrDqC,EAAY,OAAO,GAAG,kBAAkBrC,CAAsB,GAC9DqC,EAAY,OAAO,GAAG,UAAUrC,CAAsB,GACtDqC,EAAY,OAAO,GAAG,iBAAiBrC,CAAsB,GAC7DqC,EAAY,OAAO,GAAG,oBAAoBrC,CAAsB,GACtC,KAI5B,AAMEvB,OALA6D,QAAkB;EAChB,EAAsB,CAAC,CAAC,OAAO,MAAmB;GAChD,QAAQ,MAAM,sCAAsC5C,CAAK;EAC3D,CAAC;CACH,CAAC,GAC6B,KAGhC0C,EAAU,WAAW9B,EAAsB,EAAI,CAAC,CAAC,CAAC,OAAO,MAAmB;EAC1E,QAAQ,MAAM,sCAAsCZ,CAAK;CAC3D,CAAC,GACM0C;AACT"}
|
|
1
|
+
{"version":3,"file":"profileHeading2.esm.js","names":["PROFILE_HEADING_TAG","PROFILE_HEADING_MOUNT_ID","refreshRequest","navigatedListenerRegistered","authListenersRegistered","profileSavedListenerRegistered","authReady","displayedPaneKey","displayedSubjectUri","loadingPaneKey","headingPageUrl","hideAnimations","showAnimations","showHeading","mount","style","marginTop","marginBottom","animation","finish","error","cancelHeadingHide","hideHeading","height","opacity","showing","refreshAfterAuthChange","ensureMountPoint","mainContent","navbar","outlineView","insertionPoint","refreshProfileHeading","pageUrl","pod","getPodContext","force","readNavigationState","decision","deriveHeading","authn","pane","isProfilePane","paneKey","subjectUri","request","subject","profileData","canEdit","viewerMode","loadProfileFromURI","store","presentProfile","getViewerMode","heading","viewer","offersFriendAction","appearing","placeProfileHeading","initializeProfileHeading","getPageUrl","event","readiness","authSession","onNavigated"],"sources":["../../src/mainPage/profileHeading.ts"],"sourcesContent":["import { authn, authSession, store } from 'solid-logic'\nimport { NamedNode } from 'rdflib'\nimport type { ProfileDetails } from '../components/profile-heading/editor/sections/heading/types'\nimport type { ProfileHeadingEditContext } from '../components/profile-heading/ProfileHeading'\nimport { getViewerMode, presentProfile } from '../components/profile-heading/profileHeadingData'\nimport type { ViewerMode } from '../types'\nimport { loadProfileFromURI } from '../utils/webIdUtils'\nimport '../components/profile-heading'\nimport './profileHeading.css'\nimport { deriveHeading, offersFriendAction } from '../navigation/chrome'\nimport { getPodContext } from '../navigation/podContext'\nimport { onNavigated } from '../navigation/events'\nimport { readNavigationState } from '../navigation/state'\n\nconst PROFILE_HEADING_TAG = 'solid-panes-profile-heading'\nconst PROFILE_HEADING_MOUNT_ID = 'profile-heading-mount'\n\nlet refreshRequest = 0\nlet navigatedListenerRegistered = false\nlet authListenersRegistered = false\nlet profileSavedListenerRegistered = false\nlet authReady: Promise<void> | undefined\nlet displayedPaneKey = ''\nlet displayedSubjectUri = ''\nlet loadingPaneKey = ''\nlet headingPageUrl = () => window.location.href\nconst hideAnimations = new WeakMap<HTMLElement, Animation>()\nconst showAnimations = new WeakMap<HTMLElement, Animation>()\n\nfunction showHeading (mount: HTMLElement): void {\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') return\n\n const style = getComputedStyle(mount)\n const marginTop = style.marginTop || '18px'\n const marginBottom = style.marginBottom || '20px'\n const animation = mount.animate([\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' },\n {\n height: `${mount.getBoundingClientRect().height}px`,\n opacity: 1,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n }\n ], { duration: 300, easing: 'ease', fill: 'both' })\n showAnimations.set(mount, animation)\n const finish = () => {\n if (showAnimations.get(mount) !== animation) return\n showAnimations.delete(mount)\n animation.cancel()\n }\n animation.finished.then(finish, (error: unknown) => {\n if (showAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading appearance.', error)\n finish()\n })\n}\n\nfunction cancelHeadingHide (mount: HTMLElement): void {\n const animation = hideAnimations.get(mount)\n hideAnimations.delete(mount)\n animation?.cancel()\n mount.inert = false\n mount.removeAttribute('aria-hidden')\n}\n\nfunction hideHeading (mount: HTMLElement): void {\n if (hideAnimations.has(mount)) return\n\n const style = getComputedStyle(mount)\n const height = mount.getBoundingClientRect().height\n const opacity = style.opacity\n const marginTop = style.marginTop\n const marginBottom = style.marginBottom\n const showing = showAnimations.get(mount)\n showAnimations.delete(mount)\n showing?.cancel()\n\n const finish = () => {\n mount.hidden = true\n mount.replaceChildren()\n }\n mount.inert = true\n mount.setAttribute('aria-hidden', 'true')\n\n if (mount.hidden || !mount.firstElementChild ||\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n typeof mount.animate !== 'function') {\n finish()\n return\n }\n\n const animation = mount.animate([\n {\n height: `${height}px`,\n opacity,\n marginTop,\n marginBottom,\n overflow: 'hidden'\n },\n { height: '0px', opacity: 0, marginTop: '0px', marginBottom: '0px', overflow: 'hidden' }\n ], { duration: 300, easing: 'ease', fill: 'forwards' })\n hideAnimations.set(mount, animation)\n animation.finished.then(() => {\n if (hideAnimations.get(mount) !== animation) return\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n }, (error: unknown) => {\n if (hideAnimations.get(mount) !== animation) return\n console.error('Failed to animate profile heading disappearance.', error)\n finish()\n hideAnimations.delete(mount)\n animation.cancel()\n })\n}\n\nfunction refreshAfterAuthChange (): void {\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after an authentication change.', error)\n })\n}\n\nfunction ensureMountPoint (): HTMLElement | null {\n const mainContent = document.getElementById('MainContent')\n if (!mainContent) return null\n\n let mount = document.getElementById(PROFILE_HEADING_MOUNT_ID)\n if (!mount) {\n mount = document.createElement('div')\n mount.id = PROFILE_HEADING_MOUNT_ID\n mount.setAttribute('aria-label', 'Profile heading')\n }\n\n const navbar = document.querySelector('solid-panes-navbar')\n const outlineView = document.getElementById('OutlineView')\n const insertionPoint = navbar?.parentNode === mainContent\n ? navbar\n : outlineView?.parentNode === mainContent\n ? outlineView\n : null\n if (insertionPoint && mount.nextSibling !== insertionPoint) {\n mainContent.insertBefore(mount, insertionPoint)\n } else if (!insertionPoint && mount.parentNode !== mainContent) {\n mainContent.appendChild(mount)\n }\n return mount\n}\n\nexport async function refreshProfileHeading (force = false): Promise<void> {\n await authReady\n\n const pageUrl = headingPageUrl()\n const pod = await getPodContext(pageUrl)\n const mount = ensureMountPoint()\n if (!mount) return\n\n if (force) {\n refreshRequest++\n displayedPaneKey = ''\n loadingPaneKey = ''\n }\n\n const { view, viaAccountMenu } = readNavigationState()\n const decision = deriveHeading({\n view,\n viaAccountMenu,\n viewer: authn.currentUser()?.value,\n pageUrl,\n owner: pod.owner,\n storageUris: pod.storagePanes.map(pane => pane.subject.value)\n })\n\n if (decision.mode === 'none') {\n refreshRequest++\n loadingPaneKey = ''\n displayedPaneKey = ''\n displayedSubjectUri = ''\n hideHeading(mount)\n return\n }\n\n const { subjectUri } = decision\n const isProfilePane = decision.mode === 'full'\n cancelHeadingHide(mount)\n const paneKey = `${decision.paneName}:${subjectUri}`\n if (paneKey === displayedPaneKey || paneKey === loadingPaneKey) return\n\n const request = ++refreshRequest\n loadingPaneKey = paneKey\n let subject: NamedNode\n let profileData: ProfileDetails\n let canEdit: boolean\n let viewerMode: ViewerMode\n try {\n subject = await loadProfileFromURI(store.sym(subjectUri))\n profileData = presentProfile(subject, store)\n viewerMode = isProfilePane ? await getViewerMode(subject) : 'anonymous'\n canEdit = viewerMode === 'owner'\n } catch (error) {\n if (request === refreshRequest) loadingPaneKey = ''\n throw error\n }\n if (request !== refreshRequest) return\n\n const heading = (mount.querySelector(PROFILE_HEADING_TAG) ||\n document.createElement(PROFILE_HEADING_TAG)) as HTMLElement & {\n profileData?: ProfileDetails\n subject?: NamedNode\n editContext?: ProfileHeadingEditContext\n friendSubject?: NamedNode\n compact?: boolean\n updateComplete?: Promise<unknown>\n }\n heading.profileData = profileData\n heading.subject = subject\n const viewer = authn.currentUser()\n heading.friendSubject = offersFriendAction(decision.paneName) && viewer && !viewer.sameTerm(subject)\n ? subject\n : undefined\n heading.editContext = canEdit\n ? {\n subject,\n profileData,\n viewerMode,\n onSaved: () => refreshProfileHeading(true)\n }\n : undefined\n heading.compact = !isProfilePane\n const appearing = mount.hidden || !mount.firstElementChild\n mount.hidden = false\n if (heading.parentNode !== mount) mount.replaceChildren(heading)\n displayedPaneKey = paneKey\n displayedSubjectUri = subject.value\n loadingPaneKey = ''\n if (appearing) {\n await heading.updateComplete\n if (request === refreshRequest && mount.isConnected && !mount.hidden && !hideAnimations.has(mount)) {\n showHeading(mount)\n }\n }\n}\n\n/** Put the heading where it belongs, above the navbar, after the navbar has been added. */\nexport function placeProfileHeading (): void {\n ensureMountPoint()\n}\n\n/** Shells browsing another resource can supply its current URL instead of the page URL. */\nexport function initializeProfileHeading (getPageUrl = () => window.location.href): Promise<void> {\n headingPageUrl = getPageUrl\n ensureMountPoint()\n\n if (!profileSavedListenerRegistered) {\n document.addEventListener('profile-pane-saved', (event) => {\n if (!(event instanceof CustomEvent) || event.detail?.subjectUri !== displayedSubjectUri) return\n\n const heading = document.querySelector<HTMLElement & {\n profileData?: ProfileDetails\n editContext?: ProfileHeadingEditContext\n }>(`#${PROFILE_HEADING_MOUNT_ID} ${PROFILE_HEADING_TAG}`)\n if (heading && event.detail.profileData) {\n refreshRequest++\n loadingPaneKey = ''\n heading.profileData = event.detail.profileData\n if (heading.editContext) {\n heading.editContext = { ...heading.editContext, profileData: event.detail.profileData }\n }\n return\n }\n\n refreshProfileHeading(true).catch((error: unknown) => {\n console.error('Failed to refresh profile heading after saving profile information.', error)\n })\n })\n profileSavedListenerRegistered = true\n }\n\n const readiness = authReady ?? authn.checkUser().then(() => undefined)\n authReady = readiness\n\n if (!authListenersRegistered) {\n authSession.events.on('login', refreshAfterAuthChange)\n authSession.events.on('sessionRestore', refreshAfterAuthChange)\n authSession.events.on('logout', refreshAfterAuthChange)\n authSession.events.on('sessionChange', refreshAfterAuthChange)\n authSession.events.on('identityReplaced', refreshAfterAuthChange)\n authListenersRegistered = true\n }\n\n // Navigations the page's own navigation does not make, such as links and buttons in solid-ui\n if (!navigatedListenerRegistered) {\n onNavigated(() => {\n refreshProfileHeading().catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n })\n navigatedListenerRegistered = true\n }\n\n readiness.then(() => refreshProfileHeading(true)).catch((error: unknown) => {\n console.error('Failed to refresh profile heading.', error)\n })\n return readiness\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAMA,IAAsB,+BACtBC,IAA2B,yBAE7BC,IAAiB,GACjBC,IAA8B,IAC9BC,IAA0B,IAC1BC,IAAiC,IACjCC,GACAC,IAAmB,IACnBC,IAAsB,IACtBC,IAAiB,IACjBC,UAAuB,OAAO,SAAS,MACrCC,oBAAiB,IAAI,QAAgC,GACrDC,oBAAiB,IAAI,QAAgC;AAE3D,SAASC,EAAa,GAA0B;CAC9C,IAAI,OAAO,aAAa,kCAAkC,CAAC,CAAC,WACxD,OAAOC,EAAM,WAAY,YAAY;CAEzC,IAAMC,IAAQ,iBAAiBD,CAAK,GAC9BE,IAAYD,EAAM,aAAa,QAC/BE,IAAeF,EAAM,gBAAgB,QACrCG,IAAYJ,EAAM,QAAQ,CAC9B;EAAE,QAAQ;EAAO,SAAS;EAAG,WAAW;EAAO,cAAc;EAAO,UAAU;CAAS,GACvF;EACE,QAAQ,GAAGA,EAAM,sBAAsB,CAAC,CAAC,OAAO;EAChD,SAAS;EACT;EACA;EACA,UAAU;CACZ,CACF,GAAG;EAAE,UAAU;EAAK,QAAQ;EAAQ,MAAM;CAAO,CAAC;CAClD,EAAe,IAAIA,GAAOI,CAAS;CACnC,IAAMC,UAAe;EACnB,AAAIP,EAAe,IAAIE,CAAK,MAAMI,MAClCN,EAAe,OAAOE,CAAK,GAC3BI,EAAU,OAAO;CACnB;CACA,EAAU,SAAS,KAAKC,IAAS,MAAmB;EAClD,AAA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"}
|
package/dist/n3Pane.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n3Pane.d.ts","sourceRoot":"","sources":["../src/n3Pane.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAClD,OAAO,cAAc,CAAA;AACrB,OAAO,0BAA0B,CAAA;AAIjC,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,KAAK,MAAM,GAAG,IAAI,CAAA;IACzE,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,KAAK,cAAc,CAAA;CAC5E,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"n3Pane.d.ts","sourceRoot":"","sources":["../src/n3Pane.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAClD,OAAO,cAAc,CAAA;AACrB,OAAO,0BAA0B,CAAA;AAIjC,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,KAAK,MAAM,GAAG,IAAI,CAAA;IACzE,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,KAAK,cAAc,CAAA;CAC5E,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,UA2DpB,CAAA"}
|
package/dist/n3Pane2.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.n3-pane{border:1px solid var(--solid-ui-color-slate-200,#e2e8f0);box-sizing:border-box;width:100%;min-width:0}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();const e=require("./_virtual/_rolldown/runtime.cjs.js");require("./components/editor-card/index.cjs.js");let t=require("solid-ui");t=e.__toESM(t);let n=require("rdflib");n=e.__toESM(n);var r=t.ns,i={icon:t.icons.originalIconBase+`w3c/n3_smaller.png`,name:`n3`,audience:[r.solid(`Developer`)],label:function(e,t){let n=t.session.store;if(`http://www.w3.org/2007/ont/link#ProtocolEvent`in n.findTypeURIs(e))return null;let r=n.statementsMatching(void 0,void 0,void 0,e).length;return r===0?null:`Data (`+r+`) as N3`},render:function(e,t){let r=t.dom,i=t.session.store,a=r.createElement(`div`);a.setAttribute(`class`,`n3-pane`);let o=i.statementsMatching(void 0,void 0,void 0,e),s=n.Serializer(i);s.suggestNamespaces(i.namespaces),s.setBase(e.uri);let c=s.statementsToN3(o),l=r.createElement(`solid-panes-editor-card`);return l.contentType=`text/n3`,l.content=c,a.appendChild(l),a}};exports.n3Pane=i;
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.n3-pane{border:1px solid var(--solid-ui-color-slate-200,#e2e8f0);box-sizing:border-box;width:100%;min-width:0}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();const e=require("./_virtual/_rolldown/runtime.cjs.js");require("./components/editor-card/index.cjs.js");let t=require("solid-ui");t=e.__toESM(t);let n=require("rdflib");n=e.__toESM(n);var r=t.ns,i={icon:t.icons.originalIconBase+`w3c/n3_smaller.png`,name:`n3`,audience:[r.solid(`Developer`)],label:function(e,t){let n=t.session.store;if(`http://www.w3.org/2007/ont/link#ProtocolEvent`in n.findTypeURIs(e))return null;let r=n.statementsMatching(void 0,void 0,void 0,e).length;return r===0?null:`Data (`+r+`) as N3`},render:function(e,t){let r=t.dom,i=t.session.store,a=r.createElement(`div`);a.setAttribute(`class`,`n3-pane`);let o=i.statementsMatching(void 0,void 0,void 0,e),s=n.Serializer(i);s.suggestNamespaces(i.namespaces),s.setBase(e.uri);let c=s.statementsToN3(o),l=r.createElement(`solid-panes-editor-card`);return l.contentType=`text/n3`,l.content=c,l.accessibilityLabel=`Generated N3 for ${e.uri}`,l.accessibilityDescription=`Generated N3 serialization. This content is read-only.`,a.appendChild(l),a}};exports.n3Pane=i;
|
|
2
2
|
//# sourceMappingURL=n3Pane2.cjs.js.map
|
package/dist/n3Pane2.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n3Pane2.cjs.js","names":["UI","$rdf","require_runtime","solid_ui","rdflib","ns","n3Pane","store","context","subject","n","myDocument","kb","div","statements","sz","serializedContent","source"],"sources":["../src/n3Pane.ts"],"sourcesContent":["/* Notation3 content Pane\n **\n ** This pane shows the content of a particular RDF resource\n ** or at least the RDF semantics we attribute to that resource,\n ** in generated N3 syntax.\n */\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport type { DataBrowserContext } from 'pane-registry'\nimport type { NamedNode, Statement } from 'rdflib'\nimport './n3Pane.css'\nimport './components/editor-card'\n\nconst ns = UI.ns\n\ntype N3PaneLike = {\n icon: string\n name: string\n audience: NamedNode[]\n label: (subject: NamedNode, context: DataBrowserContext) => string | null\n render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement\n}\n\nexport const n3Pane: N3PaneLike = {\n icon: UI.icons.originalIconBase + 'w3c/n3_smaller.png',\n\n name: 'n3',\n\n audience: [ns.solid('Developer')],\n\n label: function (subject: NamedNode, context: DataBrowserContext): string | null {\n const store = context.session.store\n if (\n 'http://www.w3.org/2007/ont/link#ProtocolEvent' in\n store.findTypeURIs(subject)\n ) {\n return null\n }\n const n = store.statementsMatching(undefined, undefined, undefined, subject)\n .length\n if (n === 0) return null\n return 'Data (' + n + ') as N3'\n },\n\n render: function (\n subject: NamedNode,\n context: DataBrowserContext\n ): HTMLDivElement {\n const myDocument = context.dom\n const kb = context.session.store\n\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'n3-pane')\n // Because of smushing etc, this will not be a copy of the original source\n // We could instead either fetch and re-parse the source,\n // or we could keep all the pre-smushed triples.\n const statements = kb.statementsMatching(\n undefined,\n undefined,\n undefined,\n subject\n ) as Statement[] // @@ slow with current store!\n\n const sz = $rdf.Serializer(kb)\n sz.suggestNamespaces(kb.namespaces)\n sz.setBase(subject.uri)\n const serializedContent = sz.statementsToN3(statements)\n const source = myDocument.createElement('solid-panes-editor-card') as HTMLElement & {\n contentType?: string\n content?: string\n }\n source.contentType = 'text/n3'\n source.content = serializedContent\n\n div.appendChild(source)\n return div\n }\n}\n"],"mappings":"A,mNAaA,IAAMK,EAAKL,EAAG,GAUDM,EAAqB,CAChC,KAAMN,EAAG,MAAM,iBAAmB,qBAElC,KAAM,KAEN,SAAU,CAACK,EAAG,MAAM,WAAW,CAAC,EAEhC,MAAO,SAAU,EAAoB,EAA4C,CAC/E,IAAME,EAAQC,EAAQ,QAAQ,MAC9B,GACE,kDACAD,EAAM,aAAaE,CAAO,EAE1B,OAAO,KAET,IAAMC,EAAIH,EAAM,mBAAmB,IAAA,GAAW,IAAA,GAAW,IAAA,GAAWE,CAAO,CAAC,CACzE,OAEH,OADIC,IAAM,EAAU,KACb,SAAWA,EAAI,SACxB,EAEA,OAAQ,SACN,EACA,EACgB,CAChB,IAAMC,EAAaH,EAAQ,IACrBI,EAAKJ,EAAQ,QAAQ,MAErBK,EAAMF,EAAW,cAAc,KAAK,EAC1CE,EAAI,aAAa,QAAS,SAAS,EAInC,IAAMC,EAAaF,EAAG,mBACpB,IAAA,GACA,IAAA,GACA,IAAA,GACAH,CACF,EAEMM,EAAKd,EAAK,WAAWW,CAAE,EAC7BG,EAAG,kBAAkBH,EAAG,UAAU,EAClCG,EAAG,QAAQN,EAAQ,GAAG,EACtB,IAAMO,EAAoBD,EAAG,eAAeD,CAAU,EAChDG,EAASN,EAAW,cAAc,yBAAyB,
|
|
1
|
+
{"version":3,"file":"n3Pane2.cjs.js","names":["UI","$rdf","require_runtime","solid_ui","rdflib","ns","n3Pane","store","context","subject","n","myDocument","kb","div","statements","sz","serializedContent","source"],"sources":["../src/n3Pane.ts"],"sourcesContent":["/* Notation3 content Pane\n **\n ** This pane shows the content of a particular RDF resource\n ** or at least the RDF semantics we attribute to that resource,\n ** in generated N3 syntax.\n */\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport type { DataBrowserContext } from 'pane-registry'\nimport type { NamedNode, Statement } from 'rdflib'\nimport './n3Pane.css'\nimport './components/editor-card'\n\nconst ns = UI.ns\n\ntype N3PaneLike = {\n icon: string\n name: string\n audience: NamedNode[]\n label: (subject: NamedNode, context: DataBrowserContext) => string | null\n render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement\n}\n\nexport const n3Pane: N3PaneLike = {\n icon: UI.icons.originalIconBase + 'w3c/n3_smaller.png',\n\n name: 'n3',\n\n audience: [ns.solid('Developer')],\n\n label: function (subject: NamedNode, context: DataBrowserContext): string | null {\n const store = context.session.store\n if (\n 'http://www.w3.org/2007/ont/link#ProtocolEvent' in\n store.findTypeURIs(subject)\n ) {\n return null\n }\n const n = store.statementsMatching(undefined, undefined, undefined, subject)\n .length\n if (n === 0) return null\n return 'Data (' + n + ') as N3'\n },\n\n render: function (\n subject: NamedNode,\n context: DataBrowserContext\n ): HTMLDivElement {\n const myDocument = context.dom\n const kb = context.session.store\n\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'n3-pane')\n // Because of smushing etc, this will not be a copy of the original source\n // We could instead either fetch and re-parse the source,\n // or we could keep all the pre-smushed triples.\n const statements = kb.statementsMatching(\n undefined,\n undefined,\n undefined,\n subject\n ) as Statement[] // @@ slow with current store!\n\n const sz = $rdf.Serializer(kb)\n sz.suggestNamespaces(kb.namespaces)\n sz.setBase(subject.uri)\n const serializedContent = sz.statementsToN3(statements)\n const source = myDocument.createElement('solid-panes-editor-card') as HTMLElement & {\n contentType?: string\n content?: string\n accessibilityLabel?: string\n accessibilityDescription?: string\n }\n source.contentType = 'text/n3'\n source.content = serializedContent\n source.accessibilityLabel = `Generated N3 for ${subject.uri}`\n source.accessibilityDescription =\n 'Generated N3 serialization. This content is read-only.'\n\n div.appendChild(source)\n return div\n }\n}\n"],"mappings":"A,mNAaA,IAAMK,EAAKL,EAAG,GAUDM,EAAqB,CAChC,KAAMN,EAAG,MAAM,iBAAmB,qBAElC,KAAM,KAEN,SAAU,CAACK,EAAG,MAAM,WAAW,CAAC,EAEhC,MAAO,SAAU,EAAoB,EAA4C,CAC/E,IAAME,EAAQC,EAAQ,QAAQ,MAC9B,GACE,kDACAD,EAAM,aAAaE,CAAO,EAE1B,OAAO,KAET,IAAMC,EAAIH,EAAM,mBAAmB,IAAA,GAAW,IAAA,GAAW,IAAA,GAAWE,CAAO,CAAC,CACzE,OAEH,OADIC,IAAM,EAAU,KACb,SAAWA,EAAI,SACxB,EAEA,OAAQ,SACN,EACA,EACgB,CAChB,IAAMC,EAAaH,EAAQ,IACrBI,EAAKJ,EAAQ,QAAQ,MAErBK,EAAMF,EAAW,cAAc,KAAK,EAC1CE,EAAI,aAAa,QAAS,SAAS,EAInC,IAAMC,EAAaF,EAAG,mBACpB,IAAA,GACA,IAAA,GACA,IAAA,GACAH,CACF,EAEMM,EAAKd,EAAK,WAAWW,CAAE,EAC7BG,EAAG,kBAAkBH,EAAG,UAAU,EAClCG,EAAG,QAAQN,EAAQ,GAAG,EACtB,IAAMO,EAAoBD,EAAG,eAAeD,CAAU,EAChDG,EAASN,EAAW,cAAc,yBAAyB,EAajE,MAPA,GAAO,YAAc,UACrB,EAAO,QAAUK,EACjB,EAAO,mBAAqB,oBAAoBP,EAAQ,MACxD,EAAO,yBACL,yDAEFI,EAAI,YAAYI,CAAM,EACfJ,CACT,CACF,E"}
|
package/dist/n3Pane2.esm.js
CHANGED
|
@@ -19,7 +19,7 @@ var n = e.ns, r = {
|
|
|
19
19
|
let o = i.statementsMatching(void 0, void 0, void 0, e), s = t.Serializer(i);
|
|
20
20
|
s.suggestNamespaces(i.namespaces), s.setBase(e.uri);
|
|
21
21
|
let c = s.statementsToN3(o), l = r.createElement("solid-panes-editor-card");
|
|
22
|
-
return l.contentType = "text/n3", l.content = c, a.appendChild(l), a;
|
|
22
|
+
return l.contentType = "text/n3", l.content = c, l.accessibilityLabel = `Generated N3 for ${e.uri}`, l.accessibilityDescription = "Generated N3 serialization. This content is read-only.", a.appendChild(l), a;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
export { r as n3Pane };
|
package/dist/n3Pane2.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n3Pane2.esm.js","names":["ns","UI","$rdf","ns$1","n3Pane","store","context","subject","n","myDocument","kb","div","statements","sz","serializedContent","source"],"sources":["../src/n3Pane.ts"],"sourcesContent":["/* Notation3 content Pane\n **\n ** This pane shows the content of a particular RDF resource\n ** or at least the RDF semantics we attribute to that resource,\n ** in generated N3 syntax.\n */\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport type { DataBrowserContext } from 'pane-registry'\nimport type { NamedNode, Statement } from 'rdflib'\nimport './n3Pane.css'\nimport './components/editor-card'\n\nconst ns = UI.ns\n\ntype N3PaneLike = {\n icon: string\n name: string\n audience: NamedNode[]\n label: (subject: NamedNode, context: DataBrowserContext) => string | null\n render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement\n}\n\nexport const n3Pane: N3PaneLike = {\n icon: UI.icons.originalIconBase + 'w3c/n3_smaller.png',\n\n name: 'n3',\n\n audience: [ns.solid('Developer')],\n\n label: function (subject: NamedNode, context: DataBrowserContext): string | null {\n const store = context.session.store\n if (\n 'http://www.w3.org/2007/ont/link#ProtocolEvent' in\n store.findTypeURIs(subject)\n ) {\n return null\n }\n const n = store.statementsMatching(undefined, undefined, undefined, subject)\n .length\n if (n === 0) return null\n return 'Data (' + n + ') as N3'\n },\n\n render: function (\n subject: NamedNode,\n context: DataBrowserContext\n ): HTMLDivElement {\n const myDocument = context.dom\n const kb = context.session.store\n\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'n3-pane')\n // Because of smushing etc, this will not be a copy of the original source\n // We could instead either fetch and re-parse the source,\n // or we could keep all the pre-smushed triples.\n const statements = kb.statementsMatching(\n undefined,\n undefined,\n undefined,\n subject\n ) as Statement[] // @@ slow with current store!\n\n const sz = $rdf.Serializer(kb)\n sz.suggestNamespaces(kb.namespaces)\n sz.setBase(subject.uri)\n const serializedContent = sz.statementsToN3(statements)\n const source = myDocument.createElement('solid-panes-editor-card') as HTMLElement & {\n contentType?: string\n content?: string\n }\n source.contentType = 'text/n3'\n source.content = serializedContent\n\n div.appendChild(source)\n return div\n }\n}\n"],"mappings":";;;;;AAaA,IAAMA,IAAKC,EAAG,IAUDG,IAAqB;CAChC,MAAMH,EAAG,MAAM,mBAAmB;CAElC,MAAM;CAEN,UAAU,CAACD,EAAG,MAAM,WAAW,CAAC;CAEhC,OAAO,SAAU,GAAoB,GAA4C;EAC/E,IAAMK,IAAQC,EAAQ,QAAQ;EAC9B,IACE,mDACAD,EAAM,aAAaE,CAAO,GAE1B,OAAO;EAET,IAAMC,IAAIH,EAAM,mBAAmB,KAAA,GAAW,KAAA,GAAW,KAAA,GAAWE,CAAO,CAAC,CACzE;EAEH,OADIC,MAAM,IAAU,OACb,WAAWA,IAAI;CACxB;CAEA,QAAQ,SACN,GACA,GACgB;EAChB,IAAMC,IAAaH,EAAQ,KACrBI,IAAKJ,EAAQ,QAAQ,OAErBK,IAAMF,EAAW,cAAc,KAAK;EAC1C,EAAI,aAAa,SAAS,SAAS;EAInC,IAAMG,IAAaF,EAAG,mBACpB,KAAA,GACA,KAAA,GACA,KAAA,GACAH,CACF,GAEMM,IAAKX,EAAK,WAAWQ,CAAE;EAE7B,AADAG,EAAG,kBAAkBH,EAAG,UAAU,GAClCG,EAAG,QAAQN,EAAQ,GAAG;EACtB,IAAMO,IAAoBD,EAAG,eAAeD,CAAU,GAChDG,IAASN,EAAW,cAAc,yBAAyB;
|
|
1
|
+
{"version":3,"file":"n3Pane2.esm.js","names":["ns","UI","$rdf","ns$1","n3Pane","store","context","subject","n","myDocument","kb","div","statements","sz","serializedContent","source"],"sources":["../src/n3Pane.ts"],"sourcesContent":["/* Notation3 content Pane\n **\n ** This pane shows the content of a particular RDF resource\n ** or at least the RDF semantics we attribute to that resource,\n ** in generated N3 syntax.\n */\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport type { DataBrowserContext } from 'pane-registry'\nimport type { NamedNode, Statement } from 'rdflib'\nimport './n3Pane.css'\nimport './components/editor-card'\n\nconst ns = UI.ns\n\ntype N3PaneLike = {\n icon: string\n name: string\n audience: NamedNode[]\n label: (subject: NamedNode, context: DataBrowserContext) => string | null\n render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement\n}\n\nexport const n3Pane: N3PaneLike = {\n icon: UI.icons.originalIconBase + 'w3c/n3_smaller.png',\n\n name: 'n3',\n\n audience: [ns.solid('Developer')],\n\n label: function (subject: NamedNode, context: DataBrowserContext): string | null {\n const store = context.session.store\n if (\n 'http://www.w3.org/2007/ont/link#ProtocolEvent' in\n store.findTypeURIs(subject)\n ) {\n return null\n }\n const n = store.statementsMatching(undefined, undefined, undefined, subject)\n .length\n if (n === 0) return null\n return 'Data (' + n + ') as N3'\n },\n\n render: function (\n subject: NamedNode,\n context: DataBrowserContext\n ): HTMLDivElement {\n const myDocument = context.dom\n const kb = context.session.store\n\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'n3-pane')\n // Because of smushing etc, this will not be a copy of the original source\n // We could instead either fetch and re-parse the source,\n // or we could keep all the pre-smushed triples.\n const statements = kb.statementsMatching(\n undefined,\n undefined,\n undefined,\n subject\n ) as Statement[] // @@ slow with current store!\n\n const sz = $rdf.Serializer(kb)\n sz.suggestNamespaces(kb.namespaces)\n sz.setBase(subject.uri)\n const serializedContent = sz.statementsToN3(statements)\n const source = myDocument.createElement('solid-panes-editor-card') as HTMLElement & {\n contentType?: string\n content?: string\n accessibilityLabel?: string\n accessibilityDescription?: string\n }\n source.contentType = 'text/n3'\n source.content = serializedContent\n source.accessibilityLabel = `Generated N3 for ${subject.uri}`\n source.accessibilityDescription =\n 'Generated N3 serialization. This content is read-only.'\n\n div.appendChild(source)\n return div\n }\n}\n"],"mappings":";;;;;AAaA,IAAMA,IAAKC,EAAG,IAUDG,IAAqB;CAChC,MAAMH,EAAG,MAAM,mBAAmB;CAElC,MAAM;CAEN,UAAU,CAACD,EAAG,MAAM,WAAW,CAAC;CAEhC,OAAO,SAAU,GAAoB,GAA4C;EAC/E,IAAMK,IAAQC,EAAQ,QAAQ;EAC9B,IACE,mDACAD,EAAM,aAAaE,CAAO,GAE1B,OAAO;EAET,IAAMC,IAAIH,EAAM,mBAAmB,KAAA,GAAW,KAAA,GAAW,KAAA,GAAWE,CAAO,CAAC,CACzE;EAEH,OADIC,MAAM,IAAU,OACb,WAAWA,IAAI;CACxB;CAEA,QAAQ,SACN,GACA,GACgB;EAChB,IAAMC,IAAaH,EAAQ,KACrBI,IAAKJ,EAAQ,QAAQ,OAErBK,IAAMF,EAAW,cAAc,KAAK;EAC1C,EAAI,aAAa,SAAS,SAAS;EAInC,IAAMG,IAAaF,EAAG,mBACpB,KAAA,GACA,KAAA,GACA,KAAA,GACAH,CACF,GAEMM,IAAKX,EAAK,WAAWQ,CAAE;EAE7B,AADAG,EAAG,kBAAkBH,EAAG,UAAU,GAClCG,EAAG,QAAQN,EAAQ,GAAG;EACtB,IAAMO,IAAoBD,EAAG,eAAeD,CAAU,GAChDG,IAASN,EAAW,cAAc,yBAAyB;EAajE,OAPA,EAAO,cAAc,WACrB,EAAO,UAAUK,GACjB,EAAO,qBAAqB,oBAAoBP,EAAQ,OACxD,EAAO,2BACL,0DAEFI,EAAI,YAAYI,CAAM,GACfJ;CACT;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./state.cjs.js");var t,n=!1;function r(){return n}function i(e){console.error(`Failed to show the page after browser navigation.`,e)}function a(r){if(t=r,n)return;n=!0;let a=()=>(e.clearPaneState(),(t?.show({kind:`restore`,forceHeading:!0})??Promise.resolve()).catch(i)),o=window.navigation;o?(o.addEventListener(`navigate`,
|
|
1
|
+
const e=require("./state.cjs.js");var t,n=!1;function r(){return n}function i(e){console.error(`Failed to show the page after browser navigation.`,e)}function a(r){if(t=r,n)return;n=!0;let a=()=>(e.clearPaneState(),(t?.show({kind:`restore`,forceHeading:!0})??Promise.resolve()).catch(i)),o=window.navigation;o?(o.addEventListener(`navigate`,t=>{!e.isWritingNavigationHistory(window.history)&&(t.hashChange||t.destination.sameDocument===!1||t.destination.url!==window.location.href)&&t.canIntercept&&t.userInitiated&&t.navigationType===`replace`&&t.destination.url===window.location.href&&t.intercept({scroll:`manual`,focusReset:`manual`,handler:a})}),o.addEventListener(`currententrychange`,e=>{e.navigationType===`traverse`&&a()})):window.addEventListener(`popstate`,()=>{a()})}exports.isHandlingBrowserNavigation=r,exports.registerBrowserNavigation=a;
|
|
2
2
|
//# sourceMappingURL=browserEvents.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserEvents.cjs.js","names":["require_state","navigation","listenersRegistered","isHandlingBrowserNavigation","reportError","error","registerBrowserNavigation","controller","showUrl","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":"A,
|
|
1
|
+
{"version":3,"file":"browserEvents.cjs.js","names":["isWritingNavigationHistory","require_state","navigation","listenersRegistered","isHandlingBrowserNavigation","reportError","error","registerBrowserNavigation","controller","showUrl","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":"A,kCAyBA,IAAIE,EACAC,EAAsB,GAM1B,SAAgBC,GAAwC,CACtD,OAAOD,CACT,CAEA,SAASE,EAAa,EAAgB,CACpC,QAAQ,MAAM,oDAAqDC,CAAK,CAC1E,CASA,SAAgBC,EAA2B,EAAwC,CAEjF,GADA,EAAaC,EACTL,EAAqB,OACzB,EAAsB,GAEtB,IAAMM,OACJR,EAAA,eAAe,GACPC,GAAY,KAAK,CAAE,KAAM,UAAW,aAAc,EAAK,CAAC,GAAK,QAAQ,QAAQ,EAAA,CAAG,MAAMG,CAAW,GAGrGK,EAAiB,OAAqD,WACvEA,GAmBLA,EAAc,iBAAiB,WAAY,GAAS,CAC9CV,GAAAA,2BAA2B,OAAO,OAAO,IACvCW,EAAM,YAAcA,EAAM,YAAY,eAAiB,IACvDA,EAAM,YAAY,MAAQ,OAAO,SAAS,OAC3CA,EAAM,cAAiBA,EAAM,eAAiBA,EAAM,iBAAmB,WACxEA,EAAM,YAAY,MAAQ,OAAO,SAAS,MAE9CA,EAAM,UAAU,CACd,OAAQ,SACR,WAAY,SACZ,QAASF,CACX,CAAC,CACH,CAAC,EAIDC,EAAc,iBAAiB,qBAAsB,GAAS,CACxDC,EAAM,iBAAmB,YAAYF,EAAQ,CACnD,CAAC,GAhCC,OAAO,iBAAiB,eAAkB,CAAEA,EAAQ,CAAE,CAAC,CAiC3D,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserEvents.d.ts","sourceRoot":"","sources":["../../src/navigation/browserEvents.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"browserEvents.d.ts","sourceRoot":"","sources":["../../src/navigation/browserEvents.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAmBxD;;;GAGG;AACH,wBAAgB,2BAA2B,IAAK,OAAO,CAEtD;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAE,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAiDjF"}
|
|
@@ -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){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){return n===`folder
|
|
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","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.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,C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G,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"}
|
|
@@ -80,8 +80,8 @@ export interface ExplorerHeaderInput {
|
|
|
80
80
|
/** Whether the header describing a resource fits the view. */
|
|
81
81
|
export declare function deriveExplorerHeader(input: ExplorerHeaderInput): boolean;
|
|
82
82
|
/**
|
|
83
|
-
* The header is never shown over
|
|
83
|
+
* The header is never shown over profile, friends, preferences or dashboard panes,
|
|
84
84
|
* nor over a storage view, which has its own header or the navbar.
|
|
85
85
|
*/
|
|
86
|
-
export declare function explorerHeaderForPane(resourceHeader: boolean, paneName?: string, folderView?: FolderView): boolean;
|
|
86
|
+
export declare function explorerHeaderForPane(resourceHeader: boolean, paneName?: string, folderView?: FolderView, solo?: boolean): boolean;
|
|
87
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;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,gFAAgF;AAChF,eAAO,MAAM,YAAY,UAAwB,CAAA;AAEjD,wBAAgB,YAAY,CAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,gHAAgH;AAChH,wBAAgB,kBAAkB,CAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,yD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