solid-ui 2.4.22-c53976d9 → 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.
package/dist/main.js CHANGED
@@ -2745,8 +2745,7 @@ function updatePromise(del, ins) {
2745
2745
  }); // callback
2746
2746
 
2747
2747
  }); // promise
2748
- } // export findBookmarkDocument,
2749
-
2748
+ }
2750
2749
  /* Bookmarking
2751
2750
  */
2752
2751
 
@@ -7105,8 +7104,9 @@ var _debug = __webpack_require__(/*! ./debug */ "./lib/debug.js");
7105
7104
  */
7106
7105
 
7107
7106
  /* eslint-disable multiline-ternary */
7108
- // Do not export. lways us this module to find the icons, as it varies
7109
- var iconsOnGithub = 'https://solidos.github.io/solid-ui/src';
7107
+ // Do not export. Always us this module to find the icons, as they vary
7108
+ var iconsOnGithub = 'https://solidos.github.io/solid-ui/src'; // changed org 2022-05
7109
+
7110
7110
  var icons = module.scriptURI // Firefox extension
7111
7111
  ? {
7112
7112
  iconBase: module.scriptURI.slice(0, module.scriptURI.lastIndexOf('/')) + '/icons/',
@@ -7754,7 +7754,9 @@ exports.loginStatusBox = loginStatusBox;
7754
7754
  exports.newAppInstance = newAppInstance;
7755
7755
  exports.registrationControl = registrationControl;
7756
7756
  exports.registrationList = registrationList;
7757
+ exports.renderScopeHeadingRow = renderScopeHeadingRow;
7757
7758
  exports.renderSignInPopup = renderSignInPopup;
7759
+ exports.scopeLabel = scopeLabel;
7758
7760
  exports.selectWorkspace = selectWorkspace;
7759
7761
 
7760
7762
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
@@ -7775,7 +7777,7 @@ var _signup = __webpack_require__(/*! ../signup/signup.js */ "./lib/signup/signu
7775
7777
 
7776
7778
  var _style = __webpack_require__(/*! ../style */ "./lib/style.js");
7777
7779
 
7778
- var _index = __webpack_require__(/*! ../utils/index */ "./lib/utils/index.js");
7780
+ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
7779
7781
 
7780
7782
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
7781
7783
 
@@ -7783,39 +7785,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
7783
7785
 
7784
7786
  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; }
7785
7787
 
7786
- /* eslint-disable camelcase */
7788
+ 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; } } }; }
7787
7789
 
7788
- /**
7789
- * Signing in, signing up, profile and preferences reloading
7790
- * Type index management
7791
- *
7792
- * Many functions in this module take a context object which
7793
- * holds various RDF symbols, add to it, and return a promise of it.
7794
- *
7795
- * * `me` RDF symbol for the user's WebID
7796
- * * `publicProfile` The user's public profile, iff loaded
7797
- * * `preferencesFile` The user's personal preference file, iff loaded
7798
- * * `index.public` The user's public type index file
7799
- * * `index.private` The user's private type index file
7800
- *
7801
- * Not RDF symbols:
7802
- * * `noun` A string in english for the type of thing -- like "address book"
7803
- * * `instance` An array of nodes which are existing instances
7804
- * * `containers` An array of nodes of containers of instances
7805
- * * `div` A DOM element where UI can be displayed
7806
- * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
7807
- * *
7808
- * * Vocabulary: "load" loads a file if it exists;
7809
- * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
7810
- * @packageDocumentation
7811
- */
7790
+ 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); }
7791
+
7792
+ 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; }
7812
7793
 
7794
+ var store = _solidLogic.solidLogicSingleton.store;
7813
7795
  /**
7814
7796
  * Resolves with the logged in user's WebID
7815
7797
  *
7816
7798
  * @param context
7817
7799
  */
7818
7800
  // used to be logIn
7801
+
7819
7802
  function ensureLoggedIn(context) {
7820
7803
  var me = _solidLogic.authn.currentUser();
7821
7804
 
@@ -7857,7 +7840,7 @@ function ensureLoggedIn(context) {
7857
7840
  // used to be logInLoadPreferences
7858
7841
 
7859
7842
 
7860
- function ensureLoadedPreferences(_x2) {
7843
+ function ensureLoadedPreferences(_x) {
7861
7844
  return _ensureLoadedPreferences.apply(this, arguments);
7862
7845
  }
7863
7846
  /**
@@ -8004,14 +7987,17 @@ function _ensureLoadedPreferences() {
8004
7987
  return _ensureLoadedPreferences.apply(this, arguments);
8005
7988
  }
8006
7989
 
8007
- function ensureLoadedProfile(_x3) {
7990
+ function ensureLoadedProfile(_x2) {
8008
7991
  return _ensureLoadedProfile.apply(this, arguments);
8009
7992
  }
8010
7993
  /**
8011
- * Returns promise of context with arrays of symbols
8012
- *
8013
- * 2016-12-11 change to include forClass arc a la
8014
- * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
7994
+ * Returns promise of context with arrays of symbols
7995
+ *
7996
+ * leaving the `isPublic` param undefined will bring in community index things, too
7997
+ */
7998
+
7999
+ /**
8000
+ * @deprecated Since version 2.4.17 Will be deleted in version 3.0. Use solid-logic getAppInstances instead.
8015
8001
  */
8016
8002
 
8017
8003
 
@@ -8076,210 +8062,141 @@ function _ensureLoadedProfile() {
8076
8062
  return _ensureLoadedProfile.apply(this, arguments);
8077
8063
  }
8078
8064
 
8079
- function findAppInstances(_x4, _x5, _x6) {
8065
+ function findAppInstances(_x3, _x4, _x5) {
8080
8066
  return _findAppInstances.apply(this, arguments);
8081
8067
  }
8082
- /**
8083
- * UI to control registration of instance
8084
- */
8085
-
8086
8068
 
8087
8069
  function _findAppInstances() {
8088
8070
  _findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
8089
- var visibility, index, thisIndex, registrations, instances, containers, unique, e, i, cont;
8071
+ var items;
8090
8072
  return _regenerator["default"].wrap(function _callee6$(_context6) {
8091
8073
  while (1) {
8092
8074
  switch (_context6.prev = _context6.next) {
8093
8075
  case 0:
8094
- unique = function _unique(arr) {
8095
- return Array.from(new Set(arr));
8096
- };
8076
+ debug.warn('Calling deprecated function findAppInstances! Use solid-logic getAppInstances instead.');
8097
8077
 
8098
- if (!(isPublic === undefined)) {
8078
+ if (!context.me) {
8099
8079
  _context6.next = 7;
8100
8080
  break;
8101
8081
  }
8102
8082
 
8103
8083
  _context6.next = 4;
8104
- return findAppInstances(context, theClass, true);
8084
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
8105
8085
 
8106
8086
  case 4:
8107
- _context6.next = 6;
8108
- return findAppInstances(context, theClass, false);
8109
-
8110
- case 6:
8111
- return _context6.abrupt("return", context);
8112
-
8113
- case 7:
8114
- _context6.prev = 7;
8115
- _context6.next = 10;
8116
- return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
8117
-
8118
- case 10:
8119
- _context6.next = 15;
8087
+ _context6.t0 = _context6.sent;
8088
+ _context6.next = 8;
8120
8089
  break;
8121
8090
 
8122
- case 12:
8123
- _context6.prev = 12;
8124
- _context6.t0 = _context6["catch"](7);
8125
- widgets.complain(context, "loadIndex: login and load problem ".concat(_context6.t0));
8126
-
8127
- case 15:
8128
- // console.log('awaited LogInLoad!', context)
8129
- visibility = isPublic ? 'public' : 'private';
8130
- _context6.prev = 16;
8131
- _context6.next = 19;
8132
- return (0, _solidLogic.loadIndex)(context, isPublic);
8133
-
8134
- case 19:
8135
- _context6.next = 24;
8136
- break;
8137
-
8138
- case 21:
8139
- _context6.prev = 21;
8140
- _context6.t1 = _context6["catch"](16);
8141
- debug.error(_context6.t1);
8142
-
8143
- case 24:
8144
- index = context.index;
8145
- thisIndex = index[visibility];
8146
- registrations = thisIndex.map(function (ix) {
8147
- return _solidLogic.solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix);
8148
- }).reduce(function (acc, curr) {
8149
- return acc.concat(curr);
8150
- }, []);
8151
- instances = registrations.map(function (reg) {
8152
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instance'));
8153
- }).reduce(function (acc, curr) {
8154
- return acc.concat(curr);
8155
- }, []);
8156
- containers = registrations.map(function (reg) {
8157
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instanceContainer'));
8158
- }).reduce(function (acc, curr) {
8159
- return acc.concat(curr);
8160
- }, []);
8161
- context.instances = context.instances || [];
8162
- context.instances = unique(context.instances.concat(instances));
8163
- context.containers = context.containers || [];
8164
- context.containers = unique(context.containers.concat(containers));
8165
-
8166
- if (containers.length) {
8167
- _context6.next = 35;
8168
- break;
8169
- }
8170
-
8171
- return _context6.abrupt("return", context);
8172
-
8173
- case 35:
8174
- _context6.prev = 35;
8175
- _context6.next = 38;
8176
- return _solidLogic.solidLogicSingleton.load(containers);
8177
-
8178
- case 38:
8179
- _context6.next = 45;
8180
- break;
8181
-
8182
- case 40:
8183
- _context6.prev = 40;
8184
- _context6.t2 = _context6["catch"](35);
8185
- e = new Error("[FAI] Unable to load containers".concat(_context6.t2));
8186
- debug.log(e); // complain
8187
-
8188
- widgets.complain(context, "Error looking for ".concat(_index.utils.label(theClass), ": ").concat(_context6.t2)); // but then ignore it
8189
- // throw new Error(e)
8091
+ case 7:
8092
+ _context6.t0 = [];
8190
8093
 
8191
- case 45:
8192
- i = 0;
8094
+ case 8:
8095
+ items = _context6.t0;
8193
8096
 
8194
- case 46:
8195
- if (!(i < containers.length)) {
8196
- _context6.next = 56;
8197
- break;
8097
+ if (isPublic === true) {
8098
+ // old API - not recommended!
8099
+ items = items.filter(function (item) {
8100
+ return item.scope.label === 'public';
8101
+ });
8102
+ } else if (isPublic === false) {
8103
+ items = items.filter(function (item) {
8104
+ return item.scope.label === 'private';
8105
+ });
8198
8106
  }
8199
8107
 
8200
- cont = containers[i];
8201
- _context6.t3 = context.instances;
8202
- _context6.next = 51;
8203
- return _solidLogic.solidLogicSingleton.getContainerMembers(cont.value);
8204
-
8205
- case 51:
8206
- _context6.t4 = _context6.sent.map(function (uri) {
8207
- return _solidLogic.solidLogicSingleton.store.sym(uri);
8108
+ context.instances = items.map(function (item) {
8109
+ return item.instance;
8208
8110
  });
8209
- context.instances = _context6.t3.concat.call(_context6.t3, _context6.t4);
8210
-
8211
- case 53:
8212
- i++;
8213
- _context6.next = 46;
8214
- break;
8215
-
8216
- case 56:
8217
8111
  return _context6.abrupt("return", context);
8218
8112
 
8219
- case 57:
8113
+ case 12:
8220
8114
  case "end":
8221
8115
  return _context6.stop();
8222
8116
  }
8223
8117
  }
8224
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
8118
+ }, _callee6);
8225
8119
  }));
8226
8120
  return _findAppInstances.apply(this, arguments);
8227
8121
  }
8228
8122
 
8229
- function registrationControl(_x7, _x8, _x9) {
8230
- return _registrationControl.apply(this, arguments);
8123
+ function scopeLabel(context, scope) {
8124
+ var mine = context.me && context.me.sameTerm(scope.agent);
8125
+ var name = mine ? '' : utils.label(scope.agent) + ' ';
8126
+ return "".concat(name).concat(scope.label);
8231
8127
  }
8232
8128
  /**
8233
- * UI to List at all registered things
8129
+ * UI to control registration of instance
8234
8130
  */
8235
8131
 
8236
8132
 
8133
+ function registrationControl(_x6, _x7, _x8) {
8134
+ return _registrationControl.apply(this, arguments);
8135
+ }
8136
+
8237
8137
  function _registrationControl() {
8238
8138
  _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
8239
- var dom, box, context2, msg, tbody, form, registrationStatements, index, statements, _msg;
8139
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
8240
8140
 
8241
8141
  return _regenerator["default"].wrap(function _callee7$(_context7) {
8242
8142
  while (1) {
8243
8143
  switch (_context7.prev = _context7.next) {
8244
8144
  case 0:
8145
+ renderScopeCheckbox = function _renderScopeCheckbox(scope) {
8146
+ var statements = registrationStatements(scope.index);
8147
+ var name = scopeLabel(context, scope);
8148
+ var label = "".concat(name, " link to this ").concat(context.noun);
8149
+ return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
8150
+ };
8151
+
8152
+ registrationStatements = function _registrationStatemen(index) {
8153
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8154
+
8155
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8156
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8157
+ };
8158
+
8159
+ /// / body of registrationControl
8245
8160
  dom = context.dom;
8246
8161
 
8247
8162
  if (!(!dom || !context.div)) {
8248
- _context7.next = 3;
8163
+ _context7.next = 5;
8249
8164
  break;
8250
8165
  }
8251
8166
 
8252
- return _context7.abrupt("return", context);
8167
+ throw new Error('registrationControl: need dom and div');
8253
8168
 
8254
- case 3:
8169
+ case 5:
8255
8170
  box = dom.createElement('div');
8256
8171
  context.div.appendChild(box);
8257
8172
  context.me = _solidLogic.authn.currentUser(); // @@
8258
8173
 
8259
- if (context.me) {
8260
- _context7.next = 9;
8174
+ me = context.me;
8175
+
8176
+ if (me) {
8177
+ _context7.next = 12;
8261
8178
  break;
8262
8179
  }
8263
8180
 
8264
8181
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
8265
8182
  return _context7.abrupt("return", context);
8266
8183
 
8267
- case 9:
8268
- _context7.prev = 9;
8269
- _context7.next = 12;
8270
- return (0, _solidLogic.ensureTypeIndexes)(context);
8271
-
8272
8184
  case 12:
8273
- context2 = _context7.sent;
8274
- _context7.next = 19;
8275
- break;
8185
+ _context7.prev = 12;
8186
+ _context7.next = 15;
8187
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
8276
8188
 
8277
8189
  case 15:
8278
- _context7.prev = 15;
8279
- _context7.t0 = _context7["catch"](9);
8190
+ scopes = _context7.sent;
8191
+ _context7.next = 23;
8192
+ break;
8193
+
8194
+ case 18:
8195
+ _context7.prev = 18;
8196
+ _context7.t0 = _context7["catch"](12);
8280
8197
 
8281
8198
  if (context.div && context.preferencesFileError) {
8282
- msg = '(Preferences not available)';
8199
+ msg = '(Lists of stuff not available)';
8283
8200
  context.div.appendChild(dom.createElement('p')).textContent = msg;
8284
8201
  } else if (context.div) {
8285
8202
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -8287,168 +8204,201 @@ function _registrationControl() {
8287
8204
  }
8288
8205
 
8289
8206
  debug.log(msg);
8207
+ return _context7.abrupt("return", context);
8290
8208
 
8291
- case 19:
8292
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
8209
+ case 23:
8210
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8293
8211
 
8294
8212
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
8295
8213
  tbody = box.children[0].children[0];
8296
8214
  form = new _rdflib.BlankNode(); // @@ say for now
8297
8215
 
8298
- registrationStatements = function registrationStatements(index) {
8299
- var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8300
-
8301
- var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8302
- return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8303
- };
8216
+ _iterator = _createForOfIteratorHelper(scopes);
8304
8217
 
8305
8218
  try {
8306
- if (context2.index && context2.index["public"] && context2.index["public"].length > 0) {
8307
- index = context2.index["public"][0];
8308
- statements = registrationStatements(index);
8309
- tbody.children[0].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context2.noun), null, statements, form, index));
8219
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8220
+ scope = _step.value;
8221
+ row = tbody.appendChild(dom.createElement('tr'));
8222
+ row.appendChild(renderScopeCheckbox(scope)); // @@ index
8310
8223
  }
8311
-
8312
- if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
8313
- index = context2.index["private"][0];
8314
- statements = registrationStatements(index);
8315
- tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
8316
- }
8317
- } catch (e) {
8318
- _msg = "registrationControl: Error making panel: ".concat(e);
8319
-
8320
- if (context.div) {
8321
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
8322
- }
8323
-
8324
- debug.log(_msg);
8224
+ } catch (err) {
8225
+ _iterator.e(err);
8226
+ } finally {
8227
+ _iterator.f();
8325
8228
  }
8326
8229
 
8327
- return _context7.abrupt("return", context2);
8230
+ return _context7.abrupt("return", context);
8328
8231
 
8329
- case 26:
8232
+ case 30:
8330
8233
  case "end":
8331
8234
  return _context7.stop();
8332
8235
  }
8333
8236
  }
8334
- }, _callee7, null, [[9, 15]]);
8237
+ }, _callee7, null, [[12, 18]]);
8335
8238
  }));
8336
8239
  return _registrationControl.apply(this, arguments);
8337
8240
  }
8338
8241
 
8339
- function registrationList(_x10, _x11) {
8242
+ function renderScopeHeadingRow(context, store, scope) {
8243
+ var backgroundColor = {
8244
+ "private": '#fee',
8245
+ "public": '#efe'
8246
+ };
8247
+ var dom = context.dom;
8248
+ var name = scopeLabel(context, scope);
8249
+ var row = dom.createElement('tr');
8250
+ var cell = row.appendChild(dom.createElement('td'));
8251
+ cell.setAttribute('colspan', '3');
8252
+ cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
8253
+ var header = cell.appendChild(dom.createElement('h3'));
8254
+ header.textContent = name + ' links';
8255
+ header.style.textAlign = 'left';
8256
+ return row;
8257
+ }
8258
+ /**
8259
+ * UI to List at all registered things
8260
+ */
8261
+
8262
+
8263
+ function registrationList(_x9, _x10) {
8340
8264
  return _registrationList.apply(this, arguments);
8341
- }
8265
+ } // registrationList
8266
+
8342
8267
 
