solid-panes 3.7.3 → 4.0.0-cc645f25

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