solid-panes 3.5.28-alpha → 3.5.29-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 (119) hide show
  1. package/README.md +0 -2
  2. package/lib/RDFXMLPane.js +6 -8
  3. package/lib/RDFXMLPane.js.map +1 -1
  4. package/lib/argument/argumentPane.js +10 -11
  5. package/lib/argument/argumentPane.js.map +1 -1
  6. package/lib/attach/attachPane.js +47 -85
  7. package/lib/attach/attachPane.js.map +1 -1
  8. package/lib/audio/audioPane.js +11 -36
  9. package/lib/audio/audioPane.js.map +1 -1
  10. package/lib/classInstancePane.js +11 -20
  11. package/lib/classInstancePane.js.map +1 -1
  12. package/lib/dashboard/basicPreferences.js +3 -53
  13. package/lib/dashboard/basicPreferences.js.map +1 -1
  14. package/lib/dashboard/dashboardPane.js +2 -18
  15. package/lib/dashboard/dashboardPane.js.map +1 -1
  16. package/lib/dashboard/homepage.js +1 -19
  17. package/lib/dashboard/homepage.js.map +1 -1
  18. package/lib/dataContentPane.js +15 -58
  19. package/lib/dataContentPane.js.map +1 -1
  20. package/lib/defaultPane.js +13 -21
  21. package/lib/defaultPane.js.map +1 -1
  22. package/lib/dokieli/dokieliPane.js +19 -28
  23. package/lib/dokieli/dokieliPane.js.map +1 -1
  24. package/lib/dokieli/new.js.map +1 -1
  25. package/lib/form/pane.js +26 -40
  26. package/lib/form/pane.js.map +1 -1
  27. package/lib/home/homePane.js +7 -23
  28. package/lib/home/homePane.js.map +1 -1
  29. package/lib/humanReadablePane.js +14 -28
  30. package/lib/humanReadablePane.js.map +1 -1
  31. package/lib/imagePane.js +9 -13
  32. package/lib/imagePane.js.map +1 -1
  33. package/lib/index.js +4 -18
  34. package/lib/index.js.map +1 -1
  35. package/lib/internal/internalPane.js +10 -41
  36. package/lib/internal/internalPane.js.map +1 -1
  37. package/lib/mainPage/footer.js +0 -4
  38. package/lib/mainPage/footer.js.map +1 -1
  39. package/lib/mainPage/header.js +2 -28
  40. package/lib/mainPage/header.js.map +1 -1
  41. package/lib/mainPage/index.js +1 -12
  42. package/lib/mainPage/index.js.map +1 -1
  43. package/lib/microblogPane/microblogPane.js +100 -237
  44. package/lib/microblogPane/microblogPane.js.map +1 -1
  45. package/lib/n3Pane.js +2 -7
  46. package/lib/n3Pane.js.map +1 -1
  47. package/lib/outline/context.js +0 -2
  48. package/lib/outline/context.js.map +1 -1
  49. package/lib/outline/licenseOptions.js +9 -25
  50. package/lib/outline/licenseOptions.js.map +1 -1
  51. package/lib/outline/manager.js +178 -580
  52. package/lib/outline/manager.js.map +1 -1
  53. package/lib/outline/manager.test.js +1 -11
  54. package/lib/outline/manager.test.js.map +1 -1
  55. package/lib/outline/outlineIcons.js +30 -25
  56. package/lib/outline/outlineIcons.js.map +1 -1
  57. package/lib/outline/propertyViews.js +0 -10
  58. package/lib/outline/propertyViews.js.map +1 -1
  59. package/lib/outline/propertyViews.test.js +1 -3
  60. package/lib/outline/propertyViews.test.js.map +1 -1
  61. package/lib/outline/queryByExample.js +24 -76
  62. package/lib/outline/queryByExample.js.map +1 -1
  63. package/lib/outline/userInput.js +214 -454
  64. package/lib/outline/userInput.js.map +1 -1
  65. package/lib/outline/viewAsImage.js +0 -6
  66. package/lib/outline/viewAsImage.js.map +1 -1
  67. package/lib/outline/viewAsMbox.js +3 -4
  68. package/lib/outline/viewAsMbox.js.map +1 -1
  69. package/lib/pad/padPane.js +45 -93
  70. package/lib/pad/padPane.js.map +1 -1
  71. package/lib/playlist/playlistPane.js +3 -20
  72. package/lib/playlist/playlistPane.js.map +1 -1
  73. package/lib/profile/editProfile.view.js +7 -24
  74. package/lib/profile/editProfile.view.js.map +1 -1
  75. package/lib/profile/profile.dom.js +0 -3
  76. package/lib/profile/profile.dom.js.map +1 -1
  77. package/lib/registerPanes.js +29 -27
  78. package/lib/registerPanes.js.map +1 -1
  79. package/lib/schedule/formsForSchedule.js.map +1 -1
  80. package/lib/schedule/schedulePane.js +62 -122
  81. package/lib/schedule/schedulePane.js.map +1 -1
  82. package/lib/sharing/sharingPane.js +2 -10
  83. package/lib/sharing/sharingPane.js.map +1 -1
  84. package/lib/slideshow/slideshowPane.js +9 -14
  85. package/lib/slideshow/slideshowPane.js.map +1 -1
  86. package/lib/socialPane.js +43 -124
  87. package/lib/socialPane.js.map +1 -1
  88. package/lib/tabbed/tabbedPane.js +1 -15
  89. package/lib/tabbed/tabbedPane.js.map +1 -1
  90. package/lib/tableViewPane.js +4 -7
  91. package/lib/tableViewPane.js.map +1 -1
  92. package/lib/test-import-export/common.js +2 -1
  93. package/lib/test-import-export/common.js.map +1 -1
  94. package/lib/test-import-export/edit-importer.js +7 -9
  95. package/lib/test-import-export/edit-importer.js.map +1 -1
  96. package/lib/transaction/pane.js +31 -90
  97. package/lib/transaction/pane.js.map +1 -1
  98. package/lib/transaction/period.js +20 -71
  99. package/lib/transaction/period.js.map +1 -1
  100. package/lib/trip/tripPane.js +30 -34
  101. package/lib/trip/tripPane.js.map +1 -1
  102. package/lib/trustedApplications/trustedApplications.dom.js +8 -34
  103. package/lib/trustedApplications/trustedApplications.dom.js.map +1 -1
  104. package/lib/trustedApplications/trustedApplications.test.js +3 -8
  105. package/lib/trustedApplications/trustedApplications.test.js.map +1 -1
  106. package/lib/trustedApplications/trustedApplications.utils.js +0 -10
  107. package/lib/trustedApplications/trustedApplications.utils.js.map +1 -1
  108. package/lib/trustedApplications/trustedApplications.view.js +1 -22
  109. package/lib/trustedApplications/trustedApplications.view.js.map +1 -1
  110. package/lib/ui/pane.js +22 -28
  111. package/lib/ui/pane.js.map +1 -1
  112. package/lib/versionInfo.d.ts +2 -0
  113. package/lib/versionInfo.d.ts.map +1 -1
  114. package/lib/versionInfo.js +18 -16
  115. package/lib/versionInfo.js.map +1 -1
  116. package/lib/video/videoPane.js +2 -5
  117. package/lib/video/videoPane.js.map +1 -1
  118. package/package.json +24 -24
  119. package/src/versionInfo.ts +18 -16
