solid-panes 3.5.11 → 3.5.14-alpha

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 (85) hide show
  1. package/.github/workflows/ci.yml +1 -1
  2. package/README.md +4 -0
  3. package/lib/dashboard/basicPreferences.js +193 -264
  4. package/lib/dashboard/basicPreferences.js.map +1 -1
  5. package/lib/dashboard/dashboardPane.d.ts.map +1 -1
  6. package/lib/dashboard/dashboardPane.js +57 -75
  7. package/lib/dashboard/dashboardPane.js.map +1 -1
  8. package/lib/dashboard/homepage.js +98 -100
  9. package/lib/dashboard/homepage.js.map +1 -1
  10. package/lib/form/pane.js +1 -1
  11. package/lib/form/pane.js.map +1 -1
  12. package/lib/home/homePane.js +112 -103
  13. package/lib/home/homePane.js.map +1 -1
  14. package/lib/humanReadablePane.js +55 -23
  15. package/lib/humanReadablePane.js.map +1 -1
  16. package/lib/index.d.ts +2 -1
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +49 -89
  19. package/lib/index.js.map +1 -1
  20. package/lib/internal/internalPane.js +180 -200
  21. package/lib/internal/internalPane.js.map +1 -1
  22. package/lib/mainPage/footer.d.ts +3 -0
  23. package/lib/mainPage/footer.d.ts.map +1 -0
  24. package/lib/mainPage/footer.js +20 -0
  25. package/lib/mainPage/footer.js.map +1 -0
  26. package/lib/mainPage/header.d.ts +2 -0
  27. package/lib/mainPage/header.d.ts.map +1 -0
  28. package/lib/mainPage/header.js +142 -0
  29. package/lib/mainPage/header.js.map +1 -0
  30. package/lib/mainPage/index.d.ts +3 -0
  31. package/lib/mainPage/index.d.ts.map +1 -0
  32. package/lib/mainPage/index.js +63 -0
  33. package/lib/mainPage/index.js.map +1 -0
  34. package/lib/microblogPane/microblogPane.js +1 -1
  35. package/lib/outline/context.d.ts +2 -2
  36. package/lib/outline/context.d.ts.map +1 -1
  37. package/lib/outline/context.js +13 -17
  38. package/lib/outline/context.js.map +1 -1
  39. package/lib/outline/manager.js +178 -150
  40. package/lib/outline/manager.js.map +1 -1
  41. package/lib/outline/propertyViews.js +32 -46
  42. package/lib/outline/propertyViews.js.map +1 -1
  43. package/lib/outline/userInput.js +1 -1
  44. package/lib/outline/viewAsImage.js +22 -19
  45. package/lib/outline/viewAsImage.js.map +1 -1
  46. package/lib/outline/viewAsMbox.js +5 -15
  47. package/lib/outline/viewAsMbox.js.map +1 -1
  48. package/lib/pad/padPane.js +406 -451
  49. package/lib/pad/padPane.js.map +1 -1
  50. package/lib/profile/editProfile.view.js +101 -124
  51. package/lib/profile/editProfile.view.js.map +1 -1
  52. package/lib/profile/profile.dom.js +12 -17
  53. package/lib/profile/profile.dom.js.map +1 -1
  54. package/lib/registerPanes.js +1 -1
  55. package/lib/registerPanes.js.map +1 -1
  56. package/lib/sharing/sharingPane.js +33 -45
  57. package/lib/sharing/sharingPane.js.map +1 -1
  58. package/lib/tabbed/tabbedPane.js +87 -77
  59. package/lib/tabbed/tabbedPane.js.map +1 -1
  60. package/lib/trustedApplications/trustedApplications.dom.js +173 -182
  61. package/lib/trustedApplications/trustedApplications.dom.js.map +1 -1
  62. package/lib/trustedApplications/trustedApplications.test.js +1 -1
  63. package/lib/trustedApplications/trustedApplications.utils.js +30 -36
  64. package/lib/trustedApplications/trustedApplications.utils.js.map +1 -1
  65. package/lib/trustedApplications/trustedApplications.view.js +91 -99
  66. package/lib/trustedApplications/trustedApplications.view.js.map +1 -1
  67. package/lib/types.js +1 -4
  68. package/lib/types.js.map +1 -1
  69. package/lib/versionInfo.d.ts +0 -1
  70. package/lib/versionInfo.d.ts.map +1 -1
  71. package/lib/versionInfo.js +23 -29
  72. package/lib/versionInfo.js.map +1 -1
  73. package/package.json +22 -21
  74. package/src/dashboard/dashboardPane.ts +5 -3
  75. package/src/form/pane.js +1 -1
  76. package/src/humanReadablePane.js +38 -14
  77. package/src/index.ts +4 -3
  78. package/src/mainPage/footer.ts +19 -0
  79. package/src/mainPage/header.ts +75 -0
  80. package/src/mainPage/index.ts +20 -0
  81. package/src/outline/context.ts +2 -2
  82. package/src/outline/manager.js +26 -16
  83. package/src/registerPanes.js +2 -2
  84. package/src/versionInfo.ts +18 -19
  85. package/webpack.config.js +1 -1