8343
8268
  function _registrationList() {
8344
- _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(context0, options) {
8345
- var dom, div, box;
8346
- return _regenerator["default"].wrap(function _callee8$(_context8) {
8269
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
8270
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
8271
+
8272
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
8347
8273
  while (1) {
8348
- switch (_context8.prev = _context8.next) {
8274
+ switch (_context9.prev = _context9.next) {
8349
8275
  case 0:
8350
- dom = context0.dom;
8351
- div = context0.div;
8276
+ dom = context.dom;
8277
+ div = context.div;
8352
8278
  box = dom.createElement('div');
8353
8279
  div.appendChild(box);
8354
- context0.me = _solidLogic.authn.currentUser(); // @@
8280
+ context.me = _solidLogic.authn.currentUser(); // @@
8355
8281
 
8356
- if (context0.me) {
8357
- _context8.next = 8;
8282
+ if (context.me) {
8283
+ _context9.next = 8;
8358
8284
  break;
8359
8285
  }
8360
8286
 
8361
8287
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
8362
- return _context8.abrupt("return", context0);
8288
+ return _context9.abrupt("return", context);
8363
8289
 
8364
8290
  case 8:
8365
- return _context8.abrupt("return", (0, _solidLogic.ensureTypeIndexes)(context0).then(function (context) {
8366
- box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8367
-
8368
- // tbody will be inserted anyway
8369
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8370
- var table = box.firstChild;
8371
- var ix = [];
8372
- var sts = [];
8373
- var vs = ['private', 'public'];
8374
- vs.forEach(function (visibility) {
8375
- if (context.index && context.index[visibility].length > 0 && options[visibility]) {
8376
- ix = ix.concat(context.index[visibility][0]);
8377
- sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
8378
- }
8379
- });
8291
+ _context9.next = 10;
8292
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
8293
+
8294
+ case 10:
8295
+ scopes = _context9.sent;
8296
+ // includes community indexes
8297
+ // console.log('@@ registrationList ', scopes)
8298
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8380
8299
 
8381
- var _loop = function _loop(i) {
8382
- var statement = sts[i];
8300
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8301
+ table = box.firstChild;
8302
+ tbody = table.firstChild;
8303
+ _iterator2 = _createForOfIteratorHelper(scopes);
8304
+ _context9.prev = 16;
8383
8305
 
8384
- if (options.type) {
8385
- // now check terms:forClass
8386
- if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
8387
- return "continue"; // skip irrelevant ones
8388
- }
8389
- } // const cla = statement.subject
8306
+ _iterator2.s();
8307
+
8308
+ case 18:
8309
+ if ((_step2 = _iterator2.n()).done) {
8310
+ _context9.next = 30;
8311
+ break;
8312
+ }
8390
8313
 
8314
+ scope = _step2.value;
8315
+ // need some predicate for listing/adding agents
8316
+ headingRow = renderScopeHeadingRow(context, store, scope);
8317
+ tbody.appendChild(headingRow);
8318
+ _context9.next = 24;
8319
+ return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
8391
8320
 
8392
- // const cla = statement.subject
8393
- var inst = statement.object;
8394
- table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
8395
- deleteFunction: function deleteFunction(_x) {
8396
- if (!_solidLogic.solidLogicSingleton.store.updater) {
8397
- throw new Error('Cannot delete this, store has no updater');
8321
+ case 24:
8322
+ items = _context9.sent;
8323
+ // any class
8324
+ if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
8325
+
8326
+ _iterator3 = _createForOfIteratorHelper(items);
8327
+
8328
+ try {
8329
+ _loop = function _loop() {
8330
+ var item = _step3.value;
8331
+ var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
8332
+ deleteFunction: function () {
8333
+ var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
8334
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
8335
+ while (1) {
8336
+ switch (_context8.prev = _context8.next) {
8337
+ case 0:
8338
+ _context8.next = 2;
8339
+ return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
8340
+
8341
+ case 2:
8342
+ tbody.removeChild(row);
8343
+
8344
+ case 3:
8345
+ case "end":
8346
+ return _context8.stop();
8347
+ }
8348
+ }
8349
+ }, _callee8);
8350
+ }));
8351
+
8352
+ function deleteFunction() {
8353
+ return _deleteFunction.apply(this, arguments);
8398
8354
  }
8399
8355
 
8400
- _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
8401
- if (ok) {
8402
- debug.log("Removed from index: ".concat(statement.subject));
8403
- } else {
8404
- debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
8405
- }
8406
- });
8407
- }
8408
- }));
8356
+ return deleteFunction;
8357
+ }()
8358
+ });
8359
+ row.children[0].style.paddingLeft = '3em';
8360
+ tbody.appendChild(row);
8409
8361
  };
8410
8362
 
8411
- for (var i = 0; i < sts.length; i++) {
8412
- var _ret = _loop(i);
8363
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
8364
+ _loop();
8365
+ }
8366
+ } catch (err) {
8367
+ _iterator3.e(err);
8368
+ } finally {
8369
+ _iterator3.f();
8370
+ }
8413
8371
 
8414
- if (_ret === "continue") continue;
8415
- } // registrationList
8372
+ case 28:
8373
+ _context9.next = 18;
8374
+ break;
8416
8375
 
8417
- /*
8418
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8419
- if (containers.length) {
8420
- fetcher.load(containers).then(function(xhrs){
8421
- for (const i=0; i<containers.length; i++) {
8422
- const cont = containers[i];
8423
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8424
- }
8425
- });
8426
- }
8427
- */
8376
+ case 30:
8377
+ _context9.next = 35;
8378
+ break;
8428
8379
 
8380
+ case 32:
8381
+ _context9.prev = 32;
8382
+ _context9.t0 = _context9["catch"](16);
8429
8383
 
8430
- // registrationList
8384
+ _iterator2.e(_context9.t0);
8431
8385
 
8432
- /*
8433
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8434
- if (containers.length) {
8435
- fetcher.load(containers).then(function(xhrs){
8436
- for (const i=0; i<containers.length; i++) {
8437
- const cont = containers[i];
8438
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8439
- }
8440
- });
8441
- }
8442
- */
8443
- return context;
8444
- }));
8386
+ case 35:
8387
+ _context9.prev = 35;
8445
8388
 
8446
- case 9:
8389
+ _iterator2.f();
8390
+
8391
+ return _context9.finish(35);
8392
+
8393
+ case 38:
8394
+ return _context9.abrupt("return", context);
8395
+
8396
+ case 39:
8447
8397
  case "end":
8448
- return _context8.stop();
8398
+ return _context9.stop();
8449
8399
  }
8450
8400
  }
8451
- }, _callee8);
8401
+ }, _callee9, null, [[16, 32, 35, 38]]);
8452
8402
  }));
8453
8403
  return _registrationList.apply(this, arguments);
8454
8404
  }
@@ -8605,7 +8555,7 @@ function renderSignInPopup(dom) {
8605
8555
  }, _callee, null, [[0, 8]]);
8606
8556
  }));
8607
8557
 
8608
- return function loginToIssuer(_x12) {
8558
+ return function loginToIssuer(_x11) {
8609
8559
  return _ref.apply(this, arguments);
8610
8560
  };
8611
8561
  }();
@@ -8892,7 +8842,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
8892
8842
 
8893
8843
  function displayOptions(context) {
8894
8844
  // console.log('displayOptions!', context)
8895
- function makeNewWorkspace(_x13) {
8845
+ function makeNewWorkspace(_x12) {
8896
8846
  return _makeNewWorkspace.apply(this, arguments);
8897
8847
  } // const status = ''
8898
8848
 
@@ -9161,77 +9111,77 @@ function getUserRoles() {
9161
9111
 
9162
9112
 
9163
9113
  function _getUserRoles() {
9164
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
9114
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
9165
9115
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
9166
9116
 
9167
- return _regenerator["default"].wrap(function _callee9$(_context9) {
9117
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
9168
9118
  while (1) {
9169
- switch (_context9.prev = _context9.next) {
9119
+ switch (_context10.prev = _context10.next) {
9170
9120
  case 0:
9171
- _context9.prev = 0;
9172
- _context9.next = 3;
9121
+ _context10.prev = 0;
9122
+ _context10.next = 3;
9173
9123
  return ensureLoadedPreferences({});
9174
9124
 
9175
9125
  case 3:
9176
- _yield$ensureLoadedPr = _context9.sent;
9126
+ _yield$ensureLoadedPr = _context10.sent;
9177
9127
  me = _yield$ensureLoadedPr.me;
9178
9128
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
9179
9129
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
9180
9130
 
9181
9131
  if (!(!preferencesFile || preferencesFileError)) {
9182
- _context9.next = 9;
9132
+ _context10.next = 9;
9183
9133
  break;
9184
9134
  }
9185
9135
 
9186
9136
  throw new Error(preferencesFileError);
9187
9137
 
9188
9138
  case 9:
9189
- return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9139
+ return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9190
9140
 
9191
9141
  case 12:
9192
- _context9.prev = 12;
9193
- _context9.t0 = _context9["catch"](0);
9194
- debug.warn('Unable to fetch your preferences - this was the error: ', _context9.t0);
9142
+ _context10.prev = 12;
9143
+ _context10.t0 = _context10["catch"](0);
9144
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
9195
9145
 
9196
9146
  case 15:
9197
- return _context9.abrupt("return", []);
9147
+ return _context10.abrupt("return", []);
9198
9148
 
9199
9149
  case 16:
9200
9150
  case "end":
9201
- return _context9.stop();
9151
+ return _context10.stop();
9202
9152
  }
9203
9153
  }
9204
- }, _callee9, null, [[0, 12]]);
9154
+ }, _callee10, null, [[0, 12]]);
9205
9155
  }));
9206
9156
  return _getUserRoles.apply(this, arguments);
9207
9157
  }
9208
9158
 
9209
- function filterAvailablePanes(_x14) {
9159
+ function filterAvailablePanes(_x13) {
9210
9160
  return _filterAvailablePanes.apply(this, arguments);
9211
9161
  }
9212
9162
 
9213
9163
  function _filterAvailablePanes() {
9214
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
9164
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
9215
9165
  var userRoles;
9216
- return _regenerator["default"].wrap(function _callee10$(_context10) {
9166
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
9217
9167
  while (1) {
9218
- switch (_context10.prev = _context10.next) {
9168
+ switch (_context11.prev = _context11.next) {
9219
9169
  case 0:
9220
- _context10.next = 2;
9170
+ _context11.next = 2;
9221
9171
  return getUserRoles();
9222
9172
 
9223
9173
  case 2:
9224
- userRoles = _context10.sent;
9225
- return _context10.abrupt("return", panes.filter(function (pane) {
9174
+ userRoles = _context11.sent;
9175
+ return _context11.abrupt("return", panes.filter(function (pane) {
9226
9176
  return isMatchingAudience(pane, userRoles);
9227
9177
  }));
9228
9178
 
9229
9179
  case 4:
9230
9180
  case "end":
9231
- return _context10.stop();
9181
+ return _context11.stop();
9232
9182
  }
9233
9183
  }
9234
- }, _callee10);
9184
+ }, _callee11);
9235
9185
  }));
9236
9186
  return _filterAvailablePanes.apply(this, arguments);
9237
9187
  }
@@ -12026,6 +11976,83 @@ module.exports = style; // @@ No way to do this in ESM
12026
11976
 
12027
11977
  /***/ }),
12028
11978
 
11979
+ /***/ "./lib/style_multiSelect.js":
11980
+ /*!**********************************!*\
11981
+ !*** ./lib/style_multiSelect.js ***!
11982
+ \**********************************/
11983
+ /***/ ((module, exports) => {
11984
+
11985
+ "use strict";
11986
+
11987
+
11988
+ Object.defineProperty(exports, "__esModule", ({
11989
+ value: true
11990
+ }));
11991
+ exports.style = void 0;
11992
+
11993
+ /*
11994
+ * BASED ON:
11995
+ * IconicMultiSelect v0.7.0
11996
+ * Licence: MIT
11997
+ * (c) 2021 Sidney Wimart.
11998
+ * repo & configuration: https://github.com/sidneywm/iconic-multiselect
11999
+ */
12000
+
12001
+ /**
12002
+ * @version IconicMultiSelect v0.7.0
12003
+ * @licence MIT
12004
+ */
12005
+ var style = {
12006
+ multiselect__container: "\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n background-color: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n min-height: 36px;\n padding: 4px 8px 0 8px;\n position: relative;\n width: 354px;\n margin-bottom: 5px;\n font-size: 100%\n ",
12007
+
12008
+ /*
12009
+ multiselect__container:after: `
12010
+ content: '';
12011
+ min-height:inherit;
12012
+ font-size:0;
12013
+ `,
12014
+ multiselect__container > *: `
12015
+ color: #656565;
12016
+ font-size: 14px;
12017
+ `,
12018
+ */
12019
+ multiselect__wrapper: "\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n ",
12020
+ multiselect__clear_btn: "\n cursor: pointer;\n align-items: center;\n margin-bottom: 4px;\n margin-left: 4px;\n ",
12021
+ multiselect__options: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n ",
12022
+ multiselect__options_visible: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n max-height: 200px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n opacity: 1;\n transition: max-height 0.2s ease;\n ",
12023
+ multiselect__options_ul: "\n list-style: none;\n margin: 0;\n padding: 2px 0;\n max-height: 200px;\n overflow: auto;\n ",
12024
+ multiselect__options_ul_li: "\n cursor: pointer;\n padding: 4px 8px;\n ",
12025
+ // multiselect__options ul li:hover: `
12026
+ multiselect__options_ul_li_hover: "\n background-color: #dedede;\n ",
12027
+
12028
+ /*
12029
+ multiselect__options ul li *: `
12030
+ pointer-events: none;
12031
+ `,
12032
+ */
12033
+ multiselect__options_ul_p_multiselect__options_no_results: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
12034
+ multiselect__options_ul_p_multiselect__options_no_data: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
12035
+ // multiselect__options ul li.multiselect__options--selected: `
12036
+ multiselect__options_ul_li_multiselect__options_selected: "\n background-color: #656565;\n color: #fff;\n ",
12037
+ // multiselect__options ul li.multiselect__options--selected:hover: `
12038
+ multiselect__options_ul_li_multiselect__options_selected_hover: "\n background-color: #656565;\n ",
12039
+ // multiselect__options ul li.arrow-selected: `
12040
+ multiselect__options_ul_li_arrow_selected: "\n border: 2px solid rgba(101, 101, 101, 0.5);\n ",
12041
+ multiselect__selected: "\n background-color: #656565;\n border-radius: 2px;\n color: #fff;\n margin-bottom: 4px;\n margin-right: 4px;\n padding: 4px 8px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n ",
12042
+ multiselect__selected_multiselect__remove_btn: "\n cursor: pointer;\n display: flex;\n margin-left: 6px;\n ",
12043
+ multiselect__input: "\n border: none;\n -ms-flex-preferred-size: 40%;\n flex-basis: 40%;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n height: 5px; \n margin-bottom: 4px;\n min-width: 40%;\n outline: none; \n "
12044
+ };
12045
+ exports.style = style;
12046
+
12047
+ style.setStyle = function setStyle(ele, styleName) {
12048
+ ele.style = style[styleName];
12049
+ };
12050
+
12051
+ module.exports = style;
12052
+ //# sourceMappingURL=style_multiSelect.js.map
12053
+
12054
+ /***/ }),
12055
+
12029
12056
  /***/ "./lib/table.js":
