chat-pane 2.4.15-e26ee52d → 2.4.16
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/LICENSE.md +0 -0
- package/README.md +0 -0
- package/dist/chat.bundle.js +10423 -10680
- package/dist/chat.bundle.js.map +1 -1
- package/dist/index.html +0 -0
- package/dist/longChatPane.js +10525 -10792
- package/dist/longChatPane.js.map +1 -1
- package/dist/shortChatPane.js +10520 -10787
- package/dist/shortChatPane.js.map +1 -1
- package/lib/create.js +409 -0
- package/lib/create.js.map +1 -0
- package/lib/index.js +351 -0
- package/lib/index.js.map +1 -0
- package/lib/longChatPane.js +496 -0
- package/lib/longChatPane.js.map +1 -0
- package/lib/main.js +8 -0
- package/lib/main.js.map +1 -0
- package/lib/shortChatPane.js +151 -0
- package/lib/shortChatPane.js.map +1 -0
- package/package.json +7 -6
- package/src/create.ts +2 -1
- package/src/index.html +0 -0
- package/src/index.js +14 -13
- package/src/longChatPane.js +7 -7
- package/src/main.js +0 -0
- package/src/shortChatPane.js +2 -2
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _solidLogic = require("solid-logic");
|
|
4
|
+
|
|
5
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
|
+
|
|
7
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
+
|
|
9
|
+
var UI = require('solid-ui');
|
|
10
|
+
|
|
11
|
+
var ns = UI.ns;
|
|
12
|
+
|
|
13
|
+
var $rdf = require('rdflib');
|
|
14
|
+
|
|
15
|
+
var mainClass = ns.meeting('LongChat'); // @@ something from SIOC?
|
|
16
|
+
|
|
17
|
+
var CHAT_LOCATION_IN_CONTAINER = 'index.ttl#this'; // const menuIcon = 'noun_897914.svg'
|
|
18
|
+
|
|
19
|
+
var SPANNER_ICON = 'noun_344563.svg'; // resize: horizontal; min-width: 20em;
|
|
20
|
+
|
|
21
|
+
var SIDEBAR_COMPONENT_STYLE = UI.style.sidebarComponentStyle || ' padding: 0.5em; width: 100%;';
|
|
22
|
+
var SIDEBAR_STYLE = UI.style.sidebarStyle || 'overflow-x: auto; overflow-y: auto; border-radius: 1em; border: 0.1em solid white;'; // was purple border
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
CHAT_LOCATION_IN_CONTAINER: CHAT_LOCATION_IN_CONTAINER,
|
|
26
|
+
// noun_704.svg Canoe noun_346319.svg = 1 Chat noun_1689339.svg = three chat
|
|
27
|
+
icon: UI.icons.iconBase + 'noun_1689339.svg',
|
|
28
|
+
name: 'long chat',
|
|
29
|
+
label: function label(subject, context) {
|
|
30
|
+
var kb = context.session.store;
|
|
31
|
+
|
|
32
|
+
if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) {
|
|
33
|
+
// subject is the object
|
|
34
|
+
return 'Chat channnel';
|
|
35
|
+
} // Looks like a message -- might not havre any class declared
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if (kb.any(subject, ns.sioc('content')) && kb.any(subject, ns.dct('created'))) {
|
|
39
|
+
return 'message';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return null; // Suppress pane otherwise
|
|
43
|
+
},
|
|
44
|
+
mintClass: mainClass,
|
|
45
|
+
mintNew: function mintNew(context, newPaneOptions) {
|
|
46
|
+
var kb = context.session.store;
|
|
47
|
+
var updater = kb.updater;
|
|
48
|
+
|
|
49
|
+
if (newPaneOptions.me && !newPaneOptions.me.uri) {
|
|
50
|
+
throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var newInstance = newPaneOptions.newInstance = newPaneOptions.newInstance || kb.sym(newPaneOptions.newBase + CHAT_LOCATION_IN_CONTAINER);
|
|
54
|
+
var newChatDoc = newInstance.doc();
|
|
55
|
+
kb.add(newInstance, ns.rdf('type'), ns.meeting('LongChat'), newChatDoc);
|
|
56
|
+
kb.add(newInstance, ns.dc('title'), 'Chat channel', newChatDoc);
|
|
57
|
+
kb.add(newInstance, ns.dc('created'), new Date(), newChatDoc);
|
|
58
|
+
|
|
59
|
+
if (newPaneOptions.me) {
|
|
60
|
+
kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new Promise(function (resolve, reject) {
|
|
64
|
+
updater.put(newChatDoc, kb.statementsMatching(undefined, undefined, undefined, newChatDoc), 'text/turtle', function (uri2, ok, message) {
|
|
65
|
+
if (ok) {
|
|
66
|
+
resolve(newPaneOptions);
|
|
67
|
+
} else {
|
|
68
|
+
reject(new Error('FAILED to save new chat channel at: ' + uri2 + ' : ' + message));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
render: function render(subject, context, paneOptions) {
|
|
74
|
+
var dom = context.dom;
|
|
75
|
+
var kb = context.session.store;
|
|
76
|
+
/* Preferences
|
|
77
|
+
**
|
|
78
|
+
** Things like whether to color text by author webid, to expand image URLs inline,
|
|
79
|
+
** expanded inline image height. ...
|
|
80
|
+
** In general, preferences can be set per user, per user/app combo, per instance,
|
|
81
|
+
** and per instance/user combo. Per instance? not sure about unless it is valuable
|
|
82
|
+
** for everyone to be seeing the same thing.
|
|
83
|
+
*/
|
|
84
|
+
// const DCT = $rdf.Namespace('http://purl.org/dc/terms/')
|
|
85
|
+
|
|
86
|
+
var preferencesFormText = "\n @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n @prefix solid: <http://www.w3.org/ns/solid/terms#>.\n @prefix ui: <http://www.w3.org/ns/ui#>.\n @prefix : <#>.\n\n :this\n <http://purl.org/dc/elements/1.1/title> \"Chat preferences\" ;\n a ui:Form ;\n ui:parts ( :colorizeByAuthor :expandImagesInline :newestFirst :inlineImageHeightEms\n :shiftEnterSendsMessage :authorDateOnLeft :showDeletedMessages).\n\n :colorizeByAuthor a ui:TristateField; ui:property solid:colorizeByAuthor;\n ui:label \"Color user input by user\".\n\n :expandImagesInline a ui:TristateField; ui:property solid:expandImagesInline;\n ui:label \"Expand image URLs inline\".\n\n :newestFirst a ui:TristateField; ui:property solid:newestFirst;\n ui:label \"Newest messages at the top\".\n\n :inlineImageHeightEms a ui:IntegerField; ui:property solid:inlineImageHeightEms;\n ui:label \"Inline image height (lines)\".\n\n :shiftEnterSendsMessage a ui:TristateField; ui:property solid:shiftEnterSendsMessage;\n ui:label \"Shift-Enter sends message\".\n\n :authorDateOnLeft a ui:TristateField; ui:property solid:authorDateOnLeft;\n ui:label \"Author & date of message on left\".\n\n :showDeletedMessages a ui:TristateField; ui:property solid:showDeletedMessages;\n ui:label \"Show placeholders for deleted messages\".\n";
|
|
87
|
+
var preferencesForm = kb.sym('https://solid.github.io/solid-panes/longCharPane/preferencesForm.ttl#this');
|
|
88
|
+
var preferencesFormDoc = preferencesForm.doc();
|
|
89
|
+
|
|
90
|
+
if (!kb.holds(undefined, undefined, undefined, preferencesFormDoc)) {
|
|
91
|
+
// If not loaded already
|
|
92
|
+
$rdf.parse(preferencesFormText, kb, preferencesFormDoc.uri, 'text/turtle'); // Load form directly
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var preferenceProperties = kb.statementsMatching(null, ns.ui.property, null, preferencesFormDoc).map(function (st) {
|
|
96
|
+
return st.object;
|
|
97
|
+
}); // Preferences Menu
|
|
98
|
+
//
|
|
99
|
+
// Build a menu a the side (@@ reactive: on top?)
|
|
100
|
+
|
|
101
|
+
function renderPreferencesSidebar(_x) {
|
|
102
|
+
return _renderPreferencesSidebar.apply(this, arguments);
|
|
103
|
+
} // @@ Split out into solid-ui
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
function _renderPreferencesSidebar() {
|
|
107
|
+
_renderPreferencesSidebar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(context) {
|
|
108
|
+
var dom, noun, preferencesArea, menuTable, registrationArea, statusArea, me;
|
|
109
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
110
|
+
while (1) {
|
|
111
|
+
switch (_context.prev = _context.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
// const noun = 'chat room'
|
|
114
|
+
dom = context.dom, noun = context.noun;
|
|
115
|
+
preferencesArea = dom.createElement('div');
|
|
116
|
+
preferencesArea.appendChild(panelCloseButton(preferencesArea)); // @@ style below fix .. just make it onviious while testing
|
|
117
|
+
|
|
118
|
+
preferencesArea.style = SIDEBAR_COMPONENT_STYLE;
|
|
119
|
+
preferencesArea.style.minWidth = '25em'; // bit bigger
|
|
120
|
+
|
|
121
|
+
preferencesArea.style.maxHeight = triptychHeight;
|
|
122
|
+
menuTable = preferencesArea.appendChild(dom.createElement('table'));
|
|
123
|
+
registrationArea = menuTable.appendChild(dom.createElement('tr'));
|
|
124
|
+
statusArea = menuTable.appendChild(dom.createElement('tr'));
|
|
125
|
+
me = _solidLogic.authn.currentUser();
|
|
126
|
+
|
|
127
|
+
if (!me) {
|
|
128
|
+
_context.next = 15;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_context.next = 13;
|
|
133
|
+
return UI.login.registrationControl({
|
|
134
|
+
noun: noun,
|
|
135
|
+
me: me,
|
|
136
|
+
statusArea: statusArea,
|
|
137
|
+
dom: dom,
|
|
138
|
+
div: registrationArea
|
|
139
|
+
}, chatChannel, mainClass);
|
|
140
|
+
|
|
141
|
+
case 13:
|
|
142
|
+
console.log('Registration control finsished.');
|
|
143
|
+
preferencesArea.appendChild(UI.preferences.renderPreferencesForm(chatChannel, mainClass, preferencesForm, {
|
|
144
|
+
noun: noun,
|
|
145
|
+
me: me,
|
|
146
|
+
statusArea: statusArea,
|
|
147
|
+
div: preferencesArea,
|
|
148
|
+
dom: dom,
|
|
149
|
+
kb: kb
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
case 15:
|
|
153
|
+
return _context.abrupt("return", preferencesArea);
|
|
154
|
+
|
|
155
|
+
case 16:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context.stop();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, _callee);
|
|
161
|
+
}));
|
|
162
|
+
return _renderPreferencesSidebar.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function panelCloseButton(panel) {
|
|
166
|
+
function removePanel() {
|
|
167
|
+
panel.parentNode.removeChild(panel);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var button = UI.widgets.button(context.dom, UI.icons.iconBase + 'noun_1180156.svg', 'close', removePanel);
|
|
171
|
+
button.style["float"] = 'right';
|
|
172
|
+
button.style.margin = '0.7em';
|
|
173
|
+
delete button.style.backgroundColor; // do not want white
|
|
174
|
+
|
|
175
|
+
return button;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function preferencesButtonPressed(_x2) {
|
|
179
|
+
return _preferencesButtonPressed.apply(this, arguments);
|
|
180
|
+
} // preferencesButtonPressed
|
|
181
|
+
// All my chats
|
|
182
|
+
//
|
|
183
|
+
|
|
184
|
+
/* Build a other chats list drawer the side
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
function _preferencesButtonPressed() {
|
|
189
|
+
_preferencesButtonPressed = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_event) {
|
|
190
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
191
|
+
while (1) {
|
|
192
|
+
switch (_context2.prev = _context2.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
if (preferencesArea) {
|
|
195
|
+
_context2.next = 4;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
_context2.next = 3;
|
|
200
|
+
return renderPreferencesSidebar({
|
|
201
|
+
dom: dom,
|
|
202
|
+
noun: 'chat room'
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
case 3:
|
|
206
|
+
preferencesArea = _context2.sent;
|
|
207
|
+
|
|
208
|
+
case 4:
|
|
209
|
+
if (paneRight.contains(preferencesArea)) {
|
|
210
|
+
// Close menu (hide or delete??)
|
|
211
|
+
preferencesArea.parentNode.removeChild(preferencesArea);
|
|
212
|
+
preferencesArea = null;
|
|
213
|
+
} else {
|
|
214
|
+
paneRight.appendChild(preferencesArea);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
case 5:
|
|
218
|
+
case "end":
|
|
219
|
+
return _context2.stop();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}, _callee2);
|
|
223
|
+
}));
|
|
224
|
+
return _preferencesButtonPressed.apply(this, arguments);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function renderCreationControl(refreshTarget, noun) {
|
|
228
|
+
var creationDiv = dom.createElement('div');
|
|
229
|
+
|
|
230
|
+
var me = _solidLogic.authn.currentUser();
|
|
231
|
+
|
|
232
|
+
var creationContext = {
|
|
233
|
+
// folder: subject,
|
|
234
|
+
div: creationDiv,
|
|
235
|
+
dom: dom,
|
|
236
|
+
noun: noun,
|
|
237
|
+
statusArea: creationDiv,
|
|
238
|
+
me: me,
|
|
239
|
+
refreshTarget: refreshTarget
|
|
240
|
+
};
|
|
241
|
+
var chatPane = context.session.paneRegistry.byName('chat');
|
|
242
|
+
var relevantPanes = [chatPane];
|
|
243
|
+
UI.create.newThingUI(creationContext, context, relevantPanes); // Have to pass panes down newUI
|
|
244
|
+
|
|
245
|
+
return creationDiv;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function renderInstances(_x3, _x4) {
|
|
249
|
+
return _renderInstances.apply(this, arguments);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function _renderInstances() {
|
|
253
|
+
_renderInstances = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(theClass, noun) {
|
|
254
|
+
var instancesDiv, context;
|
|
255
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
256
|
+
while (1) {
|
|
257
|
+
switch (_context3.prev = _context3.next) {
|
|
258
|
+
case 0:
|
|
259
|
+
instancesDiv = dom.createElement('div');
|
|
260
|
+
context = {
|
|
261
|
+
dom: dom,
|
|
262
|
+
div: instancesDiv,
|
|
263
|
+
noun: noun
|
|
264
|
+
};
|
|
265
|
+
_context3.next = 4;
|
|
266
|
+
return UI.login.registrationList(context, {
|
|
267
|
+
"public": true,
|
|
268
|
+
"private": true,
|
|
269
|
+
type: theClass
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
case 4:
|
|
273
|
+
instancesDiv.appendChild(renderCreationControl(instancesDiv, noun));
|
|
274
|
+
return _context3.abrupt("return", instancesDiv);
|
|
275
|
+
|
|
276
|
+
case 6:
|
|
277
|
+
case "end":
|
|
278
|
+
return _context3.stop();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, _callee3);
|
|
282
|
+
}));
|
|
283
|
+
return _renderInstances.apply(this, arguments);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
var otherChatsArea = null;
|
|
287
|
+
|
|
288
|
+
function otherChatsHandler(_x5) {
|
|
289
|
+
return _otherChatsHandler.apply(this, arguments);
|
|
290
|
+
} // otherChatsHandler
|
|
291
|
+
// People in the chat
|
|
292
|
+
//
|
|
293
|
+
|
|
294
|
+
/* Build a participants list drawer the side
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
function _otherChatsHandler() {
|
|
299
|
+
_otherChatsHandler = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_event) {
|
|
300
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
301
|
+
while (1) {
|
|
302
|
+
switch (_context4.prev = _context4.next) {
|
|
303
|
+
case 0:
|
|
304
|
+
if (otherChatsArea) {
|
|
305
|
+
_context4.next = 10;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Lazy build when needed
|
|
310
|
+
// Expand
|
|
311
|
+
otherChatsArea = dom.createElement('div');
|
|
312
|
+
otherChatsArea.style = SIDEBAR_COMPONENT_STYLE;
|
|
313
|
+
otherChatsArea.style.maxHeight = triptychHeight;
|
|
314
|
+
otherChatsArea.appendChild(panelCloseButton(otherChatsArea));
|
|
315
|
+
_context4.t0 = otherChatsArea;
|
|
316
|
+
_context4.next = 8;
|
|
317
|
+
return renderInstances(ns.meeting('LongChat'), 'chat');
|
|
318
|
+
|
|
319
|
+
case 8:
|
|
320
|
+
_context4.t1 = _context4.sent;
|
|
321
|
+
|
|
322
|
+
_context4.t0.appendChild.call(_context4.t0, _context4.t1);
|
|
323
|
+
|
|
324
|
+
case 10:
|
|
325
|
+
// Toggle visibility with button clicks
|
|
326
|
+
if (paneLeft.contains(otherChatsArea)) {
|
|
327
|
+
otherChatsArea.parentNode.removeChild(otherChatsArea);
|
|
328
|
+
} else {
|
|
329
|
+
paneLeft.appendChild(otherChatsArea);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
case 11:
|
|
333
|
+
case "end":
|
|
334
|
+
return _context4.stop();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}, _callee4);
|
|
338
|
+
}));
|
|
339
|
+
return _otherChatsHandler.apply(this, arguments);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
var participantsArea;
|
|
343
|
+
|
|
344
|
+
function participantsHandler(_event) {
|
|
345
|
+
if (!participantsArea) {
|
|
346
|
+
// Expand
|
|
347
|
+
participantsArea = dom.createElement('div');
|
|
348
|
+
participantsArea.style = SIDEBAR_COMPONENT_STYLE;
|
|
349
|
+
participantsArea.style.maxHeight = triptychHeight;
|
|
350
|
+
participantsArea.appendChild(panelCloseButton(participantsArea)); // Record my participation and display participants
|
|
351
|
+
|
|
352
|
+
var me = _solidLogic.authn.currentUser();
|
|
353
|
+
|
|
354
|
+
if (!me) alert('Should be logeed in for partipants panel');
|
|
355
|
+
UI.pad.manageParticipation(dom, participantsArea, chatChannel.doc(), chatChannel, me, {});
|
|
356
|
+
} // Toggle appearance in sidebar with clicks
|
|
357
|
+
// Note also it can remove itself using the X button
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
if (paneLeft.contains(participantsArea)) {
|
|
361
|
+
// Close participants (hide or delete??)
|
|
362
|
+
participantsArea.parentNode.removeChild(participantsArea);
|
|
363
|
+
participantsArea = null;
|
|
364
|
+
} else {
|
|
365
|
+
paneLeft.appendChild(participantsArea);
|
|
366
|
+
}
|
|
367
|
+
} // participantsHandler
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
var chatChannel = subject;
|
|
371
|
+
var selectedMessage = null;
|
|
372
|
+
|
|
373
|
+
if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) {
|
|
374
|
+
// subject is the chatChannel
|
|
375
|
+
console.log('Chat channnel'); // Looks like a message -- might not havre any class declared
|
|
376
|
+
} else if (kb.any(subject, ns.sioc('content')) && kb.any(subject, ns.dct('created'))) {
|
|
377
|
+
console.log('message');
|
|
378
|
+
selectedMessage = subject;
|
|
379
|
+
chatChannel = kb.any(null, ns.wf('message'), selectedMessage);
|
|
380
|
+
if (!chatChannel) throw new Error('Message has no link to chatChannel');
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
var div = dom.createElement('div'); // Three large columns for particpant, chat, Preferences. formula below just as a note
|
|
384
|
+
// const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
|
|
385
|
+
|
|
386
|
+
var triptychHeight = '20cm'; // @@ need to be able to set to window!
|
|
387
|
+
|
|
388
|
+
var triptych = div.appendChild(dom.createElement('table'));
|
|
389
|
+
triptych.style.maxHeight = '12"'; // Screen max
|
|
390
|
+
|
|
391
|
+
var paneRow = triptych.appendChild(dom.createElement('tr'));
|
|
392
|
+
var paneLeft = paneRow.appendChild(dom.createElement('td'));
|
|
393
|
+
var paneMiddle = paneRow.appendChild(dom.createElement('td'));
|
|
394
|
+
var paneRight = paneRow.appendChild(dom.createElement('td'));
|
|
395
|
+
var paneBottom = triptych.appendChild(dom.createElement('tr'));
|
|
396
|
+
paneLeft.style = SIDEBAR_STYLE;
|
|
397
|
+
paneLeft.style.paddingRight = '1em';
|
|
398
|
+
paneRight.style = SIDEBAR_STYLE;
|
|
399
|
+
paneRight.style.paddingLeft = '1em';
|
|
400
|
+
paneBottom.appendChild(dom.createElement('td'));
|
|
401
|
+
var buttonCell = paneBottom.appendChild(dom.createElement('td'));
|
|
402
|
+
paneBottom.appendChild(dom.createElement('td')); // Button to bring up participants drawer on left
|
|
403
|
+
|
|
404
|
+
var participantsIcon = 'noun_339237.svg';
|
|
405
|
+
var participantsButton = UI.widgets.button(dom, UI.icons.iconBase + participantsIcon, 'participants ...'); // wider var
|
|
406
|
+
|
|
407
|
+
buttonCell.appendChild(participantsButton);
|
|
408
|
+
participantsButton.addEventListener('click', participantsHandler); // Button to bring up otherChats drawer on left
|
|
409
|
+
|
|
410
|
+
var otherChatsIcon = 'noun_1689339.svg'; // long chat icon -- not ideal for a set of chats @@
|
|
411
|
+
|
|
412
|
+
var otherChatsButton = UI.widgets.button(dom, UI.icons.iconBase + otherChatsIcon, 'List of other chats ...'); // wider var
|
|
413
|
+
|
|
414
|
+
buttonCell.appendChild(otherChatsButton);
|
|
415
|
+
otherChatsButton.addEventListener('click', otherChatsHandler);
|
|
416
|
+
var preferencesArea = null;
|
|
417
|
+
var menuButton = UI.widgets.button(dom, UI.icons.iconBase + SPANNER_ICON, 'Setting ...'); // wider var
|
|
418
|
+
|
|
419
|
+
buttonCell.appendChild(menuButton);
|
|
420
|
+
menuButton.style["float"] = 'right';
|
|
421
|
+
menuButton.addEventListener('click', preferencesButtonPressed);
|
|
422
|
+
div.setAttribute('class', 'chatPane');
|
|
423
|
+
var options = {
|
|
424
|
+
infinite: true
|
|
425
|
+
};
|
|
426
|
+
var participantsHandlerContext = {
|
|
427
|
+
noun: 'chat room',
|
|
428
|
+
div: div,
|
|
429
|
+
dom: dom
|
|
430
|
+
};
|
|
431
|
+
participantsHandlerContext.me = _solidLogic.authn.currentUser(); // If already logged on
|
|
432
|
+
|
|
433
|
+
function buildPane() {
|
|
434
|
+
return _buildPane.apply(this, arguments);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function _buildPane() {
|
|
438
|
+
_buildPane = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
439
|
+
var prefMap, propuri, chatControl;
|
|
440
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
441
|
+
while (1) {
|
|
442
|
+
switch (_context5.prev = _context5.next) {
|
|
443
|
+
case 0:
|
|
444
|
+
_context5.prev = 0;
|
|
445
|
+
_context5.next = 3;
|
|
446
|
+
return UI.preferences.getPreferencesForClass(chatChannel, mainClass, preferenceProperties, participantsHandlerContext);
|
|
447
|
+
|
|
448
|
+
case 3:
|
|
449
|
+
prefMap = _context5.sent;
|
|
450
|
+
_context5.next = 9;
|
|
451
|
+
break;
|
|
452
|
+
|
|
453
|
+
case 6:
|
|
454
|
+
_context5.prev = 6;
|
|
455
|
+
_context5.t0 = _context5["catch"](0);
|
|
456
|
+
UI.widgets.complain(participantsHandlerContext, _context5.t0);
|
|
457
|
+
|
|
458
|
+
case 9:
|
|
459
|
+
for (propuri in prefMap) {
|
|
460
|
+
options[propuri.split('#')[1]] = prefMap[propuri];
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if (selectedMessage) {
|
|
464
|
+
options.selectedMessage = selectedMessage;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if (paneOptions.solo) {
|
|
468
|
+
// This is the top pane, title, scrollbar etc are ours
|
|
469
|
+
options.solo = true;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
_context5.next = 14;
|
|
473
|
+
return UI.infiniteMessageArea(dom, kb, chatChannel, options);
|
|
474
|
+
|
|
475
|
+
case 14:
|
|
476
|
+
chatControl = _context5.sent;
|
|
477
|
+
chatControl.style.resize = 'both';
|
|
478
|
+
chatControl.style.overflow = 'auto';
|
|
479
|
+
chatControl.style.maxHeight = triptychHeight;
|
|
480
|
+
paneMiddle.appendChild(chatControl);
|
|
481
|
+
|
|
482
|
+
case 19:
|
|
483
|
+
case "end":
|
|
484
|
+
return _context5.stop();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}, _callee5, null, [[0, 6]]);
|
|
488
|
+
}));
|
|
489
|
+
return _buildPane.apply(this, arguments);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
buildPane().then(console.log('async - chat pane built'));
|
|
493
|
+
return div;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
//# sourceMappingURL=longChatPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/longChatPane.js"],"names":["UI","require","ns","$rdf","mainClass","meeting","CHAT_LOCATION_IN_CONTAINER","SPANNER_ICON","SIDEBAR_COMPONENT_STYLE","style","sidebarComponentStyle","SIDEBAR_STYLE","sidebarStyle","module","exports","icon","icons","iconBase","name","label","subject","context","kb","session","store","holds","rdf","any","sioc","dct","mintClass","mintNew","newPaneOptions","updater","me","uri","Error","newInstance","sym","newBase","newChatDoc","doc","add","dc","Date","Promise","resolve","reject","put","statementsMatching","undefined","uri2","ok","message","render","paneOptions","dom","preferencesFormText","preferencesForm","preferencesFormDoc","parse","preferenceProperties","ui","property","map","st","object","renderPreferencesSidebar","noun","preferencesArea","createElement","appendChild","panelCloseButton","minWidth","maxHeight","triptychHeight","menuTable","registrationArea","statusArea","authn","currentUser","login","registrationControl","div","chatChannel","console","log","preferences","renderPreferencesForm","panel","removePanel","parentNode","removeChild","button","widgets","margin","backgroundColor","preferencesButtonPressed","_event","paneRight","contains","renderCreationControl","refreshTarget","creationDiv","creationContext","chatPane","paneRegistry","byName","relevantPanes","create","newThingUI","renderInstances","theClass","instancesDiv","registrationList","type","otherChatsArea","otherChatsHandler","paneLeft","participantsArea","participantsHandler","alert","pad","manageParticipation","selectedMessage","wf","triptych","paneRow","paneMiddle","paneBottom","paddingRight","paddingLeft","buttonCell","participantsIcon","participantsButton","addEventListener","otherChatsIcon","otherChatsButton","menuButton","setAttribute","options","infinite","participantsHandlerContext","buildPane","getPreferencesForClass","prefMap","complain","propuri","split","solo","infiniteMessageArea","chatControl","resize","overflow","then"],"mappings":";;AAIA;;;;;;AACA,IAAMA,EAAE,GAAGC,OAAO,CAAC,UAAD,CAAlB;;AACA,IAAMC,EAAE,GAAGF,EAAE,CAACE,EAAd;;AACA,IAAMC,IAAI,GAAGF,OAAO,CAAC,QAAD,CAApB;;AAEA,IAAMG,SAAS,GAAGF,EAAE,CAACG,OAAH,CAAW,UAAX,CAAlB,C,CAAyC;;AAEzC,IAAMC,0BAA0B,GAAG,gBAAnC,C,CAEA;;AACA,IAAMC,YAAY,GAAG,iBAArB,C,CACA;;AACA,IAAMC,uBAAuB,GAAGR,EAAE,CAACS,KAAH,CAASC,qBAAT,IAAkC,+BAAlE;AACA,IAAMC,aAAa,GAAGX,EAAE,CAACS,KAAH,CAASG,YAAT,IAAyB,oFAA/C,C,CACA;;AACAC,MAAM,CAACC,OAAP,GAAiB;AACfR,EAAAA,0BAA0B,EAA1BA,0BADe;AAGf;AACAS,EAAAA,IAAI,EAAEf,EAAE,CAACgB,KAAH,CAASC,QAAT,GAAoB,kBAJX;AAMfC,EAAAA,IAAI,EAAE,WANS;AAQfC,EAAAA,KAAK,EAAE,eAAUC,OAAV,EAAmBC,OAAnB,EAA4B;AACjC,QAAMC,EAAE,GAAGD,OAAO,CAACE,OAAR,CAAgBC,KAA3B;;AACA,QAAIF,EAAE,CAACG,KAAH,CAASL,OAAT,EAAkBl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wB,EAGxB8D,WAHwB,EAIxBwD,OAJwB,CAlB5B;;AAAA;AAkBQW,gBAAAA,WAlBR;AAwBEA,gBAAAA,WAAW,CAAC9I,KAAZ,CAAkB+I,MAAlB,GAA2B,MAA3B;AACAD,gBAAAA,WAAW,CAAC9I,KAAZ,CAAkBgJ,QAAlB,GAA6B,MAA7B;AACAF,gBAAAA,WAAW,CAAC9I,KAAZ,CAAkBiE,SAAlB,GAA8BC,cAA9B;AACAqD,gBAAAA,UAAU,CAACzD,WAAX,CAAuBgF,WAAvB;;AA3BF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAhS+C;AAAA;AAAA;;AA6T/CR,IAAAA,SAAS,GAAGW,IAAZ,CAAiBrE,OAAO,CAACC,GAAR,CAAY,yBAAZ,CAAjB;AACA,WAAOH,GAAP;AACD;AA/Xc,CAAjB","sourcesContent":["/* Long Chat Pane\n **\n ** A long chat consists a of a series of chat files saved by date.\n */\nimport { authn } from 'solid-logic'\nconst UI = require('solid-ui')\nconst ns = UI.ns\nconst $rdf = require('rdflib')\n\nconst mainClass = ns.meeting('LongChat') // @@ something from SIOC?\n\nconst CHAT_LOCATION_IN_CONTAINER = 'index.ttl#this'\n\n// const menuIcon = 'noun_897914.svg'\nconst SPANNER_ICON = 'noun_344563.svg'\n// resize: horizontal; min-width: 20em;\nconst SIDEBAR_COMPONENT_STYLE = UI.style.sidebarComponentStyle || ' padding: 0.5em; width: 100%;'\nconst SIDEBAR_STYLE = UI.style.sidebarStyle || 'overflow-x: auto; overflow-y: auto; border-radius: 1em; border: 0.1em solid white;'\n// was purple border\nmodule.exports = {\n CHAT_LOCATION_IN_CONTAINER,\n\n // noun_704.svg Canoe noun_346319.svg = 1 Chat noun_1689339.svg = three chat\n icon: UI.icons.iconBase + 'noun_1689339.svg',\n\n name: 'long chat',\n\n label: function (subject, context) {\n const kb = context.session.store\n if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) {\n // subject is the object\n return 'Chat channnel'\n } // Looks like a message -- might not havre any class declared\n if (\n kb.any(subject, ns.sioc('content')) &&\n kb.any(subject, ns.dct('created'))\n ) {\n return 'message'\n }\n return null // Suppress pane otherwise\n },\n\n mintClass: mainClass,\n\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n var updater = kb.updater\n if (newPaneOptions.me && !newPaneOptions.me.uri) {\n throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)\n }\n\n var newInstance = (newPaneOptions.newInstance =\n newPaneOptions.newInstance ||\n kb.sym(newPaneOptions.newBase + CHAT_LOCATION_IN_CONTAINER))\n var newChatDoc = newInstance.doc()\n\n kb.add(newInstance, ns.rdf('type'), ns.meeting('LongChat'), newChatDoc)\n kb.add(newInstance, ns.dc('title'), 'Chat channel', newChatDoc)\n kb.add(newInstance, ns.dc('created'), new Date(), newChatDoc)\n if (newPaneOptions.me) {\n kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)\n }\n\n return new Promise(function (resolve, reject) {\n updater.put(\n newChatDoc,\n kb.statementsMatching(undefined, undefined, undefined, newChatDoc),\n 'text/turtle',\n function (uri2, ok, message) {\n if (ok) {\n resolve(newPaneOptions)\n } else {\n reject(\n new Error(\n 'FAILED to save new chat channel at: ' + uri2 + ' : ' + message\n )\n )\n }\n }\n )\n })\n },\n\n render: function (subject, context, paneOptions) {\n const dom = context.dom\n const kb = context.session.store\n\n /* Preferences\n **\n ** Things like whether to color text by author webid, to expand image URLs inline,\n ** expanded inline image height. ...\n ** In general, preferences can be set per user, per user/app combo, per instance,\n ** and per instance/user combo. Per instance? not sure about unless it is valuable\n ** for everyone to be seeing the same thing.\n */\n // const DCT = $rdf.Namespace('http://purl.org/dc/terms/')\n const preferencesFormText = `\n @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n @prefix solid: <http://www.w3.org/ns/solid/terms#>.\n @prefix ui: <http://www.w3.org/ns/ui#>.\n @prefix : <#>.\n\n :this\n <http://purl.org/dc/elements/1.1/title> \"Chat preferences\" ;\n a ui:Form ;\n ui:parts ( :colorizeByAuthor :expandImagesInline :newestFirst :inlineImageHeightEms\n :shiftEnterSendsMessage :authorDateOnLeft :showDeletedMessages).\n\n :colorizeByAuthor a ui:TristateField; ui:property solid:colorizeByAuthor;\n ui:label \"Color user input by user\".\n\n :expandImagesInline a ui:TristateField; ui:property solid:expandImagesInline;\n ui:label \"Expand image URLs inline\".\n\n :newestFirst a ui:TristateField; ui:property solid:newestFirst;\n ui:label \"Newest messages at the top\".\n\n :inlineImageHeightEms a ui:IntegerField; ui:property solid:inlineImageHeightEms;\n ui:label \"Inline image height (lines)\".\n\n :shiftEnterSendsMessage a ui:TristateField; ui:property solid:shiftEnterSendsMessage;\n ui:label \"Shift-Enter sends message\".\n\n :authorDateOnLeft a ui:TristateField; ui:property solid:authorDateOnLeft;\n ui:label \"Author & date of message on left\".\n\n :showDeletedMessages a ui:TristateField; ui:property solid:showDeletedMessages;\n ui:label \"Show placeholders for deleted messages\".\n`\n const preferencesForm = kb.sym(\n 'https://solid.github.io/solid-panes/longCharPane/preferencesForm.ttl#this'\n )\n const preferencesFormDoc = preferencesForm.doc()\n if (!kb.holds(undefined, undefined, undefined, preferencesFormDoc)) {\n // If not loaded already\n $rdf.parse(preferencesFormText, kb, preferencesFormDoc.uri, 'text/turtle') // Load form directly\n }\n const preferenceProperties = kb\n .statementsMatching(null, ns.ui.property, null, preferencesFormDoc)\n .map(st => st.object)\n\n // Preferences Menu\n //\n // Build a menu a the side (@@ reactive: on top?)\n\n async function renderPreferencesSidebar (context) {\n // const noun = 'chat room'\n const { dom, noun } = context\n const preferencesArea = dom.createElement('div')\n preferencesArea.appendChild(panelCloseButton(preferencesArea))\n // @@ style below fix .. just make it onviious while testing\n preferencesArea.style = SIDEBAR_COMPONENT_STYLE\n preferencesArea.style.minWidth = '25em' // bit bigger\n preferencesArea.style.maxHeight = triptychHeight\n const menuTable = preferencesArea.appendChild(dom.createElement('table'))\n const registrationArea = menuTable.appendChild(dom.createElement('tr'))\n const statusArea = menuTable.appendChild(dom.createElement('tr'))\n\n var me = authn.currentUser()\n if (me) {\n await UI.login.registrationControl(\n { noun, me, statusArea, dom, div: registrationArea },\n chatChannel,\n mainClass\n )\n console.log('Registration control finsished.')\n preferencesArea.appendChild(\n UI.preferences.renderPreferencesForm(\n chatChannel,\n mainClass,\n preferencesForm,\n {\n noun,\n me,\n statusArea,\n div: preferencesArea,\n dom,\n kb\n }\n )\n )\n }\n return preferencesArea\n }\n\n // @@ Split out into solid-ui\n\n function panelCloseButton (panel) {\n function removePanel () {\n panel.parentNode.removeChild(panel)\n }\n const button =\n UI.widgets.button(context.dom, UI.icons.iconBase + 'noun_1180156.svg', 'close', removePanel)\n button.style.float = 'right'\n button.style.margin = '0.7em'\n delete button.style.backgroundColor // do not want white\n return button\n }\n async function preferencesButtonPressed (_event) {\n if (!preferencesArea) {\n // Expand\n preferencesArea = await renderPreferencesSidebar({ dom, noun: 'chat room' })\n }\n if (paneRight.contains(preferencesArea)) {\n // Close menu (hide or delete??)\n preferencesArea.parentNode.removeChild(preferencesArea)\n preferencesArea = null\n } else {\n paneRight.appendChild(preferencesArea)\n }\n } // preferencesButtonPressed\n\n // All my chats\n //\n /* Build a other chats list drawer the side\n */\n\n function renderCreationControl (refreshTarget, noun) {\n var creationDiv = dom.createElement('div')\n var me = authn.currentUser()\n var creationContext = {\n // folder: subject,\n div: creationDiv,\n dom: dom,\n noun: noun,\n statusArea: creationDiv,\n me: me,\n refreshTarget: refreshTarget\n }\n const chatPane = context.session.paneRegistry.byName('chat')\n const relevantPanes = [chatPane]\n UI.create.newThingUI(creationContext, context, relevantPanes) // Have to pass panes down newUI\n return creationDiv\n }\n\n async function renderInstances (theClass, noun) {\n const instancesDiv = dom.createElement('div')\n var context = { dom, div: instancesDiv, noun: noun }\n await UI.login.registrationList(context, { public: true, private: true, type: theClass })\n instancesDiv.appendChild(renderCreationControl(instancesDiv, noun))\n return instancesDiv\n }\n\n var otherChatsArea = null\n async function otherChatsHandler (_event) {\n if (!otherChatsArea) { // Lazy build when needed\n // Expand\n otherChatsArea = dom.createElement('div')\n otherChatsArea.style = SIDEBAR_COMPONENT_STYLE\n otherChatsArea.style.maxHeight = triptychHeight\n otherChatsArea.appendChild(panelCloseButton(otherChatsArea))\n\n otherChatsArea.appendChild(await renderInstances(ns.meeting('LongChat'), 'chat'))\n }\n // Toggle visibility with button clicks\n if (paneLeft.contains(otherChatsArea)) {\n otherChatsArea.parentNode.removeChild(otherChatsArea)\n } else {\n paneLeft.appendChild(otherChatsArea)\n }\n } // otherChatsHandler\n\n // People in the chat\n //\n /* Build a participants list drawer the side\n */\n var participantsArea\n function participantsHandler (_event) {\n if (!participantsArea) {\n // Expand\n participantsArea = dom.createElement('div')\n participantsArea.style = SIDEBAR_COMPONENT_STYLE\n participantsArea.style.maxHeight = triptychHeight\n participantsArea.appendChild(panelCloseButton(participantsArea))\n\n // Record my participation and display participants\n var me = authn.currentUser()\n if (!me) alert('Should be logeed in for partipants panel')\n UI.pad.manageParticipation(\n dom,\n participantsArea,\n chatChannel.doc(),\n chatChannel,\n me,\n {}\n )\n }\n // Toggle appearance in sidebar with clicks\n // Note also it can remove itself using the X button\n if (paneLeft.contains(participantsArea)) {\n // Close participants (hide or delete??)\n participantsArea.parentNode.removeChild(participantsArea)\n participantsArea = null\n } else {\n paneLeft.appendChild(participantsArea)\n }\n } // participantsHandler\n\n var chatChannel = subject\n var selectedMessage = null\n if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) {\n // subject is the chatChannel\n console.log('Chat channnel')\n\n // Looks like a message -- might not havre any class declared\n } else if (\n kb.any(subject, ns.sioc('content')) &&\n kb.any(subject, ns.dct('created'))\n ) {\n console.log('message')\n selectedMessage = subject\n chatChannel = kb.any(null, ns.wf('message'), selectedMessage)\n if (!chatChannel) throw new Error('Message has no link to chatChannel')\n }\n\n var div = dom.createElement('div')\n\n // Three large columns for particpant, chat, Preferences. formula below just as a note\n // const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight\n const triptychHeight = '20cm' // @@ need to be able to set to window!\n var triptych = div.appendChild(dom.createElement('table'))\n triptych.style.maxHeight = '12\"' // Screen max\n var paneRow = triptych.appendChild(dom.createElement('tr'))\n var paneLeft = paneRow.appendChild(dom.createElement('td'))\n var paneMiddle = paneRow.appendChild(dom.createElement('td'))\n var paneRight = paneRow.appendChild(dom.createElement('td'))\n var paneBottom = triptych.appendChild(dom.createElement('tr'))\n paneLeft.style = SIDEBAR_STYLE\n paneLeft.style.paddingRight = '1em'\n paneRight.style = SIDEBAR_STYLE\n paneRight.style.paddingLeft = '1em'\n\n paneBottom.appendChild(dom.createElement('td'))\n const buttonCell = paneBottom.appendChild(dom.createElement('td'))\n paneBottom.appendChild(dom.createElement('td'))\n\n // Button to bring up participants drawer on left\n const participantsIcon = 'noun_339237.svg'\n var participantsButton = UI.widgets.button(\n dom,\n UI.icons.iconBase + participantsIcon,\n 'participants ...'\n ) // wider var\n buttonCell.appendChild(participantsButton)\n participantsButton.addEventListener('click', participantsHandler)\n\n // Button to bring up otherChats drawer on left\n const otherChatsIcon = 'noun_1689339.svg' // long chat icon -- not ideal for a set of chats @@\n var otherChatsButton = UI.widgets.button(\n dom,\n UI.icons.iconBase + otherChatsIcon,\n 'List of other chats ...'\n ) // wider var\n buttonCell.appendChild(otherChatsButton)\n otherChatsButton.addEventListener('click', otherChatsHandler)\n\n var preferencesArea = null\n const menuButton = UI.widgets.button(\n dom,\n UI.icons.iconBase + SPANNER_ICON,\n 'Setting ...'\n ) // wider var\n buttonCell.appendChild(menuButton)\n menuButton.style.float = 'right'\n menuButton.addEventListener('click', preferencesButtonPressed)\n\n div.setAttribute('class', 'chatPane')\n const options = { infinite: true }\n const participantsHandlerContext = { noun: 'chat room', div, dom: dom }\n participantsHandlerContext.me = authn.currentUser() // If already logged on\n\n async function buildPane () {\n let prefMap\n try {\n prefMap = await UI.preferences.getPreferencesForClass(\n chatChannel, mainClass, preferenceProperties, participantsHandlerContext)\n } catch (err) {\n UI.widgets.complain(participantsHandlerContext, err)\n }\n for (const propuri in prefMap) {\n options[propuri.split('#')[1]] = prefMap[propuri]\n }\n if (selectedMessage) {\n options.selectedMessage = selectedMessage\n }\n if (paneOptions.solo) {\n // This is the top pane, title, scrollbar etc are ours\n options.solo = true\n }\n const chatControl = await UI.infiniteMessageArea(\n dom,\n kb,\n chatChannel,\n options\n )\n chatControl.style.resize = 'both'\n chatControl.style.overflow = 'auto'\n chatControl.style.maxHeight = triptychHeight\n paneMiddle.appendChild(chatControl)\n }\n buildPane().then(console.log('async - chat pane built'))\n return div\n }\n}\n"],"file":"longChatPane.js"}
|
package/lib/main.js
ADDED
package/lib/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main.js"],"names":["module","exports","shortChatPane","require","longChatPane","getChat"],"mappings":";;AAAAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,aAAa,EAAEC,OAAO,CAAC,iBAAD,CADP;AAEfC,EAAAA,YAAY,EAAED,OAAO,CAAC,gBAAD,CAFN;AAGfE,EAAAA,OAAO,EAAEF,OAAO,CAAC,UAAD,CAAP,CAAoBE;AAHd,CAAjB","sourcesContent":["module.exports = {\n shortChatPane: require('./shortChatPane'),\n longChatPane: require('./longChatPane'),\n getChat: require('./create').getChat\n}\n"],"file":"main.js"}
|