@aomi-labs/widget-lib 0.2.0 → 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,168 @@
1
+ /* @aomi-labs/widget-lib - Theme Styles */
2
+ /* Consumers should import this file: @import "@aomi-labs/widget-lib/styles.css" */
3
+
4
+ /* ============================================
5
+ Theme Configuration (Tailwind v4 compatible)
6
+ ============================================ */
7
+
8
+ @custom-variant dark (&:is(.dark *));
9
+
10
+ @theme inline {
11
+ --color-background: var(--background);
12
+ --color-foreground: var(--foreground);
13
+ --font-sans: var(--font-geist-sans);
14
+ --font-mono: var(--font-geist-mono);
15
+ --color-sidebar-ring: var(--sidebar-ring);
16
+ --color-sidebar-border: var(--sidebar-border);
17
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
18
+ --color-sidebar-accent: var(--sidebar-accent);
19
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
20
+ --color-sidebar-primary: var(--sidebar-primary);
21
+ --color-sidebar-foreground: var(--sidebar-foreground);
22
+ --color-sidebar: var(--sidebar);
23
+ --color-chart-5: var(--chart-5);
24
+ --color-chart-4: var(--chart-4);
25
+ --color-chart-3: var(--chart-3);
26
+ --color-chart-2: var(--chart-2);
27
+ --color-chart-1: var(--chart-1);
28
+ --color-ring: var(--ring);
29
+ --color-input: var(--input);
30
+ --color-border: var(--border);
31
+ --color-destructive: var(--destructive);
32
+ --color-accent-foreground: var(--accent-foreground);
33
+ --color-accent: var(--accent);
34
+ --color-muted-foreground: var(--muted-foreground);
35
+ --color-muted: var(--muted);
36
+ --color-secondary-foreground: var(--secondary-foreground);
37
+ --color-secondary: var(--secondary);
38
+ --color-primary-foreground: var(--primary-foreground);
39
+ --color-primary: var(--primary);
40
+ --color-popover-foreground: var(--popover-foreground);
41
+ --color-popover: var(--popover);
42
+ --color-card-foreground: var(--card-foreground);
43
+ --color-card: var(--card);
44
+ --radius-sm: calc(var(--radius) - 4px);
45
+ --radius-md: calc(var(--radius) - 2px);
46
+ --radius-lg: var(--radius);
47
+ --radius-xl: calc(var(--radius) + 4px);
48
+ }
49
+
50
+ /* ============================================
51
+ Light Theme (Default)
52
+ ============================================ */
53
+
54
+ :root {
55
+ --radius: 0.625rem;
56
+ --background: oklch(1 0 0);
57
+ --foreground: oklch(0.141 0.005 285.823);
58
+ --card: oklch(1 0 0);
59
+ --card-foreground: oklch(0.141 0.005 285.823);
60
+ --popover: oklch(1 0 0);
61
+ --popover-foreground: oklch(0.141 0.005 285.823);
62
+ --primary: oklch(0.21 0.006 285.885);
63
+ --primary-foreground: oklch(0.985 0 0);
64
+ --secondary: oklch(0.967 0.001 286.375);
65
+ --secondary-foreground: oklch(0.21 0.006 285.885);
66
+ --muted: oklch(0.967 0.001 286.375);
67
+ --muted-foreground: oklch(0.552 0.016 285.938);
68
+ --accent: oklch(0.967 0.001 286.375);
69
+ --accent-foreground: oklch(0.21 0.006 285.885);
70
+ --destructive: oklch(0.577 0.245 27.325);
71
+ --border: oklch(0.92 0.004 286.32);
72
+ --input: oklch(0.92 0.004 286.32);
73
+ --ring: oklch(0.705 0.015 286.067);
74
+ --chart-1: oklch(0.646 0.222 41.116);
75
+ --chart-2: oklch(0.6 0.118 184.704);
76
+ --chart-3: oklch(0.398 0.07 227.392);
77
+ --chart-4: oklch(0.828 0.189 84.429);
78
+ --chart-5: oklch(0.769 0.188 70.08);
79
+ --sidebar: oklch(0.985 0 0);
80
+ --sidebar-foreground: oklch(0.141 0.005 285.823);
81
+ --sidebar-primary: oklch(0.21 0.006 285.885);
82
+ --sidebar-primary-foreground: oklch(0.985 0 0);
83
+ --sidebar-accent: oklch(0.967 0.001 286.375);
84
+ --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
85
+ --sidebar-border: oklch(0.92 0.004 286.32);
86
+ --sidebar-ring: oklch(0.705 0.015 286.067);
87
+ }
88
+
89
+ /* ============================================
90
+ Dark Theme
91
+ ============================================ */
92
+
93
+ .dark {
94
+ --background: oklch(0.141 0.005 285.823);
95
+ --foreground: oklch(0.985 0 0);
96
+ --card: oklch(0.21 0.006 285.885);
97
+ --card-foreground: oklch(0.985 0 0);
98
+ --popover: oklch(0.21 0.006 285.885);
99
+ --popover-foreground: oklch(0.985 0 0);
100
+ --primary: oklch(0.92 0.004 286.32);
101
+ --primary-foreground: oklch(0.21 0.006 285.885);
102
+ --secondary: oklch(0.274 0.006 286.033);
103
+ --secondary-foreground: oklch(0.985 0 0);
104
+ --muted: oklch(0.274 0.006 286.033);
105
+ --muted-foreground: oklch(0.705 0.015 286.067);
106
+ --accent: oklch(0.274 0.006 286.033);
107
+ --accent-foreground: oklch(0.985 0 0);
108
+ --destructive: oklch(0.704 0.191 22.216);
109
+ --border: oklch(1 0 0 / 10%);
110
+ --input: oklch(1 0 0 / 15%);
111
+ --ring: oklch(0.552 0.016 285.938);
112
+ --chart-1: oklch(0.488 0.243 264.376);
113
+ --chart-2: oklch(0.696 0.17 162.48);
114
+ --chart-3: oklch(0.769 0.188 70.08);
115
+ --chart-4: oklch(0.627 0.265 303.9);
116
+ --chart-5: oklch(0.645 0.246 16.439);
117
+ --sidebar: oklch(0.21 0.006 285.885);
118
+ --sidebar-foreground: oklch(0.985 0 0);
119
+ --sidebar-primary: oklch(0.488 0.243 264.376);
120
+ --sidebar-primary-foreground: oklch(0.985 0 0);
121
+ --sidebar-accent: oklch(0.274 0.006 286.033);
122
+ --sidebar-accent-foreground: oklch(0.985 0 0);
123
+ --sidebar-border: oklch(1 0 0 / 10%);
124
+ --sidebar-ring: oklch(0.552 0.016 285.938);
125
+ }
126
+
127
+ /* ============================================
128
+ Base Styles
129
+ ============================================ */
130
+
131
+ @layer base {
132
+ * {
133
+ @apply border-border outline-ring/50;
134
+ }
135
+
136
+ :root {
137
+ color-scheme: light;
138
+ }
139
+
140
+ :root.dark {
141
+ color-scheme: dark;
142
+ }
143
+
144
+ body {
145
+ @apply bg-background text-foreground;
146
+ }
147
+ }
148
+
149
+ /* ============================================
150
+ AppKit CSS Variable Overrides (Web3 Wallet)
151
+ ============================================ */
152
+
153
+ :root {
154
+ --apkt-tokens-theme-textInverted: var(--background) !important;
155
+ --apkt-tokens-core-backgroundAccentPrimary: var(--foreground) !important;
156
+ --apkt-tokens-core-backgroundAccentSecondary: var(--background) !important;
157
+ --apkt-tokens-core-foregroundPrimary: var(--background) !important;
158
+ --apkt-tokens-core-borderPrimary: var(--background) !important;
159
+ --apkt-color-accent: var(--background) !important;
160
+ --apkt-color-foreground: var(--background) !important;
161
+ --apkt-color-background: var(--background) !important;
162
+ }
163
+
164
+ .dark {
165
+ --apkt-tokens-core-backgroundAccentPrimary: var(--muted) !important;
166
+ --apkt-tokens-core-backgroundAccentSecondary: var(--accent) !important;
167
+ --apkt-tokens-core-foregroundPrimary: var(--foreground) !important;
168
+ }
package/package.json CHANGED
@@ -1,89 +1,108 @@
1
1
  {
2
2
  "name": "@aomi-labs/widget-lib",
3
- "version": "0.2.0",
4
- "description": "Embeddable AI chat widget with Web3 capabilities",
3
+ "version": "1.0.0",
4
+ "description": "AI-powered assistant UI widget library",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "module": "dist/index.mjs",
8
- "types": "dist/index.d.ts",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
14
19
  },
