solid-ui 2.4.22-be8b238b → 2.4.22-c7419dec

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.
@@ -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,39 +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
 
49
- /* eslint-disable camelcase */
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; } } }; }
50
52
 
51
- /**
52
- * Signing in, signing up, profile and preferences reloading
53
- * Type index management
54
- *
55
- * Many functions in this module take a context object which
56
- * holds various RDF symbols, add to it, and return a promise of it.
57
- *
58
- * * `me` RDF symbol for the user's WebID
59
- * * `publicProfile` The user's public profile, iff loaded
60
- * * `preferencesFile` The user's personal preference file, iff loaded
61
- * * `index.public` The user's public type index file
62
- * * `index.private` The user's private type index file
63
- *
64
- * Not RDF symbols:
65
- * * `noun` A string in english for the type of thing -- like "address book"
66
- * * `instance` An array of nodes which are existing instances
67
- * * `containers` An array of nodes of containers of instances
68
- * * `div` A DOM element where UI can be displayed
69
- * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
70
- * *
71
- * * Vocabulary: "load" loads a file if it exists;
72
- * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
73
- * @packageDocumentation
74
- */
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); }
75
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;
76
58
  /**
77
59
  * Resolves with the logged in user's WebID
78
60
  *
79
61
  * @param context
80
62
  */
81
63
  // used to be logIn
