solid-panes 4.4.2-1 → 4.4.2-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 (386) hide show
  1. package/README.md +10 -10
  2. package/dist/RDFXMLPane.d.ts +2 -3
  3. package/dist/RDFXMLPane2.cjs.js +3 -0
  4. package/dist/RDFXMLPane2.cjs.js.map +1 -0
  5. package/dist/RDFXMLPane2.esm.js +55 -0
  6. package/dist/RDFXMLPane2.esm.js.map +1 -0
  7. package/dist/_virtual/_rolldown/runtime.cjs.js +1 -0
  8. package/dist/_virtual/~icons/lucide/user.cjs.js +2 -0
  9. package/dist/_virtual/~icons/lucide/user.cjs.js.map +1 -0
  10. package/dist/_virtual/~icons/lucide/user.esm.js +11 -0
  11. package/dist/_virtual/~icons/lucide/user.esm.js.map +1 -0
  12. package/dist/audio/audioPane.cjs.js +2 -0
  13. package/dist/audio/audioPane.cjs.js.map +1 -0
  14. package/dist/audio/audioPane.esm.js +96 -0
  15. package/dist/audio/audioPane.esm.js.map +1 -0
  16. package/dist/classInstancePane.cjs.js +2 -0
  17. package/dist/classInstancePane.cjs.js.map +1 -0
  18. package/dist/classInstancePane.esm.js +50 -0
  19. package/dist/classInstancePane.esm.js.map +1 -0
  20. package/dist/components/header/Header.d.ts +8 -0
  21. package/dist/components/header/Header.d.ts.map +1 -0
  22. package/dist/components/header/index.d.ts +4 -0
  23. package/dist/components/header/index.d.ts.map +1 -0
  24. package/dist/dashboard/basicPreferences.cjs.js +2 -0
  25. package/dist/dashboard/basicPreferences.cjs.js.map +1 -0
  26. package/dist/dashboard/basicPreferences.d.ts +1 -1
  27. package/dist/dashboard/basicPreferences.esm.js +70 -0
  28. package/dist/dashboard/basicPreferences.esm.js.map +1 -0
  29. package/dist/dashboard/dashboardPane.d.ts +1 -1
  30. package/dist/dashboard/homepage.d.ts +1 -1
  31. package/dist/dashboard/ontologyData.cjs.js +37 -0
  32. package/dist/dashboard/ontologyData.cjs.js.map +1 -0
  33. package/dist/dashboard/ontologyData.esm.js +6 -0
  34. package/dist/dashboard/ontologyData.esm.js.map +1 -0
  35. package/dist/dashboard/preferencesFormText.cjs.js +20 -0
  36. package/dist/dashboard/preferencesFormText.cjs.js.map +1 -0
  37. package/dist/dashboard/preferencesFormText.esm.js +6 -0
  38. package/dist/dashboard/preferencesFormText.esm.js.map +1 -0
  39. package/dist/dataContentPane.d.ts +2 -3
  40. package/dist/dataContentPane2.cjs.js +2 -0
  41. package/dist/dataContentPane2.cjs.js.map +1 -0
  42. package/dist/dataContentPane2.esm.js +109 -0
  43. package/dist/dataContentPane2.esm.js.map +1 -0
  44. package/dist/defaultPane.d.ts +2 -3
  45. package/dist/defaultPane2.cjs.js +2 -0
  46. package/dist/defaultPane2.cjs.js.map +1 -0
  47. package/dist/defaultPane2.esm.js +41 -0
  48. package/dist/defaultPane2.esm.js.map +1 -0
  49. package/dist/dev.d.ts +10 -0
  50. package/dist/dev.d.ts.map +1 -0
  51. package/dist/dokieli/dokieliPane.cjs.js +2 -0
  52. package/dist/dokieli/dokieliPane.cjs.js.map +1 -0
  53. package/dist/dokieli/dokieliPane.esm.js +39 -0
  54. package/dist/dokieli/dokieliPane.esm.js.map +1 -0
  55. package/dist/dokieli/{new.js → new.cjs.js} +4 -10
  56. package/dist/dokieli/new.cjs.js.map +1 -0
  57. package/dist/dokieli/new.esm.js +6 -0
  58. package/dist/dokieli/new.esm.js.map +1 -0
  59. package/dist/form/pane.cjs.js +4 -0
  60. package/dist/form/pane.cjs.js.map +1 -0
  61. package/dist/form/pane.d.ts +1 -2
  62. package/dist/form/pane.esm.js +121 -0
  63. package/dist/form/pane.esm.js.map +1 -0
  64. package/dist/home/homePane.cjs.js +2 -0
  65. package/dist/home/homePane.cjs.js.map +1 -0
  66. package/dist/home/homePane.d.ts +1 -1
  67. package/dist/home/homePane.esm.js +35 -0
  68. package/dist/home/homePane.esm.js.map +1 -0
  69. package/dist/humanReadablePane.d.ts +2 -3
  70. package/dist/humanReadablePane2.cjs.js +2 -0
  71. package/dist/humanReadablePane2.cjs.js.map +1 -0
  72. package/dist/humanReadablePane2.esm.js +123 -0
  73. package/dist/humanReadablePane2.esm.js.map +1 -0
  74. package/dist/icons/dashboard.cjs.js +2 -0
  75. package/dist/icons/dashboard.cjs.js.map +1 -0
  76. package/dist/icons/dashboard.esm.js +6 -0
  77. package/dist/icons/dashboard.esm.js.map +1 -0
  78. package/dist/icons/folder.cjs.js +2 -0
  79. package/dist/icons/folder.cjs.js.map +1 -0
  80. package/dist/icons/folder.esm.js +6 -0
  81. package/dist/icons/folder.esm.js.map +1 -0
  82. package/dist/icons/friends.cjs.js +2 -0
  83. package/dist/icons/friends.cjs.js.map +1 -0
  84. package/dist/icons/friends.esm.js +6 -0
  85. package/dist/icons/friends.esm.js.map +1 -0
  86. package/dist/icons/iconHelper.cjs.js +2 -0
  87. package/dist/icons/iconHelper.cjs.js.map +1 -0
  88. package/dist/icons/iconHelper.esm.js +17 -0
  89. package/dist/icons/iconHelper.esm.js.map +1 -0
  90. package/dist/icons/{menu.svg → menu.cjs.js} +3 -2
  91. package/dist/icons/menu.cjs.js.map +1 -0
  92. package/dist/icons/menu.esm.js +6 -0
  93. package/dist/icons/menu.esm.js.map +1 -0
  94. package/dist/icons/person.cjs.js +2 -0
  95. package/dist/icons/person.cjs.js.map +1 -0
  96. package/dist/icons/person.esm.js +6 -0
  97. package/dist/icons/person.esm.js.map +1 -0
  98. package/dist/imagePane.d.ts +2 -3
  99. package/dist/imagePane2.cjs.js +2 -0
  100. package/dist/imagePane2.cjs.js.map +1 -0
  101. package/dist/imagePane2.esm.js +32 -0
  102. package/dist/imagePane2.esm.js.map +1 -0
  103. package/dist/index.cjs.js +2 -0
  104. package/dist/index.cjs.js.map +1 -0
  105. package/dist/index.d.ts +4 -4
  106. package/dist/index.esm.js +26 -0
  107. package/dist/index.esm.js.map +1 -0
  108. package/dist/internal/internalPane.d.ts +1 -2
  109. package/dist/internal/internalPane2.cjs.js +2 -0
  110. package/dist/internal/internalPane2.cjs.js.map +1 -0
  111. package/dist/internal/internalPane2.esm.js +104 -0
  112. package/dist/internal/internalPane2.esm.js.map +1 -0
  113. package/dist/mainPage/footer.cjs.js +2 -0
  114. package/dist/mainPage/footer.cjs.js.map +1 -0
  115. package/dist/mainPage/footer.d.ts +1 -3
  116. package/dist/mainPage/footer.esm.js +18 -0
  117. package/dist/mainPage/footer.esm.js.map +1 -0
  118. package/dist/mainPage/header.cjs.js +2 -0
  119. package/dist/mainPage/header.cjs.js.map +1 -0
  120. package/dist/mainPage/header.d.ts +1 -15
  121. package/dist/mainPage/header.d.ts.map +1 -1
  122. package/dist/mainPage/header.esm.js +24 -0
  123. package/dist/mainPage/header.esm.js.map +1 -0
  124. package/dist/mainPage/index.cjs.js +2 -0
  125. package/dist/mainPage/index.cjs.js.map +1 -0
  126. package/dist/mainPage/index.d.ts +3 -7
  127. package/dist/mainPage/index.d.ts.map +1 -1
  128. package/dist/mainPage/index.esm.js +38 -0
  129. package/dist/mainPage/index.esm.js.map +1 -0
  130. package/dist/mainPage/menu.d.ts +1 -2
  131. package/dist/mainPage/menu2.cjs.js +2 -0
  132. package/dist/mainPage/menu2.cjs.js.map +1 -0
  133. package/dist/mainPage/menu2.esm.js +184 -0
  134. package/dist/mainPage/menu2.esm.js.map +1 -0
  135. package/dist/n3Pane.d.ts +2 -3
  136. package/dist/n3Pane2.cjs.js +3 -0
  137. package/dist/n3Pane2.cjs.js.map +1 -0
  138. package/dist/n3Pane2.esm.js +52 -0
  139. package/dist/n3Pane2.esm.js.map +1 -0
  140. package/dist/outline/context.cjs.js +2 -0
  141. package/dist/outline/context.cjs.js.map +1 -0
  142. package/dist/outline/context.d.ts +3 -3
  143. package/dist/outline/context.esm.js +18 -0
  144. package/dist/outline/context.esm.js.map +1 -0
  145. package/dist/outline/manager2.cjs.js +3 -0
  146. package/dist/outline/manager2.cjs.js.map +1 -0
  147. package/dist/outline/manager2.esm.js +875 -0
  148. package/dist/outline/manager2.esm.js.map +1 -0
  149. package/dist/outline/outlineIcons.cjs.js +2 -0
  150. package/dist/outline/outlineIcons.cjs.js.map +1 -0
  151. package/dist/outline/outlineIcons.esm.js +10 -0
  152. package/dist/outline/outlineIcons.esm.js.map +1 -0
  153. package/dist/outline/propertyViews.cjs.js +2 -0
  154. package/dist/outline/propertyViews.cjs.js.map +1 -0
  155. package/dist/outline/propertyViews.esm.js +19 -0
  156. package/dist/outline/propertyViews.esm.js.map +1 -0
  157. package/dist/outline/queryByExample.cjs.js +2 -0
  158. package/dist/outline/queryByExample.cjs.js.map +1 -0
  159. package/dist/outline/queryByExample.esm.js +25 -0
  160. package/dist/outline/queryByExample.esm.js.map +1 -0
  161. package/dist/outline/userInput.cjs.js +61 -0
  162. package/dist/outline/userInput.cjs.js.map +1 -0
  163. package/dist/outline/userInput.esm.js +784 -0
  164. package/dist/outline/userInput.esm.js.map +1 -0
  165. package/dist/outline/viewAsImage.cjs.js +2 -0
  166. package/dist/outline/viewAsImage.cjs.js.map +1 -0
  167. package/dist/outline/viewAsImage.esm.js +10 -0
  168. package/dist/outline/viewAsImage.esm.js.map +1 -0
  169. package/dist/outline/viewAsMbox.cjs.js +2 -0
  170. package/dist/outline/viewAsMbox.cjs.js.map +1 -0
  171. package/dist/outline/viewAsMbox.esm.js +9 -0
  172. package/dist/outline/viewAsMbox.esm.js.map +1 -0
  173. package/dist/pad/padPane.d.ts +1 -2
  174. package/dist/pad/padPane2.cjs.js +2 -0
  175. package/dist/pad/padPane2.cjs.js.map +1 -0
  176. package/dist/pad/padPane2.esm.js +172 -0
  177. package/dist/pad/padPane2.esm.js.map +1 -0
  178. package/dist/playlist/playlistPane.cjs.js +2 -0
  179. package/dist/playlist/playlistPane.cjs.js.map +1 -0
  180. package/dist/playlist/playlistPane.esm.js +49 -0
  181. package/dist/playlist/playlistPane.esm.js.map +1 -0
  182. package/dist/profileUtils/ownerProfile.cjs.js +2 -0
  183. package/dist/profileUtils/ownerProfile.cjs.js.map +1 -0
  184. package/dist/profileUtils/ownerProfile.d.ts +1 -1
  185. package/dist/profileUtils/ownerProfile.esm.js +50 -0
  186. package/dist/profileUtils/ownerProfile.esm.js.map +1 -0
  187. package/dist/registerPanes.cjs.js +2 -0
  188. package/dist/registerPanes.cjs.js.map +1 -0
  189. package/dist/registerPanes.esm.js +45 -0
  190. package/dist/registerPanes.esm.js.map +1 -0
  191. package/dist/schedule/formsForSchedule.cjs.js +117 -0
  192. package/dist/schedule/formsForSchedule.cjs.js.map +1 -0
  193. package/dist/schedule/formsForSchedule.esm.js +6 -0
  194. package/dist/schedule/formsForSchedule.esm.js.map +1 -0
  195. package/dist/schedule/schedulePane.d.ts +2 -4
  196. package/dist/schedule/schedulePane2.cjs.js +8 -0
  197. package/dist/schedule/schedulePane2.cjs.js.map +1 -0
  198. package/dist/schedule/schedulePane2.esm.js +384 -0
  199. package/dist/schedule/schedulePane2.esm.js.map +1 -0
  200. package/dist/sharing/sharingPane.cjs.js +2 -0
  201. package/dist/sharing/sharingPane.cjs.js.map +1 -0
  202. package/dist/sharing/sharingPane.esm.js +22 -0
  203. package/dist/sharing/sharingPane.esm.js.map +1 -0
  204. package/dist/slideshow/slideshowPane.cjs.js +2 -0
  205. package/dist/slideshow/slideshowPane.cjs.js.map +1 -0
  206. package/dist/slideshow/slideshowPane.esm.js +46 -0
  207. package/dist/slideshow/slideshowPane.esm.js.map +1 -0
  208. package/dist/social/editProfileDetails.cjs.js +2 -0
  209. package/dist/social/editProfileDetails.cjs.js.map +1 -0
  210. package/dist/social/editProfileDetails.d.ts +1 -2
  211. package/dist/social/editProfileDetails.esm.js +10 -0
  212. package/dist/social/editProfileDetails.esm.js.map +1 -0
  213. package/dist/social/icons.cjs.js +82 -0
  214. package/dist/social/icons.cjs.js.map +1 -0
  215. package/dist/social/{icons.js → icons.esm.js} +12 -18
  216. package/dist/social/icons.esm.js.map +1 -0
  217. package/dist/social/socialPane.d.ts +2 -3
  218. package/dist/social/socialPane2.cjs.js +6 -0
  219. package/dist/social/socialPane2.cjs.js.map +1 -0
  220. package/dist/social/socialPane2.esm.js +326 -0
  221. package/dist/social/socialPane2.esm.js.map +1 -0
  222. package/dist/social/socialSections.cjs.js +2 -0
  223. package/dist/social/socialSections.cjs.js.map +1 -0
  224. package/dist/social/socialSections.d.ts +2 -2
  225. package/dist/social/socialSections.esm.js +221 -0
  226. package/dist/social/socialSections.esm.js.map +1 -0
  227. package/dist/social/triage.cjs.js +2 -0
  228. package/dist/social/triage.cjs.js.map +1 -0
  229. package/dist/social/triage.d.ts +2 -2
  230. package/dist/social/triage.esm.js +44 -0
  231. package/dist/social/triage.esm.js.map +1 -0
  232. package/dist/tabbed/tabbedPane.cjs.js +2 -0
  233. package/dist/tabbed/tabbedPane.cjs.js.map +1 -0
  234. package/dist/tabbed/tabbedPane.d.ts +1 -1
  235. package/dist/tabbed/tabbedPane.esm.js +38 -0
  236. package/dist/tabbed/tabbedPane.esm.js.map +1 -0
  237. package/dist/tableViewPane.cjs.js +2 -0
  238. package/dist/tableViewPane.cjs.js.map +1 -0
  239. package/dist/tableViewPane.esm.js +20 -0
  240. package/dist/tableViewPane.esm.js.map +1 -0
  241. package/dist/transaction/pane.cjs.js +8 -0
  242. package/dist/transaction/pane.cjs.js.map +1 -0
  243. package/dist/transaction/pane.esm.js +212 -0
  244. package/dist/transaction/pane.esm.js.map +1 -0
  245. package/dist/transaction/period.cjs.js +4 -0
  246. package/dist/transaction/period.cjs.js.map +1 -0
  247. package/dist/transaction/period.esm.js +126 -0
  248. package/dist/transaction/period.esm.js.map +1 -0
  249. package/dist/trip/tripPane.cjs.js +2 -0
  250. package/dist/trip/tripPane.cjs.js.map +1 -0
  251. package/dist/trip/tripPane.esm.js +85 -0
  252. package/dist/trip/tripPane.esm.js.map +1 -0
  253. package/dist/trustedApplications/trustedApplications.dom.cjs.js +2 -0
  254. package/dist/trustedApplications/trustedApplications.dom.cjs.js.map +1 -0
  255. package/dist/trustedApplications/trustedApplications.dom.d.ts +1 -1
  256. package/dist/trustedApplications/trustedApplications.dom.esm.js +108 -0
  257. package/dist/trustedApplications/trustedApplications.dom.esm.js.map +1 -0
  258. package/dist/trustedApplications/trustedApplications.utils.cjs.js +2 -0
  259. package/dist/trustedApplications/trustedApplications.utils.cjs.js.map +1 -0
  260. package/dist/trustedApplications/trustedApplications.utils.d.ts +1 -1
  261. package/dist/trustedApplications/trustedApplications.utils.esm.js +20 -0
  262. package/dist/trustedApplications/trustedApplications.utils.esm.js.map +1 -0
  263. package/dist/trustedApplications/trustedApplications.view.cjs.js +2 -0
  264. package/dist/trustedApplications/trustedApplications.view.cjs.js.map +1 -0
  265. package/dist/trustedApplications/trustedApplications.view.d.ts +1 -1
  266. package/dist/trustedApplications/trustedApplications.view.esm.js +41 -0
  267. package/dist/trustedApplications/trustedApplications.view.esm.js.map +1 -0
  268. package/dist/ui/pane.cjs.js +4 -0
  269. package/dist/ui/pane.cjs.js.map +1 -0
  270. package/dist/ui/pane.esm.js +56 -0
  271. package/dist/ui/pane.esm.js.map +1 -0
  272. package/dist/versionInfo.cjs.js +2 -0
  273. package/dist/versionInfo.cjs.js.map +1 -0
  274. package/dist/versionInfo.esm.js +40 -0
  275. package/dist/versionInfo.esm.js.map +1 -0
  276. package/dist/video/videoPane.cjs.js +2 -0
  277. package/dist/video/videoPane.cjs.js.map +1 -0
  278. package/dist/video/videoPane.esm.js +25 -0
  279. package/dist/video/videoPane.esm.js.map +1 -0
  280. package/package.json +50 -61
  281. package/dist/0314353e28ce6e5539af.svg +0 -9
  282. package/dist/04567ff683933c35c465.png +0 -0
  283. package/dist/10163fd9b5a0e00d63a0.png +0 -0
  284. package/dist/1234dcb2eec2e45f252b.png +0 -0
  285. package/dist/20899934157df4db56cb.png +0 -0
  286. package/dist/33760bf79f097f449da5.png +0 -0
  287. package/dist/4cceba29ab33b1ddd9bb.svg +0 -6
  288. package/dist/578d2b6ed32e7624164e.png +0 -0
  289. package/dist/5f62a5b2b7e99b9640c7.png +0 -0
  290. package/dist/6525766ecd288ec60129.png +0 -0
  291. package/dist/7800be6f6c4b5b0f4f20.png +0 -0
  292. package/dist/7b7538c6f6b317968009.svg +0 -9
  293. package/dist/92d03142abe6efc0b42d.svg +0 -6
  294. package/dist/976473cf5fe24d657d4b.png +0 -0
  295. package/dist/RDFXMLPane.css +0 -70
  296. package/dist/RDFXMLPane.js +0 -100
  297. package/dist/argument/argumentPane.js +0 -60
  298. package/dist/attach/attachPane.js +0 -393
  299. package/dist/audio/audioPane.js +0 -181
  300. package/dist/bda84f59e7216675a208.png +0 -0
  301. package/dist/cd68e8f3990ba8b2139e.png +0 -0
  302. package/dist/classInstancePane.js +0 -91
  303. package/dist/dashboard/basicPreferences.js +0 -147
  304. package/dist/dashboard/dashboardPane.js +0 -73
  305. package/dist/dashboard/homepage.js +0 -42
  306. package/dist/dataContentPane.css +0 -271
  307. package/dist/dataContentPane.js +0 -226
  308. package/dist/defaultPane.css +0 -97
  309. package/dist/defaultPane.js +0 -81
  310. package/dist/dokieli/dokieliPane.js +0 -74
  311. package/dist/e7074a7e2cb69e51cfd3.png +0 -0
  312. package/dist/f3772696fb7ee53c23d8.png +0 -0
  313. package/dist/form/formPane.css +0 -120
  314. package/dist/form/pane.js +0 -250
  315. package/dist/home/homePane.js +0 -74
  316. package/dist/humanReadablePane.css +0 -129
  317. package/dist/humanReadablePane.js +0 -243
  318. package/dist/icons/clock.svg +0 -7
  319. package/dist/icons/comment.svg +0 -6
  320. package/dist/icons/dashboard.svg +0 -9
  321. package/dist/icons/downArrow.svg +0 -6
  322. package/dist/icons/folder.svg +0 -6
  323. package/dist/icons/friends.svg +0 -9
  324. package/dist/icons/help.svg +0 -8
  325. package/dist/icons/iconHelper.js +0 -23
  326. package/dist/icons/person.svg +0 -6
  327. package/dist/icons/personInCircle.svg +0 -8
  328. package/dist/icons/sharing.svg +0 -10
  329. package/dist/icons/signOut.svg +0 -8
  330. package/dist/icons/signUp.svg +0 -9
  331. package/dist/icons/star.svg +0 -3
  332. package/dist/imagePane.css +0 -4
  333. package/dist/imagePane.js +0 -67
  334. package/dist/index.js +0 -123
  335. package/dist/internal/internalPane.css +0 -14
  336. package/dist/internal/internalPane.js +0 -183
  337. package/dist/mainPage/footer.js +0 -29
  338. package/dist/mainPage/header.js +0 -203
  339. package/dist/mainPage/index.js +0 -78
  340. package/dist/mainPage/menu.css +0 -243
  341. package/dist/mainPage/menu.js +0 -449
  342. package/dist/microblogPane/mbStyle.css +0 -267
  343. package/dist/microblogPane/microblogPane.js +0 -1031
  344. package/dist/n3Pane.css +0 -49
  345. package/dist/n3Pane.js +0 -88
  346. package/dist/outline/context.js +0 -21
  347. package/dist/outline/manager.css +0 -78
  348. package/dist/outline/manager.js +0 -2115
  349. package/dist/outline/outlineIcons.js +0 -126
  350. package/dist/outline/propertyViews.js +0 -43
  351. package/dist/outline/queryByExample.js +0 -285
  352. package/dist/outline/userInput.js +0 -1821
  353. package/dist/outline/viewAsImage.js +0 -14
  354. package/dist/outline/viewAsMbox.js +0 -21
  355. package/dist/pad/padPane.css +0 -40
  356. package/dist/pad/padPane.js +0 -421
  357. package/dist/playlist/playlistPane.js +0 -119
  358. package/dist/profileUtils/ownerProfile.js +0 -84
  359. package/dist/registerPanes.js +0 -145
  360. package/dist/schedule/schedulePane.css +0 -294
  361. package/dist/schedule/schedulePane.js +0 -1022
  362. package/dist/sharing/sharingPane.js +0 -48
  363. package/dist/slideshow/slideshowPane.js +0 -79
  364. package/dist/social/editProfileDetails.js +0 -362
  365. package/dist/social/socialPane.css +0 -1464
  366. package/dist/social/socialPane.js +0 -651
  367. package/dist/social/socialSections.js +0 -393
  368. package/dist/social/spinner.js +0 -13
  369. package/dist/social/triage.js +0 -79
  370. package/dist/solid-panes.js +0 -87502
  371. package/dist/solid-panes.js.map +0 -1
  372. package/dist/solid-panes.min.js +0 -3811
  373. package/dist/solid-panes.min.js.map +0 -1
  374. package/dist/styles/tabbedtab.css +0 -1066
  375. package/dist/styles/utilities.css +0 -5
  376. package/dist/tabbed/tabbedPane.js +0 -59
  377. package/dist/tableViewPane.js +0 -56
  378. package/dist/transaction/pane.js +0 -477
  379. package/dist/transaction/period.js +0 -323
  380. package/dist/trip/tripPane.js +0 -174
  381. package/dist/trustedApplications/trustedApplications.dom.js +0 -145
  382. package/dist/trustedApplications/trustedApplications.utils.js +0 -23
  383. package/dist/trustedApplications/trustedApplications.view.js +0 -55
  384. package/dist/ui/pane.js +0 -146
  385. package/dist/versionInfo.js +0 -41
  386. package/dist/video/videoPane.js +0 -42