@@ -0,0 +1,75 @@
1
+ import { icons, authn, initHeader } from 'solid-ui'
2
+ /**
3
+ * menu icons
4
+ */
5
+ const HELP_MENU_ICON = icons.iconBase + 'noun_help.svg'
6
+ const SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg'
7
+
8
+ /**
9
+ * menu elements
10
+ */
11
+ const USER_GUIDE_MENU_ITEM = 'User guide'
12
+ const REPORT_A_PROBLEM_MENU_ITEM = 'Report a problem'
13
+ const SHOW_YOUR_PROFILE_MENU_ITEM = 'Show your profile'
14
+ const LOG_OUT_MENU_ITEM = 'Log out'
15
+ /**
16
+ * URLS
17
+ */
18
+ const USER_GUIDE_MENU_URL = 'https://solid.github.io/userguide/'
19
+ const REPORT_A_PROBLEM_MENU_URL = 'https://github.com/solid/solidos/issues'
20
+
21
+ export async function createHeader (store, outliner) {
22
+ initHeader(store, await setUserMenu(outliner), setHeaderOptions())
23
+ }
24
+
25
+ function setHeaderOptions () {
26
+ const helpMenuList = [
27
+ { label: USER_GUIDE_MENU_ITEM, url: USER_GUIDE_MENU_URL, target: '_blank' },
28
+ { label: REPORT_A_PROBLEM_MENU_ITEM, url: REPORT_A_PROBLEM_MENU_URL, target: '_blank' }
29
+ ]
30
+ const headerOptions = { logo: SOLID_ICON_URL, helpIcon: HELP_MENU_ICON, helpMenuList: helpMenuList }
31
+
32
+ return headerOptions
33
+ }
34
+
35
+ async function setUserMenu (outliner: any) {
36
+ const showProfile = {
37
+ label: SHOW_YOUR_PROFILE_MENU_ITEM,
38
+ onclick: () => openUserProfile(outliner)
39
+ }
40
+
41
+ const logOut = {
42
+ label: LOG_OUT_MENU_ITEM,
43
+ onclick: () => {
44
+ authn.authSession.logout()
45
+ }
46
+ }
47
+
48
+ // the order of the menu is important here, show profile first and logout last
49
+ let userMenuList = [showProfile]
50
+ userMenuList = userMenuList.concat(await getMenuItems(outliner))
51
+ userMenuList.push(logOut)
52
+
53
+ return userMenuList
54
+ }
55
+
56
+ function openUserProfile (outliner: any) {
57
+ outliner.GotoSubject(authn.currentUser(), true, undefined, true, undefined)
58
+ location.reload()
59
+ }
60
+
61
+ async function getMenuItems (outliner: any) {
62
+ const items = await outliner.getDashboardItems()
63
+ return items.map((element) => {
64
+ return {
65
+ label: element.label,
66
+ onclick: () => openDashboardPane(outliner, element.tabName || element.paneName)
67
+ }
68
+ })
69
+ }
70
+
71
+ async function openDashboardPane (outliner: any, pane: string): Promise<void> {
72
+ outliner.showDashboard({
73
+ pane
74
+ })
75
+ }
@@ -0,0 +1,20 @@
1
+ /* Main Page
2
+ **
3
+ ** This code is called in mashlib and renders the header and footer of the Databrowser.
4
+ */
5
+
6
+ import { IndexedFormula, NamedNode } from 'rdflib'
7
+ import { getOutliner } from '../index'
8
+ import { createHeader } from './header'
9
+ import { createFooter } from './footer'
10
+
11
+ export default async function initMainPage (store: IndexedFormula, uri?: string|NamedNode|null) {
12
+ const outliner = getOutliner(document)
13
+ uri = uri || window.location.href
14
+ let subject = uri
15
+ if (typeof uri === 'string') subject = store.sym(uri)
16
+ outliner.GotoSubject(subject, true, undefined, true, undefined)
17
+ const header = createHeader(store, outliner)
18
+ const footer = createFooter(store)
19
+ return Promise.all([header, footer])
20
+ }
@@ -1,6 +1,6 @@
1
- import { DataBrowserContext, LiveStore, PaneRegistry } from 'pane-registry'
1
+ import { DataBrowserContext, PaneRegistry } from 'pane-registry'
2
2
  import { getOutliner } from '../index'
