solid-panes 5.1.0-1 → 5.1.0-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/README.md +6 -0
  2. package/dist/RDFXMLPane2.esm.js +1 -2
  3. package/dist/_virtual/~icons/lucide/cake.esm.js +1 -2
  4. package/dist/_virtual/~icons/lucide/camera.esm.js +1 -2
  5. package/dist/_virtual/~icons/lucide/circle-user-round.esm.js +1 -2
  6. package/dist/_virtual/~icons/lucide/folder-open.esm.js +1 -2
  7. package/dist/_virtual/~icons/lucide/help-circle.esm.js +1 -2
  8. package/dist/_virtual/~icons/lucide/layout-dashboard.esm.js +1 -2
  9. package/dist/_virtual/~icons/lucide/mail.esm.js +1 -2
  10. package/dist/_virtual/~icons/lucide/map-pin.esm.js +1 -2
  11. package/dist/_virtual/~icons/lucide/pencil.esm.js +1 -2
  12. package/dist/_virtual/~icons/lucide/phone.esm.js +1 -2
  13. package/dist/_virtual/~icons/lucide/settings-2.esm.js +1 -2
  14. package/dist/_virtual/~icons/lucide/user-round-plus.esm.js +1 -2
  15. package/dist/_virtual/~icons/lucide/user.esm.js +1 -2
  16. package/dist/_virtual/~icons/lucide/users.esm.js +1 -2
  17. package/dist/_virtual/~icons/lucide/x.esm.js +1 -2
  18. package/dist/audio/audioPane.esm.js +1 -2
  19. package/dist/classInstancePane.esm.js +1 -2
  20. package/dist/components/editor-card/EditorCard.cjs.js +1 -1
  21. package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
  22. package/dist/components/editor-card/EditorCard.esm.js +6 -7
  23. package/dist/components/editor-card/EditorCard.styles.esm.js +1 -2
  24. package/dist/components/header/Header.cjs.js +1 -1
  25. package/dist/components/header/Header.cjs.js.map +1 -1
  26. package/dist/components/header/Header.esm.js +7 -8
  27. package/dist/components/header/Header.styles.esm.js +1 -2
  28. package/dist/components/navbar/Navbar.cjs.js +2 -2
  29. package/dist/components/navbar/Navbar.cjs.js.map +1 -1
  30. package/dist/components/navbar/Navbar.esm.js +8 -9
  31. package/dist/components/navbar/Navbar.styles.esm.js +1 -2
  32. package/dist/components/profile-heading/ProfileHeading.cjs.js +17 -17
  33. package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
  34. package/dist/components/profile-heading/ProfileHeading.esm.js +28 -29
  35. package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
  36. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js +1 -1
  37. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
  38. package/dist/components/profile-heading/ProfileHeading.styles.esm.js +2 -3
  39. package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
  40. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +1 -1
  41. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +2 -3
  42. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js +1 -2
  43. package/dist/components/profile-heading/editor/sections/heading/imageHelpers.esm.js +1 -2
  44. package/dist/components/profile-heading/editor/sections/heading/imagePreview.esm.js +1 -2
  45. package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +1 -2
  46. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js +1 -2
  47. package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.esm.js +1 -2
  48. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js +0 -1
  49. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js +1 -2
  50. package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js +1 -2
  51. package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.esm.js +1 -2
  52. package/dist/components/profile-heading/editor/textUtils.esm.js +1 -2
  53. package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js +1 -2
  54. package/dist/components/profile-heading/editor/texts/messageTexts.esm.js +1 -2
  55. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +3 -3
  56. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
  57. package/dist/components/profile-heading/editor/ui/dialog2.esm.js +4 -19
  58. package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
  59. package/dist/components/profile-heading/editor/ui/spinner.esm.js +1 -2
  60. package/dist/components/profile-heading/editor/utils/errorDisplay.esm.js +1 -2
  61. package/dist/components/profile-heading/friendActions.esm.js +1 -2
  62. package/dist/components/profile-heading/profileHeadingData.esm.js +1 -2
  63. package/dist/dashboard/basicPreferences.esm.js +1 -2
  64. package/dist/dashboard/dashboardPane.esm.js +0 -1
  65. package/dist/dashboard/homepage.esm.js +1 -2
  66. package/dist/dashboard/ontologyData.esm.js +1 -2
  67. package/dist/dashboard/preferencesFormText.esm.js +1 -2
  68. package/dist/dataContentPane2.cjs.js +1 -1
  69. package/dist/dataContentPane2.esm.js +2 -3
  70. package/dist/defaultPane2.cjs.js +1 -1
  71. package/dist/defaultPane2.esm.js +2 -3
  72. package/dist/dokieli/dokieliPane.cjs.js +1 -1
  73. package/dist/dokieli/dokieliPane.cjs.js.map +1 -1
  74. package/dist/dokieli/dokieliPane.esm.js +7 -12
  75. package/dist/dokieli/dokieliPane.esm.js.map +1 -1
  76. package/dist/dokieli/new.esm.js +1 -2
  77. package/dist/form/pane.esm.js +1 -2
  78. package/dist/home/homePane.esm.js +1 -2
  79. package/dist/humanReadablePane.d.ts +3 -0
  80. package/dist/humanReadablePane.d.ts.map +1 -1
  81. package/dist/humanReadablePane2.cjs.js +276 -1
  82. package/dist/humanReadablePane2.cjs.js.map +1 -1
  83. package/dist/humanReadablePane2.esm.js +428 -31
  84. package/dist/humanReadablePane2.esm.js.map +1 -1
  85. package/dist/icons/folder.esm.js +1 -2
  86. package/dist/icons/friends.esm.js +1 -2
  87. package/dist/icons/person.esm.js +1 -2
  88. package/dist/imagePane.d.ts.map +1 -1
  89. package/dist/imagePane2.cjs.js +1 -1
  90. package/dist/imagePane2.cjs.js.map +1 -1
  91. package/dist/imagePane2.esm.js +2 -3
  92. package/dist/imagePane2.esm.js.map +1 -1
  93. package/dist/index.cjs.js +1 -1
  94. package/dist/index.cjs.js.map +1 -1
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.esm.js +17 -17
  98. package/dist/index.esm.js.map +1 -1
  99. package/dist/internal/internalPane2.cjs.js +1 -1
  100. package/dist/internal/internalPane2.esm.js +2 -3
  101. package/dist/mainPage/header.esm.js +1 -2
  102. package/dist/mainPage/index.cjs.js +1 -1
  103. package/dist/mainPage/index.cjs.js.map +1 -1
  104. package/dist/mainPage/index.d.ts +1 -1
  105. package/dist/mainPage/index.d.ts.map +1 -1
  106. package/dist/mainPage/index.esm.js +42 -27
  107. package/dist/mainPage/index.esm.js.map +1 -1
  108. package/dist/mainPage/navbar.esm.js +1 -2
  109. package/dist/mainPage/navigation.cjs.js +1 -1
  110. package/dist/mainPage/navigation.cjs.js.map +1 -1
  111. package/dist/mainPage/navigation.d.ts.map +1 -1
  112. package/dist/mainPage/navigation.esm.js +14 -11
  113. package/dist/mainPage/navigation.esm.js.map +1 -1
  114. package/dist/mainPage/profileHeading.d.ts +2 -1
  115. package/dist/mainPage/profileHeading.d.ts.map +1 -1
  116. package/dist/mainPage/profileHeading2.cjs.js +1 -1
  117. package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
  118. package/dist/mainPage/profileHeading2.esm.js +76 -77
  119. package/dist/mainPage/profileHeading2.esm.js.map +1 -1
  120. package/dist/n3Pane2.esm.js +1 -2
  121. package/dist/navigation/browserEvents.esm.js +1 -2
  122. package/dist/navigation/chrome.cjs.js +1 -1
  123. package/dist/navigation/chrome.cjs.js.map +1 -1
  124. package/dist/navigation/chrome.d.ts +20 -2
  125. package/dist/navigation/chrome.d.ts.map +1 -1
  126. package/dist/navigation/chrome.esm.js +15 -10
  127. package/dist/navigation/chrome.esm.js.map +1 -1
  128. package/dist/navigation/controller.cjs.js +1 -1
  129. package/dist/navigation/controller.cjs.js.map +1 -1
  130. package/dist/navigation/controller.d.ts +3 -0
  131. package/dist/navigation/controller.d.ts.map +1 -1
  132. package/dist/navigation/controller.esm.js +50 -30
  133. package/dist/navigation/controller.esm.js.map +1 -1
  134. package/dist/navigation/events.esm.js +1 -2
  135. package/dist/navigation/navbarVisibility.esm.js +1 -2
  136. package/dist/navigation/options.cjs.js +1 -1
  137. package/dist/navigation/options.cjs.js.map +1 -1
  138. package/dist/navigation/options.d.ts +12 -0
  139. package/dist/navigation/options.d.ts.map +1 -1
  140. package/dist/navigation/options.esm.js +5 -3
  141. package/dist/navigation/options.esm.js.map +1 -1
  142. package/dist/navigation/podContext.cjs.js +1 -1
  143. package/dist/navigation/podContext.cjs.js.map +1 -1
  144. package/dist/navigation/podContext.d.ts.map +1 -1
  145. package/dist/navigation/podContext.esm.js +15 -16
  146. package/dist/navigation/podContext.esm.js.map +1 -1
  147. package/dist/navigation/state.esm.js +1 -2
  148. package/dist/outline/context.esm.js +1 -2
  149. package/dist/outline/fileExplorerHelpers.cjs.js +2 -0
  150. package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -0
  151. package/dist/outline/fileExplorerHelpers.d.ts +13 -0
  152. package/dist/outline/fileExplorerHelpers.d.ts.map +1 -0
  153. package/dist/outline/fileExplorerHelpers.esm.js +24 -0
  154. package/dist/outline/fileExplorerHelpers.esm.js.map +1 -0
  155. package/dist/outline/manager2.cjs.js +1 -1
  156. package/dist/outline/manager2.cjs.js.map +1 -1
  157. package/dist/outline/manager2.esm.js +457 -437
  158. package/dist/outline/manager2.esm.js.map +1 -1
  159. package/dist/outline/outlineDomHelpers.cjs.js +2 -0
  160. package/dist/outline/outlineDomHelpers.cjs.js.map +1 -0
  161. package/dist/outline/outlineDomHelpers.d.ts +30 -0
  162. package/dist/outline/outlineDomHelpers.d.ts.map +1 -0
  163. package/dist/outline/outlineDomHelpers.esm.js +79 -0
  164. package/dist/outline/outlineDomHelpers.esm.js.map +1 -0
  165. package/dist/outline/outlineIcons.esm.js +1 -2
  166. package/dist/outline/propertyViews.esm.js +1 -2
  167. package/dist/outline/queryByExample.cjs.js.map +1 -1
  168. package/dist/outline/queryByExample.esm.js +1 -2
  169. package/dist/outline/queryByExample.esm.js.map +1 -1
  170. package/dist/outline/userInput.cjs.js +9 -9
  171. package/dist/outline/userInput.cjs.js.map +1 -1
  172. package/dist/outline/userInput.esm.js +50 -40
  173. package/dist/outline/userInput.esm.js.map +1 -1
  174. package/dist/outline/viewAsImage.esm.js +1 -2
  175. package/dist/outline/viewAsMbox.esm.js +1 -2
  176. package/dist/pad/padPane2.cjs.js +1 -1
  177. package/dist/pad/padPane2.esm.js +2 -3
  178. package/dist/playlist/playlistPane.esm.js +1 -2
  179. package/dist/registerPanes.esm.js +1 -2
  180. package/dist/schedule/formsForSchedule.esm.js +1 -2
  181. package/dist/schedule/schedulePane.d.ts.map +1 -1
  182. package/dist/schedule/schedulePane2.cjs.js +1 -1
  183. package/dist/schedule/schedulePane2.cjs.js.map +1 -1
  184. package/dist/schedule/schedulePane2.esm.js +60 -59
  185. package/dist/schedule/schedulePane2.esm.js.map +1 -1
  186. package/dist/sharing/sharingPane.esm.js +1 -2
  187. package/dist/slideshow/slideshowPane.esm.js +1 -2
  188. package/dist/social/editProfileDetails.cjs.js +1 -1
  189. package/dist/social/editProfileDetails.esm.js +1 -2
  190. package/dist/social/icons.esm.js +1 -2
  191. package/dist/social/socialPane2.esm.js +1 -2
  192. package/dist/social/socialSections.esm.js +1 -2
  193. package/dist/social/triage.esm.js +1 -2
  194. package/dist/tabbed/tabbedPane.esm.js +1 -2
  195. package/dist/tableViewPane.esm.js +1 -2
  196. package/dist/transaction/pane.esm.js +1 -2
  197. package/dist/transaction/period.esm.js +1 -2
  198. package/dist/trip/tripPane.esm.js +1 -2
  199. package/dist/trustedApplications/trustedApplications.dom.esm.js +1 -2
  200. package/dist/trustedApplications/trustedApplications.utils.esm.js +1 -2
  201. package/dist/trustedApplications/trustedApplications.view.esm.js +1 -2
  202. package/dist/ui/pane.esm.js +1 -2
  203. package/dist/utils/paneUtils.cjs.js +1 -1
  204. package/dist/utils/paneUtils.cjs.js.map +1 -1
  205. package/dist/utils/paneUtils.d.ts +5 -3
  206. package/dist/utils/paneUtils.d.ts.map +1 -1
  207. package/dist/utils/paneUtils.esm.js +36 -29
  208. package/dist/utils/paneUtils.esm.js.map +1 -1
  209. package/dist/utils/podUtils.cjs.js +1 -1
  210. package/dist/utils/podUtils.cjs.js.map +1 -1
  211. package/dist/utils/podUtils.d.ts +9 -1
  212. package/dist/utils/podUtils.d.ts.map +1 -1
  213. package/dist/utils/podUtils.esm.js +22 -95
  214. package/dist/utils/podUtils.esm.js.map +1 -1
  215. package/dist/utils/viewerUtils.esm.js +1 -2
  216. package/dist/utils/webIdUtils.esm.js +1 -2
  217. package/dist/versionInfo.cjs.js +1 -1
  218. package/dist/versionInfo.cjs.js.map +1 -1
  219. package/dist/versionInfo.esm.js +4 -5
  220. package/dist/versionInfo.esm.js.map +1 -1
  221. package/dist/video/videoPane.esm.js +1 -2
  222. package/package.json +7 -6
  223. package/dist/_virtual/~icons/lucide/arrow-left.cjs.js +0 -2
  224. package/dist/_virtual/~icons/lucide/arrow-left.cjs.js.map +0 -1
  225. package/dist/_virtual/~icons/lucide/arrow-left.esm.js +0 -11
  226. package/dist/_virtual/~icons/lucide/arrow-left.esm.js.map +0 -1
  227. package/dist/_virtual/~icons/lucide/ellipsis-vertical.cjs.js +0 -2
  228. package/dist/_virtual/~icons/lucide/ellipsis-vertical.cjs.js.map +0 -1
  229. package/dist/_virtual/~icons/lucide/ellipsis-vertical.esm.js +0 -11
  230. package/dist/_virtual/~icons/lucide/ellipsis-vertical.esm.js.map +0 -1
  231. package/dist/_virtual/~icons/lucide/folder.cjs.js +0 -2
  232. package/dist/_virtual/~icons/lucide/folder.cjs.js.map +0 -1
  233. package/dist/_virtual/~icons/lucide/folder.esm.js +0 -11
  234. package/dist/_virtual/~icons/lucide/folder.esm.js.map +0 -1
  235. package/dist/_virtual/~icons/lucide/globe.cjs.js +0 -2
  236. package/dist/_virtual/~icons/lucide/globe.cjs.js.map +0 -1
  237. package/dist/_virtual/~icons/lucide/globe.esm.js +0 -11
  238. package/dist/_virtual/~icons/lucide/globe.esm.js.map +0 -1
  239. package/dist/_virtual/~icons/lucide/lock-keyhole.cjs.js +0 -2
  240. package/dist/_virtual/~icons/lucide/lock-keyhole.cjs.js.map +0 -1
  241. package/dist/_virtual/~icons/lucide/lock-keyhole.esm.js +0 -11
  242. package/dist/_virtual/~icons/lucide/lock-keyhole.esm.js.map +0 -1
  243. package/dist/_virtual/~icons/lucide/share-2.cjs.js +0 -2
  244. package/dist/_virtual/~icons/lucide/share-2.cjs.js.map +0 -1
  245. package/dist/_virtual/~icons/lucide/share-2.esm.js +0 -11
  246. package/dist/_virtual/~icons/lucide/share-2.esm.js.map +0 -1
  247. package/dist/_virtual/~icons/lucide/user-round-cog.cjs.js +0 -2
  248. package/dist/_virtual/~icons/lucide/user-round-cog.cjs.js.map +0 -1
  249. package/dist/_virtual/~icons/lucide/user-round-cog.esm.js +0 -11
  250. package/dist/_virtual/~icons/lucide/user-round-cog.esm.js.map +0 -1
  251. package/dist/components/file-explorer-header/FileExplorerHeader.cjs.js +0 -14
  252. package/dist/components/file-explorer-header/FileExplorerHeader.cjs.js.map +0 -1
  253. package/dist/components/file-explorer-header/FileExplorerHeader.d.ts +0 -18
  254. package/dist/components/file-explorer-header/FileExplorerHeader.d.ts.map +0 -1
  255. package/dist/components/file-explorer-header/FileExplorerHeader.esm.js +0 -292
  256. package/dist/components/file-explorer-header/FileExplorerHeader.esm.js.map +0 -1
  257. package/dist/components/file-explorer-header/FileExplorerHeader.styles.cjs.js +0 -2
  258. package/dist/components/file-explorer-header/FileExplorerHeader.styles.cjs.js.map +0 -1
  259. package/dist/components/file-explorer-header/FileExplorerHeader.styles.esm.js +0 -7
  260. package/dist/components/file-explorer-header/FileExplorerHeader.styles.esm.js.map +0 -1
  261. package/dist/components/file-explorer-header/FileExplorerHeaderControls.cjs.js +0 -32
  262. package/dist/components/file-explorer-header/FileExplorerHeaderControls.cjs.js.map +0 -1
  263. package/dist/components/file-explorer-header/FileExplorerHeaderControls.d.ts +0 -21
  264. package/dist/components/file-explorer-header/FileExplorerHeaderControls.d.ts.map +0 -1
  265. package/dist/components/file-explorer-header/FileExplorerHeaderControls.esm.js +0 -294
  266. package/dist/components/file-explorer-header/FileExplorerHeaderControls.esm.js.map +0 -1
  267. package/dist/components/file-explorer-header/FileExplorerHeaderControls.styles.cjs.js +0 -2
  268. package/dist/components/file-explorer-header/FileExplorerHeaderControls.styles.cjs.js.map +0 -1
  269. package/dist/components/file-explorer-header/FileExplorerHeaderControls.styles.esm.js +0 -7
  270. package/dist/components/file-explorer-header/FileExplorerHeaderControls.styles.esm.js.map +0 -1
  271. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.cjs.js +0 -34
  272. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.cjs.js.map +0 -1
  273. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.d.ts +0 -20
  274. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.d.ts.map +0 -1
  275. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.esm.js +0 -346
  276. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.esm.js.map +0 -1
  277. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.styles.cjs.js +0 -2
  278. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.styles.cjs.js.map +0 -1
  279. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.styles.esm.js +0 -7
  280. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.styles.esm.js.map +0 -1
  281. package/dist/components/file-explorer-header/FileExplorerProvider.cjs.js +0 -13
  282. package/dist/components/file-explorer-header/FileExplorerProvider.cjs.js.map +0 -1
  283. package/dist/components/file-explorer-header/FileExplorerProvider.d.ts +0 -36
  284. package/dist/components/file-explorer-header/FileExplorerProvider.d.ts.map +0 -1
  285. package/dist/components/file-explorer-header/FileExplorerProvider.esm.js +0 -470
  286. package/dist/components/file-explorer-header/FileExplorerProvider.esm.js.map +0 -1
  287. package/dist/components/file-explorer-header/FileExplorerProvider.styles.cjs.js +0 -2
  288. package/dist/components/file-explorer-header/FileExplorerProvider.styles.cjs.js.map +0 -1
  289. package/dist/components/file-explorer-header/FileExplorerProvider.styles.esm.js +0 -7
  290. package/dist/components/file-explorer-header/FileExplorerProvider.styles.esm.js.map +0 -1
  291. package/dist/components/file-explorer-header/index.cjs.js +0 -1
  292. package/dist/components/file-explorer-header/index.d.ts +0 -3
  293. package/dist/components/file-explorer-header/index.d.ts.map +0 -1
  294. package/dist/components/file-explorer-header/index.esm.js +0 -2
  295. package/dist/components/file-explorer-header/types.d.ts +0 -10
  296. package/dist/components/file-explorer-header/types.d.ts.map +0 -1
  297. package/dist/components/resource-actions-menu/DeleteResourceDialog.d.ts +0 -8
  298. package/dist/components/resource-actions-menu/DeleteResourceDialog.d.ts.map +0 -1
  299. package/dist/components/resource-actions-menu/ResourceActionsMenu.cjs.js +0 -32
  300. package/dist/components/resource-actions-menu/ResourceActionsMenu.cjs.js.map +0 -1
  301. package/dist/components/resource-actions-menu/ResourceActionsMenu.d.ts +0 -19
  302. package/dist/components/resource-actions-menu/ResourceActionsMenu.d.ts.map +0 -1
  303. package/dist/components/resource-actions-menu/ResourceActionsMenu.esm.js +0 -322
  304. package/dist/components/resource-actions-menu/ResourceActionsMenu.esm.js.map +0 -1
  305. package/dist/components/resource-actions-menu/ResourceActionsMenu.styles.cjs.js +0 -2
  306. package/dist/components/resource-actions-menu/ResourceActionsMenu.styles.cjs.js.map +0 -1
  307. package/dist/components/resource-actions-menu/ResourceActionsMenu.styles.esm.js +0 -7
  308. package/dist/components/resource-actions-menu/ResourceActionsMenu.styles.esm.js.map +0 -1
