solid-ui 2.4.21-f8053087 → 2.4.22-027fc53e

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 (64) hide show
  1. package/README.md +23 -58
  2. package/dist/main.js +2201 -704
  3. package/dist/main.js.map +1 -1
  4. package/lib/acl/access-controller.js +2 -2
  5. package/lib/acl/access-controller.js.map +1 -1
  6. package/lib/acl/access-groups.d.ts +1 -1
  7. package/lib/acl/access-groups.js +1 -1
  8. package/lib/acl/access-groups.js.map +1 -1
  9. package/lib/acl/acl-control.d.ts +2 -2
  10. package/lib/acl/acl-control.js +5 -5
  11. package/lib/acl/acl-control.js.map +1 -1
  12. package/lib/acl/acl.d.ts +1 -1
  13. package/lib/acl/acl.js +1 -1
  14. package/lib/acl/acl.js.map +1 -1
  15. package/lib/acl/add-agent-buttons.d.ts +1 -1
  16. package/lib/acl/add-agent-buttons.js +1 -1
  17. package/lib/acl/add-agent-buttons.js.map +1 -1
  18. package/lib/acl/styles.d.ts +1 -1
  19. package/lib/acl/styles.js +1 -1
  20. package/lib/acl/styles.js.map +1 -1
  21. package/lib/chat/bookmarks.js +1 -2
  22. package/lib/chat/bookmarks.js.map +1 -1
  23. package/lib/chat/infinite.js.map +1 -1
  24. package/lib/iconBase.d.ts.map +1 -1
  25. package/lib/iconBase.js +4 -3
  26. package/lib/iconBase.js.map +1 -1
  27. package/lib/index.js +1 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/jss/index.d.ts +2 -2
  30. package/lib/jss/index.js +2 -2
  31. package/lib/jss/index.js.map +1 -1
  32. package/lib/login/login.d.ts +55 -51
  33. package/lib/login/login.d.ts.map +1 -1
  34. package/lib/login/login.js +319 -370
  35. package/lib/login/login.js.map +1 -1
  36. package/lib/participation.js +1 -1
  37. package/lib/participation.js.map +1 -1
  38. package/lib/style_multiSelect.js +67 -0
  39. package/lib/style_multiSelect.js.map +1 -0
  40. package/lib/tabs.d.ts +2 -2
  41. package/lib/tabs.d.ts.map +1 -1
  42. package/lib/tabs.js +39 -24
  43. package/lib/tabs.js.map +1 -1
  44. package/lib/utils/headerFooterHelpers.js +24 -19
  45. package/lib/utils/headerFooterHelpers.js.map +1 -1
  46. package/lib/utils/label.js +1 -1
  47. package/lib/utils/label.js.map +1 -1
  48. package/lib/versionInfo.js +7 -7
  49. package/lib/versionInfo.js.map +1 -1
  50. package/lib/widgets/buttons.d.ts.map +1 -1
  51. package/lib/widgets/buttons.js +2 -0
  52. package/lib/widgets/buttons.js.map +1 -1
  53. package/lib/widgets/error.d.ts +0 -12
  54. package/lib/widgets/error.d.ts.map +1 -1
  55. package/lib/widgets/error.js +5 -0
  56. package/lib/widgets/error.js.map +1 -1
  57. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  58. package/lib/widgets/forms/autocomplete/publicData.js +1 -1
  59. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  60. package/lib/widgets/forms.js +427 -161
  61. package/lib/widgets/forms.js.map +1 -1
  62. package/lib/widgets/multiSelect.js +784 -0
  63. package/lib/widgets/multiSelect.js.map +1 -0
  64. package/package.json +14 -11
@@ -17,7 +17,9 @@ exports.loginStatusBox = loginStatusBox;
17
17
  exports.newAppInstance = newAppInstance;
18
18
  exports.registrationControl = registrationControl;
19
19
  exports.registrationList = registrationList;
20
+ exports.renderScopeHeadingRow = renderScopeHeadingRow;
20
21
  exports.renderSignInPopup = renderSignInPopup;
22
+ exports.scopeLabel = scopeLabel;
21
23
  exports.selectWorkspace = selectWorkspace;
22
24
 
23
25
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
@@ -38,7 +40,7 @@ var _signup = require("../signup/signup.js");
38
40
 
39
41
  var _style = require("../style");
40
42
 
41
- var _index = require("../utils/index");
43
+ var utils = _interopRequireWildcard(require("../utils"));
42
44
 
43
45
  var widgets = _interopRequireWildcard(require("../widgets"));
44
46
 
@@ -46,37 +48,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
46
48
 
47
49
  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; }
48
50
 
