solid-ui 2.4.22-8fef4f19 → 2.4.22-90ab4764

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,15 +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
278
- */
257
+ * Returns promise of context with arrays of symbols
258
+ *
259
+ * 2016-12-11 change to include forClass arc a la
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
263
+ */
279
264
 
280
265
 
281
266
  function _ensureLoadedProfile() {
@@ -339,210 +324,139 @@ function _ensureLoadedProfile() {
339
324
  return _ensureLoadedProfile.apply(this, arguments);
340
325
  }
341
326
 
342
- function findAppInstances(_x4, _x5, _x6) {
327
+ function findAppInstances(_x3, _x4, _x5) {
343
328
  return _findAppInstances.apply(this, arguments);
344
329
  }
345
- /**
346
- * UI to control registration of instance
347
- */
348
-
349
330
 
350
331
  function _findAppInstances() {
351
332
  _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;
333
+ var items;
353
334
  return _regenerator["default"].wrap(function _callee6$(_context6) {
354
335
  while (1) {
355
336
  switch (_context6.prev = _context6.next) {
356
337
  case 0:
357
- unique = function _unique(arr) {
358
- return Array.from(new Set(arr));
359
- };
360
-
361
- if (!(isPublic === undefined)) {
362
- _context6.next = 7;
338
+ if (!context.me) {
339
+ _context6.next = 6;
363
340
  break;
364
341
  }
365
342
 
366
- _context6.next = 4;
367
- return findAppInstances(context, theClass, true);
343
+ _context6.next = 3;
344
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
368
345
 
369
- case 4:
370
- _context6.next = 6;
371
- return findAppInstances(context, theClass, false);
346
+ case 3:
347
+ _context6.t0 = _context6.sent;
348
+ _context6.next = 7;
349
+ break;
372
350
 
373
351
  case 6:
374
- return _context6.abrupt("return", context);
352
+ _context6.t0 = [];
375
353
 
376
354
  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);
355
+ items = _context6.t0;
440
356
 
441
- case 38:
442
- _context6.next = 45;
443
- break;
444
-
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)
453
-
454
- case 45:
455
- i = 0;
456
-
457
- case 46:
458
- if (!(i < containers.length)) {
459
- _context6.next = 56;
460
- 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
+ });
461
366
  }
462
367
 
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);
368
+ context.instances = items.map(function (item) {
369
+ return item.instance;
471
370
  });
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
371
  return _context6.abrupt("return", context);
481
372
 
482
- case 57:
373
+ case 11:
483
374
  case "end":
484
375
  return _context6.stop();
485
376
  }
486
377
  }
487
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
378
+ }, _callee6);
488
379
  }));
489
380
  return _findAppInstances.apply(this, arguments);
490
381
  }
491
382
 
492
- function registrationControl(_x7, _x8, _x9) {
493
- 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);
494
387
  }
495
388
  /**
496
- * UI to List at all registered things
389
+ * UI to control registration of instance
497
390
  */
498
391
 
499
392
 
