solid-ui 2.4.23 → 2.4.24

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 (136) hide show
  1. package/dist/main.js +2159 -5039
  2. package/dist/main.js.map +1 -1
  3. package/lib/acl/access-controller.js +4 -67
  4. package/lib/acl/access-controller.js.map +1 -1
  5. package/lib/acl/access-groups.js +59 -137
  6. package/lib/acl/access-groups.js.map +1 -1
  7. package/lib/acl/acl-control.js +14 -54
  8. package/lib/acl/acl-control.js.map +1 -1
  9. package/lib/acl/acl.js +32 -107
  10. package/lib/acl/acl.js.map +1 -1
  11. package/lib/acl/add-agent-buttons.js +0 -92
  12. package/lib/acl/add-agent-buttons.js.map +1 -1
  13. package/lib/acl/index.js +1 -3
  14. package/lib/acl/index.js.map +1 -1
  15. package/lib/acl/styles.js +1 -2
  16. package/lib/acl/styles.js.map +1 -1
  17. package/lib/chat/bookmarks.js +8 -80
  18. package/lib/chat/bookmarks.js.map +1 -1
  19. package/lib/chat/chatLogic.js +109 -180
  20. package/lib/chat/chatLogic.js.map +1 -1
  21. package/lib/chat/dateFolder.js +6 -91
  22. package/lib/chat/dateFolder.js.map +1 -1
  23. package/lib/chat/infinite.js +33 -185
  24. package/lib/chat/infinite.js.map +1 -1
  25. package/lib/chat/message.js +37 -150
  26. package/lib/chat/message.js.map +1 -1
  27. package/lib/chat/messageTools.js +23 -96
  28. package/lib/chat/messageTools.js.map +1 -1
  29. package/lib/chat/thread.js +33 -91
  30. package/lib/chat/thread.js.map +1 -1
  31. package/lib/create/create.js +19 -51
  32. package/lib/create/create.js.map +1 -1
  33. package/lib/create/index.js +0 -2
  34. package/lib/create/index.js.map +1 -1
  35. package/lib/debug.js +0 -8
  36. package/lib/debug.js.map +1 -1
  37. package/lib/folders.js +4 -27
  38. package/lib/folders.js.map +1 -1
  39. package/lib/footer/index.js +2 -24
  40. package/lib/footer/index.js.map +1 -1
  41. package/lib/footer/styleMap.js.map +1 -1
  42. package/lib/header/empty-profile.js.map +1 -1
  43. package/lib/header/index.js +3 -72
  44. package/lib/header/index.js.map +1 -1
  45. package/lib/header/styleMap.js +4 -3
  46. package/lib/header/styleMap.js.map +1 -1
  47. package/lib/iconBase.js +3 -4
  48. package/lib/iconBase.js.map +1 -1
  49. package/lib/index.js +5 -46
  50. package/lib/index.js.map +1 -1
  51. package/lib/jss/index.js +3 -9
  52. package/lib/jss/index.js.map +1 -1
  53. package/lib/log.js +15 -51
  54. package/lib/log.js.map +1 -1
  55. package/lib/login/login.js +74 -303
  56. package/lib/login/login.js.map +1 -1
  57. package/lib/matrix/index.js +0 -2
  58. package/lib/matrix/index.js.map +1 -1
  59. package/lib/matrix/matrix.js +7 -55
  60. package/lib/matrix/matrix.js.map +1 -1
  61. package/lib/media/index.js +0 -2
  62. package/lib/media/index.js.map +1 -1
  63. package/lib/media/media-capture.js +13 -33
  64. package/lib/media/media-capture.js.map +1 -1
  65. package/lib/messageArea.js +23 -64
  66. package/lib/messageArea.js.map +1 -1
  67. package/lib/noun_Camera_1618446_000000.js.map +1 -1
  68. package/lib/ns.js +5 -7
  69. package/lib/ns.js.map +1 -1
  70. package/lib/pad.js +48 -234
  71. package/lib/pad.js.map +1 -1
  72. package/lib/participation.js +10 -65
  73. package/lib/participation.js.map +1 -1
  74. package/lib/preferences.js +21 -42
  75. package/lib/preferences.js.map +1 -1
  76. package/lib/signup/config-default.js +1 -8
  77. package/lib/signup/config-default.js.map +1 -1
  78. package/lib/signup/signup.js +6 -13
  79. package/lib/signup/signup.js.map +1 -1
  80. package/lib/stories/decorators.js +0 -2
  81. package/lib/stories/decorators.js.map +1 -1
  82. package/lib/style.js +8 -5
  83. package/lib/style.js.map +1 -1
  84. package/lib/style_multiSelect.js +1 -5
  85. package/lib/style_multiSelect.js.map +1 -1
  86. package/lib/table.js +309 -322
  87. package/lib/table.js.map +1 -1
  88. package/lib/tabs.js +20 -100
  89. package/lib/tabs.js.map +1 -1
  90. package/lib/utils/headerFooterHelpers.js +4 -52
  91. package/lib/utils/headerFooterHelpers.js.map +1 -1
  92. package/lib/utils/index.js +41 -135
  93. package/lib/utils/index.js.map +1 -1
  94. package/lib/utils/label.js +13 -34
  95. package/lib/utils/label.js.map +1 -1
  96. package/lib/versionInfo.js +4 -4
  97. package/lib/versionInfo.js.map +1 -1
  98. package/lib/widgets/buttons/iconLinks.js +0 -8
  99. package/lib/widgets/buttons/iconLinks.js.map +1 -1
  100. package/lib/widgets/buttons.js +115 -291
  101. package/lib/widgets/buttons.js.map +1 -1
  102. package/lib/widgets/dragAndDrop.js +12 -41
  103. package/lib/widgets/dragAndDrop.js.map +1 -1
  104. package/lib/widgets/error.js +3 -9
  105. package/lib/widgets/error.js.map +1 -1
  106. package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -71
  107. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
  108. package/lib/widgets/forms/autocomplete/autocompleteField.js +13 -65
  109. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  110. package/lib/widgets/forms/autocomplete/autocompletePicker.js +15 -107
  111. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  112. package/lib/widgets/forms/autocomplete/language.js +6 -55
  113. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  114. package/lib/widgets/forms/autocomplete/publicData.js +12 -131
  115. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  116. package/lib/widgets/forms/basic.js +12 -55
  117. package/lib/widgets/forms/basic.js.map +1 -1
  118. package/lib/widgets/forms/comment.js +1 -15
  119. package/lib/widgets/forms/comment.js.map +1 -1
  120. package/lib/widgets/forms/fieldFunction.js +3 -16
  121. package/lib/widgets/forms/fieldFunction.js.map +1 -1
  122. package/lib/widgets/forms/fieldParams.js +0 -12
  123. package/lib/widgets/forms/fieldParams.js.map +1 -1
  124. package/lib/widgets/forms/formStyle.js +1 -14
  125. package/lib/widgets/forms/formStyle.js.map +1 -1
  126. package/lib/widgets/forms.js +70 -474
  127. package/lib/widgets/forms.js.map +1 -1
  128. package/lib/widgets/index.js +0 -21
  129. package/lib/widgets/index.js.map +1 -1
  130. package/lib/widgets/multiSelect.js +48 -171
  131. package/lib/widgets/multiSelect.js.map +1 -1
  132. package/lib/widgets/peoplePicker.js +20 -90
  133. package/lib/widgets/peoplePicker.js.map +1 -1
  134. package/lib/widgets/widgetHelpers.js +2 -9
  135. package/lib/widgets/widgetHelpers.js.map +1 -1
  136. package/package.json +28 -28
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
@@ -21,65 +19,45 @@ exports.renderScopeHeadingRow = renderScopeHeadingRow;
21
19
  exports.renderSignInPopup = renderSignInPopup;