3
- import { SolidLogic } from 'solid-logic'
3
+ import { SolidLogic, LiveStore } from 'solid-logic'
4
4
 
5
5
  export function createContext (
6
6
  dom: HTMLDocument,
@@ -392,6 +392,7 @@ export default function (context) {
392
392
 
393
393
  async function getDashboardItems () {
394
394
  const me = UI.authn.currentUser()
395
+ if (!me) return []
395
396
  const div = dom.createElement('div')
396
397
  const [books, pods] = await Promise.all([getAddressBooks(), getPods()])
397
398
  return [
@@ -416,7 +417,7 @@ export default function (context) {
416
417
 
417
418
  async function getPods () {
418
419
  async function addPodRoot (pod) { // namedNode
419
- await kb.fetcher.load(pod, { headers: { accept: 'text/turtle' } })
420
+ await checkForContainerRepresentation(pod)
420
421
  if (kb.holds(pod, ns.rdf('type'), ns.space('Storage'), pod.doc())) {
421
422
  pods.push(pod)
422
423
  return true
@@ -444,25 +445,17 @@ export default function (context) {
444
445
  const pods = kb.each(me, ns.space('storage'), null, me.doc())
445
446
 
446
447
  try {
447
- if (pods.length) {
448
- // make sure container representation is loaded (when server returns index.html)
449
- // TODO reorder to have 'me' in first position
450
- pods.map(async pod => {
451
- if (!kb.any(pod, ns.ldp('contains'), undefined, pod.doc())) {
452
- await kb.fetcher.load(pod, { headers: { accept: 'text/turtle' } })
453
- }
454
- })
455
- } else { // try to find podRoot from url
456
- await addPodRootFromUrl(me.uri)
457
- }
458
- await addPodRootFromUrl(window.location.href.substring(0, window.location.href.lastIndexOf('/') + 1))
448
+ // if uri then SolidOS is a browse.html web app
449
+ const uri = (new URL(window.location.href)).searchParams.get('uri')
450
+ const podUrl = uri || window.location.href
451
+ await addPodRootFromUrl(podUrl.substring(0, podUrl.lastIndexOf('/') + 1))
459
452
  } catch (err) {
460
453
  console.error('cannot load container', err)
461
- return []
462
454
  }
455
+ if (!pods.length) return []
463
456
  return pods.map((pod, index) => {
464
- const label =
465
- pods.length > 1 ? pod.uri.split('//')[1].slice(0, -1) : 'Your storage'
457
+ function split (item) { return item.uri.split('//')[1].slice(0, -1) }
458
+ const label = split(me).startsWith(split(pod)) ? 'Your storage' : split(pod)
466
459
  return {
467
460
  paneName: 'folder',
468
461
  tabName: `folder-${index}`,
@@ -532,6 +525,12 @@ export default function (context) {
532
525
  // finally - switch to showing dashboard
533
526
  outlineContainer.style.display = 'none'
534
527
  dashboardContainer.appendChild(dashboard)
528
+ const tab = dashboardContainer.querySelector(
529
+ `[data-global-pane-name="${options.pane}"]`
530
+ )
531
+ if (tab) {
532
+ tab.click()
533
+ }
535
534
 
536
535
  function closeDashboard () {
537
536
  dashboardContainer.style.display = 'none'
@@ -567,7 +566,18 @@ export default function (context) {
567
566
  )
568
567
  }
569
568
 
569
+ async function checkForContainerRepresentation (subject) {
570
+ // force reload for index.html with RDFa
571
+ if (!kb.any(subject, ns.ldp('contains'), undefined, subject.doc())) {
572
+ const response = await kb.fetcher.webOperation('GET', subject.uri, kb.fetcher.initFetchOptions(subject.uri, { headers: { accept: 'text/turtle' } }))
573
+ const containerTurtle = response.responseText
574
+ $rdf.parse(containerTurtle, kb, subject.uri, 'text/turtle')
575
+ }
576
+ }
577
+
570
578
  async function getRelevantPanes (subject, context) {
579
+ // make sure container representation is loaded (when server returns index.html)
580
+ if (subject.uri.endsWith('/')) { await checkForContainerRepresentation(subject) }
571
581
  const panes = context.session.paneRegistry
572
582
  const relevantPanes = panes.list.filter(
573
583
  pane => pane.label(subject, context) && !pane.global
@@ -13,7 +13,6 @@ module.exports = function registerPanes (register) {
13
13
  register(require('issue-pane'))
14
14
  register(require('contacts-pane'))
15
15
  register(require('activitystreams-pane'))
16
- register(require('markdown-pane').Pane)
17
16
 
18
17
  register(require('./pad/padPane'))
19
18
  // register(require('./argument/argumentPane.js')) // A position in an argument tree
@@ -54,8 +53,9 @@ module.exports = function registerPanes (register) {
54
53
  register(require('./socialPane.js'))
55
54
 
56
55
  register(require('./humanReadablePane.js')) // A web page as a web page -- how to escape to tabr?
57
- register(require('./dataContentPane.js')) // Preferred for a data file
56
+ // register(require('markdown-pane').Pane) // replaced by markdown in humanReadablePane
58
57
 
58
+ register(require('./dataContentPane.js')) // Preferred for a data file
59
59
  register(require('source-pane')) // edit source
60
60
  register(require('./n3Pane.js'))
61
61
  register(require('./RDFXMLPane.js'))
@@ -1,25 +1,24 @@
1
1
  export default {
2
- buildTime: '2021-11-09T21:16:26Z',
3
- commit: '354975d41e78769bf91d72a0c115bb9dc3bad510',
2
+ buildTime: '2022-01-18T23:23:17Z',
3
+ commit: '36b208831217a00e6be5f0fb39a379468f906c2b',
4
4
  npmInfo:
5
5
  {
6
- 'solid-panes': '3.5.10',
7
- npm: '6.10.0',
8
- ares: '1.15.0',
9
- brotli: '1.0.7',
10
- cldr: '35.1',
11
- http_parser: '2.8.0',
12
- icu: '64.2',
13
- llhttp: '1.1.4',
14
- modules: '72',
15
- napi: '4',
16
- nghttp2: '1.39.1',
17
- node: '12.7.0',
18
- openssl: '1.1.1c',
19
- tz: '2019a',
20
- unicode: '12.1',
21
- uv: '1.30.1',
22
- v8: '7.5.288.22-node.16',
6
+ 'solid-panes': '3.5.14',
7
+ npm: '6.14.13',
8
+ ares: '1.17.1',
9
+ brotli: '1.0.9',
10
+ cldr: '39.0',
11
+ icu: '69.1',
12
+ llhttp: '2.1.3',
13
+ modules: '83',
14
+ napi: '8',
15
+ nghttp2: '1.42.0',
16
+ node: '14.17.3',
17
+ openssl: '1.1.1k',
18
+ tz: '2021a',
19
+ unicode: '13.0',
20
+ uv: '1.41.0',
21
+ v8: '8.4.371.23-node.67',
23
22
  zlib: '1.2.11'
24
23
  }
25
24
  }
package/webpack.config.js CHANGED
@@ -38,7 +38,7 @@ module.exports = [{
38
38
  '@trust/webcrypto': 'crypto'
39
39
  },
40
40
  devServer: {
41
- contentBase: path.join(__dirname, 'dist'),
41
+ static: path.join(__dirname, 'dist'),
42
42
  compress: true,
43
43
  port: 9000
44
44
  },