quikchat 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -1,17 +1,30 @@
1
- # quikchat.js
2
- quikchat is a simple vanilla (no dependancies) JavaScript chat control that can be easily integrated into web applications. It provides a customizable chat interface with support for hiding and showing a title area and the input area.
1
+ # QuikChat (js)
2
+
3
+ Quikchat is a vanilla (no dependancies) JavaScript chat control that can be easily integrated into web applications. It provides a customizable chat interface with support for hiding and showing a title area and the input area.
3
4
 
4
5
  ## Features
5
- * Callback function for message events.
6
- * Responsive design for various screen sizes.
7
- * Themeable with css
6
+
7
+ * Callback function for message events
8
+ * Responsive design for various screen sizes and resizes with parent container
9
+ * Themeable with CSS (examples for light and dark)
8
10
  * Hideable/Showable Title and Text Entry areas allows flexibility of usage
11
+ * Full history storage and retrieval
12
+ * History can be fed directly to OpenAI / Mistral / Ollama compatible APIs for context aware chats
13
+ * Available via NPM and CDN
14
+ * Provided in UMD and ESM formats
15
+ * Multiple separate instances can run on a single page
16
+ * Multiple users can be in a chat
17
+ * Left / Right / Center support of individual users
18
+ * Callback for all message events (to monitor chat)
9
19
 
10
- ## Demo
11
- [Example Code and Demo](https://deftio.github.io/quikchat/example.html)
20
+ ## Demo & Examples
12
21
 
22
+ Examples are here
23
+ [Example Code and Demo](../examples/index.html)
24
+ Example include using ESM, UMD modules, running multiple chats on the same page, and integration with LLM providers such as Ollama, LMStudio, OpenAI compatible providers.
13
25
 
14
26
  ## Installation
27
+
15
28
  To use quikchat in your project, follow these steps:
16
29
 
17
30
  Include the quikchat.js JavaScript file in your project.
@@ -23,24 +36,58 @@ html
23
36
  <link rel="stylesheet" href="./path/to/quikchat.css">
24
37
  ```
25
38
 
26
- Create a container element in your HTML where you want the chat interface to appear:
39
+ ### use quikchat Via CDN
40
+
41
+ ```html
42
+ <script src="https://unpkg.com/quikchat"></script>
43
+ <link rel="stylesheet" href="https://unpkg.com/quikchat/dist/quikchat.css" />
44
+ ```
45
+
46
+ Create a container element in your HTML where you want the chat interface to appear. The quikchat widget will take 100% of the paretn container height and width. If the parent container width or height is not specified the quikchat widget may grow as content is added. If the parent container is resized, quikchat will resize with the parent container.
47
+
27
48
  ```html
28
49
  <div id="chat-container"></div>
29
50
  ```
30
51
 
31
52
  Initialize quikchat in your JavaScript code by providing the container element and a callback function for message events:
32
- ```javascript
33
- const chat = new quikchat('#chat-container', messageCallback);
34
- //Use the provided methods to interact with the chat control:
35
-
36
- // Add a message
37
- chat.addMessage('Hello!', 'User', 'left'); // user should appear left or right justified
38
53
 
54
+ ```javascript
55
+ chat = new quikchat(
56
+ "#chat-container", // this can be a css selector such as "#chat-container" or DOM element
57
+ {
58
+ theme: 'quikchat-theme-light', // theme see css
59
+ titleArea: { title: 'My Chat', align: 'left', show: true }, // internal title area
60
+ onSend: (chat, msg) => { // this callback is triggered with the user hits the Send button
61
+ // messages are not automatically echoed to the chat after onSend. This
62
+ // allows filtering / other processing of the message before posting.
63
+ chat.messageAddNew(msg, 'me', 'right'); // echo the message to the chat area
64
+ // now call an LLM or do other actions
65
+ // ... callLLM(msg) ... do other logic if needed.
66
+ }
67
+ });
68
+
69
+ // Add a message at any point not just from call back
70
+ chat.addMessage('Hello!', 'You', 'left'); // user should appear left or right justified
71
+
72
+ //... other logic
73
+ let messageHistory = chat.historyGet(); // get all the messages (see docs for filters)
74
+ console.log(messageHistory); // do something with messages
75
+
76
+ // show / hide the title area
77
+ chat.titleAreaHide(); // hides the title area for a bare chat
78
+
79
+ // hide the input area
80
+ chat.inputAreaHide(); // hides the input area so chat is now just a message stream.
81
+
82
+ // change themes
83
+ chat.changeTheme("quikchat-theme-dark"); // change theme on the fly (see quikchat.css for examples)
39
84
  ```
85
+
40
86
  ## Theming
41
- QuikChat also allows theming using CSS of all the messages, and user area, and overal widget.
42
87
 
43
- Below is the prebuilt 'light' theme. To change the theme, make a new set of classes with different values but the same css selector naming (e.g. change "quikchat-theme-light" to "my-theme") and save as a style. Then pass the "my-theme" to the constructor.
88
+ QuikChat allows theming using CSS of all the messages, and user area, and overal widget.
89
+
90
+ Below is the prebuilt 'light' theme. To change the theme, make a new set of classes with different values but the same css selector naming (e.g. change "quikchat-theme-light" to "my-theme") and save as a style. Then pass the "my-theme" to the constructor or to the changeTheme() function.
44
91
 
45
92
  Themes can be changed at anytime by calling
46
93
  myChatWidget.changeTheme(newTheme) where myChatWidget is the instance of your widget.
@@ -48,60 +95,63 @@ myChatWidget.changeTheme(newTheme) where myChatWidget is the instance of your wi
48
95
  If several widgets are on the same page, each can have a separate theme.
49
96
 
50
97
  ```css
51
-
98
+ /* quikchat theme light */
52
99
  .quikchat-theme-light {
53
- border: 1px solid #cccccc;
54
- border-radius: 10px;
55
- padding: 5px;
56
- background-color: #f9f9f9;
57
- }
58
-
100
+ border: 1px solid #cccccc;
101
+ border-radius: 10px;
102
+ background-color: #f9f9f9;
103
+ }
104
+
59
105
  .quikchat-theme-light .quikchat-title-area {
60
- color: #333;
106
+ padding: 8px;
107
+ color: #333;
61
108
  }
62
-
109
+
63
110
  .quikchat-theme-light .quikchat-messages-area {
64
- background-color: #ffffffe2;
65
- color: #333;
111
+ background-color: #ffffffe2;
112
+ color: #333;
66
113
  }
67
-
114
+
68
115
  .quikchat-theme-light .quikchat-message-1 {
69
- background-color: #fffffff0;
70
- color: #005662;
116
+ background-color: #fffffff0;
117
+ color: #005662;
71
118
  }
72
-
119
+
73
120
  .quikchat-theme-light .quikchat-message-2 {
74
- background-color: #eeeeeee9;
75
- color: #353535;
121
+ background-color: #eeeeeee9;
122
+ color: #353535;
76
123
  }
77
-
124
+
78
125
  .quikchat-theme-light .quikchat-input-area {
79
- background-color: #f0f0f0;
126
+ background-color: #f9f9f9;
127
+ border-bottom-left-radius : 10px;
128
+ border-bottom-right-radius : 10px;
80
129
  }
81
130
 
82
131
  .quikchat-theme-light .quikchat-input-textbox {
83
- background-color: #ffffff;
84
- border: 1px solid #ccc;
85
- border-radius: 4px;
86
- font-size: 14px;
87
- color: #333;
132
+ background-color: #ffffff;
133
+ border: 1px solid #ccc;
134
+ border-radius: 4px;
135
+ font-size: 14px;
136
+ color: #333;
88
137
  }
89
-
138
+
90
139
  .quikchat-theme-light .quikchat-input-send-btn {
91
- background-color: #4caf50;
92
- color: white;
93
- border: none;
94
- border-radius: 4px;
140
+ background-color: #4caf50;
141
+ color: white;
142
+ border: none;
143
+ border-radius: 4px;
95
144
  }
96
-
97
145
  ```
98
146
 
99
147
  ## Building from Source
148
+
149
+ quikchat is built with [https://rollupjs.org/](rollup.js).
150
+
100
151
  Make sure to run npm install. Then run npm run build.
101
- Note that at run time quikchat has no dependancies, but at build time several tools are used for packing and minifying code.
102
152
 
103
- ## Contributors
153
+ Note that at run time quikchat has no dependancies, but at build time several tools are used for packing and minifying code.
104
154
 
105
155
  ## License
106
- quikchat is licensed under the BSD-2 License.
107
156
 
157
+ quikchat is licensed under the BSD-2 License.
@@ -22,12 +22,41 @@ function _createClass(e, r, t) {
22
22
  writable: !1
23
23
  }), e;
24
24
  }
