solid-ui 2.4.28-cd2c84aa → 2.4.28-dd1547e2
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/805.solid-ui.min.js +1 -1
- package/dist/805.solid-ui.min.js.map +1 -1
- package/dist/solid-ui.js +2225 -1498
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +1938 -1938
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +249 -65
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +129 -126
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +637 -423
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +332 -193
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +463 -277
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +299 -209
- package/lib/chat/thread.js.map +1 -1
- package/lib/header/index.js +5 -0
- package/lib/header/index.js.map +1 -1
- package/lib/log.js +5 -5
- package/lib/log.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +42 -15
- package/lib/login/login.js.map +1 -1
- package/lib/media/media-capture.d.ts +2 -2
- package/lib/media/media-capture.d.ts.map +1 -1
- package/lib/media/media-capture.js +15 -11
- package/lib/media/media-capture.js.map +1 -1
- package/lib/pad.d.ts +2 -2
- package/lib/pad.d.ts.map +1 -1
- package/lib/pad.js +42 -16
- package/lib/pad.js.map +1 -1
- package/lib/participation.d.ts +6 -6
- package/lib/participation.d.ts.map +1 -1
- package/lib/participation.js +25 -25
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/style.js +85 -93
- package/lib/style.js.map +1 -1
- package/lib/tabs.d.ts +125 -0
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +8 -15
- package/lib/tabs.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js +2 -0
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/utils/keyHelpers/accessData.d.ts +2 -2
- package/lib/utils/keyHelpers/accessData.d.ts.map +1 -1
- package/lib/utils/keyHelpers/accessData.js +60 -116
- package/lib/utils/keyHelpers/accessData.js.map +1 -1
- package/lib/utils/keyHelpers/otherHelpers.d.ts +3 -0
- package/lib/utils/keyHelpers/otherHelpers.d.ts.map +1 -0
- package/lib/utils/keyHelpers/otherHelpers.js +23 -0
- package/lib/utils/keyHelpers/otherHelpers.js.map +1 -0
- package/lib/versionInfo.js +4 -4
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.js +0 -2
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/dragAndDrop.js +19 -11
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +2 -9
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +9 -5
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +5 -0
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/basic.d.ts.map +1 -1
- package/lib/widgets/forms/basic.js +4 -5
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/fieldParams.js +2 -2
- package/lib/widgets/forms/fieldParams.js.map +1 -1
- package/lib/widgets/forms.js +12 -10
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/peoplePicker.js +11 -0
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/package.json +3 -2
- package/lib/styleConstants.js +0 -36
- package/lib/styleConstants.js.map +0 -1
package/lib/participation.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.manageParticipation = manageParticipation;
|
|
9
9
|
exports.participationObject = participationObject;
|
|
10
10
|
exports.recordParticipation = recordParticipation;
|
|
11
|
-
exports.
|
|
11
|
+
exports.renderPartipants = renderPartipants;
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
14
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -23,8 +23,6 @@ var ns = _interopRequireWildcard(require("./ns"));
|
|
|
23
23
|
var _widgets = require("./widgets");
|
|
24
24
|
var _utils = require("./utils");
|
|
25
25
|
var _pad = require("./pad");
|
|
26
|
-
var style = _interopRequireWildcard(require("./style"));
|
|
27
|
-
var _styleConstants = _interopRequireDefault(require("./styleConstants"));
|
|
28
26
|
var _solidLogic = require("solid-logic");
|
|
29
27
|
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); }
|
|
30
28
|
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; }
|
|
@@ -32,7 +30,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
32
30
|
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); }
|
|
33
31
|
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; }
|
|
34
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
35
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* Manage a UI for the particpation of a person in any thing
|
|
34
|
+
*/ // import { currentUser } from './authn/authn'
|
|
36
35
|
var ParticipationTableElement = /*#__PURE__*/function (_HTMLTableElement) {
|
|
37
36
|
(0, _inherits2["default"])(ParticipationTableElement, _HTMLTableElement);
|
|
38
37
|
var _super = _createSuper(ParticipationTableElement);
|
|
@@ -57,11 +56,11 @@ var store = _solidLogic.solidLogicSingleton.store;
|
|
|
57
56
|
* @param {NamedNode} unused1/document - the document to render (this argument is no longer used, but left in for backwards compatibility)
|
|
58
57
|
* @param {NamedNode} subject - the thing in which the participation is happening
|
|
59
58
|
* @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)
|
|
60
|
-
* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable
|
|
59
|
+
* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button
|
|
61
60
|
*/
|
|
62
|
-
function
|
|
63
|
-
table.setAttribute('style',
|
|
64
|
-
var
|
|
61
|
+
function renderPartipants(dom, table, unused1, subject, unused2, options) {
|
|
62
|
+
table.setAttribute('style', 'margin: 0.8em;');
|
|
63
|
+
var newRowForParticpation = function newRowForParticpation(parp) {
|
|
65
64
|
var person = store.any(parp, ns.wf('participant'));
|
|
66
65
|
var tr;
|
|
67
66
|
if (!person) {
|
|
@@ -69,14 +68,13 @@ function renderParticipants(dom, table, unused1, subject, unused2, options) {
|
|
|
69
68
|
tr.textContent = '???'; // Don't crash - invalid part'n entry
|
|
70
69
|
return tr;
|
|
71
70
|
}
|
|
72
|
-
var bg = store.anyValue(parp, ns.ui('backgroundColor')) ||
|
|
71
|
+
var bg = store.anyValue(parp, ns.ui('backgroundColor')) || 'white';
|
|
73
72
|
var block = dom.createElement('div');
|
|
74
|
-
block.setAttribute('style',
|
|
75
|
-
block.style.backgroundColor = bg;
|
|
73
|
+
block.setAttribute('style', 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' + bg);
|
|
76
74
|
tr = (0, _widgets.personTR)(dom, null, person, options);
|
|
77
75
|
table.appendChild(tr);
|
|
78
76
|
var td = dom.createElement('td');
|
|
79
|
-
td.setAttribute('style',
|
|
77
|
+
td.setAttribute('style', 'vertical-align: middle;');
|
|
80
78
|
td.appendChild(block);
|
|
81
79
|
tr.insertBefore(td, tr.firstChild);
|
|
82
80
|
return tr;
|
|
@@ -90,16 +88,16 @@ function renderParticipants(dom, table, unused1, subject, unused2, options) {
|
|
|
90
88
|
var participations = parps.map(function (p) {
|
|
91
89
|
return p[1];
|
|
92
90
|
});
|
|
93
|
-
(0, _utils.syncTableToArray)(table, participations,
|
|
91
|
+
(0, _utils.syncTableToArray)(table, participations, newRowForParticpation);
|
|
94
92
|
};
|
|
95
93
|
table.refresh = syncTable;
|
|
96
94
|
syncTable();
|
|
97
95
|
return table;
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
/** Record, or find old,
|
|
98
|
+
/** Record, or find old, Particpation object
|
|
101
99
|
*
|
|
102
|
-
* A
|
|
100
|
+
* A particpaption object is a place to record things specifically about
|
|
103
101
|
* subject and the user, such as preferences, start of membership, etc
|
|
104
102
|
* @param {NamedNode} subject - the thing in which the participation is happening
|
|
105
103
|
* @param {NamedNode} document - where to record the data
|
|
@@ -134,20 +132,20 @@ function participationObject(subject, padDoc, me) {
|
|
|
134
132
|
}
|
|
135
133
|
candidates.sort(); // Pick the earliest
|
|
136
134
|
// @@ Possibly, for extra credit, delete the others, if we have write access
|
|
137
|
-
debug.warn('Multiple
|
|
135
|
+
debug.warn('Multiple particpation objects, picking earliest, in ' + padDoc);
|
|
138
136
|
resolve(candidates[0][1]);
|
|
139
137
|
// throw new Error('Multiple records of your participation')
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
if (parps.length) {
|
|
143
141
|
// If I am not already recorded
|
|
144
|
-
resolve(parps[0]); // returns the
|
|
142
|
+
resolve(parps[0]); // returns the particpation object
|
|
145
143
|
} else {
|
|
146
144
|
var _participation2 = (0, _widgets.newThing)(padDoc);
|
|
147
145
|
var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), _participation2, padDoc), (0, _rdflib.st)(_participation2, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(_participation2, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(_participation2, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
|
|
148
146
|
store.updater.update([], ins, function (uri, ok, errorMessage) {
|
|
149
147
|
if (!ok) {
|
|
150
|
-
reject(new Error('Error recording your
|
|
148
|
+
reject(new Error('Error recording your partipation: ' + errorMessage));
|
|
151
149
|
} else {
|
|
152
150
|
resolve(_participation2);
|
|
153
151
|
}
|
|
@@ -160,7 +158,7 @@ function participationObject(subject, padDoc, me) {
|
|
|
160
158
|
/** Record my participation and display participants
|
|
161
159
|
*
|
|
162
160
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
163
|
-
* @param {NamedNode} padDoc - the document into which the
|
|
161
|
+
* @param {NamedNode} padDoc - the document into which the particpation should be recorded
|
|
164
162
|
* @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works
|
|
165
163
|
*
|
|
166
164
|
*/
|
|
@@ -176,22 +174,24 @@ function recordParticipation(subject, padDoc, refreshable) {
|
|
|
176
174
|
}
|
|
177
175
|
if (parps.length) {
|
|
178
176
|
// If I am not already recorded
|
|
179
|
-
return parps[0]; // returns the
|
|
177
|
+
return parps[0]; // returns the particpation object
|
|
180
178
|
} else {
|
|
181
179
|
if (!store.updater.editable(padDoc)) {
|
|
182
|
-
debug.log('Not recording participation, as no write
|
|
180
|
+
debug.log('Not recording participation, as no write acesss as ' + me + ' to ' + padDoc);
|
|
183
181
|
return null;
|
|
184
182
|
}
|
|
185
183
|
var participation = (0, _widgets.newThing)(padDoc);
|
|
186
184
|
var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), participation, padDoc), (0, _rdflib.st)(participation, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(participation, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(participation, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
|
|
187
185
|
store.updater.update([], ins, function (uri, ok, errorMessage) {
|
|
188
186
|
if (!ok) {
|
|
189
|
-
throw new Error('Error recording your
|
|
187
|
+
throw new Error('Error recording your partipation: ' + errorMessage);
|
|
190
188
|
}
|
|
191
189
|
if (refreshable && refreshable.refresh) {
|
|
192
190
|
refreshable.refresh();
|
|
193
191
|
}
|
|
192
|
+
// UI.pad.renderPartipants(dom, table, padDoc, subject, me, options)
|
|
194
193
|
});
|
|
194
|
+
|
|
195
195
|
return participation;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
@@ -200,7 +200,7 @@ function recordParticipation(subject, padDoc, refreshable) {
|
|
|
200
200
|
*
|
|
201
201
|
* @param {Document} dom - the web page loaded into the browser
|
|
202
202
|
* @param {HTMLDivElement} container - the container element where the participants should be displayed
|
|
203
|
-
* @param {NamedNode} document - the document into which the
|
|
203
|
+
* @param {NamedNode} document - the document into which the particpation should be shown
|
|
204
204
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
205
205
|
* @param {NamedNode} me - the logged in user
|
|
206
206
|
* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button
|
|
@@ -209,12 +209,12 @@ function recordParticipation(subject, padDoc, refreshable) {
|
|
|
209
209
|
function manageParticipation(dom, container, padDoc, subject, me, options) {
|
|
210
210
|
var table = dom.createElement('table');
|
|
211
211
|
container.appendChild(table);
|
|
212
|
-
|
|
212
|
+
renderPartipants(dom, table, padDoc, subject, me, options);
|
|
213
213
|
var _participation;
|
|
214
214
|
try {
|
|
215
215
|
_participation = recordParticipation(subject, padDoc, table);
|
|
216
216
|
} catch (e) {
|
|
217
|
-
container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your
|
|
217
|
+
container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your partipation: ' + e)); // Clean up?
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
return table;
|
package/lib/participation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participation.js","names":["debug","_interopRequireWildcard","require","_rdflib","ns","_widgets","_utils","_pad","style","_styleConstants","_interopRequireDefault","_solidLogic","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","toString","slice","constructor","name","from","test","arr","len","arr2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","valueOf","ParticipationTableElement","_HTMLTableElement","_inherits2","_super","_this","_classCallCheck2","_len","args","_key","concat","_defineProperty2","_assertThisInitialized2","_createClass2","_wrapNativeSuper2","HTMLTableElement","store","solidLogicSingleton","renderParticipants","dom","table","unused1","subject","unused2","options","setAttribute","participantsStyle","newRowForParticipation","parp","person","any","wf","tr","createElement","textContent","bg","anyValue","ui","styleConstants","participationDefaultBackground","block","participantsBlock","backgroundColor","personTR","appendChild","td","personTableTD","insertBefore","firstChild","syncTable","parps","each","map","log","cal","sort","participations","p","syncTableToArray","refresh","participationObject","padDoc","me","Promise","resolve","reject","Error","filter","pn","holds","candidates","_iterator","_step","participation","date","push","warn","newThing","ins","st","Date","lightColorHash","updater","update","uri","ok","errorMessage","recordParticipation","refreshable","authn","currentUser","editable","manageParticipation","container","_participation","errorMessageBlock"],"sources":["../src/participation.ts"],"sourcesContent":["/* Manage a UI for the participation of a person in any thing\n*/\n\n// import { currentUser } from './authn/authn'\nimport * as debug from './debug'\nimport { LiveStore, NamedNode, st, UpdateManager } from 'rdflib'\nimport * as ns from './ns'\nimport { personTR, newThing, errorMessageBlock } from './widgets'\nimport { syncTableToArray } from './utils'\nimport { lightColorHash } from './pad'\nimport { log } from './debug'\nimport * as style from './style'\nimport styleConstants from './styleConstants'\nimport { solidLogicSingleton, authn } from 'solid-logic'\n\ntype ParticipationOptions = {\n deleteFunction?: () => {}\n link?: string\n draggable?: boolean\n}\n\nclass ParticipationTableElement extends HTMLTableElement {\n refresh?: () => void\n}\nconst store = solidLogicSingleton.store as LiveStore\n\n/** Manage participation in this session\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLTableElement} table - the table element\n* @param {NamedNode} unused1/document - the document to render (this argument is no longer used, but left in for backwards compatibility)\n* @param {NamedNode} subject - the thing in which the participation is happening\n* @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable; these are used by the personTR button\n*/\nexport function renderParticipants (dom: HTMLDocument, table: ParticipationTableElement, unused1: NamedNode, subject: NamedNode, unused2: NamedNode, options: ParticipationOptions) {\n table.setAttribute('style', style.participantsStyle)\n\n const newRowForParticipation = function (parp) {\n const person = store.any(parp, ns.wf('participant'))\n\n let tr\n if (!person) {\n tr = dom.createElement('tr')\n tr.textContent = '???' // Don't crash - invalid part'n entry\n return tr\n }\n const bg = store.anyValue(parp, ns.ui('backgroundColor')) || styleConstants.participationDefaultBackground\n\n const block = dom.createElement('div')\n block.setAttribute(\n 'style', style.participantsBlock)\n block.style.backgroundColor = bg\n\n tr = personTR(dom, null, person, options)\n table.appendChild(tr)\n const td = dom.createElement('td')\n td.setAttribute('style', style.personTableTD)\n td.appendChild(block)\n tr.insertBefore(td, tr.firstChild)\n return tr\n }\n\n const syncTable = function () {\n const parps = store.each(subject, ns.wf('participation')).map(function (parp) {\n log('in participants')\n return [store.anyValue(parp as any, ns.cal('dtstart')) || '9999-12-31', parp]\n })\n parps.sort() // List in order of joining\n const participations = parps.map(function (p) {\n return p[1]\n })\n syncTableToArray(table, participations, newRowForParticipation)\n }\n table.refresh = syncTable\n syncTable()\n return table\n}\n\n/** Record, or find old, Participation object\n *\n * A participation object is a place to record things specifically about\n * subject and the user, such as preferences, start of membership, etc\n * @param {NamedNode} subject - the thing in which the participation is happening\n * @param {NamedNode} document - where to record the data\n * @param {NamedNode} me - the logged in user\n *\n */\nexport function participationObject (subject: NamedNode, padDoc: NamedNode, me: NamedNode) {\n return new Promise(function (resolve, reject) {\n if (!me) {\n throw new Error('No user id')\n }\n\n const parps = store.each(subject, ns.wf('participation')).filter(function (pn) {\n return store.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) { // This can happen. https://github.com/solidos/chat-pane/issues/71\n const candidates: (string | NamedNode) [][] = []\n for (const participation of parps) {\n const date = store.anyValue(participation as NamedNode, ns.cal('dtstart'))\n if (date) {\n candidates.push([date, participation as NamedNode])\n }\n }\n candidates.sort() // Pick the earliest\n // @@ Possibly, for extra credit, delete the others, if we have write access\n debug.warn('Multiple participation objects, picking earliest, in ' + padDoc)\n resolve(candidates[0][1])\n // throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n resolve(parps[0]) // returns the participation object\n } else {\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ];\n (store.updater as UpdateManager).update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n reject(new Error('Error recording your participation: ' + errorMessage))\n } else {\n resolve(participation)\n }\n })\n resolve(participation)\n }\n })\n}\n\n/** Record my participation and display participants\n *\n * @param {NamedNode} subject - the thing in which participation is happening\n * @param {NamedNode} padDoc - the document into which the participation should be recorded\n * @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works\n *\n */\nexport function recordParticipation (subject: NamedNode, padDoc: NamedNode, refreshable: any) {\n const me = authn.currentUser()\n if (!me) return // Not logged in\n\n const parps = store.each(subject, ns.wf('participation')).filter(function (pn) {\n return store.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) {\n throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n return parps[0] // returns the participation object\n } else {\n if (!(store.updater as UpdateManager).editable(padDoc)) {\n debug.log('Not recording participation, as no write access as ' + me + ' to ' + padDoc)\n return null\n }\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ];\n (store.updater as UpdateManager).update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n throw new Error('Error recording your participation: ' + errorMessage)\n }\n if (refreshable && refreshable.refresh) {\n refreshable.refresh()\n }\n })\n return participation\n }\n}\n\n/** Record my participation and display participants\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLDivElement} container - the container element where the participants should be displayed\n* @param {NamedNode} document - the document into which the participation should be shown\n* @param {NamedNode} subject - the thing in which participation is happening\n* @param {NamedNode} me - the logged in user\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*\n*/\nexport function manageParticipation (\n dom: Document,\n container: HTMLDivElement,\n padDoc: NamedNode,\n subject: NamedNode,\n me: NamedNode,\n options: ParticipationOptions\n) {\n const table = dom.createElement('table')\n container.appendChild(table)\n renderParticipants(dom, table, padDoc, subject, me, options)\n let _participation\n try {\n _participation = recordParticipation(subject, padDoc, table)\n } catch (e) {\n container.appendChild(\n errorMessageBlock(\n dom,\n 'Error recording your participation: ' + e\n )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,CAACc,aAAa,CAAC,OAAO,CAAC;EACxC4D,SAAS,CAACjD,WAAW,CAACxB,KAAK,CAAC;EAC5BF,kBAAkB,CAACC,GAAG,EAAEC,KAAK,EAAEyC,MAAM,EAAEvC,OAAO,EAAEwC,EAAE,EAAEtC,OAAO,CAAC;EAC5D,IAAIsE,cAAc;EAClB,IAAI;IACFA,cAAc,GAAGP,mBAAmB,CAACjE,OAAO,EAAEuC,MAAM,EAAEzC,KAAK,CAAC;EAC9D,CAAC,CAAC,OAAO1D,CAAC,EAAE;IACVmI,SAAS,CAACjD,WAAW,CACnB,IAAAmD,0BAAiB,EACf5E,GAAG,EACH,sCAAsC,GAAGzD,CAAC,CAC3C,CACF,EAAC;EACJ;;EACA,OAAO0D,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"participation.js","names":["debug","_interopRequireWildcard","require","_rdflib","ns","_widgets","_utils","_pad","_solidLogic","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","toString","slice","constructor","name","from","test","arr","len","arr2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","valueOf","ParticipationTableElement","_HTMLTableElement","_inherits2","_super","_this","_classCallCheck2","_len","args","_key","concat","_defineProperty2","_assertThisInitialized2","_createClass2","_wrapNativeSuper2","HTMLTableElement","store","solidLogicSingleton","renderPartipants","dom","table","unused1","subject","unused2","options","setAttribute","newRowForParticpation","parp","person","any","wf","tr","createElement","textContent","bg","anyValue","ui","block","personTR","appendChild","td","insertBefore","firstChild","syncTable","parps","each","map","log","cal","sort","participations","p","syncTableToArray","refresh","participationObject","padDoc","me","Promise","resolve","reject","Error","filter","pn","holds","candidates","_iterator","_step","participation","date","push","warn","newThing","ins","st","Date","lightColorHash","updater","update","uri","ok","errorMessage","recordParticipation","refreshable","authn","currentUser","editable","manageParticipation","container","_participation","errorMessageBlock"],"sources":["../src/participation.ts"],"sourcesContent":["/* Manage a UI for the particpation of a person in any thing\n*/\n\n// import { currentUser } from './authn/authn'\nimport * as debug from './debug'\nimport { LiveStore, NamedNode, st, UpdateManager } from 'rdflib'\nimport * as ns from './ns'\nimport { personTR, newThing, errorMessageBlock } from './widgets'\nimport { syncTableToArray } from './utils'\nimport { lightColorHash } from './pad'\nimport { log } from './debug'\nimport { solidLogicSingleton, authn } from 'solid-logic'\n\ntype ParticipationOptions = {\n deleteFunction?: () => {}\n link?: string\n draggable?: boolean\n}\n\nclass ParticipationTableElement extends HTMLTableElement {\n refresh?: () => void\n}\nconst store = solidLogicSingleton.store as LiveStore\n\n/** Manage participation in this session\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLTableElement} table - the table element\n* @param {NamedNode} unused1/document - the document to render (this argument is no longer used, but left in for backwards compatibility)\n* @param {NamedNode} subject - the thing in which the participation is happening\n* @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*/\nexport function renderPartipants (dom: HTMLDocument, table: ParticipationTableElement, unused1: NamedNode, subject: NamedNode, unused2: NamedNode, options: ParticipationOptions) {\n table.setAttribute('style', 'margin: 0.8em;')\n\n const newRowForParticpation = function (parp) {\n const person = store.any(parp, ns.wf('participant'))\n\n let tr\n if (!person) {\n tr = dom.createElement('tr')\n tr.textContent = '???' // Don't crash - invalid part'n entry\n return tr\n }\n const bg = store.anyValue(parp, ns.ui('backgroundColor')) || 'white'\n\n const block = dom.createElement('div')\n block.setAttribute(\n 'style',\n 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' +\n bg\n )\n tr = personTR(dom, null, person, options)\n table.appendChild(tr)\n const td = dom.createElement('td')\n td.setAttribute('style', 'vertical-align: middle;')\n td.appendChild(block)\n tr.insertBefore(td, tr.firstChild)\n return tr\n }\n\n const syncTable = function () {\n const parps = store.each(subject, ns.wf('participation')).map(function (parp) {\n log('in participants')\n return [store.anyValue(parp as any, ns.cal('dtstart')) || '9999-12-31', parp]\n })\n parps.sort() // List in order of joining\n const participations = parps.map(function (p) {\n return p[1]\n })\n syncTableToArray(table, participations, newRowForParticpation)\n }\n table.refresh = syncTable\n syncTable()\n return table\n}\n\n/** Record, or find old, Particpation object\n *\n * A particpaption object is a place to record things specifically about\n * subject and the user, such as preferences, start of membership, etc\n * @param {NamedNode} subject - the thing in which the participation is happening\n * @param {NamedNode} document - where to record the data\n * @param {NamedNode} me - the logged in user\n *\n */\nexport function participationObject (subject: NamedNode, padDoc: NamedNode, me: NamedNode) {\n return new Promise(function (resolve, reject) {\n if (!me) {\n throw new Error('No user id')\n }\n\n const parps = store.each(subject, ns.wf('participation')).filter(function (pn) {\n return store.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) { // This can happen. https://github.com/solidos/chat-pane/issues/71\n const candidates: (string | NamedNode) [][] = []\n for (const participation of parps) {\n const date = store.anyValue(participation as NamedNode, ns.cal('dtstart'))\n if (date) {\n candidates.push([date, participation as NamedNode])\n }\n }\n candidates.sort() // Pick the earliest\n // @@ Possibly, for extra credit, delete the others, if we have write access\n debug.warn('Multiple particpation objects, picking earliest, in ' + padDoc)\n resolve(candidates[0][1])\n // throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n resolve(parps[0]) // returns the particpation object\n } else {\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ];\n (store.updater as UpdateManager).update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n reject(new Error('Error recording your partipation: ' + errorMessage))\n } else {\n resolve(participation)\n }\n })\n resolve(participation)\n }\n })\n}\n\n/** Record my participation and display participants\n *\n * @param {NamedNode} subject - the thing in which participation is happening\n * @param {NamedNode} padDoc - the document into which the particpation should be recorded\n * @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works\n *\n */\nexport function recordParticipation (subject: NamedNode, padDoc: NamedNode, refreshable: any) {\n const me = authn.currentUser()\n if (!me) return // Not logged in\n\n const parps = store.each(subject, ns.wf('participation')).filter(function (pn) {\n return store.holds(pn, ns.wf('participant'), me)\n })\n if (parps.length > 1) {\n throw new Error('Multiple records of your participation')\n }\n if (parps.length) {\n // If I am not already recorded\n return parps[0] // returns the particpation object\n } else {\n if (!(store.updater as UpdateManager).editable(padDoc)) {\n debug.log('Not recording participation, as no write acesss as ' + me + ' to ' + padDoc)\n return null\n }\n const participation = newThing(padDoc)\n const ins = [\n st(subject, ns.wf('participation'), participation, padDoc),\n\n st(participation, ns.wf('participant'), me, padDoc),\n st(participation, ns.cal('dtstart'), new Date() as any, padDoc),\n st(\n participation,\n ns.ui('backgroundColor'),\n lightColorHash(me) as any,\n padDoc\n )\n ];\n (store.updater as UpdateManager).update([], ins, function (uri: string | null | undefined, ok: boolean, errorMessage?: string) {\n if (!ok) {\n throw new Error('Error recording your partipation: ' + errorMessage)\n }\n if (refreshable && refreshable.refresh) {\n refreshable.refresh()\n }\n // UI.pad.renderPartipants(dom, table, padDoc, subject, me, options)\n })\n return participation\n }\n}\n\n/** Record my participation and display participants\n*\n* @param {Document} dom - the web page loaded into the browser\n* @param {HTMLDivElement} container - the container element where the participants should be displayed\n* @param {NamedNode} document - the document into which the particpation should be shown\n* @param {NamedNode} subject - the thing in which participation is happening\n* @param {NamedNode} me - the logged in user\n* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button\n*\n*/\nexport function manageParticipation (\n dom: Document,\n container: HTMLDivElement,\n padDoc: NamedNode,\n subject: NamedNode,\n me: NamedNode,\n options: ParticipationOptions\n) {\n const table = dom.createElement('table')\n container.appendChild(table)\n renderPartipants(dom, table, padDoc, subject, me, options)\n let _participation\n try {\n _participation = recordParticipation(subject, padDoc, table)\n } catch (e) {\n container.appendChild(\n errorMessageBlock(\n dom,\n 'Error recording your partipation: ' + e\n )\n ) // Clean up?\n }\n return table\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,EAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AAAwD,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAa,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,c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;EACtB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmB,mBAAmBA,CACjCnE,GAAa,EACboE,SAAyB,EACzBhC,MAAiB,EACjBjC,OAAkB,EAClBkC,EAAa,EACbhC,OAA6B,EAC7B;EACA,IAAMJ,KAAK,GAAGD,GAAG,CAACa,aAAa,CAAC,OAAO,CAAC;EACxCuD,SAAS,CAAChD,WAAW,CAACnB,KAAK,CAAC;EAC5BF,gBAAgB,CAACC,GAAG,EAAEC,KAAK,EAAEmC,MAAM,EAAEjC,OAAO,EAAEkC,EAAE,EAAEhC,OAAO,CAAC;EAC1D,IAAIgE,cAAc;EAClB,IAAI;IACFA,cAAc,GAAGP,mBAAmB,CAAC3D,OAAO,EAAEiC,MAAM,EAAEnC,KAAK,CAAC;EAC9D,CAAC,CAAC,OAAO1D,CAAC,EAAE;IACV6H,SAAS,CAAChD,WAAW,CACnB,IAAAkD,0BAAiB,EACftE,GAAG,EACH,oCAAoC,GAAGzD,CAAC,CACzC,CACF,EAAC;EACJ;;EACA,OAAO0D,KAAK;AACd"}
|
package/lib/preferences.js
CHANGED
|
@@ -59,6 +59,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
59
59
|
return new Promise(function (resolve, reject) {
|
|
60
60
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
61
61
|
if (!sharedPreferences) {
|
|
62
|
+
if (!kb.updater.editable(subject.doc())) {
|
|
63
|
+
debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
|
|
64
|
+
resolve(context);
|
|
65
|
+
}
|
|
62
66
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
63
67
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
64
68
|
debug.log('Creating shared preferences ' + sp);
|
package/lib/preferences.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.js","names":["$rdf","_interopRequireWildcard","require","_solidLogic","debug","_login","ns","participation","widgets","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","kb","store","value","exports","k","v","log","Error","recordSharedPreferences","subject","context","Promise","resolve","reject","sharedPreferences","any","ui","sp","sym","doc","uri","ins","st","updater","update","ok","errorMessage","recordPersonalDefaults","theClass","ensureLoadedPreferences","then","preferencesFile","preferencesFileError","regs","each","solid","prefs","reg","length","forEach","r","personalDefaults","newThing","rdf","push","errm","err","renderPreferencesForm","preferencesForm","prefContainer","dom","createElement","participationObject","me","heading","text","appendChild","textContent","noun","appendForm","mes","complain","errorMessageBlock","toJS","term","datatype","equals","xsd","Date","Number","getPreferencesForClass","predicates","results","pred","v1"],"sources":["../src/preferences.js"],"sourcesContent":["// Solid-UI preferences\n// =====================\n//\n\nimport * as $rdf from 'rdflib' // pull in first avoid cross-refs\nimport { store } from 'solid-logic'\nimport * as debug from './debug'\nimport { ensureLoadedPreferences } from './login/login'\nimport * as ns from './ns'\nimport * as participation from './participation' // @ts-ignore\nimport * as widgets from './widgets'\n\nconst kb = store\n\n// This was tabulator . preferences in the tabulator\n// Is this functionality used anywhere?\n//\n\n// used for storing user name\n// @@ Deprocate these functions. They were used for\n// communication around the tabulator functionality about the user session\n\nexport const value = []\nexport function get (k) {\n return value[k]\n}\n\nexport function set (k, v) {\n if (typeof v !== 'string') {\n debug.log('Non-string value of preference ' + k + ': ' + v)\n throw new Error('Non-string value of preference ' + k + ': ' + v)\n }\n this.value[k] = v\n}\n\n// In a solid world, Preferences are stored in the web\n//\n// Make an RDF node for recording the common view preferences for any object\n// (maybe make it in a separate file?)\nexport function recordSharedPreferences (subject, context) {\n return new Promise(function (resolve, reject) {\n const sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'))\n if (!sharedPreferences) {\n const sp = $rdf.sym(subject.doc().uri + '#SharedPreferences')\n const ins = [\n $rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())\n ]\n debug.log('Creating shared preferences ' + sp)\n kb.updater.update([], ins, function (uri, ok, errorMessage) {\n if (!ok) {\n reject(new Error('Error creating shared prefs: ' + errorMessage))\n } else {\n context.sharedPreferences = sp\n resolve(context)\n }\n })\n } else {\n context.sharedPreferences = sharedPreferences\n resolve(context)\n }\n })\n}\n\n// Construct a personal defaults node in the preferences file for a given class of object\n//\nexport function recordPersonalDefaults (theClass, context) {\n return new Promise(function (resolve, reject) {\n ensureLoadedPreferences(context).then(\n context => {\n if (!context.preferencesFile) {\n debug.log(\n 'Not doing private class preferences as no access to preferences file. ' +\n context.preferencesFileError\n )\n return\n }\n const regs = kb.each(\n null,\n ns.solid('forClass'),\n theClass,\n context.preferencesFile\n )\n let ins = []\n let prefs\n let reg\n if (regs.length) {\n // Use existing node if we can\n regs.forEach(r => {\n prefs = prefs || kb.any(r, ns.solid('personalDefaults'))\n })\n if (prefs) {\n context.personalDefaults = prefs // Found one\n resolve(context)\n return\n } else {\n prefs = widgets.newThing(context.preferencesFile)\n reg = regs[0]\n }\n } else {\n // no regs fo class\n reg = widgets.newThing(context.preferencesFile)\n ins = [\n $rdf.st(\n reg,\n ns.rdf('type'),\n ns.solid('TypeRegistration'),\n context.preferencesFile\n ),\n $rdf.st(reg, ns.solid('forClass'), theClass, context.preferencesFile)\n ]\n }\n prefs = widgets.newThing(context.preferencesFile)\n ins.push(\n $rdf.st(\n reg,\n ns.solid('personalDefaults'),\n prefs,\n context.preferencesFile\n )\n )\n kb.updater.update([], ins, function (uri, ok, errm) {\n if (!ok) {\n reject(new Error('Setting preferences for ' + theClass + ': ' + errm))\n } else {\n context.personalDefaults = prefs\n resolve(context)\n }\n })\n },\n err => {\n reject(err)\n }\n )\n })\n}\n\nexport function renderPreferencesForm (subject, theClass, preferencesForm, context) {\n const prefContainer = context.dom.createElement('div')\n participation.participationObject(subject, subject.doc(), context.me).then(\n participation => {\n const dom = context.dom\n function heading (text) {\n prefContainer.appendChild(dom.createElement('h5')).textContent = text\n }\n heading('My view of this ' + context.noun)\n widgets.appendForm(\n dom,\n prefContainer,\n {},\n participation,\n preferencesForm,\n subject.doc(),\n (ok, mes) => {\n if (!ok) widgets.complain(context, mes)\n }\n )\n\n heading(\"Everyone's view of this \" + context.noun)\n recordSharedPreferences(subject, context).then(context => {\n const sharedPreferences = context.sharedPreferences\n widgets.appendForm(\n dom,\n prefContainer,\n {},\n sharedPreferences,\n preferencesForm,\n subject.doc(),\n (ok, mes) => {\n if (!ok) widgets.complain(context, mes)\n }\n )\n\n heading('My default view of any ' + context.noun)\n recordPersonalDefaults(theClass, context).then(\n context => {\n widgets.appendForm(\n dom,\n prefContainer,\n {},\n context.personalDefaults,\n preferencesForm,\n context.preferencesFile,\n (ok, mes) => {\n if (!ok) widgets.complain(context, mes)\n }\n )\n },\n err => {\n widgets.complain(context, err)\n }\n )\n })\n },\n err => {\n // parp object fails\n prefContainer.appendChild(widgets.errorMessageBlock(context.dom, err))\n }\n )\n return prefContainer\n}\n\n// This should be part of rdflib.js ad part of the RDFJS Standard!!\n\nfunction toJS (term) {\n if (!term.datatype) return term // Objects remain objects\n if (term.datatype.equals(ns.xsd('boolean'))) {\n return term.value === '1'\n }\n if (\n term.datatype.equals(ns.xsd('dateTime')) ||\n term.datatype.equals(ns.xsd('date'))\n ) {\n return new Date(term.value)\n }\n if (\n term.datatype.equals(ns.xsd('integer')) ||\n term.datatype.equals(ns.xsd('float')) ||\n term.datatype.equals(ns.xsd('decimal'))\n ) {\n return Number(term.value)\n }\n return term.value\n}\n\n// This is the function which acuakly reads and combines the preferences\n//\n// @@ make it much more tolerant of missing buts of prefernces\nexport function getPreferencesForClass (subject, theClass, predicates, context) {\n return new Promise(function (resolve, reject) {\n recordSharedPreferences(subject, context).then(context => {\n const sharedPreferences = context.sharedPreferences\n if (context.me) {\n participation\n .participationObject(subject, subject.doc(), context.me)\n .then(participation => {\n recordPersonalDefaults(theClass, context).then(context => {\n const results = []\n const personalDefaults = context.personalDefaults\n predicates.forEach(pred => {\n // Order of preference: My settings on object, Global settings on object, my settings on class\n const v1 =\n kb.any(participation, pred) ||\n kb.any(sharedPreferences, pred) ||\n kb.any(personalDefaults, pred)\n if (v1) {\n results[pred.uri] = toJS(v1)\n }\n })\n resolve(results)\n }, reject)\n }, reject)\n } else {\n // no user defined, just use common prefs\n const results = []\n predicates.forEach(pred => {\n const v1 = kb.any(sharedPreferences, pred)\n if (v1) {\n results[pred.uri] = toJS(v1)\n }\n })\n resolve(results)\n }\n })\n })\n}\n\n// ends\n"],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAP,uBAAA,CAAAC,OAAA;AAAoC,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAa,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GA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EAAI;UACzB,IAAMC,EAAE,GAAG1E,EAAE,CAACe,GAAG,CAACD,iBAAiB,EAAE2D,IAAI,CAAC;UAC1C,IAAIC,EAAE,EAAE;YACNF,OAAO,CAACC,IAAI,CAACrD,GAAG,CAAC,GAAG2C,IAAI,CAACW,EAAE,CAAC;UAC9B;QACF,CAAC,CAAC;QACF9D,OAAO,CAAC4D,OAAO,CAAC;MAClB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;;AAEA"}
|
|
1
|
+
{"version":3,"file":"preferences.js","names":["$rdf","_interopRequireWildcard","require","_solidLogic","debug","_login","ns","participation","widgets","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","kb","store","value","exports","k","v","log","Error","recordSharedPreferences","subject","context","Promise","resolve","reject","sharedPreferences","any","ui","updater","editable","doc","concat","sp","sym","uri","ins","st","update","ok","errorMessage","recordPersonalDefaults","theClass","ensureLoadedPreferences","then","preferencesFile","preferencesFileError","regs","each","solid","prefs","reg","length","forEach","r","personalDefaults","newThing","rdf","push","errm","err","renderPreferencesForm","preferencesForm","prefContainer","dom","createElement","participationObject","me","heading","text","appendChild","textContent","noun","appendForm","mes","complain","errorMessageBlock","toJS","term","datatype","equals","xsd","Date","Number","getPreferencesForClass","predicates","results","pred","v1"],"sources":["../src/preferences.js"],"sourcesContent":["// Solid-UI preferences\n// =====================\n//\n\nimport * as $rdf from 'rdflib' // pull in first avoid cross-refs\nimport { store } from 'solid-logic'\nimport * as debug from './debug'\nimport { ensureLoadedPreferences } from './login/login'\nimport * as ns from './ns'\nimport * as participation from './participation' // @ts-ignore\nimport * as widgets from './widgets'\n\nconst kb = store\n\n// This was tabulator . preferences in the tabulator\n// Is this functionality used anywhere?\n//\n\n// used for storing user name\n// @@ Deprocate these functions. They were used for\n// communication around the tabulator functionality about the user session\n\nexport const value = []\nexport function get (k) {\n return value[k]\n}\n\nexport function set (k, v) {\n if (typeof v !== 'string') {\n debug.log('Non-string value of preference ' + k + ': ' + v)\n throw new Error('Non-string value of preference ' + k + ': ' + v)\n }\n this.value[k] = v\n}\n\n// In a solid world, Preferences are stored in the web\n//\n// Make an RDF node for recording the common view preferences for any object\n// (maybe make it in a separate file?)\nexport function recordSharedPreferences (subject, context) {\n return new Promise(function (resolve, reject) {\n const sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'))\n if (!sharedPreferences) {\n if (!kb.updater.editable(subject.doc())) {\n debug.log(` Cant make shared preferences, may not change ${subject.doc}`)\n resolve(context)\n }\n const sp = $rdf.sym(subject.doc().uri + '#SharedPreferences')\n const ins = [\n $rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())\n ]\n debug.log('Creating shared preferences ' + sp)\n kb.updater.update([], ins, function (uri, ok, errorMessage) {\n if (!ok) {\n reject(new Error('Error creating shared prefs: ' + errorMessage))\n } else {\n context.sharedPreferences = sp\n resolve(context)\n }\n })\n } else {\n context.sharedPreferences = sharedPreferences\n resolve(context)\n }\n })\n}\n\n// Construct a personal defaults node in the preferences file for a given class of object\n//\nexport function recordPersonalDefaults (theClass, context) {\n return new Promise(function (resolve, reject) {\n ensureLoadedPreferences(context).then(\n context => {\n if (!context.preferencesFile) {\n debug.log(\n 'Not doing private class preferences as no access to preferences file. ' +\n context.preferencesFileError\n )\n return\n }\n const regs = kb.each(\n null,\n ns.solid('forClass'),\n theClass,\n context.preferencesFile\n )\n let ins = []\n let prefs\n let reg\n if (regs.length) {\n // Use existing node if we can\n regs.forEach(r => {\n prefs = prefs || kb.any(r, ns.solid('personalDefaults'))\n })\n if (prefs) {\n context.personalDefaults = prefs // Found one\n resolve(context)\n return\n } else {\n prefs = widgets.newThing(context.preferencesFile)\n reg = regs[0]\n }\n } else {\n // no regs fo class\n reg = widgets.newThing(context.preferencesFile)\n ins = [\n $rdf.st(\n reg,\n ns.rdf('type'),\n ns.solid('TypeRegistration'),\n context.preferencesFile\n ),\n $rdf.st(reg, ns.solid('forClass'), theClass, context.preferencesFile)\n ]\n }\n prefs = widgets.newThing(context.preferencesFile)\n ins.push(\n $rdf.st(\n reg,\n ns.solid('personalDefaults'),\n prefs,\n context.preferencesFile\n )\n )\n kb.updater.update([], ins, function (uri, ok, errm) {\n if (!ok) {\n reject(new Error('Setting preferences for ' + theClass + ': ' + errm))\n } else {\n context.personalDefaults = prefs\n resolve(context)\n }\n })\n },\n err => {\n reject(err)\n }\n )\n })\n}\n\nexport function renderPreferencesForm (subject, theClass, preferencesForm, context) {\n const prefContainer = context.dom.createElement('div')\n participation.participationObject(subject, subject.doc(), context.me).then(\n participation => {\n const dom = context.dom\n function heading (text) {\n prefContainer.appendChild(dom.createElement('h5')).textContent = text\n }\n heading('My view of this ' + context.noun)\n widgets.appendForm(\n dom,\n prefContainer,\n {},\n participation,\n preferencesForm,\n subject.doc(),\n (ok, mes) => {\n if (!ok) widgets.complain(context, mes)\n }\n )\n\n heading(\"Everyone's view of this \" + context.noun)\n recordSharedPreferences(subject, context).then(context => {\n const sharedPreferences = context.sharedPreferences\n widgets.appendForm(\n dom,\n prefContainer,\n {},\n sharedPreferences,\n preferencesForm,\n subject.doc(),\n (ok, mes) => {\n if (!ok) widgets.complain(context, mes)\n }\n )\n\n heading('My default view of any ' + context.noun)\n recordPersonalDefaults(theClass, context).then(\n context => {\n widgets.appendForm(\n dom,\n prefContainer,\n {},\n context.personalDefaults,\n preferencesForm,\n context.preferencesFile,\n (ok, mes) => {\n if (!ok) widgets.complain(context, mes)\n }\n )\n },\n err => {\n widgets.complain(context, err)\n }\n )\n })\n },\n err => {\n // parp object fails\n prefContainer.appendChild(widgets.errorMessageBlock(context.dom, err))\n }\n )\n return prefContainer\n}\n\n// This should be part of rdflib.js ad part of the RDFJS Standard!!\n\nfunction toJS (term) {\n if (!term.datatype) return term // Objects remain objects\n if (term.datatype.equals(ns.xsd('boolean'))) {\n return term.value === '1'\n }\n if (\n term.datatype.equals(ns.xsd('dateTime')) ||\n term.datatype.equals(ns.xsd('date'))\n ) {\n return new Date(term.value)\n }\n if (\n term.datatype.equals(ns.xsd('integer')) ||\n term.datatype.equals(ns.xsd('float')) ||\n term.datatype.equals(ns.xsd('decimal'))\n ) {\n return Number(term.value)\n }\n return term.value\n}\n\n// This is the function which acuakly reads and combines the preferences\n//\n// @@ make it much more tolerant of missing buts of prefernces\nexport function getPreferencesForClass (subject, theClass, predicates, context) {\n return new Promise(function (resolve, reject) {\n recordSharedPreferences(subject, context).then(context => {\n const sharedPreferences = context.sharedPreferences\n if (context.me) {\n participation\n .participationObject(subject, subject.doc(), context.me)\n .then(participation => {\n recordPersonalDefaults(theClass, context).then(context => {\n const results = []\n const personalDefaults = context.personalDefaults\n predicates.forEach(pred => {\n // Order of preference: My settings on object, Global settings on object, my settings on class\n const v1 =\n kb.any(participation, pred) ||\n kb.any(sharedPreferences, pred) ||\n kb.any(personalDefaults, pred)\n if (v1) {\n results[pred.uri] = toJS(v1)\n }\n })\n resolve(results)\n }, reject)\n }, reject)\n } else {\n // no user defined, just use common prefs\n const results = []\n predicates.forEach(pred => {\n const v1 = kb.any(sharedPreferences, pred)\n if (v1) {\n results[pred.uri] = toJS(v1)\n }\n })\n resolve(results)\n }\n })\n })\n}\n\n// ends\n"],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAP,uBAAA,CAAAC,OAAA;AAAoC,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF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