393
+ function registrationControl(_x6, _x7, _x8) {
394
+ return _registrationControl.apply(this, arguments);
395
+ }
396
+
500
397
  function _registrationControl() {
501
398
  _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;
399
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
503
400
 
504
401
  return _regenerator["default"].wrap(function _callee7$(_context7) {
505
402
  while (1) {
506
403
  switch (_context7.prev = _context7.next) {
507
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
508
420
  dom = context.dom;
509
421
 
510
422
  if (!(!dom || !context.div)) {
511
- _context7.next = 3;
423
+ _context7.next = 5;
512
424
  break;
513
425
  }
514
426
 
515
- return _context7.abrupt("return", context);
427
+ throw new Error('registrationControl: need dom and div');
516
428
 
517
- case 3:
429
+ case 5:
518
430
  box = dom.createElement('div');
519
431
  context.div.appendChild(box);
520
432
  context.me = _solidLogic.authn.currentUser(); // @@
521
433
 
522
- if (context.me) {
523
- _context7.next = 9;
434
+ me = context.me;
435
+
436
+ if (me) {
437
+ _context7.next = 12;
524
438
  break;
525
439
  }
526
440
 
527
441
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
528
442
  return _context7.abrupt("return", context);
529
443
 
530
- case 9:
531
- _context7.prev = 9;
532
- _context7.next = 12;
533
- return (0, _solidLogic.ensureTypeIndexes)(context);
534
-
535
444
  case 12:
536
- context2 = _context7.sent;
537
- _context7.next = 19;
538
- break;
445
+ _context7.prev = 12;
446
+ _context7.next = 15;
447
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
539
448
 
540
449
  case 15:
541
- _context7.prev = 15;
542
- _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);
543
457
 
544
458
  if (context.div && context.preferencesFileError) {
545
- msg = '(Preferences not available)';
459
+ msg = '(Lists of stuff not available)';
546
460
  context.div.appendChild(dom.createElement('p')).textContent = msg;
547
461
  } else if (context.div) {
548
462
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -550,168 +464,201 @@ function _registrationControl() {
550
464
  }
551
465
 
552
466
  debug.log(msg);
467
+ return _context7.abrupt("return", context);
553
468
 
554
- case 19:
555
- 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
556
471
 
557
472
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
558
473
  tbody = box.children[0].children[0];
559
474
  form = new _rdflib.BlankNode(); // @@ say for now
560
475
 
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
- };
476
+ _iterator = _createForOfIteratorHelper(scopes);
567
477
 
568
478
  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));
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
585
483
  }
586
-
587
- debug.log(_msg);
484
+ } catch (err) {
485
+ _iterator.e(err);
486
+ } finally {
487
+ _iterator.f();
588
488
  }
589
489
 
590
- return _context7.abrupt("return", context2);
490
+ return _context7.abrupt("return", context);
591
491
 
592
- case 26:
492
+ case 30:
593
493
  case "end":
594
494
  return _context7.stop();
595
495
  }
596
496
  }
597
- }, _callee7, null, [[9, 15]]);
497
+ }, _callee7, null, [[12, 18]]);
598
498
  }));
599
499
  return _registrationControl.apply(this, arguments);
600
500
  }
601
501
 
602
- function registrationList(_x10, _x11) {
603
- 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;
604
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
+
605
527
 
606
528
  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) {
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) {
610
533
  while (1) {
611
- switch (_context8.prev = _context8.next) {
534
+ switch (_context9.prev = _context9.next) {
612
535
  case 0:
613
- dom = context0.dom;
614
- div = context0.div;
536
+ dom = context.dom;
537
+ div = context.div;
615
538
  box = dom.createElement('div');
616
539
  div.appendChild(box);
617
- context0.me = _solidLogic.authn.currentUser(); // @@
540
+ context.me = _solidLogic.authn.currentUser(); // @@
618
541
 
619
- if (context0.me) {
620
- _context8.next = 8;
542
+ if (context.me) {
543
+ _context9.next = 8;
621
544
  break;
622
545
  }
623
546
 
624
547
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
625
- return _context8.abrupt("return", context0);
548
+ return _context9.abrupt("return", context);
626
549
 
627
550
  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
- });
551
+ _context9.next = 10;
552
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
643
553
 
644
- var _loop = function _loop(i) {
645
- 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
646
559
 
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
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;
653
565
 
566
+ _iterator2.s();
654
567
 
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');
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);
661
614
  }
662
615
 
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
- }));
616
+ return deleteFunction;
617
+ }()
618
+ });
619
+ row.children[0].style.paddingLeft = '3em';
620
+ tbody.appendChild(row);
672
621
  };
673
622
 
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
- }));
623
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
624
+ _loop();
625
+ }
626
+ } catch (err) {
627
+ _iterator3.e(err);
628
+ } finally {
629
+ _iterator3.f();
630
+ }
708
631
 
709
- 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:
710
657
  case "end":
711
- return _context8.stop();
658
+ return _context9.stop();
712
659
  }
713
660
  }
714
- }, _callee8);
661
+ }, _callee9, null, [[16, 32, 35, 38]]);
715
662
  }));
716
663
  return _registrationList.apply(this, arguments);
717
664
  }
@@ -868,7 +815,7 @@ function renderSignInPopup(dom) {
868
815
  }, _callee, null, [[0, 8]]);
869
816
  }));