64
+
82
65
  function ensureLoggedIn(context) {
83
66
  var me = _solidLogic.authn.currentUser();
84
67
 
@@ -120,7 +103,7 @@ function ensureLoggedIn(context) {
120
103
  // used to be logInLoadPreferences
121
104
 
122
105
 
123
- function ensureLoadedPreferences(_x2) {
106
+ function ensureLoadedPreferences(_x) {
124
107
  return _ensureLoadedPreferences.apply(this, arguments);
125
108
  }
126
109
  /**
@@ -267,14 +250,17 @@ function _ensureLoadedPreferences() {
267
250
  return _ensureLoadedPreferences.apply(this, arguments);
268
251
  }
269
252
 
270
- function ensureLoadedProfile(_x3) {
253
+ function ensureLoadedProfile(_x2) {
271
254
  return _ensureLoadedProfile.apply(this, arguments);
272
255
  }
273
256
  /**
274
- * Returns promise of context with arrays of symbols
275
- *
276
- * 2016-12-11 change to include forClass arc a la
277
- * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
257
+ * Returns promise of context with arrays of symbols
258
+ *
259
+ * leaving the `isPublic` param undefined will bring in community index things, too
260
+ */
261
+
262
+ /**
263
+ * @deprecated Since version 2.4.17 Will be deleted in version 3.0. Use solid-logic getAppInstances instead.
278
264
  */
279
265
 
280
266
 
@@ -339,210 +325,141 @@ function _ensureLoadedProfile() {
339
325
  return _ensureLoadedProfile.apply(this, arguments);
340
326
  }
341
327
 
342
- function findAppInstances(_x4, _x5, _x6) {
328
+ function findAppInstances(_x3, _x4, _x5) {
343
329
  return _findAppInstances.apply(this, arguments);
344
330
  }
345
- /**
346
- * UI to control registration of instance
347
- */
348
-
349
331
 
350
332
  function _findAppInstances() {
351
333
  _findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
352
- var visibility, index, thisIndex, registrations, instances, containers, unique, e, i, cont;
334
+ var items;
353
335
  return _regenerator["default"].wrap(function _callee6$(_context6) {
354
336
  while (1) {
355
337
  switch (_context6.prev = _context6.next) {
356
338
  case 0:
357
- unique = function _unique(arr) {
358
- return Array.from(new Set(arr));
359
- };
339
+ debug.warn('Calling deprecated function findAppInstances! Use solid-logic getAppInstances instead.');
360
340
 
361
- if (!(isPublic === undefined)) {
341
+ if (!context.me) {
362
342
  _context6.next = 7;
363
343
  break;
364
344
  }
365
345
 
366
346
  _context6.next = 4;
367
- return findAppInstances(context, theClass, true);
347
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
368
348
 
369
349
  case 4:
370
- _context6.next = 6;
371
- return findAppInstances(context, theClass, false);
372
-
373
- case 6:
374
- return _context6.abrupt("return", context);
375
-
376
- case 7:
377
- _context6.prev = 7;
378
- _context6.next = 10;
379
- return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
380
-
381
- case 10:
382
- _context6.next = 15;
383
- break;
384
-
385
- case 12:
386
- _context6.prev = 12;
387
- _context6.t0 = _context6["catch"](7);
388
- widgets.complain(context, "loadIndex: login and load problem ".concat(_context6.t0));
389
-
390
- case 15:
391
- // console.log('awaited LogInLoad!', context)
392
- visibility = isPublic ? 'public' : 'private';
393
- _context6.prev = 16;
394
- _context6.next = 19;
395
- return (0, _solidLogic.loadIndex)(context, isPublic);
396
-
397
- case 19:
398
- _context6.next = 24;
399
- break;
400
-
401
- case 21:
402
- _context6.prev = 21;
403
- _context6.t1 = _context6["catch"](16);
404
- debug.error(_context6.t1);
405
-
406
- case 24:
407
- index = context.index;
408
- thisIndex = index[visibility];
409
- registrations = thisIndex.map(function (ix) {
410
- return _solidLogic.solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix);
411
- }).reduce(function (acc, curr) {
412
- return acc.concat(curr);
413
- }, []);
414
- instances = registrations.map(function (reg) {
415
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instance'));
416
- }).reduce(function (acc, curr) {
417
- return acc.concat(curr);
418
- }, []);
419
- containers = registrations.map(function (reg) {
420
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instanceContainer'));
421
- }).reduce(function (acc, curr) {
422
- return acc.concat(curr);
423
- }, []);
424
- context.instances = context.instances || [];
425
- context.instances = unique(context.instances.concat(instances));
426
- context.containers = context.containers || [];
427
- context.containers = unique(context.containers.concat(containers));
428
-
429
- if (containers.length) {
430
- _context6.next = 35;
431
- break;
432
- }
433
-
434
- return _context6.abrupt("return", context);
435
-
436
- case 35:
437
- _context6.prev = 35;
438
- _context6.next = 38;
439
- return _solidLogic.solidLogicSingleton.load(containers);
440
-
441
- case 38:
442
- _context6.next = 45;
350
+ _context6.t0 = _context6.sent;
351
+ _context6.next = 8;
443
352
  break;
444
353
 
445
- case 40:
446
- _context6.prev = 40;
447
- _context6.t2 = _context6["catch"](35);
448
- e = new Error("[FAI] Unable to load containers".concat(_context6.t2));
449
- debug.log(e); // complain
450
-
451
- widgets.complain(context, "Error looking for ".concat(_index.utils.label(theClass), ": ").concat(_context6.t2)); // but then ignore it
452
- // throw new Error(e)
354
+ case 7:
355
+ _context6.t0 = [];
453
356
 
454
- case 45:
455
- i = 0;
357
+ case 8:
358
+ items = _context6.t0;
456
359
 
457
- case 46:
458
- if (!(i < containers.length)) {
459
- _context6.next = 56;
460
- break;
360
+ if (isPublic === true) {
361
+ // old API - not recommended!
362
+ items = items.filter(function (item) {
363
+ return item.scope.label === 'public';
364
+ });
365
+ } else if (isPublic === false) {
366
+ items = items.filter(function (item) {
367
+ return item.scope.label === 'private';
368
+ });
461
369
  }
462
370
 
463
- cont = containers[i];
464
- _context6.t3 = context.instances;
465
- _context6.next = 51;
466
- return _solidLogic.solidLogicSingleton.getContainerMembers(cont.value);
467
-
468
- case 51:
469
- _context6.t4 = _context6.sent.map(function (uri) {
470
- return _solidLogic.solidLogicSingleton.store.sym(uri);
371
+ context.instances = items.map(function (item) {
372
+ return item.instance;
471
373
  });
472
- context.instances = _context6.t3.concat.call(_context6.t3, _context6.t4);
473
-
474
- case 53:
475
- i++;
476
- _context6.next = 46;
477
- break;
478
-
479
- case 56:
480
374
  return _context6.abrupt("return", context);
481
375
 
482
- case 57:
376
+ case 12:
483
377
  case "end":
484
378
  return _context6.stop();
485
379
  }
486
380
  }
487
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
381
+ }, _callee6);
488
382
  }));
489
383
  return _findAppInstances.apply(this, arguments);
490
384
  }
491
385
 
492
- function registrationControl(_x7, _x8, _x9) {
493
- return _registrationControl.apply(this, arguments);
386
+ function scopeLabel(context, scope) {
387
+ var mine = context.me && context.me.sameTerm(scope.agent);
388
+ var name = mine ? '' : utils.label(scope.agent) + ' ';
389
+ return "".concat(name).concat(scope.label);
494
390
  }
495
391
  /**
496
- * UI to List at all registered things
392
+ * UI to control registration of instance
497
393
  */
498
394
 
499
395
 
396
+ function registrationControl(_x6, _x7, _x8) {
397
+ return _registrationControl.apply(this, arguments);
398
+ }
399
+
500
400
  function _registrationControl() {
501
401
  _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
502
- var dom, box, context2, msg, tbody, form, registrationStatements, index, statements, _msg;
402
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
503
403
 
504
404
  return _regenerator["default"].wrap(function _callee7$(_context7) {
505
405
  while (1) {
506
406
  switch (_context7.prev = _context7.next) {
507
407
  case 0:
408
+ renderScopeCheckbox = function _renderScopeCheckbox(scope) {
409
+ var statements = registrationStatements(scope.index);
410
+ var name = scopeLabel(context, scope);
411
+ var label = "".concat(name, " link to this ").concat(context.noun);
412
+ return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
413
+ };
414
+
415
+ registrationStatements = function _registrationStatemen(index) {
416
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
417
+
418
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
419
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
420
+ };
421
+
422
+ /// / body of registrationControl
508
423
  dom = context.dom;
509
424
 
510
425
  if (!(!dom || !context.div)) {
511
- _context7.next = 3;
426
+ _context7.next = 5;
512
427
  break;
513
428
  }
514
429
 
515
- return _context7.abrupt("return", context);
430
+ throw new Error('registrationControl: need dom and div');
516
431
 
517
- case 3:
432
+ case 5:
518
433
  box = dom.createElement('div');
519
434
  context.div.appendChild(box);
520
435
  context.me = _solidLogic.authn.currentUser(); // @@
521
436
 
522
- if (context.me) {
523
- _context7.next = 9;
437
+ me = context.me;
438
+
439
+ if (me) {
440
+ _context7.next = 12;
524
441
  break;
525
442
  }
526
443
 
527
444
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
528
445
  return _context7.abrupt("return", context);
529
446
 
530
- case 9:
531
- _context7.prev = 9;
532
- _context7.next = 12;
533
- return (0, _solidLogic.ensureTypeIndexes)(context);
534
-
535
447
  case 12:
536
- context2 = _context7.sent;
537
- _context7.next = 19;
538
- break;
448
+ _context7.prev = 12;
449
+ _context7.next = 15;
450
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
539
451
 
540
452
  case 15:
541
- _context7.prev = 15;
542
- _context7.t0 = _context7["catch"](9);
453
+ scopes = _context7.sent;
454
+ _context7.next = 23;
455
+ break;
456
+
457
+ case 18:
458
+ _context7.prev = 18;
459
+ _context7.t0 = _context7["catch"](12);
543
460
 
544
461
  if (context.div && context.preferencesFileError) {
545
- msg = '(Preferences not available)';
462
+ msg = '(Lists of stuff not available)';
546
463
  context.div.appendChild(dom.createElement('p')).textContent = msg;
547
464
  } else if (context.div) {
548
465
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -550,168 +467,201 @@ function _registrationControl() {
550
467
  }
551
468
 
552
469
  debug.log(msg);
470
+ return _context7.abrupt("return", context);
553
471
 
554
- case 19:
555
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
472
+ case 23:
473
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
556
474
 
557
475
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
558
476
  tbody = box.children[0].children[0];
559
477
  form = new _rdflib.BlankNode(); // @@ say for now
560
478
 
561
- registrationStatements = function registrationStatements(index) {
562
- var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
563
-
564
- var reg = registrations.length ? registrations[0] : widgets.newThing(index);
565
- return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
566
- };
479
+ _iterator = _createForOfIteratorHelper(scopes);
567
480
 
568
481
  try {
569
- if (context2.index && context2.index["public"] && context2.index["public"].length > 0) {
570
- index = context2.index["public"][0];
571
- statements = registrationStatements(index);
572
- tbody.children[0].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context2.noun), null, statements, form, index));
573
- }
574
-
575
- if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
576
- index = context2.index["private"][0];
577
- statements = registrationStatements(index);
578
- tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
579
- }
580
- } catch (e) {
581
- _msg = "registrationControl: Error making panel: ".concat(e);
582
-
583
- if (context.div) {
584
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
482
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
483
+ scope = _step.value;
484
+ row = tbody.appendChild(dom.createElement('tr'));
485
+ row.appendChild(renderScopeCheckbox(scope)); // @@ index
585
486
  }
586
-
587
- debug.log(_msg);
487
+ } catch (err) {
488
+ _iterator.e(err);
489
+ } finally {
490
+ _iterator.f();
588
491
  }
589
492
 
590
- return _context7.abrupt("return", context2);
493
+ return _context7.abrupt("return", context);
591
494
 
592
- case 26:
495
+ case 30:
593
496
  case "end":
594
497
  return _context7.stop();
595
498
  }
596
499
  }
597
- }, _callee7, null, [[9, 15]]);
500
+ }, _callee7, null, [[12, 18]]);
598
501
  }));