12030
12057
  /*!**********************!*\
12031
12058
  !*** ./lib/table.js ***!
@@ -13914,9 +13941,9 @@ function tabWidget(options) {
13914
13941
  var marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4);
13915
13942
  var marginsStyle = "margin: ".concat(marginsPrepped.join(' '), ";");
13916
13943
  var paddingStyle = "padding: ".concat(marginsPrepped.join(' '), ";");
13917
- var tabStyle = cornersStyle + "padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
13918
- var unselectedStyle = "".concat(tabStyle + marginsStyle, "opacity: 50%; background-color: ").concat(backgroundColor, ";");
13919
- var selectedStyle = "".concat(tabStyle + marginsStyle, "background-color: ").concat(selectedColor, ";");
13944
+ var tabStyle = cornersStyle + "position: relative; padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
13945
+ var unselectedStyle = "".concat(tabStyle + marginsStyle, " opacity: 50%; background-color: ").concat(backgroundColor, ";");
13946
+ var selectedStyle = "".concat(tabStyle + marginsStyle, " background-color: ").concat(selectedColor, ";");
13920
13947
  var shownStyle = 'height: 100%; width: 100%;';
13921
13948
  var hiddenStyle = shownStyle + 'display: none;';
13922
13949
  rootElement.refresh = orderedSync;
@@ -13976,35 +14003,50 @@ function tabWidget(options) {
13976
14003
 
13977
14004
  function makeNewSlot(item) {
13978
14005
  var ele = dom.createElement(tabElement);
14006
+ ele.setAttribute('style', unselectedStyle);
13979
14007
  ele.subject = item;
13980
- var div = ele.appendChild(dom.createElement('div'));
13981
- div.setAttribute('style', unselectedStyle);
13982
- div.addEventListener('click', function (e) {
13983
- if (!e.metaKey) {
13984
- resetTabStyle();
13985
- resetBodyStyle();
14008
+ var div = ele.appendChild(dom.createElement('button'));
14009
+ div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
14010
+ var ellipsis = dom.createElement('button');
14011
+ ellipsis.textContent = '...';
14012
+ ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
14013
+
14014
+ div.onclick = function () {
14015
+ resetTabStyle();
14016
+ resetBodyStyle();
14017
+ ele.setAttribute('style', selectedStyle);
14018
+ if (!ele.bodyTR) return;
14019
+ ele.bodyTR.setAttribute('style', shownStyle);
14020
+ var bodyMain = getOrCreateContainerElement(ele);
14021
+
14022
+ if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
14023
+ bodyMain.innerHTML = 'loading item ...' + item;
14024
+ options.renderMain(bodyMain, ele.subject);
14025
+ bodyMain.asSettings = false;
13986
14026
  }
14027
+ };
13987
14028
 
13988
- div.setAttribute('style', selectedStyle);
14029
+ ellipsis.onclick = function () {
14030
+ resetTabStyle();
14031
+ resetBodyStyle();
14032
+ ele.setAttribute('style', selectedStyle);
13989
14033
  if (!ele.bodyTR) return;
13990
14034
  ele.bodyTR.setAttribute('style', shownStyle);
13991
14035
  var bodyMain = getOrCreateContainerElement(ele);
13992
14036
 
13993
- if (options.renderTabSettings && e.altKey && ele.subject && bodyMain.asSettings !== true) {
14037
+ if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {
13994
14038
  bodyMain.innerHTML = 'loading settings ...' + item;
13995
14039
  options.renderTabSettings(bodyMain, ele.subject);
13996
14040
  bodyMain.asSettings = true;
13997
- } else if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
13998
- bodyMain.innerHTML = 'loading item ...' + item;
13999
- options.renderMain(bodyMain, ele.subject);
14000
- bodyMain.asSettings = false;
14001
14041
  }
14002
- });
14042
+ };
14003
14043
 
14004
14044
  if (options.renderTab) {
14005
14045
  options.renderTab(div, item);
14046
+ ele.appendChild(ellipsis);
14006
14047
  } else {
14007
- div.textContent = (0, _utils.label)(item);
14048
+ div.innerHTML = (0, _utils.label)(item);
14049
+ ele.appendChild(ellipsis);
14008
14050
  }
14009
14051
 
14010
14052
  return ele;
@@ -14084,10 +14126,8 @@ function tabWidget(options) {
14084
14126
 
14085
14127
  if (_tab.classList.contains('unstyled')) {
14086
14128
  continue;
14087
- }
14088
-
14089
- if (_tab.children[0]) {
14090
- _tab.children[0].setAttribute('style', unselectedStyle);
14129
+ } else {
14130
+ _tab.setAttribute('style', unselectedStyle);
14091
14131
  }
14092
14132
  }
14093
14133
  }
@@ -15172,7 +15212,7 @@ function slice(s, suffix) {
15172
15212
 
15173
15213
  function getWellKnownLabel(thing) {
15174
15214
  return _solidLogic.store.any(thing, UI.ns.ui('label')) || // Prioritize ui:label
15175
- _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label'));
15215
+ _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2004/02/skos/core#prefLabel'));
15176
15216
  }
15177
15217
  //# sourceMappingURL=label.js.map
15178
15218
 
@@ -15192,11 +15232,11 @@ Object.defineProperty(exports, "__esModule", ({
15192
15232
  }));
15193
15233
  exports.versionInfo = void 0;
15194
15234
  var versionInfo = {
15195
- buildTime: '2022-05-06T08:22:56Z',
15196
- commit: 'c53976d9e349c3c62b821b299db954596a873344',
15235
+ buildTime: '2022-06-14T10:03:16Z',
15236
+ commit: 'c7419dece1f50b42cf9d14ee36b13cdbbf0b8ffd',
15197
15237
  npmInfo: {
15198
15238
  'solid-ui': '2.4.22',
15199
- npm: '6.14.16',
15239
+ npm: '6.14.17',
15200
15240
  ares: '1.18.1',
15201
15241
  brotli: '1.0.9',
15202
15242
  cldr: '40.0',
@@ -15205,12 +15245,12 @@ var versionInfo = {
15205
15245
  modules: '83',
15206
15246
  napi: '8',
15207
15247
  nghttp2: '1.42.0',
15208
- node: '14.19.1',
15209
- openssl: '1.1.1n',
15248
+ node: '14.19.3',
15249
+ openssl: '1.1.1o',
15210
15250
  tz: '2021a3',
15211
15251
  unicode: '14.0',
15212
15252
  uv: '1.42.0',
15213
- v8: '8.4.371.23-node.85',
15253
+ v8: '8.4.371.23-node.87',
15214
15254
  zlib: '1.2.11'
15215
15255
  }
15216
15256
  };
@@ -16280,6 +16320,7 @@ function openHrefInOutlineMode(e) {
16280
16320
 
16281
16321
  if (dom.outlineManager) {
16282
16322
  // @@ TODO Remove the use of document as a global object
16323
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16283
16324
  ;
16284
16325
  dom.outlineManager.GotoSubject(_solidLogic.store.sym(uri), true, undefined, true, undefined);
16285
16326
  } else if (window && window.panes && window.panes.getOutliner) {
@@ -16407,6 +16448,7 @@ function linkButton(dom, object) {
16407
16448
  b.textContent = 'Goto ' + utils.label(object);
16408
16449
  b.addEventListener('click', function (_event) {
16409
16450
  // b.parentNode.removeChild(b)
16451
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16410
16452
  ;
16411
16453
  dom.outlineManager.GotoSubject(object, true, undefined, true, undefined);
16412
16454
  }, true);
@@ -17047,7 +17089,7 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
17047
17089
  /*!******************************!*\
17048
17090
  !*** ./lib/widgets/error.js ***!
17049
17091
  \******************************/
17050
- /***/ ((__unused_webpack_module, exports) => {
17092
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
17051
17093
 
17052
17094
  "use strict";
17053
17095
 
@@ -17057,6 +17099,8 @@ Object.defineProperty(exports, "__esModule", ({
17057
17099
  }));
17058
17100
  exports.errorMessageBlock = errorMessageBlock;
17059
17101
 
17102
+ var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
17103
+
17060
17104
  /**
17061
17105
  * Create an error message block
17062
17106
  * @param dom The DOM on which dom.createElement will be called
@@ -17087,6 +17131,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
17087
17131
  div.textContent = err;
17088
17132
  }
17089
17133
 
17134
+ div.appendChild((0, _widgets.cancelButton)(dom, function () {
17135
+ if (div.parentNode) div.parentNode.removeChild(div);
17136
+ })).style = 'width: 2em; height: 2em; align: right;';
17090
17137
  div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
17091
17138
  return div;
17092
17139
  }
@@ -17125,6 +17172,12 @@ Object.defineProperty(exports, "field", ({
17125
17172
  return _fieldFunction.field;
17126
17173
  }
17127
17174
  }));
17175
+ Object.defineProperty(exports, "fieldFunction", ({
17176
+ enumerable: true,
17177
+ get: function get() {
17178
+ return _fieldFunction.fieldFunction;
17179
+ }
17180
+ }));
17128
17181
  Object.defineProperty(exports, "fieldLabel", ({
17129
17182
  enumerable: true,
17130
17183
  get: function get() {
@@ -17147,8 +17200,15 @@ exports.findClosest = findClosest;
17147
17200
  exports.formsFor = formsFor;
17148
17201
  exports.makeDescription = makeDescription;
17149
17202
  exports.makeSelectForCategory = makeSelectForCategory;
17203
+ exports.makeSelectForChoice = makeSelectForChoice;
17150
17204
  exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
17151
17205
  exports.makeSelectForOptions = makeSelectForOptions;
17206
+ Object.defineProperty(exports, "mostSpecificClassURI", ({
17207
+ enumerable: true,
17208
+ get: function get() {
17209
+ return _fieldFunction.mostSpecificClassURI;
17210
+ }
17211
+ }));
17152
17212
  exports.newButton = newButton;
17153
17213
  exports.newThing = newThing;
17154
17214
  exports.promptForNew = promptForNew;
@@ -17196,6 +17256,8 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
17196
17256
 
17197
17257
  var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
17198
17258
 
17259
+ var _multiSelect = __webpack_require__(/*! ./multiSelect */ "./lib/widgets/multiSelect.js");
17260
+
17199
17261
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
17200
17262
 
17201
17263
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -17258,14 +17320,16 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
17258
17320
  var ui = ns.ui;
17259
17321
  if (container) container.appendChild(box); // Prevent loops
17260
17322
 
17323
+ if (!form) return;
17261
17324
  var key = subject.toNT() + '|' + form.toNT();
17262
17325
 
17263
17326
  if (already[key]) {
17264
17327
  // been there done that
17265
- box.appendChild(dom.createTextNode('Group: see above ' + key));
17266
- var plist = [$rdf.st(subject, ns.owl('sameAs'), subject)]; // @@ need prev subject
17328
+ box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
17329
+ // const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
17330
+ // dom.outlineManager.appendPropertyTRs(box, plist)
17331
+ // dom.appendChild(plist)
17267
17332
 
17268
- dom.outlineManager.appendPropertyTRs(box, plist);
17269
17333
  return box;
17270
17334
  }
17271
17335
 
@@ -17366,47 +17430,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
17366
17430
  values = kb.each(subject, dependingOn);
17367
17431
  }
17368
17432
 
17369
- if (values.length === 0) {
17370
- box.appendChild((0, _error.errorMessageBlock)(dom, "Can't select subform as no value of: " + dependingOn));
17371
- } else {
17372
- for (var i = 0; i < cases.length; i++) {
17373
- var c = cases[i];
17374
- var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
17433
+ for (var i = 0; i < cases.length; i++) {
17434
+ var c = cases[i];
17435
+ var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
17375
17436
 
17376
- var match = false;
17437
+ var match = false;
17377
17438
 
17378
- for (var j = 0; j < tests.length; j++) {
17379
- var _iterator = _createForOfIteratorHelper(values),
17380
- _step;
17439
+ for (var j = 0; j < tests.length; j++) {
17440
+ var _iterator = _createForOfIteratorHelper(values),
17441
+ _step;
17381
17442
 
17382
- try {
17383
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
17384
- var value = _step.value;
17385
- var test = tests[j];
17443
+ try {
17444
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
17445
+ var value = _step.value;
17446
+ var test = tests[j];
17386
17447
 
17387
- if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
17388
- match = true;
17389
- }
17448
+ if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
17449
+ match = true;
17390
17450
  }
17391
- } catch (err) {
17392
- _iterator.e(err);
17393
- } finally {
17394
- _iterator.f();
17395
17451
  }
17452
+ } catch (err) {
17453
+ _iterator.e(err);
17454
+ } finally {
17455
+ _iterator.f();
17396
17456
  }
17457
+ }
17397
17458
 
17398
- if (match) {
17399
- var _field3 = kb.the(c, ui('use'));
17400
-
17401
- if (!_field3) {
17402
- box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
17403
- return box;
17404
- } else {
17405
- appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
17406
- }
17459
+ if (match) {
17460
+ var _field3 = kb.the(c, ui('use'));
17407
17461
 
17408
- break;
17462
+ if (!_field3) {
17463
+ box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
17464
+ return box;
17465
+ } else {
17466
+ appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
17409
17467
  }
17468
+
17469
+ break;
17410
17470
  }
17411
17471
  } // @@ Add box.refresh() to sync fields with values
17412
17472
 
@@ -17694,7 +17754,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17694
17754
  // delete button and move buttons
17695
17755
 
17696
17756
  if (kb.updater.editable(dataDoc.uri)) {
17697
- buttons.deleteButtonWithCheck(dom, subField, utils.label(property), deleteThisItem);
17757
+ buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
17698
17758
 
17699
17759
  if (ordered) {
17700
17760
  // Add controsl in a frame
@@ -17745,7 +17805,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17745
17805
 
17746
17806
  var _shim = dom.createElement('div');
17747
17807
 
17748
- _shim.appendChild(subField); // Subfield has its own laytout
17808
+ _shim.appendChild(subField); // Subfield has its own layout
17749
17809
 
17750
17810
 
17751
17811
  frame.appendChild(_shim);
@@ -17794,6 +17854,8 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17794
17854
  return shim;
17795
17855
  }
17796
17856
 
17857
+ var multipleUIlabel = kb.any(form, ui('label'));
17858
+ if (!multipleUIlabel) multipleUIlabel = utils.label(property);
17797
17859
  var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
17798
17860
 
17799
17861
  min = min ? 0 + min.value : 0;
@@ -17834,10 +17896,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17834
17896
  img.setAttribute('src', plusIconURI); // plus sign
17835
17897
 
17836
17898
  img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
17837
- img.title = 'Click to add one or more ' + utils.predicateLabel(property, reverse);
17838
- var prompt = tail.appendChild(dom.createElement('span'));
17839
- prompt.textContent = (values.length === 0 ? 'Add one or more ' : 'Add more ') + utils.predicateLabel(property, reverse); // utils.label(property)
17840
-
17899
+ img.title = 'Click to add another ' + multipleUIlabel;
17900
+ var prompt = dom.createElement('span');
17901
+ prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
17841
17902
  tail.addEventListener('click', /*#__PURE__*/function () {
17842
17903
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
17843
17904
  return _regenerator["default"].wrap(function _callee5$(_context5) {
@@ -17859,6 +17920,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17859
17920
  return _ref3.apply(this, arguments);
17860
17921
  };
17861
17922
  }(), true);
17923
+ tail.appendChild(prompt);
17862
17924
  }
17863
17925
 
17864
17926
  function createListIfNecessary() {
@@ -18133,23 +18195,25 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
18133
18195
  ** -- radio buttons
18134
18196
  ** -- auto-complete typing
18135
18197
  **
18136
- ** Todo: Deal with multiple. Maybe merge with multiple code.
18198
+ ** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
18137
18199
  */
18138
18200
 
18139
18201
 
18140
18202
  _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
18141
18203
  var ui = ns.ui;
18142
18204
  var kb = _solidLogic.store;
18143
- var multiple = false;
18144
18205
  var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
18145
18206
 
18146
18207
  var p;
18147
- var box = dom.createElement('div'); // Set flexDirection column?
18208
+ var box = dom.createElement('div');
18209
+ box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
18148
18210
 
18149
18211
  if (container) container.appendChild(box);
18150
18212
  var lhs = dom.createElement('div');
18213
+ lhs.setAttribute('class', 'formFieldName choiceBox-label');
18151
18214
  box.appendChild(lhs);
18152
18215
  var rhs = dom.createElement('div');
18216
+ rhs.setAttribute('class', 'formFieldValue choiceBox-selectBox');
18153
18217
  box.appendChild(rhs);
18154
18218
  var property = kb.any(form, ui('property'));
18155
18219
 
@@ -18158,105 +18222,126 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18158
18222
  }
18159
18223
 
18160
18224
  lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
18161
- var from = kb.any(form, ui('from'));
18225
+ var uiFrom = kb.any(form, ui('from'));
18162
18226
 
18163
- if (!from) {
18227
+ if (!uiFrom) {
18164
18228
  return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
18165
18229
  }
18166
18230
 
18167
18231
  var subForm = kb.any(form, ui('use')); // Optional
18232
+ // const follow = kb.anyJS(form, ui('follow'), null, formDoc) // data doc moves to new subject?
18168
18233
 
18169
- var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
18170
-
18171
- var possible = [];
18172
- var possibleProperties;
18173
- var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
18174
18234
  var opts = {
18175
18235
  form: form,
18176
18236
  subForm: subForm,
18177
- multiple: multiple,
18178
- firstSelectOptionText: firstSelectOptionText,
18179
18237
  disambiguate: false
18180
18238
  };
18181
- possible = kb.each(undefined, ns.rdf('type'), from, formDoc);
18182
18239
 
18183
- for (var x in kb.findMembersNT(from)) {
18184
- possible.push(kb.fromNT(x));
18185
- } // Use rdfs
18240
+ function getSelectorOptions() {
18241
+ var possible = [];
18242
+ var possibleProperties;
18243
+ possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
18186
18244
 
18245
+ for (var x in kb.findMembersNT(uiFrom)) {
18246
+ possible.push(kb.fromNT(x));
18247
+ } // Use rdfs
18187
18248
 
18188
- if (from.sameTerm(ns.rdfs('Class'))) {
18189
- for (p in buttons.allClassURIs()) {
18190
- possible.push(kb.sym(p));
18191
- } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
18192
18249
 
18193
- } else if (from.sameTerm(ns.rdf('Property'))) {
18194
- possibleProperties = buttons.propertyTriage(kb);
18250
+ if (uiFrom.sameTerm(ns.rdfs('Class'))) {
18251
+ for (p in buttons.allClassURIs()) {
18252
+ possible.push(kb.sym(p));
18253
+ } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
18195
18254
 
18196
- for (p in possibleProperties.op) {
18197
- possible.push(kb.fromNT(p));
18198
- }
18255
+ } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
18256
+ possibleProperties = buttons.propertyTriage(kb);
18199
18257
 
18200
- for (p in possibleProperties.dp) {
18201
- possible.push(kb.fromNT(p));
18202
- }
18258
+ for (p in possibleProperties.op) {
18259
+ possible.push(kb.fromNT(p));
18260
+ }
18203
18261
 
18204
- opts.disambiguate = true; // This is a big class, and the labels won't be enough.
18205
- } else if (from.sameTerm(ns.owl('ObjectProperty'))) {
18206
- possibleProperties = buttons.propertyTriage(kb);
18262
+ for (p in possibleProperties.dp) {
18263
+ possible.push(kb.fromNT(p));
18264
+ }
18207
18265
 
18208
- for (p in possibleProperties.op) {
18209
- possible.push(kb.fromNT(p));
18210
- }
18266
+ opts.disambiguate = true; // This is a big class, and the labels won't be enough.
18267
+ } else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
18268
+ possibleProperties = buttons.propertyTriage(kb);
18269
+
18270
+ for (p in possibleProperties.op) {
18271
+ possible.push(kb.fromNT(p));
18272
+ }
18211
18273
 
18212
- opts.disambiguate = true;
18213
- } else if (from.sameTerm(ns.owl('DatatypeProperty'))) {
18214
- possibleProperties = buttons.propertyTriage(kb);
18274
+ opts.disambiguate = true;
18275
+ } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
18276
+ possibleProperties = buttons.propertyTriage(kb);
18215
18277
 
18216
- for (p in possibleProperties.dp) {
18217
- possible.push(kb.fromNT(p));
18278
+ for (p in possibleProperties.dp) {
18279
+ possible.push(kb.fromNT(p));
18280
+ }
18281
+
18282
+ opts.disambiguate = true;
18218
18283
  }
18219
18284
 
18220
- opts.disambiguate = true;
18221
- }
18285
+ return possible; // return sortByLabel(possible)
18286
+ } // TODO: this checks for any occurrence, regardless of true or false setting
18222
18287
 
18223
- var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
18224
18288
 
18225
18289
  if (kb.any(form, ui('canMintNew'))) {
18226
18290
  opts.mint = '* Create new *'; // @@ could be better
18227
18291
  }
18228
18292
 
18229
- var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, opts, dataDoc, callbackFunction);
18230
- rhs.appendChild(selector);
18231
- var object;
18293
+ var multiSelect = kb.any(form, ui('multiselect')); // Optional
18232
18294
 
18233
- if (selector.currentURI) {
18234
- object = $rdf.sym(selector.currentURI);
18235
- } else {
18236
- object = kb.any(subject, property);
18237
- }
18295
+ var selector;
18238
18296
 
18239
- if (object && subForm) {
18240
- removeNextSiblingsAfterElement(selector);
18241
- addSubFormDropDown(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
18242
- }
18297
+ rhs.refresh = function () {
18298
+ // from ui:property
18299
+ var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18300
+ return object.value;
18301
+ }); // from ui:from + ui:property
18243
18302
 
18244
- return box;
18245
- };
18246
- /**
18247
- * Removes all sibling elements after specified
18248
- * @param {HTMLElement} currentElement
18249
- * @private
18250
- */
18303
+ var possibleOptions = getSelectorOptions();
18304
+ possibleOptions.push(selectedOptions);
18305
+ possibleOptions = sortByLabel(possibleOptions);
18306
+ selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
18307
+ rhs.innerHTML = '';
18308
+ rhs.appendChild(selector);
18309
+
18310
+ if (multiSelect) {
18311
+ var multiSelectDiv = new _multiSelect.IconicMultiSelect({
18312
+ placeholder: selector.selected,
18313
+ select: selector,
18314
+ container: rhs,
18315
+ textField: 'textField',
18316
+ valueField: 'valueField'
18317
+ });
18318
+ multiSelectDiv.init();
18319
+ multiSelectDiv.subscribe(function (event) {
18320
+ if (event.action === 'REMOVE_OPTION') {
18321
+ selectedOptions = selectedOptions.filter(function (value) {
18322
+ return value !== event.value;
18323
+ });
18324
+ }
18251
18325
 
18326
+ if (event.action === 'CLEAR_ALL_OPTIONS') {
18327
+ selectedOptions = [];
18328
+ }
18252
18329
 
18253
- function removeNextSiblingsAfterElement(currentElement) {
18254
- while (currentElement.nextElementSibling) {
18255
- currentElement.nextElementSibling.remove();
18256
- }
18257
- }
18330
+ if (event.action === 'ADD_OPTION') {
18331
+ selectedOptions.push(event.value);
18332
+ }
18258
18333
 
18259
- function addSubFormDropDown(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
18334
+ selector.update(selectedOptions);
18335
+ });
18336
+ }
18337
+ };
18338
+
18339
+ rhs.refresh();
18340
+ if (selector && selector.refresh) selector.refresh();
18341
+ return box;
18342
+ };
18343
+
18344
+ function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
18260
18345
  (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
18261
18346
  } // Documentation - non-interactive fields
