@c2n/chat-message 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 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,3 @@
1
+ # Chat-Message
2
+
3
+ // TODO
@@ -0,0 +1,53 @@
1
+ import { LitElement, html, unsafeCSS } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ //#region src/chat-message.scss?inline
4
+ var chat_message_default = "/* ex : var((width: 24px), width, c2-checkbox) returns var(--c2-checkbox-width, 24px) */\n:host {\n display: block;\n}\n:host .c2-chat-message {\n display: flex;\n align-items: flex-start;\n gap: var(--c2-chat-message--gap,16px);\n}\n:host .c2-chat-message .c2-chat-message-container {\n display: flex;\n flex-direction: column;\n gap: var(--c2-chat-message__message--gap,4px);\n font-variant-ligatures: common-ligatures;\n font-size: var(--c2-chat-message--font-size,14px);\n font-weight: var(--c2-chat-message--font-weight);\n font-family: var(--c2-chat-message--font-family);\n line-height: var(--c2-chat-message--line-height);\n border-top: var(--c2-chat-message__message--border-top);\n border-right: var(--c2-chat-message__message--border-right);\n border-bottom: var(--c2-chat-message__message--border-bottom);\n border-left: var(--c2-chat-message__message--border-left);\n padding-top: var(--c2-chat-message__message--padding-top);\n padding-right: var(--c2-chat-message__message--padding-right);\n padding-bottom: var(--c2-chat-message__message--padding-bottom);\n padding-left: var(--c2-chat-message__message--padding-left);\n border-top-left-radius: var(--c2-chat-message__message--border-top-left-radius);\n border-top-right-radius: var(--c2-chat-message__message--border-top-right-radius);\n border-bottom-left-radius: var(--c2-chat-message__message--border-bottom-left-radius);\n border-bottom-right-radius: var(--c2-chat-message__message--border-bottom-right-radius);\n background: var(--c2-chat-message__message--background);\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__header {\n display: flex;\n align-items: center;\n gap: var(--c2-chat-message__header--gap,8px);\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__header slot[name=title] {\n color: var(--c2-chat-message__header__title--color);\n font-size: var(--c2-chat-message__header__title--font-size,15px);\n font-weight: var(--c2-chat-message__header__title--font-weight,600);\n font-style: var(--c2-chat-message__header__title--font-style);\n line-height: var(--c2-chat-message__header__title--font-size,15px);\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__header slot[name=header-time] {\n color: var(--c2-chat-message__time--color);\n line-height: var(--c2-chat-message__time--font-size,12px);\n font-size: var(--c2-chat-message__time--font-size,12px);\n font-weight: var(--c2-chat-message__time--font-weight);\n font-style: var(--c2-chat-message__time--font-style);\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__content {\n color: var(--c2-chat-message__message--color);\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__content ::slotted([slot=message]) {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n:host .c2-chat-message .c2-chat-message-container .c2-chat-message__footer slot[name=footer-time] {\n color: var(--c2-chat-message__time--color);\n font-size: var(--c2-chat-message__time--font-size,12px);\n font-weight: var(--c2-chat-message__time--font-weight);\n font-style: var(--c2-chat-message__time--font-style);\n}\n\n:host([align=right]) .c2-chat-message {\n flex-direction: row-reverse;\n}\n:host([align=right]) .c2-chat-message .c2-chat-message__header {\n flex-direction: row-reverse;\n}\n:host([align=right]) .c2-chat-message .c2-chat-message__content ::slotted([slot=message]) {\n align-items: flex-end;\n}";
5
+ //#endregion
6
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/decorate.js
7
+ function __decorate(decorators, target, key, desc) {
8
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10
+ 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;
11
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12
+ }
13
+ //#endregion
14
+ //#region src/chat-message.ts
15
+ var ChatMessage = class ChatMessage extends LitElement {
16
+ constructor(..._args) {
17
+ super(..._args);
18
+ this.align = "left";
19
+ }
20
+ static {
21
+ this.styles = unsafeCSS(chat_message_default);
22
+ }
23
+ render() {
24
+ return html`
25
+ <div class="c2-chat-message">
26
+ <div class="c2-chat-message__avatar">
27
+ <slot name="avatar"></slot>
28
+ </div>
29
+ <div class="c2-chat-message-container">
30
+ <div class="c2-chat-message__header">
31
+ <slot name="title"></slot>
32
+ <slot name="header-time"></slot>
33
+ </div>
34
+ <div class="c2-chat-message__content">
35
+ <slot name="message"></slot>
36
+ </div>
37
+ <div class="c2-chat-message__footer">
38
+ <div class="c2-chat-message__emotion">
39
+ <slot name="emotion"></slot>
40
+ </div>
41
+ <div class="c2-chat-message__footer-time">
42
+ <slot name="footer-time"></slot>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ `;
48
+ }
49
+ };
50
+ __decorate([property()], ChatMessage.prototype, "align", void 0);
51
+ ChatMessage = __decorate([customElement("c2-chat-message")], ChatMessage);
52
+ //#endregion
53
+ export { ChatMessage };
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@c2n/chat-message",
3
+ "version": "0.0.6",
4
+ "type": "module",
5
+ "main": "dist/chat-message.js",
6
+ "exports": {
7
+ ".": {
8
+ "default": "./dist/chat-message.js",
9
+ "types": "./types/src/chat-message.d.ts"
10
+ },
11
+ "./custom-elements.json": "./custom-elements.json"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "types"
16
+ ],
17
+ "keywords": [
18
+ "chat-message",
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,60 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * @tag c2-chat-message
4
+ *
5
+ * @slot avatar
6
+ * @slot title
7
+ * @slot header-time
8
+ * @slot message
9
+ * @slot emotion
10
+ * @slot footer-time
11
+ *
12
+ * @cssproperty {pixel} [--c2-chat-message--gap=16]
13
+ * @cssproperty {font-size} [--c2-chat-message--font-size=14px]
14
+ * @cssproperty {font-weight} --c2-chat-message--font-weight
15
+ * @cssproperty {font-family} --c2-chat-message--font-family
16
+ * @cssproperty {line-height} --c2-chat-message--line-height
17
+ * @cssproperty {pixel} [--c2-chat-message__message--gap=4px]
18
+ *
19
+ * @cssproperty {border} --c2-chat-message__message--border-top
20
+ * @cssproperty {border} --c2-chat-message__message--border-right
21
+ * @cssproperty {border} --c2-chat-message__message--border-bottom
22
+ * @cssproperty {border} --c2-chat-message__message--border-left
23
+ *
24
+ * @cssproperty {border-radius} --c2-chat-message__message--border-top-left-radius
25
+ * @cssproperty {border-radius} --c2-chat-message__message--border-top-right-radius
26
+ * @cssproperty {border-radius} --c2-chat-message__message--border-bottom-left-radius
27
+ * @cssproperty {border-radius} --c2-chat-message__message--border-bottom-right-radius
28
+ *
29
+ * @cssproperty {padding} --c2-chat-message__message--padding-top
30
+ * @cssproperty {padding} --c2-chat-message__message--padding-right
31
+ * @cssproperty {padding} --c2-chat-message__message--padding-bottom
32
+ * @cssproperty {padding} --c2-chat-message__message--padding-left
33
+ *
34
+ * @cssproperty {color} --c2-chat-message__message--color
35
+ * @cssproperty {background} --c2-chat-message__message--background
36
+ *
37
+ * @cssproperty {pixel} [--c2-chat-message__header--gap=8px]
38
+ * @cssproperty {color} --c2-chat-message__header__title---color
39
+ * @cssproperty {font-size} [--c2-chat-message__header__title---font-size=15px]
40
+ * @cssproperty {font-weight} [--c2-chat-message__header__title---font-weight=600]
41
+ * @cssproperty {font-style} --c2-chat-message__header__title---font-style
42
+ *
43
+ * @cssproperty {color} --c2-chat-message__time--color
44
+ * @cssproperty {font-size} [--c2-chat-message__time--font-size=12px]
45
+ * @cssproperty {font-weight} --c2-chat-message__time--font-weight
46
+ * @cssproperty {font-style} --c2-chat-message__time--font-style
47
+ *
48
+ * @slotcomponent c2-avatar
49
+ */
50
+ export declare class ChatMessage extends LitElement {
51
+ align: 'left' | 'right';
52
+ static styles: import("lit").CSSResult;
53
+ render(): import("lit-html").TemplateResult<1>;
54
+ }
55
+ declare global {
56
+ interface HTMLElementTagNameMap {
57
+ 'c2-chat-message': ChatMessage;
58
+ }
59
+ }
60
+ //# sourceMappingURL=chat-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-message.d.ts","sourceRoot":"","sources":["../../src/chat-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAA;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBACa,WAAY,SAAQ,UAAU;IAC7B,KAAK,EAAE,MAAM,GAAG,OAAO,CAAS;IAE5C,OAAgB,MAAM,0BAAoB;IAEjC,MAAM;CA0BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,WAAW,CAAA;KAC/B;CACF"}