22
20
  exports.scopeLabel = scopeLabel;
23
21
  exports.selectWorkspace = selectWorkspace;
24
-
25
22
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
26
-
27
23
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
28
-
29
24
  var _rdflib = require("rdflib");
30
-
31
25
  var _solidLogic = require("solid-logic");
32
-
33
26
  var debug = _interopRequireWildcard(require("../debug"));
34
-
35
27
  var _log = require("../log");
36
-
37
28
  var ns = _interopRequireWildcard(require("../ns.js"));
38
-
39
29
  var _signup = require("../signup/signup.js");
40
-
41
30
  var _style = require("../style");
42
-
43
31
  var utils = _interopRequireWildcard(require("../utils"));
44
-
45
32
  var widgets = _interopRequireWildcard(require("../widgets"));
46
-
47
33
  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); }
48
-
49
34
  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; }
50
-
51
35
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
52
-
53
36
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
54
-
55
37
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
56
-
57
38
  var store = _solidLogic.solidLogicSingleton.store;
58
39
  var _solidLogicSingleton$ = _solidLogic.solidLogicSingleton.profile,
59
- loadPreferences = _solidLogicSingleton$.loadPreferences,
60
- loadProfile = _solidLogicSingleton$.loadProfile;
40
+ loadPreferences = _solidLogicSingleton$.loadPreferences,
41
+ loadProfile = _solidLogicSingleton$.loadProfile;
61
42
  var _solidLogicSingleton$2 = _solidLogic.solidLogicSingleton.typeIndex,
62
- getScopedAppInstances = _solidLogicSingleton$2.getScopedAppInstances,
63
- getRegistrations = _solidLogicSingleton$2.getRegistrations,
64
- loadAllTypeIndexes = _solidLogicSingleton$2.loadAllTypeIndexes,
65
- getScopedAppsFromIndex = _solidLogicSingleton$2.getScopedAppsFromIndex,
66
- deleteTypeIndexRegistration = _solidLogicSingleton$2.deleteTypeIndexRegistration;
43
+ getScopedAppInstances = _solidLogicSingleton$2.getScopedAppInstances,
44
+ getRegistrations = _solidLogicSingleton$2.getRegistrations,
45
+ loadAllTypeIndexes = _solidLogicSingleton$2.loadAllTypeIndexes,
46
+ getScopedAppsFromIndex = _solidLogicSingleton$2.getScopedAppsFromIndex,
47
+ deleteTypeIndexRegistration = _solidLogicSingleton$2.deleteTypeIndexRegistration;
48
+
67
49
  /**
68
50
  * Resolves with the logged in user's WebID
69
51
  *
70
52
  * @param context
71
53
  */
72
54
  // used to be logIn
73
-
74
55
  function ensureLoggedIn(context) {
75
56
  var me = _solidLogic.authn.currentUser();
76
-
77
57
  if (me) {
78
58
  _solidLogic.authn.saveUser(me, context);
79
-
80
59
  return Promise.resolve(context);
81
60
  }
82
-
83
61
  return new Promise(function (resolve) {
84
62
  _solidLogic.authn.checkUser().then(function (webId) {
85
63
  // Already logged in?
@@ -87,20 +65,19 @@ function ensureLoggedIn(context) {
87
65
  debug.log("logIn: Already logged in as ".concat(webId));
88
66
  return resolve(context);
89
67
  }
90
-
91
68
  if (!context.div || !context.dom) {
92
69
  return resolve(context);
93
70
  }
94
-
95
71
  var box = loginStatusBox(context.dom, function (webIdUri) {
96
72
  _solidLogic.authn.saveUser(webIdUri, context);
97
-
98
73
  resolve(context); // always pass growing context
99
74
  });
75
+
100
76
  context.div.appendChild(box);
101
77
  });
102
78
  });
103
79
  }
80
+
104
81
  /**
105
82
  * Loads preference file
106
83
  * Do this after having done log in and load profile
@@ -110,8 +87,6 @@ function ensureLoggedIn(context) {
110
87
  * @param context
111
88
  */
112
89
  // used to be logInLoadPreferences
113
-
114
-
115
90
  function ensureLoadedPreferences(_x) {
116
91
  return _ensureLoadedPreferences.apply(this, arguments);
117
92
  }