18262
18347
  //
@@ -18461,7 +18546,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
18461
18546
  b.setAttribute('type', 'button');
18462
18547
  b.setAttribute('style', 'float: right;');
18463
18548
  b.innerHTML = 'Goto ' + utils.label(theClass);
18464
- b.addEventListener('click', function (_e) {
18549
+ b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
18550
+ function (_e) {
18465
18551
  dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
18466
18552
  }, false);
18467
18553
  return box;
@@ -18596,10 +18682,8 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
18596
18682
  // @param subject - a term, the subject of the statement(s) being edited.
18597
18683
  // @param predicate - a term, the predicate of the statement(s) being edited
18598
18684
  // @param possible - a list of terms, the possible value the object can take
18599
- // @param options.multiple - Boolean - Whether more than one at a time is allowed
18600
- // @param options.firstSelectOptionText - a string to be displayed as the
18685
+ // @param options.nullLabel - a string to be displayed as the
18601
18686
  // option for none selected (for non multiple)
18602
- // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
18603
18687
  // @param options.subForm - If mint, then the form to be used for minting the new thing
18604
18688
  // @param dataDoc - The web document being edited
18605
18689
  // @param callbackFunction - takes (boolean ok, string errorBody)
@@ -18623,7 +18707,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18623
18707
  } // uris is now the set of possible options
18624
18708
 
18625
18709
 
18626
- if (n === 0 && !options.mint) {
18710
+ if (n === 0) {
18627
18711
  return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
18628
18712
  }
18629
18713
 
@@ -18660,17 +18744,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18660
18744
  }
18661
18745
  };
18662
18746
 
18663
- var newObject;
18664
-
18665
18747
  for (var _i = 0; _i < select.options.length; _i++) {
18666
18748
  var opt = select.options[_i];
18667
-
18668
- if (opt.selected && opt.AJAR_mint) {
18669
- newObject = newThing(dataDoc);
18670
- removeNextSiblingsAfterElement(select);
18671
- addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(newObject), options.subForm, dataDoc, callbackFunction);
18672
- }
18673
-
18674
18749
  if (!opt.AJAR_uri) continue; // a prompt or mint
18675
18750
 
18676
18751
  if (opt.selected && !(opt.AJAR_uri in actual)) {
@@ -18678,6 +18753,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18678
18753
  is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
18679
18754
  }
18680
18755
 
18756
+ if (!opt.selected && opt.AJAR_uri in actual) {
18757
+ // old class
18758
+ removeValue(kb.sym(opt.AJAR_uri));
18759
+ }
18760
+
18681
18761
  if (opt.selected) select.currentURI = opt.AJAR_uri;
18682
18762
  }
18683
18763
 
@@ -18695,25 +18775,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18695
18775
  sel = sel.superSelect;
18696
18776
  }
18697
18777
 
18698
- function doneNew(ok, _body) {
18699
- callbackFunction(ok, {
18700
- widget: 'select',
18701
- event: 'new'
18702
- });
18703
- }
18704
-
18705
18778
  log.info('selectForOptions: data doc = ' + dataDoc);
18706
- removeNextSiblingsAfterElement(select);
18707
- addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, callbackFunction);
18708
18779
  kb.updater.update(ds, is, function (uri, ok, body) {
18709
18780
  actual = getActual(); // refresh
18710
18781
 
18711
18782
  if (ok) {
18712
- if (newObject) {
18713
- removeNextSiblingsAfterElement(select);
18714
- addSubFormDropDown(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
18715
- }
18716
-
18717
18783
  select.disabled = false; // data written back
18718
18784
  } else {
18719
18785
  return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
@@ -18728,7 +18794,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18728
18794
 
18729
18795
  var select = dom.createElement('select');
18730
18796
  select.setAttribute('style', style.formSelectSTyle);
18731
- if (options.multiple) select.setAttribute('multiple', 'true');
18732
18797
  select.currentURI = null;
18733
18798
 
18734
18799
  select.refresh = function () {
@@ -18771,22 +18836,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18771
18836
  select.appendChild(option);
18772
18837
  }
18773
18838
 
18774
- if (editable && options.mint) {
18775
- var mint = dom.createElement('option');
18776
- mint.appendChild(dom.createTextNode(options.mint));
18777
- mint.AJAR_mint = true; // Flag it
18778
-
18779
- select.insertBefore(mint, select.firstChild);
18780
- }
18781
-
18782
- if (!select.currentURI && !options.multiple) {
18839
+ if (!select.currentURI) {
18783
18840
  var prompt = dom.createElement('option');
18784
- prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
18785
- prompt.selected = true;
18786
- prompt.disabled = true;
18787
- prompt.value = true;
18788
- prompt.hidden = true;
18841
+ prompt.appendChild(dom.createTextNode(options.nullLabel));
18789
18842
  select.insertBefore(prompt, select.firstChild);
18843
+ prompt.selected = true;
18790
18844
  }
18791
18845
 
18792
18846
  if (editable) {
@@ -18805,27 +18859,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18805
18859
  function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
18806
18860
  var du = kb.any(category, ns.owl('disjointUnionOf'));
18807
18861
  var subs;
18808
- var multiple = false;
18809
18862
 
18810
18863
  if (!du) {
18811
18864
  subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
18812
- multiple = true;
18813
18865
  } else {
18814
18866
  subs = du.elements;
18815
18867
  }
18816
18868
 
18817
18869
  log.debug('Select list length ' + subs.length);
18818
-
18819
- if (subs.length === 0) {
18820
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18821
- }
18822
-
18823
- if (subs.length === 1) {
18824
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18825
- }
18826
-
18827
18870
  return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
18828
- multiple: multiple
18871
+ nullLabel: '* Select type *'
18829
18872
  }, dataDoc, callbackFunction);
18830
18873
  }
18831
18874
  /** Make SELECT element to select subclasses recurively
@@ -18859,8 +18902,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
18859
18902
  function onChange(ok, body) {
18860
18903
  if (ok) update();
18861
18904
  callbackFunction(ok, body);
18862
- } // eslint-disable-next-line prefer-const
18863
-
18905
+ }
18864
18906
 
18865
18907
  var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
18866
18908
  container.appendChild(select);
@@ -19015,6 +19057,264 @@ function newThing(doc) {
19015
19057
  var now = new Date();
19016
19058
  return $rdf.sym(doc.uri + '#' + 'id' + ('' + now.getTime()));
19017
19059
  }
19060
+ /** Make SELECT element to select options
19061
+ //
19062
+ // @param subject - a term, the subject of the statement(s) being edited.
19063
+ // @param predicate - a term, the predicate of the statement(s) being edited
19064
+ // @param possible - a list of terms, the possible value the object can take
19065
+ // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
19066
+ // @param options.subForm - If mint, then the form to be used for minting the new thing
19067
+ // @param dataDoc - The web document being edited
19068
+ // @param callbackFunction - takes (boolean ok, string errorBody)
19069
+ */
19070
+
19071
+
19072
+ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossibleOptions, selectedOptions, uiFrom, options, dataDoc, callbackFunction) {
19073
+ var optionsFromClassUIfrom = {}; // Count them
19074
+
19075
+ var editable = kb.updater.editable(dataDoc.uri);
19076
+
19077
+ for (var i = 0; i < inputPossibleOptions.length; i++) {
19078
+ var sub = inputPossibleOptions[i]; // @@ Maybe; make this so it works with blank nodes too
19079
+ // if (!sub.uri) debug.warn(`makeSelectForChoice: option does not have an uri: ${sub}, with predicate: ${predicate}`)
19080
+
19081
+ if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
19082
+ optionsFromClassUIfrom[sub.uri] = true;
19083
+ }
19084
+
19085
+ var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
19086
+
19087
+ if (isEmpty && !options.mint) {
19088
+ return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
19089
+ }
19090
+
19091
+ log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
19092
+
19093
+ function createDefaultSelectOptionText() {
19094
+ var firstSelectOptionText = '--- choice ---';
19095
+
19096
+ if (predicate && !(predicate.termType === 'BlankNode')) {
19097
+ firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
19098
+ }
19099
+
19100
+ if (subject && !(subject.termType === 'BlankNode')) {
19101
+ firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
19102
+ }
19103
+
19104
+ return firstSelectOptionText;
19105
+ }
19106
+
19107
+ function createDefaultSelectOption() {
19108
+ var option = dom.createElement('option');
19109
+ option.appendChild(dom.createTextNode(createDefaultSelectOptionText()));
19110
+ option.disabled = true;
19111
+ option.value = true;
19112
+ option.hidden = true;
19113
+ option.selected = true;
19114
+ return option;
19115
+ }
19116
+
19117
+ var onChange = function onChange(_e) {
19118
+ container.removeChild(container.lastChild);
19119
+ select.refresh();
19120
+ };
19121
+
19122
+ var select = dom.createElement('select');
19123
+ select.setAttribute('style', style.formSelectSTyle);
19124
+ select.setAttribute('id', 'formSelect');
19125
+ select.currentURI = null;
19126
+
19127
+ for (var uri in optionsFromClassUIfrom) {
19128
+ select.appendChild(createOption(uri));
19129
+ }
19130
+
19131
+ if (editable && options.mint) {
19132
+ var mint = dom.createElement('option');
19133
+ mint.appendChild(dom.createTextNode(options.mint));
19134
+ mint.AJAR_mint = true; // Flag it
19135
+
19136
+ select.insertBefore(mint, select.firstChild);
19137
+ }
19138
+
19139
+ if (select.children.length === 0) select.insertBefore(createDefaultSelectOption(), select.firstChild);
19140
+
19141
+ select.update = function (newSelectedOptions) {
19142
+ selectedOptions = newSelectedOptions;
19143
+ var ds = [];
19144
+ var is = [];
19145
+
19146
+ var removeValue = function removeValue(t) {
19147
+ if (kb.holds(subject, predicate, t, dataDoc)) {
19148
+ ds.push($rdf.st(subject, predicate, t, dataDoc));
19149
+ }
19150
+ };
19151
+
19152
+ var addValue = function addValue(t) {
19153
+ if (!kb.holds(subject, predicate, t, dataDoc)) {
19154
+ is.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value added " + t)
19155
+ }
19156
+
19157
+ if (uiFrom && !kb.holds(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)) {
19158
+ is.push($rdf.st(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // console.log("----added type to value " + uiFrom)
19159
+ }
19160
+ };
19161
+
19162
+ var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
19163
+ return object.value;
19164
+ });
19165
+
19166
+ var _iterator2 = _createForOfIteratorHelper(existingValues),
19167
+ _step2;
19168
+
19169
+ try {
19170
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
19171
+ var value = _step2.value;
19172
+ if (!containsObject(value, selectedOptions)) removeValue($rdf.sym(value));
19173
+ }
19174
+ } catch (err) {
19175
+ _iterator2.e(err);
19176
+ } finally {
19177
+ _iterator2.f();
19178
+ }
19179
+
19180
+ var _iterator3 = _createForOfIteratorHelper(selectedOptions),
19181
+ _step3;
19182
+
19183
+ try {
19184
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
19185
+ var _value = _step3.value;
19186
+ if (!(_value in existingValues)) addValue($rdf.sym(_value));
19187
+ }
19188
+ } catch (err) {
19189
+ _iterator3.e(err);
19190
+ } finally {
19191
+ _iterator3.f();
19192
+ }
19193
+
19194
+ kb.updater.update(ds, is, function (uri, ok, body) {
19195
+ if (!ok) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
19196
+ select.refresh();
19197
+ if (callbackFunction) callbackFunction(ok, {
19198
+ widget: 'select',
19199
+ event: 'change'
19200
+ });
19201
+ });
19202
+ };
19203
+
19204
+ select.refresh = function () {
19205
+ select.disabled = true; // unlocked any conflict we had got into
19206
+
19207
+ var is = [];
19208
+ var newObject;
19209
+
19210
+ for (var _i3 = 0; _i3 < select.options.length; _i3++) {
19211
+ var opt = select.options[_i3];
19212
+
19213
+ if (opt.selected && opt.AJAR_mint) {
19214
+ // not sure if this 'if' is used because I cannot find mintClass
19215
+ if (options.mintClass) {
19216
+ var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
19217
+ if (!ok) {
19218
+ callbackFunction(ok, body, {
19219
+ change: 'new'
19220
+ }); // @@ if ok, need some form of refresh of the select for the new thing
19221
+ }
19222
+ });
19223
+ select.parentNode.appendChild(thisForm);
19224
+ newObject = thisForm.AJAR_subject;
19225
+ } else {
19226
+ newObject = newThing(dataDoc);
19227
+ }
19228
+
19229
+ is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
19230
+ if (uiFrom) is.push($rdf.st(newObject, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
19231
+
19232
+ if (options.mintStatementsFun) {
19233
+ is = is.concat(options.mintStatementsFun(newObject));
19234
+ }
19235
+
19236
+ select.currentURI = newObject;
19237
+ }
19238
+
19239
+ if (!opt.AJAR_uri) continue; // a prompt or mint
19240
+
19241
+ if (opt.selected && containsObject(opt.AJAR_uri, selectedOptions)) {
19242
+ select.currentURI = opt.AJAR_uri;
19243
+ }
19244
+
19245
+ if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.removeAttribute('selected');
19246
+ if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
19247
+ }
19248
+
19249
+ log.info('selectForOptions: data doc = ' + dataDoc);
19250
+
19251
+ if (select.currentURI && options.subForm) {
19252
+ addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
19253
+ if (ok) {
19254
+ kb.updater.update([], is, function (uri, success, errorBody) {
19255
+ if (!success) container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
19256
+ });
19257
+ if (callbackFunction) callbackFunction(ok, {
19258
+ widget: 'select',
19259
+ event: 'new'
19260
+ });
19261
+ } else {
19262
+ container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
19263
+ }
19264
+ });
19265
+ }
19266
+
19267
+ select.disabled = false;
19268
+ };
19269
+
19270
+ function createOption(uri) {
19271
+ var option = dom.createElement('option');
19272
+ var c = kb.sym(uri);
19273
+ var label;
19274
+
19275
+ if (options.disambiguate) {
19276
+ label = utils.labelWithOntology(c, true); // Init. cap
19277
+ } else {
19278
+ label = utils.label(c, true);
19279
+ }
19280
+
19281
+ option.appendChild(dom.createTextNode(label)); // Init.
19282
+
19283
+ option.setAttribute('value', uri);
19284
+ var backgroundColor = kb.any(c, kb.sym('http://www.w3.org/ns/ui#backgroundColor'));
19285
+
19286
+ if (backgroundColor) {
19287
+ option.setAttribute('style', 'background-color: ' + backgroundColor.value + '; ');
19288
+ }
19289
+
19290
+ option.AJAR_uri = uri;
19291
+
19292
+ if (containsObject(c.value, selectedOptions)) {
19293
+ option.setAttribute('selected', 'true');
19294
+ }
19295
+
19296
+ return option;
19297
+ }
19298
+
19299
+ if (editable) {
19300
+ select.addEventListener('change', onChange, false);
19301
+ }
19302
+
19303
+ return select;
19304
+ } // makeSelectForChoice
19305
+
19306
+
19307
+ function containsObject(obj, list) {
19308
+ var i;
19309
+
19310
+ for (i = 0; i < list.length; i++) {
19311
+ if (list[i] === obj) {
19312
+ return true;
19313
+ }
19314
+ }
19315
+
19316
+ return false;
19317
+ }
19018
19318
  //# sourceMappingURL=forms.js.map