15
- "./styles": "./dist/styles.css"
20
+ "./styles.css": "./dist/styles.css"
16
21
  },
17
22
  "files": [
18
23
  "dist"
19
24
  ],
20
- "scripts": {
21
- "dev": "rollup -c -w",
22
- "build": "rollup -c && npm run build:types",
23
- "build:types": "tsc --emitDeclarationOnly --outDir dist",
24
- "test": "vitest",
25
- "test:ui": "vitest --ui",
26
- "typecheck": "tsc --noEmit",
27
- "lint": "eslint 'src/**/*.{ts,tsx}'",
28
- "lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
29
- "preview": "vite preview",
30
- "clean": "rimraf dist"
31
- },
32
- "keywords": [
33
- "widget",
34
- "chat",
35
- "ai",
36
- "web3",
37
- "ethereum",
38
- "chatbot",
39
- "embed",
40
- "typescript"
41
- ],
42
- "author": "Aomi Labs",
43
- "license": "MIT",
44
- "repository": {
45
- "type": "git",
46
- "url": "https://github.com/aomi-labs/widget-lib"
25
+ "prettier": {
26
+ "plugins": [
27
+ "prettier-plugin-tailwindcss"
28
+ ],
29
+ "tailwindStylesheet": "app/globals.css"
47
30
  },
48
31
  "peerDependencies": {
49
- "react": ">=16.8.0",
50
- "react-dom": ">=16.8.0"
51
- },
52
- "peerDependenciesMeta": {
53
- "react": {
54
- "optional": true
55
- },
56
- "react-dom": {
57
- "optional": true
58
- }
32
+ "@assistant-ui/react": "^0.11.0",
33
+ "@assistant-ui/react-markdown": "^0.11.0",
34
+ "@radix-ui/react-avatar": "^1.0.0",
35
+ "@radix-ui/react-dialog": "^1.0.0",
36
+ "@radix-ui/react-separator": "^1.0.0",
37
+ "@radix-ui/react-slot": "^1.0.0",
38
+ "@radix-ui/react-tooltip": "^1.0.0",
39
+ "@tanstack/react-query": "^5.0.0",
40
+ "framer-motion": "^12.0.0",
41
+ "lucide-react": "^0.500.0",
42
+ "motion": "^12.0.0",
43
+ "next": ">=14.0.0",
44
+ "react": "^18.0.0 || ^19.0.0",
45
+ "react-dom": "^18.0.0 || ^19.0.0",
46
+ "react-shiki": "^0.9.0",
47
+ "remark-gfm": "^4.0.0",
48
+ "tailwindcss": "^4.0.0",
49
+ "zustand": "^5.0.0"
59
50
  },
60
51
  "dependencies": {
61
- "dompurify": "^3.0.6",
62
- "eventemitter3": "^5.0.1",
63
- "marked": "^12.0.2",
64
- "mermaid": "^11.12.0"
52
+ "class-variance-authority": "^0.7.1",
53
+ "clsx": "^2.1.1",
54
+ "tailwind-merge": "^3.3.1"
65
55
  },
66
56
  "devDependencies": {
67
- "@rollup/plugin-commonjs": "^25.0.7",
68
- "@rollup/plugin-node-resolve": "^15.2.3",
69
- "@rollup/plugin-typescript": "^11.1.5",
70
- "@types/node": "^20.8.9",
71
- "@types/react": "^18.2.33",
72
- "@types/react-dom": "^18.2.14",
73
- "@typescript-eslint/eslint-plugin": "^6.9.1",
74
- "@typescript-eslint/parser": "^6.9.1",
75
- "@vitejs/plugin-react": "^4.1.1",
76
- "eslint": "^8.52.0",
77
- "jsdom": "^27.0.1",
78
- "react": "^18.2.0",
79
- "react-dom": "^18.2.0",
80
- "rimraf": "^5.0.5",
81
- "rollup": "^4.2.0",
82
- "rollup-plugin-dts": "^6.1.0",
83
- "rollup-plugin-postcss": "^4.0.2",
84
- "tslib": "^2.6.2",
85
- "typescript": "^5.2.2",
86
- "vite": "^6.4.1",
87
- "vitest": "^3.2.4"
57
+ "@ai-sdk/openai": "^2.0.46",
58
+ "@assistant-ui/react": "^0.11.28",
59
+ "@assistant-ui/react-ai-sdk": "^1.1.5",
60
+ "@assistant-ui/react-markdown": "^0.11.1",
61
+ "@eslint/eslintrc": "^3",
62
+ "@radix-ui/react-avatar": "^1.1.10",
63
+ "@radix-ui/react-dialog": "^1.1.15",
64
+ "@radix-ui/react-separator": "^1.1.7",
65
+ "@radix-ui/react-slot": "^1.2.3",
66
+ "@radix-ui/react-tooltip": "^1.2.8",
67
+ "@reown/appkit": "^1.8.14",
68
+ "@reown/appkit-adapter-wagmi": "^1.8.14",
69
+ "@tailwindcss/postcss": "^4",
70
+ "@tanstack/react-query": "^5.90.10",
71
+ "@types/node": "^24",
72
+ "@types/react": "^19",
73
+ "@types/react-dom": "^19",
74
+ "ai": "^5.0.65",
75
+ "eslint": "^9",
76
+ "eslint-config-next": "15.5.4",
77
+ "framer-motion": "^12.23.22",
78
+ "lucide-react": "^0.545.0",
79
+ "motion": "^12.23.22",
80
+ "next": "15.5.7",
81
+ "prettier": "^3.6.2",
82
+ "prettier-plugin-tailwindcss": "^0.6.14",
83
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
84
+ "@typescript-eslint/parser": "^8.18.0",
85
+ "react": "^19.2.0",
86
+ "react-dom": "^19.2.0",
87
+ "react-shiki": "^0.9.0",
88
+ "remark-gfm": "^4.0.1",
89
+ "tailwindcss": "^4",
90
+ "tsup": "^8.5.1",
91
+ "tw-animate-css": "^1.4.0",
92
+ "typescript": "^5",
93
+ "viem": "^2.40.3",
94
+ "wagmi": "^2.19.5",
95
+ "zustand": "^5.0.8"
96
+ },
97
+ "scripts": {
98
+ "dev": "next dev --turbopack",
99
+ "dev:example:live": "pnpm run build:lib -- --watch & pnpm --filter example dev",
100
+ "build": "next build",
101
+ "build:lib": "tsup",
102
+ "vercel-build": "pnpm run build:lib && pnpm --filter example build",
103
+ "start": "next start",
104
+ "lint": "eslint .",
105
+ "prettier": "prettier --check .",
106
+ "prettier:fix": "prettier --write ."
88
107
  }
89
- }
108
+ }
@@ -1,41 +0,0 @@
1
- import type { AomiChatWidgetParams, AomiChatWidgetHandler, WidgetConfig, ChatState, AomiChatEventListeners, EthereumProvider, ChatMessage } from '../types';
2
- declare class AomiChatWidgetHandlerImpl implements AomiChatWidgetHandler {
3
- private container;
4
- private config;
5
- private chatManager;
6
- private themeManager;
7
- private walletManager;
8
- private widgetElement;
9
- private isDestroyed;
10
- private eventEmitter;
11
- constructor(container: HTMLElement, config: WidgetConfig);
12
- sendMessage(message: string): Promise<void>;
13
- updateParams(params: Partial<AomiChatWidgetParams>): void;
14
- updateProvider(provider?: EthereumProvider): void;
15
- getState(): ChatState;
16
- getSessionId(): string;
17
- isReady(): boolean;
18
- on<K extends keyof AomiChatEventListeners>(event: K, listener: NonNullable<AomiChatEventListeners[K]>): AomiChatWidgetHandler;
19
- off<K extends keyof AomiChatEventListeners>(event: K, listener: NonNullable<AomiChatEventListeners[K]>): AomiChatWidgetHandler;
20
- clearChat(): void;
21
- exportChat(): ChatMessage[];
22
- resize(width?: string, height?: string): void;
23
- focus(): void;
24
- destroy(): void;
25
- private initialize;
26
- private setupEventListeners;
27
- private setupWalletEventListeners;
28
- private forwardStateEvents;
29
- private handleTransactionRequest;
30
- private render;
31
- private renderChatInterface;
32
- private applyTheme;
33
- private getModeClass;
34
- private updateDimensions;
35
- }
36
- /**
37
- * Creates and initializes an Aomi Chat Widget
38
- */
39
- export declare function createAomiChatWidget(container: HTMLElement, config: WidgetConfig): AomiChatWidgetHandler;
40
- export { AomiChatWidgetHandlerImpl as AomiChatWidgetHandler };
41
- //# sourceMappingURL=AomiChatWidget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AomiChatWidget.d.ts","sourceRoot":"","sources":["../../src/core/AomiChatWidget.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EAEZ,MAAM,UAAU,CAAC;AA8BlB,cAAM,yBAA0B,YAAW,qBAAqB;IAC9D,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAe;gBAEvB,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY;IA+B3C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjD,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;IA+BzD,cAAc,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAsBjD,QAAQ,IAAI,SAAS;IAIrB,YAAY,IAAI,MAAM;IAItB,OAAO,IAAI,OAAO;IAKlB,EAAE,CAAC,CAAC,SAAS,MAAM,sBAAsB,EAC9C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAC/C,qBAAqB;IAKjB,GAAG,CAAC,CAAC,SAAS,MAAM,sBAAsB,EAC/C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAC/C,qBAAqB;IAKjB,SAAS,IAAI,IAAI;IAKjB,UAAU,IAAI,WAAW,EAAE;IAI3B,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAa7C,KAAK,IAAI,IAAI;IASb,OAAO,IAAI,IAAI;YA+BR,UAAU;IAoBxB,OAAO,CAAC,mBAAmB;IA8B3B,OAAO,CAAC,yBAAyB;IA2BjC,OAAO,CAAC,kBAAkB;YAMZ,wBAAwB;IAyBtC,OAAO,CAAC,MAAM;IA+Bd,OAAO,CAAC,mBAAmB;IAiC3B,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,gBAAgB;CAMzB;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,YAAY,GACnB,qBAAqB,CAmBvB;AAGD,OAAO,EAAE,yBAAyB,IAAI,qBAAqB,EAAE,CAAC"}
@@ -1,81 +0,0 @@
1
- import { EventEmitter } from 'eventemitter3';
2
- import type { ChatMessage, ChatState, WalletTransaction, WalletState, ChatManagerConfig, AomiChatError } from '../types';
3
- import { ConnectionStatus } from '../types';
4
- interface ChatManagerEvents {
5
- stateChange: (state: ChatState) => void;
6
- message: (message: ChatMessage) => void;
7
- error: (error: AomiChatError) => void;
8
- connectionChange: (status: ConnectionStatus) => void;
9
- transactionRequest: (transaction: WalletTransaction) => void;
10
- }
11
- export declare class ChatManager extends EventEmitter<ChatManagerEvents> {
12
- private config;
13
- private state;
14
- private eventSource;
15
- private reconnectAttempt;
16
- private reconnectTimer;
17
- private heartbeatTimer;
18
- constructor(config?: Partial<ChatManagerConfig>);
19
- /**
20
- * Gets the current state
21
- */
22
- getState(): ChatState;
23
- /**
24
- * Gets the session ID
25
- */
26
- getSessionId(): string;
27
- /**
28
- * Sets a new session ID and reconnects if needed
29
- */
30
- setSessionId(sessionId: string): void;
31
- /**
32
- * Connects to the backend via Server-Sent Events
33
- */
34
- connectSSE(): Promise<void>;
35
- /**
36
- * Disconnects from the backend
37
- */
38
- disconnectSSE(): void;
39
- /**
40
- * Sends a message to the backend
41
- */
42
- sendMessage(message: string): Promise<void>;
43
- /**
44
- * Sends a system message
45
- */
46
- sendSystemMessage(message: string): Promise<void>;
47
- /**
48
- * Interrupts current processing
49
- */
50
- interrupt(): Promise<void>;
51
- /**
52
- * Sends transaction result back to backend
53
- */
54
- sendTransactionResult(success: boolean, txHash?: string, error?: string): Promise<void>;
55
- /**
56
- * Clears all messages
57
- */
58
- clearMessages(): void;
59
- /**
60
- * Updates wallet state
61
- */
62
- updateWalletState(walletState: Partial<WalletState>): void;
63
- /**
64
- * Destroys the chat manager
65
- */
66
- destroy(): void;
67
- private handleBackendMessage;
68
- private normalizeReadiness;
69
- private addMessage;
70
- private setConnectionStatus;
71
- private setReadiness;
72
- private emitStateChange;
73
- private postToBackend;
74
- private handleConnectionError;
75
- private scheduleReconnect;
76
- private clearReconnectTimer;
77
- private startHeartbeat;
78
- private stopHeartbeat;
79
- }
80
- export {};
81
- //# sourceMappingURL=ChatManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatManager.d.ts","sourceRoot":"","sources":["../../src/core/ChatManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EAET,iBAAiB,EACj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E,OAAO,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAUhB;;OAEG;IACI,aAAa,IAAI,IAAI;IAK5B;;OAEG;IACI,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAKjE;;OAEG;IACI,OAAO,IAAI,IAAI;IAStB,OAAO,CAAC,oBAAoB;IAuD5B,OAAO,CAAC,kBAAkB;IA2B1B,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,eAAe;YAIT,aAAa;IA4B3B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,aAAa;CAMtB"}
@@ -1,80 +0,0 @@
1
- import type { AomiChatTheme, AomiChatWidgetPalette, AomiChatWidgetPaletteColors, ThemeDefinition } from '../types';
2
- export declare class ThemeManager {
3
- private currentTheme;
4
- private customPalette;
5
- constructor(theme?: AomiChatTheme | AomiChatWidgetPalette);
6
- /**
7
- * Updates the current theme
8
- */
9
- updateTheme(theme?: AomiChatTheme | AomiChatWidgetPalette): void;
10
- /**
11
- * Gets the current computed theme
12
- */
13
- getComputedTheme(): ThemeDefinition;
14
- /**
15
- * Gets a specific color from the current theme
16
- */
17
- getColor(colorKey: keyof AomiChatWidgetPaletteColors): string;
18
- /**
19
- * Gets the CSS class name for the current theme
20
- */
21
- getThemeClass(): string;
22
- /**
23
- * Gets the font family for the current theme
24
- */
25
- getFontFamily(): string;
26
- /**
27
- * Gets the monospace font family for the current theme
28
- */
29
- getMonospaceFontFamily(): string;
30
- /**
31
- * Gets a spacing value for the current theme
32
- */
33
- getSpacing(size: 'xs' | 'sm' | 'md' | 'lg' | 'xl'): string;
34
- /**
35
- * Gets a border radius value for the current theme
36
- */
37
- getBorderRadius(size: 'sm' | 'md' | 'lg'): string;
38
- /**
39
- * Gets a shadow value for the current theme
40
- */
41
- getShadow(size: 'sm' | 'md' | 'lg'): string;
42
- /**
43
- * Generates CSS custom properties for the current theme
44
- */
45
- getCSSCustomProperties(): Record<string, string>;
46
- /**
47
- * Applies the theme to a DOM element
48
- */
49
- applyThemeToElement(element: HTMLElement): void;
50
- /**
51
- * Generates CSS string for the current theme
52
- */
53
- generateCSS(selector?: string): string;
54
- /**
55
- * Destroys the theme manager
56
- */
57
- destroy(): void;
58
- private resolveTheme;
59
- private isCustomPalette;
60
- private getBaseThemeName;
61
- private isPaletteEqual;
62
- private generateComponentCSS;
63
- }
64
- /**
65
- * Creates a theme manager instance
66
- */
67
- export declare function createThemeManager(theme?: AomiChatTheme | AomiChatWidgetPalette): ThemeManager;
68
- /**
69
- * Gets all available predefined themes
70
- */
71
- export declare function getAvailableThemes(): Record<string, ThemeDefinition>;
72
- /**
73
- * Validates a custom palette
74
- */
75
- export declare function validateCustomPalette(palette: unknown): palette is AomiChatWidgetPalette;
76
- /**
77
- * Creates a custom palette from a base theme
78
- */
79
- export declare function createCustomPalette(baseTheme: AomiChatTheme, overrides: Partial<AomiChatWidgetPaletteColors>): AomiChatWidgetPalette;
80
- //# sourceMappingURL=ThemeManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeManager.d.ts","sourceRoot":"","sources":["../../src/core/ThemeManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,2BAA2B,EAC3B,eAAe,EAChB,MAAM,UAAU,CAAC;AAYlB,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,aAAa,CAA4C;gBAErD,KAAK,CAAC,EAAE,aAAa,GAAG,qBAAqB;IAQzD;;OAEG;IACI,WAAW,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,qBAAqB,GAAG,IAAI;IAKvE;;OAEG;IACI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CAAC,GAC9C,qBAAqB,CAWvB"}
@@ -1,105 +0,0 @@
1
- import { EventEmitter } from 'eventemitter3';
2
- import type { EthereumProvider, SupportedChainId, AomiChatError } from '../types';
3
- interface TransactionRequest {
4
- to: string;
5
- value: string;
6
- data: string;
7
- gas?: string;
8
- }
9
- interface WalletManagerEvents {
10
- connect: (address: string) => void;
11
- disconnect: () => void;
12
- chainChange: (chainId: SupportedChainId) => void;
13
- accountsChange: (accounts: string[]) => void;
14
- error: (error: AomiChatError) => void;
15
- }
16
- export declare class WalletManager extends EventEmitter<WalletManagerEvents> {
17
- private provider;
18
- private currentAccount;
19
- private currentChainId;
20
- private isConnected;
21
- constructor(provider: EthereumProvider);
22
- /**
23
- * Gets the current connected account
24
- */
25
- getCurrentAccount(): string | null;
26
- /**
27
- * Gets the current chain ID
28
- */
29
- getCurrentChainId(): SupportedChainId | null;
30
- /**
31
- * Gets the current network name
32
- */
33
- getCurrentNetworkName(): string | null;
34
- /**
35
- * Checks if wallet is connected
36
- */
37
- getIsConnected(): boolean;
38
- /**
39
- * Connects to the wallet
40
- */
41
- connect(): Promise<string>;
42
- /**
43
- * Disconnects from the wallet
44
- */
45
- disconnect(): void;
46
- /**
47
- * Switches to a specific network
48
- */
49
- switchNetwork(chainId: SupportedChainId): Promise<void>;
50
- /**
51
- * Sends a transaction
52
- */
53
- sendTransaction(transaction: TransactionRequest): Promise<string>;
54
- /**
55
- * Signs a message
56
- */
57
- signMessage(message: string): Promise<string>;
58
- /**
59
- * Gets account balance
60
- */
61
- getBalance(address?: string): Promise<string>;
62
- /**
63
- * Updates the provider
64
- */
65
- updateProvider(provider: EthereumProvider): void;
66
- /**
67
- * Destroys the wallet manager
68
- */
69
- destroy(): void;
70
- private initializeState;
71
- private updateChainId;
72
- private setupEventListeners;
73
- private removeProviderListeners;
74
- private handleAccountsChanged;
75
- private handleChainChanged;
76
- private handleDisconnect;
77
- private validateTransaction;
78
- private addNetwork;
79
- private getNetworkConfig;
80
- }
81
- /**
82
- * Creates a wallet manager instance
83
- */
84
- export declare function createWalletManager(provider: EthereumProvider): WalletManager;
85
- /**
86
- * Checks if a provider supports the required methods
87
- */
88
- export declare function isValidProvider(provider: unknown): provider is EthereumProvider;
89
- /**
90
- * Detects available wallets
91
- */
92
- export declare function detectWallets(): Array<{
93
- name: string;
94
- provider: EthereumProvider;
95
- }>;
96
- declare global {
97
- interface Window {
98
- ethereum?: EthereumProvider & {
99
- isMetaMask?: boolean;
100
- isWalletConnect?: boolean;
101
- };
102
- }
103
- }
104
- export {};
105
- //# sourceMappingURL=WalletManager.d.ts.map