@@ -123,8 +98,6 @@ function ensureLoadedPreferences(_x) {
123
98
  * @returns Resolves with the context after login / fetch
124
99
  */
125
100
  // used to be logInLoadProfile
126
-
127
-
128
101
  function _ensureLoadedPreferences() {
129
102
  _ensureLoadedPreferences = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(context) {
130
103
  var statusArea, progressDisplay, complain, preferencesFile, m2;
@@ -134,117 +107,93 @@ function _ensureLoadedPreferences() {
134
107
  case 0:
135
108
  complain = function _complain(message) {
136
109
  message = "ensureLoadedPreferences: ".concat(message);
137
-
138
110
  if (statusArea) {
139
111
  // statusArea.innerHTML = ''
140
112
  statusArea.appendChild(widgets.errorMessageBlock(context.dom, message));
141
113
  }
142
-
143
- debug.log(message); // reject(new Error(message))
114
+ debug.log(message);
115
+ // reject(new Error(message))
144
116
  };
145
-
146
117
  if (!context.preferencesFile) {
147
118
  _context4.next = 3;
148
119
  break;
149
120
  }
150
-
151
121
  return _context4.abrupt("return", Promise.resolve(context));
152
-
153
122
  case 3:
154
123
  // already done
155
124
  statusArea = context.statusArea || context.div || null;
156
125
  _context4.prev = 4;
157
126
  _context4.next = 7;
158
127
  return ensureLoadedProfile(context);
159
-
160
128
  case 7:
161
129
  context = _context4.sent;
162
130
  _context4.next = 10;
163
131
  return loadPreferences(context.me);
164
-
165
132
  case 10:
166
133
  preferencesFile = _context4.sent;
167
-
168
134
  if (progressDisplay) {
169
135
  progressDisplay.parentNode.removeChild(progressDisplay);
170
136
  }
171
-
172
137
  context.preferencesFile = preferencesFile;
173
138
  _context4.next = 51;
174
139
  break;
175
-
176
140
  case 15:
177
141
  _context4.prev = 15;
178
142
  _context4.t0 = _context4["catch"](4);
179
-
180
143
  if (!(_context4.t0 instanceof _solidLogic.UnauthorizedError)) {
181
144
  _context4.next = 22;
182
145
  break;
183
146
  }
184
-
185
147
  m2 = 'Ooops - you are not authenticated (properly logged in) to for me to read your preference file. Try loggin out and logging in?';
186
148
  (0, _log.alert)(m2);
187
149
  _context4.next = 51;
188
150
  break;
189
-
190
151
  case 22:
191
152
  if (!(_context4.t0 instanceof _solidLogic.CrossOriginForbiddenError)) {
192
153
  _context4.next = 28;
193
154
  break;
194
155
  }
195
-
196
156
  m2 = "Unauthorized: Assuming preference file blocked for origin ".concat(window.location.origin);
197
157
  context.preferencesFileError = m2;
198
158
  return _context4.abrupt("return", context);
199
-
200
159
  case 28:
201
160
  if (!(_context4.t0 instanceof _solidLogic.SameOriginForbiddenError)) {
202
161
  _context4.next = 34;
203
162
  break;
204
163
  }
205
-
206
164
  m2 = 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.';
207
165
  debug.warn(m2);
208
166
  return _context4.abrupt("return", context);
209
-
210
167
  case 34:
211
168
  if (!(_context4.t0 instanceof _solidLogic.NotEditableError)) {
212
169
  _context4.next = 40;
213
170
  break;
214
171
  }
215
-
216
172
  m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
217
173
  debug.warn(m2);
218
174
  return _context4.abrupt("return", context);
219
-
220
175
  case 40:
221
176
  if (!(_context4.t0 instanceof _solidLogic.WebOperationError)) {
222
177
  _context4.next = 45;
223
178
  break;
224
179
  }
225
-
226
180
  m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
227
181
  debug.warn(m2);
228
182
  _context4.next = 51;
229
183
  break;
230
-
231
184
  case 45:
232
185
  if (!(_context4.t0 instanceof _solidLogic.FetchError)) {
233
186
  _context4.next = 50;
234
187
  break;
235
188
  }
236
-
237
189
  m2 = "Strange: Error ".concat(_context4.t0.status, " trying to read your preference file.").concat(_context4.t0.message);
238
190
  (0, _log.alert)(m2);
239
191
  _context4.next = 51;
240
192
  break;
241
-
242
193
  case 50:
243
194
  throw new Error("(via loadPrefs) ".concat(_context4.t0));
244
-
245
195
  case 51:
246
196
  return _context4.abrupt("return", context);
247
-
248
197
  case 52:
249
198
  case "end":
250
199
  return _context4.stop();
@@ -254,7 +203,6 @@ function _ensureLoadedPreferences() {
254
203
  }));
255
204
  return _ensureLoadedPreferences.apply(this, arguments);
256
205
  }
257
-
258
206
  function ensureLoadedProfile(_x2) {
259
207
  return _ensureLoadedProfile.apply(this, arguments);
260
208
  }
@@ -263,8 +211,6 @@ function ensureLoadedProfile(_x2) {
263
211
  *
264
212
  * leaving the `isPublic` param undefined will bring in community index things, too
265
213
  */
266
-
267
-
268
214
  function _ensureLoadedProfile() {
269
215
  _ensureLoadedProfile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(context) {
270
216
  var logInContext;
@@ -276,46 +222,34 @@ function _ensureLoadedProfile() {
276
222
  _context5.next = 2;
277
223
  break;
278
224
  }
279
-
280
225
  return _context5.abrupt("return", context);
281
-
282
226
  case 2:
283
227
  _context5.prev = 2;
284
228
  _context5.next = 5;
285
229
  return ensureLoggedIn(context);
286
-
287
230
  case 5:
288
231
  logInContext = _context5.sent;
289
-
290
232
  if (logInContext.me) {
291
233
  _context5.next = 8;
292
234
  break;
293
235
  }
294
-
295
236
  throw new Error('Could not log in');
296
-
297
237
  case 8:
298
238
  _context5.next = 10;
299
239
  return loadProfile(logInContext.me);
300
-
301
240
  case 10:
302
241
  context.publicProfile = _context5.sent;
303
242
  _context5.next = 17;
304
243
  break;
305
-
306
244
  case 13:
307
245
  _context5.prev = 13;
308
246
  _context5.t0 = _context5["catch"](2);
309
-
310
247
  if (context.div && context.dom) {
311
248
  context.div.appendChild(widgets.errorMessageBlock(context.dom, _context5.t0.message));
312
249
  }
313
-
314
250
  throw new Error("Can't log in: ".concat(_context5.t0));
315
-
316
251
  case 17:
317
252
  return _context5.abrupt("return", context);
318
-
319
253
  case 18:
320
254
  case "end":
321
255
  return _context5.stop();
@@ -325,11 +259,9 @@ function _ensureLoadedProfile() {
325
259
  }));
326
260
  return _ensureLoadedProfile.apply(this, arguments);
327
261
  }
328
-
329
262
  function findAppInstances(_x3, _x4, _x5) {
330
263
  return _findAppInstances.apply(this, arguments);
331
264
  }
332
-
333
265
  function _findAppInstances() {
334
266
  _findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
335
267
  var items;
@@ -341,21 +273,16 @@ function _findAppInstances() {
341
273
  _context6.next = 6;
342
274
  break;
343
275
  }
344
-
345
276
  _context6.next = 3;
346
277
  return getScopedAppInstances(theClass, context.me);
347
-
348
278
  case 3:
349
279
  _context6.t0 = _context6.sent;
350
280
  _context6.next = 7;
351
281
  break;
352
-
353
282
  case 6:
354
283
  _context6.t0 = [];
355
-
356
284
  case 7:
357
285
  items = _context6.t0;
358
-
359
286
  if (isPublic === true) {
360
287
  // old API - not recommended!
361
288
  items = items.filter(function (item) {
@@ -366,12 +293,10 @@ function _findAppInstances() {
366
293
  return item.scope.label === 'private';
367
294
  });
368
295
  }
369
-
370
296
  context.instances = items.map(function (item) {
371
297
  return item.instance;
372
298
  });
373
299
  return _context6.abrupt("return", context);
374
-
375
300
  case 11:
376
301
  case "end":
377
302
  return _context6.stop();
@@ -381,7 +306,6 @@ function _findAppInstances() {
381
306
  }));
382
307
  return _findAppInstances.apply(this, arguments);
383
308
  }
