@c2n/chat-input 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/chat-input.js +166 -0
- package/package.json +60 -0
- package/types/src/chat-input.d.ts +86 -0
- package/types/src/chat-input.d.ts.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Nguyen Thai Vinh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { LitElement, html, nothing, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, eventOptions, property, query, state } from "lit/decorators.js";
|
|
3
|
+
import { redispatchEvent } from "@c2n/core/dom-helper.js";
|
|
4
|
+
import { live } from "lit/directives/live.js";
|
|
5
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
6
|
+
import { addClasses } from "@c2n/core/css-helper.js";
|
|
7
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
8
|
+
//#region src/chat-input.scss?inline
|
|
9
|
+
var chat_input_default = "/* ex : var((width: 24px), width, c2-checkbox) returns var(--c2-checkbox-width, 24px) */\n:host {\n display: block;\n}\n\n.c2-chat-input {\n display: flex;\n flex-direction: column;\n}\n.c2-chat-input .c2-chat-input-wrapper {\n flex: 1;\n display: flex;\n cursor: text;\n position: relative;\n align-self: stretch;\n justify-self: stretch;\n border-top: var(--c2-chat-input--border-top,1px solid rgb(177, 177, 177));\n border-bottom: var(--c2-chat-input--border-bottom,1px solid rgb(177, 177, 177));\n border-right: var(--c2-chat-input--border-right,1px solid rgb(177, 177, 177));\n border-left: var(--c2-chat-input--border-left,1px solid rgb(177, 177, 177));\n border-top-left-radius: var(--c2-chat-input--border-top-left-radius,4px);\n border-top-right-radius: var(--c2-chat-input--border-top-right-radius,4px);\n border-bottom-left-radius: var(--c2-chat-input--border-bottom-left-radius,4px);\n border-bottom-right-radius: var(--c2-chat-input--border-bottom-right-radius,4px);\n color: var(--c2-chat-input--color,rgb(34, 34, 34));\n background: var(--c2-chat-input--background,rgb(255, 255, 255));\n gap: 4px;\n}\n.c2-chat-input .c2-chat-input-wrapper .input {\n resize: none;\n scrollbar-width: none;\n overscroll-behavior: none;\n touch-action: pan-y;\n z-index: 0;\n width: 100%;\n flex: 1;\n border: none;\n outline: none;\n caret-color: inherit;\n text-align: inherit;\n border-radius: inherit;\n color: inherit;\n background: transparent;\n overflow: visible;\n text-wrap: wrap;\n text-indent: 0;\n max-height: var(--c2-chat-input--max-height,25vh);\n padding-top: var(--c2-chat-input--padding-top,8px);\n padding-bottom: var(--c2-chat-input--padding-bottom,8px);\n padding-left: var(--c2-chat-input--padding-left,8px);\n padding-right: calc(var(--c2-chat-input__send-icon--width,24px) + 2 * var(--c2-chat-input--padding-right,8px) + 6px);\n font-size: var(--c2-chat-input--font-size,14px);\n font-weight: var(--c2-chat-input--font-weight);\n font-style: var(--c2-chat-input--font-style);\n font-family: var(--c2-chat-input--font-family);\n line-height: var(--c2-chat-input--line-height,24px);\n}\n.c2-chat-input .c2-chat-input-wrapper .input::placeholder {\n font-weight: var(--c2-chat-input__placeholder--font-weight);\n font-style: var(--c2-chat-input__placeholder--font-style);\n color: var(--c2-chat-input__placeholder--color);\n opacity: var(--c2-chat-input__placeholder--opacity,0.5);\n}\n.c2-chat-input .c2-chat-input-wrapper .input::-webkit-scrollbar {\n display: none;\n}\n.c2-chat-input .c2-chat-input-wrapper .scrollbar-track {\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n width: 6px;\n cursor: default;\n z-index: 7;\n padding: 2px;\n}\n.c2-chat-input .c2-chat-input-wrapper .scrollbar-track .scrollbar-thumb {\n display: none;\n position: absolute;\n width: 6px;\n right: 2px;\n top: 0;\n}\n.c2-chat-input .c2-chat-input-wrapper .scrollbar-track .scrollbar-thumb:after {\n content: \"\";\n position: absolute;\n inset: 2px 0;\n width: 100%;\n border-radius: 6px;\n background: var(--color-scrollbar, rgba(0, 0, 0, 0.15));\n}\n.c2-chat-input .c2-chat-input-wrapper:hover .scrollbar-track .scrollbar-thumb {\n display: block;\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper {\n display: flex;\n position: absolute;\n right: 0px;\n bottom: 0px;\n padding-right: calc(var(--c2-chat-input--padding-right,8px) + 6px);\n padding-top: var(--c2-chat-input--padding-top,8px);\n padding-bottom: var(--c2-chat-input--padding-bottom,8px);\n padding-left: var(--c2-chat-input--padding-right,8px);\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button {\n border: none;\n outline: none;\n cursor: pointer;\n padding: 0px;\n margin: 0px;\n background: none;\n line-height: 0px;\n opacity: var(--c2-chat-input__send-icon--opacity,0.5);\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button slot[name=send-icon] svg {\n color: var(--c2-chat-input__send-icon--opacity,0.5);\n width: var(--c2-chat-input__send-icon--width,24px);\n height: var(--c2-chat-input__send-icon--height,24px);\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button ::slotted(svg) {\n color: var(--c2-chat-input__send-icon--opacity,0.5);\n width: var(--c2-chat-input__send-icon--width,24px);\n height: var(--c2-chat-input__send-icon--height,24px);\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button:hover {\n opacity: 1;\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button[active] {\n opacity: 1;\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button[active] slot[name=send-icon] svg {\n color: var(--c2-chat-input__send-icon__active--color);\n}\n.c2-chat-input .c2-chat-input-wrapper .send-button-wrapper button[active] ::slotted(svg) {\n color: var(--c2-chat-input__send-icon__active--color);\n}\n.c2-chat-input.focus-within .c2-chat-input-wrapper {\n border-top: var(--c2-chat-input__focus--border-top,var(--c2-chat-input--border-top,1px solid rgb(177, 177, 177)));\n border-bottom: var(--c2-chat-input__focus--border-bottom,var(--c2-chat-input--border-bottom,1px solid rgb(177, 177, 177)));\n border-right: var(--c2-chat-input__focus--border-right,var(--c2-chat-input--border-right,1px solid rgb(177, 177, 177)));\n border-left: var(--c2-chat-input__focus--border-left,var(--c2-chat-input--border-left,1px solid rgb(177, 177, 177)));\n color: var(--c2-chat-input__focus--color,var(--c2-chat-input--color,rgb(34, 34, 34)));\n background: var(--c2-chat-input__focus--background,var(--c2-chat-input--background,rgb(255, 255, 255)));\n}";
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/decorate.js
|
|
12
|
+
function __decorate(decorators, target, key, desc) {
|
|
13
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
16
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/chat-input.ts
|
|
20
|
+
var ChatInput = class ChatInput extends LitElement {
|
|
21
|
+
constructor(..._args) {
|
|
22
|
+
super(..._args);
|
|
23
|
+
this.placeholder = "";
|
|
24
|
+
this.value = "";
|
|
25
|
+
this.dirty = false;
|
|
26
|
+
this.scrollBarPosition = 0;
|
|
27
|
+
this.scrollBarHeight = 0;
|
|
28
|
+
this.focused = false;
|
|
29
|
+
this.handleFocus = () => {
|
|
30
|
+
this.focus();
|
|
31
|
+
};
|
|
32
|
+
this.inputDimensions = null;
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
this.styles = unsafeCSS(chat_input_default);
|
|
36
|
+
}
|
|
37
|
+
isDirty() {
|
|
38
|
+
return this.dirty;
|
|
39
|
+
}
|
|
40
|
+
focus(options) {
|
|
41
|
+
this.focused = true;
|
|
42
|
+
this.input?.focus(options);
|
|
43
|
+
}
|
|
44
|
+
async handleKeydown(event) {
|
|
45
|
+
this.dirty = true;
|
|
46
|
+
if (event.altKey) {
|
|
47
|
+
if (event.key == "Enter") {
|
|
48
|
+
this.value = this.value + "\n";
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
}
|
|
51
|
+
} else if (event.key == "Enter") {
|
|
52
|
+
this.dispatchSubmitEvent();
|
|
53
|
+
this.value = "";
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
}
|
|
56
|
+
await this.updateComplete;
|
|
57
|
+
this.updateInputHeight();
|
|
58
|
+
}
|
|
59
|
+
async handleInput(event) {
|
|
60
|
+
this.value = event.target.value;
|
|
61
|
+
this.updateInputHeight();
|
|
62
|
+
redispatchEvent(this, event);
|
|
63
|
+
}
|
|
64
|
+
updateInputHeight() {
|
|
65
|
+
const input = this.input;
|
|
66
|
+
if (input) {
|
|
67
|
+
if (!this.inputDimensions) {
|
|
68
|
+
const computedStyleMap = input.computedStyleMap();
|
|
69
|
+
this.inputDimensions = {
|
|
70
|
+
top: computedStyleMap.get("padding-top").value,
|
|
71
|
+
bottom: computedStyleMap.get("padding-bottom").value
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
this.input.style.height = "";
|
|
75
|
+
this.input.style.height = `${this.input?.scrollHeight - this.inputDimensions.top - this.inputDimensions.bottom}px`;
|
|
76
|
+
this.calculateScrollbarPosition();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
handleFocusin(event) {
|
|
80
|
+
this.focused = true;
|
|
81
|
+
redispatchEvent(this, event);
|
|
82
|
+
}
|
|
83
|
+
forwardFocusin(event) {
|
|
84
|
+
if (!event.defaultPrevented) this.focus();
|
|
85
|
+
}
|
|
86
|
+
redispatchEvent(event) {
|
|
87
|
+
redispatchEvent(this, event);
|
|
88
|
+
}
|
|
89
|
+
handleFocusout(event) {
|
|
90
|
+
this.focused = false;
|
|
91
|
+
redispatchEvent(this, event);
|
|
92
|
+
}
|
|
93
|
+
dispatchSubmitEvent() {
|
|
94
|
+
console.log("submit-message", this.value);
|
|
95
|
+
this.dispatchEvent(new CustomEvent("submit-message", {
|
|
96
|
+
bubbles: true,
|
|
97
|
+
cancelable: true,
|
|
98
|
+
detail: this.value
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
handleNavContentScroll() {
|
|
102
|
+
this.calculateScrollbarPosition();
|
|
103
|
+
}
|
|
104
|
+
calculateScrollbarPosition() {
|
|
105
|
+
if (this.input.scrollHeight - this.input.clientHeight > 0) {
|
|
106
|
+
const ratio = this.input.clientHeight / this.input.scrollHeight;
|
|
107
|
+
this.scrollBarHeight = this.input.clientHeight * ratio;
|
|
108
|
+
this.scrollBarPosition = this.input.scrollTop * ratio;
|
|
109
|
+
} else this.scrollBarHeight = 0;
|
|
110
|
+
}
|
|
111
|
+
renderScrollbar() {
|
|
112
|
+
if (!this.scrollBarHeight) return nothing;
|
|
113
|
+
const style = {
|
|
114
|
+
transform: `translate3d(0px, ${this.scrollBarPosition}px, 0px)`,
|
|
115
|
+
height: `${this.scrollBarHeight}px`
|
|
116
|
+
};
|
|
117
|
+
return html`<div class="scrollbar-track">
|
|
118
|
+
<div class="scrollbar-thumb" style="${styleMap(style)}"></div>
|
|
119
|
+
</div>`;
|
|
120
|
+
}
|
|
121
|
+
attributeChangedCallback(attribute, newValue, oldValue) {
|
|
122
|
+
if (attribute === "value" && this.dirty) return;
|
|
123
|
+
super.attributeChangedCallback(attribute, newValue, oldValue);
|
|
124
|
+
}
|
|
125
|
+
render() {
|
|
126
|
+
const classes = { "focus-within": this.focused };
|
|
127
|
+
addClasses(this, classes);
|
|
128
|
+
return html`
|
|
129
|
+
<div class="c2-chat-input ${classMap(classes)}">
|
|
130
|
+
<div class="c2-chat-input-wrapper">
|
|
131
|
+
<textarea
|
|
132
|
+
class="input"
|
|
133
|
+
tabindex="0"
|
|
134
|
+
.value=${live(this.value)}
|
|
135
|
+
placeholder=${this.placeholder || ""}
|
|
136
|
+
autocomplete="off"
|
|
137
|
+
rows="1"
|
|
138
|
+
@change=${this.redispatchEvent}
|
|
139
|
+
@select=${this.redispatchEvent}
|
|
140
|
+
@focusin=${this.handleFocusin}
|
|
141
|
+
@focusout=${this.handleFocusout}
|
|
142
|
+
@keydown=${this.handleKeydown}
|
|
143
|
+
@input=${this.handleInput}
|
|
144
|
+
@scroll=${this.handleNavContentScroll}
|
|
145
|
+
>
|
|
146
|
+
</textarea>
|
|
147
|
+
<div class="toolbar">
|
|
148
|
+
<slot name="toolbar"></slot>
|
|
149
|
+
</div>
|
|
150
|
+
${this.renderScrollbar()}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
__decorate([property({ type: String })], ChatInput.prototype, "placeholder", void 0);
|
|
157
|
+
__decorate([property({ type: String })], ChatInput.prototype, "value", void 0);
|
|
158
|
+
__decorate([state()], ChatInput.prototype, "dirty", void 0);
|
|
159
|
+
__decorate([state()], ChatInput.prototype, "scrollBarPosition", void 0);
|
|
160
|
+
__decorate([state()], ChatInput.prototype, "scrollBarHeight", void 0);
|
|
161
|
+
__decorate([state()], ChatInput.prototype, "focused", void 0);
|
|
162
|
+
__decorate([query(".input")], ChatInput.prototype, "input", void 0);
|
|
163
|
+
__decorate([eventOptions({ passive: true })], ChatInput.prototype, "handleNavContentScroll", null);
|
|
164
|
+
ChatInput = __decorate([customElement("c2-chat-input")], ChatInput);
|
|
165
|
+
//#endregion
|
|
166
|
+
export { ChatInput };
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@c2n/chat-input",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/chat-input.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"default": "./dist/chat-input.js",
|
|
9
|
+
"types": "./types/src/chat-input.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./custom-elements.json": "./custom-elements.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"types"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"chat-input",
|
|
19
|
+
"web component",
|
|
20
|
+
"lit"
|
|
21
|
+
],
|
|
22
|
+
"author": "code2nguyen@gmail.com",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org",
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/code2nguyen/web-components.git"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"build": "wireit",
|
|
34
|
+
"build:only": "vite build",
|
|
35
|
+
"type-check": "wireit"
|
|
36
|
+
},
|
|
37
|
+
"wireit": {
|
|
38
|
+
"type-check": {
|
|
39
|
+
"dependencies": [
|
|
40
|
+
"../../core:build"
|
|
41
|
+
],
|
|
42
|
+
"command": "tsc -p tsconfig.lib.json --composite false"
|
|
43
|
+
},
|
|
44
|
+
"build": {
|
|
45
|
+
"dependencies": [
|
|
46
|
+
"type-check"
|
|
47
|
+
],
|
|
48
|
+
"command": "vite build"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@c2n/core": "0.0.6",
|
|
53
|
+
"lit": "3.3.3"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@c2n/config": "*"
|
|
57
|
+
},
|
|
58
|
+
"customElements": "custom-elements.json",
|
|
59
|
+
"gitHead": "2921054bc75299da66dad11c1e374246ff88a51e"
|
|
60
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @tag c2-chat-input
|
|
4
|
+
*
|
|
5
|
+
* @slot send-icon
|
|
6
|
+
*
|
|
7
|
+
* @event {CustomEvent} submit-message
|
|
8
|
+
* @cssproperty {border-radius} [--c2-chat-input--border-top-left-radius=4px]
|
|
9
|
+
* @cssproperty {border-radius} [--c2-chat-input--border-top-right-radius=4px]
|
|
10
|
+
* @cssproperty {border-radius} [--c2-chat-input--border-bottom-left-radius=4px]
|
|
11
|
+
* @cssproperty {border-radius} [--c2-chat-input--border-bottom-right-radius=4px]
|
|
12
|
+
*
|
|
13
|
+
* @cssproperty {padding} [--c2-chat-input--padding-top=8px]
|
|
14
|
+
* @cssproperty {padding} [--c2-chat-input--padding-right=8px]
|
|
15
|
+
* @cssproperty {padding} [--c2-chat-input--padding-bottom=8px]
|
|
16
|
+
* @cssproperty {padding} [--c2-chat-input--padding-left=8px]
|
|
17
|
+
*
|
|
18
|
+
* @cssproperty {border} [--c2-chat-input--border-top=1px solid rgb(177, 177, 177)]
|
|
19
|
+
* @cssproperty {border} [--c2-chat-input--border-right=1px solid rgb(177, 177, 177)]
|
|
20
|
+
* @cssproperty {border} [--c2-chat-input--border-bottom=1px solid rgb(177, 177, 177)]
|
|
21
|
+
* @cssproperty {border} [--c2-chat-input--border-left=1px solid rgb(177, 177, 177)]
|
|
22
|
+
*
|
|
23
|
+
* @cssproperty {color} [--c2-chat-input--color=rgb(34, 34, 34)]
|
|
24
|
+
* @cssproperty {background} [--c2-chat-input--background=rgb(255, 255, 255)]
|
|
25
|
+
*
|
|
26
|
+
* @cssproperty {font-size} [--c2-chat-input--font-size=14px]
|
|
27
|
+
* @cssproperty {font-weight} --c2-chat-input--font-weight
|
|
28
|
+
* @cssproperty {font-style} --c2-chat-input--font-style
|
|
29
|
+
* @cssproperty {font-family} --c2-chat-input--font-family
|
|
30
|
+
* @cssproperty {line-height} [--c2-chat-input--line-height=24px]
|
|
31
|
+
* @cssproperty {max-height} [--c2-chat-input--max-height=25vh]
|
|
32
|
+
*
|
|
33
|
+
* @cssproperty {opacity} [--c2-chat-input__placeholder--opacity=0.5]
|
|
34
|
+
* @cssproperty {font-weight} --c2-chat-input__placeholder--font-weight
|
|
35
|
+
* @cssproperty {font-style} --c2-chat-input__placeholder--font-style
|
|
36
|
+
* @cssproperty {color} --c2-chat-input__placeholder--color
|
|
37
|
+
*
|
|
38
|
+
* @cssproperty {pixel} [--c2-chat-input__send-icon--width=24px]
|
|
39
|
+
* @cssproperty {pixel} [--c2-chat-input__send-icon--height=24px]
|
|
40
|
+
* @cssproperty {opacity} [--c2-chat-input__send-icon--opacity=0.5]
|
|
41
|
+
* @cssproperty {color} --c2-chat-input__send-icon--color
|
|
42
|
+
* @cssproperty {color} --c2-chat-input__send-icon__active--color
|
|
43
|
+
*
|
|
44
|
+
* @cssproperty {border} --c2-chat-input__focus--border-top
|
|
45
|
+
* @cssproperty {border} --c2-chat-input__focus--border-right
|
|
46
|
+
* @cssproperty {border} --c2-chat-input__focus--border-bottom
|
|
47
|
+
* @cssproperty {border} --c2-chat-input__focus--border-left
|
|
48
|
+
*
|
|
49
|
+
* @cssproperty {color} --c2-chat-input__focus--color
|
|
50
|
+
* @cssproperty {background} --c2-chat-input__focus--background
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export declare class ChatInput extends LitElement {
|
|
55
|
+
static styles: import("lit").CSSResult;
|
|
56
|
+
placeholder: string;
|
|
57
|
+
value: string;
|
|
58
|
+
private dirty;
|
|
59
|
+
private scrollBarPosition;
|
|
60
|
+
private scrollBarHeight;
|
|
61
|
+
private focused;
|
|
62
|
+
private readonly input?;
|
|
63
|
+
handleFocus: () => void;
|
|
64
|
+
isDirty(): boolean;
|
|
65
|
+
private inputDimensions;
|
|
66
|
+
focus(options?: FocusOptions | undefined): void;
|
|
67
|
+
private handleKeydown;
|
|
68
|
+
protected handleInput(event: InputEvent): Promise<void>;
|
|
69
|
+
private updateInputHeight;
|
|
70
|
+
protected handleFocusin(event: Event): void;
|
|
71
|
+
protected forwardFocusin(event: Event): void;
|
|
72
|
+
private redispatchEvent;
|
|
73
|
+
protected handleFocusout(event: Event): void;
|
|
74
|
+
private dispatchSubmitEvent;
|
|
75
|
+
private handleNavContentScroll;
|
|
76
|
+
private calculateScrollbarPosition;
|
|
77
|
+
private renderScrollbar;
|
|
78
|
+
attributeChangedCallback(attribute: string, newValue: string | null, oldValue: string | null): void;
|
|
79
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
80
|
+
}
|
|
81
|
+
declare global {
|
|
82
|
+
interface HTMLElementTagNameMap {
|
|
83
|
+
'c2-chat-input': ChatInput;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=chat-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../src/chat-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,MAAM,KAAK,CAAA;AAS1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,qBACa,SAAU,SAAQ,UAAU;IACvC,OAAgB,MAAM,0BAAoB;IAEd,WAAW,SAAK;IAChB,KAAK,SAAK;IAG7B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,iBAAiB,CAAI;IAC7B,OAAO,CAAC,eAAe,CAAI;IAC3B,OAAO,CAAC,OAAO,CAAQ;IAGf,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAqB;IAE7D,WAAW,aAEV;IAED,OAAO;IAIP,OAAO,CAAC,eAAe,CAA+C;IAE7D,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;YAK1C,aAAa;cAgBX,WAAW,CAAC,KAAK,EAAE,UAAU;IAM7C,OAAO,CAAC,iBAAiB;IAgBzB,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK;IAKpC,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK;IAIrC,OAAO,CAAC,eAAe;IAIvB,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK;IAYrC,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,0BAA0B;IAWlC,OAAO,CAAC,eAAe;IA2Bd,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU5F,MAAM;CAgChB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,SAAS,CAAA;KAC3B;CACF"}
|