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