599
502
  return _registrationControl.apply(this, arguments);
600
503
  }
601
504
 
602
- function registrationList(_x10, _x11) {
603
- return _registrationList.apply(this, arguments);
505
+ function renderScopeHeadingRow(context, store, scope) {
506
+ var backgroundColor = {
507
+ "private": '#fee',
508
+ "public": '#efe'
509
+ };
510
+ var dom = context.dom;
511
+ var name = scopeLabel(context, scope);
512
+ var row = dom.createElement('tr');
513
+ var cell = row.appendChild(dom.createElement('td'));
514
+ cell.setAttribute('colspan', '3');
515
+ cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
516
+ var header = cell.appendChild(dom.createElement('h3'));
517
+ header.textContent = name + ' links';
518
+ header.style.textAlign = 'left';
519
+ return row;
604
520
  }
521
+ /**
522
+ * UI to List at all registered things
523
+ */
524
+
525
+
526
+ function registrationList(_x9, _x10) {
527
+ return _registrationList.apply(this, arguments);
528
+ } // registrationList
529
+
605
530
 
606
531
  function _registrationList() {
607
- _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(context0, options) {
608
- var dom, div, box;
609
- return _regenerator["default"].wrap(function _callee8$(_context8) {
532
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
533
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
534
+
535
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
610
536
  while (1) {
611
- switch (_context8.prev = _context8.next) {
537
+ switch (_context9.prev = _context9.next) {
612
538
  case 0:
613
- dom = context0.dom;
614
- div = context0.div;
539
+ dom = context.dom;
540
+ div = context.div;
615
541
  box = dom.createElement('div');
616
542
  div.appendChild(box);
617
- context0.me = _solidLogic.authn.currentUser(); // @@
543
+ context.me = _solidLogic.authn.currentUser(); // @@
618
544
 
619
- if (context0.me) {
620
- _context8.next = 8;
545
+ if (context.me) {
546
+ _context9.next = 8;
621
547
  break;
622
548
  }
623
549
 
624
550
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
625
- return _context8.abrupt("return", context0);
551
+ return _context9.abrupt("return", context);
626
552
 
627
553
  case 8:
628
- return _context8.abrupt("return", (0, _solidLogic.ensureTypeIndexes)(context0).then(function (context) {
629
- box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
630
-
631
- // tbody will be inserted anyway
632
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
633
- var table = box.firstChild;
634
- var ix = [];
635
- var sts = [];
636
- var vs = ['private', 'public'];
637
- vs.forEach(function (visibility) {
638
- if (context.index && context.index[visibility].length > 0 && options[visibility]) {
639
- ix = ix.concat(context.index[visibility][0]);
640
- sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
641
- }
642
- });
554
+ _context9.next = 10;
555
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
643
556
 
644
- var _loop = function _loop(i) {
645
- var statement = sts[i];
557
+ case 10:
558
+ scopes = _context9.sent;
559
+ // includes community indexes
560
+ // console.log('@@ registrationList ', scopes)
561
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
646
562
 
647
- if (options.type) {
648
- // now check terms:forClass
649
- if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
650
- return "continue"; // skip irrelevant ones
651
- }
652
- } // const cla = statement.subject
563
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
564
+ table = box.firstChild;
565
+ tbody = table.firstChild;
566
+ _iterator2 = _createForOfIteratorHelper(scopes);
567
+ _context9.prev = 16;
653
568
 
569
+ _iterator2.s();
654
570
 
655
- // const cla = statement.subject
656
- var inst = statement.object;
657
- table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
658
- deleteFunction: function deleteFunction(_x) {
659
- if (!_solidLogic.solidLogicSingleton.store.updater) {
660
- throw new Error('Cannot delete this, store has no updater');
571
+ case 18:
572
+ if ((_step2 = _iterator2.n()).done) {
573
+ _context9.next = 30;
574
+ break;
575
+ }
576
+
577
+ scope = _step2.value;
578
+ // need some predicate for listing/adding agents
579
+ headingRow = renderScopeHeadingRow(context, store, scope);
580
+ tbody.appendChild(headingRow);
581
+ _context9.next = 24;
582
+ return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
583
+
584
+ case 24:
585
+ items = _context9.sent;
586
+ // any class
587
+ if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
588
+
589
+ _iterator3 = _createForOfIteratorHelper(items);
590
+
591
+ try {
592
+ _loop = function _loop() {
593
+ var item = _step3.value;
594
+ var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
595
+ deleteFunction: function () {
596
+ var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
597
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
598
+ while (1) {
599
+ switch (_context8.prev = _context8.next) {
600
+ case 0:
601
+ _context8.next = 2;
602
+ return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
603
+
604
+ case 2:
605
+ tbody.removeChild(row);
606
+
607
+ case 3:
608
+ case "end":
609
+ return _context8.stop();
610
+ }
611
+ }
612
+ }, _callee8);
613
+ }));
614
+
615
+ function deleteFunction() {
616
+ return _deleteFunction.apply(this, arguments);
661
617
  }
662
618
 
663
- _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
664
- if (ok) {
665
- debug.log("Removed from index: ".concat(statement.subject));
666
- } else {
667
- debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
668
- }
669
- });
670
- }
671
- }));
619
+ return deleteFunction;
620
+ }()
621
+ });
622
+ row.children[0].style.paddingLeft = '3em';
623
+ tbody.appendChild(row);
672
624
  };
673
625
 
674
- for (var i = 0; i < sts.length; i++) {
675
- var _ret = _loop(i);
676
-
677
- if (_ret === "continue") continue;
678
- } // registrationList
679
-
680
- /*
681
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
682
- if (containers.length) {
683
- fetcher.load(containers).then(function(xhrs){
684
- for (const i=0; i<containers.length; i++) {
685
- const cont = containers[i];
686
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
687
- }
688
- });
689
- }
690
- */
691
-
692
-
693
- // registrationList
694
-
695
- /*
696
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
697
- if (containers.length) {
698
- fetcher.load(containers).then(function(xhrs){
699
- for (const i=0; i<containers.length; i++) {
700
- const cont = containers[i];
701
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
702
- }
703
- });
704
- }
705
- */
706
- return context;
707
- }));
626
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
627
+ _loop();
628
+ }
629
+ } catch (err) {
630
+ _iterator3.e(err);
631
+ } finally {
632
+ _iterator3.f();
633
+ }
708
634
 