51
+ 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
+ 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
+ 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
+ var store = _solidLogic.solidLogicSingleton.store;
49
58
  /**
50
- * Signing in, signing up, profile and preferences reloading
51
- * Type index management
59
+ * Resolves with the logged in user's WebID
52
60
  *
53
- * Many functions in this module take a context object which
54
- * holds various RDF symbols, add to it, and return a promise of it.
55
- *
56
- * * `me` RDF symbol for the user's WebID
57
- * * `publicProfile` The user's public profile, iff loaded
58
- * * `preferencesFile` The user's personal preference file, iff loaded
59
- * * `index.public` The user's public type index file
60
- * * `index.private` The user's private type index file
61
- *
62
- * Not RDF symbols:
63
- * * `noun` A string in english for the type of thing -- like "address book"
64
- * * `instance` An array of nodes which are existing instances
65
- * * `containers` An array of nodes of containers of instances
66
- * * `div` A DOM element where UI can be displayed
67
- * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
68
- * *
69
- * * Vocabulary: "load" loads a file if it exists;
70
- * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
71
- * @packageDocumentation
61
+ * @param context
72
62
  */
73
-
74
- /**
75
- * Resolves with the logged in user's WebID
76
- *
77
- * @param context
78
- */
79
63
  // used to be logIn