25
+ function _defineProperty(e, r, t) {
26
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
27
+ value: t,
28
+ enumerable: !0,
29
+ configurable: !0,
30
+ writable: !0
31
+ }) : e[r] = t, e;
32
+ }
25
33
  function _iterableToArray(r) {
26
34
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
27
35
  }
28
36
  function _nonIterableSpread() {
29
37
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
30
38
  }
39
+ function ownKeys(e, r) {
40
+ var t = Object.keys(e);
41
+ if (Object.getOwnPropertySymbols) {
42
+ var o = Object.getOwnPropertySymbols(e);
43
+ r && (o = o.filter(function (r) {
44
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
45
+ })), t.push.apply(t, o);
46
+ }
47
+ return t;
48
+ }
49
+ function _objectSpread2(e) {
50
+ for (var r = 1; r < arguments.length; r++) {
51
+ var t = null != arguments[r] ? arguments[r] : {};
52
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
53
+ _defineProperty(e, r, t[r]);
54
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
55
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
56
+ });
57
+ }
58
+ return e;
59
+ }
31
60
  function _toConsumableArray(r) {
32
61
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
33
62
  }
@@ -45,15 +74,6 @@ function _toPropertyKey(t) {
45
74
  var i = _toPrimitive(t, "string");
46
75
  return "symbol" == typeof i ? i : i + "";
47
76
  }