709
- case 9:
635
+ case 28:
636
+ _context9.next = 18;
637
+ break;
638
+
639
+ case 30:
640
+ _context9.next = 35;
641
+ break;
642
+
643
+ case 32:
644
+ _context9.prev = 32;
645
+ _context9.t0 = _context9["catch"](16);
646
+
647
+ _iterator2.e(_context9.t0);
648
+
649
+ case 35:
650
+ _context9.prev = 35;
651
+
652
+ _iterator2.f();
653
+
654
+ return _context9.finish(35);
655
+
656
+ case 38:
657
+ return _context9.abrupt("return", context);
658
+
659
+ case 39:
710
660
  case "end":
711
- return _context8.stop();
661
+ return _context9.stop();
712
662
  }
713
663
  }
714
- }, _callee8);
664
+ }, _callee9, null, [[16, 32, 35, 38]]);
715
665
  }));
716
666
  return _registrationList.apply(this, arguments);
717
667
  }
@@ -868,7 +818,7 @@ function renderSignInPopup(dom) {
868
818
  }, _callee, null, [[0, 8]]);
869
819
  }));
870
820
 
871
- return function loginToIssuer(_x12) {
821
+ return function loginToIssuer(_x11) {
872
822
  return _ref.apply(this, arguments);
873
823
  };
874
824
  }();
