chatroom-app 1.0.0

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.
@@ -0,0 +1,18 @@
1
+ import { LitElement } from 'lit-element';
2
+ import { Message } from '../../models/message.model';
3
+ /**
4
+ * dialog-box
5
+ */
6
+ export declare class DialogBoxComponent extends LitElement {
7
+ static styles: import("lit-element").CSSResult;
8
+ messages: Message[];
9
+ topic: string;
10
+ constructor();
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ private _closeDialog;
13
+ }
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ 'dialog-box': DialogBoxComponent;
17
+ }
18
+ }
@@ -0,0 +1,6 @@
1
+ export declare class DialogBoxController {
2
+ private model;
3
+ constructor();
4
+ setMessage(message: string): void;
5
+ getMessage(): string;
6
+ }
@@ -0,0 +1,5 @@
1
+ export declare class DialogBoxModel {
2
+ private message;
3
+ setMessage(message: string): void;
4
+ getMessage(): string;
5
+ }
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit-element';
2
+ import '../message-box/message-box.component';
3
+ import '../dialog-box/dialog-box.component';
4
+ /**
5
+ * main-container
6
+ *
7
+ */
8
+ export declare class MainContainerComponent extends LitElement {
9
+ static styles: import("lit-element").CSSResult;
10
+ private controller;
11
+ private topic;
12
+ token: string;
13
+ clientId: string;
14
+ constructor();
15
+ connectedCallback(): void;
16
+ disconnectedCallback(): void;
17
+ private _handleMessageSent;
18
+ private _handleDialogClosed;
19
+ render(): import("lit-html").TemplateResult<1>;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ 'main-container': MainContainerComponent;
24
+ }
25
+ }
@@ -0,0 +1,16 @@
1
+ import { MainModel } from './main.model';
2
+ import MQTTService from '../../utils/mqtt-service';
3
+ export declare class MainController {
4
+ private clientId;
5
+ private model;
6
+ private mqttService?;
7
+ private historyService?;
8
+ getMqttService(): MQTTService | undefined;
9
+ getMainModel(): MainModel;
10
+ constructor(clientid: string);
11
+ initMqtt(): void;
12
+ sendMessage(message: string): void;
13
+ getMessages(): string[];
14
+ addMessage(message: string): void;
15
+ getHistory(topic: string): import("../../models/message.model").Message[];
16
+ }
@@ -0,0 +1,5 @@
1
+ export declare class MainModel {
2
+ private messages;
3
+ addMessage(message: string): void;
4
+ getMessages(): string[];
5
+ }
@@ -0,0 +1,17 @@
1
+ import { LitElement } from 'lit-element';
2
+ /**
3
+ * message-box
4
+ */
5
+ export declare class MessageBoxComponent extends LitElement {
6
+ static styles: import("lit-element").CSSResult;
7
+ private controller;
8
+ clientId: string;
9
+ constructor();
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ private _sendMessage;
12
+ }
13
+ declare global {
14
+ interface HTMLElementTagNameMap {
15
+ 'message-box': MessageBoxComponent;
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ import { MessageBoxModel } from './message-box.model';
2
+ export declare class MessageBoxController {
3
+ private model;
4
+ getModel(): MessageBoxModel;
5
+ constructor();
6
+ updateMessage(message: string): void;
7
+ getMessage(): string;
8
+ }
@@ -0,0 +1,5 @@
1
+ export declare class MessageBoxModel {
2
+ private message;
3
+ setMessage(message: string): void;
4
+ getMessage(): string;
5
+ }
@@ -0,0 +1,40 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+
7
+ color-scheme: light dark;
8
+ color: rgba(255, 255, 255, 0.87);
9
+ background-color: #242424;
10
+
11
+ font-synthesis: none;
12
+ text-rendering: optimizeLegibility;
13
+ -webkit-font-smoothing: antialiased;
14
+ -moz-osx-font-smoothing: grayscale;
15
+ -webkit-text-size-adjust: 100%;
16
+ }
17
+
18
+ a {
19
+ font-weight: 500;
20
+ color: #646cff;
21
+ text-decoration: inherit;
22
+ }
23
+ a:hover {
24
+ color: #535bf2;
25
+ }
26
+
27
+ body {
28
+ margin: 0;
29
+ display: flex;
30
+ place-items: center;
31
+ min-width: 320px;
32
+ min-height: 100vh;
33
+ }
34
+
35
+ @media (prefers-color-scheme: light) {
36
+ :root {
37
+ color: #213547;
38
+ background-color: #ffffff;
39
+ }
40
+ }
@@ -0,0 +1,6 @@
1
+ export interface Message {
2
+ topic: string;
3
+ username: string;
4
+ message: string;
5
+ timestamp: Date;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Message } from '../models/message.model';
2
+ export declare class HistoryService {
3
+ private history;
4
+ constructor();
5
+ getHistory(topic: string): Message[];
6
+ }
@@ -0,0 +1,5 @@
1
+ import { IClientOptions } from 'mqtt';
2
+ export declare function generateMqttConfig(clientId: string): {
3
+ brokerUrl: any;
4
+ options: IClientOptions;
5
+ };
@@ -0,0 +1,9 @@
1
+ import { IClientOptions } from 'mqtt';
2
+ declare class MQTTService {
3
+ private client;
4
+ constructor(brokerUrl: string, options?: IClientOptions);
5
+ subscribe(topic: string, callback: (topic: string, message: Buffer) => void): void;
6
+ publish(topic: string, message: string): void;
7
+ disconnect(): void;
8
+ }
9
+ export default MQTTService;
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "chatroom-app",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/chatroom-app.cjs",
6
+ "module": "./dist/chatroom-app.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./dist/chatroom-app.cjs",
10
+ "import": "./dist/chatroom-app.mjs"
11
+ }
12
+ },
13
+ "types": "module",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "license": "ISC",
22
+ "private": false,
23
+ "scripts": {
24
+ "dev": "vite",
25
+ "build": "vite build && tsc --emitDeclarationOnly",
26
+ "build:css": "sass src/styles/tailwind.scss src/styles/tailwind.css",
27
+ "preview": "vite preview"
28
+ },
29
+ "dependencies": {
30
+ "autoprefixer": "^10.4.20",
31
+ "dotenv": "^16.4.7",
32
+ "https-proxy-agent": "^7.0.6",
33
+ "lit-element": "^4.1.0",
34
+ "mqtt": "^5.10.3",
35
+ "postcss": "^8.4.49",
36
+ "tailwindcss": "^3.4.17",
37
+ "vite-plugin-ssr": "^0.4.142"
38
+ },
39
+ "devDependencies": {
40
+ "sass": "^1.83.1",
41
+ "typescript": "^5.7.3",
42
+ "vite": "^3.0.8",
43
+ "vite-plugin-html": "^3.2.2"
44
+ }
45
+ }