@@ -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","hideAnimations","showAnimations","showHeading","mount","style","marginTop","marginBottom","animation","finish","error","cancelHeadingHide","hideHeading","height","opacity","showing","refreshAfterAuthChange","ensureMountPoint","mainContent","navbar","outlineView","insertionPoint","refreshProfileHeading","pod","getPodContext","force","readNavigationState","decision","deriveHeading","authn","pane","isProfilePane","paneKey","subjectUri","request","subject","profileData","canEdit","viewerMode","loadProfileFromURI","store","presentProfile","getViewerMode","heading","viewer","appearing","placeProfileHeading","initializeProfileHeading","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 } 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 = ''\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 pod = await getPodContext(window.location.href)\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: window.location.href,\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 = isProfilePane && 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\nexport function initializeProfileHeading (): void {\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}\n"],"mappings":";;;;;;;;;;AAcA,IAAMA,IAAsB,+BACtBC,IAA2B,yBAE7BC,IAAiB,GACjBC,IAA8B,IAC9BC,IAA0B,IAC1BC,IAAiC,IACjCC,GACAC,IAAmB,IACnBC,IAAsB,IACtBC,IAAiB,IACfC,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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sCAAsCzC,CAAK;EAC3D,CAAC;CACH,CAAC,GAC6B,KAGhCuC,EAAU,WAAW3B,EAAsB,EAAI,CAAC,CAAC,CAAC,OAAO,MAAmB;EAC1E,QAAQ,MAAM,sCAAsCZ,CAAK;CAC3D,CAAC;AACH"}
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,UAA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,EAAI,CAAC,CAAC,OAAO,MAAmB;GACpD,QAAQ,MAAM,uEAAuEZ,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"}
@@ -2,7 +2,7 @@
2
2
  import "./components/editor-card/index.esm.js";
3
3
  import * as e from "solid-ui";
4
4
  import * as t from "rdflib";