@@ -6,33 +6,35 @@
6
6
  ** The dokeili system allows the user to edit a document including anotations
7
7
  ** review. It does not use turtle, but RDF/a
8
8
  */
9
- var UI = require('solid-ui');
10
9
 
10
+ var UI = require('solid-ui');
11
11
  var $rdf = require('rdflib');
12
+ var mime = require('mime-types');
12
13
 
13
- var mime = require('mime-types'); // const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok
14
-
14
+ // const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok
15
15
 
16
16
  var DOKIELI_TEMPLATE = require('./new.js'); // Distributed with this library
17
17
 
18
-
19
18
  module.exports = {
20
19
  icon: UI.icons.iconBase + 'dokieli-logo.png',
21
20
  // @@ improve? more like doccument?
21
+
22
22
  name: 'Dokieli',
23
23
  mintClass: UI.ns.solid('DokieliDocument'),
24
24
  // @@ A better class?
25
+
25
26
  label: function label(subject, context) {
26
27
  var kb = context.session.store;
27
28
  var ns = UI.ns;
28
- var allowed = [// 'text/plain',
29
- 'text/html', 'application/xhtml+xml' // 'image/png', 'image/jpeg', 'application/pdf',
29
+ var allowed = [
30
+ // 'text/plain',
31
+ 'text/html', 'application/xhtml+xml'
32
+ // 'image/png', 'image/jpeg', 'application/pdf',
30
33
  // 'video/mp4'
31
34
  ];
32
35
 
33
36
  var hasContentTypeIn = function hasContentTypeIn(kb, x, displayables) {
34
37
  var cts = kb.fetcher.getHeader(x, 'content-type');
35
-
36
38
  if (cts) {
37
39
  for (var j = 0; j < cts.length; j++) {
38
40
  for (var k = 0; k < displayables.length; k++) {
@@ -42,56 +44,44 @@ module.exports = {
42
44
  }
43
45
  }
44
46
  }
45
-
46
47
  return false;
47
- }; // This data coul d come from a fetch OR from ldp comtaimner
48
-
48
+ };
49
49
 
50
+ // This data coul d come from a fetch OR from ldp comtaimner
50
51
  var hasContentTypeIn2 = function hasContentTypeIn2(kb, x, displayables) {
51
52
  var t = kb.findTypeURIs(subject);
52
-
53
53
  for (var k = 0; k < displayables.length; k++) {
54
54
  if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {
55
55
  return true;
56
56
  }
57
57
  }
58
-
59
58
  return false;
60
59
  };
61
-
62
60
  if (!subject.uri) return null; // no bnodes
63
61
 
64
62
  var t = kb.findTypeURIs(subject);
65
63
  if (t[ns.link('WebPage').uri]) return 'view';
66
-
67
64
  if (hasContentTypeIn(kb, subject, allowed) || hasContentTypeIn2(kb, subject, allowed)) {
68
65
  return 'Dok';
69
66
  }
70
-
71
67
  return null;
72
68
  },
73
69
  // Create a new folder in a Solid system, with a dokieli editable document in it
74
70
  mintNew: function mintNew(context, newPaneOptions) {
75
71
  var kb = context.session.store;
76
72
  var newInstance = newPaneOptions.newInstance;
77
-
78
73
  if (!newInstance) {
79
74
  var uri = newPaneOptions.newBase;
80
-
81
75
  if (uri.endsWith('/')) {
82
76
  uri = uri.slice(0, -1);
83
77
  newPaneOptions.newBase = uri;
84
78
  }
85
-
86
79
  newInstance = kb.sym(uri);
87
80
  }
88
-
89
81
  var contentType = mime.lookup(newInstance.uri);
90
-
91
82
  if (!contentType || !contentType.includes('html')) {
92
83
  newInstance = $rdf.sym(newInstance.uri + '.html');
93
84
  }
94
-
95
85
  newPaneOptions.newInstance = newInstance; // Save for creation system
96
86
 
97
87
  console.log('New dokieli will make: ' + newInstance);
@@ -118,36 +108,37 @@ module.exports = {
118
108
  render: function render(subject, context) {
119
109
  var myDocument = context.dom;
120
110
  var div = myDocument.createElement('div');
121
- var kb = context.session.store; // @@ When we can, use CSP to turn off scripts within the iframe
111
+ var kb = context.session.store;
122
112
 
113
+ // @@ When we can, use CSP to turn off scripts within the iframe
123
114
  div.setAttribute('class', 'docView');
124
115
  var iframe = myDocument.createElement('IFRAME');
125
116
  iframe.setAttribute('src', subject.uri); // allow-same-origin
126
-
127
117
  iframe.setAttribute('class', 'doc');
128
118
  var cts = kb.fetcher.getHeader(subject.doc(), 'content-type');
129
119
  var ct = cts ? cts[0] : null;
130
-
131
120
  if (ct) {
132
121
  console.log('dokieliPane: c-t:' + ct);
133
122
  } else {
134
123
  console.log('dokieliPane: unknown content-type?');
135
- } // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
124
+ }
125
+
126
+ // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
136
127
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
137
128
  // You can;'t have any sandbox and allow plugins.
138
129
  // We could sandbox only HTML files I suppose.
139
130
  // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html
140
- // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static
141
131
 
132
+ // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static
142
133
 
143
134
  iframe.setAttribute('style', 'resize = both; height: 40em; width:40em;'); // @@ improve guess
144
135
  // iframe.setAttribute('height', '480')
145
136
  // iframe.setAttribute('width', '640')
146
-
147
137
  var tr = myDocument.createElement('tr');
148
138
  tr.appendChild(iframe);
149
139
  div.appendChild(tr);
150
140
  return div;
151
141
  }
152
- }; // ends
142
+ };
143
+ // ends
153
144
  //# sourceMappingURL=dokieliPane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dokieliPane.js","names":["UI","require","$rdf","mime","DOKIELI_TEMPLATE","module","exports","icon","icons","iconBase","name","mintClass","ns","solid","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","link","mintNew","newPaneOptions","newInstance","newBase","endsWith","slice","sym","contentType","lookup","includes","console","log","htmlContents","filename","split","decodeURIComponent","encodedTitle","replace","Promise","resolve","webOperation","data","then","err","render","myDocument","dom","div","createElement","setAttribute","iframe","doc","ct","tr","appendChild"],"sources":["../../src/dokieli/dokieliPane.js"],"sourcesContent":["/* Human-readable editable \"Dokieli\" Pane\n **\n ** This outline pane contains the document contents for a Dokieli document\n ** The dokeili system allows the user to edit a document including anotations\n ** review. It does not use turtle, but RDF/a\n */\n\nconst UI = require('solid-ui')\nconst $rdf = require('rdflib')\nconst mime = require('mime-types')\n\n// const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok\n\nconst DOKIELI_TEMPLATE = require('./new.js') // Distributed with this library\n\nmodule.exports = {\n icon: UI.icons.iconBase + 'dokieli-logo.png', // @@ improve? more like doccument?\n\n name: 'Dokieli',\n\n mintClass: UI.ns.solid('DokieliDocument'), // @@ A better class?\n\n label: function (subject, context) {\n const kb = context.session.store\n const ns = UI.ns\n const allowed = [\n // 'text/plain',\n 'text/html',\n 'application/xhtml+xml'\n // 'image/png', 'image/jpeg', 'application/pdf',\n // 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data coul d come from a fetch OR from ldp comtaimner\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(subject)\n for (let k = 0; k < displayables.length; k++) {\n if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'Dok'\n }\n\n return null\n },\n\n // Create a new folder in a Solid system, with a dokieli editable document in it\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n let newInstance = newPaneOptions.newInstance\n if (!newInstance) {\n let uri = newPaneOptions.newBase\n if (uri.endsWith('/')) {\n uri = uri.slice(0, -1)\n newPaneOptions.newBase = uri\n }\n newInstance = kb.sym(uri)\n }\n\n const contentType = mime.lookup(newInstance.uri)\n if (!contentType || !contentType.includes('html')) {\n newInstance = $rdf.sym(newInstance.uri + '.html')\n }\n newPaneOptions.newInstance = newInstance // Save for creation system\n\n console.log('New dokieli will make: ' + newInstance)\n\n let htmlContents = DOKIELI_TEMPLATE\n let filename = newInstance.uri.split('/').slice(-1)[0]\n filename = decodeURIComponent(filename.split('.')[0])\n const encodedTitle = filename\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle)\n htmlContents = htmlContents.replace(\n '</article>',\n '<h1>' + encodedTitle + '</h1></article>'\n )\n console.log('@@ New HTML for Dok:' + htmlContents)\n return new Promise(function (resolve) {\n kb.fetcher\n .webOperation('PUT', newInstance.uri, {\n data: htmlContents,\n contentType: 'text/html'\n })\n .then(function () {\n console.log(\n 'new Dokieli document created at ' + newPaneOptions.newInstance\n )\n resolve(newPaneOptions)\n })\n .catch(function (err) {\n console.log(\n 'Error creating dokelili dok at ' +\n newPaneOptions.newInstance +\n ': ' +\n err\n )\n })\n })\n },\n\n // Derived from: humanReadablePane .. share code?\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const iframe = myDocument.createElement('IFRAME')\n iframe.setAttribute('src', subject.uri) // allow-same-origin\n iframe.setAttribute('class', 'doc')\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0] : null\n if (ct) {\n console.log('dokieliPane: c-t:' + ct)\n } else {\n console.log('dokieliPane: unknown content-type?')\n }\n\n // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can;'t have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n iframe.setAttribute('style', 'resize = both; height: 40em; width:40em;') // @@ improve guess\n // iframe.setAttribute('height', '480')\n // iframe.setAttribute('width', '640')\n const tr = myDocument.createElement('tr')\n tr.appendChild(iframe)\n div.appendChild(tr)\n return div\n }\n}\n// ends\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,UAAD,CAAlB;;AACA,IAAMC,IAAI,GAAGD,OAAO,CAAC,QAAD,CAApB;;AACA,IAAME,IAAI,GAAGF,OAAO,CAAC,YAAD,CAApB,C,CAEA;;;AAEA,IAAMG,gBAAgB,GAAGH,OAAO,CAAC,UAAD,CAAhC,C,CAA6C;;;AAE7CI,MAAM,CAACC,OAAP,GAAiB;EACfC,IAAI,EAAEP,EAAE,CAACQ,KAAH,CAASC,QAAT,GAAoB,kBADX;EAC+B;EAE9CC,IAAI,EAAE,SAHS;EAKfC,SAAS,EAAEX,EAAE,CAACY,EAAH,CAAMC,KAAN,CAAY,iBAAZ,CALI;EAK4B;EAE3CC,KAAK,EAAE,eAAUC,OAAV,EAAmBC,OAAnB,EAA4B;IACjC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAR,CAAgBC,KAA3B;IACA,IAAMP,EAAE,GAAGZ,EAAE,CAACY,EAAd;IACA,IAAMQ,OAAO,GAAG,CACd;IACA,WAFc,EAGd,uBAHc,CAId;IACA;IALc,CAAhB;;IAQA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAUJ,EAAV,EAAcK,CAAd,EAAiBC,YAAjB,EAA+B;MACtD,IAAMC,GAAG,GAAGP,EAAE,CAACQ,OAAH,CAAWC,SAAX,CAAqBJ,CAArB,EAAwB,cAAxB,CAAZ;;MACA,IAAIE,GAAJ,EAAS;QACP,KAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,GAAG,CAACI,MAAxB,EAAgCD,CAAC,E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GP,EAAE,CAACQ,OAAH,CAAWC,SAAX,CAAqBX,OAAO,CAACsD,GAAR,EAArB,EAAoC,cAApC,CAAZ;IACA,IAAMC,EAAE,GAAG9C,GAAG,GAAGA,GAAG,CAAC,CAAD,CAAN,GAAY,IAA1B;;IACA,IAAI8C,EAAJ,EAAQ;MACNtB,OAAO,CAACC,GAAR,CAAY,sBAAsBqB,EAAlC;IACD,CAFD,MAEO;MACLtB,OAAO,CAACC,GAAR,CAAY,oCAAZ;IACD,CAjBiC,CAmBlC;IACA;IACA;IACA;IACA;IAEA;;;IAEAmB,MAAM,CAACD,YAAP,CAAoB,OAApB,EAA6B,0CAA7B,EA3BkC,CA2BuC;IACzE;IACA;;IACA,IAAMI,EAAE,GAAGR,UAAU,CAACG,aAAX,CAAyB,IAAzB,CAAX;IACAK,EAAE,CAACC,WAAH,CAAeJ,MAAf;IACAH,GAAG,CAACO,WAAJ,CAAgBD,EAAhB;IACA,OAAON,GAAP;EACD;AAtJc,CAAjB,C,CAwJA"}
1
+ {"version":3,"file":"dokieliPane.js","names":["UI","require","$rdf","mime","DOKIELI_TEMPLATE","module","exports","icon","icons","iconBase","name","mintClass","ns","solid","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","link","mintNew","newPaneOptions","newInstance","newBase","endsWith","slice","sym","contentType","lookup","includes","console","log","htmlContents","filename","split","decodeURIComponent","encodedTitle","replace","Promise","resolve","webOperation","data","then","err","render","myDocument","dom","div","createElement","setAttribute","iframe","doc","ct","tr","appendChild"],"sources":["../../src/dokieli/dokieliPane.js"],"sourcesContent":["/* Human-readable editable \"Dokieli\" Pane\n **\n ** This outline pane contains the document contents for a Dokieli document\n ** The dokeili system allows the user to edit a document including anotations\n ** review. It does not use turtle, but RDF/a\n */\n\nconst UI = require('solid-ui')\nconst $rdf = require('rdflib')\nconst mime = require('mime-types')\n\n// const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok\n\nconst DOKIELI_TEMPLATE = require('./new.js') // Distributed with this library\n\nmodule.exports = {\n icon: UI.icons.iconBase + 'dokieli-logo.png', // @@ improve? more like doccument?\n\n name: 'Dokieli',\n\n mintClass: UI.ns.solid('DokieliDocument'), // @@ A better class?\n\n label: function (subject, context) {\n const kb = context.session.store\n const ns = UI.ns\n const allowed = [\n // 'text/plain',\n 'text/html',\n 'application/xhtml+xml'\n // 'image/png', 'image/jpeg', 'application/pdf',\n // 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data coul d come from a fetch OR from ldp comtaimner\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(subject)\n for (let k = 0; k < displayables.length; k++) {\n if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'Dok'\n }\n\n return null\n },\n\n // Create a new folder in a Solid system, with a dokieli editable document in it\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n let newInstance = newPaneOptions.newInstance\n if (!newInstance) {\n let uri = newPaneOptions.newBase\n if (uri.endsWith('/')) {\n uri = uri.slice(0, -1)\n newPaneOptions.newBase = uri\n }\n newInstance = kb.sym(uri)\n }\n\n const contentType = mime.lookup(newInstance.uri)\n if (!contentType || !contentType.includes('html')) {\n newInstance = $rdf.sym(newInstance.uri + '.html')\n }\n newPaneOptions.newInstance = newInstance // Save for creation system\n\n console.log('New dokieli will make: ' + newInstance)\n\n let htmlContents = DOKIELI_TEMPLATE\n let filename = newInstance.uri.split('/').slice(-1)[0]\n filename = decodeURIComponent(filename.split('.')[0])\n const encodedTitle = filename\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle)\n htmlContents = htmlContents.replace(\n '</article>',\n '<h1>' + encodedTitle + '</h1></article>'\n )\n console.log('@@ New HTML for Dok:' + htmlContents)\n return new Promise(function (resolve) {\n kb.fetcher\n .webOperation('PUT', newInstance.uri, {\n data: htmlContents,\n contentType: 'text/html'\n })\n .then(function () {\n console.log(\n 'new Dokieli document created at ' + newPaneOptions.newInstance\n )\n resolve(newPaneOptions)\n })\n .catch(function (err) {\n console.log(\n 'Error creating dokelili dok at ' +\n newPaneOptions.newInstance +\n ': ' +\n err\n )\n })\n })\n },\n\n // Derived from: humanReadablePane .. share code?\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const iframe = myDocument.createElement('IFRAME')\n iframe.setAttribute('src', subject.uri) // allow-same-origin\n iframe.setAttribute('class', 'doc')\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0] : null\n if (ct) {\n console.log('dokieliPane: c-t:' + ct)\n } else {\n console.log('dokieliPane: unknown content-type?')\n }\n\n // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can;'t have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n iframe.setAttribute('style', 'resize = both; height: 40em; width:40em;') // @@ improve guess\n // iframe.setAttribute('height', '480')\n // iframe.setAttribute('width', '640')\n const tr = myDocument.createElement('tr')\n tr.appendChild(iframe)\n div.appendChild(tr)\n return div\n }\n}\n// ends\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,UAAU,CAAC;AAC9B,IAAMC,IAAI,GAAGD,OAAO,CAAC,QAAQ,CAAC;AAC9B,IAAME,IAAI,GAAGF,OAAO,CAAC,YAAY,CAAC;;AAElC;;AAEA,IAAMG,gBAAgB,GAAGH,OAAO,CAAC,UAAU,CAAC,EAAC;;AAE7CI,MAAM,CAACC,OAAO,GAAG;EACfC,IAAI,EAAEP,EAAE,CAACQ,KAAK,CAACC,QAAQ,GAAG,kBAAkB;EAAE;;EAE9CC,IAAI,EAAE,SAAS;EAEfC,SAAS,EAAEX,EAAE,CAACY,EAAE,CAACC,KAAK,CAAC,iBAAiB,CAAC;EAAE;;EAE3CC,KAAK,EAAE,eAAUC,OAAO,EAAEC,OAAO,EAAE;IACjC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAO,CAACC,KAAK;IAChC,IAAMP,EAAE,GAAGZ,EAAE,CAACY,EAAE;IAChB,IAAMQ,OAAO,GAAG;IACd;IACA,WAAW,EACX;IACA;IACA;IAAA,CACD;;IAED,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgB,CAAaJ,EAAE,EAAEK,CAAC,EAAEC,YAAY,EAAE;MACtD,IAAMC,GAAG,GAAGP,EAAE,CAACQ,OAAO,CAACC,SAAS,CAACJ,CAAC,EAAE,cAAc,CAAC;MACnD,IAAIE,GAAG,EAAE;QACP,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,GAAG,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;UACnC,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACK,MAAM,EAAEC,CAAC,EAAE,EAAE;YAC5C,IAAIL,G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GAAG,IAAI;IAC9B,IAAI8C,EAAE,EAAE;MACNtB,OAAO,CAACC,GAAG,CAAC,mBAAmB,GAAGqB,EAAE,CAAC;IACvC,CAAC,MAAM;MACLtB,OAAO,CAACC,GAAG,CAAC,oCAAoC,CAAC;IACnD;;IAEA;IACA;IACA;IACA;IACA;;IAEA;;IAEAmB,MAAM,CAACD,YAAY,CAAC,OAAO,EAAE,0CAA0C,CAAC,EAAC;IACzE;IACA;IACA,IAAMI,EAAE,GAAGR,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzCK,EAAE,CAACC,WAAW,CAACJ,MAAM,CAAC;IACtBH,GAAG,CAACO,WAAW,CAACD,EAAE,CAAC;IACnB,OAAON,GAAG;EACZ;AACF,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"new.js","names":["module","exports"],"sources":["../../src/dokieli/new.js"],"sourcesContent":["module.exports = `\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# cc: https://creativecommons.org/ns# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork sioc:Post prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>\n`\n"],"mappings":";;AAAAA,MAAM,CAACC,OAAP"}
1
+ {"version":3,"file":"new.js","names":["module","exports"],"sources":["../../src/dokieli/new.js"],"sourcesContent":["module.exports = `\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# cc: https://creativecommons.org/ns# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork sioc:Post prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>\n`\n"],"mappings":";;AAAAA,MAAM,CAACC,OAAO,mgEAoBb"}
package/lib/form/pane.js CHANGED
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  var UI = _interopRequireWildcard(require("solid-ui"));
6
-
7
5
  var _solidLogic = require("solid-logic");
8
-
9
6
  var $rdf = _interopRequireWildcard(require("rdflib"));
10
-
11
7
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
-
13
8
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
-
15
9
  /*
16
10
  ** Pane for running existing forms for any object
17
11
  **
18
12
  */
13
+
19
14
  var ns = UI.ns;
20
15
  module.exports = {
21
16
  icon: UI.icons.iconBase + 'noun_122196.svg',
@@ -31,70 +26,70 @@ module.exports = {
31
26
  render: function render(subject, context) {
32
27
  var kb = context.session.store;
33
28
  var dom = context.dom;
34
-
35
29
  var mention = function complain(message, style) {
36
30
  var pre = dom.createElement('p');
37
31
  pre.setAttribute('style', style || 'color: grey; background-color: white');
38
32
  box.appendChild(pre).textContent = message;
39
33
  return pre;
40
34
  };
41
-
42
35
  var complain = function complain(message, style) {
43
36
  mention(message, 'style', style || 'color: grey; background-color: #fdd;');
44
37
  };
45
-
46
38
  var complainIfBad = function complainIfBad(ok, body) {
47
- if (ok) {// setModifiedDate(store, kb, store);
39
+ if (ok) {
40
+ // setModifiedDate(store, kb, store);
48
41
  // rerender(box); // Deleted forms at the moment
49
42
  } else complain('Sorry, failed to save your change:\n' + body);
50
- }; // The question of where to store this data about subject
43
+ };
44
+
45
+ // The question of where to store this data about subject
51
46
  // This in general needs a whole lot more thought
52
47
  // and it connects to the discoverbility through links
53
- // const t = kb.findTypeURIs(subject)
54
48
 
49
+ // const t = kb.findTypeURIs(subject)
55
50
 
56
51
  var me = _solidLogic.authn.currentUser();
57
-
58
52
  var box = dom.createElement('div');
59
53
  box.setAttribute('class', 'formPane');
60
-
61
54
  if (!me) {
62
55
  mention('You are not logged in. If you log in and have ' + 'workspaces then you would be able to select workspace in which ' + 'to put this new information');
63
56
  } else {
64
57
  var ws = kb.each(me, ns.ui('workspace'));
65
-
66
58
  if (ws.length === 0) {
67
59
  mention("You don't seem to have any workspaces defined. " + 'A workspace is a place on the web (http://..) or in ' + 'the file system (file:///) to store application data.\n');
68
- } else {// @@
60
+ } else {
61
+ // @@
69
62
  }
70
- } // Render forms using a given store
63
+ }
71
64
 
65
+ // Render forms using a given store
72
66
 
73
67
  var renderFormsFor = function renderFormsFor(store, subject) {
74
68
  kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {
75
- if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body); // Render the forms
69
+ if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body);
70
+
71
+ // Render the forms
76
72
 
77
- var forms = UI.widgets.formsFor(subject); // complain('Form for editing this form:');
73
+ var forms = UI.widgets.formsFor(subject);
78
74
 
75
+ // complain('Form for editing this form:');
79
76
  for (var i = 0; i < forms.length; i++) {
80
77
  var form = forms[i];
81
78
  var heading = dom.createElement('h4');
82
79
  box.appendChild(heading);
83
-
84
80
  if (form.uri) {
85
81
  var formStore = $rdf.Util.uri.document(form.uri);
86
-
87
82
  if (formStore.uri !== form.uri) {
88
83
  // The form is a hash-type URI
89
84
  var e = box.appendChild(UI.widgets.editFormButton(dom, box, form, formStore, complainIfBad));
90
85
  e.setAttribute('style', 'float: right;');
91
86
  }
92
87
  }
93
-
94
88
  var anchor = dom.createElement('a');
95
89
  anchor.setAttribute('href', form.uri);
96
90
  heading.appendChild(anchor);
97
91
  anchor.textContent = UI.utils.label(form, true);
92
+
98
93
  /* Keep tis as a reminder to let a New one have its URI given by user
99
94
  mention("Where will this information be stored?")
100
95
  const ele = dom.createElement('input');
@@ -110,21 +105,22 @@ module.exports = {
110
105
  }
111
106
  }); // end: when store loded
112
107
  }; // renderFormsFor
108
+
113
109
  // Figure out what store
114
- // Which places are editable and have stuff about the subject?
115
110
 
111
+ // Which places are editable and have stuff about the subject?
116
112
 
117
- var store = null; // 1. The document URI of the subject itself
113
+ var store = null;
118
114
 
115
+ // 1. The document URI of the subject itself
119
116
  var docuri = $rdf.Util.uri.docpart(subject.uri);
120
-
121
117
  if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {
122
118
  store = subject.doc();
123
119
  } // an editable data file with hash
124
120
 
121
+ store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'));
125
122
 
126
- store = store || kb.any(kb.sym(docuri), ns.link('annotationStore')); // 2. where stuff is already stored
127
-
123
+ // 2. where stuff is already stored
128
124
  if (!store) {
129
125
  var docs = {};
130
126
  var docList = [];
@@ -134,37 +130,30 @@ module.exports = {
134
130
  store.statementsMatching(undefined, undefined, subject).forEach(function (st) {
135
131
  docs[st.why.uri] = 2;
136
132
  });
137
-
138
133
  for (var d in docs) {
139
134
  docList.push(docs[d], d);
140
135
  }
141
-
142
136
  docList.sort();
143
-
144
137
  for (var i = 0; i < docList.length; i++) {
145
138
  var uri = docList[i][1];
146
-
147
139
  if (uri && store.updater.editable(uri)) {
148
140
  store = store.sym(uri);
149
141
  break;
150
142
  }
151
143
  }
152
- } // 3. In a workspace store
153
- // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)
154
-
144
+ }
155
145
 
146
+ // 3. In a workspace store
147
+ // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)
156
148
  var _followeach = function _followeach(kb, subject, path) {
157
149
  if (path.length === 0) return [subject];
158
150
  var oo = kb.each(subject, path[0]);
159
151
  var res = [];
160
-
161
152
  for (var _i = 0; _i < oo.length; _i++) {
162
153
  res = res.concat(_followeach(kb, oo[_i], path.slice(1)));
163
154
  }
164
-
165
155
  return res;
166
156
  };
167
-
168
157
  var date = '2014'; // @@@@@@@@@@@@ pass as parameter
169
158
 
170
159
  if (store) {
@@ -175,13 +164,11 @@ module.exports = {
175
164
  var foobarbaz = UI.login.selectWorkspace(dom, function (ws) {
176
165
  mention('Workspace selected OK: ' + ws);
177
166
  var activities = store.each(undefined, ns.space('workspace'), ws);
178
-
179
167
  for (var j = 0; j < activities.length; j++) {
180
168
  var act = activities[j];
181
169
  var subjectDoc2 = store.any(ws, ns.space('store'));
182
170
  var start = store.any(ws, ns.cal('dtstart')).value();
183
171
  var end = store.any(ws, ns.cal('dtend')).value();
184
-
185
172
  if (subjectDoc2 && start && end && start <= date && end > date) {
186
173
  renderFormsFor(subjectDoc2, subject);
187
174
  break;
@@ -192,7 +179,6 @@ module.exports = {
192
179
  });
193
180
  box.appendChild(foobarbaz);
194
181
  }
195
-
196
182
  return box;
197
183
  }
198
184
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pane.js","names":["ns","UI","module","exports","icon","icons","iconBase","name","audience","solid","label","subject","n","widgets","formsFor","length","log","debug","render","context","kb","session","store","dom","mention","complain","message","style","pre","createElement","setAttribute","box","appendChild","textContent","complainIfBad","ok","body","me","authn","currentUser","ws","each","ui","renderFormsFor","fetcher","nowOrWhenFetched","uri","forms","i","form","heading","formStore","$rdf","Util","document","e","editFormButton","anchor","utils","appendForm","docuri","docpart","updater","editable","doc","any","sym","link","docs","docList","statementsMatching","forEach","st","why","undefined","d","push","sort","_followeach","path","oo","res","concat","slice","date","foobarbaz","login","selectWorkspace","activities","space","j","act","subjectDoc2","start","cal","value","end"],"sources":["../../src/form/pane.js"],"sourcesContent":["/*\n ** Pane for running existing forms for any object\n **\n */\n\nimport * as UI from 'solid-ui'\nimport { authn } from 'solid-logic'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nmodule.exports = {\n icon: UI.icons.iconBase + 'noun_122196.svg',\n\n name: 'form',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject) {\n const n = UI.widgets.formsFor(subject).length\n UI.log.debug('Form pane: forms for ' + subject + ': ' + n)\n if (!n) return null\n return '' + n + ' forms'\n },\n\n render: function (subject, context) {\n const kb = context.session.store\n const dom = context.dom\n\n const mention = function complain (message, style) {\n const pre = dom.createElement('p')\n pre.setAttribute('style', style || 'color: grey; background-color: white')\n box.appendChild(pre).textContent = message\n return pre\n }\n\n const complain = function complain (message, style) {\n mention(message, 'style', style || 'color: grey; background-color: #fdd;')\n }\n\n const complainIfBad = function (ok, body) {\n if (ok) {\n // setModifiedDate(store, kb, store);\n // rerender(box); // Deleted forms at the moment\n } else complain('Sorry, failed to save your change:\\n' + body)\n }\n\n // The question of where to store this data about subject\n // This in general needs a whole lot more thought\n // and it connects to the discoverbility through links\n\n // const t = kb.findTypeURIs(subject)\n\n const me = authn.currentUser()\n\n const box = dom.createElement('div')\n box.setAttribute('class', 'formPane')\n\n if (!me) {\n mention(\n 'You are not logged in. If you log in and have ' +\n 'workspaces then you would be able to select workspace in which ' +\n 'to put this new information'\n )\n } else {\n const ws = kb.each(me, ns.ui('workspace'))\n if (ws.length === 0) {\n mention(\n \"You don't seem to have any workspaces defined. \" +\n 'A workspace is a place on the web (http://..) or in ' +\n 'the file system (file:///) to store application data.\\n'\n )\n } else {\n // @@\n }\n }\n\n // Render forms using a given store\n\n const renderFormsFor = function (store, subject) {\n kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {\n if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)\n\n // Render the forms\n\n const forms = UI.widgets.formsFor(subject)\n\n // complain('Form for editing this form:');\n for (let i = 0; i < forms.length; i++) {\n const form = forms[i]\n const heading = dom.createElement('h4')\n box.appendChild(heading)\n if (form.uri) {\n const formStore = $rdf.Util.uri.document(form.uri)\n if (formStore.uri !== form.uri) {\n // The form is a hash-type URI\n const e = box.appendChild(\n UI.widgets.editFormButton(\n dom,\n box,\n form,\n formStore,\n complainIfBad\n )\n )\n e.setAttribute('style', 'float: right;')\n }\n }\n const anchor = dom.createElement('a')\n anchor.setAttribute('href', form.uri)\n heading.appendChild(anchor)\n anchor.textContent = UI.utils.label(form, true)\n\n /* Keep tis as a reminder to let a New one have its URI given by user\n mention(\"Where will this information be stored?\")\n const ele = dom.createElement('input');\n box.appendChild(ele);\n ele.setAttribute('type', 'text');\n ele.setAttribute('size', '72');\n ele.setAttribute('maxlength', '1024');\n ele.setAttribute('style', 'font-size: 80%; color:#222;');\n ele.value = store.uri\n */\n\n UI.widgets.appendForm(\n dom,\n box,\n {},\n subject,\n form,\n store,\n complainIfBad\n )\n }\n }) // end: when store loded\n } // renderFormsFor\n\n // Figure out what store\n\n // Which places are editable and have stuff about the subject?\n\n let store = null\n\n // 1. The document URI of the subject itself\n const docuri = $rdf.Util.uri.docpart(subject.uri)\n if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {\n store = subject.doc()\n } // an editable data file with hash\n\n store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'))\n\n // 2. where stuff is already stored\n if (!store) {\n const docs = {}\n const docList = []\n store.statementsMatching(subject).forEach(function (st) {\n docs[st.why.uri] = 1\n })\n store\n .statementsMatching(undefined, undefined, subject)\n .forEach(function (st) {\n docs[st.why.uri] = 2\n })\n for (const d in docs) docList.push(docs[d], d)\n docList.sort()\n for (let i = 0; i < docList.length; i++) {\n const uri = docList[i][1]\n if (uri && store.updater.editable(uri)) {\n store = store.sym(uri)\n break\n }\n }\n }\n\n // 3. In a workspace store\n // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)\n const _followeach = function (kb, subject, path) {\n if (path.length === 0) return [subject]\n const oo = kb.each(subject, path[0])\n let res = []\n for (let i = 0; i < oo.length; i++) {\n res = res.concat(_followeach(kb, oo[i], path.slice(1)))\n }\n return res\n }\n\n const date = '2014' // @@@@@@@@@@@@ pass as parameter\n\n if (store) {\n // mention(\"@@ Ok, we have a store <\" + store.uri + \">.\");\n renderFormsFor(store, subject)\n } else {\n complain('No suitable store is known, to edit <' + subject.uri + '>.')\n const foobarbaz = UI.login.selectWorkspace(dom, function (ws) {\n mention('Workspace selected OK: ' + ws)\n\n const activities = store.each(undefined, ns.space('workspace'), ws)\n for (let j = 0; j < activities.length; j++) {\n const act = activities[j]\n\n const subjectDoc2 = store.any(ws, ns.space('store'))\n const start = store.any(ws, ns.cal('dtstart')).value()\n const end = store.any(ws, ns.cal('dtend')).value()\n if (subjectDoc2 && start && end && start <= date && end > date) {\n renderFormsFor(subjectDoc2, subject)\n break\n } else {\n complain('Note no suitable annotation store in activity: ' + act)\n }\n }\n })\n box.appendChild(foobarbaz)\n }\n\n return box\n }\n}\n"],"mappings":";;;;AAKA;;AACA;;AACA;;;;;;AAPA;AACA;AACA;AACA;AAKA,IAAMA,EAAE,GAAGC,EAAE,CAACD,EAAd;AAEAE,MAAM,CAACC,OAAP,GAAiB;EACfC,IAAI,EAAEH,EAAE,CAACI,KAAH,CAASC,QAAT,GAAoB,iBADX;EAGfC,IAAI,EAAE,MAHS;EAKfC,QAAQ,EAAE,CAACR,EAAE,CAACS,KAAH,CAAS,WAAT,CAAD,CALK;EAOf;EACAC,KAAK,EAAE,eAAUC,OAAV,EAAmB;IACxB,IAAMC,CAAC,GAAGX,EAAE,CAACY,OAAH,CAAWC,QAAX,CAAoBH,OAApB,EAA6BI,MAAvC;IACAd,EAAE,CAACe,GAAH,CAAOC,KAAP,CAAa,0BAA0BN,OAA1B,GAAoC,IAApC,GAA2CC,CAAxD;IACA,IAAI,CAACA,CAAL,EAAQ,OAAO,IAAP;IACR,OAAO,KAAKA,CAAL,GAAS,QAAhB;EACD,CAbc;EAefM,MAAM,EAAE,gBAAUP,OAAV,EAAmBQ,OAAnB,EAA4B;IAClC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAR,CAAgBC,KAA3B;IAC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AAIC,KAAf,IAAwBG,GAAxB,IAA+BH,KAAK,IAAIT,IAAxC,IAAgDY,GAAG,GAAGZ,IAA1D,EAAgE;YAC9DzC,cAAc,CAACiD,WAAD,EAAcjF,OAAd,CAAd;YACA;UACD,CAHD,MAGO;YACLc,QAAQ,CAAC,oDAAoDkE,GAArD,CAAR;UACD;QACF;MACF,CAjBiB,CAAlB;MAkBA5D,GAAG,CAACC,WAAJ,CAAgBqD,SAAhB;IACD;;IAED,OAAOtD,GAAP;EACD;AA7Mc,CAAjB"}
1
+ {"version":3,"file":"pane.js","names":["ns","UI","module","exports","icon","icons","iconBase","name","audience","solid","label","subject","n","widgets","formsFor","length","log","debug","render","context","kb","session","store","dom","mention","complain","message","style","pre","createElement","setAttribute","box","appendChild","textContent","complainIfBad","ok","body","me","authn","currentUser","ws","each","ui","renderFormsFor","fetcher","nowOrWhenFetched","uri","forms","i","form","heading","formStore","$rdf","Util","document","e","editFormButton","anchor","utils","appendForm","docuri","docpart","updater","editable","doc","any","sym","link","docs","docList","statementsMatching","forEach","st","why","undefined","d","push","sort","_followeach","path","oo","res","concat","slice","date","foobarbaz","login","selectWorkspace","activities","space","j","act","subjectDoc2","start","cal","value","end"],"sources":["../../src/form/pane.js"],"sourcesContent":["/*\n ** Pane for running existing forms for any object\n **\n */\n\nimport * as UI from 'solid-ui'\nimport { authn } from 'solid-logic'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nmodule.exports = {\n icon: UI.icons.iconBase + 'noun_122196.svg',\n\n name: 'form',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject) {\n const n = UI.widgets.formsFor(subject).length\n UI.log.debug('Form pane: forms for ' + subject + ': ' + n)\n if (!n) return null\n return '' + n + ' forms'\n },\n\n render: function (subject, context) {\n const kb = context.session.store\n const dom = context.dom\n\n const mention = function complain (message, style) {\n const pre = dom.createElement('p')\n pre.setAttribute('style', style || 'color: grey; background-color: white')\n box.appendChild(pre).textContent = message\n return pre\n }\n\n const complain = function complain (message, style) {\n mention(message, 'style', style || 'color: grey; background-color: #fdd;')\n }\n\n const complainIfBad = function (ok, body) {\n if (ok) {\n // setModifiedDate(store, kb, store);\n // rerender(box); // Deleted forms at the moment\n } else complain('Sorry, failed to save your change:\\n' + body)\n }\n\n // The question of where to store this data about subject\n // This in general needs a whole lot more thought\n // and it connects to the discoverbility through links\n\n // const t = kb.findTypeURIs(subject)\n\n const me = authn.currentUser()\n\n const box = dom.createElement('div')\n box.setAttribute('class', 'formPane')\n\n if (!me) {\n mention(\n 'You are not logged in. If you log in and have ' +\n 'workspaces then you would be able to select workspace in which ' +\n 'to put this new information'\n )\n } else {\n const ws = kb.each(me, ns.ui('workspace'))\n if (ws.length === 0) {\n mention(\n \"You don't seem to have any workspaces defined. \" +\n 'A workspace is a place on the web (http://..) or in ' +\n 'the file system (file:///) to store application data.\\n'\n )\n } else {\n // @@\n }\n }\n\n // Render forms using a given store\n\n const renderFormsFor = function (store, subject) {\n kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {\n if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)\n\n // Render the forms\n\n const forms = UI.widgets.formsFor(subject)\n\n // complain('Form for editing this form:');\n for (let i = 0; i < forms.length; i++) {\n const form = forms[i]\n const heading = dom.createElement('h4')\n box.appendChild(heading)\n if (form.uri) {\n const formStore = $rdf.Util.uri.document(form.uri)\n if (formStore.uri !== form.uri) {\n // The form is a hash-type URI\n const e = box.appendChild(\n UI.widgets.editFormButton(\n dom,\n box,\n form,\n formStore,\n complainIfBad\n )\n )\n e.setAttribute('style', 'float: right;')\n }\n }\n const anchor = dom.createElement('a')\n anchor.setAttribute('href', form.uri)\n heading.appendChild(anchor)\n anchor.textContent = UI.utils.label(form, true)\n\n /* Keep tis as a reminder to let a New one have its URI given by user\n mention(\"Where will this information be stored?\")\n const ele = dom.createElement('input');\n box.appendChild(ele);\n ele.setAttribute('type', 'text');\n ele.setAttribute('size', '72');\n ele.setAttribute('maxlength', '1024');\n ele.setAttribute('style', 'font-size: 80%; color:#222;');\n ele.value = store.uri\n */\n\n UI.widgets.appendForm(\n dom,\n box,\n {},\n subject,\n form,\n store,\n complainIfBad\n )\n }\n }) // end: when store loded\n } // renderFormsFor\n\n // Figure out what store\n\n // Which places are editable and have stuff about the subject?\n\n let store = null\n\n // 1. The document URI of the subject itself\n const docuri = $rdf.Util.uri.docpart(subject.uri)\n if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {\n store = subject.doc()\n } // an editable data file with hash\n\n store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'))\n\n // 2. where stuff is already stored\n if (!store) {\n const docs = {}\n const docList = []\n store.statementsMatching(subject).forEach(function (st) {\n docs[st.why.uri] = 1\n })\n store\n .statementsMatching(undefined, undefined, subject)\n .forEach(function (st) {\n docs[st.why.uri] = 2\n })\n for (const d in docs) docList.push(docs[d], d)\n docList.sort()\n for (let i = 0; i < docList.length; i++) {\n const uri = docList[i][1]\n if (uri && store.updater.editable(uri)) {\n store = store.sym(uri)\n break\n }\n }\n }\n\n // 3. In a workspace store\n // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)\n const _followeach = function (kb, subject, path) {\n if (path.length === 0) return [subject]\n const oo = kb.each(subject, path[0])\n let res = []\n for (let i = 0; i < oo.length; i++) {\n res = res.concat(_followeach(kb, oo[i], path.slice(1)))\n }\n return res\n }\n\n const date = '2014' // @@@@@@@@@@@@ pass as parameter\n\n if (store) {\n // mention(\"@@ Ok, we have a store <\" + store.uri + \">.\");\n renderFormsFor(store, subject)\n } else {\n complain('No suitable store is known, to edit <' + subject.uri + '>.')\n const foobarbaz = UI.login.selectWorkspace(dom, function (ws) {\n mention('Workspace selected OK: ' + ws)\n\n const activities = store.each(undefined, ns.space('workspace'), ws)\n for (let j = 0; j < activities.length; j++) {\n const act = activities[j]\n\n const subjectDoc2 = store.any(ws, ns.space('store'))\n const start = store.any(ws, ns.cal('dtstart')).value()\n const end = store.any(ws, ns.cal('dtend')).value()\n if (subjectDoc2 && start && end && start <= date && end > date) {\n renderFormsFor(subjectDoc2, subject)\n break\n } else {\n complain('Note no suitable annotation store in activity: ' + act)\n }\n }\n })\n box.appendChild(foobarbaz)\n }\n\n return box\n }\n}\n"],"mappings":";;;AAKA;AACA;AACA;AAA8B;AAAA;AAP9B;AACA;AACA;AACA;;AAKA,IAAMA,EAAE,GAAGC,EAAE,CAACD,EAAE;AAEhBE,MAAM,CAACC,OAAO,GAAG;EACfC,IAAI,EAAEH,EAAE,CAACI,KAAK,CAACC,QAAQ,GAAG,iBAAiB;EAE3CC,IAAI,EAAE,MAAM;EAEZC,QAAQ,EAAE,CAACR,EAAE,CAACS,KAAK,CAAC,WAAW,CAAC,CAAC;EAEjC;EACAC,KAAK,EAAE,eAAUC,OAAO,EAAE;IACxB,IAAMC,CAAC,GAAGX,EAAE,CAACY,OAAO,CAACC,QAAQ,CAACH,OAAO,CAAC,CAACI,MAAM;IAC7Cd,EAAE,CAACe,GAAG,CAACC,KAAK,CAAC,uBAAuB,GAAGN,OAAO,GAAG,IAAI,GAAGC,CAAC,CAAC;IAC1D,IAAI,CAACA,CAAC,EAAE,OAAO,IAAI;IACnB,OAAO,EAAE,GAAGA,CAAC,GAAG,QAAQ;EAC1B,CAAC;EAEDM,MAAM,EAAE,gBAAUP,OAAO,EAAEQ,OAAO,EAAE;IAClC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAO,CAACC,KAAK;IAChC,IAAMC,GAAG,GAAGJ,OAAO,CAACI,GAAG;IAEvB,IAAMC,OAAO,GAAG,SAASC,QAAQ,CAAEC,OAAO,EAAEC,KAAK,EAAE;MACjD,IAAMC,GAAG,GAAGL,GAAG,CAACM,aAAa,CAAC,GAAG,CAAC;MAClCD,GAAG,CAACE,YAAY,CAAC,OAAO,EAAEH,KAAK,IAAI,sCAAsC,CAAC;MAC1EI,GAAG,CAACC,WAAW,CAACJ,GAAG,CAAC,CAACK,WAAW,GAAGP,OAAO;MAC1C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