@@ -1155,7 +1105,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1155
1105
 
1156
1106
  function displayOptions(context) {
1157
1107
  // console.log('displayOptions!', context)
1158
- function makeNewWorkspace(_x13) {
1108
+ function makeNewWorkspace(_x12) {
1159
1109
  return _makeNewWorkspace.apply(this, arguments);
1160
1110
  } // const status = ''
1161
1111
 
@@ -1424,77 +1374,77 @@ function getUserRoles() {
1424
1374
 
1425
1375
 
1426
1376
  function _getUserRoles() {
1427
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
1377
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
1428
1378
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
1429
1379
 
1430
- return _regenerator["default"].wrap(function _callee9$(_context9) {
1380
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
1431
1381
  while (1) {
1432
- switch (_context9.prev = _context9.next) {
1382
+ switch (_context10.prev = _context10.next) {
1433
1383
  case 0:
1434
- _context9.prev = 0;
1435
- _context9.next = 3;
1384
+ _context10.prev = 0;
1385
+ _context10.next = 3;
1436
1386
  return ensureLoadedPreferences({});
1437
1387
 
1438
1388
  case 3:
1439
- _yield$ensureLoadedPr = _context9.sent;
1389
+ _yield$ensureLoadedPr = _context10.sent;
1440
1390
  me = _yield$ensureLoadedPr.me;
1441
1391
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
1442
1392
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
1443
1393
 
1444
1394
  if (!(!preferencesFile || preferencesFileError)) {
1445
- _context9.next = 9;
1395
+ _context10.next = 9;
1446
1396
  break;
1447
1397
  }
1448
1398
 
1449
1399
  throw new Error(preferencesFileError);
1450
1400
 
1451
1401
  case 9:
1452
- return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
1402
+ return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
1453
1403
 
1454
1404
  case 12:
1455
- _context9.prev = 12;
1456
- _context9.t0 = _context9["catch"](0);
1457
- debug.warn('Unable to fetch your preferences - this was the error: ', _context9.t0);
1405
+ _context10.prev = 12;
1406
+ _context10.t0 = _context10["catch"](0);
1407
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
1458
1408
 
1459
1409
  case 15:
1460
- return _context9.abrupt("return", []);
1410
+ return _context10.abrupt("return", []);
1461
1411
 
1462
1412
  case 16:
1463
1413
  case "end":
1464
- return _context9.stop();
1414
+ return _context10.stop();
1465
1415
  }
1466
1416
  }
1467
- }, _callee9, null, [[0, 12]]);
1417
+ }, _callee10, null, [[0, 12]]);
1468
1418
  }));
