@tinkrapp/widget 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.
- package/dist/client-CExUGn7b.d.cts +147 -0
- package/dist/client-CExUGn7b.d.ts +147 -0
- package/dist/course-ai-widget.css +2 -0
- package/dist/course-ai-widget.css.map +1 -0
- package/dist/course-ai-widget.global.js +632 -0
- package/dist/course-ai-widget.global.js.map +1 -0
- package/dist/index.cjs +233 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +229 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +4857 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +165 -0
- package/dist/react.d.ts +165 -0
- package/dist/react.js +4815 -0
- package/dist/react.js.map +1 -0
- package/package.json +104 -0
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default, { ReactNode, FC } from 'react';
|
|
4
|
+
import { b as WidgetConfig, W as WidgetClient, c as WidgetState, M as Message, e as WidgetError } from './client-CExUGn7b.cjs';
|
|
5
|
+
export { A as Artifact, f as ArtifactCategory, C as ChatSession } from './client-CExUGn7b.cjs';
|
|
6
|
+
import * as _emotion_utils from '@emotion/utils';
|
|
7
|
+
|
|
8
|
+
interface WidgetContextValue {
|
|
9
|
+
client: WidgetClient;
|
|
10
|
+
state: WidgetState;
|
|
11
|
+
userId: string;
|
|
12
|
+
}
|
|
13
|
+
declare const WidgetContext: react__default.Context<WidgetContextValue | null>;
|
|
14
|
+
interface WidgetProviderProps {
|
|
15
|
+
config: WidgetConfig;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
autoInitialize?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function WidgetProvider({ config, children, autoInitialize, }: WidgetProviderProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
declare function useWidget(): {
|
|
22
|
+
state: WidgetState;
|
|
23
|
+
client: WidgetClient;
|
|
24
|
+
isIdle: boolean;
|
|
25
|
+
isInitializing: boolean;
|
|
26
|
+
isReady: boolean;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
isError: boolean;
|
|
29
|
+
messages: Message[];
|
|
30
|
+
error: WidgetError | null;
|
|
31
|
+
initialize: () => Promise<void>;
|
|
32
|
+
sendMessage: (content: string) => Promise<Message>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare function useChat(): {
|
|
36
|
+
input: string;
|
|
37
|
+
setInput: react.Dispatch<react.SetStateAction<string>>;
|
|
38
|
+
handleSubmit: (e?: React.FormEvent) => Promise<void>;
|
|
39
|
+
messages: Message[];
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
canSubmit: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
interface WidgetContainerProps {
|
|
45
|
+
defaultOpen?: boolean;
|
|
46
|
+
position?: "bottom-right" | "bottom-left";
|
|
47
|
+
}
|
|
48
|
+
declare function WidgetContainer({ defaultOpen, position, }: WidgetContainerProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
|
+
interface ChatWidgetProps {
|
|
51
|
+
sidebarOpen?: boolean;
|
|
52
|
+
onSidebarClose?: () => void;
|
|
53
|
+
}
|
|
54
|
+
declare const ChatWidget: FC<ChatWidgetProps>;
|
|
55
|
+
|
|
56
|
+
declare const Thread: FC;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* ReadOnlyThread component for displaying chat history without interactive elements.
|
|
60
|
+
* Used by content creators to view student conversations.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
declare const ReadOnlyThread: FC;
|
|
64
|
+
|
|
65
|
+
declare const ThreadList: FC;
|
|
66
|
+
|
|
67
|
+
declare const ArtifactToolUIs: FC;
|
|
68
|
+
|
|
69
|
+
declare const theme: {
|
|
70
|
+
readonly colors: {
|
|
71
|
+
readonly background: {
|
|
72
|
+
readonly primary: "#1a1a1a";
|
|
73
|
+
readonly secondary: "#2a2a2a";
|
|
74
|
+
readonly tertiary: "#3a3a3a";
|
|
75
|
+
};
|
|
76
|
+
readonly accent: {
|
|
77
|
+
readonly primary: "#c9a227";
|
|
78
|
+
readonly hover: "#d4af37";
|
|
79
|
+
readonly muted: "rgba(201, 162, 39, 0.4)";
|
|
80
|
+
};
|
|
81
|
+
readonly text: {
|
|
82
|
+
readonly primary: "#ffffff";
|
|
83
|
+
readonly secondary: "#888888";
|
|
84
|
+
readonly tertiary: "#cccccc";
|
|
85
|
+
readonly inverse: "#1a1a1a";
|
|
86
|
+
};
|
|
87
|
+
readonly border: "#2a2a2a";
|
|
88
|
+
readonly shadow: "rgba(0, 0, 0, 0.4)";
|
|
89
|
+
};
|
|
90
|
+
readonly spacing: {
|
|
91
|
+
readonly xs: "0.25rem";
|
|
92
|
+
readonly sm: "0.5rem";
|
|
93
|
+
readonly md: "1rem";
|
|
94
|
+
readonly lg: "1.5rem";
|
|
95
|
+
readonly xl: "2rem";
|
|
96
|
+
readonly '2xl': "3rem";
|
|
97
|
+
};
|
|
98
|
+
readonly radii: {
|
|
99
|
+
readonly sm: "0.5rem";
|
|
100
|
+
readonly md: "0.75rem";
|
|
101
|
+
readonly lg: "1rem";
|
|
102
|
+
readonly xl: "1.5rem";
|
|
103
|
+
readonly full: "50%";
|
|
104
|
+
};
|
|
105
|
+
readonly typography: {
|
|
106
|
+
readonly fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
107
|
+
readonly fontSize: {
|
|
108
|
+
readonly xs: "0.75rem";
|
|
109
|
+
readonly sm: "0.875rem";
|
|
110
|
+
readonly md: "1rem";
|
|
111
|
+
readonly lg: "1.125rem";
|
|
112
|
+
readonly xl: "1.25rem";
|
|
113
|
+
readonly '2xl': "1.5rem";
|
|
114
|
+
};
|
|
115
|
+
readonly fontWeight: {
|
|
116
|
+
readonly normal: 400;
|
|
117
|
+
readonly medium: 500;
|
|
118
|
+
readonly semibold: 600;
|
|
119
|
+
readonly bold: 700;
|
|
120
|
+
};
|
|
121
|
+
readonly lineHeight: {
|
|
122
|
+
readonly tight: 1.25;
|
|
123
|
+
readonly normal: 1.5;
|
|
124
|
+
readonly relaxed: 1.7;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
readonly zIndex: {
|
|
128
|
+
readonly widget: 9999;
|
|
129
|
+
readonly overlay: 9998;
|
|
130
|
+
};
|
|
131
|
+
readonly shadows: {
|
|
132
|
+
readonly sm: "0 2px 8px rgba(0, 0, 0, 0.2)";
|
|
133
|
+
readonly md: "0 4px 16px rgba(0, 0, 0, 0.3)";
|
|
134
|
+
readonly lg: "0 8px 32px rgba(0, 0, 0, 0.4)";
|
|
135
|
+
readonly accent: "0 4px 16px rgba(201, 162, 39, 0.4)";
|
|
136
|
+
readonly accentHover: "0 6px 20px rgba(201, 162, 39, 0.5)";
|
|
137
|
+
};
|
|
138
|
+
readonly transitions: {
|
|
139
|
+
readonly fast: "0.15s ease";
|
|
140
|
+
readonly normal: "0.2s ease";
|
|
141
|
+
readonly slow: "0.3s ease";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
type Theme = typeof theme;
|
|
145
|
+
declare module '@emotion/react' {
|
|
146
|
+
interface Theme {
|
|
147
|
+
colors: typeof theme.colors;
|
|
148
|
+
spacing: typeof theme.spacing;
|
|
149
|
+
radii: typeof theme.radii;
|
|
150
|
+
typography: typeof theme.typography;
|
|
151
|
+
zIndex: typeof theme.zIndex;
|
|
152
|
+
shadows: typeof theme.shadows;
|
|
153
|
+
transitions: typeof theme.transitions;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Create an isolated Emotion cache for the widget.
|
|
159
|
+
* This ensures our styles don't conflict with host website styles.
|
|
160
|
+
* The 'la-widget' prefix will be added to all generated class names.
|
|
161
|
+
*/
|
|
162
|
+
declare const createWidgetCache: (container?: HTMLElement) => _emotion_utils.EmotionCache;
|
|
163
|
+
declare const widgetCache: _emotion_utils.EmotionCache;
|
|
164
|
+
|
|
165
|
+
export { ArtifactToolUIs, ChatWidget, Message, ReadOnlyThread, type Theme, Thread, ThreadList, WidgetConfig, WidgetContainer, WidgetContext, WidgetProvider, WidgetState, createWidgetCache, theme, useChat, useWidget, widgetCache };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default, { ReactNode, FC } from 'react';
|
|
4
|
+
import { b as WidgetConfig, W as WidgetClient, c as WidgetState, M as Message, e as WidgetError } from './client-CExUGn7b.js';
|
|
5
|
+
export { A as Artifact, f as ArtifactCategory, C as ChatSession } from './client-CExUGn7b.js';
|
|
6
|
+
import * as _emotion_utils from '@emotion/utils';
|
|
7
|
+
|
|
8
|
+
interface WidgetContextValue {
|
|
9
|
+
client: WidgetClient;
|
|
10
|
+
state: WidgetState;
|
|
11
|
+
userId: string;
|
|
12
|
+
}
|
|
13
|
+
declare const WidgetContext: react__default.Context<WidgetContextValue | null>;
|
|
14
|
+
interface WidgetProviderProps {
|
|
15
|
+
config: WidgetConfig;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
autoInitialize?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function WidgetProvider({ config, children, autoInitialize, }: WidgetProviderProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
declare function useWidget(): {
|
|
22
|
+
state: WidgetState;
|
|
23
|
+
client: WidgetClient;
|
|
24
|
+
isIdle: boolean;
|
|
25
|
+
isInitializing: boolean;
|
|
26
|
+
isReady: boolean;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
isError: boolean;
|
|
29
|
+
messages: Message[];
|
|
30
|
+
error: WidgetError | null;
|
|
31
|
+
initialize: () => Promise<void>;
|
|
32
|
+
sendMessage: (content: string) => Promise<Message>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare function useChat(): {
|
|
36
|
+
input: string;
|
|
37
|
+
setInput: react.Dispatch<react.SetStateAction<string>>;
|
|
38
|
+
handleSubmit: (e?: React.FormEvent) => Promise<void>;
|
|
39
|
+
messages: Message[];
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
canSubmit: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
interface WidgetContainerProps {
|
|
45
|
+
defaultOpen?: boolean;
|
|
46
|
+
position?: "bottom-right" | "bottom-left";
|
|
47
|
+
}
|
|
48
|
+
declare function WidgetContainer({ defaultOpen, position, }: WidgetContainerProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
|
+
interface ChatWidgetProps {
|
|
51
|
+
sidebarOpen?: boolean;
|
|
52
|
+
onSidebarClose?: () => void;
|
|
53
|
+
}
|
|
54
|
+
declare const ChatWidget: FC<ChatWidgetProps>;
|
|
55
|
+
|
|
56
|
+
declare const Thread: FC;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* ReadOnlyThread component for displaying chat history without interactive elements.
|
|
60
|
+
* Used by content creators to view student conversations.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
declare const ReadOnlyThread: FC;
|
|
64
|
+
|
|
65
|
+
declare const ThreadList: FC;
|
|
66
|
+
|
|
67
|
+
declare const ArtifactToolUIs: FC;
|
|
68
|
+
|
|
69
|
+
declare const theme: {
|
|
70
|
+
readonly colors: {
|
|
71
|
+
readonly background: {
|
|
72
|
+
readonly primary: "#1a1a1a";
|
|
73
|
+
readonly secondary: "#2a2a2a";
|
|
74
|
+
readonly tertiary: "#3a3a3a";
|
|
75
|
+
};
|
|
76
|
+
readonly accent: {
|
|
77
|
+
readonly primary: "#c9a227";
|
|
78
|
+
readonly hover: "#d4af37";
|
|
79
|
+
readonly muted: "rgba(201, 162, 39, 0.4)";
|
|
80
|
+
};
|
|
81
|
+
readonly text: {
|
|
82
|
+
readonly primary: "#ffffff";
|
|
83
|
+
readonly secondary: "#888888";
|
|
84
|
+
readonly tertiary: "#cccccc";
|
|
85
|
+
readonly inverse: "#1a1a1a";
|
|
86
|
+
};
|
|
87
|
+
readonly border: "#2a2a2a";
|
|
88
|
+
readonly shadow: "rgba(0, 0, 0, 0.4)";
|
|
89
|
+
};
|
|
90
|
+
readonly spacing: {
|
|
91
|
+
readonly xs: "0.25rem";
|
|
92
|
+
readonly sm: "0.5rem";
|
|
93
|
+
readonly md: "1rem";
|
|
94
|
+
readonly lg: "1.5rem";
|
|
95
|
+
readonly xl: "2rem";
|
|
96
|
+
readonly '2xl': "3rem";
|
|
97
|
+
};
|
|
98
|
+
readonly radii: {
|
|
99
|
+
readonly sm: "0.5rem";
|
|
100
|
+
readonly md: "0.75rem";
|
|
101
|
+
readonly lg: "1rem";
|
|
102
|
+
readonly xl: "1.5rem";
|
|
103
|
+
readonly full: "50%";
|
|
104
|
+
};
|
|
105
|
+
readonly typography: {
|
|
106
|
+
readonly fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
107
|
+
readonly fontSize: {
|
|
108
|
+
readonly xs: "0.75rem";
|
|
109
|
+
readonly sm: "0.875rem";
|
|
110
|
+
readonly md: "1rem";
|
|
111
|
+
readonly lg: "1.125rem";
|
|
112
|
+
readonly xl: "1.25rem";
|
|
113
|
+
readonly '2xl': "1.5rem";
|
|
114
|
+
};
|
|
115
|
+
readonly fontWeight: {
|
|
116
|
+
readonly normal: 400;
|
|
117
|
+
readonly medium: 500;
|
|
118
|
+
readonly semibold: 600;
|
|
119
|
+
readonly bold: 700;
|
|
120
|
+
};
|
|
121
|
+
readonly lineHeight: {
|
|
122
|
+
readonly tight: 1.25;
|
|
123
|
+
readonly normal: 1.5;
|
|
124
|
+
readonly relaxed: 1.7;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
readonly zIndex: {
|
|
128
|
+
readonly widget: 9999;
|
|
129
|
+
readonly overlay: 9998;
|
|
130
|
+
};
|
|
131
|
+
readonly shadows: {
|
|
132
|
+
readonly sm: "0 2px 8px rgba(0, 0, 0, 0.2)";
|
|
133
|
+
readonly md: "0 4px 16px rgba(0, 0, 0, 0.3)";
|
|
134
|
+
readonly lg: "0 8px 32px rgba(0, 0, 0, 0.4)";
|
|
135
|
+
readonly accent: "0 4px 16px rgba(201, 162, 39, 0.4)";
|
|
136
|
+
readonly accentHover: "0 6px 20px rgba(201, 162, 39, 0.5)";
|
|
137
|
+
};
|
|
138
|
+
readonly transitions: {
|
|
139
|
+
readonly fast: "0.15s ease";
|
|
140
|
+
readonly normal: "0.2s ease";
|
|
141
|
+
readonly slow: "0.3s ease";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
type Theme = typeof theme;
|
|
145
|
+
declare module '@emotion/react' {
|
|
146
|
+
interface Theme {
|
|
147
|
+
colors: typeof theme.colors;
|
|
148
|
+
spacing: typeof theme.spacing;
|
|
149
|
+
radii: typeof theme.radii;
|
|
150
|
+
typography: typeof theme.typography;
|
|
151
|
+
zIndex: typeof theme.zIndex;
|
|
152
|
+
shadows: typeof theme.shadows;
|
|
153
|
+
transitions: typeof theme.transitions;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Create an isolated Emotion cache for the widget.
|
|
159
|
+
* This ensures our styles don't conflict with host website styles.
|
|
160
|
+
* The 'la-widget' prefix will be added to all generated class names.
|
|
161
|
+
*/
|
|
162
|
+
declare const createWidgetCache: (container?: HTMLElement) => _emotion_utils.EmotionCache;
|
|
163
|
+
declare const widgetCache: _emotion_utils.EmotionCache;
|
|
164
|
+
|
|
165
|
+
export { ArtifactToolUIs, ChatWidget, Message, ReadOnlyThread, type Theme, Thread, ThreadList, WidgetConfig, WidgetContainer, WidgetContext, WidgetProvider, WidgetState, createWidgetCache, theme, useChat, useWidget, widgetCache };
|