64
+
80
65
  function ensureLoggedIn(context) {
81
66
  var me = _solidLogic.authn.currentUser();
82
67
 
@@ -118,7 +103,7 @@ function ensureLoggedIn(context) {
118
103
  // used to be logInLoadPreferences
119
104
 
120
105
 
121
- function ensureLoadedPreferences(_x2) {
106
+ function ensureLoadedPreferences(_x) {
122
107
  return _ensureLoadedPreferences.apply(this, arguments);
123
108
  }
124
109
  /**
@@ -265,7 +250,7 @@ function _ensureLoadedPreferences() {
265
250
  return _ensureLoadedPreferences.apply(this, arguments);
266
251
  }
267
252
 
268
- function ensureLoadedProfile(_x3) {
253
+ function ensureLoadedProfile(_x2) {
269
254
  return _ensureLoadedProfile.apply(this, arguments);
270
255
  }
271
256
  /**
@@ -273,6 +258,8 @@ function ensureLoadedProfile(_x3) {
273
258
  *
274
259
  * 2016-12-11 change to include forClass arc a la
275
260
  * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
261
+ * This is now legacy; should instead use solid-logic getAppInstances
262
+ * leaving the `isPublic` param undefined will bring in community index things, too
276
263
  */
277
264
 
278
265
 
@@ -337,210 +324,139 @@ function _ensureLoadedProfile() {
337
324
  return _ensureLoadedProfile.apply(this, arguments);
338
325
  }
339
326
 
340
- function findAppInstances(_x4, _x5, _x6) {
327
+ function findAppInstances(_x3, _x4, _x5) {
341
328
  return _findAppInstances.apply(this, arguments);
342
329
  }
343
- /**
344
- * UI to control registration of instance
345
- */
346
-
347
330
 
348
331
  function _findAppInstances() {
349
332
  _findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
350
- var visibility, index, thisIndex, registrations, instances, containers, unique, e, i, cont;
333
+ var items;
351
334
  return _regenerator["default"].wrap(function _callee6$(_context6) {
352
335
  while (1) {
353
336
  switch (_context6.prev = _context6.next) {
354
337
  case 0:
355
- unique = function _unique(arr) {
356
- return Array.from(new Set(arr));
357
- };
358
-
359
- if (!(isPublic === undefined)) {
360
- _context6.next = 7;
338
+ if (!context.me) {
339
+ _context6.next = 6;
361
340
  break;
362
341
  }
363
342
 
364
- _context6.next = 4;
365
- return findAppInstances(context, theClass, true);
343
+ _context6.next = 3;
344
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
366
345
 
367
- case 4:
368
- _context6.next = 6;
369
- return findAppInstances(context, theClass, false);
346
+ case 3:
347
+ _context6.t0 = _context6.sent;
348
+ _context6.next = 7;
349
+ break;
370
350
 
371
351
  case 6:
372
- return _context6.abrupt("return", context);
352
+ _context6.t0 = [];
373
353
 
374
354
  case 7:
375
- _context6.prev = 7;
376
- _context6.next = 10;
377
- return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
378
-
379
- case 10:
380
- _context6.next = 15;
381
- break;
355
+ items = _context6.t0;
382
356
 
383
- case 12:
384
- _context6.prev = 12;
385
- _context6.t0 = _context6["catch"](7);
386
- widgets.complain(context, "loadIndex: login and load problem ".concat(_context6.t0));
387
-
388
- case 15:
389
- // console.log('awaited LogInLoad!', context)
390
- visibility = isPublic ? 'public' : 'private';
391
- _context6.prev = 16;
392
- _context6.next = 19;
393
- return (0, _solidLogic.loadIndex)(context, isPublic);
394
-
395
- case 19:
396
- _context6.next = 24;
397
- break;
398
-
399
- case 21:
400
- _context6.prev = 21;
401
- _context6.t1 = _context6["catch"](16);
402
- debug.error(_context6.t1);
403
-
404
- case 24:
405
- index = context.index;
406
- thisIndex = index[visibility];
407
- registrations = thisIndex.map(function (ix) {
408
- return _solidLogic.solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix);
409
- }).reduce(function (acc, curr) {
410
- return acc.concat(curr);
411
- }, []);
412
- instances = registrations.map(function (reg) {
413
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instance'));
414
- }).reduce(function (acc, curr) {
415
- return acc.concat(curr);
416
- }, []);
417
- containers = registrations.map(function (reg) {
418
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instanceContainer'));
419
- }).reduce(function (acc, curr) {
420
- return acc.concat(curr);
421
- }, []);
422
- context.instances = context.instances || [];
423
- context.instances = unique(context.instances.concat(instances));
424
- context.containers = context.containers || [];
425
- context.containers = unique(context.containers.concat(containers));
426
-
427
- if (containers.length) {
428
- _context6.next = 35;
429
- break;
430
- }
431
-
432
- return _context6.abrupt("return", context);
433
-
434
- case 35:
435
- _context6.prev = 35;
436
- _context6.next = 38;
437
- return _solidLogic.solidLogicSingleton.load(containers);
438
-
439
- case 38:
440
- _context6.next = 45;
441
- break;
442
-
443
- case 40:
444
- _context6.prev = 40;
445
- _context6.t2 = _context6["catch"](35);
446
- e = new Error("[FAI] Unable to load containers".concat(_context6.t2));
447
- debug.log(e); // complain
448
-
449
- widgets.complain(context, "Error looking for ".concat(_index.utils.label(theClass), ": ").concat(_context6.t2)); // but then ignore it
450
- // throw new Error(e)
451
-
452
- case 45:
453
- i = 0;
454
-
455
- case 46:
456
- if (!(i < containers.length)) {
457
- _context6.next = 56;
458
- break;
357
+ if (isPublic === true) {
358
+ // old API - not recommended!
359
+ items = items.filter(function (item) {
360
+ return item.scope.label === 'public';
361
+ });
362
+ } else if (isPublic === false) {
363
+ items = items.filter(function (item) {
364
+ return item.scope.label === 'private';
365
+ });
459
366
  }
460
367
 
461
- cont = containers[i];
462
- _context6.t3 = context.instances;
463
- _context6.next = 51;
464
- return _solidLogic.solidLogicSingleton.getContainerMembers(cont.value);
465
-
466
- case 51:
467
- _context6.t4 = _context6.sent.map(function (uri) {
468
- return _solidLogic.solidLogicSingleton.store.sym(uri);
368
+ context.instances = items.map(function (item) {
369
+ return item.instance;
469
370
  });
470
- context.instances = _context6.t3.concat.call(_context6.t3, _context6.t4);
471
-
472
- case 53:
473
- i++;
474
- _context6.next = 46;
475
- break;
476
-
477
- case 56:
478
371
  return _context6.abrupt("return", context);
479
372
 
480
- case 57:
373
+ case 11:
481
374
  case "end":
482
375
  return _context6.stop();
483
376
  }
484
377
  }
485
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
378
+ }, _callee6);
486
379
  }));
487
380
  return _findAppInstances.apply(this, arguments);
488
381
  }
489
382
 
490
- function registrationControl(_x7, _x8, _x9) {
491
- return _registrationControl.apply(this, arguments);
383
+ function scopeLabel(context, scope) {
384
+ var mine = context.me && context.me.sameTerm(scope.agent);
385
+ var name = mine ? '' : utils.label(scope.agent) + ' ';
386
+ return "".concat(name).concat(scope.label);
492
387
  }
493
388
  /**
494
- * UI to List at all registered things
495
- */
389
+ * UI to control registration of instance
390
+ */
496
391
 
497
392
 
393
+ function registrationControl(_x6, _x7, _x8) {
394
+ return _registrationControl.apply(this, arguments);
395
+ }
396
+
498
397
  function _registrationControl() {
499
398
  _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
500
- var dom, box, context2, msg, tbody, form, registrationStatements, index, statements, _msg;
399
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
501
400
 
502
401
  return _regenerator["default"].wrap(function _callee7$(_context7) {
503
402
  while (1) {
504
403
  switch (_context7.prev = _context7.next) {
505
404
  case 0:
405
+ renderScopeCheckbox = function _renderScopeCheckbox(scope) {
406
+ var statements = registrationStatements(scope.index);
407
+ var name = scopeLabel(context, scope);
408
+ var label = "".concat(name, " link to this ").concat(context.noun);
409
+ return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
410
+ };
411
+
412
+ registrationStatements = function _registrationStatemen(index) {
413
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
414
+
415
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
416
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
417
+ };
418
+
419
+ /// / body of registrationControl
506
420
  dom = context.dom;
507
421
 
508
422
  if (!(!dom || !context.div)) {
509
- _context7.next = 3;
423
+ _context7.next = 5;
510
424
  break;
511
425
  }
512
426
 
513
- return _context7.abrupt("return", context);
427
+ throw new Error('registrationControl: need dom and div');
514
428
 
515
- case 3:
429
+ case 5:
516
430
  box = dom.createElement('div');
517
431
  context.div.appendChild(box);
518
432
  context.me = _solidLogic.authn.currentUser(); // @@
519
433
 
520
- if (context.me) {
521
- _context7.next = 9;
434
+ me = context.me;
435
+
436
+ if (me) {
437
+ _context7.next = 12;
522
438
  break;
523
439
  }
524
440
 
525
441
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
526
442
  return _context7.abrupt("return", context);
527
443
 
528
- case 9:
529
- _context7.prev = 9;
530
- _context7.next = 12;
531
- return (0, _solidLogic.ensureTypeIndexes)(context);
532
-
533
444
  case 12:
534
- context2 = _context7.sent;
535
- _context7.next = 19;
536
- break;
445
+ _context7.prev = 12;
446
+ _context7.next = 15;
447
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
537
448
 
538
449
  case 15:
539
- _context7.prev = 15;
540
- _context7.t0 = _context7["catch"](9);
450
+ scopes = _context7.sent;
451
+ _context7.next = 23;
452
+ break;
453
+
454
+ case 18:
455
+ _context7.prev = 18;
456
+ _context7.t0 = _context7["catch"](12);
541
457
 
542
458
  if (context.div && context.preferencesFileError) {
543
- msg = '(Preferences not available)';
459
+ msg = '(Lists of stuff not available)';
544
460
  context.div.appendChild(dom.createElement('p')).textContent = msg;
545
461
  } else if (context.div) {
546
462
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -548,168 +464,201 @@ function _registrationControl() {
548
464
  }
549
465
 
550
466
  debug.log(msg);
467
+ return _context7.abrupt("return", context);
551
468
 
552
- case 19:
553
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
469
+ case 23:
470
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
554
471
 
555
472
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
556
473
  tbody = box.children[0].children[0];
557
474
  form = new _rdflib.BlankNode(); // @@ say for now
558
475
 
559
- registrationStatements = function registrationStatements(index) {
560
- var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
561
-
562
- var reg = registrations.length ? registrations[0] : widgets.newThing(index);
563
- return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
564
- };
476
+ _iterator = _createForOfIteratorHelper(scopes);
565
477
 
566
478
  try {
567
- if (context2.index && context2.index["public"] && context2.index["public"].length > 0) {
568
- index = context2.index["public"][0];
569
- statements = registrationStatements(index);
570
- tbody.children[0].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context2.noun), null, statements, form, index));
571
- }
572
-
573
- if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
574
- index = context2.index["private"][0];
575
- statements = registrationStatements(index);
576
- tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
479
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
480
+ scope = _step.value;
481
+ row = tbody.appendChild(dom.createElement('tr'));
482
+ row.appendChild(renderScopeCheckbox(scope)); // @@ index
577
483
  }
578
- } catch (e) {
579
- _msg = "registrationControl: Error making panel: ".concat(e);
580
-
581
- if (context.div) {
582
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
583
- }
584
-
585
- debug.log(_msg);
484
+ } catch (err) {
485
+ _iterator.e(err);
486
+ } finally {
487
+ _iterator.f();
586
488
  }
587
489
 
588
- return _context7.abrupt("return", context2);
490
+ return _context7.abrupt("return", context);
589
491
 
590
- case 26:
492
+ case 30:
591
493
  case "end":
592
494
  return _context7.stop();
593
495
  }
594
496
  }
595
- }, _callee7, null, [[9, 15]]);
497
+ }, _callee7, null, [[12, 18]]);
596
498
  }));