870
817
 
871
- return function loginToIssuer(_x12) {
818
+ return function loginToIssuer(_x11) {
872
819
  return _ref.apply(this, arguments);
873
820
  };
874
821
  }();
@@ -1155,7 +1102,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
1155
1102
 
1156
1103
  function displayOptions(context) {
1157
1104
  // console.log('displayOptions!', context)
1158
- function makeNewWorkspace(_x13) {
1105
+ function makeNewWorkspace(_x12) {
1159
1106
  return _makeNewWorkspace.apply(this, arguments);
1160
1107
  } // const status = ''
1161
1108
 
@@ -1424,77 +1371,77 @@ function getUserRoles() {
1424
1371
 
1425
1372
 
1426
1373
  function _getUserRoles() {
1427
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
1374
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
1428
1375
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
1429
1376
 
1430
- return _regenerator["default"].wrap(function _callee9$(_context9) {
1377
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
1431
1378
  while (1) {
1432
- switch (_context9.prev = _context9.next) {
1379
+ switch (_context10.prev = _context10.next) {
1433
1380
  case 0:
1434
- _context9.prev = 0;
1435
- _context9.next = 3;
1381
+ _context10.prev = 0;
1382
+ _context10.next = 3;
1436
1383
  return ensureLoadedPreferences({});
1437
1384
 
1438
1385
  case 3:
1439
- _yield$ensureLoadedPr = _context9.sent;
1386
+ _yield$ensureLoadedPr = _context10.sent;
1440
1387
  me = _yield$ensureLoadedPr.me;
1441
1388
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
1442
1389
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
1443
1390
 
1444
1391
  if (!(!preferencesFile || preferencesFileError)) {
1445
- _context9.next = 9;
1392
+ _context10.next = 9;
1446
1393
  break;
1447
1394
  }
1448
1395
 
1449
1396
  throw new Error(preferencesFileError);
1450
1397
 
1451
1398
  case 9:
1452
- 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()));
1453
1400
 
1454
1401
  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);
1402
+ _context10.prev = 12;
1403
+ _context10.t0 = _context10["catch"](0);
1404
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
1458
1405
 
1459
1406
  case 15:
1460
- return _context9.abrupt("return", []);
1407
+ return _context10.abrupt("return", []);
1461
1408
 
1462
1409
  case 16:
1463
1410
  case "end":
1464
- return _context9.stop();
1411
+ return _context10.stop();
1465
1412
  }
1466
1413
  }
1467
- }, _callee9, null, [[0, 12]]);
1414
+ }, _callee10, null, [[0, 12]]);
1468
1415
  }));
1469
1416
  return _getUserRoles.apply(this, arguments);
1470
1417
  }
1471
1418
 
1472
- function filterAvailablePanes(_x14) {
1419
+ function filterAvailablePanes(_x13) {
1473
1420
  return _filterAvailablePanes.apply(this, arguments);
1474
1421
  }
1475
1422
 
1476
1423
  function _filterAvailablePanes() {
1477
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
1424
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
1478
1425
  var userRoles;
1479
- return _regenerator["default"].wrap(function _callee10$(_context10) {
1426
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
1480
1427
  while (1) {
1481
- switch (_context10.prev = _context10.next) {
1428
+ switch (_context11.prev = _context11.next) {
1482
1429
  case 0:
1483
- _context10.next = 2;
1430
+ _context11.next = 2;
1484
1431
  return getUserRoles();
1485
1432
 
1486
1433
  case 2:
1487
- userRoles = _context10.sent;
1488
- return _context10.abrupt("return", panes.filter(function (pane) {
1434
+ userRoles = _context11.sent;
1435
+ return _context11.abrupt("return", panes.filter(function (pane) {
1489
1436
  return isMatchingAudience(pane, userRoles);
1490
1437
  }));
1491
1438
 
1492
1439
  case 4:
1493
1440
  case "end":
1494
- return _context10.stop();
1441
+ return _context11.stop();
1495
1442
  }
1496
1443
  }
1497
- }, _callee10);
1444
+ }, _callee11);
1498
1445
  }));
1499
1446
  return _filterAvailablePanes.apply(this, arguments);
1500
1447
  }