@@ -1,2115 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = _default;
7
- var paneRegistry = _interopRequireWildcard(require("pane-registry"));
8
- require("./manager.css");
9
- var $rdf = _interopRequireWildcard(require("rdflib"));
10
- var UI = _interopRequireWildcard(require("solid-ui"));
11
- var _solidLogic = require("solid-logic");
12
- var _propertyViews = require("./propertyViews");
13
- var _outlineIcons = require("./outlineIcons.js");
14
- var _userInput = require("./userInput.js");
15
- var queryByExample = _interopRequireWildcard(require("./queryByExample.js"));
16
- var _ownerProfile = require("../profileUtils/ownerProfile");
17
- var _person = _interopRequireDefault(require("../icons/person.svg"));
18
- var _friends = _interopRequireDefault(require("../icons/friends.svg"));
19
- var _folder = _interopRequireDefault(require("../icons/folder.svg"));
20
- var _dashboard = _interopRequireDefault(require("../icons/dashboard.svg"));
21
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
23
- /* istanbul ignore file */
24
- /* -*- coding: utf-8-dos -*-
25
- Outline Mode Manager
26
- */
27
-
28
- // @@ chec
29
-
30
- const PERSON_ICON = _person.default;
31
- const FRIENDS_ICON = _friends.default;
32
- const FOLDER_ICON = _folder.default;
33
- const DASHBOARD_ICON = _dashboard.default;
34
-
35
- /* global alert XPathResult sourceWidget */
36
- // XPathResult?
37
-
38
- // const iconHeight = '24px'
39
-
40
- function _default(context) {
41
- const dom = context.dom;
42
- this.document = context.dom;
43
- this.context = context;
44
- this.outlineIcons = _outlineIcons.outlineIcons;
45
- this.labeller = this.labeller || {};
46
- this.labeller.LanguagePreference = ''; // for now
47
- const outline = this; // Kenny: do we need this?
48
- const thisOutline = this;
49
- let selection = [];
50
- this.selection = selection;
51
- this.ancestor = UI.utils.ancestor; // make available as outline.ancestor in callbacks
52
- this.sparql = $rdf.UpdateManager;
53
- this.kb = _solidLogic.store;
54
- const kb = _solidLogic.store;
55
- const sf = _solidLogic.store.fetcher;
56
- dom.outline = this;
57
- this.qs = new queryByExample.QuerySource(); // Track queries in queryByExample
58
-
59
- // var selection = [] // Array of statements which have been selected
60
- // this.focusTd // the <td> that is being observed
61
- this.UserInput = new _userInput.UserInput(this);
62
- this.clipboardAddress = 'tabulator:clipboard'; // Weird
63
- this.UserInput.clipboardInit(this.clipboardAddress);
64
- const outlineElement = this.outlineElement;
65
- this.init = function () {
66
- const table = getOutlineContainer();
67
- table.outline = this;
68
- };
69
- this.getLayoutMode = function () {
70
- const envLayout = this.context?.environment?.layout;
71
- if (envLayout === 'mobile' || envLayout === 'desktop') return envLayout;
72
- if (typeof window !== 'undefined' && window.matchMedia) {
73
- const viewportWidth = Math.round(Math.min(window.innerWidth, window.visualViewport?.width || window.innerWidth));
74
- const isTouchInput = window.matchMedia('(pointer: coarse)').matches || navigator.maxTouchPoints > 0;
75
- return viewportWidth <= 768 || isTouchInput && viewportWidth <= 1024 ? 'mobile' : 'desktop';
76
- }
77
- return 'desktop';
78
- };
79
-
80
- /** benchmark a function **/
81
- benchmark.lastkbsize = 0;
82
- function benchmark(f) {
83
- const args = [];
84
- for (let i = arguments.length - 1; i > 0; i--) args[i - 1] = arguments[i];
85
- // UI.log.debug('BENCHMARK: args=' + args.join());
86
- const begin = new Date().getTime();
87
- const returnValue = f.apply(f, args);
88
- const end = new Date().getTime();
89
- UI.log.info('BENCHMARK: kb delta: ' + (kb.statements.length - benchmark.lastkbsize) + ', time elapsed for ' + f + ' was ' + (end - begin) + 'ms');
90
- benchmark.lastkbsize = kb.statements.length;
91
- return returnValue;
92
- } // benchmark
93
-
94
- // / ////////////////////// Representing data
95
-
96
- // Represent an object in summary form as a table cell
97
-
98
- function appendRemoveIcon(node, subject, removeNode) {
99
- const image = UI.utils.AJARImage(_outlineIcons.outlineIcons.src.icon_remove_node, 'remove', undefined, dom);
100
- image.addEventListener('click', removeNodeIconMouseDownListener);
101
- // image.setAttribute('align', 'right') Causes icon to be moved down
102
- image.node = removeNode;
103
- image.setAttribute('about', subject.toNT());
104
- image.style.marginLeft = '5px';
105
- image.style.marginRight = '10px';
106
- // image.style.border='solid #777 1px';
107
- node.appendChild(image);
108
- return image;
109
- }
110
- this.appendAccessIcons = function (kb, node, obj) {
111
- if (obj.termType !== 'NamedNode') return;
112
- const uris = kb.uris(obj);
113
- uris.sort();
114
- let last = null;
115
- for (let i = 0; i < uris.length; i++) {
116
- if (uris[i] === last) continue;
117
- last = uris[i];
118
- thisOutline.appendAccessIcon(node, last);
119
- }
120
- };
121
- this.appendAccessIcon = function (node, uri) {
122
- if (!uri) return '';
123
- const docuri = $rdf.uri.docpart(uri);
124
- if (docuri.slice(0, 5) !== 'http:') return '';
125
- const state = sf.getState(docuri);
126
- let icon, alt, listener;
127
- switch (state) {
128
- case 'unrequested':
129
- icon = _outlineIcons.outlineIcons.src.icon_unrequested;
130
- alt = 'fetch';
131
- listener = unrequestedIconMouseDownListener;
132
- break;
133
- case 'requested':
134
- icon = _outlineIcons.outlineIcons.src.icon_requested;
135
- alt = 'fetching';
136
- listener = failedIconMouseDownListener; // new: can retry yello blob
137
- break;
138
- case 'fetched':
139
- icon = _outlineIcons.outlineIcons.src.icon_fetched;
140
- listener = fetchedIconMouseDownListener;
141
- alt = 'loaded';
142
- break;
143
- case 'failed':
144
- icon = _outlineIcons.outlineIcons.src.icon_failed;
145
- alt = 'failed';
146
- listener = failedIconMouseDownListener;
147
- break;
148
- case 'unpermitted':
149
- icon = _outlineIcons.outlineIcons.src.icon_failed;
150
- listener = failedIconMouseDownListener;
151
- alt = 'no perm';
152
- break;
153
- case 'unfetchable':
154
- icon = _outlineIcons.outlineIcons.src.icon_failed;
155
- listener = failedIconMouseDownListener;
156
- alt = 'cannot fetch';
157
- break;
158
- default:
159
- UI.log.error('?? state = ' + state);
160
- break;
161
- } // switch
162
- const img = UI.utils.AJARImage(icon, alt, _outlineIcons.outlineIcons.tooltips[icon].replace(/[Tt]his resource/, docuri), dom);
163
- img.setAttribute('uri', uri);
164
- img.addEventListener('click', listener); // @@ seemed to be missing 2017-08
165
- addButtonCallbacks(img, docuri);
166
- node.appendChild(img);
167
- return img;
168
- }; // appendAccessIcon
169
-
170
- /** make the td for an object (grammatical object)
171
- * @param obj - an RDF term
172
- * @param view - a VIEW function (rather than a bool asImage)
173
- **/
174
-
175
- this.outlineObjectTD = function outlineObjectTD(obj, view, deleteNode, statement) {
176
- const td = dom.createElement('td');
177
- td.classList.add('obj');
178
- td.setAttribute('notSelectable', 'false');
179
- td.style.margin = '0.2em';
180
- if (!obj) {
181
- td.textContent = 'No object available.';
182
- return td;
183
- }
184
- td.style.border = 'none';
185
- td.style.padding = '0';
186
- td.style.verticalAlign = 'top';
187
- const theClass = 'obj';
188
-
189
- // set about and put 'expand' icon
190
- if (obj.termType === 'NamedNode' || obj.termType === 'BlankNode' || obj.termType === 'Literal' && obj.value.slice && (obj.value.slice(0, 6) === 'ftp://' || obj.value.slice(0, 8) === 'https://' || obj.value.slice(0, 7) === 'http://')) {
191
- td.setAttribute('about', obj.toNT());
192
- td.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-expand-trans.png', 'expand', undefined, dom)).addEventListener('click', expandMouseDownListener);
193
- }
194
- td.setAttribute('class', theClass); // this is how you find an object
195
- if (kb.whether(obj, UI.ns.rdf('type'), UI.ns.link('Request'))) {
196
- td.className = 'undetermined';
197
- } // @@? why-timbl
198
-
199
- if (!view) {
200
- // view should be a function pointer
201
- view = viewAsBoringDefault;
202
- }
203
- td.appendChild(view(obj));
204
- if (deleteNode) {
205
- appendRemoveIcon(td, obj, deleteNode);
206
- }
207
-
208
- // set DOM methods
209
- td.tabulatorSelect = function () {
210
- setSelected(this, true);
211
- };
212
- td.tabulatorDeselect = function () {
213
- setSelected(this, false);
214
- };
215
- td.addEventListener('click', selectableTDClickListener);
216
- return td;
217
- }; // outlineObjectTD
218
-
219
- this.outlinePredicateTD = function outlinePredicateTD(predicate, newTr, inverse, internal) {
220
- const predicateTD = dom.createElement('TD');
221
- predicateTD.setAttribute('about', predicate.toNT());
222
- predicateTD.setAttribute('class', internal ? 'pred internal' : 'pred');
223
- let lab;
224
- switch (predicate.termType) {
225
- case 'BlankNode':
226
- // TBD
227
- predicateTD.className = 'undetermined';
228
- break;
229
- case 'NamedNode':
230
- lab = UI.utils.predicateLabelForXML(predicate, inverse);
231
- break;
232
- case 'Collection':
233
- // some choices of predicate
234
- lab = UI.utils.predicateLabelForXML(predicate.elements[0], inverse);
235
- }
236
- lab = lab ? lab.slice(0, 1).toUpperCase() + lab.slice(1) : '...';
237
- // if (kb.statementsMatching(predicate,rdf('type'), UI.ns.link('Request')).length) predicateTD.className='undetermined';
238
-
239
- const labelTD = dom.createElement('TD');
240
- labelTD.classList.add('labelTD');
241
- labelTD.setAttribute('notSelectable', 'true');
242
- labelTD.appendChild(dom.createTextNode(lab));
243
- predicateTD.appendChild(labelTD);
244
- labelTD.style.width = '100%';
245
- predicateTD.appendChild(termWidget.construct(dom)); // termWidget is global???
246
- for (const w in _outlineIcons.outlineIcons.termWidgets) {
247
- if (!newTr || !newTr.AJAR_statement) break; // case for TBD as predicate
248
- // alert(Icon.termWidgets[w]+' '+Icon.termWidgets[w].filter)
249
- if (_outlineIcons.outlineIcons.termWidgets[w].filter && _outlineIcons.outlineIcons.termWidgets[w].filter(newTr.AJAR_statement, 'pred', inverse)) {
250
- termWidget.addIcon(predicateTD, _outlineIcons.outlineIcons.termWidgets[w]);
251
- }
252
- }
253
-
254
- // set DOM methods
255
- predicateTD.tabulatorSelect = function () {
256
- setSelected(this, true);
257
- };
258
- predicateTD.tabulatorDeselect = function () {
259
- setSelected(this, false);
260
- };
261
- predicateTD.addEventListener('click', selectableTDClickListener);
262
- return predicateTD;
263
- }; // outlinePredicateTD
264
-
265
- /**
266
- * Render Tabbed set of home app panes
267
- *
268
- * @param {Object} [options] A set of options you can provide
269
- * @param {string} [options.selectedTab] To open a specific dashboard pane
270
- * @param {Function} [options.onClose] If given, will present an X for the dashboard, and call this method when clicked
271
- * @returns Promise<{Element}> - the div that holds the dashboard
272
- */
273
- async function globalAppTabs(options = {}) {
274
- console.log('globalAppTabs @@');
275
- const div = dom.createElement('div');
276
- const me = _solidLogic.authn.currentUser();
277
- if (!me) {
278
- alert('Must be logged in for this');
279
- throw new Error('Not logged in');
280
- }
281
- const items = await getDashboardItems();
282
- const selectedItem = options.selectedTab ? items.find(item => item.paneName === options.selectedTab || item.tabName === options.selectedTab) : items[0];
283
- if (!selectedItem) {
284
- return div;
285
- }
286
- div.dataset.globalPaneName = selectedItem.tabName || selectedItem.paneName;
287
- const content = div.appendChild(dom.createElement('div'));
288
- const pane = paneRegistry.byName(selectedItem.paneName); // 20190701
289
- const table = content.appendChild(dom.createElement('table'));
290
- thisOutline.GotoSubject(selectedItem.subject || me, true, pane, false, undefined, table);
291
- return div;
292
- }
293
- this.getDashboard = globalAppTabs;
294
- async function getDashboardItems() {
295
- const me = _solidLogic.authn.currentUser();
296
- if (!me) return [];
297
- const div = dom.createElement('div');
298
- const panes = [{
299
- paneName: 'profile',
300
- subject: me,
301
- label: 'Your profile',
302
- icon: PERSON_ICON
303
- }, {
304
- paneName: 'social',
305
- // loads socialPane
306
- subject: me,
307
- label: 'Your friends',
308
- icon: FRIENDS_ICON
309
- }];
310
- const [pods] = await Promise.all([getPods()]);
311
- panes.push(...pods);
312
- panes.push(
313
- /* not in use since redesign of profile-pane
314
- {
315
- paneName: 'editProfile',
316
- label: 'Edit your Profile',
317
- icon: UI.icons.iconBase + 'noun_492246.svg'
318
- },
319
- */
320
- {
321
- paneName: 'home',
322
- label: 'Your dashboard',
323
- icon: DASHBOARD_ICON
324
- }, {
325
- paneName: 'basicPreferences',
326
- label: 'Your preferences',
327
- icon: UI.icons.iconBase + 'noun_Sliders_341315_000000.svg'
328
- });
329
- return panes;
330
- async function getPods() {
331
- async function addPodStorage(pod) {
332
- // namedNode
333
- await loadContainerRepresentation(pod);
334
- if (kb.holds(pod, ns.rdf('type'), ns.space('Storage'), pod.doc())) {
335
- pods.push(pod);
336
- return true;
337
- }
338
- return false;
339
- }
340
- async function addPodStorageFromUrl(url) {
341
- const podStorage = new URL(url);
342
- // check for predicate pim:Storage in containers up the path tree
343
- let pathStorage = podStorage.pathname;
344
- while (pathStorage.length) {
345
- pathStorage = pathStorage.substring(0, pathStorage.lastIndexOf('/'));
346
- if (await addPodStorage(kb.sym(`${podStorage.origin}${pathStorage}/`))) return;
347
- }
348
- // TODO should url.origin be added to pods list when there are no pim:Storage ???
349
- }
350
- try {
351
- // need to make sure that profile is loaded
352
- await kb.fetcher.load(me.doc());
353
- } catch (err) {
354
- console.error('Unable to load profile', err);
355
- return [];
356
- }
357
- // load pod's storages from profile
358
- let pods = kb.each(me, ns.space('storage'), null, me.doc());
359
- await Promise.all(pods.map(async pod => {
360
- // TODO use addPodStorageFromUrl(pod.uri) to check for pim:Storage ???
361
- await loadContainerRepresentation(pod);
362
- }));
363
- try {
364
- // if uri then SolidOS is a browse.html web app
365
- const uri = new URL(window.location.href).searchParams.get('uri');
366
- const podUrl = uri || window.location.href;
367
- await addPodStorageFromUrl(podUrl);
368
- } catch (err) {
369
- console.error('cannot load container', err);
370
- }
371
- // remove namedNodes duplicates
372
- function uniques(nodes) {
373
- const uniqueNodes = [];
374
- nodes.forEach(node => {
375
- if (!uniqueNodes.find(uniqueNode => uniqueNode.equals(node))) uniqueNodes.push(node);
376
- });
377
- return uniqueNodes;
378
- }
379
- pods = uniques(pods);
380
- if (!pods.length) return [];
381
- return Promise.all(pods.map(async (pod, index) => {
382
- function split(item) {
383
- return item.uri.split('//')[1].slice(0, -1);
384
- }
385
- const ownerName = (await (0, _ownerProfile.getNameOfPodOwner)(pod, kb, sf)) || '';
386
- const label = split(me).startsWith(split(pod)) ? 'Your storage' : ownerName.trim() !== '' ? ownerName + '\'s storage' : split(pod);
387
- return {
388
- paneName: 'folder',
389
- tabName: `folder-${index}`,
390
- label,
391
- subject: pod,
392
- icon: FOLDER_ICON
393
- };
394
- }));
395
- }
396
- async function getAddressBooks() {
397
- try {
398
- const context = await UI.login.findAppInstances({
399
- me,
400
- div,
401
- dom
402
- }, ns.vcard('AddressBook'));
403
- return (context.instances || []).map((book, index) => ({
404
- paneName: 'contact',
405
- tabName: `contact-${index}`,
406
- label: 'Contacts',
407
- subject: book,
408
- icon: UI.icons.iconBase + 'noun_15695.svg'
409
- }));
410
- } catch (err) {
411
- console.error('oops in globalAppTabs AddressBook');
412
- }
413
- return [];
414
- }
415
- }
416
- this.getDashboardItems = getDashboardItems;
417
-
418
- /**
419
- * Call this method to show the global dashboard.
420
- *
421
- * @param {Object} [options] A set of options that can be passed
422
- * @param {string} [options.pane] To open a specific dashboard pane
423
- * @returns {Promise<void>}
424
- */
425
- function closeDashboard() {
426
- const dashboardContainer = getDashboardContainer();
427
- const outlineContainer = getOutlineContainer();
428
- dashboardContainer.innerHTML = '';
429
- hideGlobalContainer(dashboardContainer);
430
- showGlobalContainer(outlineContainer);
431
- }
432
-
433
- // Register the closeDashboard listener only once
434
- _solidLogic.authSession.events.on('logout', closeDashboard);
435
- function showGlobalContainer(container) {
436
- container.removeAttribute('hidden');
437
- container.style.display = '';
438
- }
439
- function hideGlobalContainer(container) {
440
- container.setAttribute('hidden', '');
441
- container.style.display = 'none';
442
- }
443
- async function showDashboard(subject, options = {}) {
444
- const dashboardContainer = getDashboardContainer();
445
- const outlineContainer = getOutlineContainer();
446
-
447
- // reuse existing dashboard if already rendered for the same pane and subject
448
- if (dashboardContainer.childNodes.length > 0) {
449
- const existingDashboard = dashboardContainer.firstElementChild;
450
- if (existingDashboard && options.pane && existingDashboard.dataset.globalPaneName === options.pane && existingDashboard.dataset.subject === (subject && subject.value || '')) {
451
- hideGlobalContainer(outlineContainer);
452
- showGlobalContainer(dashboardContainer);
453
- return;
454
- }
455
- dashboardContainer.innerHTML = '';
456
- }
457
-
458
- // create a new dashboard if not already present
459
- const dashboard = await globalAppTabs({
460
- selectedTab: options.pane
461
- // onClose: closeDashboard
462
- });
463
-
464
- // finally - switch to showing dashboard
465
- hideGlobalContainer(outlineContainer);
466
- showGlobalContainer(dashboardContainer);
467
- dashboardContainer.appendChild(dashboard);
468
- }
469
- this.showDashboard = showDashboard;
470
- function getDashboardContainer() {
471
- return getOrCreateContainer('GlobalDashboard', 'Dashboard');
472
- }
473
- function getOutlineContainer() {
474
- return getOrCreateContainer('OutlineView', 'Resource browser');
475
- }
476
-
477
- /**
478
- * Get element with id or create a new on the fly with that id
479
- *
480
- * @param {string} id The ID of the element you want to get or create
481
- * @param {string} [ariaLabel] Optional aria-label for accessibility
482
- * @returns {HTMLElement}
483
- */
484
- function getOrCreateContainer(id) {
485
- const containerHost = document.getElementById('app-view') || document.getElementById('MainContent') || document.querySelector('[role="main"]') || document.body;
486
-
487
- // OutlineView is a table
488
- if (id === 'OutlineView') {
489
- const existingOutline = document.getElementById('OutlineView');
490
- if (existingOutline) {
491
- return existingOutline;
492
- }
493
- if (containerHost) {
494
- const OutlineView = document.createElement('table');
495
- OutlineView.id = 'OutlineView';
496
- OutlineView.classList.add('outline-view');
497
- OutlineView.setAttribute('aria-label', 'Resource browser');
498
- containerHost.appendChild(OutlineView);
499
- return OutlineView;
500
- }
501
- }
502
-
503
- // or we deal with the section GlobalDashboard
504
- return document.getElementById(id) || (() => {
505
- const GlobalDashboard = document.createElement('section');
506
- GlobalDashboard.id = id;
507
- GlobalDashboard.setAttribute('aria-label', 'Dashboard');
508
- GlobalDashboard.classList.add('global-dashboard');
509
- return containerHost.appendChild(GlobalDashboard);
510
- })();
511
- }
512
- async function loadContainerRepresentation(subject) {
513
- // force reload for index.html with RDFa
514
- if (!kb.any(subject, ns.ldp('contains'), undefined, subject.doc())) {
515
- const response = await kb.fetcher.webOperation('GET', subject.uri, kb.fetcher.initFetchOptions(subject.uri, {
516
- headers: {
517
- accept: 'text/turtle'
518
- }
519
- }));
520
- const containerTurtle = response.responseText;
521
- $rdf.parse(containerTurtle, kb, subject.uri, 'text/turtle');
522
- }
523
- }
524
- async function getRelevantPanes(subject, context) {
525
- // make sure container representation is loaded (when server returns index.html)
526
- if (subject.uri.endsWith('/')) {
527
- await loadContainerRepresentation(subject);
528
- }
529
- const panes = context.session.paneRegistry;
530
- const relevantPanes = panes.list.filter(pane => pane.label(subject, context) && !pane.global);
531
- if (relevantPanes.length === 0) {
532
- // there are no relevant panes, simply return default pane (which ironically is internalPane)
533
- return [panes.byName('internal')];
534
- }
535
- const filteredPanes = await UI.login.filterAvailablePanes(relevantPanes);
536
- if (filteredPanes.length === 0) {
537
- // if no relevant panes are available panes because of user role, we still allow for the most relevant pane to be viewed
538
- return [relevantPanes[0]];
539
- }
540
- const firstRelevantPaneIndex = panes.list.indexOf(relevantPanes[0]);
541
- const firstFilteredPaneIndex = panes.list.indexOf(filteredPanes[0]);
542
- // if the first relevant pane is loaded before the panes available wrt role, we still want to offer the most relevant pane
543
- return firstRelevantPaneIndex < firstFilteredPaneIndex ? [relevantPanes[0]].concat(filteredPanes) : filteredPanes;
544
- }
545
- function getPane(relevantPanes, subject) {
546
- return relevantPanes.find(pane => pane.shouldGetFocus && pane.shouldGetFocus(subject)) || relevantPanes[0];
547
- }
548
- async function expandedHeaderTR(subject, requiredPane, options) {
549
- async function renderPaneIconTray(td, options = {}) {
550
- const paneShownStyle = 'width: 24px; border-radius: 0.5em; border-top: solid #222 1px; border-left: solid #222 0.1em; border-bottom: solid #eee 0.1em; border-right: solid #eee 0.1em; margin-left: 1em; padding: 3px; background-color: #ffd;';
551
- const paneHiddenStyle = 'width: 24px; border-radius: 0.5em; margin-left: 1em; padding: 3px';
552
- const paneIconTray = td.appendChild(dom.createElement('nav'));
553
- paneIconTray.style = 'display:flex; justify-content: flex-start; align-items: center;';
554
- const relevantPanes = options.hideList ? [] : await getRelevantPanes(subject, context);
555
- tr.firstPane = requiredPane || getPane(relevantPanes, subject);
556
- const paneNumber = relevantPanes.indexOf(tr.firstPane);
557
- if (relevantPanes.length !== 1) {
558
- // if only one, simplify interface
559
- relevantPanes.forEach((pane, index) => {
560
- const label = pane.label(subject, context);
561
- let iconSrc = '';
562
- if (pane.name === 'profile') {
563
- iconSrc = PERSON_ICON;
564
- } else if (pane.name === 'social') {
565
- iconSrc = FRIENDS_ICON;
566
- } else {
567
- iconSrc = typeof pane.icon === 'function' ? pane.icon(subject, context) : pane.icon;
568
- }
569
- const ico = UI.utils.AJARImage(iconSrc, label, label, dom);
570
-
571
- // Handle async icon functions
572
- if (iconSrc instanceof Promise) {
573
- iconSrc.then(resolvedIconSrc => {
574
- ico.setAttribute('src', resolvedIconSrc);
575
- }).catch(err => {
576
- console.error('Error resolving async icon:', err);
577
- });
578
- }
579
- ico.style = pane === tr.firstPane ? paneShownStyle : paneHiddenStyle; // init to something at least
580
- // ico.setAttribute('align','right'); @@ Should be better, but ffox bug pushes them down
581
- // ico.style.width = iconHeight
582
- // ico.style.height = iconHeight
583
- const listen = function (ico, pane) {
584
- // Freeze scope for event time
585
- ico.addEventListener('click', function (event) {
586
- let containingTable;
587
- // Find the containing table for this subject
588
- for (containingTable = td; containingTable.parentNode; containingTable = containingTable.parentNode) {
589
- if (containingTable.nodeName === 'TABLE') break;
590
- }
591
- if (containingTable.nodeName !== 'TABLE') {
592
- throw new Error('outline: internal error.');
593
- }
594
- const removePanes = function (specific) {
595
- for (let d = containingTable.firstChild; d; d = d.nextSibling) {
596
- if (typeof d.pane !== 'undefined') {
597
- if (!specific || d.pane === specific) {
598
- if (d.paneButton) {
599
- d.paneButton.setAttribute('class', 'paneHidden');
600
- d.paneButton.style = paneHiddenStyle;
601
- }
602
- removeAndRefresh(d);
603
- // If we just delete the node d, ffox doesn't refresh the display properly.
604
- // state = 'paneHidden';
605
- if (d.pane.requireQueryButton && containingTable.parentNode.className /* outer table */ && numberOfPanesRequiringQueryButton === 1 && dom.getElementById('queryButton')) {
606
- dom.getElementById('queryButton').setAttribute('style', 'display:none;');
607
- }
608
- }
609
- }
610
- }
611
- };
612
- const renderPane = function (pane) {
613
- let paneDiv;
614
- UI.log.info('outline: Rendering pane (2): ' + pane.name);
615
- try {
616
- paneDiv = pane.render(subject, context, options);
617
- } catch (e) {
618
- // Easier debugging for pane developers
619
- paneDiv = dom.createElement('div');
620
- paneDiv.setAttribute('class', 'exceptionPane');
621
- const pre = dom.createElement('pre');
622
- paneDiv.appendChild(pre);
623
- pre.appendChild(dom.createTextNode(UI.utils.stackString(e)));
624
- }
625
- if (pane.requireQueryButton && dom.getElementById('queryButton')) {
626
- dom.getElementById('queryButton').removeAttribute('style');
627
- }
628
- const second = containingTable.firstChild.nextSibling;
629
- const row = dom.createElement('tr');
630
- const cell = row.appendChild(dom.createElement('td'));
631
- cell.setAttribute('colspan', '2');
632
- cell.style.textAlign = 'left';
633
- cell.style.width = '100%';
634
- cell.appendChild(paneDiv);
635
- if (second) containingTable.insertBefore(row, second);else containingTable.appendChild(row);
636
- row.pane = pane;
637
- row.paneButton = ico;
638
- };
639
- const state = ico.getAttribute('class');
640
- if (state === 'paneHidden') {
641
- if (!event.shiftKey) {
642
- // shift means multiple select
643
- removePanes();
644
- }
645
- renderPane(pane);
646
- ico.setAttribute('class', 'paneShown');
647
- ico.style = paneShownStyle;
648
- } else {
649
- removePanes(pane);
650
- ico.setAttribute('class', 'paneHidden');
651
- ico.style = paneHiddenStyle;
652
- }
653
- let numberOfPanesRequiringQueryButton = 0;
654
- for (let d = containingTable.firstChild; d; d = d.nextSibling) {
655
- if (d.pane && d.pane.requireQueryButton) {
656
- numberOfPanesRequiringQueryButton++;
657
- }
658
- }
659
- }, false);
660
- }; // listen
661
-
662
- listen(ico, pane);
663
- ico.setAttribute('class', index !== paneNumber ? 'paneHidden' : 'paneShown');
664
- if (index === paneNumber) tr.paneButton = ico;
665
- paneIconTray.appendChild(ico);
666
- });
667
- }
668
- return paneIconTray;
669
- } // renderPaneIconTray
670
-
671
- // Body of expandedHeaderTR
672
- const tr = dom.createElement('tr');
673
- if (options.hover) {
674
- // By default no hide till hover as community deems it confusing
675
- tr.setAttribute('class', 'hoverControl');
676
- }
677
- const td = tr.appendChild(dom.createElement('td'));
678
- td.setAttribute('style', 'margin: 0.2em; border: none; padding-top: 0; padding-bottom: 0; vertical-align: top;' + 'display:flex; justify-content: space-between; flex-direction: row;' + 'background-color: var(--color-background, #F8F9FB);');
679
- td.setAttribute('notSelectable', 'true');
680
- td.setAttribute('about', subject.toNT());
681
- td.setAttribute('colspan', '2');
682
-
683
- // Stuff at the right about the subject
684
- const header = td.appendChild(dom.createElement('div'));
685
- header.style = 'display:flex; justify-content: flex-start; align-items: center; flex-wrap: wrap;';
686
- const showHeader = !!requiredPane;
687
- if (!options.solo && !showHeader) {
688
- const icon = header.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-collapse.png', 'collapse', undefined, dom));
689
- icon.addEventListener('click', collapseMouseDownListener);
690
- const strong = header.appendChild(dom.createElement('h1'));
691
- strong.appendChild(dom.createTextNode(UI.utils.label(subject)));
692
- strong.style = 'font-size: 150%; margin: 0 0.6em 0 0; padding: 0.1em 0.4em;' + 'background-color: var(--color-background, #F8F9FB);';
693
- UI.widgets.makeDraggable(strong, subject);
694
- }
695
- header.appendChild(await renderPaneIconTray(td, {
696
- hideList: showHeader
697
- }));
698
-
699
- // set DOM methods
700
- tr.firstChild.tabulatorSelect = function () {
701
- setSelected(this, true);
702
- };
703
- tr.firstChild.tabulatorDeselect = function () {
704
- setSelected(this, false);
705
- };
706
- return tr;
707
- } // expandedHeaderTR
708
-
709
- // / //////////////////////////////////////////////////////////////////////////
710
-
711
- /* PANES
712
- **
713
- ** Panes are regions of the outline view in which a particular subject is
714
- ** displayed in a particular way. They are like views but views are for query results.
715
- ** subject panes are currently stacked vertically.
716
- */
717
-
718
- // / //////////////////// Specific panes are in panes/*.js
719
- //
720
- // The defaultPane is the first one registered for which the label method exists
721
- // Those registered first take priority as a default pane.
722
- // That is, those earlier in this file
723
-
724
- /**
725
- * Pane registration
726
- */
727
-
728
- // the second argument indicates whether the query button is required
729
-
730
- // / ///////////////////////////////////////////////////////////////////////////
731
-
732
- // Remove a node from the DOM so that Firefox refreshes the screen OK
733
- // Just deleting it cause whitespace to accumulate.
734
- function removeAndRefresh(d) {
735
- const table = d.parentNode;
736
- const par = table.parentNode;
737
- const placeholder = dom.createElement('table');
738
- placeholder.classList.add('placeholderTable');
739
- par.replaceChild(placeholder, table);
740
- table.removeChild(d);
741
- par.replaceChild(table, placeholder); // Attempt to
742
- }
743
- const propertyTable = this.propertyTable = function propertyTable(subject, table, pane, options) {
744
- UI.log.debug('Property table for: ' + subject);
745
- subject = kb.canon(subject);
746
- // if (!pane) pane = panes.defaultPane;
747
-
748
- if (!table) {
749
- // Create a new property table
750
- table = dom.createElement('table');
751
- table.classList.add('tableFullWidth');
752
- expandedHeaderTR(subject, pane, options).then(tr1 => {
753
- table.appendChild(tr1);
754
- if (tr1.firstPane) {
755
- let paneDiv;
756
- try {
757
- UI.log.info('outline: Rendering pane (1): ' + tr1.firstPane.name);
758
- paneDiv = tr1.firstPane.render(subject, context, options);
759
- } catch (e) {
760
- // Easier debugging for pane developers
761
- paneDiv = dom.createElement('div');
762
- paneDiv.setAttribute('class', 'exceptionPane');
763
- const pre = dom.createElement('pre');
764
- paneDiv.appendChild(pre);
765
- pre.appendChild(dom.createTextNode(UI.utils.stackString(e)));
766
- }
767
- const row = dom.createElement('tr');
768
- const cell = row.appendChild(dom.createElement('td'));
769
- cell.setAttribute('colspan', '2');
770
- cell.style.textAlign = 'left';
771
- cell.style.width = '100%';
772
- cell.style.backgroundColor = 'var(--color-background, #F8F9FB)';
773
- cell.appendChild(paneDiv);
774
- if (tr1.firstPane.requireQueryButton && dom.getElementById('queryButton')) {
775
- dom.getElementById('queryButton').removeAttribute('style');
776
- }
777
- table.appendChild(row);
778
- row.pane = tr1.firstPane;
779
- row.paneButton = tr1.paneButton;
780
- }
781
- });
782
- return table;
783
- } else {
784
- // New display of existing table, keeping expanded bits
785
- UI.log.info('Re-expand: ' + table);
786
- // do some other stuff here
787
- return table;
788
- }
789
- }; /* propertyTable */
790
-
791
- function propertyTR(doc, st, inverse) {
792
- const tr = doc.createElement('TR');
793
- tr.AJAR_statement = st;
794
- tr.AJAR_inverse = inverse;
795
- // tr.AJAR_variable = null; // @@ ?? was just 'tr.AJAR_variable'
796
- tr.setAttribute('predTR', 'true');
797
- const predicateTD = thisOutline.outlinePredicateTD(st.predicate, tr, inverse);
798
- tr.appendChild(predicateTD); // @@ add 'internal' to predicateTD's class for style? mno
799
- return tr;
800
- }
801
- this.propertyTR = propertyTR;
802
-
803
- // / ////////// Property list
804
- function appendPropertyTRs(parent, plist, inverse, predicateFilter) {
805
- // UI.log.info('@appendPropertyTRs, 'this' is %s, dom is %s, '+ // Gives 'can't access dead object'
806
- // 'thisOutline.document is %s', this, dom.location, thisOutline.document.location);
807
- // UI.log.info('@appendPropertyTRs, dom is now ' + this.document.location);
808
- // UI.log.info('@appendPropertyTRs, dom is now ' + thisOutline.document.location);
809
- UI.log.debug('Property list length = ' + plist.length);
810
- if (plist.length === 0) return '';
811
- let sel, j, k;
812
- if (inverse) {
813
- sel = function (x) {
814
- return x.subject;
815
- };
816
- plist = plist.sort(UI.utils.RDFComparePredicateSubject);
817
- } else {
818
- sel = function (x) {
819
- return x.object;
820
- };
821
- plist = plist.sort(UI.utils.RDFComparePredicateObject);
822
- }
823
- const max = plist.length;
824
- for (j = 0; j < max; j++) {
825
- // squishing together equivalent properties I think
826
- let s = plist[j];
827
- // if (s.object == parentSubject) continue; // that we knew
828
-
829
- // Avoid predicates from other panes
830
- if (predicateFilter && !predicateFilter(s.predicate, inverse)) continue;
831
- const tr = propertyTR(dom, s, inverse);
832
- parent.appendChild(tr);
833
- const predicateTD = tr.firstChild; // we need to kludge the rowspan later
834
-
835
- let defaultpropview = views.defaults[s.predicate.uri];
836
-
837
- // LANGUAGE PREFERENCES WAS AVAILABLE WITH FF EXTENSION - get from elsewhere?
838
-
839
- let dups = 0; // How many rows have the same predicate, -1?
840
- let langTagged = 0; // how many objects have language tags?
841
- let myLang = 0; // Is there one I like?
842
-
843
- for (k = 0; k + j < max && plist[j + k].predicate.sameTerm(s.predicate); k++) {
844
- if (k > 0 && sel(plist[j + k]).sameTerm(sel(plist[j + k - 1]))) dups++;
845
- if (sel(plist[j + k]).lang && outline.labeller.LanguagePreference) {
846
- langTagged += 1;
847
- if (sel(plist[j + k]).lang.indexOf(outline.labeller.LanguagePreference) >= 0) {
848
- myLang++;
849
- }
850
- }
851
- }
852
-
853
- /* Display only the one in the preferred language
854
- ONLY in the case (currently) when all the values are tagged.
855
- Then we treat them as alternatives. */
856
-
857
- if (myLang > 0 && langTagged === dups + 1) {
858
- for (let k = j; k <= j + dups; k++) {
859
- if (outline.labeller.LanguagePreference && sel(plist[k]).lang.indexOf(outline.labeller.LanguagePreference) >= 0) {
860
- tr.appendChild(thisOutline.outlineObjectTD(sel(plist[k]), defaultpropview, undefined, s));
861
- break;
862
- }
863
- }
864
- j += dups; // extra push
865
- continue;
866
- }
867
- tr.appendChild(thisOutline.outlineObjectTD(sel(s), defaultpropview, undefined, s));
868
-
869
- /* Note: showNobj shows between n to 2n objects.
870
- * This is to prevent the case where you have a long list of objects
871
- * shown, and dangling at the end is '1 more' (which is easily ignored)
872
- * Therefore more objects are shown than hidden.
873
- */
874
-
875
- tr.showNobj = function (n) {
876
- const predDups = k - dups;
877
- const show = 2 * n < predDups ? n : predDups;
878
- const showLaterArray = [];
879
- if (predDups !== 1) {
880
- predicateTD.setAttribute('rowspan', show === predDups ? predDups : n + 1);
881
- let l;
882
- if (show < predDups && show === 1) {
883
- // what case is this...
884
- predicateTD.setAttribute('rowspan', 2);
885
- }
886
- let displayed = 0; // The number of cells generated-1,
887
- // all duplicate thing removed
888
- for (l = 1; l < k; l++) {
889
- // This detects the same things
890
- if (!kb.canon(sel(plist[j + l])).sameTerm(kb.canon(sel(plist[j + l - 1])))) {
891
- displayed++;
892
- s = plist[j + l];
893
- defaultpropview = views.defaults[s.predicate.uri];
894
- const trObj = dom.createElement('tr');
895
- trObj.style.colspan = '1';
896
- trObj.appendChild(thisOutline.outlineObjectTD(sel(plist[j + l]), defaultpropview, undefined, s));
897
- trObj.AJAR_statement = s;
898
- trObj.AJAR_inverse = inverse;
899
- parent.appendChild(trObj);
900
- if (displayed >= show) {
901
- trObj.style.display = 'none';
902
- showLaterArray.push(trObj);
903
- }
904
- } else {
905
- // ToDo: show all the data sources of this statement
906
- UI.log.info('there are duplicates here: %s', plist[j + l - 1]);
907
- }
908
- }
909
- // @@a quick fix on the messing problem.
910
- if (show === predDups) {
911
- predicateTD.setAttribute('rowspan', displayed + 1);
912
- }
913
- } // end of if (predDups!==1)
914
-
915
- if (show < predDups) {
916
- // Add the x more <TR> here
917
- const moreTR = dom.createElement('tr');
918
- const moreTD = moreTR.appendChild(dom.createElement('td'));
919
- moreTD.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
920
- moreTD.setAttribute('notSelectable', 'false');
921
- if (predDups > n) {
922
- // what is this for??
923
- const small = dom.createElement('a');
924
- moreTD.appendChild(small);
925
- const predToggle = function (f) {
926
- return f(predicateTD, k, dups, n);
927
- }(function (predicateTD, k, dups, n) {
928
- return function (display) {
929
- small.innerHTML = '';
930
- if (display === 'none') {
931
- small.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-more-trans.png', 'more', 'See all', dom));
932
- small.appendChild(dom.createTextNode(predDups - n + ' more...'));
933
- predicateTD.setAttribute('rowspan', n + 1);
934
- } else {
935
- small.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-shrink.png', '(less)', undefined, dom));
936
- predicateTD.setAttribute('rowspan', predDups + 1);
937
- }
938
- for (let i = 0; i < showLaterArray.length; i++) {
939
- const trObj = showLaterArray[i];
940
- trObj.style.display = display;
941
- }
942
- };
943
- }); // ???
944
- let current = 'none';
945
- const toggleObj = function (event) {
946
- predToggle(current);
947
- current = current === 'none' ? '' : 'none';
948
- if (event) event.stopPropagation();
949
- return false; // what is this for?
950
- };
951
- toggleObj();
952
- small.addEventListener('click', toggleObj, false);
953
- } // if(predDups>n)
954
- parent.appendChild(moreTR);
955
- } // if
956
- }; // tr.showNobj
957
-
958
- tr.showAllobj = function () {
959
- tr.showNobj(k - dups);
960
- };
961
- tr.showNobj(10);
962
- j += k - 1; // extra push
963
- }
964
- } // appendPropertyTRs
965
-
966
- this.appendPropertyTRs = appendPropertyTRs;
967
-
968
- /* termWidget
969
- **
970
- */
971
- const termWidget = {}; // @@@@@@ global
972
- global.termWidget = termWidget;
973
- termWidget.construct = function (dom) {
974
- dom = dom || document;
975
- const td = dom.createElement('TD');
976
- td.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
977
- td.setAttribute('class', 'iconTD');
978
- td.setAttribute('notSelectable', 'true');
979
- td.style.width = '0px';
980
- return td;
981
- };
982
- termWidget.addIcon = function (td, icon, listener) {
983
- const iconTD = td.childNodes[1];
984
- if (!iconTD) return;
985
- let width = iconTD.style.width;
986
- const img = UI.utils.AJARImage(icon.src, icon.alt, icon.tooltip, dom);
987
- width = parseInt(width);
988
- width = width + icon.width;
989
- iconTD.style.width = width + 'px';
990
- iconTD.appendChild(img);
991
- if (listener) {
992
- img.addEventListener('click', listener);
993
- }
994
- };
995
- termWidget.removeIcon = function (td, icon) {
996
- const iconTD = td.childNodes[1];
997
- let baseURI;
998
- if (!iconTD) return;
999
- let width = iconTD.style.width;
1000
- width = parseInt(width);
1001
- width = width - icon.width;
1002
- iconTD.style.width = width + 'px';
1003
- for (let x = 0; x < iconTD.childNodes.length; x++) {
1004
- const elt = iconTD.childNodes[x];
1005
- const eltSrc = elt.src;
1006
-
1007
- // ignore first '?' and everything after it //Kenny doesn't know what this is for
1008
- try {
1009
- baseURI = dom.location.href.split('?')[0];
1010
- } catch (e) {
1011
- console.log(e);
1012
- baseURI = '';
1013
- }
1014
- const relativeIconSrc = $rdf.uri.join(icon.src, baseURI);
1015
- if (eltSrc === relativeIconSrc) {
1016
- iconTD.removeChild(elt);
1017
- }
1018
- }
1019
- };
1020
- termWidget.replaceIcon = function (td, oldIcon, newIcon, listener) {
1021
- termWidget.removeIcon(td, oldIcon);
1022
- termWidget.addIcon(td, newIcon, listener);
1023
- };
1024
-
1025
- // / /////////////////////////////////////////////////// VALUE BROWSER VIEW
1026
-
1027
- // / /////////////////////////////////////////////////////// TABLE VIEW
1028
-
1029
- // Summarize a thing as a table cell
1030
-
1031
- /**********************
1032
- query global vars
1033
- ***********************/
1034
-
1035
- // const doesn't work in Opera
1036
- // const BLANK_QUERY = { pat: kb.formula(), vars: [], orderBy: [] };
1037
- // @ pat: the query pattern in an RDFIndexedFormula. Statements are in pat.statements
1038
- // @ vars: the free variables in the query
1039
- // @ orderBy: the variables to order the table
1040
-
1041
- function QueryObj() {
1042
- this.pat = kb.formula();
1043
- this.vars = [];
1044
- // this.orderBy = []
1045
- }
1046
- const queries = [];
1047
- queries[0] = new QueryObj();
1048
- /*
1049
- function querySave () {
1050
- queries.push(queries[0])
1051
- var choices = dom.getElementById('queryChoices')
1052
- var next = dom.createElement('option')
1053
- var box = dom.createElement('input')
1054
- var index = queries.length - 1
1055
- box.setAttribute('type', 'checkBox')
1056
- box.setAttribute('value', index)
1057
- choices.appendChild(box)
1058
- choices.appendChild(dom.createTextNode('Saved query #' + index))
1059
- choices.appendChild(dom.createElement('br'))
1060
- next.setAttribute('value', index)
1061
- next.appendChild(dom.createTextNode('Saved query #' + index))
1062
- dom.getElementById('queryJump').appendChild(next)
1063
- }
1064
- */
1065
- /*
1066
- function resetQuery () {
1067
- function resetOutliner (pat) {
1068
- var n = pat.statements.length
1069
- var pattern, tr
1070
- for (let i = 0; i < n; i++) {
1071
- pattern = pat.statements[i]
1072
- tr = pattern.tr
1073
- // UI.log.debug('tr: ' + tr.AJAR_statement);
1074
- if (typeof tr !== 'undefined') {
1075
- delete tr.AJAR_pattern
1076
- delete tr.AJAR_variable
1077
- }
1078
- }
1079
- for (let x in pat.optional) { resetOutliner(pat.optional[x]) }
1080
- }
1081
- resetOutliner(myQuery.pat)
1082
- UI.utils.clearVariableNames()
1083
- queries[0] = myQuery = new QueryObj()
1084
- }
1085
- */
1086
- function addButtonCallbacks(target, fireOn) {
1087
- UI.log.debug('Button callbacks for ' + fireOn + ' added');
1088
- const makeIconCallback = function (icon) {
1089
- return function IconCallback(req) {
1090
- if (req.indexOf('#') >= 0) {
1091
- console.log('@@ makeIconCallback: Not expecting # in URI whose state changed: ' + req);
1092
- // alert('Should have no hash in '+req)
1093
- }
1094
- if (!target) {
1095
- return false;
1096
- }
1097
- if (!outline.ancestor(target, 'DIV')) return false;
1098
- // if (term.termType != 'symbol') { return true } // should always ve
1099
- if (req === fireOn) {
1100
- target.src = icon;
1101
- target.title = _outlineIcons.outlineIcons.tooltips[icon];
1102
- }
1103
- return true;
1104
- };
1105
- };
1106
- sf.addCallback('request', makeIconCallback(_outlineIcons.outlineIcons.src.icon_requested));
1107
- sf.addCallback('done', makeIconCallback(_outlineIcons.outlineIcons.src.icon_fetched));
1108
- sf.addCallback('fail', makeIconCallback(_outlineIcons.outlineIcons.src.icon_failed));
1109
- }
1110
-
1111
- // Selection support
1112
-
1113
- function selected(node) {
1114
- const a = node.getAttribute('class');
1115
- if (a && a.indexOf('selected') >= 0) return true;
1116
- return false;
1117
- }
1118
-
1119
- // These woulkd be simpler using closer variables below
1120
- function optOnIconMouseDownListener(e) {
1121
- // outlineIcons.src.icon_opton needed?
1122
- const target = thisOutline.targetOf(e);
1123
- const p = target.parentNode;
1124
- termWidget.replaceIcon(p.parentNode, _outlineIcons.outlineIcons.termWidgets.optOn, _outlineIcons.outlineIcons.termWidgets.optOff, optOffIconMouseDownListener);
1125
- p.parentNode.parentNode.removeAttribute('optional');
1126
- }
1127
- function optOffIconMouseDownListener(e) {
1128
- // outlineIcons.src.icon_optoff needed?
1129
- const target = thisOutline.targetOf(e);
1130
- const p = target.parentNode;
1131
- termWidget.replaceIcon(p.parentNode, _outlineIcons.outlineIcons.termWidgets.optOff, _outlineIcons.outlineIcons.termWidgets.optOn, optOnIconMouseDownListener);
1132
- p.parentNode.parentNode.setAttribute('optional', 'true');
1133
- }
1134
- function setSelectedParent(node, inc) {
1135
- const onIcon = _outlineIcons.outlineIcons.termWidgets.optOn;
1136
- const offIcon = _outlineIcons.outlineIcons.termWidgets.optOff;
1137
- for (let n = node; n.parentNode; n = n.parentNode) {
1138
- while (true) {
1139
- if (n.getAttribute('predTR')) {
1140
- let num = n.getAttribute('parentOfSelected');
1141
- if (!num) num = 0;else num = parseInt(num);
1142
- if (num === 0 && inc > 0) {
1143
- termWidget.addIcon(n.childNodes[0], n.getAttribute('optional') ? onIcon : offIcon, n.getAttribute('optional') ? optOnIconMouseDownListener : optOffIconMouseDownListener);
1144
- }
1145
- num = num + inc;
1146
- n.setAttribute('parentOfSelected', num);
1147
- if (num === 0) {
1148
- n.removeAttribute('parentOfSelected');
1149
- termWidget.removeIcon(n.childNodes[0], n.getAttribute('optional') ? onIcon : offIcon);
1150
- }
1151
- break;
1152
- } else if (n.previousSibling && n.previousSibling.nodeName === 'TR') {
1153
- n = n.previousSibling;
1154
- } else break;
1155
- }
1156
- }
1157
- }
1158
- this.statusBarClick = function (event) {
1159
- const target = UI.utils.getTarget(event);
1160
- if (target.label) {
1161
- window.content.location = target.label;
1162
- // The following alternative does not work in the extension.
1163
- // var s = store.sym(target.label);
1164
- // outline.GotoSubject(s, true);
1165
- }
1166
- };
1167
- this.showURI = function showURI(about) {
1168
- if (about && dom.getElementById('UserURI')) {
1169
- dom.getElementById('UserURI').value = about.termType === 'NamedNode' ? about.uri : ''; // blank if no URI
1170
- }
1171
- };
1172
- this.showSource = function showSource() {
1173
- if (typeof sourceWidget === 'undefined') return;
1174
- // deselect all before going on, this is necessary because you would switch tab,
1175
- // close tab or so on...
1176
- for (const uri in sourceWidget.sources) {
1177
- sourceWidget.sources[uri].setAttribute('class', '');
1178
- } // .class doesn't work. Be careful!
1179
- for (let i = 0; i < selection.length; i++) {
1180
- if (!selection[i].parentNode) {
1181
- console.log('showSource: EH? no parentNode? ' + selection[i] + '\n');
1182
- continue;
1183
- }
1184
- const st = selection[i].parentNode.AJAR_statement;
1185
- if (!st) continue; // for root TD
1186
- const source = st.why;
1187
- if (source && source.uri) {
1188
- sourceWidget.highlight(source, true);
1189
- }
1190
- }
1191
- };
1192
- this.getSelection = function getSelection() {
1193
- return selection;
1194
- };
1195
- function setSelected(node, newValue) {
1196
- // UI.log.info('selection has ' +selection.map(function(item){return item.textContent;}).join(', '));
1197
- // UI.log.debug('@outline setSelected, intended to '+(newValue?'select ':'deselect ')+node+node.textContent);
1198
- // if (newValue === selected(node)) return; //we might not need this anymore...
1199
- if (node.nodeName !== 'TD') {
1200
- UI.log.debug('down' + node.nodeName);
1201
- throw new Error('Expected TD in setSelected: ' + node.nodeName + ' : ' + node.textContent);
1202
- }
1203
- UI.log.debug('pass');
1204
- let cla = node.getAttribute('class');
1205
- if (!cla) cla = '';
1206
- if (newValue) {
1207
- cla += ' selected';
1208
- if (cla.indexOf('pred') >= 0 || cla.indexOf('obj') >= 0) {
1209
- setSelectedParent(node, 1);
1210
- }
1211
- selection.push(node);
1212
- // UI.log.info('Selecting '+node.textContent)
1213
-
1214
- const about = UI.utils.getTerm(node); // show uri for a newly selectedTd
1215
- thisOutline.showURI(about);
1216
- let st = node.AJAR_statement; // show blue cross when the why of that triple is editable
1217
- if (typeof st === 'undefined' && node.parentNode) st = node.parentNode.AJAR_statement;
1218
- // if (typeof st === 'undefined') return; // @@ Kludge? Click in the middle of nowhere
1219
- if (st) {
1220
- // don't do these for headers or base nodes
1221
- const source = st.why;
1222
- // var target = st.why
1223
- const editable = _solidLogic.store.updater.editable(source.uri, kb);
1224
- if (!editable) {
1225
- // let target = node.parentNode.AJAR_inverse ? st.object : st.subject
1226
- } // left hand side
1227
- // think about this later. Because we update to the why for now.
1228
- // alert('Target='+target+', editable='+editable+'\nselected statement:' + st)
1229
- if (editable && cla.indexOf('pred') >= 0) {
1230
- termWidget.addIcon(node, _outlineIcons.outlineIcons.termWidgets.addTri);
1231
- } // Add blue plus
1232
- }
1233
- } else {
1234
- UI.log.debug('cla=$' + cla + '$');
1235
- if (cla === 'selected') cla = ''; // for header <TD>
1236
- cla = cla.replace(' selected', '');
1237
- if (cla.indexOf('pred') >= 0 || cla.indexOf('obj') >= 0) {
1238
- setSelectedParent(node, -1);
1239
- }
1240
- if (cla.indexOf('pred') >= 0) {
1241
- termWidget.removeIcon(node, _outlineIcons.outlineIcons.termWidgets.addTri);
1242
- }
1243
- selection = selection.filter(function (x) {
1244
- return x === node;
1245
- });
1246
- UI.log.info('Deselecting ' + node.textContent);
1247
- }
1248
- if (typeof sourceWidget !== 'undefined') thisOutline.showSource(); // Update the data sources display
1249
- // UI.log.info('selection becomes [' +selection.map(function(item){return item.textContent;}).join(', ')+']');
1250
- // UI.log.info('Setting className ' + cla);
1251
- node.setAttribute('class', cla);
1252
- }
1253
- function deselectAll() {
1254
- const n = selection.length;
1255
- for (let i = n - 1; i >= 0; i--) setSelected(selection[i], false);
1256
- selection = [];
1257
- }
1258
-
1259
- /** Get the target of an event **/
1260
- this.targetOf = function (e) {
1261
- let target;
1262
- if (!e) e = window.event;
1263
- if (e.target) {
1264
- target = e.target;
1265
- } else if (e.srcElement) {
1266
- target = e.srcElement;
1267
- } else {
1268
- UI.log.error('can\'t get target for event ' + e);
1269
- return false;
1270
- } // fail
1271
- if (target.nodeType === 3) {
1272
- // defeat Safari bug [sic]
1273
- target = target.parentNode;
1274
- }
1275
- return target;
1276
- }; // targetOf
1277
-
1278
- this.walk = function walk(directionCode, inputTd) {
1279
- const selectedTd = inputTd || selection[0];
1280
- let newSelTd;
1281
- switch (directionCode) {
1282
- case 'down':
1283
- try {
1284
- newSelTd = selectedTd.parentNode.nextSibling.lastChild;
1285
- } catch (e) {
1286
- this.walk('up');
1287
- return;
1288
- } // end
1289
- deselectAll();
1290
- setSelected(newSelTd, true);
1291
- break;
1292
- case 'up':
1293
- try {
1294
- newSelTd = selectedTd.parentNode.previousSibling.lastChild;
1295
- } catch (e) {
1296
- return;
1297
- } // top
1298
- deselectAll();
1299
- setSelected(newSelTd, true);
1300
- break;
1301
- case 'right':
1302
- deselectAll();
1303
- if (selectedTd.nextSibling || selectedTd.lastChild.tagName === 'strong') {
1304
- setSelected(selectedTd.nextSibling, true);
1305
- } else {
1306
- const newSelected = dom.evaluate('table/div/tr/td[2]', selectedTd, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
1307
- setSelected(newSelected, true);
1308
- }
1309
- break;
1310
- case 'left':
1311
- deselectAll();
1312
- if (selectedTd.previousSibling && selectedTd.previousSibling.className === 'undetermined') {
1313
- setSelected(selectedTd.previousSibling, true);
1314
- return true; // do not shrink signal
1315
- } else {
1316
- setSelected(UI.utils.ancestor(selectedTd.parentNode, 'TD'), true);
1317
- } // supplied by thieOutline.focusTd
1318
- break;
1319
- case 'moveTo':
1320
- // UI.log.info(selection[0].textContent+'->'+inputTd.textContent);
1321
- deselectAll();
1322
- setSelected(inputTd, true);
1323
- break;
1324
- }
1325
- if (directionCode === 'down' || directionCode === 'up') {
1326
- if (!newSelTd.tabulatorSelect) this.walk(directionCode);
1327
- }
1328
- // return newSelTd;
1329
- };
1330
-
1331
- // Keyboard Input: we can consider this as...
1332
- // 1. a fast way to modify data - enter will go to next predicate
1333
- // 2. an alternative way to input - enter at the end of a predicate will create a new statement
1334
- this.OutlinerKeypressPanel = function OutlinerKeypressPanel(e) {
1335
- UI.log.info('Key ' + e.keyCode + ' pressed');
1336
- function showURI(about) {
1337
- if (about && dom.getElementById('UserURI')) {
1338
- dom.getElementById('UserURI').value = about.termType === 'NamedNode' ? about.uri : ''; // blank if no URI
1339
- }
1340
- }
1341
- function setSelectedAfterward(_uri) {
1342
- if (arguments[3]) return true;
1343
- walk('right', selectedTd);
1344
- showURI(UI.utils.getAbout(kb, selection[0]));
1345
- return true;
1346
- }
1347
- let target, editable;
1348
- if (UI.utils.getTarget(e).tagName === 'TEXTAREA') return;
1349
- if (UI.utils.getTarget(e).id === 'UserURI') return;
1350
- if (selection.length > 1) return;
1351
- if (selection.length === 0) {
1352
- if (e.keyCode === 13 || e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39) {
1353
- this.walk('right', thisOutline.focusTd);
1354
- showURI(UI.utils.getAbout(kb, selection[0]));
1355
- }
1356
- return;
1357
- }
1358
- const selectedTd = selection[0];
1359
- // if not done, Have to deal with redraw...
1360
- sf.removeCallback('done', 'setSelectedAfterward');
1361
- sf.removeCallback('fail', 'setSelectedAfterward');
1362
- switch (e.keyCode) {
1363
- case 13:
1364
- // enter
1365
- if (UI.utils.getTarget(e).tagName === 'HTML') {
1366
- // I don't know why 'HTML'
1367
- const object = UI.utils.getAbout(kb, selectedTd);
1368
- target = selectedTd.parentNode.AJAR_statement.why;
1369
- editable = _solidLogic.store.updater.editable(target.uri, kb);
1370
- if (object) {
1371
- // <Feature about='enterToExpand'>
1372
- outline.GotoSubject(object, true);
1373
- /* //deal with this later
1374
- deselectAll();
1375
- var newTr=dom.getElementById('OutlineView').lastChild;
1376
- setSelected(newTr.firstChild.firstChild.childNodes[1].lastChild,true);
1377
- function setSelectedAfterward(uri){
1378
- deselectAll();
1379
- setSelected(newTr.firstChild.firstChild.childNodes[1].lastChild,true);
1380
- showURI(getAbout(kb,selection[0]));
1381
- return true;
1382
- }
1383
- sf.insertCallback('done',setSelectedAfterward);
1384
- sf.insertCallback('fail',setSelectedAfterward);
1385
- */
1386
- // </Feature>
1387
- } else if (editable) {
1388
- // this is a text node and editable
1389
- thisOutline.UserInput.Enter(selectedTd);
1390
- }
1391
- } else {
1392
- // var newSelTd=thisOutline.UserInput.lastModified.parentNode.parentNode.nextSibling.lastChild;
1393
- this.UserInput.Keypress(e);
1394
- this.walk('down'); // bug with input at the end
1395
- // dom.getElementById('docHTML').focus(); //have to set this or focus blurs
1396
- e.stopPropagation();
1397
- }
1398
- return;
1399
- case 38:
1400
- // up
1401
- // thisOutline.UserInput.clearInputAndSave();
1402
- // ^^^ does not work because up and down not captured...
1403
- this.walk('up');
1404
- e.stopPropagation();
1405
- e.preventDefault();
1406
- break;
1407
- case 40:
1408
- // down
1409
- // thisOutline.UserInput.clearInputAndSave();
1410
- this.walk('down');
1411
- e.stopPropagation();
1412
- e.preventDefault();
1413
- } // switch
1414
-
1415
- if (UI.utils.getTarget(e).tagName === 'INPUT') return;
1416
- let walk;
1417
- switch (e.keyCode) {
1418
- case 46: // delete
1419
- case 8:
1420
- // backspace
1421
- target = selectedTd.parentNode.AJAR_statement.why;
1422
- editable = _solidLogic.store.updater.editable(target.uri, kb);
1423
- if (editable) {
1424
- e.preventDefault(); // prevent from going back
1425
- this.UserInput.Delete(selectedTd);
1426
- }
1427
- break;
1428
- case 37:
1429
- {
1430
- // left
1431
- if (this.walk('left')) return;
1432
- const titleTd = UI.utils.ancestor(selectedTd.parentNode, 'TD');
1433
- outlineCollapse(selectedTd, UI.utils.getAbout(kb, titleTd));
1434
- break;
1435
- }
1436
- case 39:
1437
- // right
1438
- // @@ TODO: Write away the need for exception on next line
1439
- {
1440
- const obj = UI.utils.getAbout(kb, selectedTd);
1441
- if (obj) {
1442
- walk = this.walk;
1443
- if (selectedTd.nextSibling) {
1444
- // when selectedTd is a predicate
1445
- this.walk('right');
1446
- return;
1447
- }
1448
- if (selectedTd.firstChild.tagName !== 'TABLE') {
1449
- // not expanded
1450
- sf.addCallback('done', setSelectedAfterward);
1451
- sf.addCallback('fail', setSelectedAfterward);
1452
- outlineExpand(selectedTd, obj, {
1453
- pane: paneRegistry.byName('defaultPane')
1454
- });
1455
- }
1456
- setSelectedAfterward();
1457
- }
1458
- }
1459
- break;
1460
- case 38: // up
1461
- case 40:
1462
- // down
1463
- break;
1464
- default:
1465
- switch (e.charCode) {
1466
- case 99:
1467
- // c for Copy
1468
- if (e.ctrlKey) {
1469
- thisOutline.UserInput.copyToClipboard(thisOutline.clipboardAddress, selectedTd);
1470
- break;
1471
- }
1472
- break;
1473
- case 118: // v
1474
- case 112:
1475
- // p for Paste
1476
- if (e.ctrlKey) {
1477
- thisOutline.UserInput.pasteFromClipboard(thisOutline.clipboardAddress, selectedTd);
1478
- // dom.getElementById('docHTML').focus(); //have to set this or focus blurs
1479
- // window.focus();
1480
- // e.stopPropagation();
1481
- break;
1482
- }
1483
- break;
1484
- default:
1485
- if (UI.utils.getTarget(e).tagName === 'HTML') {
1486
- /*
1487
- //<Feature about='typeOnSelectedToInput'>
1488
- thisOutline.UserInput.Click(e,selectedTd);
1489
- thisOutline.UserInput.lastModified.value=String.fromCharCode(e.charCode);
1490
- if (selectedTd.className==='undetermined selected') thisOutline.UserInput.AutoComplete(e.charCode)
1491
- //</Feature>
1492
- */
1493
- // Events are not reliable...
1494
- // var e2=document.createEvent('KeyboardEvent');
1495
- // e2.initKeyEvent('keypress',true,true,null,false,false,false,false,e.keyCode,0);
1496
- // UserInput.lastModified.dispatchEvent(e2);
1497
- }
1498
- }
1499
- } // end of switch
1500
-
1501
- showURI(UI.utils.getAbout(kb, selection[0]));
1502
- // alert(window);alert(doc);
1503
- /*
1504
- var wm = Components.classes['@mozilla.org/appshell/window-mediator;1']
1505
- .getService(Components.interfaces.nsIWindowMediator);
1506
- var gBrowser = wm.getMostRecentWindow('navigator:browser') */
1507
- // gBrowser.addTab('http://www.w3.org/');
1508
- // alert(gBrowser.addTab);alert(gBrowser.scroll);alert(gBrowser.scrollBy)
1509
- // gBrowser.scrollBy(0,100);
1510
-
1511
- // var thisHtml=selection[0].owner
1512
- if (selection[0]) {
1513
- const PosY = UI.utils.findPos(selection[0])[1];
1514
- if (PosY + selection[0].clientHeight > window.scrollY + window.innerHeight) {
1515
- UI.utils.getEyeFocus(selection[0], true, true, window);
1516
- }
1517
- if (PosY < window.scrollY + 54) {
1518
- UI.utils.getEyeFocus(selection[0], true, undefined, window);
1519
- }
1520
- }
1521
- };
1522
- this.OutlinerMouseclickPanel = function (e) {
1523
- switch (thisOutline.UserInput._tabulatorMode) {
1524
- case 0:
1525
- TabulatorMousedown(e);
1526
- break;
1527
- case 1:
1528
- thisOutline.UserInput.Click(e);
1529
- break;
1530
- default:
1531
- }
1532
- };
1533
-
1534
- /** things to do onmousedown in outline view **/
1535
- /*
1536
- ** To Do: This big event handler needs to be replaced by lots
1537
- ** of little ones individually connected to each icon. This horrible
1538
- ** switch below isn't modular. (Sorry!) - Tim
1539
- */
1540
- // expand
1541
- // collapse
1542
- // refocus
1543
- // select
1544
- // visit/open a page
1545
-
1546
- function expandMouseDownListener(e) {
1547
- // For icon (UI.icons.originalIconBase + 'tbl-expand-trans.png')
1548
- const target = thisOutline.targetOf(e);
1549
- const p = target.parentNode;
1550
- const subject = UI.utils.getAbout(kb, target);
1551
- const pane = e.altKey ? paneRegistry.byName('internal') : undefined; // set later: was panes.defaultPane
1552
-
1553
- if (e.shiftKey) {
1554
- // Shift forces a refocus - bring this to the top
1555
- outlineRefocus(p, subject, pane);
1556
- } else {
1557
- if (e.altKey) {
1558
- // To investigate screw ups, dont wait show internals
1559
- outlineExpand(p, subject, {
1560
- pane: paneRegistry.byName('internal'),
1561
- immediate: true
1562
- });
1563
- } else {
1564
- outlineExpand(p, subject);
1565
- }
1566
- }
1567
- }
1568
- function collapseMouseDownListener(e) {
1569
- // for icon UI.icons.originalIconBase + 'tbl-collapse.png'
1570
- const target = thisOutline.targetOf(e);
1571
- const subject = UI.utils.getAbout(kb, target);
1572
- const pane = e.altKey ? paneRegistry.byName('internal') : undefined;
1573
- const p = target.parentNode.parentNode;
1574
- outlineCollapse(p, subject, pane);
1575
- }
1576
- function failedIconMouseDownListener(e) {
1577
- // outlineIcons.src.icon_failed
1578
- const target = thisOutline.targetOf(e);
1579
- const uri = target.getAttribute('uri'); // Put on access buttons
1580
- if (e.altKey) {
1581
- sf.fetch($rdf.uri.docpart(uri), {
1582
- force: true
1583
- }); // Add 'force' bit?
1584
- } else {
1585
- sf.refresh(kb.sym($rdf.uri.docpart(uri))); // just one
1586
- }
1587
- }
1588
- function fetchedIconMouseDownListener(e) {
1589
- // outlineIcons.src.icon_fetched
1590
- const target = thisOutline.targetOf(e);
1591
- const uri = target.getAttribute('uri'); // Put on access buttons
1592
- if (e.altKey) {
1593
- sf.fetch($rdf.uri.docpart(uri), {
1594
- force: true
1595
- });
1596
- } else {
1597
- sf.refresh(kb.sym($rdf.uri.docpart(uri))); // just one
1598
- }
1599
- }
1600
- function unrequestedIconMouseDownListener(e) {
1601
- const target = thisOutline.targetOf(e);
1602
- const uri = target.getAttribute('uri'); // Put on access buttons
1603
- sf.fetch($rdf.uri.docpart(uri));
1604
- }
1605
- function removeNodeIconMouseDownListener(e) {
1606
- // icon_remove_node
1607
- const target = thisOutline.targetOf(e);
1608
- let node = target.node;
1609
- if (node.childNodes.length > 1) node = target.parentNode; // parallel outline view @@ Hack
1610
- removeAndRefresh(node); // @@ update icons for pane?
1611
- }
1612
- function selectableTDClickListener(e) {
1613
- // Is we are in editing mode already
1614
- if (thisOutline.UserInput._tabulatorMode) {
1615
- return thisOutline.UserInput.Click(e);
1616
- }
1617
- const target = thisOutline.targetOf(e);
1618
- // Originally this was set on the whole tree and could happen anywhere
1619
- // var p = target.parentNode
1620
- let node;
1621
- for (node = UI.utils.ancestor(target, 'TD'); node && !(node.getAttribute('notSelectable') === 'false');
1622
- // Default now is not selectable
1623
- node = UI.utils.ancestor(node.parentNode, 'TD')) {
1624
- // ...
1625
- }
1626
- if (!node) return;
1627
-
1628
- // var node = target;
1629
-
1630
- const sel = selected(node);
1631
- // var cla = node.getAttribute('class')
1632
- UI.log.debug('Was node selected before: ' + sel);
1633
- if (e.altKey) {
1634
- setSelected(node, !selected(node));
1635
- } else if (e.shiftKey) {
1636
- setSelected(node, true);
1637
- } else {
1638
- // setSelected(node, !selected(node))
1639
- deselectAll();
1640
- thisOutline.UserInput.clearInputAndSave(e);
1641
- setSelected(node, true);
1642
- if (e.detail === 2) {
1643
- // double click -> quit TabulatorMousedown()
1644
- e.stopPropagation();
1645
- return;
1646
- }
1647
- // if the node is already selected and the corresponding statement is editable,
1648
- // go to UserInput
1649
- let st;
1650
- if (node.parentNode) st = node.parentNode.AJAR_statement;
1651
- if (!st) return; // For example in the title TD of an expanded pane
1652
- const target = st.why;
1653
- const editable = _solidLogic.store.updater.editable(target.uri, kb);
1654
- if (sel && editable) thisOutline.UserInput.Click(e, selection[0]); // was next 2 lines
1655
- // var text='TabulatorMouseDown@Outline()';
1656
- // HCIoptions['able to edit in Discovery Mode by mouse'].setupHere([sel,e,thisOutline,selection[0]],text);
1657
- }
1658
- UI.log.debug('Was node selected after: ' + selected(node) + ', count=' + selection.length);
1659
- // var tr = node.parentNode
1660
- /*
1661
- if (tr.AJAR_statement) {
1662
- // var why = tr.AJAR_statement.why
1663
- // UI.log.info('Information from '+why);
1664
- }
1665
- */
1666
- e.stopPropagation();
1667
- // this is important or conflict between deselect and user input happens
1668
- }
1669
- function TabulatorMousedown(e) {
1670
- UI.log.info('@TabulatorMousedown, dom.location is now ' + dom.location);
1671
- const target = thisOutline.targetOf(e);
1672
- if (!target) return;
1673
- const tname = target.tagName;
1674
- // UI.log.debug('TabulatorMousedown: ' + tname + ' shift='+e.shiftKey+' alt='+e.altKey+' ctrl='+e.ctrlKey);
1675
- // var p = target.parentNode
1676
- // var about = UI.utils.getAbout(kb, target)
1677
- // var source = null
1678
- if (tname === 'INPUT' || tname === 'TEXTAREA') {
1679
- return;
1680
- }
1681
-
1682
- // not input then clear
1683
- thisOutline.UserInput.clearMenu();
1684
-
1685
- // ToDo:remove this and recover X
1686
- if (thisOutline.UserInput.lastModified && thisOutline.UserInput.lastModified.parentNode.nextSibling) {
1687
- thisOutline.UserInput.backOut();
1688
- }
1689
-
1690
- // if (typeof rav=='undefined') //uncomment this for javascript2rdf
1691
- // have to put this here or this conflicts with deselectAll()
1692
-
1693
- if (!target.src || target.src.slice(target.src.indexOf('/icons/') + 1) !== _outlineIcons.outlineIcons.src.icon_show_choices && target.src.slice(target.src.indexOf('/icons/') + 1) !== _outlineIcons.outlineIcons.src.icon_add_triple) {
1694
- thisOutline.UserInput.clearInputAndSave(e);
1695
- }
1696
- if (!target.src || target.src.slice(target.src.indexOf('/icons/') + 1) !== _outlineIcons.outlineIcons.src.icon_show_choices) {
1697
- thisOutline.UserInput.clearMenu();
1698
- }
1699
- if (e) e.stopPropagation();
1700
- } // function TabulatorMousedown
1701
-
1702
- function setUrlBarAndTitle(subject) {
1703
- dom.title = UI.utils.label(subject);
1704
- if (dom.location.href.startsWith(subject.site().uri)) {
1705
- // dom.location = subject.uri // No causes reload
1706
- }
1707
- }
1708
-
1709
- /** Expand an outline view
1710
- * @param p {Element} - container
1711
- */
1712
- function outlineExpand(p, subject1, options) {
1713
- options = options || {};
1714
- const pane = options.pane;
1715
- let already = !!options.already;
1716
- const immediate = options.immediate;
1717
- UI.log.info('@outlineExpand, dom is now ' + dom.location);
1718
- // remove callback to prevent unexpected repaint
1719
- sf.removeCallback('done', 'expand');
1720
- sf.removeCallback('fail', 'expand');
1721
- let subject = kb.canon(subject1);
1722
- // var requTerm = subject.uri ? kb.sym($rdf.uri.docpart(subject.uri)) : subject
1723
-
1724
- function render() {
1725
- subject = kb.canon(subject);
1726
- if (!p || !p.parentNode || !p.parentNode.parentNode) return false;
1727
- let newTable;
1728
- UI.log.info('@@ REPAINTING ');
1729
- if (!already) {
1730
- // first expand
1731
- newTable = propertyTable(subject, undefined, pane, options);
1732
- } else {
1733
- UI.log.info(' ... p is ' + p);
1734
- for (newTable = p.firstChild; newTable.nextSibling; newTable = newTable.nextSibling) {
1735
- UI.log.info(' ... checking node ' + newTable);
1736
- if (newTable.nodeName === 'table') break;
1737
- }
1738
- newTable = propertyTable(subject, newTable, pane, options);
1739
- }
1740
- already = true;
1741
- if (UI.utils.ancestor(p, 'TABLE') && UI.utils.ancestor(p, 'TABLE').style.backgroundColor === 'white') {
1742
- newTable.style.backgroundColor = '#eee';
1743
- } else {
1744
- newTable.style.backgroundColor = 'white';
1745
- }
1746
- UI.utils.emptyNode(p).appendChild(newTable);
1747
- thisOutline.focusTd = p; // I don't know why I couldn't use 'this'...because not defined in callbacks
1748
- UI.log.debug('expand: Node for ' + subject + ' expanded');
1749
- // fetch seeAlso when render()
1750
- // var seeAlsoStats = sf.store.statementsMatching(subject, UI.ns.rdfs('seeAlso'))
1751
- // seeAlsoStats.map(function (x) {sf.lookUpThing(x.object, subject,false);})
1752
- const seeAlsoWhat = kb.each(subject, UI.ns.rdfs('seeAlso'));
1753
- for (let i = 0; i < seeAlsoWhat.length; i++) {
1754
- if (i === 25) {
1755
- UI.log.warn('expand: Warning: many (' + seeAlsoWhat.length + ') seeAlso links for ' + subject);
1756
- // break; Not sure what limits the AJAX system has here
1757
- }
1758
- sf.lookUpThing(seeAlsoWhat[i], subject);
1759
- }
1760
- }
1761
- function expand(uri) {
1762
- if (arguments[3]) return true; // already fetched indicator
1763
- const cursubj = kb.canon(subject); // canonical identifier may have changed
1764
- UI.log.info('@@ expand: relevant subject=' + cursubj + ', uri=' + uri + ', already=' + already);
1765
- // var term = kb.sym(uri)
1766
- const docTerm = kb.sym($rdf.uri.docpart(uri));
1767
- if (uri.indexOf('#') >= 0) {
1768
- throw new Error('Internal error: hash in ' + uri);
1769
- }
1770
- const relevant = function () {
1771
- // Is the loading of this URI relevam to the display of subject?
1772
- if (!cursubj.uri) return true; // bnode should expand()
1773
- const as = kb.uris(cursubj);
1774
- if (!as) return false;
1775
- for (let i = 0; i < as.length; i++) {
1776
- // canon'l uri or any alias
1777
- for (let rd = $rdf.uri.docpart(as[i]); rd; rd = kb.HTTPRedirects[rd]) {
1778
- if (uri === rd) return true;
1779
- }
1780
- }
1781
- if (kb.anyStatementMatching(cursubj, undefined, undefined, docTerm)) {
1782
- return true;
1783
- } // Kenny: inverse?
1784
- return false;
1785
- };
1786
- if (relevant()) {
1787
- UI.log.success('@@ expand OK: relevant subject=' + cursubj + ', uri=' + uri + ', source=' + already);
1788
- render();
1789
- return false; // @@@@@@@@@@@ Will this allow just the first
1790
- }
1791
- return true;
1792
- }
1793
- // Body of outlineExpand
1794
-
1795
- if (options.solo) {
1796
- setUrlBarAndTitle(subject);
1797
- }
1798
- UI.log.debug('outlineExpand: dereferencing ' + subject);
1799
- const status = dom.createElement('span');
1800
- p.appendChild(status);
1801
- sf.addCallback('done', expand); // @@@@@@@ This can really mess up existing work
1802
- sf.addCallback('fail', expand); // Need to do if there s one a gentle resync of page with store
1803
-
1804
- const returnConditions = []; // this is quite a general way to do cut and paste programming
1805
- // I might make a class for this
1806
- if (subject.uri && subject.uri.split(':')[0] === 'rdf') {
1807
- // what is this? -tim
1808
- render();
1809
- return;
1810
- }
1811
- for (let i = 0; i < returnConditions.length; i++) {
1812
- let returnCode;
1813
- if (returnCode === returnConditions[i](subject)) {
1814
- render();
1815
- UI.log.debug('outline 1815');
1816
- if (returnCode[1]) outlineElement.removeChild(outlineElement.lastChild);
1817
- return;
1818
- }
1819
- }
1820
- if (subject.uri && !immediate && !UI.widgets.isAudio(subject) && !UI.widgets.isVideo(subject)) {
1821
- const docUri = subject.doc() && subject.doc().uri ? subject.doc().uri : '' + subject.doc();
1822
- /* handle auth errors more gracefully. For now just display a friendlier message
1823
- perhaps we can have a different page that gets shown in the future */
1824
- const outlineAuthMessage = function (statusCode) {
1825
- const isRootResource = !!(subject && subject.uri && subject.site && subject.site().uri === subject.uri);
1826
- if (statusCode === 403) {
1827
- return isRootResource ? 'This root resource is not accessible with your current permissions. Try logging in with an authorized account or opening a public profile document.' : 'This resource is not accessible with your current permissions.';
1828
- }
1829
- return isRootResource ? 'This root resource is not publicly readable. Try logging in or opening a profile document.' : 'This resource is not publicly readable. Try logging in or opening a different public resource.';
1830
- };
1831
- const authErrorStatus = function (detail, errObj) {
1832
- const detailText = typeof detail === 'string' ? detail : String(detail || '');
1833
- const statusCode = errObj?.status || errObj?.response?.status;
1834
- if (statusCode === 401 || statusCode === 403) return statusCode;
1835
- if (detailText.includes('status: 403') || detailText.includes('status 403')) return 403;
1836
- if (detailText.includes('status: 401') || detailText.includes('status 401')) return 401;
1837
- return null;
1838
- };
1839
- const appendOutlineError = function (detail, errObj) {
1840
- if (p.querySelector && docUri) {
1841
- const existing = p.querySelector('[data-outline-error-for="' + docUri + '"]');
1842
- if (existing) return;
1843
- }
1844
- const statusCode = authErrorStatus(detail, errObj);
1845
- const friendlyDetail = statusCode ? outlineAuthMessage(statusCode) : detail;
1846
- const message = UI.widgets.errorMessageBlock(dom, friendlyDetail, '#fee', errObj instanceof Error ? errObj : undefined);
1847
- if (docUri) message.setAttribute('data-outline-error-for', docUri);
1848
- p.appendChild(message);
1849
- };
1850
- // Wait till at least the main URI is loaded before expanding:
1851
- let errorReported = false;
1852
- const fetchPromise = sf.nowOrWhenFetched(subject.doc(), undefined, function (ok, body) {
1853
- if (ok) {
1854
- sf.lookUpThing(subject);
1855
- render(); // inital open, or else full if re-open
1856
- if (options.solo) {
1857
- // Update window title with new information
1858
- // dom.title = UI.utils.label(subject)
1859
- setUrlBarAndTitle(subject);
1860
- }
1861
- } else {
1862
- errorReported = true;
1863
- appendOutlineError(body, undefined);
1864
- }
1865
- });
1866
- if (fetchPromise && typeof fetchPromise.catch === 'function') {
1867
- fetchPromise.catch(function (err) {
1868
- if (errorReported) return;
1869
- errorReported = true;
1870
- appendOutlineError(err, err);
1871
- });
1872
- }
1873
- } else {
1874
- render();
1875
- }
1876
- } // outlineExpand
1877
-
1878
- function outlineCollapse(p, subject) {
1879
- let row = UI.utils.ancestor(p, 'TR');
1880
- row = UI.utils.ancestor(row.parentNode, 'TR'); // two levels up
1881
- let statement;
1882
- if (row) statement = row.AJAR_statement;
1883
- let level; // find level (the enclosing TD)
1884
- for (level = p.parentNode; level.tagName !== 'TD'; level = level.parentNode) {
1885
- if (typeof level === 'undefined') {
1886
- alert('Not enclosed in TD!');
1887
- return;
1888
- }
1889
- }
1890
- UI.log.debug('Collapsing subject ' + subject);
1891
- let myview;
1892
- if (statement) {
1893
- UI.log.debug('looking up pred ' + statement.predicate.uri + 'in defaults');
1894
- myview = views.defaults[statement.predicate.uri];
1895
- }
1896
- UI.log.debug('view= ' + myview);
1897
- let deleteNode;
1898
- if (level.parentNode.parentNode.id === 'outline') {
1899
- deleteNode = level.parentNode;
1900
- }
1901
- thisOutline.replaceTD(thisOutline.outlineObjectTD(subject, myview, deleteNode, statement), level);
1902
- } // outlineCollapse
1903
-
1904
- this.replaceTD = function replaceTD(newTd, replacedTd) {
1905
- let reselect;
1906
- if (selected(replacedTd)) reselect = true;
1907
-
1908
- // deselects everything being collapsed. This goes backwards because
1909
- // deselecting an element decreases selection.length
1910
- for (let x = selection.length - 1; x > -1; x--) {
1911
- for (let elt = selection[x]; elt.parentNode; elt = elt.parentNode) {
1912
- if (elt === replacedTd) {
1913
- setSelected(selection[x], false);
1914
- }
1915
- }
1916
- }
1917
- replacedTd.parentNode.replaceChild(newTd, replacedTd);
1918
- if (reselect) setSelected(newTd, true);
1919
- };
1920
- function outlineRefocus(p, subject) {
1921
- // Shift-expand or shift-collapse: Maximize
1922
- let outer = null;
1923
- for (let level = p.parentNode; level; level = level.parentNode) {
1924
- UI.log.debug('level ' + level.tagName);
1925
- if (level.tagName === 'TD') outer = level;
1926
- } // find outermost td
1927
- UI.utils.emptyNode(outer).appendChild(propertyTable(subject));
1928
- setUrlBarAndTitle(subject);
1929
- // dom.title = UI.utils.label(subject)
1930
- outer.setAttribute('about', subject.toNT());
1931
- } // outlineRefocus
1932
-
1933
- outline.outlineRefocus = outlineRefocus;
1934
-
1935
- // Inversion is turning the outline view inside-out
1936
- // It may be called eversion
1937
- /*
1938
- function outlineInversion (p, subject) { // re-root at subject
1939
- function move_root (rootTR, childTR) { // swap root with child
1940
- // @@
1941
- }
1942
- }
1943
- */
1944
- this.GotoFormURI_enterKey = function (e) {
1945
- if (e.keyCode === 13) outline.GotoFormURI(e);
1946
- };
1947
- this.GotoFormURI = function (_e) {
1948
- GotoURI(dom.getElementById('UserURI').value);
1949
- };
1950
- function GotoURI(uri) {
1951
- const subject = kb.sym(uri);
1952
- this.GotoSubject(subject, true);
1953
- }
1954
- this.GotoURIinit = function (uri) {
1955
- const subject = kb.sym(uri);
1956
- this.GotoSubject(subject);
1957
- };
1958
-
1959
- /** Display the subject in an outline view
1960
- @param subject -- RDF term for teh thing to be presented
1961
- @param expand -- flag -- open the subject rather than keep folded closed
1962
- @param pane -- optional -- pane to be used for expanded display
1963
- @param solo -- optional -- the window will be cleared out and only the subject displayed
1964
- @param referer -- optional -- where did we hear about this from anyway?
1965
- @param table -- option -- default is an HTML table element in which to put the outline.
1966
- */
1967
- this.GotoSubject = function (subject, expand, pane, solo, referrer, table) {
1968
- table = table || getOutlineContainer('OutlineView'); // if does not exist create a compatible host in the current shell
1969
- if (solo) {
1970
- UI.utils.emptyNode(table);
1971
- table.style.width = '100%';
1972
- }
1973
- function GotoSubjectDefault() {
1974
- const tr = dom.createElement('TR');
1975
- tr.style.verticalAlign = 'top';
1976
- table.appendChild(tr);
1977
- const td = thisOutline.outlineObjectTD(subject, undefined, tr);
1978
- tr.appendChild(td);
1979
- return td;
1980
- }
1981
- const td = GotoSubjectDefault();
1982
- if (solo) setUrlBarAndTitle(subject); // dom.title = UI.utils.label(subject) // 'Tabulator: '+ No need to advertize
1983
-
1984
- if (expand) {
1985
- outlineExpand(td, subject, {
1986
- pane,
1987
- solo
1988
- });
1989
- const tr = td.parentNode;
1990
- UI.utils.getEyeFocus(tr, false, undefined, window); // instantly: false
1991
- }
1992
- if (solo && dom && dom.defaultView && dom.defaultView.history &&
1993
- // Don't add the new location to the history if we arrived here through a direct link
1994
- // (i.e. when static/databrowser.html in node-solid-server called this method):
1995
- document.location.href !== subject.uri) {
1996
- const stateObj = pane ? {
1997
- paneName: pane.name
1998
- } : {};
1999
- try {
2000
- const currentUrl = new URL(document.location.href);
2001
- const targetUrl = new URL(subject.uri, document.location.href);
2002
- if (currentUrl.origin === targetUrl.origin) {
2003
- dom.defaultView.history.pushState(stateObj, subject.uri, subject.uri);
2004
- }
2005
- } catch (e) {
2006
- console.log(e);
2007
- }
2008
- }
2009
- return subject;
2010
- };
2011
-
2012
- // / /////////////////////////////////////////////////////
2013
- //
2014
- //
2015
- // VIEWS
2016
- //
2017
- //
2018
- // / /////////////////////////////////////////////////////
2019
-
2020
- const ns = UI.ns;
2021
- const views = (0, _propertyViews.propertyViews)(dom);
2022
-
2023
- // var thisOutline = this dup
2024
- /** some builtin simple views **/
2025
-
2026
- function viewAsBoringDefault(obj) {
2027
- // UI.log.debug('entered viewAsBoringDefault...');
2028
- let rep; // representation in html
2029
-
2030
- if (obj.termType === 'Literal') {
2031
- const styles = {
2032
- integer: 'text-align: right;',
2033
- decimal: 'text-align: \'.\';',
2034
- double: 'text-align: \'.\';'
2035
- };
2036
- rep = dom.createElement('span');
2037
- rep.textContent = obj.value;
2038
- // Newlines have effect and overlong lines wrapped automatically
2039
- let style = '';
2040
- if (obj.datatype && obj.datatype.uri) {
2041
- const xsd = UI.ns.xsd('').uri;
2042
- if (obj.datatype.uri.slice(0, xsd.length) === xsd) {
2043
- style = styles[obj.datatype.uri.slice(xsd.length)];
2044
- }
2045
- }
2046
- rep.setAttribute('style', style || 'white-space: pre-wrap;');
2047
- } else if (obj.termType === 'NamedNode' || obj.termType === 'BlankNode') {
2048
- rep = dom.createElement('span');
2049
- rep.setAttribute('about', obj.toNT());
2050
- thisOutline.appendAccessIcons(kb, rep, obj);
2051
- if (obj.termType === 'NamedNode') {
2052
- if (obj.uri.slice(0, 4) === 'tel:') {
2053
- const num = obj.uri.slice(4);
2054
- const anchor = dom.createElement('a');
2055
- rep.appendChild(dom.createTextNode(num));
2056
- anchor.setAttribute('href', obj.uri);
2057
- anchor.appendChild(UI.utils.AJARImage(_outlineIcons.outlineIcons.src.icon_telephone, 'phone', 'phone ' + num, dom));
2058
- rep.appendChild(anchor);
2059
- anchor.firstChild.setAttribute('class', 'phoneIcon');
2060
- } else {
2061
- // not tel:
2062
- rep.appendChild(dom.createTextNode(UI.utils.label(obj)));
2063
- const anchor = UI.widgets.linkIcon(dom, obj);
2064
- rep.appendChild(anchor);
2065
- UI.widgets.makeDraggable(rep, obj); // 2017
2066
- }
2067
- } else {
2068
- // bnode
2069
- rep.appendChild(dom.createTextNode(UI.utils.label(obj)));
2070
- }
2071
- } else if (obj.termType === 'Collection') {
2072
- // obj.elements is an array of the elements in the collection
2073
- rep = dom.createElement('table');
2074
- rep.classList.add('tableFullWidth');
2075
- rep.setAttribute('about', obj.toNT());
2076
- /* Not sure which looks best -- with or without. I think without
2077
- var tr = rep.appendChild(document.createElement('tr'));
2078
- tr.appendChild(document.createTextNode(
2079
- obj.elements.length ? '(' + obj.elements.length+')' : '(none)'));
2080
- */
2081
- for (let i = 0; i < obj.elements.length; i++) {
2082
- const elt = obj.elements[i];
2083
- const row = rep.appendChild(dom.createElement('tr'));
2084
- const numcell = row.appendChild(dom.createElement('td'));
2085
- numcell.classList.add('obj');
2086
- numcell.setAttribute('notSelectable', 'false');
2087
- numcell.setAttribute('about', obj.toNT());
2088
- numcell.innerHTML = i + 1 + ')';
2089
- row.appendChild(thisOutline.outlineObjectTD(elt));
2090
- }
2091
- } else if (obj.termType === 'Graph') {
2092
- rep = paneRegistry.byName('dataContentPane').statementsAsTables(obj.statements, context);
2093
- rep.setAttribute('class', 'nestedFormula');
2094
- } else {
2095
- UI.log.error('Object ' + obj + ' has unknown term type: ' + obj.termType);
2096
- rep = dom.createTextNode('[unknownTermType:' + obj.termType + ']');
2097
- } // boring defaults.
2098
- UI.log.debug('contents: ' + rep.innerHTML);
2099
- return rep;
2100
- } // boring_default
2101
-
2102
- this.createTabURI = function () {
2103
- dom.getElementById('UserURI').value = dom.URL + '?uri=' + dom.getElementById('UserURI').value;
2104
- };
2105
-
2106
- // a way to expose variables to UserInput without making them propeties/methods
2107
- this.UserInput.setSelected = setSelected;
2108
- this.UserInput.deselectAll = deselectAll;
2109
- this.UserInput.views = views;
2110
- this.outlineExpand = outlineExpand;
2111
-
2112
- // this.panes = panes; // Allow external panes to register
2113
-
2114
- return this;
2115
- } // END OF OUTLINE