48
- function _typeof(o) {
49
- "@babel/helpers - typeof";
50
-
51
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
52
- return typeof o;
53
- } : function (o) {
54
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
55
- }, _typeof(o);
56
- }
57
77
  function _unsupportedIterableToArray(r, a) {
58
78
  if (r) {
59
79
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
@@ -72,7 +92,12 @@ var quikchat = /*#__PURE__*/function () {
72
92
  var meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
73
93
  theme: 'quikchat-theme-light',
74
94
  onSend: function onSend() {},
75
- trackHistory: true
95
+ trackHistory: true,
96
+ titleArea: {
97
+ title: "Title Area",
98
+ show: false,
99
+ align: "center"
100
+ }
76
101
  };
77
102
  _classCallCheck(this, quikchat);
78
103
  if (typeof parentElement === 'string') {
@@ -85,7 +110,7 @@ var quikchat = /*#__PURE__*/function () {
85
110
  // title area
86
111
  if (meta.titleArea) {
87
112
  this.titleAreaSetContents(meta.titleArea.title, meta.titleArea.align);
88
- if (meta.titleArea.show) {
113
+ if (meta.titleArea.show == true) {
89
114
  this.titleAreaShow();
90
115
  } else {
91
116
  this.titleAreaHide();
@@ -93,6 +118,7 @@ var quikchat = /*#__PURE__*/function () {
93
118
  }
94
119
  this._attachEventListeners();
95
120
  this.trackHistory = meta.trackHistory || true;
121
+ this._historyLimit = 10000000;
96
122
  this._history = [];
97
123
  }
98
124
  return _createClass(quikchat, [{
@@ -108,9 +134,6 @@ var quikchat = /*#__PURE__*/function () {
108
134
  this._sendButton = this._inputArea.querySelector('.quikchat-input-send-btn');
109
135
  this.msgid = 0;
110
136
  }
111
- }, {
112
- key: "$",
113
- value: function $() {}
114
137
  }, {
115
138
  key: "_attachEventListeners",
116
139
  value: function _attachEventListeners() {
@@ -133,6 +156,20 @@ var quikchat = /*#__PURE__*/function () {
133
156
  }
134
157
  });
135
158
  }
159
+ // set the onSend function callback.
160
+ }, {
161
+ key: "setCallbackOnSend",
162
+ value: function setCallbackOnSend(callback) {
163
+ this._onSend = callback;
164
+ }
165
+ // set a callback for everytime a message is added (listener)
166
+ }, {
167
+ key: "setCallbackonMessageAdded",
168
+ value: function setCallbackonMessageAdded(callback) {
169
+ this._onMessageAdded = callback;
170
+ }
171
+
172
+ // Public methods
136
173
  }, {
137
174
  key: "titleAreaToggle",
138
175
  value: function titleAreaToggle() {
@@ -208,59 +245,67 @@ var quikchat = /*#__PURE__*/function () {
208
245
  this._sendButton.style.minWidth = "".concat(minWidth, "px");
209
246
  }
210
247
  }, {
211
- key: "messageAddNew",
212
- value: function messageAddNew(message) {
213
- var userObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "test";
214
- var align = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'left';
215
- var messageDiv = document.createElement('div');
248
+ key: "messageAddFull",
249
+ value: function messageAddFull() {
250
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
251
+ content: "",
252
+ userString: "user",
253
+ align: "right",
254
+ role: "user",
255
+ userID: -1
256
+ };
216
257
  var msgid = this.msgid;
258
+ var messageDiv = document.createElement('div');
217
259
  var msgidClass = 'quikchat-msgid-' + String(msgid).padStart(10, '0');
260
+ 'quikchat-userid-' + String(input.userString).padStart(10, '0'); // hash this..
218
261
  messageDiv.classList.add('quikchat-message', msgidClass);
219
262
  this.msgid++;
220
263
  messageDiv.classList.add(this._messagesArea.children.length % 2 === 1 ? 'quikchat-message-1' : 'quikchat-message-2');
221
- var user = {
222
- name: "not-set",
223
- role: "user"
224
- };
225
- if (_typeof(userObject) === 'object') {
226
- for (var key in userObject) {
227
- user[key] = userObject[key];
228
- }
229
- } else {
230
- // if userObject is a string
231
- user["name"] = userObject;
232
- }
233
264
  var userDiv = document.createElement('div');
234
- userDiv.innerHTML = user.name;
235
- userDiv.style = "width: 100%; text-align: ".concat(align, "; font-size: 1em; font-weight:700; color: #444;");
265
+ userDiv.innerHTML = input.userString;
266
+ userDiv.style = "width: 100%; text-align: ".concat(input.align, "; font-size: 1em; font-weight:700;");
236
267
  var contentDiv = document.createElement('div');
237
- contentDiv.style = "width: 100%; text-align: ".concat(align, ";");
238
- contentDiv.innerHTML = message;
268
+ contentDiv.style = "width: 100%; text-align: ".concat(input.align, ";");
269
+ contentDiv.innerHTML = input.content;
239
270
  messageDiv.appendChild(userDiv);
240
271
  messageDiv.appendChild(contentDiv);
241
272
  this._messagesArea.appendChild(messageDiv);
242
- this._messagesArea.lastChild.scrollIntoView();
273
+ //this._messagesArea.lastChild.scrollIntoView();
274
+ this._messagesArea.lastElementChild.scrollIntoView();
243
275
  this._textEntry.value = '';
244
276
  this._adjustMessagesAreaHeight();
245
277
  var timestamp = new Date().toISOString();
246
278
  var updatedtime = timestamp;
247
279
  if (this.trackHistory) {
248
- this._history.push({
249
- msgid: msgid,
250
- user: user,
251
- message: message,
252
- align: align,
280
+ this._history.push(_objectSpread2(_objectSpread2({
281
+ msgid: msgid
282
+ }, input), {}, {
253
283
  timestamp: timestamp,
254
284
  updatedtime: updatedtime,
255
285
  messageDiv: messageDiv
256
- });
257
- if (this._history.length > 10000000) {
286
+ }));
287
+ if (this._history.length > this._historyLimit) {
258
288
  this._history.shift();
259
289
  }
260
290
  }
261
- return {
262
- msgid: msgid
263
- };
291
+ if (this._onMessageAdded) {
292
+ this._onMessageAdded(this, msgid);
293
+ }
294
+ return msgid;
295
+ }
296
+ }, {
297
+ key: "messageAddNew",
298
+ value: function messageAddNew() {
299
+ var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
300
+ var userString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "user";
301
+ var align = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
302
+ var role = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "user";
303
+ return this.messageAddFull({
304
+ content: content,
305
+ userString: userString,
306
+ align: align,
307
+ role: role
308
+ });
264
309
  }
265
310
  }, {
266
311
  key: "messageRemove",
@@ -274,10 +319,13 @@ var quikchat = /*#__PURE__*/function () {
274
319
  console.log("{String(n)} : Message ID not found");
275
320
  }
276
321
  if (sucess) {
277
- // remove from history
278
- this._history = this._history.filter(function (item) {
279
- return item.msgid !== n;
280
- });
322
+ // slow way to remove from history
323
+ //this._history = this._history.filter((item) => item.msgid !== n); // todo make this more efficient
324
+
325
+ // better way to delete this from history
326
+ this._history.splice(this._history.findIndex(function (item) {
327
+ return item.msgid === n;
328
+ }), 1);
281
329
  }
282
330
  return sucess;
283
331
  }
@@ -303,7 +351,11 @@ var quikchat = /*#__PURE__*/function () {
303
351
  var content = "";
304
352
  // now use css selector to get the message
305
353
  try {
306
- content = this._messagesArea.querySelector(".quikchat-msgid-".concat(String(n).padStart(10, '0'))).lastChild.textContent;
354
+ // get from history..
355
+ content = this._history.filter(function (item) {
356
+ return item.msgid === n;
357
+ })[0].content;
358
+ //content = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.textContent;
307
359
  } catch (error) {
308
360
  console.log("{String(n)} : Message ID not found");
309
361
  }
@@ -318,7 +370,15 @@ var quikchat = /*#__PURE__*/function () {
318
370
  var sucess = false;
319
371
  try {
320
372
  this._messagesArea.querySelector(".quikchat-msgid-".concat(String(n).padStart(10, '0'))).lastChild.innerHTML += content;
373
+ // update history
374
+ var item = this._history.filter(function (item) {
375
+ return item.msgid === n;
376
+ })[0];
377
+ item.content += content;
378
+ item.updatedtime = new Date().toISOString();
321
379
  sucess = true;
380
+ //this._messagesArea.lastChild.scrollIntoView();
381
+ this._messagesArea.lastElementChild.scrollIntoView();
322
382
  } catch (error) {
323
383
  console.log("{String(n)} : Message ID not found");
324
384
  }
@@ -331,6 +391,10 @@ var quikchat = /*#__PURE__*/function () {
331
391
  var sucess = false;
332
392
  try {
333
393
  this._messagesArea.querySelector(".quikchat-msgid-".concat(String(n).padStart(10, '0'))).lastChild.innerHTML = content;
394
+ // update history
395
+ this._history.filter(function (item) {
396
+ return item.msgid === n;
397
+ })[0].content = content;
334
398
  sucess = true;
335
399
  } catch (error) {
336
400
  console.log("{String(n)} : Message ID not found");
@@ -354,6 +418,9 @@ var quikchat = /*#__PURE__*/function () {
354
418
  if (m === undefined) {
355
419
  m = n < 0 ? m : n + 1;
356
420
  }
421
+ // remember that entries could be deleted. TODO: So we need to return the actual history entries
422
+ // so now we need to find the array index that correspondes to messageIds n (start) and m (end)
423
+
357
424
  return this._history.slice(n, m);
358
425
  }
359
426
  }, {
@@ -393,10 +460,12 @@ var quikchat = /*#__PURE__*/function () {
393
460
  return this._theme;
394
461
  }
395
462
  }], [{
396
- key: "getVersion",
397
- value: function getVersion() {
463
+ key: "version",
464
+ value: function version() {
398
465
  return {
399
- "version": "1.0.2"
466
+ "version": "1.0.4",
467
+ "license": "BSD-2",
468
+ "url": "https://github/deftio/quikchat"
400
469
  };
401
470
  }
402
471
  }]);
@@ -1 +1 @@
1
- {"version":3,"file":"quikchat.cjs.js","sources":["../src/quikchat.js"],"sourcesContent":["\nclass quikchat {\n /**\n * \n * @param string or DOM element parentElement \n * @param {*} meta \n */\n constructor(parentElement, \n meta = { \n theme: 'quikchat-theme-light', \n onSend: () => { },\n trackHistory: true,\n }) {\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = meta.onSend ? meta.onSend : () => { };\n this._createWidget();\n // title area\n if (meta.titleArea) {\n this.titleAreaSetContents(meta.titleArea.title, meta.titleArea.align);\n if (meta.titleArea.show) {\n this.titleAreaShow();\n } else {\n this.titleAreaHide();\n }\n }\n this._attachEventListeners();\n this.trackHistory = meta.trackHistory || true;\n this._history = [];\n }\n\n _createWidget() {\n const widgetHTML =\n `\n <div class=\"quikchat-base ${this.theme}\">\n <div class=\"quikchat-title-area\">\n <span style=\"font-size: 1.5em; font-weight: 600;\">Title Area</span>\n </div>\n <div class=\"quikchat-messages-area\"></div>\n <div class=\"quikchat-input-area\">\n <textarea class=\"quikchat-input-textbox\"></textarea>\n <button class=\"quikchat-input-send-btn\">Send</button>\n </div>\n </div>\n `;\n\n this._parentElement.innerHTML = widgetHTML;\n this._chatWidget = this._parentElement.querySelector('.quikchat-base');\n this._titleArea = this._chatWidget.querySelector('.quikchat-title-area');\n this._messagesArea = this._chatWidget.querySelector('.quikchat-messages-area');\n this._inputArea = this._chatWidget.querySelector('.quikchat-input-area');\n this._textEntry = this._inputArea.querySelector('.quikchat-input-textbox');\n this._sendButton = this._inputArea.querySelector('.quikchat-input-send-btn');\n this.msgid = 0;\n }\n $() {\n }\n _attachEventListeners() {\n this._sendButton.addEventListener('click', () => this._onSend(this, this._textEntry.value.trim()));\n window.addEventListener('resize', () => this._handleContainerResize());\n this._chatWidget.addEventListener('resize', () => this._handleContainerResize());\n this._textEntry.addEventListener('keydown', (event) => {\n // Check if Shift + Enter is pressed\n if (event.shiftKey && event.keyCode === 13) {\n // Prevent default behavior (adding new line)\n event.preventDefault();\n this._onSend(this, this._textEntry.value.trim())\n }\n });\n }\n\n titleAreaToggle() {\n this._titleArea.style.display === 'none' ? this.titleAreaShow() : this.titleAreaHide();\n }\n\n titleAreaShow() {\n this._titleArea.style.display = '';\n this._adjustMessagesAreaHeight();\n }\n\n titleAreaHide() {\n this._titleArea.style.display = 'none';\n this._adjustMessagesAreaHeight();\n }\n\n titleAreaSetContents(title, align = 'center') {\n this._titleArea.innerHTML = title;\n this._titleArea.style.textAlign = align;\n }\n\n titleAreaGetContents() {\n return this._titleArea.innerHTML;\n }\n\n inputAreaToggle() {\n this._inputArea.classList.toggle('hidden');\n this._inputArea.style.display === 'none' ? this.inputAreaShow() : this.inputAreaHide();\n }\n\n inputAreaShow() {\n this._inputArea.style.display = '';\n this._adjustMessagesAreaHeight();\n }\n\n inputAreaHide() {\n this._inputArea.style.display = 'none';\n this._adjustMessagesAreaHeight();\n }\n\n _adjustMessagesAreaHeight() {\n const hiddenElements = [...this._chatWidget.children].filter(child => child.classList.contains('hidden'));\n const totalHiddenHeight = hiddenElements.reduce((sum, child) => sum + child.offsetHeight, 0);\n const containerHeight = this._chatWidget.offsetHeight;\n this._messagesArea.style.height = `calc(100% - ${containerHeight - totalHiddenHeight}px)`;\n }\n\n _handleContainerResize() {\n this._adjustMessagesAreaHeight();\n this._adjustSendButtonWidth();\n //console.log('Container resized');\n }\n\n _adjustSendButtonWidth() {\n const sendButtonText = this._sendButton.textContent.trim();\n const fontSize = parseFloat(getComputedStyle(this._sendButton).fontSize);\n const minWidth = fontSize * sendButtonText.length + 16;\n this._sendButton.style.minWidth = `${minWidth}px`;\n }\n\n messageAddNew(message, userObject = \"test\", align = 'left') {\n const messageDiv = document.createElement('div');\n const msgid = this.msgid;\n const msgidClass = 'quikchat-msgid-' + String(msgid).padStart(10, '0');\n messageDiv.classList.add('quikchat-message', msgidClass);\n this.msgid++;\n messageDiv.classList.add(this._messagesArea.children.length % 2 === 1 ? 'quikchat-message-1' : 'quikchat-message-2');\n let user = {name: \"not-set\",role : \"user\"};\n if (typeof userObject === 'object') {\n for (const key in userObject) {\n user[key] = userObject[key];\n }\n }\n else { // if userObject is a string\n user[\"name\"] = userObject ;\n }\n const userDiv = document.createElement('div');\n userDiv.innerHTML = user.name;\n userDiv.style = `width: 100%; text-align: ${align}; font-size: 1em; font-weight:700; color: #444;`;\n\n const contentDiv = document.createElement('div');\n contentDiv.style = `width: 100%; text-align: ${align};`;\n contentDiv.innerHTML = message;\n\n messageDiv.appendChild(userDiv);\n messageDiv.appendChild(contentDiv);\n this._messagesArea.appendChild(messageDiv);\n this._messagesArea.lastChild.scrollIntoView();\n\n this._textEntry.value = '';\n this._adjustMessagesAreaHeight();\n const timestamp = new Date().toISOString();\n const updatedtime = timestamp;\n if (this.trackHistory) {\n this._history.push({ msgid, user, message, align, timestamp, updatedtime, messageDiv});\n if (this._history.length > 10000000) {\n this._history.shift();\n }\n }\n return {msgid};\n }\n\n messageRemove(n) {\n // use css selector to remove the message\n let sucess = false;\n try {\n this._messagesArea.removeChild(this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`));\n sucess = true;\n }\n catch (error) {\n console.log(`{String(n)} : Message ID not found`);\n }\n if (sucess) {\n // remove from history\n this._history = this._history.filter((item) => item.msgid !== n);\n }\n return sucess;\n }\n /* returns the message html object from the DOM\n */\n messageGetDOMObject(n) {\n let msg = null;\n // now use css selector to get the message \n try {\n msg = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n }\n return msg; \n }\n /* returns the message content only\n */\n messageGetContent(n) {\n let content = \"\"\n // now use css selector to get the message \n try {\n content = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.textContent;\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n }\n return content; \n }\n\n /* append message to the message content\n */\n messageAppendContent(n, content) {\n let sucess = false;\n try {\n this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.innerHTML += content;\n sucess = true;\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n } \n }\n /* replace message content\n */\n messageReplaceContent(n, content) {\n let sucess = false;\n try {\n this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.innerHTML = content;\n sucess = true;\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n }\n return sucess;\n }\n // history functions\n /**\n * \n * @param {*} n \n * @param {*} m \n * @returns array of history messages\n */\n historyGet(n,m) {\n\n if (n == undefined) {\n n = 0;\n m= this._history.length;\n }\n if (m === undefined) {\n m = n < 0 ? m: n + 1;\n }\n return this._history.slice(n,m);\n }\n\n historyClear() {\n this.msgid = 0;\n this._history = [];\n } \n\n historyGetLength() {\n return this._history.length;\n } \n\n historyGetMessage(n) {\n if ( n>=0 && n < this._history.length) {\n this._history[n];\n }\n return {};\n\n } \n\n historyGetMessageContent(n) {\n return this._history[n].message;\n }\n\n\n changeTheme(newTheme) {\n this._chatWidget.classList.remove(this._theme);\n this._chatWidget.classList.add(newTheme);\n this._theme = newTheme;\n }\n\n get theme() {\n return this._theme;\n }\n\n static getVersion() {\n return {\"version\" : \"1.0.2\"}\n }\n}\n\nexport default quikchat;\n"],"names":["quikchat","parentElement","meta","arguments","length","undefined","theme","onSend","trackHistory","_classCallCheck","document","querySelector","_parentElement","_theme","_onSend","_createWidget","titleArea","titleAreaSetContents","title","align","show","titleAreaShow","titleAreaHide","_attachEventListeners","_history","_createClass","key","value","widgetHTML","concat","innerHTML","_chatWidget","_titleArea","_messagesArea","_inputArea","_textEntry","_sendButton","msgid","$","_this","addEventListener","trim","window","_handleContainerResize","event","shiftKey","keyCode","preventDefault","titleAreaToggle","style","display","_adjustMessagesAreaHeight","textAlign","titleAreaGetContents","inputAreaToggle","classList","toggle","inputAreaShow","inputAreaHide","hiddenElements","_toConsumableArray","children","filter","child","contains","totalHiddenHeight","reduce","sum","offsetHeight","containerHeight","height","_adjustSendButtonWidth","sendButtonText","textContent","fontSize","parseFloat","getComputedStyle","minWidth","messageAddNew","message","userObject","messageDiv","createElement","msgidClass","String","padStart","add","user","name","role","_typeof","userDiv","contentDiv","appendChild","lastChild","scrollIntoView","timestamp","Date","toISOString","updatedtime","push","shift","messageRemove","n","sucess","removeChild","error","console","log","item","messageGetDOMObject","msg","messageGetContent","content","messageAppendContent","messageReplaceContent","historyGet","m","slice","historyClear","historyGetLength","historyGetMessage","historyGetMessageContent","changeTheme","newTheme","remove","get","getVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACMA,QAAQ,gBAAA,YAAA;AACV;AACJ;AACA;AACA;AACA;EACI,SAAAA,QAAAA,CAAYC,aAAa,EAKlB;IAAA,IAJHC,IAAI,GAAAC,SAAA,CAAAC,MAAA,GAAAD,CAAAA,IAAAA,SAAA,CAAAE,CAAAA,CAAAA,KAAAA,SAAA,GAAAF,SAAA,CAAG,CAAA,CAAA,GAAA;AACHG,MAAAA,KAAK,EAAE,sBAAsB;AAC7BC,MAAAA,MAAM,EAAE,SAAAA,MAAA,GAAM,EAAG;AACjBC,MAAAA,YAAY,EAAE,IAAA;KACjB,CAAA;AAAAC,IAAAA,eAAA,OAAAT,QAAA,CAAA,CAAA;AACD,IAAA,IAAI,OAAOC,aAAa,KAAK,QAAQ,EAAE;AACnCA,MAAAA,aAAa,GAAGS,QAAQ,CAACC,aAAa,CAACV,aAAa,CAAC,CAAA;AACzD,KAAA;IACA,IAAI,CAACW,cAAc,GAAGX,aAAa,CAAA;AACnC,IAAA,IAAI,CAACY,MAAM,GAAGX,IAAI,CAACI,KAAK,CAAA;AACxB,IAAA,IAAI,CAACQ,OAAO,GAAGZ,IAAI,CAACK,MAAM,GAAGL,IAAI,CAACK,MAAM,GAAG,YAAM,EAAG,CAAA;IACpD,IAAI,CAACQ,aAAa,EAAE,CAAA;AACpB;IACA,IAAIb,IAAI,CAACc,SAAS,EAAE;AAChB,MAAA,IAAI,CAACC,oBAAoB,CAACf,IAAI,CAACc,S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.js","sources":["../src/quikchat.js"],"sourcesContent":["\nclass quikchat {\n /**\n * \n * @param string or DOM element parentElement \n * @param {*} meta \n */\n constructor(parentElement, \n meta = { \n theme: 'quikchat-theme-light', \n onSend: () => { }, \n trackHistory: true,\n titleArea: {title: \"Title Area\", show: false, align: \"center\"}\n }) \n {\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = meta.onSend ? meta.onSend : () => { };\n this._createWidget();\n // title area\n if (meta.titleArea) {\n this.titleAreaSetContents(meta.titleArea.title, meta.titleArea.align);\n if (meta.titleArea.show == true) {\n this.titleAreaShow();\n } else {\n this.titleAreaHide();\n }\n }\n this._attachEventListeners();\n this.trackHistory = meta.trackHistory || true;\n this._historyLimit = 10000000;\n this._history = [];\n }\n\n _createWidget() {\n const widgetHTML =\n `\n <div class=\"quikchat-base ${this.theme}\">\n <div class=\"quikchat-title-area\">\n <span style=\"font-size: 1.5em; font-weight: 600;\">Title Area</span>\n </div>\n <div class=\"quikchat-messages-area\"></div>\n <div class=\"quikchat-input-area\">\n <textarea class=\"quikchat-input-textbox\"></textarea>\n <button class=\"quikchat-input-send-btn\">Send</button>\n </div>\n </div>\n `;\n\n this._parentElement.innerHTML = widgetHTML;\n this._chatWidget = this._parentElement.querySelector('.quikchat-base');\n this._titleArea = this._chatWidget.querySelector('.quikchat-title-area');\n this._messagesArea = this._chatWidget.querySelector('.quikchat-messages-area');\n this._inputArea = this._chatWidget.querySelector('.quikchat-input-area');\n this._textEntry = this._inputArea.querySelector('.quikchat-input-textbox');\n this._sendButton = this._inputArea.querySelector('.quikchat-input-send-btn');\n this.msgid = 0;\n }\n\n _attachEventListeners() {\n this._sendButton.addEventListener('click', () => this._onSend(this, this._textEntry.value.trim()));\n window.addEventListener('resize', () => this._handleContainerResize());\n this._chatWidget.addEventListener('resize', () => this._handleContainerResize());\n this._textEntry.addEventListener('keydown', (event) => {\n // Check if Shift + Enter is pressed\n if (event.shiftKey && event.keyCode === 13) {\n // Prevent default behavior (adding new line)\n event.preventDefault();\n this._onSend(this, this._textEntry.value.trim())\n }\n });\n }\n // set the onSend function callback.\n setCallbackOnSend(callback) {\n this._onSend = callback;\n }\n // set a callback for everytime a message is added (listener)\n setCallbackonMessageAdded(callback) {\n this._onMessageAdded = callback;\n }\n\n // Public methods\n titleAreaToggle() {\n this._titleArea.style.display === 'none' ? this.titleAreaShow() : this.titleAreaHide();\n }\n\n titleAreaShow() {\n this._titleArea.style.display = '';\n this._adjustMessagesAreaHeight();\n }\n\n titleAreaHide() {\n this._titleArea.style.display = 'none';\n this._adjustMessagesAreaHeight();\n }\n\n titleAreaSetContents(title, align = 'center') {\n this._titleArea.innerHTML = title;\n this._titleArea.style.textAlign = align;\n }\n\n titleAreaGetContents() {\n return this._titleArea.innerHTML;\n }\n\n inputAreaToggle() {\n this._inputArea.classList.toggle('hidden');\n this._inputArea.style.display === 'none' ? this.inputAreaShow() : this.inputAreaHide();\n }\n\n inputAreaShow() {\n this._inputArea.style.display = '';\n this._adjustMessagesAreaHeight();\n }\n\n inputAreaHide() {\n this._inputArea.style.display = 'none';\n this._adjustMessagesAreaHeight();\n }\n\n _adjustMessagesAreaHeight() {\n const hiddenElements = [...this._chatWidget.children].filter(child => child.classList.contains('hidden'));\n const totalHiddenHeight = hiddenElements.reduce((sum, child) => sum + child.offsetHeight, 0);\n const containerHeight = this._chatWidget.offsetHeight;\n this._messagesArea.style.height = `calc(100% - ${containerHeight - totalHiddenHeight}px)`;\n }\n\n _handleContainerResize() {\n this._adjustMessagesAreaHeight();\n this._adjustSendButtonWidth();\n //console.log('Container resized');\n }\n\n _adjustSendButtonWidth() {\n const sendButtonText = this._sendButton.textContent.trim();\n const fontSize = parseFloat(getComputedStyle(this._sendButton).fontSize);\n const minWidth = fontSize * sendButtonText.length + 16;\n this._sendButton.style.minWidth = `${minWidth}px`;\n }\n \n messageAddFull(input = {content: \"\", userString: \"user\", align : \"right\", role : \"user\", userID : -1}) {\n const msgid = this.msgid;\n const messageDiv = document.createElement('div');\n const msgidClass = 'quikchat-msgid-' + String(msgid).padStart(10, '0');\n const userIdClass = 'quikchat-userid-' + String(input.userString).padStart(10, '0'); // hash this..\n messageDiv.classList.add('quikchat-message', msgidClass);\n this.msgid++;\n messageDiv.classList.add(this._messagesArea.children.length % 2 === 1 ? 'quikchat-message-1' : 'quikchat-message-2');\n \n const userDiv = document.createElement('div');\n userDiv.innerHTML = input.userString;\n userDiv.style = `width: 100%; text-align: ${input.align}; font-size: 1em; font-weight:700;`;\n\n const contentDiv = document.createElement('div');\n contentDiv.style = `width: 100%; text-align: ${input.align};`;\n contentDiv.innerHTML = input.content;\n\n messageDiv.appendChild(userDiv);\n messageDiv.appendChild(contentDiv);\n this._messagesArea.appendChild(messageDiv);\n //this._messagesArea.lastChild.scrollIntoView();\n this._messagesArea.lastElementChild.scrollIntoView()\n\n this._textEntry.value = '';\n this._adjustMessagesAreaHeight();\n const timestamp = new Date().toISOString();\n const updatedtime = timestamp;\n if (this.trackHistory) {\n this._history.push({ msgid, ...input, timestamp, updatedtime, messageDiv});\n if (this._history.length > this._historyLimit) {\n this._history.shift();\n }\n }\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n };\n return msgid;\n }\n messageAddNew(content=\"\", userString=\"user\", align = \"right\", role = \"user\") {\n return this.messageAddFull( \n {content: content, userString: userString, align: align, role: role}\n );\n }\n messageRemove(n) {\n // use css selector to remove the message\n let sucess = false;\n try {\n this._messagesArea.removeChild(this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`));\n sucess = true;\n }\n catch (error) {\n console.log(`{String(n)} : Message ID not found`);\n }\n if (sucess) {\n // slow way to remove from history\n //this._history = this._history.filter((item) => item.msgid !== n); // todo make this more efficient\n\n // better way to delete this from history\n this._history.splice(this._history.findIndex((item) => item.msgid === n), 1);\n }\n return sucess;\n }\n /* returns the message html object from the DOM\n */\n messageGetDOMObject(n) {\n let msg = null;\n // now use css selector to get the message \n try {\n msg = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`);\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n }\n return msg; \n }\n /* returns the message content only\n */\n messageGetContent(n) {\n let content = \"\"\n // now use css selector to get the message \n try {\n // get from history..\n content = this._history.filter((item) => item.msgid === n)[0].content;\n //content = this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.textContent;\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n }\n return content; \n }\n\n /* append message to the message content\n */\n messageAppendContent(n, content) {\n let sucess = false;\n try {\n this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.innerHTML += content;\n // update history\n let item = this._history.filter((item) => item.msgid === n)[0];\n item.content += content;\n item.updatedtime = new Date().toISOString();\n sucess = true;\n //this._messagesArea.lastChild.scrollIntoView();\n this._messagesArea.lastElementChild.scrollIntoView()\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n } \n }\n /* replace message content\n */\n messageReplaceContent(n, content) {\n let sucess = false;\n try {\n this._messagesArea.querySelector(`.quikchat-msgid-${String(n).padStart(10, '0')}`).lastChild.innerHTML = content;\n // update history\n this._history.filter((item) => item.msgid === n)[0].content = content;\n sucess = true;\n } \n catch (error) \n {\n console.log(`{String(n)} : Message ID not found`);\n }\n return sucess;\n }\n // history functions\n /**\n * \n * @param {*} n \n * @param {*} m \n * @returns array of history messages\n */\n historyGet(n,m) {\n\n if (n == undefined) {\n n = 0;\n m= this._history.length;\n }\n if (m === undefined) {\n m = n < 0 ? m: n + 1;\n }\n // remember that entries could be deleted. TODO: So we need to return the actual history entries\n // so now we need to find the array index that correspondes to messageIds n (start) and m (end)\n \n return this._history.slice(n,m);\n }\n\n historyClear() {\n this.msgid = 0;\n this._history = [];\n } \n\n historyGetLength() {\n return this._history.length;\n } \n\n historyGetMessage(n) {\n if ( n>=0 && n < this._history.length) {\n this._history[n];\n }\n return {};\n\n } \n\n historyGetMessageContent(n) {\n return this._history[n].message;\n }\n\n\n changeTheme(newTheme) {\n this._chatWidget.classList.remove(this._theme);\n this._chatWidget.classList.add(newTheme);\n this._theme = newTheme;\n }\n\n get theme() {\n return this._theme;\n }\n\n static version() {\n return {\"version\" : \"1.0.4\", \"license\" : \"BSD-2\", \"url\" :\"https://github/deftio/quikchat\"};\n }\n}\n\nexport default quikchat;\n"],"names":["quikchat","parentElement","meta","arguments","length","undefined","theme","onSend","trackHistory","titleArea","title","show","align","_classCallCheck","document","querySelector","_parentElement","_theme","_onSend","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","_attachEventListeners","_historyLimit","_history","_createClass","key","value","widgetHTML","concat","innerHTML","_chatWidget","_titleArea","_messagesArea","_inputArea","_textEntry","_sendButton","msgid","_this","addEventListener","trim","window","_handleContainerResize","event","shiftKey","keyCode","preventDefault","setCallbackOnSend","callback","setCallbackonMessageAdded","_onMessageAdded","titleAreaToggle","style","display","_adjustMessagesAreaHeight","textAlign","titleAreaGetContents","inputAreaToggle","classList","toggle","inputAreaShow","inputAreaHide","hiddenElements","_toConsumableArray","children","filter","child","contains","totalHiddenHeight","reduce","sum","offsetHeight","containerHeight","height","_adjustSendButtonWidth","sendButtonText","textContent","fontSize","parseFloat","getComputedStyle","minWidth","messageAddFull","input","content","userString","role","userID","messageDiv","createElement","msgidClass","String","padStart","add","userDiv","contentDiv","appendChild","lastElementChild","scrollIntoView","timestamp","Date","toISOString","updatedtime","push","_objectSpread","shift","messageAddNew","messageRemove","n","sucess","removeChild","error","console","log","splice","findIndex","item","messageGetDOMObject","msg","messageGetContent","messageAppendContent","lastChild","messageReplaceContent","historyGet","m","slice","historyClear","historyGetLength","historyGetMessage","historyGetMessageContent","message","changeTheme","newTheme","remove","get","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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