597
499
  return _registrationControl.apply(this, arguments);
598
500
  }
599
501
 
600
- function registrationList(_x10, _x11) {
601
- return _registrationList.apply(this, arguments);
502
+ function renderScopeHeadingRow(context, store, scope) {
503
+ var backgroundColor = {
504
+ "private": '#fee',
505
+ "public": '#efe'
506
+ };
507
+ var dom = context.dom;
508
+ var name = scopeLabel(context, scope);
509
+ var row = dom.createElement('tr');
510
+ var cell = row.appendChild(dom.createElement('td'));
511
+ cell.setAttribute('colspan', '3');
512
+ cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
513
+ var header = cell.appendChild(dom.createElement('h3'));
514
+ header.textContent = name + ' links';
515
+ header.style.textAlign = 'left';
516
+ return row;
602
517
  }
518
+ /**
519
+ * UI to List at all registered things
520
+ */
521
+
522
+
523
+ function registrationList(_x9, _x10) {
524
+ return _registrationList.apply(this, arguments);
525
+ } // registrationList
526
+
603
527
 
604
528
  function _registrationList() {
605
- _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(context0, options) {
606
- var dom, div, box;
607
- return _regenerator["default"].wrap(function _callee8$(_context8) {
529
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
530
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
531
+
532
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
608
533
  while (1) {
609
- switch (_context8.prev = _context8.next) {
534
+ switch (_context9.prev = _context9.next) {
610
535
  case 0:
611
- dom = context0.dom;
612
- div = context0.div;
536
+ dom = context.dom;
537
+ div = context.div;
613
538
  box = dom.createElement('div');
614
539
  div.appendChild(box);
615
- context0.me = _solidLogic.authn.currentUser(); // @@
540
+ context.me = _solidLogic.authn.currentUser(); // @@
616
541
 
617
- if (context0.me) {
618
- _context8.next = 8;
542
+ if (context.me) {
543
+ _context9.next = 8;
619
544
  break;
620
545
  }
621
546
 
622
547
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
623
- return _context8.abrupt("return", context0);
548
+ return _context9.abrupt("return", context);
624
549
 
625
550
  case 8:
626
- return _context8.abrupt("return", (0, _solidLogic.ensureTypeIndexes)(context0).then(function (context) {
627
- box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
628
-
629
- // tbody will be inserted anyway
630
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
631
- var table = box.firstChild;
632
- var ix = [];
633
- var sts = [];
634
- var vs = ['private', 'public'];
635
- vs.forEach(function (visibility) {
636
- if (context.index && context.index[visibility].length > 0 && options[visibility]) {
637
- ix = ix.concat(context.index[visibility][0]);
638
- sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
639
- }
640
- });
551
+ _context9.next = 10;
552
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
641
553
 
642
- var _loop = function _loop(i) {
643
- var statement = sts[i];
554
+ case 10:
555
+ scopes = _context9.sent;
556
+ // includes community indexes
557
+ // console.log('@@ registrationList ', scopes)
558
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
644
559
 
645
- if (options.type) {
646
- // now check terms:forClass
647
- if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
648
- return "continue"; // skip irrelevant ones
649
- }
650
- } // const cla = statement.subject
560
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
561
+ table = box.firstChild;
562
+ tbody = table.firstChild;
563
+ _iterator2 = _createForOfIteratorHelper(scopes);
564
+ _context9.prev = 16;
651
565
 
566
+ _iterator2.s();
652
567
 
653
- // const cla = statement.subject
654
- var inst = statement.object;
655
- table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
656
- deleteFunction: function deleteFunction(_x) {
657
- if (!_solidLogic.solidLogicSingleton.store.updater) {
658
- throw new Error('Cannot delete this, store has no updater');
568
+ case 18:
569
+ if ((_step2 = _iterator2.n()).done) {
570
+ _context9.next = 30;
571
+ break;
572
+ }
573
+
574
+ scope = _step2.value;
575
+ // need some predicate for listing/adding agents
576
+ headingRow = renderScopeHeadingRow(context, store, scope);
577
+ tbody.appendChild(headingRow);
578
+ _context9.next = 24;
579
+ return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
580
+
581
+ case 24:
582
+ items = _context9.sent;
583
+ // any class
584
+ if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
585
+
586
+ _iterator3 = _createForOfIteratorHelper(items);
587
+
588
+ try {
589
+ _loop = function _loop() {
590
+ var item = _step3.value;
591
+ var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
592
+ deleteFunction: function () {
593
+ var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
594
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
595
+ while (1) {
596
+ switch (_context8.prev = _context8.next) {
597
+ case 0:
598
+ _context8.next = 2;
599
+ return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
600
+
601
+ case 2:
602
+ tbody.removeChild(row);
603
+
604
+ case 3:
605
+ case "end":
606
+ return _context8.stop();
607
+ }
608
+ }
609
+ }, _callee8);
610
+ }));
611
+
612
+ function deleteFunction() {
613
+ return _deleteFunction.apply(this, arguments);
659
614
  }
660
615
 
661
- _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
662
- if (ok) {
663
- debug.log("Removed from index: ".concat(statement.subject));
664
- } else {
665
- debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
666
- }
667
- });
668
- }
669
- }));
616
+ return deleteFunction;
617
+ }()
618
+ });
619
+ row.children[0].style.paddingLeft = '3em';
620
+ tbody.appendChild(row);
670
621
  };
671
622
 
672
- for (var i = 0; i < sts.length; i++) {
673
- var _ret = _loop(i);
674
-
675
- if (_ret === "continue") continue;
676
- } // registrationList
677
-
678
- /*
679
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
680
- if (containers.length) {
681
- fetcher.load(containers).then(function(xhrs){
682
- for (const i=0; i<containers.length; i++) {
683
- const cont = containers[i];
684
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
685
- }
686
- });
687
- }
688
- */
689
-
690
-
691
- // registrationList
692
-
693
- /*
694
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
695
- if (containers.length) {
696
- fetcher.load(containers).then(function(xhrs){
697
- for (const i=0; i<containers.length; i++) {
698
- const cont = containers[i];
699
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
700
- }
701
- });
702
- }
703
- */
704
- return context;
705
- }));
623
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
624
+ _loop();
625
+ }
626
+ } catch (err) {
627
+ _iterator3.e(err);
628
+ } finally {
629
+ _iterator3.f();
630
+ }
706
631
 