19019
19319
 
19020
19320
  /***/ }),
@@ -21989,6 +22289,800 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21989
22289
 
21990
22290
  /***/ }),
21991
22291
 
22292
+ /***/ "./lib/widgets/multiSelect.js":
22293
+ /*!************************************!*\
22294
+ !*** ./lib/widgets/multiSelect.js ***!
22295
+ \************************************/
22296
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
22297
+
22298
+ "use strict";
22299
+
22300
+
22301
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
22302
+
22303
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
22304
+
22305
+ Object.defineProperty(exports, "__esModule", ({
22306
+ value: true
22307
+ }));
22308
+ exports.IconicMultiSelect = void 0;
22309
+
22310
+ var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
22311
+
22312
+ var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
22313
+
22314
+ var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
22315
+
22316
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
22317
+
22318
+ var style = _interopRequireWildcard(__webpack_require__(/*! ../style_multiSelect */ "./lib/style_multiSelect.js"));
22319
+
22320
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22321
+
22322
+ 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; }
22323
+
22324
+ /*
22325
+ * IconicMultiSelect v0.7.0
22326
+ * Licence: MIT
22327
+ * (c) 2021 Sidney Wimart.
22328
+ * repo & configuration: https://github.com/sidneywm/iconic-multiselect
22329
+ */
22330
+
22331
+ /**
22332
+ * @version IconicMultiSelect v0.7.0
22333
+ * @licence MIT
22334
+ */
22335
+ var IconicMultiSelect = /*#__PURE__*/function () {
22336
+ /**
22337
+ * Iconic Multiselect constructor.
22338
+ * @param { Object[] } data - Array of objects.
22339
+ * @param { string } noData - Defines the message when there is no data input.
22340
+ * @param { string } noResults - Defines the message when there is no result if options are filtered.
22341
+ * @param { string } placeholder - Defines the placeholder's text.
22342
+ * @param { string } select - DOM element to be selected. It must be a HTML Select tag - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
22343
+ * @param { string } textField - Field to select in the object for the text.
22344
+ * @param { string } valueField - Field to select in the object for the value.
22345
+ */
22346
+ function IconicMultiSelect(_ref) {
22347
+ var data = _ref.data,
22348
+ itemTemplate = _ref.itemTemplate,
22349
+ noData = _ref.noData,
22350
+ noResults = _ref.noResults,
22351
+ placeholder = _ref.placeholder,
22352
+ select = _ref.select,
22353
+ container = _ref.container,
22354
+ tagTemplate = _ref.tagTemplate,
22355
+ textField = _ref.textField,
22356
+ valueField = _ref.valueField;
22357
+ (0, _classCallCheck2["default"])(this, IconicMultiSelect);
22358
+ (0, _defineProperty2["default"])(this, "_data", void 0);
22359
+ (0, _defineProperty2["default"])(this, "_domElements", void 0);
22360
+ (0, _defineProperty2["default"])(this, "_event", function () {});
22361
+ (0, _defineProperty2["default"])(this, "_itemTemplate", void 0);
22362
+ (0, _defineProperty2["default"])(this, "_multiselect", void 0);
22363
+ (0, _defineProperty2["default"])(this, "_noData", void 0);
22364
+ (0, _defineProperty2["default"])(this, "_noResults", void 0);
22365
+ (0, _defineProperty2["default"])(this, "_options", []);
22366
+ (0, _defineProperty2["default"])(this, "_placeholder", void 0);
22367
+ (0, _defineProperty2["default"])(this, "_select", void 0);
22368
+ (0, _defineProperty2["default"])(this, "_selectContainer", void 0);
22369
+ (0, _defineProperty2["default"])(this, "_selectedOptions", []);
22370
+ (0, _defineProperty2["default"])(this, "_tagTemplate", void 0);
22371
+ (0, _defineProperty2["default"])(this, "_textField", void 0);
22372
+ (0, _defineProperty2["default"])(this, "_valueField", void 0);
22373
+ (0, _defineProperty2["default"])(this, "_cross", "\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z\"\n fill=\"currentColor\"\n />\n </svg>\n ");
22374
+ this._data = data !== null && data !== void 0 ? data : [];
22375
+ this._itemTemplate = itemTemplate !== null && itemTemplate !== void 0 ? itemTemplate : null;
22376
+ this._noData = noData !== null && noData !== void 0 ? noData : 'No data found.';
22377
+ this._noResults = noResults !== null && noResults !== void 0 ? noResults : 'No results found.';
22378
+ this._placeholder = placeholder !== null && placeholder !== void 0 ? placeholder : 'Select...';
22379
+ this._select = select; // Timea added a container here
22380
+
22381
+ this._selectContainer = container;
22382
+ this._tagTemplate = tagTemplate !== null && tagTemplate !== void 0 ? tagTemplate : null;
22383
+ this._textField = textField !== null && textField !== void 0 ? textField : null;
22384
+ this._valueField = valueField !== null && valueField !== void 0 ? valueField : null;
22385
+ }
22386
+ /**
22387
+ * Initialize the Iconic Multiselect component.
22388
+ * @public
22389
+ */
22390
+
22391
+
22392
+ (0, _createClass2["default"])(IconicMultiSelect, [{
22393
+ key: "init",
22394
+ value: function init() {
22395
+ // Timea change to use this._select instead of this._selectContainer
22396
+ if (this._select && this._select.nodeName === 'SELECT') {
22397
+ if (this._itemTemplate && this._data.length === 0) {
22398
+ throw new Error('itemTemplate must be initialized with data from the component settings');
22399
+ }
22400
+
22401
+ if (this._tagTemplate && this._data.length === 0) {
22402
+ throw new Error('tagTemplate must be initialized with data from the component settings');
22403
+ }
22404
+
22405
+ this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
22406
+
22407
+ this._renderMultiselect();
22408
+
22409
+ this._renderOptionsList();
22410
+
22411
+ this._domElements = {
22412
+ clear: this._multiselect.querySelector('.multiselect__clear-btn'),
22413
+ input: this._multiselect.querySelector('.multiselect__input'),
22414
+ optionsContainer: this._multiselect.querySelector('.multiselect__options'),
22415
+ optionsContainerList: this._multiselect.querySelector('.multiselect__options > ul'),
22416
+ options: {
22417
+ list: this._multiselect.querySelectorAll('.multiselect__options > ul > li'),
22418
+ find: function find(callbackFn) {
22419
+ for (var i = 0; i < this.list.length; i++) {
22420
+ var node = this.list[i];
22421
+ if (callbackFn(node)) return node;
22422
+ }
22423
+
22424
+ return undefined;
22425
+ },
22426
+ some: function some(callbackFn) {
22427
+ for (var i = 0; i < this.list.length; i++) {
22428
+ var node = this.list[i];
22429
+ if (callbackFn(node, i)) return true;
22430
+ }
22431
+
22432
+ return false;
22433
+ }
22434
+ }
22435
+ };
22436
+
22437
+ this._enableEventListenners();
22438
+
22439
+ this._initSelectedList();
22440
+ } else {
22441
+ throw new Error("The selector '".concat(this._select, "' did not select any valid select tag."));
22442
+ }
22443
+ }
22444
+ /**
22445
+ * Subscribes to the emitted events.
22446
+ * @param { Function } callback - Callback function which emits a custom event object.
22447
+ * @public
22448
+ */
22449
+
22450
+ }, {
22451
+ key: "subscribe",
22452
+ value: function subscribe(callback) {
22453
+ if (typeof callback === 'function') {
22454
+ this._event = callback;
22455
+ } else {
22456
+ throw new Error('parameter in the subscribe method is not a function');
22457
+ }
22458
+ }
22459
+ /**
22460
+ * Add an option to the selection list.
22461
+ * @param { Object: { text: string; value: string; }} option
22462
+ * @private
22463
+ */
22464
+
22465
+ }, {
22466
+ key: "_addOptionToList",
22467
+ value: function _addOptionToList(option, index) {
22468
+ var _this = this;
22469
+
22470
+ var html = "<span class=\"multiselect__selected\" style=\"".concat(style.multiselect__selected, "\" data-value=\"").concat(option.value, "\">").concat(this._tagTemplate ? this._processTemplate(this._tagTemplate, index) : option.text, "<span class=\"multiselect__remove-btn\" style=\"").concat(style.multiselect__remove_btn, "\">").concat(this._cross, "</span></span>");
22471
+
22472
+ this._domElements.input.insertAdjacentHTML('beforebegin', html);
22473
+
22474
+ var _this$_multiselect$qu = this._multiselect.querySelector("span[data-value=\"".concat(option.value, "\"]")),
22475
+ removeBtn = _this$_multiselect$qu.lastElementChild;
22476
+
22477
+ removeBtn.addEventListener('click', function () {
22478
+ var target = _this._domElements.options.find(function (el) {
22479
+ return el.dataset.value === option.value;
22480
+ });
22481
+
22482
+ _this._handleOption(target);
22483
+ });
22484
+ }
22485
+ /**
22486
+ * Clears all selected options.
22487
+ * @private
22488
+ */
22489
+
22490
+ }, {
22491
+ key: "_clearSelection",
22492
+ value: function _clearSelection() {
22493
+ var _this2 = this;
22494
+
22495
+ var _loop = function _loop(i) {
22496
+ var option = _this2._selectedOptions[i];
22497
+
22498
+ var target = _this2._domElements.options.find(function (el) {
22499
+ return el.dataset.value === option.value;
22500
+ });
22501
+
22502
+ target.classList.remove('multiselect__options--selected');
22503
+ target.setAttribute('style', style.multiselect__options);
22504
+
22505
+ _this2._removeOptionFromList(target.dataset.value);
22506
+ };
22507
+
22508
+ for (var i = 0; i < this._selectedOptions.length; i++) {
22509
+ _loop(i);
22510
+ }
22511
+
22512
+ this._selectedOptions = [];
22513
+
22514
+ this._handleClearSelectionBtn();
22515
+
22516
+ this._handlePlaceholder();
22517
+
22518
+ this._dispatchEvent({
22519
+ action: 'CLEAR_ALL_OPTIONS',
22520
+ selection: this._selectedOptions
22521
+ });
22522
+ }
22523
+ /**
22524
+ * Close the options container.
22525
+ * @private
22526
+ */
22527
+
22528
+ }, {
22529
+ key: "_closeList",
22530
+ value: function _closeList() {
22531
+ this._domElements.input.value = '';
22532
+
22533
+ this._domElements.optionsContainer.classList.remove('visible');
22534
+
22535
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
22536
+
22537
+ this._filterOptions('');
22538
+
22539
+ this._removeAllArrowSelected();
22540
+ }
22541
+ /**
22542
+ * Dispatches new events.
22543
+ * @param { object : { action: string; selection: { option: string; text: string; }[]; value?: string; } } event
22544
+ * @private
22545
+ */
22546
+
22547
+ }, {
22548
+ key: "_dispatchEvent",
22549
+ value: function _dispatchEvent(event) {
22550
+ this._event(event);
22551
+ }
22552
+ /**
22553
+ * Enables all main event listenners.
22554
+ * @private
22555
+ */
22556
+
22557
+ }, {
22558
+ key: "_enableEventListenners",
22559
+ value: function _enableEventListenners() {
22560
+ var _this3 = this;
22561
+
22562
+ document.addEventListener('mouseup', function (_ref2) {
22563
+ var target = _ref2.target;
22564
+
22565
+ if (!_this3._multiselect.contains(target)) {
22566
+ _this3._filterOptions('');
22567
+
22568
+ _this3._closeList();
22569
+
22570
+ _this3._handlePlaceholder();
22571
+ }
22572
+ });
22573
+
22574
+ this._domElements.clear.addEventListener('click', function () {
22575
+ _this3._clearSelection();
22576
+ });
22577
+
22578
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
22579
+ var option = this._domElements.options.list[i];
22580
+ option.addEventListener('click', function (_ref3) {
22581
+ var target = _ref3.target;
22582
+
22583
+ _this3._handleOption(target);
22584
+
22585
+ _this3._closeList();
22586
+ });
22587
+ }
22588
+
22589
+ this._domElements.input.addEventListener('focus', function () {
22590
+ _this3._domElements.optionsContainer.classList.add('visible');
22591
+
22592
+ _this3._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22593
+ });
22594
+
22595
+ this._domElements.input.addEventListener('input', function (_ref4) {
22596
+ var value = _ref4.target.value;
22597
+
22598
+ if (_this3._domElements.options.list.length > 0) {
22599
+ _this3._filterOptions(value);
22600
+ }
22601
+ });
22602
+
22603
+ this._domElements.input.addEventListener('keydown', function (e) {
22604
+ _this3._handleArrows(e);
22605
+
22606
+ _this3._handleBackspace(e);
22607
+
22608
+ _this3._handleEnter(e);
22609
+ });
22610
+ }
22611
+ /**
22612
+ * Filters user input.
22613
+ * @param { string } value
22614
+ * @private
22615
+ */
22616
+
22617
+ }, {
22618
+ key: "_filterOptions",
22619
+ value: function _filterOptions(value) {
22620
+ var _this4 = this;
22621
+
22622
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible');
22623
+
22624
+ var valueLowerCase = value.toLowerCase();
22625
+
22626
+ if (!isOpen && value.length > 0) {
22627
+ this._domElements.optionsContainer.classList.add('visible');
22628
+
22629
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22630
+ }
22631
+
22632
+ if (this._domElements.options.list.length > 0) {
22633
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
22634
+ var el = this._domElements.options.list[i];
22635
+ var text = this._itemTemplate ? this._data[i][this._textField] : el.textContent;
22636
+
22637
+ if (text.toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase) {
22638
+ this._domElements.optionsContainerList.appendChild(el);
22639
+ } else {
22640
+ el.parentNode && el.parentNode.removeChild(el);
22641
+ }
22642
+ }
22643
+
22644
+ var hasResults = this._domElements.options.some(function (el, index) {
22645
+ return (_this4._itemTemplate ? _this4._data[index][_this4._textField] : el.textContent).toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase;
22646
+ });
22647
+
22648
+ this._showNoResults(!hasResults);
22649
+ }
22650
+ }
22651
+ }, {
22652
+ key: "_generateId",
22653
+ value: function _generateId(length) {
22654
+ var result = '';
22655
+ var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
22656
+ var charactersLength = characters.length;
22657
+
22658
+ for (var i = 0; i < length; i++) {
22659
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
22660
+ }
22661
+
22662
+ return result;
22663
+ }
22664
+ /**
22665
+ * Gets data from select tag.
22666
+ * @private
22667
+ */
22668
+
22669
+ }, {
22670
+ key: "_getDataFromSelectTag",
22671
+ value: function _getDataFromSelectTag() {
22672
+ var arr = [];
22673
+ var options = this._select.options;
22674
+
22675
+ for (var i = 0; i < options.length; i++) {
22676
+ var item = options[i];
22677
+ arr.push({
22678
+ text: item.text,
22679
+ value: item.value,
22680
+ selected: item.hasAttribute('selected')
22681
+ });
22682
+ }
22683
+
22684
+ return arr;
22685
+ }
22686
+ /**
22687
+ * Gets data from settings.
22688
+ * @private
22689
+ */
22690
+
22691
+ }, {
22692
+ key: "_getDataFromSettings",
22693
+ value: function _getDataFromSettings() {
22694
+ if (this._data.length > 0 && this._valueField && this._textField) {
22695
+ var isValueFieldValid = typeof this._valueField === 'string';
22696
+ var isTextFieldValid = typeof this._textField === 'string';
22697
+ var arr = [];
22698
+
22699
+ if (!isValueFieldValid || !isTextFieldValid) {
22700
+ throw new Error('textField and valueField must be of type string');
22701
+ }
22702
+
22703
+ for (var i = 0; i < this._data.length; i++) {
22704
+ var item = this._data[i];
22705
+ arr.push({
22706
+ value: item[this._valueField],
22707
+ text: item[this._textField],
22708
+ selected: typeof item.selected === 'boolean' ? item.selected : false
22709
+ });
22710
+ }
22711
+
22712
+ return arr;
22713
+ } else {
22714
+ return null;
22715
+ }
22716
+ }
22717
+ /**
22718
+ * Handles Arrow up & Down. Selection of an option is also possible with these keys.
22719
+ * @param { Event } event
22720
+ * @private
22721
+ */
22722
+
22723
+ }, {
22724
+ key: "_handleArrows",
22725
+ value: function _handleArrows(event) {
22726
+ if (event.keyCode === 40 || event.keyCode === 38) {
22727
+ event.preventDefault();
22728
+
22729
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible'); // An updated view of the container is needed because of the filtering option
22730
+
22731
+
22732
+ var optionsContainerList = this._multiselect.querySelector('.multiselect__options > ul');
22733
+
22734
+ if (!isOpen) {
22735
+ this._domElements.optionsContainer.classList.add('visible');
22736
+
22737
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22738
+
22739
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
22740
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22741
+ optionsContainerList.firstElementChild.scrollIntoView(false);
22742
+ } else {
22743
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
22744
+
22745
+ var action = {
22746
+ ArrowUp: 'previous',
22747
+ Up: 'previous',
22748
+ ArrowDown: 'next',
22749
+ Down: 'next'
22750
+ };
22751
+
22752
+ if (!selected) {
22753
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
22754
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22755
+ optionsContainerList.firstElementChild.scrollIntoView(false);
22756
+ return;
22757
+ }
22758
+
22759
+ selected.classList.remove('arrow-selected');
22760
+ selected.setAttribute('style', style.multiselect__options_ul_li);
22761
+ selected = selected[action[event.key] + 'ElementSibling']; // Go to start or end of the popup list
22762
+
22763
+ if (!selected) {
22764
+ selected = optionsContainerList.children[action[event.key] === 'next' ? 0 : optionsContainerList.children.length - 1];
22765
+ selected.classList.add('arrow-selected');
22766
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22767
+
22768
+ this._scrollIntoView(optionsContainerList, selected);
22769
+
22770
+ return;
22771
+ }
22772
+
22773
+ selected.classList.add('arrow-selected');
22774
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22775
+
22776
+ this._scrollIntoView(optionsContainerList, selected);
22777
+ }
22778
+ }
22779
+ }
22780
+ /**
22781
+ * Handles the backspace key event - Deletes the preceding option in the selection list.
22782
+ * @param { Event } e
22783
+ * @private
22784
+ */
22785
+
22786
+ }, {
22787
+ key: "_handleBackspace",
22788
+ value: function _handleBackspace(e) {
22789
+ if (e.keyCode === 8 && e.target.value === '') {
22790
+ var lastSelectedOption = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
22791
+
22792
+ if (lastSelectedOption) {
22793
+ var targetLastSelectedOption = this._multiselect.querySelector("li[data-value=\"".concat(lastSelectedOption.value, "\"]"));
22794
+
22795
+ this._handleOption(targetLastSelectedOption);
22796
+
22797
+ if (this._selectedOptions.length === 0) {
22798
+ this._domElements.optionsContainer.classList.remove('visible');
22799
+
22800
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
22801
+ }
22802
+ }
22803
+ }
22804
+ }
22805
+ /**
22806
+ * Shows clear selection button if some options are selected.
22807
+ * @private
22808
+ */
22809
+
22810
+ }, {
22811
+ key: "_handleClearSelectionBtn",
22812
+ value: function _handleClearSelectionBtn() {
22813
+ if (this._selectedOptions.length > 0) {
22814
+ this._domElements.clear.style.display = 'flex';
22815
+ } else {
22816
+ this._domElements.clear.style.display = 'none';
22817
+ }
22818
+ }
22819
+ /**
22820
+ * Handles the enter key event.
22821
+ * @param { Event } event
22822
+ * @private
22823
+ */
22824
+
22825
+ }, {
22826
+ key: "_handleEnter",
22827
+ value: function _handleEnter(event) {
22828
+ if (event.keyCode === 13) {
22829
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
22830
+
22831
+ if (selected) {
22832
+ this._handleOption(selected);
22833
+
22834
+ this._closeList();
22835
+ }
22836
+ }
22837
+ }
22838
+ }, {
22839
+ key: "_handleOption",
22840
+ value: function _handleOption(target) {
22841
+ var dispatchEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22842
+
22843
+ // Remove
22844
+ for (var i = 0; i < this._selectedOptions.length; i++) {
22845
+ var el = this._selectedOptions[i];
22846
+
22847
+ if (el.value === target.dataset.value) {
22848
+ target.classList.remove('multiselect__options--selected');
22849
+ target.setAttribute('style', style.multiselect__options);
22850
+
22851
+ this._selectedOptions.splice(i, 1);
22852
+
22853
+ this._removeOptionFromList(target.dataset.value);
22854
+
22855
+ this._handleClearSelectionBtn();
22856
+
22857
+ this._handlePlaceholder();
22858
+
22859
+ return dispatchEvent && this._dispatchEvent({
22860
+ action: 'REMOVE_OPTION',
22861
+ value: target.dataset.value,
22862
+ selection: this._selectedOptions
22863
+ });
22864
+ }
22865
+ } // Add
22866
+
22867
+
22868
+ for (var _i = 0; _i < this._options.length; _i++) {
22869
+ var option = this._options[_i];
22870
+
22871
+ if (option.value === target.dataset.value) {
22872
+ target.classList.add('multiselect__options--selected');
22873
+ target.setAttribute('style', style.multiselect__options_selected);
22874
+ this._selectedOptions = [].concat((0, _toConsumableArray2["default"])(this._selectedOptions), [option]);
22875
+
22876
+ this._addOptionToList(option, _i);
22877
+
22878
+ this._handleClearSelectionBtn();
22879
+
22880
+ this._handlePlaceholder();
22881
+
22882
+ return dispatchEvent && this._dispatchEvent({
22883
+ action: 'ADD_OPTION',
22884
+ value: target.dataset.value,
22885
+ selection: this._selectedOptions
22886
+ });
22887
+ }
22888
+ }
22889
+ }
22890
+ /**
22891
+ * Shows the placeholder if no options are selected.
22892
+ * @private
22893
+ */
22894
+
22895
+ }, {
22896
+ key: "_handlePlaceholder",
22897
+ value: function _handlePlaceholder() {
22898
+ this._domElements.input.placeholder = this._placeholder;
22899
+ }
22900
+ }, {
22901
+ key: "_initSelectedList",
22902
+ value: function _initSelectedList() {
22903
+ var _this5 = this;
22904
+
22905
+ var hasItemsSelected = false;
22906
+
22907
+ var _loop2 = function _loop2(i) {
22908
+ var option = _this5._options[i];
22909
+
22910
+ if (option.selected) {
22911
+ hasItemsSelected = true;
22912
+
22913
+ var target = _this5._domElements.options.find(function (el) {
22914
+ return el.dataset.value === option.value;
22915
+ });
22916
+
22917
+ target.classList.add('multiselect__options--selected');
22918
+ target.setAttribute('style', style.multiselect__options_selected);
22919
+ _this5._selectedOptions = [].concat((0, _toConsumableArray2["default"])(_this5._selectedOptions), [option]);
22920
+
22921
+ _this5._addOptionToList(option, i);
22922
+ }
22923
+ };
22924
+
22925
+ for (var i = 0; i < this._options.length; i++) {
22926
+ _loop2(i);
22927
+ }
22928
+
22929
+ if (hasItemsSelected) {
22930
+ this._handleClearSelectionBtn();
22931
+ }
22932
+
22933
+ this._handlePlaceholder();
22934
+ }
22935
+ /**
22936
+ * Process the custom template.
22937
+ * @param { string } template
22938
+ * @private
22939
+ */
22940
+
22941
+ }, {
22942
+ key: "_processTemplate",
22943
+ value: function _processTemplate(template, index) {
22944
+ var processedTemplate = template;
22945
+ var objAttr = template.match(/\$\{(\w+)\}/g).map(function (e) {
22946
+ return e.replace(/\$\{|\}/g, '');
22947
+ });
22948
+
22949
+ for (var i = 0; i < objAttr.length; i++) {
22950
+ var _this$_data$index$att;
22951
+
22952
+ var attr = objAttr[i]; // eslint-disable-next-line no-useless-escape
22953
+
22954
+ processedTemplate = processedTemplate.replace("${".concat(attr, "}"), (_this$_data$index$att = this._data[index][attr]) !== null && _this$_data$index$att !== void 0 ? _this$_data$index$att : '');
22955
+ }
22956
+
22957
+ return processedTemplate;
22958
+ }
22959
+ }, {
22960
+ key: "_removeAllArrowSelected",
22961
+ value: function _removeAllArrowSelected() {
22962
+ var className = 'arrow-selected';
22963
+
22964
+ var target = this._domElements.options.find(function (el) {
22965
+ return el.classList.contains(className);
22966
+ });
22967
+
22968
+ target && target.classList.remove(className) && target.setAttribute('style', style.multiselect__options_ul_li);
22969
+ }
22970
+ /**
22971
+ * Removes an option from the list.
22972
+ * @param { string } value
22973
+ * @private
22974
+ */
22975
+
22976
+ }, {
22977
+ key: "_removeOptionFromList",
22978
+ value: function _removeOptionFromList(value) {
22979
+ var optionDom = this._multiselect.querySelector("span[data-value=\"".concat(value, "\"]"));
22980
+
22981
+ optionDom && optionDom.parentNode && optionDom.parentNode.removeChild(optionDom);
22982
+ }
22983
+ /**
22984
+ * Renders the multiselect options list view.
22985
+ * @private
22986
+ */
22987
+
22988
+ }, {
22989
+ key: "_renderOptionsList",
22990
+ value: function _renderOptionsList() {
22991
+ var _this6 = this;
22992
+
22993
+ var html = "\n <div class=\"multiselect__options\" style=\"".concat(style.multiselect__options, "\">\n <ul style=\"").concat(style.multiselect__options_ul, "\">\n ").concat(this._options.length > 0 && !this._itemTemplate ? this._options.map(function (option) {
22994
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(option.text, "</li>\n ");
22995
+ }).join('') : '', "\n\n ").concat(this._options.length > 0 && this._itemTemplate ? this._options.map(function (option, index) {
22996
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(_this6._processTemplate(_this6._itemTemplate, index), "</li>\n ");
22997
+ }).join('') : '', "\n ").concat(this._showNoData(this._options.length === 0), "\n </ul>\n </div>\n ");
22998
+
22999
+ this._multiselect.insertAdjacentHTML('beforeend', html);
23000
+ }
23001
+ /**
23002
+ * Renders the multiselect view.
23003
+ * @private
23004
+ */
23005
+
23006
+ }, {
23007
+ key: "_renderMultiselect",
23008
+ value: function _renderMultiselect() {
23009
+ this._select.style.display = 'none';
23010
+
23011
+ var id = 'iconic-' + this._generateId(20); // Timea created dedicated div element because previous code was not rendering
23012
+
23013
+
23014
+ this._multiselect = document.createElement('div');
23015
+
23016
+ this._multiselect.setAttribute('id', id);
23017
+
23018
+ this._multiselect.setAttribute('class', 'multiselect__container');
23019
+
23020
+ this._multiselect.setAttribute('style', style.multiselect__container);
23021
+
23022
+ var html = "\n <div class=\"multiselect__wrapper\" style=\"".concat(style.multiselect__wrapper, "\">\n <input class=\"multiselect__input\" style=\"").concat(style.multiselect__input, "\" placeholder=\"").concat(this._placeholder, "\" />\n </div>\n <span style=\"display: none;\" class=\"multiselect__clear-btn\" style=\"").concat(style.multiselect__clear_btn, "\">").concat(this._cross, "</span>\n ");
23023
+ this._multiselect.innerHTML = html;
23024
+
23025
+ this._selectContainer.appendChild(this._multiselect);
23026
+ }
23027
+ /**
23028
+ * ScrollIntoView - This small utility reproduces the behavior of .scrollIntoView({ block: "nearest", inline: "nearest" })
23029
+ * This is for IE compatibility without a need of a polyfill
23030
+ * @private
23031
+ */
23032
+
23033
+ }, {
23034
+ key: "_scrollIntoView",
23035
+ value: function _scrollIntoView(parent, child) {
23036
+ var rectParent = parent.getBoundingClientRect();
23037
+ var rectChild = child.getBoundingClientRect(); // Detect if not visible at top and then scroll to the top
23038
+
23039
+ if (!(rectParent.top < rectChild.bottom - child.offsetHeight)) {
23040
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight);
23041
+ } // Detect if not visible at bottom and then scroll to the bottom
23042
+
23043
+
23044
+ if (!(rectParent.bottom > rectChild.top + child.offsetHeight)) {
23045
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight) - (parent.offsetHeight - (child.offsetHeight + (child.offsetHeight - child.clientHeight)));
23046
+ }
23047
+ }
23048
+ /**
23049
+ * Shows a no data message.
23050
+ * @param { boolean } condition
23051
+ * @private
23052
+ */
23053
+
23054
+ }, {
23055
+ key: "_showNoData",
23056
+ value: function _showNoData(condition) {
23057
+ return condition ? "<p class=\"multiselect__options--no-data\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_data, "\">").concat(this._noData, "</p>") : '';
23058
+ }
23059
+ /**
23060
+ * Shows a no results message.
23061
+ * @param { boolean } condition
23062
+ * @private
23063
+ */
23064
+
23065
+ }, {
23066
+ key: "_showNoResults",
23067
+ value: function _showNoResults(condition) {
23068
+ var dom = this._multiselect.querySelector('.multiselect__options--no-results');
23069
+
23070
+ if (condition) {
23071
+ var html = "<p class=\"multiselect__options--no-results\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_results, "\">").concat(this._noResults, "</p>");
23072
+ !dom && this._domElements.optionsContainerList.insertAdjacentHTML('beforeend', html);
23073
+ } else {
23074
+ dom && dom.parentNode && dom.parentNode.removeChild(dom);
23075
+ }
23076
+ }
23077
+ }]);
23078
+ return IconicMultiSelect;
23079
+ }();
23080
+
23081
+ exports.IconicMultiSelect = IconicMultiSelect;
23082
+ //# sourceMappingURL=multiSelect.js.map
23083
+
23084
+ /***/ }),
23085
+
21992
23086
  /***/ "./lib/widgets/peoplePicker.js":