1469
1419
  return _getUserRoles.apply(this, arguments);
1470
1420
  }
1471
1421
 
1472
- function filterAvailablePanes(_x14) {
1422
+ function filterAvailablePanes(_x13) {
1473
1423
  return _filterAvailablePanes.apply(this, arguments);
1474
1424
  }
1475
1425
 
1476
1426
  function _filterAvailablePanes() {
1477
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
1427
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
1478
1428
  var userRoles;
1479
- return _regenerator["default"].wrap(function _callee10$(_context10) {
1429
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
1480
1430
  while (1) {
1481
- switch (_context10.prev = _context10.next) {
1431
+ switch (_context11.prev = _context11.next) {
1482
1432
  case 0:
1483
- _context10.next = 2;
1433
+ _context11.next = 2;
1484
1434
  return getUserRoles();
1485
1435
 
1486
1436
  case 2:
1487
- userRoles = _context10.sent;
1488
- return _context10.abrupt("return", panes.filter(function (pane) {
1437
+ userRoles = _context11.sent;
1438
+ return _context11.abrupt("return", panes.filter(function (pane) {
1489
1439
  return isMatchingAudience(pane, userRoles);
1490
1440
  }));
1491
1441
 
1492
1442
  case 4:
1493
1443
  case "end":
1494
- return _context10.stop();
1444
+ return _context11.stop();
1495
1445
  }
1496
1446
  }
1497
- }, _callee10);
1447
+ }, _callee11);
1498
1448
  }));
1499
1449
  return _filterAvailablePanes.apply(this, arguments);
1500
1450
  }