707
- case 9:
632
+ case 28:
633
+ _context9.next = 18;
634
+ break;
635
+
636
+ case 30:
637
+ _context9.next = 35;
638
+ break;
639
+
640
+ case 32:
641
+ _context9.prev = 32;
642
+ _context9.t0 = _context9["catch"](16);
643
+
644
+ _iterator2.e(_context9.t0);
645
+
646
+ case 35:
647
+ _context9.prev = 35;
648
+
649
+ _iterator2.f();
650
+
651
+ return _context9.finish(35);
652
+
653
+ case 38:
654
+ return _context9.abrupt("return", context);
655
+
656
+ case 39:
708
657
  case "end":
709
- return _context8.stop();
658
+ return _context9.stop();
710
659
  }
711
660
  }
712
- }, _callee8);
661
+ }, _callee9, null, [[16, 32, 35, 38]]);
713
662
  }));
714
663
  return _registrationList.apply(this, arguments);
715
664
  }
@@ -718,14 +667,14 @@ function getDefaultSignInButtonStyle() {
718
667
  return 'padding: 1em; border-radius:0.5em; font-size: 100%;';
719
668
  }
720
669
  /**
721
- * Bootstrapping identity
722
- * (Called by `loginStatusBox()`)
723
- *
724
- * @param dom
725
- * @param setUserCallback
726
- *
727
- * @returns
728
- */
670
+ * Bootstrapping identity
671
+ * (Called by `loginStatusBox()`)
672
+ *
673
+ * @param dom
674
+ * @param setUserCallback
675
+ *
676
+ * @returns
677
+ */
729
678
 