21993
23087
  /*!*************************************!*\
21994
23088
  !*** ./lib/widgets/peoplePicker.js ***!
@@ -22660,6 +23754,22 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
22660
23754
 
22661
23755
  /***/ }),
22662
23756
 
23757
+ /***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
23758
+ /*!******************************************************************!*\
23759
+ !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
23760
+ \******************************************************************/
23761
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23762
+
23763
+ var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
23764
+
23765
+ function _arrayWithoutHoles(arr) {
23766
+ if (Array.isArray(arr)) return arrayLikeToArray(arr);
23767
+ }
23768
+
23769
+ module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
23770
+
23771
+ /***/ }),
23772
+
22663
23773
  /***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
22664
23774
  /*!**********************************************************************!*\
22665
23775
  !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
@@ -22925,6 +24035,20 @@ module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, mo
22925
24035
 
22926
24036
  /***/ }),
22927
24037
 
24038
+ /***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
24039
+ /*!****************************************************************!*\
24040
+ !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
24041
+ \****************************************************************/
24042
+ /***/ ((module) => {
24043
+
24044
+ function _iterableToArray(iter) {
24045
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24046
+ }
24047
+
24048
+ module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
24049
+
24050
+ /***/ }),
24051
+
22928
24052
  /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
22929
24053
  /*!*********************************************************************!*\
22930
24054
  !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
@@ -22979,6 +24103,20 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
22979
24103
 
22980
24104
  /***/ }),
22981
24105
 
24106
+ /***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
24107
+ /*!******************************************************************!*\
24108
+ !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
24109
+ \******************************************************************/
24110
+ /***/ ((module) => {
24111
+
24112
+ function _nonIterableSpread() {
24113
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
24114
+ }
24115
+
24116
+ module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
24117
+
24118
+ /***/ }),
24119
+
22982
24120
  /***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
22983
24121
  /*!**************************************************************************!*\
22984
24122
  !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
@@ -23065,6 +24203,28 @@ module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, modul
23065
24203
 
23066
24204
  /***/ }),
23067
24205
 
24206
+ /***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
24207
+ /*!******************************************************************!*\
24208
+ !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
24209
+ \******************************************************************/
24210
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24211
+
24212
+ var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
24213
+
24214
+ var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/iterableToArray.js");
24215
+
24216
+ var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
24217
+
24218
+ var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js");
24219
+
24220
+ function _toConsumableArray(arr) {
24221
+ return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
24222
+ }
24223
+
24224
+ module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
24225
+
24226
+ /***/ }),
24227
+
23068
24228
  /***/ "./node_modules/@babel/runtime/helpers/typeof.js":
23069
24229
  /*!*******************************************************!*\
23070
24230
  !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
@@ -25762,31 +26922,6 @@ function freeze(object, oc) {
25762
26922
  return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
25763
26923
  }
25764
26924
 
25765
- /**
25766
- * Since we can not rely on `Object.assign` we provide a simplified version
25767
- * that is sufficient for our needs.
25768
- *
25769
- * @param {Object} target
25770
- * @param {Object | null | undefined} source
25771
- *
25772
- * @returns {Object} target
25773
- * @throws TypeError if target is not an object
25774
- *
25775
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
25776
- * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
25777
- */
25778
- function assign(target, source) {
25779
- if (target === null || typeof target !== 'object') {
25780
- throw new TypeError('target is not an object')
25781
- }
25782
- for (var key in source) {
25783
- if (Object.prototype.hasOwnProperty.call(source, key)) {
25784
- target[key] = source[key]
25785
- }
25786
- }
25787
- return target
25788
- }
25789
-
25790
26925
  /**
25791
26926
  * All mime types that are allowed as input to `DOMParser.parseFromString`
25792
26927
  *
@@ -25904,7 +27039,6 @@ var NAMESPACE = freeze({
25904
27039
  XMLNS: 'http://www.w3.org/2000/xmlns/',
25905
27040
  })
25906
27041
 
25907
- exports.assign = assign;
25908
27042
  exports.freeze = freeze;
25909
27043
  exports.MIME_TYPE = MIME_TYPE;
25910
27044
  exports.NAMESPACE = NAMESPACE;
@@ -27439,10 +28573,9 @@ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
27439
28573
  * are serialized as their entity references, so they will be preserved.
27440
28574
  * (In contrast to whitespace literals in the input which are normalized to spaces)
27441
28575
  * @see https://www.w3.org/TR/xml11/#AVNormalize
27442
- * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
27443
28576
  */