384
-
385
309
  function scopeLabel(context, scope) {
386
310
  var mine = context.me && context.me.sameTerm(scope.agent);
387
311
  var name = mine ? '' : utils.label(scope.agent) + ' ';
@@ -390,16 +314,12 @@ function scopeLabel(context, scope) {
390
314
  /**
391
315
  * UI to control registration of instance
392
316
  */
393
-
394
-
395
317
  function registrationControl(_x6, _x7, _x8) {
396
318
  return _registrationControl.apply(this, arguments);
397
319
  }
398
-
399
320
  function _registrationControl() {
400
321
  _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
401
322
  var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
402
-
403
323
  return _regenerator["default"].wrap(function _callee7$(_context7) {
404
324
  while (1) {
405
325
  switch (_context7.prev = _context7.next) {
@@ -410,52 +330,40 @@ function _registrationControl() {
410
330
  var label = "".concat(name, " link to this ").concat(context.noun);
411
331
  return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
412
332
  };
413
-
414
333
  registrationStatements = function _registrationStatemen(index) {
415
334
  var registrations = getRegistrations(instance, theClass);
416
335
  var reg = registrations.length ? registrations[0] : widgets.newThing(index);
417
336
  return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
418
337
  };
419
-
420
338
  /// / body of registrationControl
421
339
  dom = context.dom;
422
-
423
340
  if (!(!dom || !context.div)) {
424
341
  _context7.next = 5;
425
342
  break;
426
343
  }
427
-
428
344
  throw new Error('registrationControl: need dom and div');
429
-
430
345
  case 5:
431
346
  box = dom.createElement('div');
432
347
  context.div.appendChild(box);
433
348
  context.me = _solidLogic.authn.currentUser(); // @@
434
-
435
349
  me = context.me;
436
-
437
350
  if (me) {
438
351
  _context7.next = 12;
439
352
  break;
440
353
  }
441
-
442
354
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
443
355
  return _context7.abrupt("return", context);
444
-
445
356
  case 12:
446
357
  _context7.prev = 12;
447
358
  _context7.next = 15;
448
359
  return loadAllTypeIndexes(me);
449
-
450
360
  case 15:
451
361
  scopes = _context7.sent;
452
362
  _context7.next = 23;
453
363
  break;
454
-
455
364
  case 18:
456
365
  _context7.prev = 18;
457
366
  _context7.t0 = _context7["catch"](12);
458
-
459
367
  if (context.div && context.preferencesFileError) {
460
368
  msg = '(Lists of stuff not available)';
461
369
  context.div.appendChild(dom.createElement('p')).textContent = msg;
@@ -463,19 +371,14 @@ function _registrationControl() {
463
371
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
464
372
  context.div.appendChild(widgets.errorMessageBlock(context.dom, _context7.t0));
465
373
  }
466
-
467
374
  debug.log(msg);
468
375
  return _context7.abrupt("return", context);
469
-
470
376
  case 23:
471
377
  box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
472
-
473
378
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
474
379
  tbody = box.children[0].children[0];
475
380
  form = new _rdflib.BlankNode(); // @@ say for now
476
-
477
381
  _iterator = _createForOfIteratorHelper(scopes);
478
-
479
382
  try {
480
383
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
481
384
  scope = _step.value;
@@ -487,9 +390,7 @@ function _registrationControl() {
487
390
  } finally {
488
391
  _iterator.f();
489
392
  }
490
-
491
393
  return _context7.abrupt("return", context);
492
-
493
394
  case 30:
494
395
  case "end":
495
396
  return _context7.stop();
@@ -499,7 +400,6 @@ function _registrationControl() {
499
400
  }));
500
401
  return _registrationControl.apply(this, arguments);
501
402
  }
502
-
503
403
  function renderScopeHeadingRow(context, store, scope) {
504
404
  var backgroundColor = {
505
405
  "private": '#fee',
@@ -519,17 +419,12 @@ function renderScopeHeadingRow(context, store, scope) {
519
419
  /**
520
420
  * UI to List at all registered things
521
421
  */
522
-
523
-
524
422
  function registrationList(_x9, _x10) {
525
423
  return _registrationList.apply(this, arguments);
526
424
  } // registrationList
527
-
528
-
529
425
  function _registrationList() {
530
426
  _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
531
427
  var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
532
-
533
428
  return _regenerator["default"].wrap(function _callee9$(_context9) {
534
429
  while (1) {
535
430
  switch (_context9.prev = _context9.next) {
@@ -539,53 +434,44 @@ function _registrationList() {
539
434
  box = dom.createElement('div');
540
435
  div.appendChild(box);
541
436
  context.me = _solidLogic.authn.currentUser(); // @@
542
-
543
437
  if (context.me) {
544
438
  _context9.next = 8;
545
439
  break;
546
440
  }
547
-
548
441
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
549
442
  return _context9.abrupt("return", context);
550
-
551
443
  case 8:
552
444
  _context9.next = 10;
553
445
  return loadAllTypeIndexes(context.me);
554
-
555
446
  case 10:
556
447
  scopes = _context9.sent;
557
448
  // includes community indexes
449
+
558
450
  // console.log('@@ registrationList ', scopes)
559
451
  box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
560
-
561
452
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
562
453
  table = box.firstChild;
563
454
  tbody = table.firstChild;
564
455
  _iterator2 = _createForOfIteratorHelper(scopes);
565
456
  _context9.prev = 16;
566
-
567
457
  _iterator2.s();
568
-
569
458
  case 18:
570
459
  if ((_step2 = _iterator2.n()).done) {
571
460
  _context9.next = 30;
572
461
  break;
573
462
  }
574
-
575
463
  scope = _step2.value;
576
464
  // need some predicate for listing/adding agents
577
465
  headingRow = renderScopeHeadingRow(context, store, scope);
578
466
  tbody.appendChild(headingRow);
579
467
  _context9.next = 24;
580
468
  return getScopedAppsFromIndex(scope, options.type || null);
581
-
582
469
  case 24:
583
470
  items = _context9.sent;
584
471
  // any class
585
- if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
586
-
472
+ if (items.length === 0) headingRow.style.display = 'none';
473
+ // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
587
474
  _iterator3 = _createForOfIteratorHelper(items);
588
-
589
475
  try {
590
476
  _loop = function _loop() {
591
477
  var item = _step3.value;
@@ -598,10 +484,8 @@ function _registrationList() {
598
484
  case 0:
599
485
  _context8.next = 2;
600
486
  return deleteTypeIndexRegistration(item);
601
-
602
487
  case 2:
603
488
  tbody.removeChild(row);
604
-
605
489
  case 3:
606
490
  case "end":
607
491
  return _context8.stop();
@@ -609,18 +493,15 @@ function _registrationList() {
609
493
  }
610
494
  }, _callee8);
611
495
  }));
612
-
613
496
  function deleteFunction() {
614
497
  return _deleteFunction.apply(this, arguments);
615
498
  }
616
-
617
499
  return deleteFunction;
618
500
  }()
619
501
  });
620
502
  row.children[0].style.paddingLeft = '3em';
621
503
  tbody.appendChild(row);
622
504
  };
623
-
624
505
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
625
506
  _loop();
626
507
  }
@@ -629,31 +510,22 @@ function _registrationList() {
629
510
  } finally {
630
511
  _iterator3.f();
631
512
  }
632
-
633
513
  case 28:
634
514
  _context9.next = 18;
635
515
  break;
636
-
637
516
  case 30:
638
517
  _context9.next = 35;
639
518
  break;
640
-
641
519
  case 32:
642
520
  _context9.prev = 32;
643
521
  _context9.t0 = _context9["catch"](16);
644
-
645
522
  _iterator2.e(_context9.t0);
646
-
647
523
  case 35:
648
524
  _context9.prev = 35;
649
-
650
525
  _iterator2.f();
651
-
652
526
  return _context9.finish(35);
653
-
654
527
  case 38:
655
528
  return _context9.abrupt("return", context);
656
-
657
529
  case 39:
658
530
  case "end":
659
531
  return _context9.stop();
@@ -663,10 +535,10 @@ function _registrationList() {
663
535
  }));
664
536
  return _registrationList.apply(this, arguments);
665
537
  }
666
-
667
538
  function getDefaultSignInButtonStyle() {
668
539
  return 'padding: 1em; border-radius:0.5em; font-size: 100%;';
669
540
  }
541
+
670
542
  /**
671
543
  * Bootstrapping identity
672
544
  * (Called by `loginStatusBox()`)
@@ -676,48 +548,43 @@ function getDefaultSignInButtonStyle() {
676
548
  *
677
549
  * @returns
678
550
  */
679
-
680
-
681
551
  function signInOrSignUpBox(dom, setUserCallback) {
682
552
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
683
553
  options = options || {};
684
- var signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle(); // @@ TODO Remove the need to cast HTML element to any
554
+ var signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle();
685
555
 
556
+ // @@ TODO Remove the need to cast HTML element to any
686
557
  var box = dom.createElement('div');
687
558
  var magicClassName = 'SolidSignInOrSignUpBox';
688
559
  debug.log('widgets.signInOrSignUpBox');
689
560
  box.setUserCallback = setUserCallback;
690
561
  box.setAttribute('class', magicClassName);
691
562
  box.style = 'display:flex;'; // @@ fix all typecasts like this
692
- // Sign in button with PopUP
693
563
 
564
+ // Sign in button with PopUP
694
565
  var signInPopUpButton = dom.createElement('input'); // multi
695
-
696
566
  box.appendChild(signInPopUpButton);
697
567
  signInPopUpButton.setAttribute('type', 'button');
698
568
  signInPopUpButton.setAttribute('value', 'Log in');
699
569
  signInPopUpButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #eef;"));
700
-
701
570
  _solidLogic.authSession.onLogin(function () {
702
- var me = _solidLogic.authn.currentUser(); // const sessionInfo = authSession.info
571
+ var me = _solidLogic.authn.currentUser();
572
+ // const sessionInfo = authSession.info
703
573
  // if (sessionInfo && sessionInfo.isLoggedIn) {
704
-
705
-
706
574
  if (me) {
707
575
  // const webIdURI = sessionInfo.webId
708
- var webIdURI = me.uri; // setUserCallback(webIdURI)
709
-
576
+ var webIdURI = me.uri;
577
+ // setUserCallback(webIdURI)
710
578
  var divs = dom.getElementsByClassName(magicClassName);
711
- debug.log("Logged in, ".concat(divs.length, " panels to be serviced")); // At the same time, satisfy all the other login boxes
712
-
579
+ debug.log("Logged in, ".concat(divs.length, " panels to be serviced"));
580
+ // At the same time, satisfy all the other login boxes
713
581
  for (var i = 0; i < divs.length; i++) {
714
- var div = divs[i]; // @@ TODO Remove the need to manipulate HTML elements
715
-
582
+ var div = divs[i];
583
+ // @@ TODO Remove the need to manipulate HTML elements
716
584
  if (div.setUserCallback) {
717
585
  try {
718
586
  div.setUserCallback(webIdURI);
719
587
  var parent = div.parentNode;
720
-
721
588
  if (parent) {
722
589
  parent.removeChild(div);
723
590
  }
@@ -729,13 +596,13 @@ function signInOrSignUpBox(dom, setUserCallback) {
729
596
  }
730
597
  }
731
598
  });
732
-
733
599
  signInPopUpButton.addEventListener('click', function () {
734
600
  var offline = (0, _solidLogic.offlineTestID)();
735
601
  if (offline) return setUserCallback(offline.uri);
736
602
  renderSignInPopup(dom);
737
- }, false); // Sign up button
603
+ }, false);
738
604
 
605
+ // Sign up button
739
606
  var signupButton = dom.createElement('input');
740
607
  box.appendChild(signupButton);
741
608
  signupButton.setAttribute('type', 'button');
@@ -750,7 +617,6 @@ function signInOrSignUpBox(dom, setUserCallback) {
750
617
  }, false);
751
618
  return box;
752
619
  }
753
-
754
620
  function renderSignInPopup(dom) {
755
621
  /**
756
622
  * Issuer Menu
@@ -775,7 +641,6 @@ function renderSignInPopup(dom) {
775
641
  });
776
642
  issuerPopupBoxTopMenu.appendChild(issuerPopupBoxLabel);
777
643
  issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton);
778
-
779
644
  var loginToIssuer = /*#__PURE__*/function () {
780
645
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(issuerUri) {
781
646
  var preLoginRedirectHash;
@@ -786,28 +651,23 @@ function renderSignInPopup(dom) {
786
651
  _context.prev = 0;
787
652
  // Save hash
788
653
  preLoginRedirectHash = new URL(window.location.href).hash;
789
-
790
654
  if (preLoginRedirectHash) {
791
655
  window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash);
792
656
  }
793
-
794
- window.localStorage.setItem('loginIssuer', issuerUri); // Login
795
-
657
+ window.localStorage.setItem('loginIssuer', issuerUri);
658
+ // Login
796
659
  _context.next = 6;
797
660
  return _solidLogic.authSession.login({
798
661
  redirectUrl: window.location.href,
799
662
  oidcIssuer: issuerUri
800
663
  });
801
-
802
664
  case 6:
803
665
  _context.next = 11;
804
666
  break;
805
-
806
667
  case 8:
807
668
  _context.prev = 8;
808
669
  _context.t0 = _context["catch"](0);
809
670
  (0, _log.alert)(_context.t0.message);
810
-
811
671
  case 11:
812
672
  case "end":
813
673
  return _context.stop();
@@ -815,16 +675,14 @@ function renderSignInPopup(dom) {
815
675
  }
816
676
  }, _callee, null, [[0, 8]]);
817
677
  }));
818
-
819
678
  return function loginToIssuer(_x11) {
820
679
  return _ref.apply(this, arguments);
821
680
  };
822
681
  }();
682
+
823
683
  /**
824
684
  * Text-based idp selection
825
685
  */
826
-
827
-
828
686
  var issuerTextContainer = dom.createElement('div');
829
687
  issuerTextContainer.setAttribute('style', "\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");
830
688
  var issuerTextInputContainer = dom.createElement('div');
@@ -848,10 +706,10 @@ function renderSignInPopup(dom) {
848
706
  issuerTextInputContainer.appendChild(issuerTextGoButton);
849
707
  issuerTextContainer.appendChild(issuerTextInputContainer);
850
708
  issuerPopupBox.appendChild(issuerTextContainer);
709
+
851
710
  /**
852
711
  * Button-based idp selection
853
712
  */
854
-
855
713
  var issuerButtonContainer = dom.createElement('div');
856
714
  issuerButtonContainer.setAttribute('style', "\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");
857
715
  var issuerBottonLabel = dom.createElement('label');
@@ -869,6 +727,7 @@ function renderSignInPopup(dom) {
869
727
  });
870
728
  issuerPopupBox.appendChild(issuerButtonContainer);
871
729
  }
730
+
872
731
  /**
873
732
  * Login status box
874
733
  *
@@ -879,110 +738,86 @@ function renderSignInPopup(dom) {
879
738
  *
880
739
  * @returns
881
740
  */
882
-
883
-
884
741
  function loginStatusBox(dom) {
885
742
  var listener = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
886
743
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
887
744
  // 20190630
888
- var me = (0, _solidLogic.offlineTestID)(); // @@ TODO Remove the need to cast HTML element to any
889
-
745
+ var me = (0, _solidLogic.offlineTestID)();
746
+ // @@ TODO Remove the need to cast HTML element to any
890
747
  var box = dom.createElement('div');
891
-
892
748
  function setIt(newidURI) {
893
749
  if (!newidURI) {
894
750
  return;
895
- } // const uri = newidURI.uri || newidURI
896
- // me = sym(uri)
897
-
751
+ }
898
752
 
753
+ // const uri = newidURI.uri || newidURI
754
+ // me = sym(uri)
899
755
  me = _solidLogic.authn.saveUser(newidURI);
900
756
  box.refresh();
901
757
  if (listener) listener(me.uri);
902
758
  }
903
-
904
759
  function logoutButtonHandler(_event) {
905
760
  var oldMe = me;
906
-
907
761
  _solidLogic.authSession.logout().then(function () {
908
762
  var message = "Your WebID was ".concat(oldMe, ". It has been forgotten.");
909
763
  me = null;
910
-
911
764
  try {
912
765
  (0, _log.alert)(message);
913
766
  } catch (e) {
914
767
  window.alert(message);
915
768
  }
916
-
917
769
  box.refresh();
918
770
  if (listener) listener(null);
919
771
  }, function (err) {
920
772
  (0, _log.alert)('Fail to log out:' + err);
921
773
  });
922
774
  }
923
-
924
775
  function logoutButton(me, options) {
925
776
  var signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle();
926
777
  var logoutLabel = 'WebID logout';
927
-
928
778
  if (me) {
929
779
  var nick = _solidLogic.solidLogicSingleton.store.any(me, ns.foaf('nick')) || _solidLogic.solidLogicSingleton.store.any(me, ns.foaf('name'));
930
-
931
780
  if (nick) {
932
781
  logoutLabel = 'Logout ' + nick.value;
933
782
  }
934
783
  }
935
-
936
- var signOutButton = dom.createElement('input'); // signOutButton.className = 'WebIDCancelButton'
937
-
784
+ var signOutButton = dom.createElement('input');
785
+ // signOutButton.className = 'WebIDCancelButton'
938
786
  signOutButton.setAttribute('type', 'button');
939
787
  signOutButton.setAttribute('value', logoutLabel);
940
788
  signOutButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #eee;"));
941
789
  signOutButton.addEventListener('click', logoutButtonHandler, false);
942
790
  return signOutButton;
943
791
  }
944
-
945
792
  box.refresh = function () {
946
793
  var sessionInfo = _solidLogic.authSession.info;
947
-
948
794
  if (sessionInfo && sessionInfo.webId && sessionInfo.isLoggedIn) {
949
795
  me = _solidLogic.solidLogicSingleton.store.sym(sessionInfo.webId);
950
796
  } else {
951
797
  me = null;
952
798
  }
953
-
954
799
  if (me && box.me !== me.uri || !me && box.me) {
955
800
  widgets.clearElement(box);
956
-
957
801
  if (me) {
958
802
  box.appendChild(logoutButton(me, options));
959
803
  } else {
960
804
  box.appendChild(signInOrSignUpBox(dom, setIt, options));
961
805
  }
962
806
  }
963
-
964
807
  box.me = me ? me.uri : null;
965
808
  };
966
-
967
809
  box.refresh();
968
-
969
810
  function trackSession() {
970
811
  me = _solidLogic.authn.currentUser();
971
812
  box.refresh();
972
813
  }
973
-
974
814
  trackSession();
975
-
976
815
  _solidLogic.authSession.onLogin(trackSession);
977
-
978
816
  _solidLogic.authSession.onLogout(trackSession);
979
-
980
817
  box.me = '99999'; // Force refresh
981
-
982
818
  box.refresh();
983
819
  return box;
984
820
  }