730
679
 
731
680
  function signInOrSignUpBox(dom, setUserCallback) {
@@ -803,8 +752,8 @@ function signInOrSignUpBox(dom, setUserCallback) {
803
752
 
804
753
  function renderSignInPopup(dom) {
805
754
  /**
806
- * Issuer Menu
807
- */
755
+ * Issuer Menu
756
+ */
808
757
  var issuerPopup = dom.createElement('div');
809
758
  issuerPopup.setAttribute('style', 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;');
810
759
  dom.body.appendChild(issuerPopup);
@@ -818,7 +767,7 @@ function renderSignInPopup(dom) {
818
767
  issuerPopupBoxLabel.setAttribute('style', 'margin-right: 5px; font-weight: 800');
819
768
  issuerPopupBoxLabel.innerText = 'Select an identity provider';
820
769
  var issuerPopupBoxCloseButton = dom.createElement('button');
821
- issuerPopupBoxCloseButton.innerHTML = '<img src="https://solid.github.io/solid-ui/src/icons/noun_1180156.svg" style="width: 2em; height: 2em;" title="Cancel">';
770
+ issuerPopupBoxCloseButton.innerHTML = '<img src="https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg" style="width: 2em; height: 2em;" title="Cancel">';
822
771
  issuerPopupBoxCloseButton.setAttribute('style', 'background-color: transparent; border: none;');
823
772
  issuerPopupBoxCloseButton.addEventListener('click', function () {
824
773
  issuerPopup.remove();
@@ -866,13 +815,13 @@ function renderSignInPopup(dom) {
866
815
  }, _callee, null, [[0, 8]]);
867
816
  }));
868
817
 
869
- return function loginToIssuer(_x12) {
818
+ return function loginToIssuer(_x11) {
870
819
  return _ref.apply(this, arguments);
871
820
  };
872
821
  }();
873
822
  /**
874
- * Text-based idp selection
875
- */
823
+ * Text-based idp selection
824
+ */
876
825
 
877
826
 
878
827
  var issuerTextContainer = dom.createElement('div');
@@ -899,8 +848,8 @@ function renderSignInPopup(dom) {
899
848
  issuerTextContainer.appendChild(issuerTextInputContainer);
900
849
  issuerPopupBox.appendChild(issuerTextContainer);
901
850
  /**
902
- * Button-based idp selection
903
- */
851
+ * Button-based idp selection
852
+ */
904
853
 
905
854
  var issuerButtonContainer = dom.createElement('div');
906
855
  issuerButtonContainer.setAttribute('style', "\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");
@@ -920,15 +869,15 @@ function renderSignInPopup(dom) {
920
869
  issuerPopupBox.appendChild(issuerButtonContainer);
921
870
  }
922
871
  /**
923
- * Login status box
924
- *
925
- * A big sign-up/sign in box or a logout box depending on the state
926
- *
927
- * @param dom
928
- * @param listener
929
- *
930
- * @returns
931
- */
872
+ * Login status box
873
+ *
874
+ * A big sign-up/sign in box or a logout box depending on the state
875
+ *
876
+ * @param dom
877
+ * @param listener
878
+ *
879
+ * @returns
880
+ */
932
881
 
933
882
 
934
883
  function loginStatusBox(dom) {
@@ -1089,28 +1038,28 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
1089
1038
  }, _callee2, null, [[2, 17]]);
1090
1039
  })));