27444
28577
  function addSerializedAttribute(buf, qualifiedName, value) {
27445
- buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"')
28578
+ buf.push(' ', qualifiedName, '="', value.replace(/[<&"\t\n\r]/g, _xmlEncoder), '"')
27446
28579
  }
27447
28580
 
27448
28581
  function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
@@ -27587,10 +28720,10 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
27587
28720
  * and does not include the CDATA-section-close delimiter, `]]>`.
27588
28721
  *
27589
28722
  * @see https://www.w3.org/TR/xml/#NT-CharData
27590
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
27591
28723
  */
27592
28724
  return buf.push(node.data
27593
- .replace(/[<&>]/g,_xmlEncoder)
28725
+ .replace(/[<&]/g,_xmlEncoder)
28726
+ .replace(/]]>/g, ']]&gt;')
27594
28727
  );
27595
28728
  case CDATA_SECTION_NODE:
27596
28729
  return buf.push( '<![CDATA[',node.data,']]>');
@@ -44619,8 +45752,8 @@ class N3Parser {
44619
45752
  _saveContext(type, graph, subject, predicate, object) {
44620
45753
  const n3Mode = this._n3Mode;
44621
45754
  this._contextStack.push({
44622
- subject: subject, predicate: predicate, object: object,
44623
- graph: graph, type: type,
45755
+ type,
45756
+ subject, predicate, object, graph,
44624
45757
  inverse: n3Mode ? this._inversePredicate : false,
44625
45758
  blankPrefix: n3Mode ? this._prefixes._ : '',
44626
45759
  quantified: n3Mode ? this._quantified : null,
@@ -44639,14 +45772,20 @@ class N3Parser {
44639
45772
 
44640
45773
  // ### `_restoreContext` restores the parent context
44641
45774
  // when leaving a scope (list, blank node, formula)
44642
- _restoreContext() {
44643
- const context = this._contextStack.pop(), n3Mode = this._n3Mode;
45775
+ _restoreContext(type, token) {
45776
+ // Obtain the previous context
45777
+ const context = this._contextStack.pop();
45778
+ if (!context || context.type !== type)
45779
+ return this._error(`Unexpected ${token.type}`, token);
45780
+
45781
+ // Restore the quad of the previous context
44644
45782
  this._subject = context.subject;
44645
45783
  this._predicate = context.predicate;
44646
45784
  this._object = context.object;
44647
45785
  this._graph = context.graph;
44648
- // The settings below only apply to N3 streams
44649
- if (n3Mode) {
45786
+
45787
+ // Restore N3 context settings
45788
+ if (this._n3Mode) {
44650
45789
  this._inversePredicate = context.inverse;
44651
45790
  this._prefixes._ = context.blankPrefix;
44652
45791
  this._quantified = context.quantified;
@@ -44919,7 +46058,7 @@ class N3Parser {
44919
46058
 
44920
46059
  // Restore the parent context containing this blank node
44921
46060
  const empty = this._predicate === null;
44922
- this._restoreContext();
46061
+ this._restoreContext('blank', token);
44923
46062
  // If the blank node was the object, restore previous context and read punctuation
44924
46063
  if (this._object !== null)
44925
46064
  return this._getContextEndReader();
@@ -44970,7 +46109,7 @@ class N3Parser {
44970
46109
  break;
44971
46110
  case ')':
44972
46111
  // Closing the list; restore the parent context
44973
- this._restoreContext();
46112
+ this._restoreContext('list', token);
44974
46113
  // If this list is contained within a parent list, return the membership quad here.
44975
46114
  // This will be `<parent list element> rdf:first <this list>.`.
44976
46115
  if (stack.length !== 0 && stack[stack.length - 1].type === 'list')
@@ -45121,7 +46260,7 @@ class N3Parser {
45121
46260
  this._emit(this._subject, this._predicate, this._object, this._graph);
45122
46261
 
45123
46262
  // Restore the parent context containing this formula
45124
- this._restoreContext();
46263
+ this._restoreContext('formula', token);
45125
46264
  // If the formula was the subject, continue reading the predicate.
45126
46265
  // If the formula was the object, read punctuation.
45127
46266
  return this._object === null ? this._readPredicate : this._getContextEndReader();
@@ -45330,7 +46469,7 @@ class N3Parser {
45330
46469
  // The list item is the remaining subejct after reading the path
45331
46470
  const item = this._subject;
45332
46471
  // Switch back to the context of the list
45333
- this._restoreContext();
46472
+ this._restoreContext('item', token);
45334
46473
  // Output the list item
45335
46474
  this._emit(this._subject, this.RDF_FIRST, item, this._graph);
45336
46475
  }
@@ -45392,7 +46531,7 @@ class N3Parser {
45392
46531
  // Read the quad and restore the previous context
45393
46532
  const quad = this._quad(this._subject, this._predicate, this._object,
45394
46533
  this._graph || this.DEFAULTGRAPH);
45395
- this._restoreContext();
46534
+ this._restoreContext('<<', token);
45396
46535
  // If the triple was the subject, continue by reading the predicate.
45397
46536
  if (this._subject === null) {
45398
46537
  this._subject = quad;
@@ -65656,7 +66795,7 @@ var SolidAuthnLogic = /** @class */ (function () {
65656
66795
  if (app.viewingNoAuthPage) {
65657
66796
  return (0, rdflib_1.sym)(app.webId);
65658
66797
  }
65659
- if (this.session.info.webId && this.session.info.isLoggedIn) {
66798
+ if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
65660
66799
  return (0, rdflib_1.sym)(this.session.info.webId);
65661
66800
  }
65662
66801
  return (0, authUtil_1.offlineTestID)(); // null unless testing
@@ -66183,6 +67322,29 @@ exports.determineChatContainer = determineChatContainer;
66183
67322
 
66184
67323
  "use strict";
66185
67324
 
67325
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
67326
+ if (k2 === undefined) k2 = k;
67327
+ var desc = Object.getOwnPropertyDescriptor(m, k);
67328
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
67329
+ desc = { enumerable: true, get: function() { return m[k]; } };
67330
+ }
67331
+ Object.defineProperty(o, k2, desc);
67332
+ }) : (function(o, m, k, k2) {
67333
+ if (k2 === undefined) k2 = k;
67334
+ o[k2] = m[k];
67335
+ }));
67336
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
67337
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
67338
+ }) : function(o, v) {
67339
+ o["default"] = v;
67340
+ });
67341
+ var __importStar = (this && this.__importStar) || function (mod) {
67342
+ if (mod && mod.__esModule) return mod;
67343
+ var result = {};
67344
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
67345
+ __setModuleDefault(result, mod);
67346
+ return result;
67347
+ };
66186
67348
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
66187
67349
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66188
67350
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -66219,16 +67381,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
66219
67381
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66220
67382
  }
66221
67383
  };
67384
+ var __importDefault = (this && this.__importDefault) || function (mod) {
67385
+ return (mod && mod.__esModule) ? mod : { "default": mod };
67386
+ };
66222
67387
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66223
- exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = void 0;
67388
+ exports.deleteTypeIndexRegistration = exports.registerInstanceInTypeIndex = exports.getAppInstances = exports.getScopedAppInstances = exports.getScopedAppsFromIndex = exports.uniqueNodes = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.followOrCreateLink = exports.suggestPrivateTypeIndex = exports.suggestPublicTypeIndex = exports.suggestPreferencesFile = exports.loadOrCreateIfNotExists = void 0;
66224
67389
  var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js");
66225
- var ns = {
66226
- solid: (0, rdflib_1.Namespace)('http://www.w3.org/ns/solid/terms#'),
66227
- space: (0, rdflib_1.Namespace)('http://www.w3.org/ns/pim/space#')
66228
- };
67390
+ var $rdf = __importStar(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
67391
+ var solidLogicSingleton_1 = __webpack_require__(/*! ../logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
67392
+ var uri_1 = __webpack_require__(/*! ../util/uri */ "./node_modules/solid-logic/lib/util/uri.js");
67393
+ var solid_namespace_1 = __importDefault(__webpack_require__(/*! solid-namespace */ "./node_modules/solid-namespace/index.js"));
67394
+ var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
67395
+ var currentUser = authn.currentUser;
67396
+ var ns = (0, solid_namespace_1.default)($rdf);
67397
+ /**
67398
+ * Create a resource if it really does not exist
67399
+ * Be absolutely sure something does not exist before creating a new empty file
67400
+ * as otherwise existing could be deleted.
67401
+ * @param doc {NamedNode} - The resource
67402
+ */
67403
+ function loadOrCreateIfNotExists(store, doc) {
67404
+ return __awaiter(this, void 0, void 0, function () {
67405
+ var response, err_1, msg, msg;
67406
+ return __generator(this, function (_a) {
67407
+ switch (_a.label) {
67408
+ case 0:
67409
+ _a.trys.push([0, 2, , 3]);
67410
+ return [4 /*yield*/, store.fetcher.load(doc)];
67411
+ case 1:
67412
+ response = _a.sent();
67413
+ return [3 /*break*/, 3];
67414
+ case 2:
67415
+ err_1 = _a.sent();
67416
+ if (err_1.response.status === 404) {
67417
+ try {
67418
+ store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
67419
+ }
67420
+ catch (err) {
67421
+ msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
67422
+ throw new Error(msg);
67423
+ }
67424
+ delete store.fetcher.requested[doc.uri]; // delete cached 404 error
67425
+ }
67426
+ else {
67427
+ msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
67428
+ throw new Error(msg); // @@ add nested errors
67429
+ }
67430
+ return [3 /*break*/, 3];
67431
+ case 3: return [2 /*return*/, response];
67432
+ }
67433
+ });
67434
+ });
67435
+ }
67436
+ exports.loadOrCreateIfNotExists = loadOrCreateIfNotExists;
67437
+ function suggestPreferencesFile(me) {
67438
+ var stripped = me.uri.replace('/profile/', '/').replace('/public/', '/');
67439
+ // const stripped = me.uri.replace(\/[p|P]rofile/\g, '/').replace(\/[p|P]ublic/\g, '/')
67440
+ var folderURI = stripped.split('/').slice(0, -1).join('/') + '/Settings/';
67441
+ var fileURI = folderURI + 'Preferences.ttl';
67442
+ return (0, rdflib_1.sym)(fileURI);
67443
+ }
67444
+ exports.suggestPreferencesFile = suggestPreferencesFile;
67445
+ function suggestPublicTypeIndex(me) {
67446
+ var _a;
67447
+ return (0, rdflib_1.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
67448
+ }
67449
+ exports.suggestPublicTypeIndex = suggestPublicTypeIndex;
67450
+ // Note this one is based off the pref file not the profile
67451
+ function suggestPrivateTypeIndex(preferencesFile) {
67452
+ var _a;
67453
+ return (0, rdflib_1.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
67454
+ }
67455
+ exports.suggestPrivateTypeIndex = suggestPrivateTypeIndex;
67456
+ /* Follow link from this doc to another thing, or else make a new link
67457
+ **
67458
+ ** return: null no ld one and failed to make a new one
67459
+ */
67460
+ function followOrCreateLink(store, subject, predicate, object, doc) {
67461
+ return __awaiter(this, void 0, void 0, function () {
67462
+ var result, err_2, err_3;
67463
+ return __generator(this, function (_a) {
67464
+ switch (_a.label) {
67465
+ case 0: return [4 /*yield*/, store.fetcher.load(doc)];
67466
+ case 1:
67467
+ _a.sent();
67468
+ result = store.any(subject, predicate, null, doc);
67469
+ if (result)
67470
+ return [2 /*return*/, result];
67471
+ if (!store.updater.editable(doc)) {
67472
+ return [2 /*return*/, null];
67473
+ }
67474
+ _a.label = 2;
67475
+ case 2:
67476
+ _a.trys.push([2, 4, , 5]);
67477
+ return [4 /*yield*/, store.updater.update([], [(0, rdflib_1.st)(subject, predicate, object, doc)])];
67478
+ case 3:
67479
+ _a.sent();
67480
+ return [3 /*break*/, 5];
67481
+ case 4:
67482
+ err_2 = _a.sent();
67483
+ console.warn("followOrCreateLink: Error making link in ".concat(doc, " to ").concat(object, ": ").concat(err_2));
67484
+ return [2 /*return*/, null];
67485
+ case 5:
67486
+ _a.trys.push([5, 7, , 8]);
67487
+ return [4 /*yield*/, loadOrCreateIfNotExists(store, object)
67488
+ // store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
67489
+ ];
67490
+ case 6:
67491
+ _a.sent();
67492
+ return [3 /*break*/, 8];
67493
+ case 7:
67494
+ err_3 = _a.sent();
67495
+ console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
67496
+ return [3 /*break*/, 8];
67497
+ case 8: return [2 /*return*/, object];
67498
+ }
67499
+ });
67500
+ });
67501
+ }
67502
+ exports.followOrCreateLink = followOrCreateLink;
66229
67503
  function loadProfile(store, user) {
66230
67504
  return __awaiter(this, void 0, void 0, function () {
66231
- var err_1;
67505
+ var err_4;
66232
67506
  return __generator(this, function (_a) {
66233
67507
  switch (_a.label) {
66234
67508
  case 0:
@@ -66243,8 +67517,8 @@ function loadProfile(store, user) {
66243
67517
  _a.sent();
66244
67518
  return [3 /*break*/, 4];
66245
67519
  case 3:
66246
- err_1 = _a.sent();
66247
- throw new Error("Unable to load profile of user <".concat(user, ">: ").concat(err_1));
67520
+ err_4 = _a.sent();
67521
+ throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
66248
67522
  case 4: return [2 /*return*/, user.doc()];
66249
67523
  }
66250
67524
  });
@@ -66253,27 +67527,32 @@ function loadProfile(store, user) {
66253
67527
  exports.loadProfile = loadProfile;
66254
67528
  function loadPreferences(store, user) {
66255
67529
  return __awaiter(this, void 0, void 0, function () {
66256
- var profile, preferencesFile;
67530
+ var possiblePreferencesFile, preferencesFile, message, err_5;
66257
67531
  return __generator(this, function (_a) {
66258
67532
  switch (_a.label) {
66259
67533
  case 0: return [4 /*yield*/, loadProfile(store, user)];
66260
67534
  case 1:
66261
- profile = _a.sent();
66262
- preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile);
67535
+ _a.sent();
67536
+ possiblePreferencesFile = suggestPreferencesFile(user);
67537
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
67538
+ case 2:
67539
+ preferencesFile = _a.sent();
66263
67540
  if (!preferencesFile) {
66264
- // throw new Error(`USer ${user} has no pointer in profile to preferences file.`)
67541
+ message = "User ".concat(user, " has no pointer in profile to preferences file.");
67542
+ console.warn(message);
66265
67543
  return [2 /*return*/, undefined];
66266
67544
  }
66267
- try {
66268
- store.fetcher.load(preferencesFile);
66269
- }
66270
- catch (err) { // Mabeb a permission propblem or origin problem
66271
- return [2 /*return*/, undefined
66272
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
66273
- ];
66274
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
66275
- }
66276
- return [2 /*return*/, preferencesFile];
67545
+ _a.label = 3;
67546
+ case 3:
67547
+ _a.trys.push([3, 5, , 6]);
67548
+ return [4 /*yield*/, store.fetcher.load(preferencesFile)];
67549
+ case 4:
67550
+ _a.sent();
67551
+ return [3 /*break*/, 6];
67552
+ case 5:
67553
+ err_5 = _a.sent();
67554
+ return [2 /*return*/, undefined];
67555
+ case 6: return [2 /*return*/, preferencesFile];
66277
67556
  }
66278
67557
  });
66279
67558
  });
@@ -66281,7 +67560,7 @@ function loadPreferences(store, user) {
66281
67560
  exports.loadPreferences = loadPreferences;
66282
67561
  function loadTypeIndexesFor(store, user) {
66283
67562
  return __awaiter(this, void 0, void 0, function () {
66284
- var profile, publicTypeIndex, _a, pub, preferencesFile, privateTypeIndexes, priv;
67563
+ var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_6, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_7;
66285
67564
  return __generator(this, function (_b) {
66286
67565
  switch (_b.label) {
66287
67566
  case 0:
@@ -66290,30 +67569,55 @@ function loadTypeIndexesFor(store, user) {
66290
67569
  return [4 /*yield*/, loadProfile(store, user)];
66291
67570
  case 1:
66292
67571
  profile = _b.sent();
66293
- publicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile);
66294
- if (!publicTypeIndex) return [3 /*break*/, 5];
66295
- _b.label = 2;
67572
+ suggestion = suggestPublicTypeIndex(user);
67573
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)];
66296
67574
  case 2:
66297
- _b.trys.push([2, 4, , 5]);
66298
- return [4 /*yield*/, store.fetcher.load(publicTypeIndex)];
67575
+ publicTypeIndex = _b.sent();
67576
+ publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
67577
+ _b.label = 3;
66299
67578
  case 3:
66300
- _b.sent();
66301
- return [3 /*break*/, 5];
67579
+ _b.trys.push([3, 5, , 6]);
67580
+ return [4 /*yield*/, loadPreferences(store, user)];
66302
67581
  case 4:
66303
- _a = _b.sent();
66304
- return [3 /*break*/, 5];
67582
+ preferencesFile = _b.sent();
67583
+ return [3 /*break*/, 6];
66305
67584
  case 5:
66306
- pub = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
66307
- return [4 /*yield*/, loadPreferences(store, user)];
67585
+ err_6 = _b.sent();
67586
+ preferencesFile = null;
67587
+ return [3 /*break*/, 6];
66308
67588
  case 6:
66309
- preferencesFile = _b.sent();
66310
- if (preferencesFile) { // watch out - can be in either as spec was not clear
66311
- privateTypeIndexes = store.each(user, ns.solid('privateTypeIndex'), undefined, preferencesFile)
66312
- .concat(store.each(user, ns.solid('privateTypeIndex'), undefined, profile));
66313
- priv = privateTypeIndexes.length > 0 ? [{ label: 'priSo @@@@@vate', index: privateTypeIndexes[0], agent: user }] : [];
66314
- return [2 /*return*/, pub.concat(priv)];
66315
- }
66316
- return [2 /*return*/, pub];
67589
+ if (!preferencesFile) return [3 /*break*/, 9];
67590
+ suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile);
67591
+ _a = store.any(user, ns.solid('privateTypeIndex'), undefined, profile);
67592
+ if (_a) return [3 /*break*/, 8];
67593
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile)];
67594
+ case 7:
67595
+ _a = (_b.sent());
67596
+ _b.label = 8;
67597
+ case 8:
67598
+ privateTypeIndex = _a;
67599
+ privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex, agent: user }] : [];
67600
+ return [3 /*break*/, 10];
67601
+ case 9:
67602
+ privateScopes = [];
67603
+ _b.label = 10;
67604
+ case 10:
67605
+ scopes = publicScopes.concat(privateScopes);
67606
+ if (scopes.length === 0)
67607
+ return [2 /*return*/, scopes];
67608
+ files = scopes.map(function (scope) { return scope.index; });
67609
+ _b.label = 11;
67610
+ case 11:
67611
+ _b.trys.push([11, 13, , 14]);
67612
+ return [4 /*yield*/, store.fetcher.load(files)];
67613
+ case 12:
67614
+ _b.sent();
67615
+ return [3 /*break*/, 14];
67616
+ case 13:
67617
+ err_7 = _b.sent();
67618
+ console.warn('Problems loading type index: ', err_7);
67619
+ return [3 /*break*/, 14];
67620
+ case 14: return [2 /*return*/, scopes];
66317
67621
  }
66318
67622
  });
66319
67623
  });
@@ -66321,44 +67625,30 @@ function loadTypeIndexesFor(store, user) {
66321
67625
  exports.loadTypeIndexesFor = loadTypeIndexesFor;
66322
67626
  function loadCommunityTypeIndexes(store, user) {
66323
67627
  return __awaiter(this, void 0, void 0, function () {
66324
- var preferencesFile, communities, communityTypeIndexesPromise, result1;
66325
- var _this = this;
66326
- return __generator(this, function (_a) {
66327
- switch (_a.label) {
67628
+ var preferencesFile, communities, result, _i, communities_1, org, _a, _b;
67629
+ return __generator(this, function (_c) {
67630
+ switch (_c.label) {
66328
67631
  case 0: return [4 /*yield*/, loadPreferences(store, user)];
66329
67632
  case 1:
66330
- preferencesFile = _a.sent();
66331
- if (preferencesFile) {
66332
- communities = store.each(user, ns.solid('community'), undefined, preferencesFile);
66333
- communityTypeIndexesPromise = communities.map(function (community) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
66334
- switch (_a.label) {
66335
- case 0: return [4 /*yield*/, loadTypeIndexesFor(store, community)];
66336
- case 1: return [2 /*return*/, _a.sent()];
66337
- }
66338
- }); }); });
66339
- result1 = Promise.all(communityTypeIndexesPromise);
66340
- // const result2 = Promise.all(result1)
66341
- // const flat = result2.flat()
66342
- return [2 /*return*/, result1
66343
- // const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
66344
- /*
66345
- let result = [] as TypeIndex[]
66346
- for(const community of communities) {
66347
- result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
66348
- }
66349
- */
66350
- // return communityTypeIndexesPromise.resolve()
66351
- ];
66352
- // const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
66353
- /*
66354
- let result = [] as TypeIndex[]
66355
- for(const community of communities) {
66356
- result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
66357
- }
66358
- */
66359
- // return communityTypeIndexesPromise.resolve()
66360
- }
66361
- return [2 /*return*/, []];
67633
+ preferencesFile = _c.sent();
67634
+ if (!preferencesFile) return [3 /*break*/, 6];
67635
+ communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
67636
+ result = [];
67637
+ _i = 0, communities_1 = communities;
67638
+ _c.label = 2;
67639
+ case 2:
67640
+ if (!(_i < communities_1.length)) return [3 /*break*/, 5];
67641
+ org = communities_1[_i];
67642
+ _b = (_a = result).concat;
67643
+ return [4 /*yield*/, loadTypeIndexesFor(store, org)];
67644
+ case 3:
67645
+ result = _b.apply(_a, [_c.sent()]);
67646
+ _c.label = 4;
67647
+ case 4:
67648
+ _i++;
67649
+ return [3 /*break*/, 2];
67650
+ case 5: return [2 /*return*/, result];
67651
+ case 6: return [2 /*return*/, []]; // No communities
66362
67652
  }
66363
67653
  });
66364
67654
  });
@@ -66379,11 +67669,159 @@ function loadAllTypeIndexes(store, user) {
66379
67669
  });
66380
67670
  }
66381
67671
  exports.loadAllTypeIndexes = loadAllTypeIndexes;
67672
+ // Utility: remove duplicates from Array of NamedNodes
67673
+ function uniqueNodes(arr) {
67674
+ var uris = arr.map(function (x) { return x.uri; });
67675
+ var set = new Set(uris);
67676
+ var uris2 = Array.from(set);
67677
+ var arr2 = uris2.map(function (u) { return new rdflib_1.NamedNode(u); });
67678
+ return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
67679
+ }
67680
+ exports.uniqueNodes = uniqueNodes;
67681
+ function getScopedAppsFromIndex(store, scope, theClass) {
67682
+ return __awaiter(this, void 0, void 0, function () {
67683
+ var index, registrations, relevant, directInstances, instances, instanceContainers, containers, i, cont, contents;
67684
+ return __generator(this, function (_a) {
67685
+ switch (_a.label) {
67686
+ case 0:
67687
+ index = scope.index;
67688
+ registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
67689
+ .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
67690
+ .map(function (st) { return st.subject; });
67691
+ relevant = theClass ? registrations.filter(function (reg) { return store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass); })
67692
+ : registrations;
67693
+ directInstances = relevant.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
67694
+ instances = uniqueNodes(directInstances);
67695
+ instanceContainers = relevant.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
67696
+ containers = uniqueNodes(instanceContainers);
67697
+ if (containers.length > 0) {
67698
+ console.log('@@ getScopedAppsFromIndex containers ', containers);
67699
+ }
67700
+ i = 0;
67701
+ _a.label = 1;
67702
+ case 1:
67703
+ if (!(i < containers.length)) return [3 /*break*/, 4];
67704
+ cont = containers[i];
67705
+ return [4 /*yield*/, store.fetcher.load(cont)];
67706
+ case 2:
67707
+ _a.sent();
67708
+ contents = store.each(cont, ns.ldp('contains'), null, cont);
67709
+ instances = instances.concat(contents);
67710
+ _a.label = 3;
67711
+ case 3:
67712
+ i++;
67713
+ return [3 /*break*/, 1];
67714
+ case 4: return [2 /*return*/, instances.map(function (instance) { return { instance: instance, scope: scope }; })];
67715
+ }
67716
+ });
67717
+ });
67718
+ }
67719
+ exports.getScopedAppsFromIndex = getScopedAppsFromIndex;
67720
+ function getScopedAppInstances(store, klass, user) {
67721
+ return __awaiter(this, void 0, void 0, function () {
67722
+ var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
67723
+ return __generator(this, function (_a) {
67724
+ switch (_a.label) {
67725
+ case 0: return [4 /*yield*/, loadAllTypeIndexes(store, user)];
67726
+ case 1:
67727
+ scopes = _a.sent();
67728
+ scopedApps = [];
67729
+ _i = 0, scopes_1 = scopes;
67730
+ _a.label = 2;
67731
+ case 2:
67732
+ if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
67733
+ scope = scopes_1[_i];
67734
+ return [4 /*yield*/, getScopedAppsFromIndex(store, scope, klass)];
67735
+ case 3:
67736
+ scopedApps0 = _a.sent();
67737
+ scopedApps = scopedApps.concat(scopedApps0);
67738
+ _a.label = 4;
67739
+ case 4:
67740
+ _i++;
67741
+ return [3 /*break*/, 2];
67742
+ case 5: return [2 /*return*/, scopedApps];
67743
+ }
67744
+ });
67745
+ });
67746
+ }
67747
+ exports.getScopedAppInstances = getScopedAppInstances;
67748
+ // This is the function signature which used to be in solid-ui/logic
67749
+ // Recommended to use getScopedAppInstances instead as it provides more information.
67750
+ //
67751
+ function getAppInstances(store, klass) {
67752
+ return __awaiter(this, void 0, void 0, function () {
67753
+ var user, scopedAppInstances;
67754
+ return __generator(this, function (_a) {
67755
+ switch (_a.label) {
67756
+ case 0:
67757
+ user = currentUser();
67758
+ if (!user)
67759
+ throw new Error('getAppInstances: Must be logged in to find apps.');
67760
+ return [4 /*yield*/, getScopedAppInstances(store, klass, user)];
67761
+ case 1:
67762
+ scopedAppInstances = _a.sent();
67763
+ return [2 /*return*/, scopedAppInstances.map(function (scoped) { return scoped.instance; })];
67764
+ }
67765
+ });
67766
+ });
67767
+ }
67768
+ exports.getAppInstances = getAppInstances;
66382
67769
  /*
66383
- export async function getAppInstances (store:LiveStore, klass: NamedNode) {
66384
-
67770
+ * Register a new app in a type index
67771
+ * used in chat in bookmark.js (solid-ui)
67772
+ * Returns the registration object if successful else null
67773
+ */
67774
+ function registerInstanceInTypeIndex(store, instance, index, theClass) {
67775
+ return __awaiter(this, void 0, void 0, function () {
67776
+ var registration, ins, err_8, msg;
67777
+ return __generator(this, function (_a) {
67778
+ switch (_a.label) {
67779
+ case 0:
67780
+ registration = (0, uri_1.newThing)(index);
67781
+ ins = [
67782
+ // See https://github.com/solid/solid/blob/main/proposals/data-discovery.md
67783
+ (0, rdflib_1.st)(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),
67784
+ (0, rdflib_1.st)(registration, ns.solid('forClass'), theClass, index),
67785
+ (0, rdflib_1.st)(registration, ns.solid('instance'), instance, index)
67786
+ ];
67787
+ _a.label = 1;
67788
+ case 1:
67789
+ _a.trys.push([1, 3, , 4]);
67790
+ return [4 /*yield*/, store.updater.update([], ins)];
67791
+ case 2:
67792
+ _a.sent();
67793
+ return [3 /*break*/, 4];
67794
+ case 3:
67795
+ err_8 = _a.sent();
67796
+ msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_8);
67797
+ console.warn(msg);
67798
+ return [2 /*return*/, null];
67799
+ case 4: return [2 /*return*/, registration];
67800
+ }
67801
+ });
67802
+ });
66385
67803
  }
66386
- */
67804
+ exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
67805
+ function deleteTypeIndexRegistration(store, item) {
67806
+ return __awaiter(this, void 0, void 0, function () {
67807
+ var reg, statements;
67808
+ return __generator(this, function (_a) {
67809
+ switch (_a.label) {
67810
+ case 0:
67811
+ reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index);
67812
+ if (!reg)
67813
+ throw new Error("deleteTypeIndexRegistration: No registration found for ".concat(item.instance));
67814
+ statements = store.statementsMatching(reg, null, null, item.scope.index);
67815
+ return [4 /*yield*/, store.updater.update(statements, [])];
67816
+ case 1:
67817
+ _a.sent();
67818
+ return [2 /*return*/];
67819
+ }
67820
+ });
67821
+ });
67822
+ }
67823
+ exports.deleteTypeIndexRegistration = deleteTypeIndexRegistration;
67824
+ // ENDS
66387
67825
  //# sourceMappingURL=discoveryLogic.js.map
66388
67826
 
66389
67827
  /***/ }),
@@ -66397,7 +67835,7 @@ export async function getAppInstances (store:LiveStore, klass: NamedNode) {
66397
67835
  "use strict";
66398
67836
 
66399
67837
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66400
- exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
67838
+ exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.uniqueNodes = exports.suggestPublicTypeIndex = exports.suggestPrivateTypeIndex = exports.suggestPreferencesFile = exports.registerInstanceInTypeIndex = exports.loadTypeIndexesFor = exports.loadProfile = exports.loadPreferences = exports.loadOrCreateIfNotExists = exports.loadCommunityTypeIndexes = exports.loadAllTypeIndexes = exports.getScopedAppsFromIndex = exports.getScopedAppInstances = exports.getAppInstances = exports.followOrCreateLink = exports.deleteTypeIndexRegistration = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
66401
67839
  // Make these variables directly accessible as it is what you need most of the time
66402
67840
  // This also makes these variable globaly accesible in mashlib
66403
67841
  var solidLogicSingleton_1 = __webpack_require__(/*! ./logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
@@ -66419,12 +67857,25 @@ Object.defineProperty(exports, "ensureTypeIndexes", ({ enumerable: true, get: fu
66419
67857
  Object.defineProperty(exports, "loadTypeIndexes", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } }));
66420
67858
  Object.defineProperty(exports, "registerInTypeIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } }));
66421
67859
  Object.defineProperty(exports, "loadIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } }));
67860
+ // Generate by
67861
+ // grep export src/discovery/discoveryLogic.ts | sed -e 's/export //g' | sed -e 's/async //g'| sed -e 's/function //g' | sed -e 's/ .*/,/g' | sort
66422
67862
  var discoveryLogic_1 = __webpack_require__(/*! ./discovery/discoveryLogic */ "./node_modules/solid-logic/lib/discovery/discoveryLogic.js");
66423
- Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
67863
+ Object.defineProperty(exports, "deleteTypeIndexRegistration", ({ enumerable: true, get: function () { return discoveryLogic_1.deleteTypeIndexRegistration; } }));
67864
+ Object.defineProperty(exports, "followOrCreateLink", ({ enumerable: true, get: function () { return discoveryLogic_1.followOrCreateLink; } }));
67865
+ Object.defineProperty(exports, "getAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getAppInstances; } }));
67866
+ Object.defineProperty(exports, "getScopedAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppInstances; } }));
67867
+ Object.defineProperty(exports, "getScopedAppsFromIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppsFromIndex; } }));
67868
+ Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67869
+ Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
67870
+ Object.defineProperty(exports, "loadOrCreateIfNotExists", ({ enumerable: true, get: function () { return discoveryLogic_1.loadOrCreateIfNotExists; } }));
66424
67871
  Object.defineProperty(exports, "loadPreferences", ({ enumerable: true, get: function () { return discoveryLogic_1.loadPreferences; } }));
67872
+ Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
66425
67873
  Object.defineProperty(exports, "loadTypeIndexesFor", ({ enumerable: true, get: function () { return discoveryLogic_1.loadTypeIndexesFor; } }));
66426
- Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
66427
- Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67874
+ Object.defineProperty(exports, "registerInstanceInTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.registerInstanceInTypeIndex; } }));
67875
+ Object.defineProperty(exports, "suggestPreferencesFile", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPreferencesFile; } }));
67876
+ Object.defineProperty(exports, "suggestPrivateTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPrivateTypeIndex; } }));
67877
+ Object.defineProperty(exports, "suggestPublicTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPublicTypeIndex; } }));
67878
+ Object.defineProperty(exports, "uniqueNodes", ({ enumerable: true, get: function () { return discoveryLogic_1.uniqueNodes; } }));
66428
67879
  var SolidLogic_1 = __webpack_require__(/*! ./logic/SolidLogic */ "./node_modules/solid-logic/lib/logic/SolidLogic.js");
66429
67880
  Object.defineProperty(exports, "SolidLogic", ({ enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } }));
66430
67881
  var authUtil_1 = __webpack_require__(/*! ./authn/authUtil */ "./node_modules/solid-logic/lib/authn/authUtil.js");
@@ -76913,9 +78364,8 @@ class LocalJWKSet {
76913
78364
  }
76914
78365
  async getKey(protectedHeader, token) {
76915
78366
  const { alg, kid } = { ...protectedHeader, ...token.header };
76916
- const kty = getKtyFromAlg(alg);
76917
78367
  const candidates = this._jwks.keys.filter((jwk) => {
76918
- let candidate = kty === jwk.kty;
78368
+ let candidate = jwk.kty === getKtyFromAlg(alg);
76919
78369
  if (candidate && typeof kid === 'string') {
76920
78370
  candidate = kid === jwk.kid;
76921
78371
  }
@@ -78132,15 +79582,21 @@ function lengthAndInput(input) {
78132
79582
  }
78133
79583
  async function concatKdf(secret, bits, value) {
78134
79584
  const iterations = Math.ceil((bits >> 3) / 32);
78135
- const res = new Uint8Array(iterations * 32);
78136
- for (let iter = 0; iter < iterations; iter++) {
79585
+ let res;
79586
+ for (let iter = 1; iter <= iterations; iter++) {
78137
79587
  const buf = new Uint8Array(4 + secret.length + value.length);
78138
- buf.set(uint32be(iter + 1));
79588
+ buf.set(uint32be(iter));
78139
79589
  buf.set(secret, 4);
78140
79590
  buf.set(value, 4 + secret.length);
78141
- res.set(await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf), iter * 32);
79591
+ if (!res) {
79592
+ res = await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf);
79593
+ }
79594
+ else {
79595
+ res = concat(res, await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf));
79596
+ }
78142
79597
  }
78143
- return res.slice(0, bits >> 3);
79598
+ res = res.slice(0, bits >> 3);
79599
+ return res;
78144
79600
  }
78145
79601
 
78146
79602
 
@@ -79355,12 +80811,9 @@ const encode = (input) => {
79355
80811
  return encodeBase64(input).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
79356
80812
  };
79357
80813
  const decodeBase64 = (encoded) => {
79358
- const binary = atob(encoded);
79359
- const bytes = new Uint8Array(binary.length);
79360
- for (let i = 0; i < binary.length; i++) {
79361
- bytes[i] = binary.charCodeAt(i);
79362
- }
79363
- return bytes;
80814
+ return new Uint8Array(atob(encoded)
80815
+ .split('')
80816
+ .map((c) => c.charCodeAt(0)));
79364
80817
  };
79365
80818
  const decode = (input) => {
79366
80819
  let encoded = input;