985
-
986
821
  _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
987
822
  var issuer, wellKnownUri, wellKnownResult, openidConfiguration;
988
823
  return _regenerator["default"].wrap(function _callee2$(_context2) {
@@ -990,53 +825,41 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
990
825
  switch (_context2.prev = _context2.next) {
991
826
  case 0:
992
827
  issuer = window.localStorage.getItem('loginIssuer');
993
-
994
828
  if (!issuer) {
995
829
  _context2.next = 19;
996
830
  break;
997
831
  }
998
-
999
832
  _context2.prev = 2;
1000
833
  wellKnownUri = new URL(issuer);
1001
834
  wellKnownUri.pathname = '/.well-known/openid-configuration';
1002
835
  _context2.next = 7;
1003
836
  return fetch(wellKnownUri.toString());
1004
-
1005
837
  case 7:
1006
838
  wellKnownResult = _context2.sent;
1007
-
1008
839
  if (!(wellKnownResult.status === 200)) {
1009
840
  _context2.next = 15;
1010
841
  break;
1011
842
  }
1012
-
1013
843
  _context2.next = 11;
1014
844
  return wellKnownResult.json();
1015
-
1016
845
  case 11:
1017
846
  openidConfiguration = _context2.sent;
1018
-
1019
847
  if (!(openidConfiguration && openidConfiguration.end_session_endpoint)) {
1020
848
  _context2.next = 15;
1021
849
  break;
1022
850
  }
1023
-
1024
851
  _context2.next = 15;
1025
852
  return fetch(openidConfiguration.end_session_endpoint, {
1026
853
  credentials: 'include'
1027
854
  });
1028
-
1029
855
  case 15:
1030
856
  _context2.next = 19;
1031
857
  break;
1032
-
1033
858
  case 17:
1034
859
  _context2.prev = 17;
1035
860
  _context2.t0 = _context2["catch"](2);
1036
-
1037
861
  case 19:
1038
862
  window.location.reload();
1039
-
1040
863
  case 20:
1041
864
  case "end":
1042
865
  return _context2.stop();
@@ -1044,6 +867,7 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
1044
867
  }
1045
868
  }, _callee2, null, [[2, 17]]);
