quikchat 1.1.2 → 1.1.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 +59 -25
- package/dist/quikchat.cjs.js +16 -1
- package/dist/quikchat.cjs.js.map +1 -1
- package/dist/quikchat.cjs.min.js +1 -1
- package/dist/quikchat.cjs.min.js.map +1 -1
- package/dist/quikchat.css +16 -5
- package/dist/quikchat.esm.js +16 -1
- package/dist/quikchat.esm.js.map +1 -1
- package/dist/quikchat.esm.min.js +1 -1
- package/dist/quikchat.esm.min.js.map +1 -1
- package/dist/quikchat.min.css +2 -0
- package/dist/quikchat.umd.js +16 -1
- package/dist/quikchat.umd.js.map +1 -1
- package/dist/quikchat.umd.min.js +1 -1
- package/dist/quikchat.umd.min.js.map +1 -1
- package/package.json +30 -7
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
[](https://opensource.org/licenses/BSD-2-Clause)
|
|
2
|
+
[](https://www.npmjs.com/package/quikchat)
|
|
3
|
+

|
|
4
|
+
|
|
1
5
|
# QuikChat (js)
|
|
2
6
|
|
|
3
7
|
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.
|
|
@@ -5,23 +9,25 @@ Quikchat is a vanilla (no dependancies) JavaScript chat control that can be easi
|
|
|
5
9
|
## Features
|
|
6
10
|
|
|
7
11
|
* Themeable with CSS (examples for light and dark)
|
|
8
|
-
* Callback function for all message events (allows monitoring)
|
|
9
12
|
* Responsive design for various screen sizes and resizes with parent container
|
|
10
13
|
* Hideable/Showable Title and Text Entry areas allows flexibility of usage
|
|
11
14
|
* Full message history storage and retrieval
|
|
12
15
|
* History can be fed directly to OpenAI / Mistral / Ollama compatible APIs for context aware chats
|
|
13
|
-
* Available via NPM
|
|
14
|
-
* Provided in UMD and ESM formats
|
|
16
|
+
* Available via NPM, CDN or source via github
|
|
17
|
+
* Provided in UMD and ESM formats (minified)
|
|
15
18
|
* Multiple separate instances can run on a single page
|
|
16
19
|
* Multiple users can be in a chat
|
|
20
|
+
* Messages can be searched, appended to (streamed token completion), replaced, or removed.
|
|
17
21
|
* Left / Right / Center support of individual users
|
|
18
22
|
* Callback for all message events (to monitor chat)
|
|
19
23
|
|
|
20
24
|
## Demo & Examples
|
|
25
|
+
[Simple Demo](https://deftio.github.io/quikchat/examples/example_umd.html)
|
|
26
|
+
|
|
27
|
+
Full Examples are in the repo examples folder:
|
|
28
|
+
[Example Code and Demo](./examples/index.html).
|
|
21
29
|
|
|
22
|
-
Examples
|
|
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.
|
|
30
|
+
Examples include using ESM, UMD modules, theming, running multiple chats on the same page, and integration with LLM providers such as Ollama, LMStudio, OpenAI compatible providers.
|
|
25
31
|
|
|
26
32
|
## Installation
|
|
27
33
|
|
|
@@ -46,28 +52,37 @@ html
|
|
|
46
52
|
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
53
|
|
|
48
54
|
```html
|
|
55
|
+
<style>
|
|
56
|
+
#chat-container {width: 100%; height: 50vh;} /* use any width / height as appropriate for your app */
|
|
57
|
+
</style>
|
|
49
58
|
<div id="chat-container"></div>
|
|
50
59
|
```
|
|
51
60
|
|
|
52
61
|
Initialize quikchat in your JavaScript code by providing the container element and a callback function for message events:
|
|
53
62
|
|
|
63
|
+
See /examples for full working code.
|
|
64
|
+
|
|
54
65
|
```javascript
|
|
55
66
|
chat = new quikchat(
|
|
56
67
|
"#chat-container", // this can be a css selector such as "#chat-container" or DOM element
|
|
57
68
|
{
|
|
58
|
-
theme: 'quikchat-theme-light', // theme see css
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// messages are not automatically echoed to the chat after onSend. This
|
|
69
|
+
theme: 'quikchat-theme-light', // set theme, see quikchat.css
|
|
70
|
+
(chat, msg) => { // this callback triggered when user hits the Send
|
|
71
|
+
// messages are not automatically echoed.
|
|
62
72
|
// allows filtering / other processing of the message before posting.
|
|
63
|
-
chat.messageAddNew(msg, 'me', 'right'); // echo
|
|
64
|
-
|
|
73
|
+
chat.messageAddNew(msg, 'me', 'right'); // echo msg to chat area
|
|
74
|
+
|
|
75
|
+
// now call an LLM or do other actions with msg
|
|
65
76
|
// ... callLLM(msg) ... do other logic if needed.
|
|
77
|
+
// or callLLM(chat.historyGet()); // pass full history (can also filter)
|
|
66
78
|
}
|
|
79
|
+
titleArea: { title: 'My Chat', align: 'left', show: true }, // internal title area if desired
|
|
67
80
|
});
|
|
68
81
|
|
|
69
|
-
// Add a message at any point not just from
|
|
70
|
-
chat.
|
|
82
|
+
// Add a message at any point not just from callback
|
|
83
|
+
chat.messageAddNew('Hello!', 'You', 'left'); // user should appear left or right justified
|
|
84
|
+
chat.messageAddNew('Hello!', 'Them', 'right'); // user should appear left or right justified
|
|
85
|
+
|
|
71
86
|
|
|
72
87
|
//... other logic
|
|
73
88
|
let messageHistory = chat.historyGet(); // get all the messages (see docs for filters)
|
|
@@ -79,7 +94,7 @@ chat.titleAreaHide(); // hides the title area for a bare chat
|
|
|
79
94
|
// hide the input area
|
|
80
95
|
chat.inputAreaHide(); // hides the input area so chat is now just a message stream.
|
|
81
96
|
|
|
82
|
-
// change themes
|
|
97
|
+
// change themes at any time
|
|
83
98
|
chat.changeTheme("quikchat-theme-dark"); // change theme on the fly (see quikchat.css for examples)
|
|
84
99
|
```
|
|
85
100
|
|
|
@@ -111,17 +126,18 @@ If several widgets are on the same page, each can have a separate theme.
|
|
|
111
126
|
background-color: #ffffffe2;
|
|
112
127
|
color: #333;
|
|
113
128
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
|
|
130
|
+
/* support for alternating row styles */
|
|
131
|
+
.quikchat-theme-light .quikchat-messages-area-alt .quikchat-message:nth-child(odd) {
|
|
132
|
+
background-color: #fffffff0;
|
|
133
|
+
color: #005662;
|
|
118
134
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
color: #353535;
|
|
135
|
+
.quikchat-theme-light .quikchat-messages-area-alt .quikchat-message:nth-child(even) {
|
|
136
|
+
background-color: #eeeeeee9;
|
|
137
|
+
color: #353535;
|
|
123
138
|
}
|
|
124
|
-
|
|
139
|
+
|
|
140
|
+
/* input area / text entry / send button */
|
|
125
141
|
.quikchat-theme-light .quikchat-input-area {
|
|
126
142
|
background-color: #f9f9f9;
|
|
127
143
|
border-bottom-left-radius : 10px;
|
|
@@ -146,12 +162,30 @@ If several widgets are on the same page, each can have a separate theme.
|
|
|
146
162
|
|
|
147
163
|
## Building from Source
|
|
148
164
|
|
|
149
|
-
quikchat is built with [https://rollupjs.org/
|
|
165
|
+
quikchat is built with [rollup.js](https://rollupjs.org/).
|
|
150
166
|
|
|
151
167
|
Make sure to run npm install. Then run npm run build.
|
|
152
168
|
|
|
153
169
|
Note that at run time quikchat has no dependancies, but at build time several tools are used for packing and minifying code.
|
|
154
170
|
|
|
171
|
+
## Testing
|
|
172
|
+
|
|
173
|
+
quikchat is tested with the jest framwork. To run unit tests and see coverage run:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npm run test
|
|
177
|
+
```
|
|
178
|
+
|
|
155
179
|
## License
|
|
156
180
|
|
|
157
181
|
quikchat is licensed under the BSD-2 License.
|
|
182
|
+
|
|
183
|
+
## Home Page
|
|
184
|
+
|
|
185
|
+
[quikchat homepage and source code](https://githhub.com/deftio/quikchat)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
package/dist/quikchat.cjs.js
CHANGED
|
@@ -511,6 +511,11 @@ var quikchat = /*#__PURE__*/function () {
|
|
|
511
511
|
value: function historyGetMessageContent(n) {
|
|
512
512
|
return this._history[n].message;
|
|
513
513
|
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
*
|
|
517
|
+
* @param {string} newTheme
|
|
518
|
+
*/
|
|
514
519
|
}, {
|
|
515
520
|
key: "changeTheme",
|
|
516
521
|
value: function changeTheme(newTheme) {
|
|
@@ -518,16 +523,26 @@ var quikchat = /*#__PURE__*/function () {
|
|
|
518
523
|
this._chatWidget.classList.add(newTheme);
|
|
519
524
|
this._theme = newTheme;
|
|
520
525
|
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Get the current theme
|
|
529
|
+
* @returns {string} - The current theme
|
|
530
|
+
*/
|
|
521
531
|
}, {
|
|
522
532
|
key: "theme",
|
|
523
533
|
get: function get() {
|
|
524
534
|
return this._theme;
|
|
525
535
|
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
*
|
|
539
|
+
* @returns {object} - Returns the version and license information for the library.
|
|
540
|
+
*/
|
|
526
541
|
}], [{
|
|
527
542
|
key: "version",
|
|
528
543
|
value: function version() {
|
|
529
544
|
return {
|
|
530
|
-
"version": "1.1.
|
|
545
|
+
"version": "1.1.4",
|
|
531
546
|
"license": "BSD-2",
|
|
532
547
|
"url": "https://github/deftio/quikchat"
|
|
533
548
|
};
|
package/dist/quikchat.cjs.js.map
CHANGED
|
@@ -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, onSend = () => { }, options = {}) {\n const defaultOpts = {\n theme: 'quikchat-theme-light',\n trackHistory: true,\n titleArea: { title: \"Chat\", show: false, align: \"center\" },\n messagesArea: { alternating: true },\n };\n const meta = { ...defaultOpts, ...options }; // merge options with defaults\n\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n //console.log(parentElement, meta);\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = onSend ? onSend : () => { }; // call back function for 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 // messages area\n if (meta.messagesArea) {\n this.messagesAreaAlternateColors(meta.messagesArea.alternating);\n }\n // plumbing\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 /**\n * Attach event listeners to the widget\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 this._messagesArea.addEventListener('scroll', () => {\n const { scrollTop, scrollHeight, clientHeight } = this._messagesArea;\n this.userScrolledUp = scrollTop + clientHeight < scrollHeight;\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 //messagesArea functions\n messagesAreaAlternateColors(alt = true) {\n if (alt) {\n this._messagesArea.classList.add('quikchat-messages-area-alt');\n }\n else {\n this._messagesArea.classList.remove('quikchat-messages-area-alt');\n }\n return alt === true;\n }\n messagesAreaAlternateColorsToggle() {\n this._messagesArea.classList.toggle('quikchat-messages-area-alt');\n }\n messagesAreaAlternateColorsGet() {\n return this._messagesArea.classList.contains('quikchat-messages-area-alt');\n }\n // message functions\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\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n\n this._textEntry.value = '';\n this._adjustMessagesAreaHeight();\n const timestamp = new Date().toISOString();\n const updatedtime = timestamp;\n\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\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n }\n\n return msgid;\n }\n\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 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 console.log(`{String(n)} : Message ID not found`);\n }\n return content;\n }\n\n /* append message to the message content\n */\n\n messageAppendContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\n \n /* replace message content\n */\n messageReplaceContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\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.1.2\", \"license\": \"BSD-2\", \"url\": \"https://github/deftio/quikchat\" };\n }\n\n /**\n * quikchat.loremIpsum() - Generate a simple string of Lorem Ipsum text (sample typographer's text) of numChars in length.\n * borrowed from github.com/deftio/bitwrench.js\n * @param {number} numChars - The number of characters to generate (random btw 25 and 150 if undefined). \n * @param {number} [startSpot=0] - The starting index in the Lorem Ipsum text. If undefined, a random startSpot will be generated.\n * @param {boolean} [startWithCapitalLetter=true] - If true, capitalize the first character or inject a capital letter if the first character isn't a capital letter.\n * \n * @returns {string} A string of Lorem Ipsum text.\n * \n * @example \n * // Returns 200 characters of Lorem Ipsum starting from index 50\n * loremIpsum(200, 50);\n * \n * @example \n * //Returns a 200 Lorem Ipsum characters starting from a random index\n * loremIpsum(200);\n */\n\n static loremIpsum(numChars, startSpot = undefined, startWithCapitalLetter = true) {\n const loremText = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \";\n\n if (typeof numChars !== \"number\") {\n numChars = Math.floor(Math.random() * (150)) + 25;\n }\n\n if (startSpot === undefined) {\n startSpot = Math.floor(Math.random() * loremText.length);\n }\n\n startSpot = startSpot % loremText.length;\n\n // Move startSpot to the next non-whitespace and non-punctuation character\n while (loremText[startSpot] === ' ' || /[.,:;!?]/.test(loremText[startSpot])) {\n startSpot = (startSpot + 1) % loremText.length;\n }\n\n let l = loremText.substring(startSpot) + loremText.substring(0, startSpot);\n\n if (typeof numChars !== \"number\") {\n numChars = l.length;\n }\n\n let s = \"\";\n while (numChars > 0) {\n s += numChars < l.length ? l.substring(0, numChars) : l;\n numChars -= l.length;\n }\n\n if (s[s.length - 1] === \" \") {\n s = s.substring(0, s.length - 1) + \".\"; // always end on non-whitespace. \".\" was chosen arbitrarily.\n }\n\n if (startWithCapitalLetter) {\n let c = s[0].toUpperCase();\n c = /[A-Z]/.test(c) ? c : \"M\";\n s = c + s.substring(1);\n }\n\n return s;\n };\n\n\n}\n\nexport default quikchat;\n"],"names":["quikchat","parentElement","onSend","arguments","length","undefined","options","_classCallCheck","defaultOpts","theme","trackHistory","titleArea","title","show","align","messagesArea","alternating","meta","_objectSpread","document","querySelector","_parentElement","_theme","_onSend","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","messagesAreaAlternateColors","_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","_this$_messagesArea","scrollTop","scrollHeight","clientHeight","userScrolledUp","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","alt","add","remove","messagesAreaAlternateColorsToggle","messagesAreaAlternateColorsGet","messageAddFull","input","content","userString","role","userID","messageDiv","createElement","msgidClass","String","padStart","userDiv","contentDiv","appendChild","lastElementChild","scrollIntoView","timestamp","Date","toISOString","updatedtime","push","shift","messageAddNew","messageRemove","n","sucess","removeChild","error","console","log","splice","findIndex","item","messageGetDOMObject","msg","messageGetContent","messageAppendContent","success","lastChild","messageReplaceContent","historyGet","m","slice","historyClear","historyGetLength","historyGetMessage","historyGetMessageContent","message","changeTheme","newTheme","get","version","loremIpsum","numChars","startSpot","startWithCapitalLetter","loremText","Math","floor","random","test","l","substring","s","c","toUpperCase"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACMA,QAAQ,gBAAA,YAAA;AACV;AACJ;AACA;AACA;AACA;EACI,SAAAA,QAAAA,CAAYC,aAAa,EAAoC;AAAA,IAAA,IAAlCC,MAAM,GAAAC,SAAA,CAAAC,MAAA,GAAAD,CAAAA,IAAAA,SAAA,CAAAE,CAAAA,CAAAA,KAAAA,SAAA,GAAAF,SAAA,CAAG,CAAA,CAAA,GAAA,YAAM,EAAG,CAAA;AAAA,IAAA,IAAEG,OAAO,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAAAI,IAAAA,eAAA,OAAAP,QAAA,CAAA,CAAA;AACvD,IAAA,IAAMQ,WAAW,GAAG;AAChBC,MAAAA,KAAK,EAAE,sBAAsB;AAC7BC,MAAAA,YAAY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,CAAC3J,MAAM,CAAA;AACxB,OAAA;MAEA,IAAI6J,CAAC,CAACA,CAAC,CAAC7J,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;AACzB6J,QAAAA,CAAC,GAAGA,CAAC,CAACD,SAAS,CAAC,CAAC,EAAEC,CAAC,CAAC7J,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3C,OAAA;AAEA,MAAA,IAAIqJ,sBAAsB,EAAE;QACxB,IAAIS,CAAC,GAAGD,CAAC,CAAC,CAAC,CAAC,CAACE,WAAW,EAAE,CAAA;QAC1BD,CAAC,GAAG,OAAO,CAACJ,IAAI,CAACI,CAAC,CAAC,GAAGA,CAAC,GAAG,GAAG,CAAA;QAC7BD,CAAC,GAAGC,CAAC,GAAGD,CAAC,CAACD,SAAS,CAAC,CAAC,CAAC,CAAA;AAC1B,OAAA;AAEA,MAAA,OAAOC,CAAC,CAAA;AACZ,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA;;;;"}
|
|
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, onSend = () => { }, options = {}) {\n const defaultOpts = {\n theme: 'quikchat-theme-light',\n trackHistory: true,\n titleArea: { title: \"Chat\", show: false, align: \"center\" },\n messagesArea: { alternating: true },\n };\n const meta = { ...defaultOpts, ...options }; // merge options with defaults\n\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n //console.log(parentElement, meta);\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = onSend ? onSend : () => { }; // call back function for 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 // messages area\n if (meta.messagesArea) {\n this.messagesAreaAlternateColors(meta.messagesArea.alternating);\n }\n // plumbing\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 /**\n * Attach event listeners to the widget\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 this._messagesArea.addEventListener('scroll', () => {\n const { scrollTop, scrollHeight, clientHeight } = this._messagesArea;\n this.userScrolledUp = scrollTop + clientHeight < scrollHeight;\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 //messagesArea functions\n messagesAreaAlternateColors(alt = true) {\n if (alt) {\n this._messagesArea.classList.add('quikchat-messages-area-alt');\n }\n else {\n this._messagesArea.classList.remove('quikchat-messages-area-alt');\n }\n return alt === true;\n }\n messagesAreaAlternateColorsToggle() {\n this._messagesArea.classList.toggle('quikchat-messages-area-alt');\n }\n messagesAreaAlternateColorsGet() {\n return this._messagesArea.classList.contains('quikchat-messages-area-alt');\n }\n // message functions\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\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n\n this._textEntry.value = '';\n this._adjustMessagesAreaHeight();\n const timestamp = new Date().toISOString();\n const updatedtime = timestamp;\n\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\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n }\n\n return msgid;\n }\n\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 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 console.log(`{String(n)} : Message ID not found`);\n }\n return content;\n }\n\n /* append message to the message content\n */\n\n messageAppendContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\n \n /* replace message content\n */\n messageReplaceContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\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 * \n * @param {string} newTheme \n */\n changeTheme(newTheme) {\n this._chatWidget.classList.remove(this._theme);\n this._chatWidget.classList.add(newTheme);\n this._theme = newTheme;\n }\n\n /**\n * Get the current theme\n * @returns {string} - The current theme\n */\n get theme() {\n return this._theme;\n }\n\n /**\n * \n * @returns {object} - Returns the version and license information for the library.\n */\n static version() {\n return { \"version\": \"1.1.4\", \"license\": \"BSD-2\", \"url\": \"https://github/deftio/quikchat\" };\n }\n\n /**\n * quikchat.loremIpsum() - Generate a simple string of Lorem Ipsum text (sample typographer's text) of numChars in length.\n * borrowed from github.com/deftio/bitwrench.js\n * @param {number} numChars - The number of characters to generate (random btw 25 and 150 if undefined). \n * @param {number} [startSpot=0] - The starting index in the Lorem Ipsum text. If undefined, a random startSpot will be generated.\n * @param {boolean} [startWithCapitalLetter=true] - If true, capitalize the first character or inject a capital letter if the first character isn't a capital letter.\n * \n * @returns {string} A string of Lorem Ipsum text.\n * \n * @example \n * // Returns 200 characters of Lorem Ipsum starting from index 50\n * loremIpsum(200, 50);\n * \n * @example \n * //Returns a 200 Lorem Ipsum characters starting from a random index\n * loremIpsum(200);\n */\n\n static loremIpsum(numChars, startSpot = undefined, startWithCapitalLetter = true) {\n const loremText = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \";\n\n if (typeof numChars !== \"number\") {\n numChars = Math.floor(Math.random() * (150)) + 25;\n }\n\n if (startSpot === undefined) {\n startSpot = Math.floor(Math.random() * loremText.length);\n }\n\n startSpot = startSpot % loremText.length;\n\n // Move startSpot to the next non-whitespace and non-punctuation character\n while (loremText[startSpot] === ' ' || /[.,:;!?]/.test(loremText[startSpot])) {\n startSpot = (startSpot + 1) % loremText.length;\n }\n\n let l = loremText.substring(startSpot) + loremText.substring(0, startSpot);\n\n if (typeof numChars !== \"number\") {\n numChars = l.length;\n }\n\n let s = \"\";\n while (numChars > 0) {\n s += numChars < l.length ? l.substring(0, numChars) : l;\n numChars -= l.length;\n }\n\n if (s[s.length - 1] === \" \") {\n s = s.substring(0, s.length - 1) + \".\"; // always end on non-whitespace. \".\" was chosen arbitrarily.\n }\n\n if (startWithCapitalLetter) {\n let c = s[0].toUpperCase();\n c = /[A-Z]/.test(c) ? c : \"M\";\n s = c + s.substring(1);\n }\n\n return s;\n };\n\n\n}\n\nexport default quikchat;\n"],"names":["quikchat","parentElement","onSend","arguments","length","undefined","options","_classCallCheck","defaultOpts","theme","trackHistory","titleArea","title","show","align","messagesArea","alternating","meta","_objectSpread","document","querySelector","_parentElement","_theme","_onSend","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","messagesAreaAlternateColors","_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","_this$_messagesArea","scrollTop","scrollHeight","clientHeight","userScrolledUp","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","alt","add","remove","messagesAreaAlternateColorsToggle","messagesAreaAlternateColorsGet","messageAddFull","input","content","userString","role","userID","messageDiv","createElement","msgidClass","String","padStart","userDiv","contentDiv","appendChild","lastElementChild","scrollIntoView","timestamp","Date","toISOString","updatedtime","push","shift","messageAddNew","messageRemove","n","sucess","removeChild","error","console","log","splice","findIndex","item","messageGetDOMObject","msg","messageGetContent","messageAppendContent","success","lastChild","messageReplaceContent","historyGet","m","slice","historyClear","historyGetLength","historyGetMessage","historyGetMessageContent","message","changeTheme","newTheme","get","version","loremIpsum","numChars","startSpot","startWithCapitalLetter","loremText","Math","floor","random","test","l","substring","s","c","toUpperCase"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACMA,QAAQ,gBAAA,YAAA;AACV;AACJ;AACA;AACA;AACA;EACI,SAAAA,QAAAA,CAAYC,aAAa,EAAoC;AAAA,IAAA,IAAlCC,MAAM,GAAAC,SAAA,CAAAC,MAAA,GAAAD,CAAAA,IAAAA,SAAA,CAAAE,CAAAA,CAAAA,KAAAA,SAAA,GAAAF,SAAA,CAAG,CAAA,CAAA,GAAA,YAAM,EAAG,CAAA;AAAA,IAAA,IAAEG,OAAO,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAAAI,IAAAA,eAAA,OAAAP,QAAA,CAAA,CAAA;AACvD,IAAA,IAAMQ,WAAW,GAAG;AAChBC,MAAAA,KAAK,EAAE,sBAAsB;AAC7BC,MAAAA,YAAY,EAAE,IAAI;AAClBC,MAAAA,SAAS,EAAE;AAAEC,QAAAA,KAAK,EAAE,MAAM;AAAEC,QAAAA,IAAI,EAAE,KAAK;AAAEC,QAAA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AAC,EAAET,QAAQ,CAAC,GAAGQ,CAAC,CAAA;QACvDR,QAAQ,IAAIQ,CAAC,CAAC3J,MAAM,CAAA;AACxB,OAAA;MAEA,IAAI6J,CAAC,CAACA,CAAC,CAAC7J,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;AACzB6J,QAAAA,CAAC,GAAGA,CAAC,CAACD,SAAS,CAAC,CAAC,EAAEC,CAAC,CAAC7J,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3C,OAAA;AAEA,MAAA,IAAIqJ,sBAAsB,EAAE;QACxB,IAAIS,CAAC,GAAGD,CAAC,CAAC,CAAC,CAAC,CAACE,WAAW,EAAE,CAAA;QAC1BD,CAAC,GAAG,OAAO,CAACJ,IAAI,CAACI,CAAC,CAAC,GAAGA,CAAC,GAAG,GAAG,CAAA;QAC7BD,CAAC,GAAGC,CAAC,GAAGD,CAAC,CAACD,SAAS,CAAC,CAAC,CAAC,CAAA;AAC1B,OAAA;AAEA,MAAA,OAAOC,CAAC,CAAA;AACZ,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA;;;;"}
|
package/dist/quikchat.cjs.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function i(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?n(Object(s),!0).forEach((function(t){i(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):n(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function r(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,i){if(t){if("string"==typeof t)return e(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,i):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var o=function(){return e=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=s(s({},{theme:"quikchat-theme-light",trackHistory:!0,titleArea:{title:"Chat",show:!1,align:"center"},messagesArea:{alternating:!0}}),n);"string"==typeof t&&(t=document.querySelector(t)),this._parentElement=t,this._theme=r.theme,this._onSend=i||function(){},this._createWidget(),r.titleArea&&(this.titleAreaSetContents(r.titleArea.title,r.titleArea.align),!0===r.titleArea.show?this.titleAreaShow():this.titleAreaHide()),r.messagesArea&&this.messagesAreaAlternateColors(r.messagesArea.alternating),this._attachEventListeners(),this.trackHistory=r.trackHistory||!0,this._historyLimit=1e7,this._history=[]},i=[{key:"_createWidget",value:function(){var e='\n <div class="quikchat-base '.concat(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 ');this._parentElement.innerHTML=e,this._chatWidget=this._parentElement.querySelector(".quikchat-base"),this._titleArea=this._chatWidget.querySelector(".quikchat-title-area"),this._messagesArea=this._chatWidget.querySelector(".quikchat-messages-area"),this._inputArea=this._chatWidget.querySelector(".quikchat-input-area"),this._textEntry=this._inputArea.querySelector(".quikchat-input-textbox"),this._sendButton=this._inputArea.querySelector(".quikchat-input-send-btn"),this.msgid=0}},{key:"_attachEventListeners",value:function(){var e=this;this._sendButton.addEventListener("click",(function(){return e._onSend(e,e._textEntry.value.trim())})),window.addEventListener("resize",(function(){return e._handleContainerResize()})),this._chatWidget.addEventListener("resize",(function(){return e._handleContainerResize()})),this._textEntry.addEventListener("keydown",(function(t){t.shiftKey&&13===t.keyCode&&(t.preventDefault(),e._onSend(e,e._textEntry.value.trim()))})),this._messagesArea.addEventListener("scroll",(function(){var t=e._messagesArea,i=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;e.userScrolledUp=i+s<n}))}},{key:"setCallbackOnSend",value:function(e){this._onSend=e}},{key:"setCallbackonMessageAdded",value:function(e){this._onMessageAdded=e}},{key:"titleAreaToggle",value:function(){"none"===this._titleArea.style.display?this.titleAreaShow():this.titleAreaHide()}},{key:"titleAreaShow",value:function(){this._titleArea.style.display="",this._adjustMessagesAreaHeight()}},{key:"titleAreaHide",value:function(){this._titleArea.style.display="none",this._adjustMessagesAreaHeight()}},{key:"titleAreaSetContents",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center";this._titleArea.innerHTML=e,this._titleArea.style.textAlign=t}},{key:"titleAreaGetContents",value:function(){return this._titleArea.innerHTML}},{key:"inputAreaToggle",value:function(){this._inputArea.classList.toggle("hidden"),"none"===this._inputArea.style.display?this.inputAreaShow():this.inputAreaHide()}},{key:"inputAreaShow",value:function(){this._inputArea.style.display="",this._adjustMessagesAreaHeight()}},{key:"inputAreaHide",value:function(){this._inputArea.style.display="none",this._adjustMessagesAreaHeight()}},{key:"_adjustMessagesAreaHeight",value:function(){var e=r(this._chatWidget.children).filter((function(e){return e.classList.contains("hidden")})).reduce((function(e,t){return e+t.offsetHeight}),0),t=this._chatWidget.offsetHeight;this._messagesArea.style.height="calc(100% - ".concat(t-e,"px)")}},{key:"_handleContainerResize",value:function(){this._adjustMessagesAreaHeight(),this._adjustSendButtonWidth()}},{key:"_adjustSendButtonWidth",value:function(){var e=this._sendButton.textContent.trim(),t=parseFloat(getComputedStyle(this._sendButton).fontSize)*e.length+16;this._sendButton.style.minWidth="".concat(t,"px")}},{key:"messagesAreaAlternateColors",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return e?this._messagesArea.classList.add("quikchat-messages-area-alt"):this._messagesArea.classList.remove("quikchat-messages-area-alt"),!0===e}},{key:"messagesAreaAlternateColorsToggle",value:function(){this._messagesArea.classList.toggle("quikchat-messages-area-alt")}},{key:"messagesAreaAlternateColorsGet",value:function(){return this._messagesArea.classList.contains("quikchat-messages-area-alt")}},{key:"messageAddFull",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{content:"",userString:"user",align:"right",role:"user",userID:-1},t=this.msgid,i=document.createElement("div"),n="quikchat-msgid-"+String(t).padStart(10,"0");String(e.userString).padStart(10,"0"),i.classList.add("quikchat-message",n),this.msgid++,i.classList.add(this._messagesArea.children.length%2==1?"quikchat-message-1":"quikchat-message-2");var r=document.createElement("div");r.innerHTML=e.userString,r.style="width: 100%; text-align: ".concat(e.align,"; font-size: 1em; font-weight:700;");var a=document.createElement("div");a.style="width: 100%; text-align: ".concat(e.align,";"),a.innerHTML=e.content,i.appendChild(r),i.appendChild(a),this._messagesArea.appendChild(i),this.userScrolledUp||this._messagesArea.lastElementChild.scrollIntoView(),this._textEntry.value="",this._adjustMessagesAreaHeight();var o=(new Date).toISOString(),l=o;return this.trackHistory&&(this._history.push(s(s({msgid:t},e),{},{timestamp:o,updatedtime:l,messageDiv:i})),this._history.length>this._historyLimit&&this._history.shift()),this._onMessageAdded&&this._onMessageAdded(this,t),t}},{key:"messageAddNew",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"right",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"user";return this.messageAddFull({content:e,userString:t,align:i,role:n})}},{key:"messageRemove",value:function(e){var t=!1;try{this._messagesArea.removeChild(this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0")))),t=!0}catch(e){console.log("{String(n)} : Message ID not found")}return t&&this._history.splice(this._history.findIndex((function(t){return t.msgid===e})),1),t}},{key:"messageGetDOMObject",value:function(e){var t=null;try{t=this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0")))}catch(e){console.log("{String(n)} : Message ID not found")}return t}},{key:"messageGetContent",value:function(e){var t="";try{t=this._history.filter((function(t){return t.msgid===e}))[0].content}catch(e){console.log("{String(n)} : Message ID not found")}return t}},{key:"messageAppendContent",value:function(e,t){var i=!1;try{this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0"))).lastChild.innerHTML+=t;var n=this._history.filter((function(t){return t.msgid===e}))[0];n.content+=t,n.updatedtime=(new Date).toISOString(),i=!0,this.userScrolledUp||this._messagesArea.lastElementChild.scrollIntoView()}catch(t){console.log("".concat(String(e)," : Message ID not found"))}return i}},{key:"messageReplaceContent",value:function(e,t){var i=!1;try{this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0"))).lastChild.innerHTML=t;var n=this._history.filter((function(t){return t.msgid===e}))[0];n.content=t,n.updatedtime=(new Date).toISOString(),i=!0,this.userScrolledUp||this._messagesArea.lastElementChild.scrollIntoView()}catch(t){console.log("".concat(String(e)," : Message ID not found"))}return i}},{key:"historyGet",value:function(e,t){return null==e&&(e=0,t=this._history.length),void 0===t&&(t=e<0?t:e+1),this._history.slice(e,t)}},{key:"historyClear",value:function(){this.msgid=0,this._history=[]}},{key:"historyGetLength",value:function(){return this._history.length}},{key:"historyGetMessage",value:function(e){return e>=0&&e<this._history.length&&this._history[e],{}}},{key:"historyGetMessageContent",value:function(e){return this._history[e].message}},{key:"changeTheme",value:function(e){this._chatWidget.classList.remove(this._theme),this._chatWidget.classList.add(e),this._theme=e}},{key:"theme",get:function(){return this._theme}}],n=[{key:"version",value:function(){return{version:"1.1.2",license:"BSD-2",url:"https://github/deftio/quikchat"}}},{key:"loremIpsum",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ";for("number"!=typeof e&&(e=Math.floor(150*Math.random())+25),void 0===t&&(t=Math.floor(446*Math.random())),t%=446;" "===n[t]||/[.,:;!?]/.test(n[t]);)t=(t+1)%446;var s=n.substring(t)+n.substring(0,t);"number"!=typeof e&&(e=s.length);for(var r="";e>0;)r+=e<s.length?s.substring(0,e):s,e-=s.length;if(" "===r[r.length-1]&&(r=r.substring(0,r.length-1)+"."),i){var a=r[0].toUpperCase();r=(a=/[A-Z]/.test(a)?a:"M")+r.substring(1)}return r}}],i&&t(e.prototype,i),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n}();module.exports=o;
|
|
1
|
+
"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function i(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?n(Object(s),!0).forEach((function(t){i(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):n(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function r(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,i){if(t){if("string"==typeof t)return e(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,i):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var o=function(){return e=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=s(s({},{theme:"quikchat-theme-light",trackHistory:!0,titleArea:{title:"Chat",show:!1,align:"center"},messagesArea:{alternating:!0}}),n);"string"==typeof t&&(t=document.querySelector(t)),this._parentElement=t,this._theme=r.theme,this._onSend=i||function(){},this._createWidget(),r.titleArea&&(this.titleAreaSetContents(r.titleArea.title,r.titleArea.align),!0===r.titleArea.show?this.titleAreaShow():this.titleAreaHide()),r.messagesArea&&this.messagesAreaAlternateColors(r.messagesArea.alternating),this._attachEventListeners(),this.trackHistory=r.trackHistory||!0,this._historyLimit=1e7,this._history=[]},i=[{key:"_createWidget",value:function(){var e='\n <div class="quikchat-base '.concat(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 ');this._parentElement.innerHTML=e,this._chatWidget=this._parentElement.querySelector(".quikchat-base"),this._titleArea=this._chatWidget.querySelector(".quikchat-title-area"),this._messagesArea=this._chatWidget.querySelector(".quikchat-messages-area"),this._inputArea=this._chatWidget.querySelector(".quikchat-input-area"),this._textEntry=this._inputArea.querySelector(".quikchat-input-textbox"),this._sendButton=this._inputArea.querySelector(".quikchat-input-send-btn"),this.msgid=0}},{key:"_attachEventListeners",value:function(){var e=this;this._sendButton.addEventListener("click",(function(){return e._onSend(e,e._textEntry.value.trim())})),window.addEventListener("resize",(function(){return e._handleContainerResize()})),this._chatWidget.addEventListener("resize",(function(){return e._handleContainerResize()})),this._textEntry.addEventListener("keydown",(function(t){t.shiftKey&&13===t.keyCode&&(t.preventDefault(),e._onSend(e,e._textEntry.value.trim()))})),this._messagesArea.addEventListener("scroll",(function(){var t=e._messagesArea,i=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;e.userScrolledUp=i+s<n}))}},{key:"setCallbackOnSend",value:function(e){this._onSend=e}},{key:"setCallbackonMessageAdded",value:function(e){this._onMessageAdded=e}},{key:"titleAreaToggle",value:function(){"none"===this._titleArea.style.display?this.titleAreaShow():this.titleAreaHide()}},{key:"titleAreaShow",value:function(){this._titleArea.style.display="",this._adjustMessagesAreaHeight()}},{key:"titleAreaHide",value:function(){this._titleArea.style.display="none",this._adjustMessagesAreaHeight()}},{key:"titleAreaSetContents",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"center";this._titleArea.innerHTML=e,this._titleArea.style.textAlign=t}},{key:"titleAreaGetContents",value:function(){return this._titleArea.innerHTML}},{key:"inputAreaToggle",value:function(){this._inputArea.classList.toggle("hidden"),"none"===this._inputArea.style.display?this.inputAreaShow():this.inputAreaHide()}},{key:"inputAreaShow",value:function(){this._inputArea.style.display="",this._adjustMessagesAreaHeight()}},{key:"inputAreaHide",value:function(){this._inputArea.style.display="none",this._adjustMessagesAreaHeight()}},{key:"_adjustMessagesAreaHeight",value:function(){var e=r(this._chatWidget.children).filter((function(e){return e.classList.contains("hidden")})).reduce((function(e,t){return e+t.offsetHeight}),0),t=this._chatWidget.offsetHeight;this._messagesArea.style.height="calc(100% - ".concat(t-e,"px)")}},{key:"_handleContainerResize",value:function(){this._adjustMessagesAreaHeight(),this._adjustSendButtonWidth()}},{key:"_adjustSendButtonWidth",value:function(){var e=this._sendButton.textContent.trim(),t=parseFloat(getComputedStyle(this._sendButton).fontSize)*e.length+16;this._sendButton.style.minWidth="".concat(t,"px")}},{key:"messagesAreaAlternateColors",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return e?this._messagesArea.classList.add("quikchat-messages-area-alt"):this._messagesArea.classList.remove("quikchat-messages-area-alt"),!0===e}},{key:"messagesAreaAlternateColorsToggle",value:function(){this._messagesArea.classList.toggle("quikchat-messages-area-alt")}},{key:"messagesAreaAlternateColorsGet",value:function(){return this._messagesArea.classList.contains("quikchat-messages-area-alt")}},{key:"messageAddFull",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{content:"",userString:"user",align:"right",role:"user",userID:-1},t=this.msgid,i=document.createElement("div"),n="quikchat-msgid-"+String(t).padStart(10,"0");String(e.userString).padStart(10,"0"),i.classList.add("quikchat-message",n),this.msgid++,i.classList.add(this._messagesArea.children.length%2==1?"quikchat-message-1":"quikchat-message-2");var r=document.createElement("div");r.innerHTML=e.userString,r.style="width: 100%; text-align: ".concat(e.align,"; font-size: 1em; font-weight:700;");var a=document.createElement("div");a.style="width: 100%; text-align: ".concat(e.align,";"),a.innerHTML=e.content,i.appendChild(r),i.appendChild(a),this._messagesArea.appendChild(i),this.userScrolledUp||this._messagesArea.lastElementChild.scrollIntoView(),this._textEntry.value="",this._adjustMessagesAreaHeight();var o=(new Date).toISOString(),l=o;return this.trackHistory&&(this._history.push(s(s({msgid:t},e),{},{timestamp:o,updatedtime:l,messageDiv:i})),this._history.length>this._historyLimit&&this._history.shift()),this._onMessageAdded&&this._onMessageAdded(this,t),t}},{key:"messageAddNew",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"right",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"user";return this.messageAddFull({content:e,userString:t,align:i,role:n})}},{key:"messageRemove",value:function(e){var t=!1;try{this._messagesArea.removeChild(this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0")))),t=!0}catch(e){console.log("{String(n)} : Message ID not found")}return t&&this._history.splice(this._history.findIndex((function(t){return t.msgid===e})),1),t}},{key:"messageGetDOMObject",value:function(e){var t=null;try{t=this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0")))}catch(e){console.log("{String(n)} : Message ID not found")}return t}},{key:"messageGetContent",value:function(e){var t="";try{t=this._history.filter((function(t){return t.msgid===e}))[0].content}catch(e){console.log("{String(n)} : Message ID not found")}return t}},{key:"messageAppendContent",value:function(e,t){var i=!1;try{this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0"))).lastChild.innerHTML+=t;var n=this._history.filter((function(t){return t.msgid===e}))[0];n.content+=t,n.updatedtime=(new Date).toISOString(),i=!0,this.userScrolledUp||this._messagesArea.lastElementChild.scrollIntoView()}catch(t){console.log("".concat(String(e)," : Message ID not found"))}return i}},{key:"messageReplaceContent",value:function(e,t){var i=!1;try{this._messagesArea.querySelector(".quikchat-msgid-".concat(String(e).padStart(10,"0"))).lastChild.innerHTML=t;var n=this._history.filter((function(t){return t.msgid===e}))[0];n.content=t,n.updatedtime=(new Date).toISOString(),i=!0,this.userScrolledUp||this._messagesArea.lastElementChild.scrollIntoView()}catch(t){console.log("".concat(String(e)," : Message ID not found"))}return i}},{key:"historyGet",value:function(e,t){return null==e&&(e=0,t=this._history.length),void 0===t&&(t=e<0?t:e+1),this._history.slice(e,t)}},{key:"historyClear",value:function(){this.msgid=0,this._history=[]}},{key:"historyGetLength",value:function(){return this._history.length}},{key:"historyGetMessage",value:function(e){return e>=0&&e<this._history.length&&this._history[e],{}}},{key:"historyGetMessageContent",value:function(e){return this._history[e].message}},{key:"changeTheme",value:function(e){this._chatWidget.classList.remove(this._theme),this._chatWidget.classList.add(e),this._theme=e}},{key:"theme",get:function(){return this._theme}}],n=[{key:"version",value:function(){return{version:"1.1.4",license:"BSD-2",url:"https://github/deftio/quikchat"}}},{key:"loremIpsum",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ";for("number"!=typeof e&&(e=Math.floor(150*Math.random())+25),void 0===t&&(t=Math.floor(446*Math.random())),t%=446;" "===n[t]||/[.,:;!?]/.test(n[t]);)t=(t+1)%446;var s=n.substring(t)+n.substring(0,t);"number"!=typeof e&&(e=s.length);for(var r="";e>0;)r+=e<s.length?s.substring(0,e):s,e-=s.length;if(" "===r[r.length-1]&&(r=r.substring(0,r.length-1)+"."),i){var a=r[0].toUpperCase();r=(a=/[A-Z]/.test(a)?a:"M")+r.substring(1)}return r}}],i&&t(e.prototype,i),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n}();module.exports=o;
|
|
2
2
|
//# sourceMappingURL=quikchat.cjs.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quikchat.cjs.min.js","sources":["../src/quikchat.js"],"sourcesContent":["\nclass quikchat {\n /**\n * \n * @param string or DOM element parentElement \n * @param {*} meta \n */\n constructor(parentElement, onSend = () => { }, options = {}) {\n const defaultOpts = {\n theme: 'quikchat-theme-light',\n trackHistory: true,\n titleArea: { title: \"Chat\", show: false, align: \"center\" },\n messagesArea: { alternating: true },\n };\n const meta = { ...defaultOpts, ...options }; // merge options with defaults\n\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n //console.log(parentElement, meta);\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = onSend ? onSend : () => { }; // call back function for 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 // messages area\n if (meta.messagesArea) {\n this.messagesAreaAlternateColors(meta.messagesArea.alternating);\n }\n // plumbing\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 /**\n * Attach event listeners to the widget\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 this._messagesArea.addEventListener('scroll', () => {\n const { scrollTop, scrollHeight, clientHeight } = this._messagesArea;\n this.userScrolledUp = scrollTop + clientHeight < scrollHeight;\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 //messagesArea functions\n messagesAreaAlternateColors(alt = true) {\n if (alt) {\n this._messagesArea.classList.add('quikchat-messages-area-alt');\n }\n else {\n this._messagesArea.classList.remove('quikchat-messages-area-alt');\n }\n return alt === true;\n }\n messagesAreaAlternateColorsToggle() {\n this._messagesArea.classList.toggle('quikchat-messages-area-alt');\n }\n messagesAreaAlternateColorsGet() {\n return this._messagesArea.classList.contains('quikchat-messages-area-alt');\n }\n // message functions\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\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n\n this._textEntry.value = '';\n this._adjustMessagesAreaHeight();\n const timestamp = new Date().toISOString();\n const updatedtime = timestamp;\n\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\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n }\n\n return msgid;\n }\n\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 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 console.log(`{String(n)} : Message ID not found`);\n }\n return content;\n }\n\n /* append message to the message content\n */\n\n messageAppendContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\n \n /* replace message content\n */\n messageReplaceContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\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.1.2\", \"license\": \"BSD-2\", \"url\": \"https://github/deftio/quikchat\" };\n }\n\n /**\n * quikchat.loremIpsum() - Generate a simple string of Lorem Ipsum text (sample typographer's text) of numChars in length.\n * borrowed from github.com/deftio/bitwrench.js\n * @param {number} numChars - The number of characters to generate (random btw 25 and 150 if undefined). \n * @param {number} [startSpot=0] - The starting index in the Lorem Ipsum text. If undefined, a random startSpot will be generated.\n * @param {boolean} [startWithCapitalLetter=true] - If true, capitalize the first character or inject a capital letter if the first character isn't a capital letter.\n * \n * @returns {string} A string of Lorem Ipsum text.\n * \n * @example \n * // Returns 200 characters of Lorem Ipsum starting from index 50\n * loremIpsum(200, 50);\n * \n * @example \n * //Returns a 200 Lorem Ipsum characters starting from a random index\n * loremIpsum(200);\n */\n\n static loremIpsum(numChars, startSpot = undefined, startWithCapitalLetter = true) {\n const loremText = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \";\n\n if (typeof numChars !== \"number\") {\n numChars = Math.floor(Math.random() * (150)) + 25;\n }\n\n if (startSpot === undefined) {\n startSpot = Math.floor(Math.random() * loremText.length);\n }\n\n startSpot = startSpot % loremText.length;\n\n // Move startSpot to the next non-whitespace and non-punctuation character\n while (loremText[startSpot] === ' ' || /[.,:;!?]/.test(loremText[startSpot])) {\n startSpot = (startSpot + 1) % loremText.length;\n }\n\n let l = loremText.substring(startSpot) + loremText.substring(0, startSpot);\n\n if (typeof numChars !== \"number\") {\n numChars = l.length;\n }\n\n let s = \"\";\n while (numChars > 0) {\n s += numChars < l.length ? l.substring(0, numChars) : l;\n numChars -= l.length;\n }\n\n if (s[s.length - 1] === \" \") {\n s = s.substring(0, s.length - 1) + \".\"; // always end on non-whitespace. \".\" was chosen arbitrarily.\n }\n\n if (startWithCapitalLetter) {\n let c = s[0].toUpperCase();\n c = /[A-Z]/.test(c) ? c : \"M\";\n s = c + s.substring(1);\n }\n\n return s;\n };\n\n\n}\n\nexport default quikchat;\n"],"names":["quikchat","parentElement","onSend","arguments","length","undefined","options","_classCallCheck","meta","_objectSpread","defaultOpts","theme","trackHistory","titleArea","title","show","align","messagesArea","alternating","document","querySelector","this","_parentElement","_theme","_onSend","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","messagesAreaAlternateColors","_attachEventListeners","_historyLimit","_history","key","value","widgetHTML","concat","innerHTML","_chatWidget","_titleArea","_messagesArea","_inputArea","_textEntry","_sendButton","msgid","_this","addEventListener","trim","window","_handleContainerResize","event","shiftKey","keyCode","preventDefault","_this$_messagesArea","scrollTop","scrollHeight","clientHeight","userScrolledUp","callback","_onMessageAdded","style","display","_adjustMessagesAreaHeight","textAlign","classList","toggle","inputAreaShow","inputAreaHide","totalHiddenHeight","_toConsumableArray","children","filter","child","contains","reduce","sum","offsetHeight","containerHeight","height","_adjustSendButtonWidth","sendButtonText","textContent","minWidth","parseFloat","getComputedStyle","fontSize","alt","add","remove","input","content","userString","role","userID","messageDiv","createElement","msgidClass","String","padStart","userDiv","contentDiv","appendChild","lastElementChild","scrollIntoView","timestamp","Date","toISOString","updatedtime","push","shift","messageAddFull","n","sucess","removeChild","error","console","log","splice","findIndex","item","msg","success","lastChild","m","slice","message","newTheme","get","version","license","url","numChars","startSpot","startWithCapitalLetter","loremText","Math","flo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AAWM,KAAKJ,EAAUF,KAC7DA,GAAaA,EAAY,GAAKE,IAGlC,IAAIK,EAAIL,EAAUM,UAAUR,GAAaE,EAAUM,UAAU,EAAGR,GAExC,iBAAbD,IACPA,EAAWQ,EAAExI,QAIjB,IADA,IAAI0I,EAAI,GACDV,EAAW,GACdU,GAAKV,EAAWQ,EAAExI,OAASwI,EAAEC,UAAU,EAAGT,GAAYQ,EACtDR,GAAYQ,EAAExI,OAOlB,GAJwB,MAApB0I,EAAEA,EAAE1I,OAAS,KACb0I,EAAIA,EAAED,UAAU,EAAGC,EAAE1I,OAAS,GAAK,KAGnCkI,EAAwB,CACxB,IAAIS,EAAID,EAAE,GAAGE,cAEbF,GADAC,EAAI,QAAQJ,KAAKI,GAAKA,EAAI,KAClBD,EAAED,UAAU,EACxB,CAEA,OAAOC,CACX,gGAAC,CApbS"}
|
|
1
|
+
{"version":3,"file":"quikchat.cjs.min.js","sources":["../src/quikchat.js"],"sourcesContent":["\nclass quikchat {\n /**\n * \n * @param string or DOM element parentElement \n * @param {*} meta \n */\n constructor(parentElement, onSend = () => { }, options = {}) {\n const defaultOpts = {\n theme: 'quikchat-theme-light',\n trackHistory: true,\n titleArea: { title: \"Chat\", show: false, align: \"center\" },\n messagesArea: { alternating: true },\n };\n const meta = { ...defaultOpts, ...options }; // merge options with defaults\n\n if (typeof parentElement === 'string') {\n parentElement = document.querySelector(parentElement);\n }\n //console.log(parentElement, meta);\n this._parentElement = parentElement;\n this._theme = meta.theme;\n this._onSend = onSend ? onSend : () => { }; // call back function for 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 // messages area\n if (meta.messagesArea) {\n this.messagesAreaAlternateColors(meta.messagesArea.alternating);\n }\n // plumbing\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 /**\n * Attach event listeners to the widget\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 this._messagesArea.addEventListener('scroll', () => {\n const { scrollTop, scrollHeight, clientHeight } = this._messagesArea;\n this.userScrolledUp = scrollTop + clientHeight < scrollHeight;\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 //messagesArea functions\n messagesAreaAlternateColors(alt = true) {\n if (alt) {\n this._messagesArea.classList.add('quikchat-messages-area-alt');\n }\n else {\n this._messagesArea.classList.remove('quikchat-messages-area-alt');\n }\n return alt === true;\n }\n messagesAreaAlternateColorsToggle() {\n this._messagesArea.classList.toggle('quikchat-messages-area-alt');\n }\n messagesAreaAlternateColorsGet() {\n return this._messagesArea.classList.contains('quikchat-messages-area-alt');\n }\n // message functions\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\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n\n this._textEntry.value = '';\n this._adjustMessagesAreaHeight();\n const timestamp = new Date().toISOString();\n const updatedtime = timestamp;\n\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\n if (this._onMessageAdded) {\n this._onMessageAdded(this, msgid);\n }\n\n return msgid;\n }\n\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 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 console.log(`{String(n)} : Message ID not found`);\n }\n return content;\n }\n\n /* append message to the message content\n */\n\n messageAppendContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\n \n /* replace message content\n */\n messageReplaceContent(n, content) {\n let success = 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 success = true;\n\n // Scroll to the last message only if the user is not actively scrolling up\n if (!this.userScrolledUp) {\n this._messagesArea.lastElementChild.scrollIntoView();\n }\n } catch (error) {\n console.log(`${String(n)} : Message ID not found`);\n }\n return success;\n }\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 * \n * @param {string} newTheme \n */\n changeTheme(newTheme) {\n this._chatWidget.classList.remove(this._theme);\n this._chatWidget.classList.add(newTheme);\n this._theme = newTheme;\n }\n\n /**\n * Get the current theme\n * @returns {string} - The current theme\n */\n get theme() {\n return this._theme;\n }\n\n /**\n * \n * @returns {object} - Returns the version and license information for the library.\n */\n static version() {\n return { \"version\": \"1.1.4\", \"license\": \"BSD-2\", \"url\": \"https://github/deftio/quikchat\" };\n }\n\n /**\n * quikchat.loremIpsum() - Generate a simple string of Lorem Ipsum text (sample typographer's text) of numChars in length.\n * borrowed from github.com/deftio/bitwrench.js\n * @param {number} numChars - The number of characters to generate (random btw 25 and 150 if undefined). \n * @param {number} [startSpot=0] - The starting index in the Lorem Ipsum text. If undefined, a random startSpot will be generated.\n * @param {boolean} [startWithCapitalLetter=true] - If true, capitalize the first character or inject a capital letter if the first character isn't a capital letter.\n * \n * @returns {string} A string of Lorem Ipsum text.\n * \n * @example \n * // Returns 200 characters of Lorem Ipsum starting from index 50\n * loremIpsum(200, 50);\n * \n * @example \n * //Returns a 200 Lorem Ipsum characters starting from a random index\n * loremIpsum(200);\n */\n\n static loremIpsum(numChars, startSpot = undefined, startWithCapitalLetter = true) {\n const loremText = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \";\n\n if (typeof numChars !== \"number\") {\n numChars = Math.floor(Math.random() * (150)) + 25;\n }\n\n if (startSpot === undefined) {\n startSpot = Math.floor(Math.random() * loremText.length);\n }\n\n startSpot = startSpot % loremText.length;\n\n // Move startSpot to the next non-whitespace and non-punctuation character\n while (loremText[startSpot] === ' ' || /[.,:;!?]/.test(loremText[startSpot])) {\n startSpot = (startSpot + 1) % loremText.length;\n }\n\n let l = loremText.substring(startSpot) + loremText.substring(0, startSpot);\n\n if (typeof numChars !== \"number\") {\n numChars = l.length;\n }\n\n let s = \"\";\n while (numChars > 0) {\n s += numChars < l.length ? l.substring(0, numChars) : l;\n numChars -= l.length;\n }\n\n if (s[s.length - 1] === \" \") {\n s = s.substring(0, s.length - 1) + \".\"; // always end on non-whitespace. \".\" was chosen arbitrarily.\n }\n\n if (startWithCapitalLetter) {\n let c = s[0].toUpperCase();\n c = /[A-Z]/.test(c) ? c : \"M\";\n s = c + s.substring(1);\n }\n\n return s;\n };\n\n\n}\n\nexport default quikchat;\n"],"names":["quikchat","parentElement","onSend","arguments","length","undefined","options","_classCallCheck","meta","_objectSpread","defaultOpts","theme","trackHistory","titleArea","title","show","align","messagesArea","alternating","document","querySelector","this","_parentElement","_theme","_onSend","_createWidget","titleAreaSetContents","titleAreaShow","titleAreaHide","messagesAreaAlternateColors","_attachEventListeners","_historyLimit","_history","key","value","widgetHTML","concat","innerHTML","_chatWidget","_titleArea","_messagesArea","_inputArea","_textEntry","_sendButton","msgid","_this","addEventListener","trim","window","_handleContainerResize","event","shiftKey","keyCode","preventDefault","_this$_messagesArea","scrollTop","scrollHeight","clientHeight","userScrolledUp","callback","_onMessageAdded","style","display","_adjustMessagesAreaHeight","textAlign","classList","toggle","inputAreaShow","inputAreaHide","totalHiddenHeight","_toConsumableArray","children","filter","child","contains","reduce","sum","offsetHeight","containerHeight","height","_adjustSendButtonWidth","sendButtonText","textContent","minWidth","parseFloat","getComputedStyle","fontSize","alt","add","remove","input","content","userString","role","userID","messageDiv","createElement","msgidClass","String","padStart","userDiv","contentDiv","appendChild","lastElementChild","scrollIntoView","timestamp","Date","toISOString","updatedtime","push","shift","messageAddFull","n","sucess","removeChild","error","console","log","splice","findIndex","item","msg","success","lastChild","m","slice","message","newTheme","get","version","license","url","numChars","startSpot","startWithCapitalLetter","loremText","Math","floor","random","test","l","substring","s","c","toUpperCase"],"mappings":"u3DACMA,EAAQ,WAyCT,SAnCD,SAAAA,EAAYC,GAAiD,IAAlCC,EAAMC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAG,GAAA,WAAM,EAAKG,EAAOH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,+FAAEI,MAAAP,GACvD,IAMMQ,EAAIC,EAAAA,EAAQC,CAAAA,EANE,CAChBC,MAAO,uBACPC,cAAc,EACdC,UAAW,CAAEC,MAAO,OAAQC,MAAM,EAAOC,MAAO,UAChDC,aAAc,CAAEC,aAAa,KAECZ,GAEL,iBAAlBL,IACPA,EAAgBkB,SAASC,cAAcnB,IAG3CoB,KAAKC,eAAiBrB,EACtBoB,KAAKE,OAASf,EAAKG,MACnBU,KAAKG,QAAUtB,GAAkB,WAAM,EACvCmB,KAAKI,gBAEDjB,EAAKK,YACLQ,KAAKK,qBAAqBlB,EAAKK,UAAUC,MAAON,EAAKK,UAAUG,QACnC,IAAxBR,EAAKK,UAAUE,KACfM,KAAKM,gBAELN,KAAKO,iBAITpB,EAAKS,cACLI,KAAKQ,4BAA4BrB,EAAKS,aAAaC,aAGvDG,KAAKS,wBACLT,KAAKT,aAAeJ,EAAKI,eAAgB,EACzCS,KAAKU,cAAgB,IACrBV,KAAKW,SAAW,EACpB,IAAC,CAAA,CAAAC,IAAA,gBAAAC,MAED,WACI,IAAMC,EAAUC,2CAAAA,OAEgBf,KAAKV,MAUhC,weAELU,KAAKC,eAAee,UAAYF,EAChCd,KAAKiB,YAAcjB,KAAKC,eAAeF,cAAc,kBACrDC,KAAKkB,WAAalB,KAAKiB,YAAYlB,cAAc,wBACjDC,KAAKmB,cAAgBnB,KAAKiB,YAAYlB,cAAc,2BACpDC,KAAKoB,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