5
- //#region src/n3Pane.ts
5
+ // src/n3Pane.ts
6
6
  var n = e.ns, r = {
7
7
  icon: e.icons.originalIconBase + "w3c/n3_smaller.png",
8
8
  name: "n3",
@@ -22,7 +22,6 @@ var n = e.ns, r = {
22
22
  return l.contentType = "text/n3", l.content = c, a.appendChild(l), a;
23
23
  }
24
24
  };
25
- //#endregion
26
25
  export { r as n3Pane };
27
26
 
28
27
  //# sourceMappingURL=n3Pane2.esm.js.map
@@ -1,5 +1,5 @@
1
1
  import { clearPaneState as e } from "./state.esm.js";
2
- //#region src/navigation/browserEvents.ts
2
+ // src/navigation/browserEvents.ts
3
3
  var t, n = !1;
4
4
  function r() {
5
5
  return n;
@@ -26,7 +26,6 @@ function a(r) {
26
26
  a();
27
27
  });
28
28
  }
29
- //#endregion
30
29
  export { r as isHandlingBrowserNavigation, a as registerBrowserNavigation };
31
30
 
32
31
  //# sourceMappingURL=browserEvents.esm.js.map
@@ -1,2 +1,2 @@
1
- var e=[`profile`,`social`];function t(t){return t!==void 0&&e.includes(t)}function n(e){let{view:n,viaAccountMenu:r,viewer:i,pageUrl:a,owner:o,storageUris:s}=e,c=n.pane,l=c===`profile`||c===`social`?o!==void 0:c===`folder`&&s.some(e=>!n.subject||e===n.subject),u=l||!r?o:void 0;return t(c)?{mode:c===`profile`?`full`:`compact`,subjectUri:n.subject||(l?o:void 0)||a,paneName:c}:!u||u===i?{mode:`none`}:{mode:`compact`,subjectUri:u,paneName:c}}function r(e,t){return{paneName:e.pane??(t?`profile`:void 0),paneUri:e.subject}}function i(e,t,n){return!t.paneName||e.paneName!==t.paneName?!1:e.paneName===`folder`?t.paneUri?t.paneUri===e.paneUri:n===1:!0}function a(e,t,n){let r=e.filter(e=>e.paneName===t);return r.find(e=>e.paneUri===n)??r[0]}function o(e){return e.viaAccountMenu||e.ownProfile||e.inViewerPod}function s(e){return e.isRootResource||e.isWebId?!1:!e.viewerPodOnly||e.inViewerPod}function c(e,n){return e&&!t(n)}exports.PERSON_PANES=e,exports.deriveExplorerHeader=s,exports.deriveHeading=n,exports.deriveNavbarSelection=r,exports.explorerHeaderForPane=c,exports.isNavbarHidden=o,exports.isNavbarItemSelected=i,exports.isPersonPane=t,exports.pickNavbarItem=a;
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`&&(r===`explorer`||r===`storage`)?!1:e&&!t(n)}exports.PERSON_PANES=e,exports.deriveExplorerHeader=l,exports.deriveHeading=r,exports.deriveNavbarSelection=i,exports.deriveStorageView=c,exports.explorerHeaderForPane=u,exports.isNavbarHidden=s,exports.isNavbarItemSelected=a,exports.isPersonPane=t,exports.offersFriendAction=n,exports.pickNavbarItem=o;
2
2
  //# sourceMappingURL=chrome.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chrome.cjs.js","names":["PERSON_PANES","isPersonPane","paneName","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","deriveExplorerHeader","explorerHeaderForPane","resourceHeader"],"sources":["../../src/navigation/chrome.ts"],"sourcesContent":["/*\n * The rules for what the page chrome shows, as pure functions.\n *\n * What the user sees depends on the page URL, the pane that was last opened, whether the\n * account menu opened it, who is logged in and whose pod the URL is in. These functions\n * decide it from those inputs alone: they read no history, DOM or session, so every rule\n * can be tested in one place. The heading, navbar, outline and file explorer provider\n * only apply the result.\n */\n\nimport { type NavigationView } from './state'\n\n/** Registry names of the panes that present a person rather than a resource. */\nexport const PERSON_PANES = ['profile', 'social']\n\nexport function isPersonPane (paneName?: string): boolean {\n return paneName !== undefined && PERSON_PANES.includes(paneName)\n}\n\n/** The parts of a navbar item that the rules look at. */\nexport interface NavbarItemRef {\n paneName?: string\n paneUri?: string\n}\n\n// Profile heading\n\nexport type HeadingDecision =\n | { mode: 'none' }\n | {\n /** Full on the profile pane, compact everywhere else. */\n mode: 'full' | 'compact'\n /** The profile (WebID or document) to present. */\n subjectUri: string\n paneName?: string\n }\n\nexport interface HeadingInput {\n view: NavigationView\n viaAccountMenu: boolean\n /** WebID of the logged-in user. */\n viewer?: string\n pageUrl: string\n /** WebID of the person whose pod the page is in, if known. */\n owner?: string\n /** URIs of the storages of that pod. */\n storageUris: string[]\n}\n\n/**\n * Profile and friends panes present their own subject. Any other pane shows the owner of\n * the pod the page is in, unless that is the viewer, or the view came from the account menu\n * and so shows the viewer's own content.\n */\nexport function deriveHeading (input: HeadingInput): HeadingDecision {\n const { view, viaAccountMenu, viewer, pageUrl, owner, storageUris } = input\n const paneName = view.pane\n\n // Whether the pod owner's navbar has an item for the displayed pane: Profile and Friends\n // whenever there is an owner, and a storage by its URI (any of them when the view names none).\n const ownerHasPane = paneName === 'profile' || paneName === 'social'\n ? owner !== undefined\n : paneName === 'folder' && storageUris.some(uri => !view.subject || uri === view.subject)\n const ownerUri = ownerHasPane || !viaAccountMenu ? owner : undefined\n\n if (!isPersonPane(paneName)) {\n if (!ownerUri || ownerUri === viewer) return { mode: 'none' }\n return { mode: 'compact', subjectUri: ownerUri, paneName }\n }\n\n return {\n mode: paneName === 'profile' ? 'full' : 'compact',\n subjectUri: view.subject || (ownerHasPane ? owner : undefined) || pageUrl,\n paneName\n }\n}\n\n// Navbar\n\nexport interface NavbarSelection {\n paneName?: string\n paneUri?: string\n}\n\n/** What the navbar should have selected: the displayed pane, or Profile on a WebID. */\nexport function deriveNavbarSelection (view: NavigationView, pageIsWebId: boolean): NavbarSelection {\n return {\n paneName: view.pane ?? (pageIsWebId ? 'profile' : undefined),\n paneUri: view.subject\n }\n}\n\n/**\n * @param storageItemCount how many storage items the navbar has; a single storage is\n * selected even when the view does not say which one it was\n */\nexport function isNavbarItemSelected (\n item: NavbarItemRef,\n selection: NavbarSelection,\n storageItemCount: number\n): boolean {\n if (!selection.paneName || item.paneName !== selection.paneName) return false\n if (item.paneName === 'folder') {\n return selection.paneUri ? selection.paneUri === item.paneUri : storageItemCount === 1\n }\n return true\n}\n\n/** The item to select for a pane: the one for that subject, else the first for that pane. */\nexport function pickNavbarItem<Item extends NavbarItemRef> (\n items: Item[],\n paneName: string,\n paneUri?: string\n): Item | undefined {\n const forPane = items.filter(item => item.paneName === paneName)\n return forPane.find(item => item.paneUri === paneUri) ?? forPane[0]\n}\n\n/** The navbar is not offered in the viewer's own pod, nor over account-menu content. */\nexport function isNavbarHidden (input: { viaAccountMenu: boolean, ownProfile: boolean, inViewerPod: boolean }): boolean {\n return input.viaAccountMenu || input.ownProfile || input.inViewerPod\n}\n\n// File explorer header\n\nexport interface ExplorerHeaderInput {\n isRootResource: boolean\n isWebId: boolean\n /**\n * The view shows a person's own subject or the viewer's content, not the resource the\n * page URL points at, so the resource header only fits inside the viewer's own pod.\n */\n viewerPodOnly: boolean\n inViewerPod: boolean\n}\n\n/** Whether the header describing a resource fits the view. */\nexport function deriveExplorerHeader (input: ExplorerHeaderInput): boolean {\n if (input.isRootResource || input.isWebId) return false\n return !input.viewerPodOnly || input.inViewerPod\n}\n\n/** The header is never shown over a person's profile or friends, whatever the resource. */\nexport function explorerHeaderForPane (resourceHeader: boolean, paneName?: string): boolean {\n return resourceHeader && !isPersonPane(paneName)\n}\n"],"mappings":"AAaA,IAAaA,EAAe,CAAC,UAAW,QAAQ,EAEhD,SAAgBC,EAAc,EAA4B,CACxD,OAAOC,IAAa,IAAA,IAAaF,EAAa,SAASE,CAAQ,CACjE,CAqCA,SAAgBC,EAAe,EAAsC,CACnE,GAAM,CAAE,OAAM,iBAAgB,SAAQ,UAAS,QAAO,eAAgBC,EAChEF,EAAWG,EAAK,KAIhBC,EAAeJ,IAAa,WAAaA,IAAa,SACxDK,IAAU,IAAA,GACVL,IAAa,UAAYM,EAAY,KAAK,GAAO,CAACH,EAAK,SAAWI,IAAQJ,EAAK,OAAO,EACpFK,EAAWJ,GAAgB,CAACK,EAAiBJ,EAAQ,IAAA,GAO3D,OALKN,EAAaC,CAAQ,EAKnB,CACL,KAAMA,IAAa,UAAY,OAAS,UACxC,WAAYG,EAAK,UAAYC,EAAeC,EAAQ,IAAA,KAAcK,EAClE,UACF,EARM,CAACF,GAAYA,IAAaG,EAAe,CAAE,KAAM,MAAO,EACrD,CAAE,KAAM,UAAW,WAAYH,EAAU,UAAS,CAQ7D,CAUA,SAAgBI,EAAuB,EAAsB,EAAuC,CAClG,MAAO,CACL,SAAUT,EAAK,OAASU,EAAc,UAAY,IAAA,IAClD,QAASV,EAAK,OAChB,CACF,CAMA,SAAgBW,EACd,EACA,EACA,EACS,CAKT,MAJI,CAACC,EAAU,UAAYC,EAAK,WAAaD,EAAU,SAAiB,GACpEC,EAAK,WAAa,SACbD,EAAU,QAAUA,EAAU,UAAYC,EAAK,QAAUC,IAAqB,EAEhF,EACT,CAGA,SAAgBC,EACd,EACA,EACA,EACkB,CAClB,IAAMC,EAAUC,EAAM,OAAO,GAAQJ,EAAK,WAAahB,CAAQ,EAC/D,OAAOmB,EAAQ,KAAK,GAAQH,EAAK,UAAYK,CAAO,GAAKF,EAAQ,EACnE,CAGA,SAAgBG,EAAgB,EAAwF,CACtH,OAAOpB,EAAM,gBAAkBA,EAAM,YAAcA,EAAM,WAC3D,CAgBA,SAAgBqB,EAAsB,EAAqC,CAEzE,OADIrB,EAAM,gBAAkBA,EAAM,QAAgB,GAC3C,CAACA,EAAM,eAAiBA,EAAM,WACvC,CAGA,SAAgBsB,EAAuB,EAAyB,EAA4B,CAC1F,OAAOC,GAAkB,CAAC1B,EAAaC,CAAQ,CACjD,C"}
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","folderView","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 a person's profile or friends, whatever the resource,\n * nor over a storage view, which has its own header or the navbar.\n */\nexport function explorerHeaderForPane (resourceHeader: boolean, paneName?: string, folderView?: FolderView): boolean {\n if (paneName === 'folder' && (folderView === 'explorer' || folderView === 'storage')) return false\n return resourceHeader && !isPersonPane(paneName)\n}\n"],"mappings":"AAcA,IAAaA,EAAe,CAAC,UAAW,QAAQ,EAEhD,SAAgBC,EAAc,EAA4B,CACxD,OAAOC,IAAa,IAAA,IAAaF,EAAa,SAASE,CAAQ,CACjE,CAGA,SAAgBC,EAAoB,EAA4B,CAC9D,OAAOF,EAAaC,CAAQ,CAC9B,CAqCA,SAAgBE,EAAe,EAAsC,CACnE,GAAM,CAAE,OAAM,iBAAgB,SAAQ,UAAS,QAAO,eAAgBC,EAChEH,EAAWI,EAAK,KAIhBC,EAAeL,IAAa,WAAaA,IAAa,SACxDM,IAAU,IAAA,GACVN,IAAa,UAAYO,EAAY,KAAK,GAAO,CAACH,EAAK,SAAWI,IAAQJ,EAAK,OAAO,EACpFK,E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2
+ import { FolderView } from './options';
2
3
  /** Registry names of the panes that present a person rather than a resource. */
3
4
  export declare const PERSON_PANES: string[];
4
5
  export declare function isPersonPane(paneName?: string): boolean;
6
+ /** Whether the heading over this pane offers to add its person as a friend: on the Profile and Friends tabs. */
7
+ export declare function offersFriendAction(paneName?: string): boolean;
5
8
  /** The parts of a navbar item that the rules look at. */
6
9
  export interface NavbarItemRef {
7
10
  paneName?: string;
@@ -52,6 +55,18 @@ export declare function isNavbarHidden(input: {
52
55
  ownProfile: boolean;
53
56
  inViewerPod: boolean;
54
57
  }): boolean;
58
+ export interface StorageViewInput {
59
+ viaAccountMenu: boolean;
60
+ /** The storage is one of the viewer's own. */
61
+ inViewerPod: boolean;
62
+ /** The storage belongs to a person whose profile was found; the server root has none. */
63
+ hasOwner: boolean;
64
+ }
65
+ /**
66
+ * The viewer's own storage, and the server root, come with the folder pane's storage header.
67
+ * Someone else's storage sits under the navbar of their pod, which already says whose it is.
68
+ */
69
+ export declare function deriveStorageView(input: StorageViewInput): Extract<FolderView, 'explorer' | 'storage'>;
55
70
  export interface ExplorerHeaderInput {
56
71
  isRootResource: boolean;
57
72
  isWebId: boolean;
@@ -64,6 +79,9 @@ export interface ExplorerHeaderInput {
64
79
  }
65
80
  /** Whether the header describing a resource fits the view. */
66
81
  export declare function deriveExplorerHeader(input: ExplorerHeaderInput): boolean;
67
- /** The header is never shown over a person's profile or friends, whatever the resource. */
68
- export declare function explorerHeaderForPane(resourceHeader: boolean, paneName?: string): boolean;
82
+ /**
83
+ * The header is never shown over a person's profile or friends, whatever the resource,
84
+ * nor over a storage view, which has its own header or the navbar.
85
+ */
86
+ export declare function explorerHeaderForPane(resourceHeader: boolean, paneName?: string, folderView?: FolderView): boolean;
69
87
  //# sourceMappingURL=chrome.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/navigation/chrome.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,cAAc,EAAE,M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IAC9C,WAAW,EAAE,OAAO,CAAA;IACpB,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC,CAEvG;AAID,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAGzE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAGnH"}
@@ -1,9 +1,12 @@
1
- //#region src/navigation/chrome.ts
1
+ // src/navigation/chrome.ts
2
2
  var e = ["profile", "social"];
3
3
  function t(t) {
4
4
  return t !== void 0 && e.includes(t);
5
5
  }
6
6
  function n(e) {
7
+ return t(e);
8
+ }
9
+ function r(e) {
7
10
  let { view: n, viaAccountMenu: r, viewer: i, pageUrl: a, owner: o, storageUris: s } = e, c = n.pane, l = c === "profile" || c === "social" ? o !== void 0 : c === "folder" && s.some((e) => !n.subject || e === n.subject), u = l || !r ? o : void 0;
8
11
  return t(c) ? {
9
12
  mode: c === "profile" ? "full" : "compact",
@@ -15,29 +18,31 @@ function n(e) {
15
18
  paneName: c
16
19
  };
17
20
  }
18
- function r(e, t) {
21
+ function i(e, t) {
19
22
  return {
20
23
  paneName: e.pane ?? (t ? "profile" : void 0),
21
24
  paneUri: e.subject
22
25
  };
23
26
  }
24
- function i(e, t, n) {
27
+ function a(e, t, n) {
25
28
  return !t.paneName || e.paneName !== t.paneName ? !1 : e.paneName === "folder" ? t.paneUri ? t.paneUri === e.paneUri : n === 1 : !0;
26
29
  }
27
- function a(e, t, n) {
30
+ function o(e, t, n) {
28
31
  let r = e.filter((e) => e.paneName === t);
29
32
  return r.find((e) => e.paneUri === n) ?? r[0];
30
33
  }
31
- function o(e) {
34
+ function s(e) {
32
35
  return e.viaAccountMenu || e.ownProfile || e.inViewerPod;
33
36
  }
34
- function s(e) {
37
+ function c(e) {
38
+ return e.viaAccountMenu || e.inViewerPod || !e.hasOwner ? "explorer" : "storage";
39
+ }
40
+ function l(e) {
35
41
  return e.isRootResource || e.isWebId ? !1 : !e.viewerPodOnly || e.inViewerPod;
36
42
  }
37
- function c(e, n) {
38
- return e && !t(n);
43
+ function u(e, n, r) {
44
+ return n === "folder" && (r === "explorer" || r === "storage") ? !1 : e && !t(n);
39
45
  }
40
- //#endregion
41
- export { e as PERSON_PANES, s as deriveExplorerHeader, n as deriveHeading, r as deriveNavbarSelection, c as explorerHeaderForPane, o as isNavbarHidden, i as isNavbarItemSelected, t as isPersonPane, a as pickNavbarItem };
46
+ export { e as PERSON_PANES, l as deriveExplorerHeader, r as deriveHeading, i as deriveNavbarSelection, c as deriveStorageView, u as explorerHeaderForPane, s as isNavbarHidden, a as isNavbarItemSelected, t as isPersonPane, n as offersFriendAction, o as pickNavbarItem };
42
47
 
43
48
  //# sourceMappingURL=chrome.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chrome.esm.js","names":["PERSON_PANES","isPersonPane","paneName","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","deriveExplorerHeader","explorerHeaderForPane","resourceHeader"],"sources":["../../src/navigation/chrome.ts"],"sourcesContent":["/*\n * The rules for what the page chrome shows, as pure functions.\n *\n * What the user sees depends on the page URL, the pane that was last opened, whether the\n * account menu opened it, who is logged in and whose pod the URL is in. These functions\n * decide it from those inputs alone: they read no history, DOM or session, so every rule\n * can be tested in one place. The heading, navbar, outline and file explorer provider\n * only apply the result.\n */\n\nimport { type NavigationView } from './state'\n\n/** Registry names of the panes that present a person rather than a resource. */\nexport const PERSON_PANES = ['profile', 'social']\n\nexport function isPersonPane (paneName?: string): boolean {\n return paneName !== undefined && PERSON_PANES.includes(paneName)\n}\n\n/** The parts of a navbar item that the rules look at. */\nexport interface NavbarItemRef {\n paneName?: string\n paneUri?: string\n}\n\n// Profile heading\n\nexport type HeadingDecision =\n | { mode: 'none' }\n | {\n /** Full on the profile pane, compact everywhere else. */\n mode: 'full' | 'compact'\n /** The profile (WebID or document) to present. */\n subjectUri: string\n paneName?: string\n }\n\nexport interface HeadingInput {\n view: NavigationView\n viaAccountMenu: boolean\n /** WebID of the logged-in user. */\n viewer?: string\n pageUrl: string\n /** WebID of the person whose pod the page is in, if known. */\n owner?: string\n /** URIs of the storages of that pod. */\n storageUris: string[]\n}\n\n/**\n * Profile and friends panes present their own subject. Any other pane shows the owner of\n * the pod the page is in, unless that is the viewer, or the view came from the account menu\n * and so shows the viewer's own content.\n */\nexport function deriveHeading (input: HeadingInput): HeadingDecision {\n const { view, viaAccountMenu, viewer, pageUrl, owner, storageUris } = input\n const paneName = view.pane\n\n // Whether the pod owner's navbar has an item for the displayed pane: Profile and Friends\n // whenever there is an owner, and a storage by its URI (any of them when the view names none).\n const ownerHasPane = paneName === 'profile' || paneName === 'social'\n ? owner !== undefined\n : paneName === 'folder' && storageUris.some(uri => !view.subject || uri === view.subject)\n const ownerUri = ownerHasPane || !viaAccountMenu ? owner : undefined\n\n if (!isPersonPane(paneName)) {\n if (!ownerUri || ownerUri === viewer) return { mode: 'none' }\n return { mode: 'compact', subjectUri: ownerUri, paneName }\n }\n\n return {\n mode: paneName === 'profile' ? 'full' : 'compact',\n subjectUri: view.subject || (ownerHasPane ? owner : undefined) || pageUrl,\n paneName\n }\n}\n\n// Navbar\n\nexport interface NavbarSelection {\n paneName?: string\n paneUri?: string\n}\n\n/** What the navbar should have selected: the displayed pane, or Profile on a WebID. */\nexport function deriveNavbarSelection (view: NavigationView, pageIsWebId: boolean): NavbarSelection {\n return {\n paneName: view.pane ?? (pageIsWebId ? 'profile' : undefined),\n paneUri: view.subject\n }\n}\n\n/**\n * @param storageItemCount how many storage items the navbar has; a single storage is\n * selected even when the view does not say which one it was\n */\nexport function isNavbarItemSelected (\n item: NavbarItemRef,\n selection: NavbarSelection,\n storageItemCount: number\n): boolean {\n if (!selection.paneName || item.paneName !== selection.paneName) return false\n if (item.paneName === 'folder') {\n return selection.paneUri ? selection.paneUri === item.paneUri : storageItemCount === 1\n }\n return true\n}\n\n/** The item to select for a pane: the one for that subject, else the first for that pane. */\nexport function pickNavbarItem<Item extends NavbarItemRef> (\n items: Item[],\n paneName: string,\n paneUri?: string\n): Item | undefined {\n const forPane = items.filter(item => item.paneName === paneName)\n return forPane.find(item => item.paneUri === paneUri) ?? forPane[0]\n}\n\n/** The navbar is not offered in the viewer's own pod, nor over account-menu content. */\nexport function isNavbarHidden (input: { viaAccountMenu: boolean, ownProfile: boolean, inViewerPod: boolean }): boolean {\n return input.viaAccountMenu || input.ownProfile || input.inViewerPod\n}\n\n// File explorer header\n\nexport interface ExplorerHeaderInput {\n isRootResource: boolean\n isWebId: boolean\n /**\n * The view shows a person's own subject or the viewer's content, not the resource the\n * page URL points at, so the resource header only fits inside the viewer's own pod.\n */\n viewerPodOnly: boolean\n inViewerPod: boolean\n}\n\n/** Whether the header describing a resource fits the view. */\nexport function deriveExplorerHeader (input: ExplorerHeaderInput): boolean {\n if (input.isRootResource || input.isWebId) return false\n return !input.viewerPodOnly || input.inViewerPod\n}\n\n/** The header is never shown over a person's profile or friends, whatever the resource. */\nexport function explorerHeaderForPane (resourceHeader: boolean, paneName?: string): boolean {\n return resourceHeader && !isPersonPane(paneName)\n}\n"],"mappings":";AAaA,IAAaA,IAAe,CAAC,WAAW,QAAQ;AAEhD,SAAgBC,EAAc,GAA4B;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AAiBA,EAAM;AACvC;AAGA,SAAgBsB,EAAuB,GAAyB,GAA4B;CAC1F,OAAOC,KAAkB,CAAC1B,EAAaC,CAAQ;AACjD"}
1
+ {"version":3,"file":"chrome.esm.js","names":["PERSON_PANES","isPersonPane","paneName","offersFriendAction","deriveHeading","input","view","ownerHasPane","owner","storageUris","uri","ownerUri","viaAccountMenu","pageUrl","viewer","deriveNavbarSelection","pageIsWebId","isNavbarItemSelected","selection","item","storageItemCount","pickNavbarItem","forPane","items","paneUri","isNavbarHidden","deriveStorageView","deriveExplorerHeader","explorerHeaderForPane","folderView","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 a person's profile or friends, whatever the resource,\n * nor over a storage view, which has its own header or the navbar.\n */\nexport function explorerHeaderForPane (resourceHeader: boolean, paneName?: string, folderView?: FolderView): boolean {\n if (paneName === 'folder' && (folderView === 'explorer' || folderView === 'storage')) return false\n return resourceHeader && !isPersonPane(paneName)\n}\n"],"mappings":";AAcA,IAAaA,IAAe,CAAC,WAAW,QAAQ;AAEhD,SAAgBC,EAAc,GAA4B;CACxD,OAAOC,MAAa,KAAA,KAAaF,EAAa,SAASE,CAAQ;AACjE;AAGA,SAAgBC,EAAoB,GAA4B;CAC9D,OAAOF,EAAaC,CAAQ;AAC9B;AAqCA,SAAgBE,EAAe,GAAsC;CACnE,IAAM,EAAE,SAAM,mBAAgB,W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AAMA,SAAgBuB,EAAuB,GAAyB,GAAmB,GAAkC;CAEnH,OADI1B,MAAa,aAAa2B,MAAe,cAAcA,MAAe,aAAmB,KACtFC,KAAkB,CAAC7B,EAAaC,CAAQ;AACjD"}
@@ -1,2 +1,2 @@
1
- const e=require("../utils/webIdUtils.cjs.js"),t=require("../utils/paneUtils.cjs.js"),n=require("./state.cjs.js"),r=require("./navbarVisibility.cjs.js");function i(i){let{store:a,outliner:o,byName:s,effects:c}=i,l=0;async function u(n,r){if(r.subject){let e=a.sym(r.subject);if(r.kind===`profile`)return t.getProfilePaneFromURI(e);if(r.kind===`friends`)return t.getSocialPaneFromURI(e);if(r.kind===`storage`)return t.getFolderPaneForStorage(e)}return r.pane?s(r.pane)??void 0:e.isWebIdUri(n)?t.getProfilePaneFromURI(n):void 0}async function d(e,n,r){switch(e.kind){case`restore`:return u(n,r.view);case`profile`:return t.getProfilePaneFromURI(a.sym(e.subject));case`friends`:return t.getSocialPaneFromURI(a.sym(e.subject));case`storage`:return e.pane;case`app`:return s(e.pane)}}return{async show(e){let t=++l,i=n.readNavigationState(),s=e.kind===`restore`?i.viaAccountMenu?`accountMenu`:`default`:e.source??`default`;s===`accountMenu`&&r.setNavbarHidden(!0);let u=a.sym(e.kind===`restore`&&e.subject?e.subject:window.location.href),f=await d(e,u,i);if(t===l){if(!f&&e.kind!==`restore`)console.warn(`Could not open the requested view for the logged-in user.`);else{if(o.GotoSubject(u,!0,f??void 0,!0,void 0,void 0,{source:s}),s!==`accountMenu`){let{view:e}=n.readNavigationState();e.pane&&c.selectNavbarPane(e.pane,e.subject)}await c.refreshHeading(e.kind===`restore`&&e.forceHeading===!0)}}}}}exports.createNavigationController=i;
1
+ const e=require("../utils/webIdUtils.cjs.js"),t=require("./chrome.cjs.js"),n=require("../utils/paneUtils.cjs.js"),r=require("./podContext.cjs.js"),i=require("./state.cjs.js"),a=require("./navbarVisibility.cjs.js");function o(o){let{store:s,outliner:c,byName:l,effects:u,podContextOf:d=r.getPodContext}=o,f=0;async function p(e){if(!e.uri.endsWith(`/`))return;let t=e.site().uri===e.uri,{storagePanes:r,viewerStorages:i}=await d(e.uri),a=r.some(t=>t.subject.uri===e.uri)||i.includes(e.uri);return t||a?n.getFolderPaneForStorage(e):void 0}async function m(e,n){let i=n?void 0:await d(e);return t.deriveStorageView({viaAccountMenu:n,inViewerPod:!!i&&r.isInViewerPod(i,e),hasOwner:!!i?.owner})}async function h(t,r){if(r.subject){let e=s.sym(r.subject);if(r.kind===`profile`)return n.getProfilePaneFromURI(e,l);if(r.kind===`friends`)return n.getSocialPaneFromURI(e,l);if(r.kind===`storage`)return n.getFolderPaneForStorage(e)}return r.pane?l(r.pane)??void 0:e.isWebIdUri(t)?n.getProfilePaneFromURI(t,l):p(t)}async function g(e,t,r){switch(e.kind){case`restore`:return h(t,r.view);case`profile`:return n.getProfilePaneFromURI(s.sym(e.subject),l);case`friends`:return n.getSocialPaneFromURI(s.sym(e.subject),l);case`storage`:return e.pane;case`app`:return l(e.pane)}}return{async show(e){let t=++f,n=i.readNavigationState(),r=e.kind===`restore`?n.viaAccountMenu?`accountMenu`:`default`:e.source??`default`;r===`accountMenu`&&a.setNavbarHidden(!0);let o=s.sym(e.kind===`restore`&&e.subject?e.subject:window.location.href),l=await g(e,o,n);if(t!==f)return;if(!l&&e.kind!==`restore`){console.warn(`Could not open the requested view for the logged-in user.`);return}let d=l&&l.name===`folder`?l.subject?.uri:void 0,p=d?await m(d,r===`accountMenu`):void 0;if(t===f){if(c.GotoSubject(o,!0,l??void 0,!0,void 0,void 0,p?{source:r,folderView:p}:{source:r}),r!==`accountMenu`){let{view:e}=i.readNavigationState();e.pane&&u.selectNavbarPane(e.pane,e.subject)}await u.refreshHeading(e.kind===`restore`&&e.forceHeading===!0)}}}}exports.createNavigationController=o;
2
2
  //# sourceMappingURL=controller.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.cjs.js","names":["getProfilePaneFromURI","getSocialPaneFromURI","getFolderPaneForStorage","isWebIdUri","readNavigationState","require_webIdUtils","require_paneUtils","require_state","require_navbarVisibility","createNavigationController","deps","latest","paneForView","view","paneSubject","store","byName","subject","paneFor","intent","state","request","source","pane","outliner","effects"],"sources":["../../src/navigation/controller.ts"],"sourcesContent":["/*\n * The one place that displays a view and brings the page chrome in line with it.\n *\n * The account menu, the navbar, a page load, Enter in the address bar, back and forward and a\n * layout change used to each resolve a pane, call `GotoSubject` and then do some of the follow-up\n * themselves. Now each describes what it wants as an intent, and the follow-up is always the same:\n * navbar visibility and selection, then the profile heading.\n */\n\nimport type { LiveStore, NamedNode } from 'rdflib'\nimport type { PaneDefinition } from 'pane-registry'\nimport type { OutlineManager } from '../outline/manager'\nimport { getFolderPaneForStorage, getProfilePaneFromURI, getSocialPaneFromURI, type PaneItem } from '../utils/paneUtils'\nimport { setNavbarHidden } from './navbarVisibility'\nimport { readNavigationState, type NavigationState, type NavigationView } from './state'\nimport type { NavigationSource } from './options'\nimport { isWebIdUri } from '../utils/webIdUtils'\n\nexport type NavigationIntent =\n /** Display what the current history entry says was displayed, for the page's own URL. */\n | {\n kind: 'restore'\n /** The page subject, when it is not the current URL. */\n subject?: string\n /** Redo the heading even if it believes it already shows the right profile. */\n forceHeading?: boolean\n }\n /** A person's profile or friends, by WebID. */\n | { kind: 'profile' | 'friends', subject: string, source?: NavigationSource }\n /** A storage, as the navbar or the account menu offers it. */\n | { kind: 'storage', pane: PaneItem, source?: NavigationSource }\n /** A pane of the application itself, by registry name (dashboard, preferences). */\n | { kind: 'app', pane: string, source?: NavigationSource }\n\nexport interface NavigationEffects {\n selectNavbarPane: (paneName: string, paneUri?: string) => void\n refreshHeading: (force: boolean) => Promise<void>\n}\n\nexport interface NavigationDeps {\n store: LiveStore\n outliner: OutlineManager\n byName: (name: string) => PaneDefinition | null | undefined\n effects: NavigationEffects\n}\n\nexport interface NavigationController {\n /**\n * Display what the intent asks for. If another intent arrives while this one is still\n * resolving its pane, only the later one is displayed.\n */\n show: (intent: NavigationIntent) => Promise<void>\n}\n\ntype DisplayedPane = PaneItem | PaneDefinition | null | undefined\n\nexport function createNavigationController (deps: NavigationDeps): NavigationController {\n const { store, outliner, byName, effects } = deps\n let latest = 0\n\n async function paneForView (subject: NamedNode, view: NavigationView): Promise<DisplayedPane> {\n // These panes render a subject other than the page URL.\n if (view.subject) {\n const paneSubject = store.sym(view.subject)\n if (view.kind === 'profile') return getProfilePaneFromURI(paneSubject)\n if (view.kind === 'friends') return getSocialPaneFromURI(paneSubject)\n if (view.kind === 'storage') return getFolderPaneForStorage(paneSubject)\n }\n if (view.pane) return byName(view.pane) ?? undefined\n return isWebIdUri(subject) ? getProfilePaneFromURI(subject) : undefined\n }\n\n async function paneFor (intent: NavigationIntent, subject: NamedNode, state: NavigationState): Promise<DisplayedPane> {\n switch (intent.kind) {\n case 'restore': return paneForView(subject, state.view)\n case 'profile': return getProfilePaneFromURI(store.sym(intent.subject))\n case 'friends': return getSocialPaneFromURI(store.sym(intent.subject))\n case 'storage': return intent.pane\n case 'app': return byName(intent.pane)\n }\n }\n\n return {\n async show (intent) {\n const request = ++latest\n const state = readNavigationState()\n const source: NavigationSource = intent.kind === 'restore'\n ? (state.viaAccountMenu ? 'accountMenu' : 'default')\n : intent.source ?? 'default'\n // The account menu shows the viewer's own content, so the navbar for the page is not offered\n if (source === 'accountMenu') setNavbarHidden(true)\n\n const subject = store.sym(intent.kind === 'restore' && intent.subject ? intent.subject : window.location.href)\n const pane = await paneFor(intent, subject, state)\n if (request !== latest) return\n\n // Without a pane the outline would fall back to the page URL's own default view, which\n // is only right when restoring an entry that displayed nothing in particular.\n if (!pane && intent.kind !== 'restore') {\n console.warn('Could not open the requested view for the logged-in user.')\n return\n }\n\n outliner.GotoSubject(subject, true, pane ?? undefined, true, undefined, undefined, { source })\n\n if (source !== 'accountMenu') {\n const { view } = readNavigationState()\n if (view.pane) effects.selectNavbarPane(view.pane, view.subject)\n }\n await effects.refreshHeading(intent.kind === 'restore' && intent.forceHeading === true)\n }\n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,CAAK,EACjD,GAAIC,IAAYV,EAIhB,IAAI,CAACY,GAAQJ,EAAO,OAAS,UAC3B,QAAQ,KAAK,2DAA2D,MAI1E,CAEA,GAFAK,EAAS,YAAYP,EAAS,GAAMM,GAAQ,IAAA,GAAW,GAAM,IAAA,GAAW,IAAA,GAAW,CAAE,QAAO,CAAC,EAEzFD,IAAW,cAAe,CAC5B,GAAM,CAAE,QAASlB,EAAAA,oBAAoB,EACjCS,EAAK,MAAMY,EAAQ,iBAAiBZ,EAAK,KAAMA,EAAK,OAAO,CACjE,CACA,MAAMY,EAAQ,eAAeN,EAAO,OAAS,WAAaA,EAAO,eAAiB,EAAI,CANO,CAF7F,CASF,CACF,CACF,C"}
1
+ {"version":3,"file":"controller.cjs.js","names":["getPodContext","getFolderPaneForStorage","deriveStorageView","isInViewerPod","getProfilePaneFromURI","getSocialPaneFromURI","isWebIdUri","readNavigationState","require_webIdUtils","require_chrome","require_paneUtils","require_podContext","require_state","require_navbarVisibility","createNavigationController","deps","latest","storageAt","subject","isServerRoot","podContextOf","isStorage","storagePanes","pane","viewerStorages","folderViewFor","context","viaAccountMenu","storage","paneForView","view","paneSubject","store","byName","paneFor","intent","state","request","source","folderView","outliner","effects"],"sources":["../../src/navigation/controller.ts"],"sourcesContent":["/*\n * The one place that displays a view and brings the page chrome in line with it.\n *\n * The account menu, the navbar, a page load, Enter in the address bar, back and forward and a\n * layout change used to each resolve a pane, call `GotoSubject` and then do some of the follow-up\n * themselves. Now each describes what it wants as an intent, and the follow-up is always the same:\n * navbar visibility and selection, then the profile heading.\n */\n\nimport type { LiveStore, NamedNode } from 'rdflib'\nimport type { PaneDefinition } from 'pane-registry'\nimport type { OutlineManager } from '../outline/manager'\nimport { getFolderPaneForStorage, getProfilePaneFromURI, getSocialPaneFromURI, type PaneItem } from '../utils/paneUtils'\nimport { setNavbarHidden } from './navbarVisibility'\nimport { readNavigationState, type NavigationState, type NavigationView } from './state'\nimport type { FolderView, NavigationSource } from './options'\nimport { isWebIdUri } from '../utils/webIdUtils'\nimport { deriveStorageView } from './chrome'\nimport { getPodContext, isInViewerPod, type PodContext } from './podContext'\n\nexport type NavigationIntent =\n /** Display what the current history entry says was displayed, for the page's own URL. */\n | {\n kind: 'restore'\n /** The page subject, when it is not the current URL. */\n subject?: string\n /** Redo the heading even if it believes it already shows the right profile. */\n forceHeading?: boolean\n }\n /** A person's profile or friends, by WebID. */\n | { kind: 'profile' | 'friends', subject: string, source?: NavigationSource }\n /** A storage, as the navbar or the account menu offers it. */\n | { kind: 'storage', pane: PaneItem, source?: NavigationSource }\n /** A pane of the application itself, by registry name (dashboard, preferences). */\n | { kind: 'app', pane: string, source?: NavigationSource }\n\nexport interface NavigationEffects {\n selectNavbarPane: (paneName: string, paneUri?: string) => void\n refreshHeading: (force: boolean) => Promise<void>\n}\n\nexport interface NavigationDeps {\n store: LiveStore\n outliner: OutlineManager\n byName: (name: string) => PaneDefinition | null | undefined\n effects: NavigationEffects\n /** Whose pod a URL is in; `getPodContext` unless a test supplies its own. */\n podContextOf?: (url: string) => Promise<PodContext>\n}\n\nexport interface NavigationController {\n /**\n * Display what the intent asks for. If another intent arrives while this one is still\n * resolving its pane, only the later one is displayed.\n */\n show: (intent: NavigationIntent) => Promise<void>\n}\n\ntype DisplayedPane = PaneItem | PaneDefinition | null | undefined\n\nexport function createNavigationController (deps: NavigationDeps): NavigationController {\n const { store, outliner, byName, effects, podContextOf = getPodContext } = deps\n let latest = 0\n\n /** The storage pane for a page that is a storage of its pod, or the server root. */\n async function storageAt (subject: NamedNode): Promise<PaneItem | null | undefined> {\n if (!subject.uri.endsWith('/')) return undefined\n const isServerRoot = subject.site().uri === subject.uri\n const { storagePanes, viewerStorages } = await podContextOf(subject.uri)\n const isStorage = storagePanes.some(pane => pane.subject.uri === subject.uri) ||\n viewerStorages.includes(subject.uri)\n return isServerRoot || isStorage ? getFolderPaneForStorage(subject) : undefined\n }\n\n async function folderViewFor (storage: string, viaAccountMenu: boolean): Promise<FolderView> {\n const context = viaAccountMenu ? undefined : await podContextOf(storage)\n return deriveStorageView({\n viaAccountMenu,\n inViewerPod: !!context && isInViewerPod(context, storage),\n hasOwner: !!context?.owner\n })\n }\n\n async function paneForView (subject: NamedNode, view: NavigationView): Promise<DisplayedPane> {\n // These panes render a subject other than the page URL.\n if (view.subject) {\n const paneSubject = store.sym(view.subject)\n if (view.kind === 'profile') return getProfilePaneFromURI(paneSubject, byName)\n if (view.kind === 'friends') return getSocialPaneFromURI(paneSubject, byName)\n if (view.kind === 'storage') return getFolderPaneForStorage(paneSubject)\n }\n if (view.pane) return byName(view.pane) ?? undefined\n // With nothing recorded, the URL decides: a WebID shows its profile, a storage its storage view\n return isWebIdUri(subject) ? getProfilePaneFromURI(subject, byName) : storageAt(subject)\n }\n\n async function paneFor (intent: NavigationIntent, subject: NamedNode, state: NavigationState): Promise<DisplayedPane> {\n switch (intent.kind) {\n case 'restore': return paneForView(subject, state.view)\n case 'profile': return getProfilePaneFromURI(store.sym(intent.subject), byName)\n case 'friends': return getSocialPaneFromURI(store.sym(intent.subject), byName)\n case 'storage': return intent.pane\n case 'app': return byName(intent.pane)\n }\n }\n\n return {\n async show (intent) {\n const request = ++latest\n const state = readNavigationState()\n const source: NavigationSource = intent.kind === 'restore'\n ? (state.viaAccountMenu ? 'accountMenu' : 'default')\n : intent.source ?? 'default'\n // The account menu shows the viewer's own content, so the navbar for the page is not offered\n if (source === 'accountMenu') setNavbarHidden(true)\n\n const subject = store.sym(intent.kind === 'restore' && intent.subject ? intent.subject : window.location.href)\n const pane = await paneFor(intent, subject, state)\n if (request !== latest) return\n\n // Without a pane the outline would fall back to the page URL's own default view, which\n // is only right when restoring an entry that displayed nothing in particular.\n if (!pane && intent.kind !== 'restore') {\n console.warn('Could not open the requested view for the logged-in user.')\n return\n }\n\n const storage = pane && pane.name === 'folder' ? (pane as PaneItem).subject?.uri : undefined\n const folderView = storage ? await folderViewFor(storage, source === 'accountMenu') : undefined\n if (request !== latest) return\n\n outliner.GotoSubject(subject, true, pane ?? undefined, true, undefined, undefined, folderView ? { source, folderView } : { source })\n\n if (source !== 'accountMenu') {\n const { view } = readNavigationState()\n if (view.pane) effects.selectNavbarPane(view.pane, view.subject)\n }\n await effects.refreshHeading(intent.kind === 'restore' && intent.forceHeading === true)\n }\n }\n}\n"],"mappings":"A,sNA4DA,SAAgBc,EAA4B,EAA4C,CACtF,GAAM,CAAE,QAAO,WAAU,SAAQ,UAAS,eAAed,EAAAA,eAAkBe,EACvEC,EAAS,EAGb,eAAeC,EAAW,EAA0D,CAClF,GAAI,CAACC,EAAQ,IAAI,SAAS,GAAG,EAAG,OAChC,IAAMC,EAAeD,EAAQ,KAAK,CAAC,CAAC,MAAQA,EAAQ,IAC9C,CAAE,eAAc,kBAAmB,MAAME,EAAaF,EAAQ,GAAG,EACjEG,EAAYC,EAAa,KAAK,GAAQC,EAAK,QAAQ,MAAQL,EAAQ,GAAG,GAC1EM,EAAe,SAASN,EAAQ,GAAG,EACrC,OAAOC,GAAgBE,EAAYpB,EAAAA,wBAAwBiB,CAAO,EAAI,IAAA,EACxE,CAEA,eAAeO,EAAe,EAAiB,EAA8C,CAC3F,IAAMC,EAAUC,EAAiB,IAAA,GAAY,MAAMP,EAAaQ,CAAO,EACvE,OAAO1B,EAAAA,kBAAkB,CACvB,iBACA,YAAa,CAAC,CAACwB,GAAWvB,EAAAA,cAAcuB,EAASE,CAAO,EACxD,SAAU,CAAC,CAACF,GAAS,KACvB,CAAC,CACH,CAEA,eAAeG,EAAa,EAAoB,EAA8C,CAE5F,GAAIC,EAAK,QAAS,CAChB,IAAMC,EAAcC,EAAM,IAAIF,EAAK,OAAO,EAC1C,GAAIA,EAAK,OAAS,UAAW,OAAO1B,EAAAA,sBAAsB2B,EAAaE,CAAM,EAC7E,GAAIH,EAAK,OAAS,UAAW,OAAOzB,EAAAA,qBAAqB0B,EAAaE,CAAM,EAC5E,GAAIH,EAAK,OAAS,UAAW,OAAO7B,EAAAA,wBAAwB8B,CAAW,CACz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AAA,GAAW,IAAA,GAAWgB,EAAa,CAAE,SAAQ,YAAW,EAAI,CAAE,QAAO,CAAC,EAE/HD,IAAW,cAAe,CAC5B,GAAM,CAAE,QAAS/B,EAAAA,oBAAoB,EACjCuB,EAAK,MAAMW,EAAQ,iBAAiBX,EAAK,KAAMA,EAAK,OAAO,CACjE,CACA,MAAMW,EAAQ,eAAeN,EAAO,OAAS,WAAaA,EAAO,eAAiB,EAAI,CAN6C,CAOrI,CACF,CACF,C"}
@@ -3,6 +3,7 @@ import { PaneDefinition } from '../../node_modules/pane-registry';
3
3
  import { OutlineManager } from '../outline/manager';
4
4
  import { PaneItem } from '../utils/paneUtils';
5
5
  import { NavigationSource } from './options';
6
+ import { PodContext } from './podContext';
6
7
  export type NavigationIntent =
7
8
  /** Display what the current history entry says was displayed, for the page's own URL. */
8
9
  {
@@ -39,6 +40,8 @@ export interface NavigationDeps {
39
40
  outliner: OutlineManager;
40
41
  byName: (name: string) => PaneDefinition | null | undefined;
41
42
  effects: NavigationEffects;
43
+ /** Whose pod a URL is in; `getPodContext` unless a test supplies its own. */
44
+ podContextOf?: (url: string) => Promise<PodContext>;
42
45
  }
43
46
  export interface NavigationController {
44
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/navigation/controller.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAwE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAGxH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAGjD,MAAM,MAAM,gBAAgB;AAC1B,yFAAyF;AACvF;IACA,IAAI,EAAE,SAAS,CAAA;IACf,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAA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E,iBAAiB,CAAA;IAC1B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;CACpD;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAClD;AAID,wBAAgB,0BAA0B,CAAE,IAAI,EAAE,cAAc,GAAG,oBAAoB,CAgFtF"}
@@ -1,45 +1,65 @@
1
1
  import { isWebIdUri as e } from "../utils/webIdUtils.esm.js";
2
- import { getFolderPaneForStorage as t, getProfilePaneFromURI as n, getSocialPaneFromURI as r } from "../utils/paneUtils.esm.js";
3
- import { readNavigationState as i } from "./state.esm.js";
4
- import { setNavbarHidden as a } from "./navbarVisibility.esm.js";
5
- //#region src/navigation/controller.ts
6
- function o(o) {
7
- let { store: s, outliner: c, byName: l, effects: u } = o, d = 0;
8
- async function f(i, a) {
2
+ import { deriveStorageView as t } from "./chrome.esm.js";
3
+ import { getFolderPaneForStorage as n, getProfilePaneFromURI as r, getSocialPaneFromURI as i } from "../utils/paneUtils.esm.js";
4
+ import { getPodContext as a, isInViewerPod as o } from "./podContext.esm.js";
5
+ import { readNavigationState as s } from "./state.esm.js";
6
+ import { setNavbarHidden as c } from "./navbarVisibility.esm.js";
7
+ // src/navigation/controller.ts
8
+ function l(l) {
9
+ let { store: u, outliner: d, byName: f, effects: p, podContextOf: m = a } = l, h = 0;
10
+ async function g(e) {
11
+ if (!e.uri.endsWith("/")) return;
12
+ let t = e.site().uri === e.uri, { storagePanes: r, viewerStorages: i } = await m(e.uri), a = r.some((t) => t.subject.uri === e.uri) || i.includes(e.uri);
13
+ return t || a ? n(e) : void 0;
14
+ }
15
+ async function _(e, n) {
16
+ let r = n ? void 0 : await m(e);
17
+ return t({
18
+ viaAccountMenu: n,
19
+ inViewerPod: !!r && o(r, e),
20
+ hasOwner: !!r?.owner
21
+ });
22
+ }
23
+ async function v(t, a) {
9
24
  if (a.subject) {
10
- let e = s.sym(a.subject);
11
- if (a.kind === "profile") return n(e);
12
- if (a.kind === "friends") return r(e);
13
- if (a.kind === "storage") return t(e);
25
+ let e = u.sym(a.subject);
26
+ if (a.kind === "profile") return r(e, f);
27
+ if (a.kind === "friends") return i(e, f);
28
+ if (a.kind === "storage") return n(e);
14
29
  }
15
- return a.pane ? l(a.pane) ?? void 0 : e(i) ? n(i) : void 0;
30
+ return a.pane ? f(a.pane) ?? void 0 : e(t) ? r(t, f) : g(t);
16
31
  }
17
- async function p(e, t, i) {
32
+ async function y(e, t, n) {
18
33
  switch (e.kind) {
19
- case "restore": return f(t, i.view);
20
- case "profile": return n(s.sym(e.subject));
21
- case "friends": return r(s.sym(e.subject));
34
+ case "restore": return v(t, n.view);
35
+ case "profile": return r(u.sym(e.subject), f);
36
+ case "friends": return i(u.sym(e.subject), f);
22
37
  case "storage": return e.pane;
23
- case "app": return l(e.pane);
38
+ case "app": return f(e.pane);
24
39
  }
25
40
  }
26
41
  return { async show(e) {
27
- let t = ++d, n = i(), r = e.kind === "restore" ? n.viaAccountMenu ? "accountMenu" : "default" : e.source ?? "default";
28
- r === "accountMenu" && a(!0);
29
- let o = s.sym(e.kind === "restore" && e.subject ? e.subject : window.location.href), l = await p(e, o, n);
30
- if (t === d) {
31
- if (!l && e.kind !== "restore") console.warn("Could not open the requested view for the logged-in user.");
32
- else {
33
- if (c.GotoSubject(o, !0, l ?? void 0, !0, void 0, void 0, { source: r }), r !== "accountMenu") {
34
- let { view: e } = i();
35
- e.pane && u.selectNavbarPane(e.pane, e.subject);
36
- }
37
- await u.refreshHeading(e.kind === "restore" && e.forceHeading === !0);
42
+ let t = ++h, n = s(), r = e.kind === "restore" ? n.viaAccountMenu ? "accountMenu" : "default" : e.source ?? "default";
43
+ r === "accountMenu" && c(!0);
44
+ let i = u.sym(e.kind === "restore" && e.subject ? e.subject : window.location.href), a = await y(e, i, n);
45
+ if (t !== h) return;
46
+ if (!a && e.kind !== "restore") {
47
+ console.warn("Could not open the requested view for the logged-in user.");
48
+ return;
49
+ }
50
+ let o = a && a.name === "folder" ? a.subject?.uri : void 0, l = o ? await _(o, r === "accountMenu") : void 0;
51
+ if (t === h) {
52
+ if (d.GotoSubject(i, !0, a ?? void 0, !0, void 0, void 0, l ? {
53
+ source: r,
54
+ folderView: l
55
+ } : { source: r }), r !== "accountMenu") {
56
+ let { view: e } = s();
57
+ e.pane && p.selectNavbarPane(e.pane, e.subject);
38
58
  }
59
+ await p.refreshHeading(e.kind === "restore" && e.forceHeading === !0);
39
60
  }
40
61
  } };
41
62
  }
42
- //#endregion
43
- export { o as createNavigationController };
63
+ export { l as createNavigationController };
44
64
 
45
65
  //# sourceMappingURL=controller.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.esm.js","names":["createNavigationController","deps","latest","paneForView","view","paneSubject","store","getProfilePaneFromURI","getSocialPaneFromURI","getFolderPaneForStorage","byName","isWebIdUri","subject","paneFor","intent","state","request","readNavigationState","source","setNavbarHidden","pane","outliner","effects"],"sources":["../../src/navigation/controller.ts"],"sourcesContent":["/*\n * The one place that displays a view and brings the page chrome in line with it.\n *\n * The account menu, the navbar, a page load, Enter in the address bar, back and forward and a\n * layout change used to each resolve a pane, call `GotoSubject` and then do some of the follow-up\n * themselves. Now each describes what it wants as an intent, and the follow-up is always the same:\n * navbar visibility and selection, then the profile heading.\n */\n\nimport type { LiveStore, NamedNode } from 'rdflib'\nimport type { PaneDefinition } from 'pane-registry'\nimport type { OutlineManager } from '../outline/manager'\nimport { getFolderPaneForStorage, getProfilePaneFromURI, getSocialPaneFromURI, type PaneItem } from '../utils/paneUtils'\nimport { setNavbarHidden } from './navbarVisibility'\nimport { readNavigationState, type NavigationState, type NavigationView } from './state'\nimport type { NavigationSource } from './options'\nimport { isWebIdUri } from '../utils/webIdUtils'\n\nexport type NavigationIntent =\n /** Display what the current history entry says was displayed, for the page's own URL. */\n | {\n kind: 'restore'\n /** The page subject, when it is not the current URL. */\n subject?: string\n /** Redo the heading even if it believes it already shows the right profile. */\n forceHeading?: boolean\n }\n /** A person's profile or friends, by WebID. */\n | { kind: 'profile' | 'friends', subject: string, source?: NavigationSource }\n /** A storage, as the navbar or the account menu offers it. */\n | { kind: 'storage', pane: PaneItem, source?: NavigationSource }\n /** A pane of the application itself, by registry name (dashboard, preferences). */\n | { kind: 'app', pane: string, source?: NavigationSource }\n\nexport interface NavigationEffects {\n selectNavbarPane: (paneName: string, paneUri?: string) => void\n refreshHeading: (force: boolean) => Promise<void>\n}\n\nexport interface NavigationDeps {\n store: LiveStore\n outliner: OutlineManager\n byName: (name: string) => PaneDefinition | null | undefined\n effects: NavigationEffects\n}\n\nexport interface NavigationController {\n /**\n * Display what the intent asks for. If another intent arrives while this one is still\n * resolving its pane, only the later one is displayed.\n */\n show: (intent: NavigationIntent) => Promise<void>\n}\n\ntype DisplayedPane = PaneItem | PaneDefinition | null | undefined\n\nexport function createNavigationController (deps: NavigationDeps): NavigationController {\n const { store, outliner, byName, effects } = deps\n let latest = 0\n\n async function paneForView (subject: NamedNode, view: NavigationView): Promise<DisplayedPane> {\n // These panes render a subject other than the page URL.\n if (view.subject) {\n const paneSubject = store.sym(view.subject)\n if (view.kind === 'profile') return getProfilePaneFromURI(paneSubject)\n if (view.kind === 'friends') return getSocialPaneFromURI(paneSubject)\n if (view.kind === 'storage') return getFolderPaneForStorage(paneSubject)\n }\n if (view.pane) return byName(view.pane) ?? undefined\n return isWebIdUri(subject) ? getProfilePaneFromURI(subject) : undefined\n }\n\n async function paneFor (intent: NavigationIntent, subject: NamedNode, state: NavigationState): Promise<DisplayedPane> {\n switch (intent.kind) {\n case 'restore': return paneForView(subject, state.view)\n case 'profile': return getProfilePaneFromURI(store.sym(intent.subject))\n case 'friends': return getSocialPaneFromURI(store.sym(intent.subject))\n case 'storage': return intent.pane\n case 'app': return byName(intent.pane)\n }\n }\n\n return {\n async show (intent) {\n const request = ++latest\n const state = readNavigationState()\n const source: NavigationSource = intent.kind === 'restore'\n ? (state.viaAccountMenu ? 'accountMenu' : 'default')\n : intent.source ?? 'default'\n // The account menu shows the viewer's own content, so the navbar for the page is not offered\n if (source === 'accountMenu') setNavbarHidden(true)\n\n const subject = store.sym(intent.kind === 'restore' && intent.subject ? intent.subject : window.location.href)\n const pane = await paneFor(intent, subject, state)\n if (request !== latest) return\n\n // Without a pane the outline would fall back to the page URL's own default view, which\n // is only right when restoring an entry that displayed nothing in particular.\n if (!pane && intent.kind !== 'restore') {\n console.warn('Could not open the requested view for the logged-in user.')\n return\n }\n\n outliner.GotoSubject(subject, true, pane ?? undefined, true, undefined, undefined, { source })\n\n if (source !== 'accountMenu') {\n const { view } = readNavigationState()\n if (view.pane) effects.selectNavbarPane(view.pane, view.subject)\n }\n await effects.refreshHeading(intent.kind === 'restore' && intent.forceHeading === true)\n }\n }\n}\n"],"mappings":";;;;;AAwDA,SAAgBA,EAA4B,GAA4C;CACtF,IAAM,EAAE,UAAO,aAAU,WAAQ,eAAYC,GACzCC,IAAS;CAEb,eAAeC,EAAa,GAAoB,GAA8C;EAE5F,IAAIC,EAAK,SAAS;GAChB,IAAMC,IAAcC,EAAM,IAAIF,EAAK,OAAO;GAC1C,IAAIA,EAAK,SAAS,WAAW,OAAOG,EAAsBF,CAAW;GACrE,IAAID,EAAK,SAAS,WAAW,OAAOI,EAAqBH,CAAW;GACpE,IAAID,EAAK,SAAS,WAAW,OAAOK,EAAwBJ,CAAW;EACzE;EAEA,OADID,EAAK,OAAaM,EAAON,EAAK,IAAI,KAAK,KAAA,IACpCO,EAAWC,CAAO,IAAIL,EAAsBK,CAAO,IAAI,KAAA;CAChE;CAEA,eAAeC,EAAS,GAA0B,GAAoB,GAAgD;EACpH,QAAQC,EAAO,MAAf;GACE,KAAK,WAAW,OAAOX,EAAYS,GAASG,EAAM,IAAI;GACtD,KAAK,WAAW,OAAOR,EAAsBD,EAAM,IAAIQ,EAAO,OAAO,CAAC;GACtE,KAAK,WAAW,OAAON,EAAqBF,EAAM,IAAIQ,EAAO,OAAO,CAAC;GACrE,KAAK,WAAW,OAAOA,EAAO;GAC9B,KAAK,OAAO,OAAOJ,EAAOI,EAAO,IAAI;EACvC;CACF;CAEA,OAAO,EACL,MAAM,KAAM,GAAQ;EAClB,IAAME,IAAU,EAAEd,GACZa,IAAQE,EAAoB,GAC5BC,IAA2BJ,EAAO,SAAS,YAC5CC,EAAM,iBAAiB,gBAAgB,YACxCD,EAAO,UAAU;EAErB,AAAII,MAAW,iBAAeC,EAAgB,EAAI;EAElD,IAAMP,IAAUN,EAAM,IAAIQ,EAAO,SAAS,aAAaA,EAAO,UAAUA,EAAO,UAAU,OAAO,SAAS,IAAI,GACvGM,IAAO,MAAMP,EAAQC,GAAQF,GAASG,CAAK;EACjD,IAAIC,MAAYd,GAIhB;OAAI,CAACkB,KAAQN,EAAO,SAAS,WAC3B,QAAQ,KAAK,2DAA2D;QAI1E;IAEA,IAFAO,EAAS,YAAYT,GAAS,IAAMQ,KAAQ,KAAA,GAAW,IAAM,KAAA,GAAW,KAAA,GAAW,EAAE,UAAO,CAAC,GAEzFF,MAAW,eAAe;KAC5B,IAAM,EAAE,YAASD,EAAoB;KACrC,AAAIb,EAAK,QAAMkB,EAAQ,iBAAiBlB,EAAK,MAAMA,EAAK,OAAO;IACjE;IACA,MAAMkB,EAAQ,eAAeR,EAAO,SAAS,aAAaA,EAAO,iBAAiB,EAAI;GANO;EAF7F;CASF,EACF;AACF"}
1
+ {"version":3,"file":"controller.esm.js","names":["createNavigationController","getPodContext","deps","latest","storageAt","subject","isServerRoot","podContextOf","isStorage","storagePanes","pane","viewerStorages","getFolderPaneForStorage","folderViewFor","context","viaAccountMenu","storage","deriveStorageView","isInViewerPod","paneForView","view","paneSubject","store","getProfilePaneFromURI","byName","getSocialPaneFromURI","isWebIdUri","paneFor","intent","state","request","readNavigationState","source","setNavbarHidden","folderView","outliner","effects"],"sources":["../../src/navigation/controller.ts"],"sourcesContent":["/*\n * The one place that displays a view and brings the page chrome in line with it.\n *\n * The account menu, the navbar, a page load, Enter in the address bar, back and forward and a\n * layout change used to each resolve a pane, call `GotoSubject` and then do some of the follow-up\n * themselves. Now each describes what it wants as an intent, and the follow-up is always the same:\n * navbar visibility and selection, then the profile heading.\n */\n\nimport type { LiveStore, NamedNode } from 'rdflib'\nimport type { PaneDefinition } from 'pane-registry'\nimport type { OutlineManager } from '../outline/manager'\nimport { getFolderPaneForStorage, getProfilePaneFromURI, getSocialPaneFromURI, type PaneItem } from '../utils/paneUtils'\nimport { setNavbarHidden } from './navbarVisibility'\nimport { readNavigationState, type NavigationState, type NavigationView } from './state'\nimport type { FolderView, NavigationSource } from './options'\nimport { isWebIdUri } from '../utils/webIdUtils'\nimport { deriveStorageView } from './chrome'\nimport { getPodContext, isInViewerPod, type PodContext } from './podContext'\n\nexport type NavigationIntent =\n /** Display what the current history entry says was displayed, for the page's own URL. */\n | {\n kind: 'restore'\n /** The page subject, when it is not the current URL. */\n subject?: string\n /** Redo the heading even if it believes it already shows the right profile. */\n forceHeading?: boolean\n }\n /** A person's profile or friends, by WebID. */\n | { kind: 'profile' | 'friends', subject: string, source?: NavigationSource }\n /** A storage, as the navbar or the account menu offers it. */\n | { kind: 'storage', pane: PaneItem, source?: NavigationSource }\n /** A pane of the application itself, by registry name (dashboard, preferences). */\n | { kind: 'app', pane: string, source?: NavigationSource }\n\nexport interface NavigationEffects {\n selectNavbarPane: (paneName: string, paneUri?: string) => void\n refreshHeading: (force: boolean) => Promise<void>\n}\n\nexport interface NavigationDeps {\n store: LiveStore\n outliner: OutlineManager\n byName: (name: string) => PaneDefinition | null | undefined\n effects: NavigationEffects\n /** Whose pod a URL is in; `getPodContext` unless a test supplies its own. */\n podContextOf?: (url: string) => Promise<PodContext>\n}\n\nexport interface NavigationController {\n /**\n * Display what the intent asks for. If another intent arrives while this one is still\n * resolving its pane, only the later one is displayed.\n */\n show: (intent: NavigationIntent) => Promise<void>\n}\n\ntype DisplayedPane = PaneItem | PaneDefinition | null | undefined\n\nexport function createNavigationController (deps: NavigationDeps): NavigationController {\n const { store, outliner, byName, effects, podContextOf = getPodContext } = deps\n let latest = 0\n\n /** The storage pane for a page that is a storage of its pod, or the server root. */\n async function storageAt (subject: NamedNode): Promise<PaneItem | null | undefined> {\n if (!subject.uri.endsWith('/')) return undefined\n const isServerRoot = subject.site().uri === subject.uri\n const { storagePanes, viewerStorages } = await podContextOf(subject.uri)\n const isStorage = storagePanes.some(pane => pane.subject.uri === subject.uri) ||\n viewerStorages.includes(subject.uri)\n return isServerRoot || isStorage ? getFolderPaneForStorage(subject) : undefined\n }\n\n async function folderViewFor (storage: string, viaAccountMenu: boolean): Promise<FolderView> {\n const context = viaAccountMenu ? undefined : await podContextOf(storage)\n return deriveStorageView({\n viaAccountMenu,\n inViewerPod: !!context && isInViewerPod(context, storage),\n hasOwner: !!context?.owner\n })\n }\n\n async function paneForView (subject: NamedNode, view: NavigationView): Promise<DisplayedPane> {\n // These panes render a subject other than the page URL.\n if (view.subject) {\n const paneSubject = store.sym(view.subject)\n if (view.kind === 'profile') return getProfilePaneFromURI(paneSubject, byName)\n if (view.kind === 'friends') return getSocialPaneFromURI(paneSubject, byName)\n if (view.kind === 'storage') return getFolderPaneForStorage(paneSubject)\n }\n if (view.pane) return byName(view.pane) ?? undefined\n // With nothing recorded, the URL decides: a WebID shows its profile, a storage its storage view\n return isWebIdUri(subject) ? getProfilePaneFromURI(subject, byName) : storageAt(subject)\n }\n\n async function paneFor (intent: NavigationIntent, subject: NamedNode, state: NavigationState): Promise<DisplayedPane> {\n switch (intent.kind) {\n case 'restore': return paneForView(subject, state.view)\n case 'profile': return getProfilePaneFromURI(store.sym(intent.subject), byName)\n case 'friends': return getSocialPaneFromURI(store.sym(intent.subject), byName)\n case 'storage': return intent.pane\n case 'app': return byName(intent.pane)\n }\n }\n\n return {\n async show (intent) {\n const request = ++latest\n const state = readNavigationState()\n const source: NavigationSource = intent.kind === 'restore'\n ? (state.viaAccountMenu ? 'accountMenu' : 'default')\n : intent.source ?? 'default'\n // The account menu shows the viewer's own content, so the navbar for the page is not offered\n if (source === 'accountMenu') setNavbarHidden(true)\n\n const subject = store.sym(intent.kind === 'restore' && intent.subject ? intent.subject : window.location.href)\n const pane = await paneFor(intent, subject, state)\n if (request !== latest) return\n\n // Without a pane the outline would fall back to the page URL's own default view, which\n // is only right when restoring an entry that displayed nothing in particular.\n if (!pane && intent.kind !== 'restore') {\n console.warn('Could not open the requested view for the logged-in user.')\n return\n }\n\n const storage = pane && pane.name === 'folder' ? (pane as PaneItem).subject?.uri : undefined\n const folderView = storage ? await folderViewFor(storage, source === 'accountMenu') : undefined\n if (request !== latest) return\n\n outliner.GotoSubject(subject, true, pane ?? undefined, true, undefined, undefined, folderView ? { source, folderView } : { source })\n\n if (source !== 'accountMenu') {\n const { view } = readNavigationState()\n if (view.pane) effects.selectNavbarPane(view.pane, view.subject)\n }\n await effects.refreshHeading(intent.kind === 'restore' && intent.forceHeading === true)\n }\n }\n}\n"],"mappings":";;;;;;;AA4DA,SAAgBA,EAA4B,GAA4C;CACtF,IAAM,EAAE,UAAO,aAAU,WAAQ,YAAS,kBAAeC,MAAkBC,GACvEC,IAAS;CAGb,eAAeC,EAAW,GAA0D;EAClF,IAAI,CAACC,EAAQ,IAAI,SAAS,GAAG,GAAG;EAChC,IAAMC,IAAeD,EAAQ,KAAK,CAAC,CAAC,QAAQA,EAAQ,KAC9C,EAAE,iBAAc,sBAAmB,MAAME,EAAaF,EAAQ,GAAG,GACjEG,IAAYC,EAAa,MAAK,MAAQC,EAAK,QAAQ,QAAQL,EAAQ,GAAG,KAC1EM,EAAe,SAASN,EAAQ,GAAG;EACrC,OAAOC,KAAgBE,IAAYI,EAAwBP,CAAO,IAAI,KAAA;CACxE;CAEA,eAAeQ,EAAe,GAAiB,GAA8C;EAC3F,IAAMC,IAAUC,IAAiB,KAAA,IAAY,MAAMR,EAAaS,CAAO;EACvE,OAAOC,EAAkB;GACvB;GACA,aAAa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jD,IAAIC,MAAY3B,GAAQ;EAIxB,IAAI,CAACO,KAAQkB,EAAO,SAAS,WAAW;GACtC,QAAQ,KAAK,2DAA2D;GACxE;EACF;EAEA,IAAMZ,IAAUN,KAAQA,EAAK,SAAS,WAAYA,EAAkB,SAAS,MAAM,KAAA,GAC7EwB,IAAalB,IAAU,MAAMH,EAAcG,GAASgB,MAAW,aAAa,IAAI,KAAA;EACtF,IAAIF,MAAY3B,GAEhB;GAEA,IAFAgC,EAAS,YAAY9B,GAAS,IAAMK,KAAQ,KAAA,GAAW,IAAM,KAAA,GAAW,KAAA,GAAWwB,IAAa;IAAE;IAAQ;GAAW,IAAI,EAAE,UAAO,CAAC,GAE/HF,MAAW,eAAe;IAC5B,IAAM,EAAE,YAASD,EAAoB;IACrC,AAAIX,EAAK,QAAMgB,EAAQ,iBAAiBhB,EAAK,MAAMA,EAAK,OAAO;GACjE;GACA,MAAMgB,EAAQ,eAAeR,EAAO,SAAS,aAAaA,EAAO,iBAAiB,EAAI;EAN6C;CAOrI,EACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { parseNavigationState as e } from "./state.esm.js";
2
- //#region src/navigation/events.ts
2
+ // src/navigation/events.ts
3
3
  var t = "solid-panes:navigated";
4
4
  function n(n) {
5
5
  let r = {
@@ -12,7 +12,6 @@ function r(e, n = document) {
12
12
  let r = (t) => e(t.detail);
13
13
  return n.addEventListener(t, r), () => n.removeEventListener(t, r);
14
14
  }
15
- //#endregion
16
15
  export { t as NAVIGATED_EVENT, n as announceNavigation, r as onNavigated };
17
16
 
18
17
  //# sourceMappingURL=events.esm.js.map
@@ -2,7 +2,7 @@ import { isOwnWebIdProfile as e } from "../utils/webIdUtils.esm.js";
2
2
  import { isNavbarHidden as t } from "./chrome.esm.js";
3
3
  import { isPageInViewerPod as n } from "./podContext.esm.js";
4
4
  import { sym as r } from "rdflib";
5
- //#region src/navigation/navbarVisibility.ts
5
+ // src/navigation/navbarVisibility.ts
6
6
  var i = "navbar--hidden", a = 0;
7
7
  function o(e) {
8
8
  ++a, document.querySelector("solid-panes-navbar")?.classList.toggle(i, e);
@@ -20,7 +20,6 @@ async function s(i, s = !1) {
20
20
  inViewerPod: u
21
21
  }));
22
22
  }
23
- //#endregion
24
23
  export { s as refreshNavbarVisibility, o as setNavbarHidden };
25
24
 
26
25
  //# sourceMappingURL=navbarVisibility.esm.js.map
@@ -1,2 +1,2 @@
1
- function e(e){return typeof e==`object`&&e?e.source??`default`:e===void 0||e?`default`:`accountMenu`}exports.resolveSource=e;
1
+ function e(e){return typeof e==`object`&&e?e.folderView:void 0}function t(e){return typeof e==`object`&&e?e.source??`default`:e===void 0||e?`default`:`accountMenu`}exports.resolveFolderView=e,exports.resolveSource=t;
2
2
  //# sourceMappingURL=options.cjs.js.map