1046
869
  })));
870
+
1047
871
  /**
1048
872
  * Workspace selection etc
1049
873
  * See https://github.com/solidos/userguide/issues/16
@@ -1067,8 +891,6 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
1067
891
  * @param appDetails
1068
892
  * @param callbackWS
1069
893
  */
1070
-
1071
-
1072
894
  function selectWorkspace(dom, appDetails, callbackWS) {
1073
895
  var noun = appDetails.noun;
1074
896
  var appPathSegment = appDetails.appPathSegment;
@@ -1079,41 +901,30 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1079
901
  dom: dom,
1080
902
  div: box
1081
903
  };
1082
-
1083
904
  function say(s, background) {
1084
905
  box.appendChild(widgets.errorMessageBlock(dom, s, background));
1085
906
  }
1086
-
1087
907
  function figureOutBase(ws) {
1088
908
  var newBaseNode = _solidLogic.solidLogicSingleton.store.any(ws, ns.space('uriPrefix'));
1089
-
1090
909
  var newBaseString;
1091
-
1092
910
  if (!newBaseNode) {
1093
911
  newBaseString = ws.uri.split('#')[0];
1094
912
  } else {
1095
913
  newBaseString = newBaseNode.value;
1096
914
  }
1097
-
1098
915
  if (newBaseString.slice(-1) !== '/') {
1099
916
  debug.log("".concat(appPathSegment, ": No / at end of uriPrefix ").concat(newBaseString)); // @@ paramater?
1100
-
1101
917
  newBaseString = "".concat(newBaseString, "/");
1102
918
  }
1103
-
1104
919
  var now = new Date();
1105
920
  newBaseString += "".concat(appPathSegment, "/id").concat(now.getTime(), "/"); // unique id
1106
-
1107
921
  return newBaseString;
1108
922
  }