1091
1040
  /**
1092
- * Workspace selection etc
1093
- * See https://github.com/solid/userguide/issues/16
1094
- */
1041
+ * Workspace selection etc
1042
+ * See https://github.com/solidos/userguide/issues/16
1043
+ */
1095
1044
 
1096
1045
  /**
1097
- * Returns a UI object which, if it selects a workspace,
1098
- * will callback(workspace, newBase).
1099
- * See https://github.com/solid/userguide/issues/16 for more info on workspaces.
1100
- *
1101
- * If necessary, will get an account, preference file, etc. In sequence:
1102
- *
1103
- * - If not logged in, log in.
1104
- * - Load preference file
1105
- * - Prompt user for workspaces
1106
- * - Allows the user to just type in a URI by hand
1107
- *
1108
- * Calls back with the workspace and the base URI
1109
- *
1110
- * @param dom
1111
- * @param appDetails
1112
- * @param callbackWS
1113
- */
1046
+ * Returns a UI object which, if it selects a workspace,
1047
+ * will callback(workspace, newBase).
1048
+ * See https://github.com/solidos/userguide/issues/16 for more info on workspaces.
1049
+ *
1050
+ * If necessary, will get an account, preference file, etc. In sequence:
1051
+ *
1052
+ * - If not logged in, log in.
1053
+ * - Load preference file
1054
+ * - Prompt user for workspaces
1055
+ * - Allows the user to just type in a URI by hand
1056
+ *
1057
+ * Calls back with the workspace and the base URI
1058
+ *
1059
+ * @param dom
1060
+ * @param appDetails
1061
+ * @param callbackWS
1062
+ */
1114
1063
 
1115
1064
 