1109
-
1110
923
  function displayOptions(context) {
1111
924
  // console.log('displayOptions!', context)
1112
925
  function makeNewWorkspace(_x12) {
1113
926
  return _makeNewWorkspace.apply(this, arguments);
1114
927
  } // const status = ''
1115
-
1116
-
1117
928
  function _makeNewWorkspace() {
1118
929
  _makeNewWorkspace = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(_event) {
1119
930
  var row, cell, newBase, newWs, newData;
@@ -1128,25 +939,21 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1128
939
  _context3.t0 = encodeURI;
1129
940
  _context3.next = 7;
1130
941
  return widgets.askName(dom, _solidLogic.solidLogicSingleton.store, cell, ns.solid('URL'), ns.space('Workspace'), 'Workspace');
1131
-
1132
942
  case 7:
1133
943
  _context3.t1 = _context3.sent;
1134
944
  newBase = (0, _context3.t0)(_context3.t1);
1135
945
  newWs = widgets.newThing(context.preferencesFile);
1136
- newData = [(0, _rdflib.st)(context.me, ns.space('workspace'), newWs, context.preferencesFile), // eslint-disable-next-line camelcase
946
+ newData = [(0, _rdflib.st)(context.me, ns.space('workspace'), newWs, context.preferencesFile),
947
+ // eslint-disable-next-line camelcase
1137
948
  (0, _rdflib.st)(newWs, ns.space('uriPrefix'), newBase, context.preferencesFile)];
1138
-
1139
949
  if (_solidLogic.solidLogicSingleton.store.updater) {
1140
950
  _context3.next = 13;
1141
951
  break;
1142
952
  }
1143
-
1144
953
  throw new Error('store has no updater');
1145
-
1146
954
  case 13:
1147
955
  _context3.next = 15;
1148
956
  return _solidLogic.solidLogicSingleton.store.updater.update([], newData);
1149
-
1150
957
  case 15:
1151
958
  case "end":
1152
959
  return _context3.stop();
@@ -1156,18 +963,15 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1156
963
  }));
1157
964
  return _makeNewWorkspace.apply(this, arguments);
1158
965
  }
1159
-
1160
966
  var id = context.me;
1161
967
  var preferencesFile = context.preferencesFile;
1162
- var newBase = null; // A workspace specifically defined in the private preference file:
968
+ var newBase = null;
1163
969
 
970
+ // A workspace specifically defined in the private preference file:
1164
971
  var w = _solidLogic.solidLogicSingleton.store.each(id, ns.space('workspace'), undefined, preferencesFile); // Only trust preference file here
1165
- // A workspace in a storage in the public profile:
1166
-
1167
972
 
973
+ // A workspace in a storage in the public profile:
1168
974
  var storages = _solidLogic.solidLogicSingleton.store.each(id, ns.space('storage')); // @@ No provenance requirement at the moment
1169
-
1170
-
1171
975
  if (w.length === 0 && storages) {
1172
976
  say("You don't seem to have any workspaces. You have ".concat(storages.length, " storage spaces."), 'white');
1173
977
  storages.map(function (s) {
@@ -1177,41 +981,40 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1177
981
  return file.id ? ['public', 'private'].includes(file.id().toLowerCase()) : '';
1178
982
  });
1179
983
  }
1180
-
1181
984
  if (w.length === 1) {
1182
985
  say("Workspace used: ".concat(w[0].uri), 'white'); // @@ allow user to see URI
1183
-
1184
- newBase = figureOutBase(w[0]); // callbackWS(w[0], newBase)
986
+ newBase = figureOutBase(w[0]);
987
+ // callbackWS(w[0], newBase)
1185
988
  // } else if (w.length === 0) {
1186
- } // Prompt for ws selection or creation
989
+ }
990
+
991
+ // Prompt for ws selection or creation
1187
992
  // say( w.length + " workspaces for " + id + "Choose one.");
993
+ var table = dom.createElement('table');
994
+ table.setAttribute('style', 'border-collapse:separate; border-spacing: 0.5em;');
1188
995
 
996
+ // const popup = window.open(undefined, '_blank', { height: 300, width:400 }, false)
997
+ box.appendChild(table);
1189
998
 
1190
- var table = dom.createElement('table');
1191
- table.setAttribute('style', 'border-collapse:separate; border-spacing: 0.5em;'); // const popup = window.open(undefined, '_blank', { height: 300, width:400 }, false)
999
+ // Add a field for directly adding the URI yourself
1192
1000
 
1193
- box.appendChild(table); // Add a field for directly adding the URI yourself
1194
1001
  // const hr = box.appendChild(dom.createElement('hr')) // @@
1195
-
1196
1002
  box.appendChild(dom.createElement('hr')); // @@
1197
1003
 
1198
1004
  var p = box.appendChild(dom.createElement('p'));
1199
1005
  p.style = _style.commentStyle;
1200
- p.textContent = "Where would you like to store the data for the ".concat(noun, "?\n Give the URL of the folder where you would like the data stored.\n It can be anywhere in solid world - this URI is just an idea."); // @@ TODO Remove the need to cast baseField to any
1201
-
1006
+ p.textContent = "Where would you like to store the data for the ".concat(noun, "?\n Give the URL of the folder where you would like the data stored.\n It can be anywhere in solid world - this URI is just an idea.");
1007
+ // @@ TODO Remove the need to cast baseField to any
1202
1008
  var baseField = box.appendChild(dom.createElement('input'));
1203
1009
  baseField.setAttribute('type', 'text');
1204
1010
  baseField.style = _style.textInputStyle;
1205
1011
  baseField.size = 80; // really a string
1206
-
1207
1012
  baseField.label = 'base URL';
1208
1013
  baseField.autocomplete = 'on';
1209
-
1210
1014
  if (newBase) {
1211
1015
  // set to default
1212
1016
  baseField.value = newBase;
1213
1017
  }
1214
-
1215
1018
  context.baseField = baseField;
1216
1019
  box.appendChild(dom.createElement('br')); // @@
1217
1020
 
@@ -1220,27 +1023,27 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1220
1023
  button.textContent = "Start new ".concat(noun, " at this URI");
1221
1024
  button.addEventListener('click', function (_event) {
1222
1025
  var newBase = baseField.value.replace(' ', '%20'); // do not re-encode in general, as % encodings may exist
1223
-
1224
1026
  if (newBase.slice(-1) !== '/') {
1225
1027
  newBase += '/';
1226
1028
  }
1227
-
1228
1029
  callbackWS(null, newBase);
1229
- }); // Now go set up the table of spaces
1230
- // const row = 0
1030
+ });
1231
1031
 
1032
+ // Now go set up the table of spaces
1033
+
1034
+ // const row = 0
1232
1035
  w = w.filter(function (x) {
1233
- return !_solidLogic.solidLogicSingleton.store.holds(x, ns.rdf('type'), // Ignore master workspaces
1036
+ return !_solidLogic.solidLogicSingleton.store.holds(x, ns.rdf('type'),
1037
+ // Ignore master workspaces
1234
1038
  ns.space('MasterWorkspace'));
1235
1039
  });
1236
1040
  var col1, col2, col3, tr, ws, style, comment;
1237
1041
  var cellStyle = 'height: 3em; margin: 1em; padding: 1em white; border-radius: 0.3em;';
1238
- var deselectedStyle = "".concat(cellStyle, "border: 0px;"); // const selectedStyle = cellStyle + 'border: 1px solid black;'
1239
-
1042
+ var deselectedStyle = "".concat(cellStyle, "border: 0px;");
1043
+ // const selectedStyle = cellStyle + 'border: 1px solid black;'
1240
1044
  for (var i = 0; i < w.length; i++) {
1241
1045
  ws = w[i];
1242
1046
  tr = dom.createElement('tr');
1243
-
1244
1047
  if (i === 0) {
1245
1048
  col1 = dom.createElement('td');
1246
1049
  col1.setAttribute('rowspan', "".concat(w.length));
@@ -1248,10 +1051,8 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1248
1051
  col1.setAttribute('style', 'vertical-align:middle;');
1249
1052
  tr.appendChild(col1);
1250
1053
  }
1251
-
1252
1054
  col2 = dom.createElement('td');
1253
1055
  style = _solidLogic.solidLogicSingleton.store.anyValue(ws, ns.ui('style'));
1254
-
1255
1056
  if (!style) {
1256
1057
  // Otherwise make up arbitrary colour
1257
1058
  var hash = function hash(x) {
@@ -1260,32 +1061,24 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1260
1061
  return a & a;
1261
1062
  }, 0);
1262
1063
  };
1263
-
1264
1064
  var bgcolor = "#".concat((hash(ws.uri) & 0xffffff | 0xc0c0c0).toString(16)); // c0c0c0 forces pale
1265
-
1266
1065
  style = "color: black ; background-color: ".concat(bgcolor, ";");
1267
1066
  }
1268
-
1269
1067
  col2.setAttribute('style', deselectedStyle + style);
1270
1068
  tr.target = ws.uri;
1271
-
1272
1069
  var label = _solidLogic.solidLogicSingleton.store.any(ws, ns.rdfs('label'));
1273
-
1274
1070
  if (!label) {
1275
1071
  label = ws.uri.split('/').slice(-1)[0] || ws.uri.split('/').slice(-2)[0];
1276
1072
  }
1277
-
1278
1073
  col2.textContent = label || '???';
1279
1074
  tr.appendChild(col2);
1280
-
1281
1075
  if (i === 0) {
1282
1076
  col3 = dom.createElement('td');
1283
- col3.setAttribute('rowspan', "".concat(w.length, "1")); // col3.textContent = '@@@@@ remove';
1284
-
1077
+ col3.setAttribute('rowspan', "".concat(w.length, "1"));
1078
+ // col3.textContent = '@@@@@ remove';
1285
1079
  col3.setAttribute('style', 'width:50%;');
1286
1080
  tr.appendChild(col3);
1287
1081
  }
1288
-
1289
1082
  table.appendChild(tr);
1290
1083
  comment = _solidLogic.solidLogicSingleton.store.any(ws, ns.rdfs('comment'));
1291
1084
  comment = comment ? comment.value : 'Use this workspace';
@@ -1293,8 +1086,8 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1293
1086
  col3.textContent = comment ? comment.value : '';
1294
1087
  col3.setAttribute('style', deselectedStyle + style);
1295
1088
  var button = dom.createElement('button');
1296
- button.textContent = 'Continue'; // button.setAttribute('style', style);
1297
-
1089
+ button.textContent = 'Continue';
1090
+ // button.setAttribute('style', style);
1298
1091
  var newBase = figureOutBase(ws);
1299
1092
  baseField.value = newBase; // show user proposed URI
1300
1093
 
@@ -1303,12 +1096,11 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1303
1096
  callbackWS(ws, newBase);
1304
1097
  button.textContent = '---->';
1305
1098
  }, true); // capture vs bubble
1306
-
1307
1099
  col3.appendChild(button);
1308
1100
  }, true); // capture vs bubble
1309
- } // last line with "Make new workspace"
1310
-
1101
+ }
1311
1102
 
1103
+ // last line with "Make new workspace"
1312
1104
  var trLast = dom.createElement('tr');
1313
1105
  col2 = dom.createElement('td');
1314
1106
  col2.setAttribute('style', cellStyle);
@@ -1317,9 +1109,8 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1317
1109
  trLast.appendChild(col2);
1318
1110
  table.appendChild(trLast);
1319
1111
  } // displayOptions
1320
- // console.log('kicking off async operation')
1321
-
1322
1112
 
1113
+ // console.log('kicking off async operation')
1323
1114
  ensureLoadedPreferences(context) // kick off async operation
1324
1115
  .then(displayOptions)["catch"](function (err) {
1325
1116
  // console.log("err from async op")
@@ -1344,14 +1135,11 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1344
1135
  *
1345
1136
  * @returns A div with a button in it for making a new app instance
1346
1137
  */
1347
-
1348
-
1349
1138
  function newAppInstance(dom, appDetails, callback) {
1350
1139
  var gotWS = function gotWS(ws, base) {
1351
1140
  // log.debug("newAppInstance: Selected workspace = " + (ws? ws.uri : 'none'))
1352
1141
  callback(ws, base);
1353
1142
  };
1354
-
1355
1143
  var div = dom.createElement('div');
1356
1144
  var b = dom.createElement('button');
1357
1145
  b.setAttribute('type', 'button');
@@ -1367,20 +1155,15 @@ function newAppInstance(dom, appDetails, callback) {
1367
1155
  * Retrieves whether the currently logged in user is a power user
1368
1156
  * and/or a developer
1369
1157
  */
1370
-
1371
-
1372
1158
  function getUserRoles() {
1373
1159
  return _getUserRoles.apply(this, arguments);
1374
1160
  }
1375
1161
  /**
1376
1162
  * Filters which panes should be available, based on the result of [[getUserRoles]]
1377
1163
  */
1378
-
1379
-
1380
1164
  function _getUserRoles() {
1381
1165
  _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
1382
1166
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
1383
-
1384
1167
  return _regenerator["default"].wrap(function _callee10$(_context10) {
1385
1168
  while (1) {
1386
1169
  switch (_context10.prev = _context10.next) {
@@ -1388,31 +1171,24 @@ function _getUserRoles() {
1388
1171
  _context10.prev = 0;
1389
1172
  _context10.next = 3;
1390
1173
  return ensureLoadedPreferences({});
1391
-
1392
1174
  case 3:
1393
1175
  _yield$ensureLoadedPr = _context10.sent;
1394
1176
  me = _yield$ensureLoadedPr.me;
1395
1177
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
1396
1178
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
1397
-
1398
1179
  if (!(!preferencesFile || preferencesFileError)) {
1399
1180
  _context10.next = 9;
1400
1181
  break;
1401
1182
  }
1402
-
1403
1183
  throw new Error(preferencesFileError);
1404
-
1405
1184
  case 9:
1406
1185
  return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
1407
-
1408
1186
  case 12:
1409
1187
  _context10.prev = 12;
1410
1188
  _context10.t0 = _context10["catch"](0);
1411
1189
  debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
1412
-
1413
1190
  case 15:
1414
1191
  return _context10.abrupt("return", []);
1415
-
1416
1192
  case 16:
1417
1193
  case "end":
1418
1194
  return _context10.stop();
@@ -1422,11 +1198,9 @@ function _getUserRoles() {
1422
1198
  }));
1423
1199
  return _getUserRoles.apply(this, arguments);
1424
1200
  }
1425
-
1426
1201
  function filterAvailablePanes(_x13) {
1427
1202
  return _filterAvailablePanes.apply(this, arguments);
1428
1203
  }
1429
-
1430
1204
  function _filterAvailablePanes() {
1431
1205
  _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
1432
1206
  var userRoles;
@@ -1436,13 +1210,11 @@ function _filterAvailablePanes() {
1436
1210
  case 0:
1437
1211
  _context11.next = 2;
1438
1212
  return getUserRoles();
1439
-
1440
1213
  case 2:
1441
1214
  userRoles = _context11.sent;
1442
1215
  return _context11.abrupt("return", panes.filter(function (pane) {
1443
1216
  return isMatchingAudience(pane, userRoles);
1444
1217
  }));
1445
-
1446
1218
  case 4:
1447
1219
  case "end":
1448
1220
  return _context11.stop();
@@ -1452,7 +1224,6 @@ function _filterAvailablePanes() {
1452
1224
  }));
1453
1225
  return _filterAvailablePanes.apply(this, arguments);
1454
1226
  }
1455
-
1456
1227
  function isMatchingAudience(pane, userRoles) {
1457
1228
  var audience = pane.audience || [];
1458
1229
  return audience.reduce(function (isMatch, audienceRole) {