1116
1065
  function selectWorkspace(dom, appDetails, callbackWS) {
@@ -1153,7 +1102,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1153
1102
 
1154
1103
  function displayOptions(context) {
1155
1104
  // console.log('displayOptions!', context)
1156
- function makeNewWorkspace(_x13) {
1105
+ function makeNewWorkspace(_x12) {
1157
1106
  return _makeNewWorkspace.apply(this, arguments);
1158
1107
  } // const status = ''
1159
1108
 
@@ -1373,21 +1322,21 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1373
1322
  } // selectWorkspace
1374
1323
 
1375
1324
  /**
1376
- * Creates a new instance of an app.
1377
- *
1378
- * An instance of an app could be e.g. an issue tracker for a given project,
1379
- * or a chess game, or calendar, or a health/fitness record for a person.
1380
- *
1381
- * Note that this use of the term 'app' refers more to entries in the user's
1382
- * type index than to actual software applications that use the personal data
1383
- * to which these entries point.
1384
- *
1385
- * @param dom
1386
- * @param appDetails
1387
- * @param callback
1388
- *
1389
- * @returns A div with a button in it for making a new app instance
1390
- */
1325
+ * Creates a new instance of an app.
1326
+ *
1327
+ * An instance of an app could be e.g. an issue tracker for a given project,
1328
+ * or a chess game, or calendar, or a health/fitness record for a person.
1329
+ *
1330
+ * Note that this use of the term 'app' refers more to entries in the user's
1331
+ * type index than to actual software applications that use the personal data
1332
+ * to which these entries point.
1333
+ *
1334
+ * @param dom
1335
+ * @param appDetails
1336
+ * @param callback
1337
+ *
1338
+ * @returns A div with a button in it for making a new app instance
1339
+ */
1391
1340
 
1392
1341
 
1393
1342
  function newAppInstance(dom, appDetails, callback) {
@@ -1422,77 +1371,77 @@ function getUserRoles() {
1422
1371
 
1423
1372
 
1424
1373
  function _getUserRoles() {
1425
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
1374
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
1426
1375
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
1427
1376
 
1428
- return _regenerator["default"].wrap(function _callee9$(_context9) {
1377
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
1429
1378
  while (1) {
1430
- switch (_context9.prev = _context9.next) {
1379
+ switch (_context10.prev = _context10.next) {
1431
1380
  case 0:
1432
- _context9.prev = 0;
1433
- _context9.next = 3;
1381
+ _context10.prev = 0;
1382
+ _context10.next = 3;
1434
1383
  return ensureLoadedPreferences({});
1435
1384
 
1436
1385
  case 3:
1437
- _yield$ensureLoadedPr = _context9.sent;
1386
+ _yield$ensureLoadedPr = _context10.sent;
1438
1387
  me = _yield$ensureLoadedPr.me;
1439
1388
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
1440
1389
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
1441
1390
 
1442
1391
  if (!(!preferencesFile || preferencesFileError)) {
1443
- _context9.next = 9;
1392
+ _context10.next = 9;
1444
1393
  break;
1445
1394
  }
1446
1395
 
1447
1396
  throw new Error(preferencesFileError);
1448
1397
 
1449
1398
  case 9:
1450
- return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
1399
+ return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
1451
1400
 
1452
1401
  case 12:
1453
- _context9.prev = 12;
1454
- _context9.t0 = _context9["catch"](0);
1455
- debug.warn('Unable to fetch your preferences - this was the error: ', _context9.t0);
1402
+ _context10.prev = 12;
1403
+ _context10.t0 = _context10["catch"](0);
1404
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
1456
1405
 
1457
1406
  case 15:
1458
- return _context9.abrupt("return", []);
1407
+ return _context10.abrupt("return", []);
1459
1408
 
1460
1409
  case 16:
1461
1410
  case "end":
1462
- return _context9.stop();
1411
+ return _context10.stop();
1463
1412
  }
1464
1413
  }
1465
- }, _callee9, null, [[0, 12]]);
1414
+ }, _callee10, null, [[0, 12]]);
1466
1415
  }));
1467
1416
  return _getUserRoles.apply(this, arguments);
1468
1417
  }
1469
1418
 
1470
- function filterAvailablePanes(_x14) {
1419
+ function filterAvailablePanes(_x13) {
1471
1420
  return _filterAvailablePanes.apply(this, arguments);
1472
1421
  }
1473
1422
 
1474
1423
  function _filterAvailablePanes() {
1475
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
1424
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
1476
1425
  var userRoles;
1477
- return _regenerator["default"].wrap(function _callee10$(_context10) {
1426
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
1478
1427
  while (1) {
1479
- switch (_context10.prev = _context10.next) {
1428
+ switch (_context11.prev = _context11.next) {
1480
1429
  case 0:
1481
- _context10.next = 2;
1430
+ _context11.next = 2;
1482
1431
  return getUserRoles();
1483
1432
 
1484
1433
  case 2:
1485
- userRoles = _context10.sent;
1486
- return _context10.abrupt("return", panes.filter(function (pane) {
1434
+ userRoles = _context11.sent;
1435
+ return _context11.abrupt("return", panes.filter(function (pane) {
1487
1436
  return isMatchingAudience(pane, userRoles);
1488
1437
  }));
1489
1438
 
1490
1439
  case 4:
1491
1440
  case "end":
1492
- return _context10.stop();
1441
+ return _context11.stop();
1493
1442
  }
1494
1443
  }
1495
- }, _callee10);
1444
+ }, _callee11);
1496
1445
  }));
1497
1446
  return _filterAvailablePanes.apply(this, arguments);
1498
1447
  }