@lssm/module.ai-chat 0.0.0-canary-20251217083314 → 1.41.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/ai-chat.feature.js +1 -93
- package/dist/context/context-builder.js +2 -147
- package/dist/context/file-operations.js +1 -174
- package/dist/context/index.js +1 -5
- package/dist/context/workspace-context.js +2 -123
- package/dist/core/chat-service.js +2 -211
- package/dist/core/conversation-store.js +1 -108
- package/dist/core/index.js +1 -4
- package/dist/index.js +1 -22
- package/dist/presentation/components/ChatContainer.js +1 -62
- package/dist/presentation/components/ChatInput.js +1 -149
- package/dist/presentation/components/ChatMessage.js +1 -135
- package/dist/presentation/components/CodePreview.js +2 -126
- package/dist/presentation/components/ContextIndicator.js +1 -96
- package/dist/presentation/components/ModelPicker.js +1 -197
- package/dist/presentation/components/index.js +1 -8
- package/dist/presentation/hooks/index.js +1 -4
- package/dist/presentation/hooks/useChat.js +1 -171
- package/dist/presentation/hooks/useProviders.js +1 -42
- package/dist/presentation/index.js +1 -12
- package/dist/providers/chat-utilities.js +1 -16
- package/dist/providers/index.js +1 -7
- package/package.json +17 -18
- package/dist/ai-chat.feature.d.ts +0 -11
- package/dist/context/context-builder.d.ts +0 -56
- package/dist/context/file-operations.d.ts +0 -99
- package/dist/context/index.d.ts +0 -4
- package/dist/context/workspace-context.d.ts +0 -116
- package/dist/core/chat-service.d.ts +0 -72
- package/dist/core/conversation-store.d.ts +0 -73
- package/dist/core/index.d.ts +0 -4
- package/dist/core/message-types.d.ts +0 -149
- package/dist/index.d.ts +0 -16
- package/dist/libs/ai-providers/dist/factory.js +0 -225
- package/dist/libs/ai-providers/dist/index.js +0 -4
- package/dist/libs/ai-providers/dist/legacy.js +0 -2
- package/dist/libs/ai-providers/dist/models.js +0 -299
- package/dist/libs/ai-providers/dist/validation.js +0 -60
- package/dist/libs/design-system/dist/_virtual/rolldown_runtime.js +0 -5
- package/dist/libs/design-system/dist/components/atoms/Button.js +0 -33
- package/dist/libs/design-system/dist/components/atoms/Textarea.js +0 -35
- package/dist/libs/design-system/dist/lib/keyboard.js +0 -193
- package/dist/libs/design-system/dist/ui-kit-web/dist/ui/button.js +0 -55
- package/dist/libs/design-system/dist/ui-kit-web/dist/ui/textarea.js +0 -16
- package/dist/libs/design-system/dist/ui-kit-web/dist/ui-kit-core/dist/utils.js +0 -13
- package/dist/libs/ui-kit-web/dist/ui/avatar.js +0 -25
- package/dist/libs/ui-kit-web/dist/ui/badge.js +0 -26
- package/dist/libs/ui-kit-web/dist/ui/scroll-area.js +0 -39
- package/dist/libs/ui-kit-web/dist/ui/select.js +0 -79
- package/dist/libs/ui-kit-web/dist/ui/skeleton.js +0 -14
- package/dist/libs/ui-kit-web/dist/ui/tooltip.js +0 -39
- package/dist/libs/ui-kit-web/dist/ui/utils.js +0 -10
- package/dist/libs/ui-kit-web/dist/ui-kit-core/dist/utils.js +0 -10
- package/dist/presentation/components/ChatContainer.d.ts +0 -20
- package/dist/presentation/components/ChatInput.d.ts +0 -34
- package/dist/presentation/components/ChatMessage.d.ts +0 -23
- package/dist/presentation/components/CodePreview.d.ts +0 -39
- package/dist/presentation/components/ContextIndicator.d.ts +0 -25
- package/dist/presentation/components/ModelPicker.d.ts +0 -38
- package/dist/presentation/components/index.d.ts +0 -7
- package/dist/presentation/hooks/index.d.ts +0 -3
- package/dist/presentation/hooks/useChat.d.ts +0 -66
- package/dist/presentation/hooks/useProviders.d.ts +0 -37
- package/dist/presentation/index.d.ts +0 -10
- package/dist/providers/chat-utilities.d.ts +0 -14
- package/dist/providers/index.d.ts +0 -3
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
//#region ../../libs/ai-providers/dist/models.js
|
|
2
|
-
/**
|
|
3
|
-
* Default models per provider
|
|
4
|
-
*/
|
|
5
|
-
const DEFAULT_MODELS = {
|
|
6
|
-
ollama: "llama3.2",
|
|
7
|
-
openai: "gpt-4o",
|
|
8
|
-
anthropic: "claude-sonnet-4-20250514",
|
|
9
|
-
mistral: "mistral-large-latest",
|
|
10
|
-
gemini: "gemini-2.0-flash"
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* All recommended models with metadata
|
|
14
|
-
*/
|
|
15
|
-
const MODELS = [
|
|
16
|
-
{
|
|
17
|
-
id: "llama3.2",
|
|
18
|
-
name: "Llama 3.2",
|
|
19
|
-
provider: "ollama",
|
|
20
|
-
contextWindow: 128e3,
|
|
21
|
-
capabilities: {
|
|
22
|
-
vision: false,
|
|
23
|
-
tools: true,
|
|
24
|
-
reasoning: false,
|
|
25
|
-
streaming: true
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "codellama",
|
|
30
|
-
name: "Code Llama",
|
|
31
|
-
provider: "ollama",
|
|
32
|
-
contextWindow: 16e3,
|
|
33
|
-
capabilities: {
|
|
34
|
-
vision: false,
|
|
35
|
-
tools: false,
|
|
36
|
-
reasoning: false,
|
|
37
|
-
streaming: true
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "deepseek-coder",
|
|
42
|
-
name: "DeepSeek Coder",
|
|
43
|
-
provider: "ollama",
|
|
44
|
-
contextWindow: 16e3,
|
|
45
|
-
capabilities: {
|
|
46
|
-
vision: false,
|
|
47
|
-
tools: false,
|
|
48
|
-
reasoning: false,
|
|
49
|
-
streaming: true
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: "mistral",
|
|
54
|
-
name: "Mistral 7B",
|
|
55
|
-
provider: "ollama",
|
|
56
|
-
contextWindow: 32e3,
|
|
57
|
-
capabilities: {
|
|
58
|
-
vision: false,
|
|
59
|
-
tools: false,
|
|
60
|
-
reasoning: false,
|
|
61
|
-
streaming: true
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "gpt-4o",
|
|
66
|
-
name: "GPT-4o",
|
|
67
|
-
provider: "openai",
|
|
68
|
-
contextWindow: 128e3,
|
|
69
|
-
capabilities: {
|
|
70
|
-
vision: true,
|
|
71
|
-
tools: true,
|
|
72
|
-
reasoning: false,
|
|
73
|
-
streaming: true
|
|
74
|
-
},
|
|
75
|
-
costPerMillion: {
|
|
76
|
-
input: 2.5,
|
|
77
|
-
output: 10
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "gpt-4o-mini",
|
|
82
|
-
name: "GPT-4o Mini",
|
|
83
|
-
provider: "openai",
|
|
84
|
-
contextWindow: 128e3,
|
|
85
|
-
capabilities: {
|
|
86
|
-
vision: true,
|
|
87
|
-
tools: true,
|
|
88
|
-
reasoning: false,
|
|
89
|
-
streaming: true
|
|
90
|
-
},
|
|
91
|
-
costPerMillion: {
|
|
92
|
-
input: .15,
|
|
93
|
-
output: .6
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
id: "o1",
|
|
98
|
-
name: "o1",
|
|
99
|
-
provider: "openai",
|
|
100
|
-
contextWindow: 2e5,
|
|
101
|
-
capabilities: {
|
|
102
|
-
vision: true,
|
|
103
|
-
tools: true,
|
|
104
|
-
reasoning: true,
|
|
105
|
-
streaming: true
|
|
106
|
-
},
|
|
107
|
-
costPerMillion: {
|
|
108
|
-
input: 15,
|
|
109
|
-
output: 60
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: "o1-mini",
|
|
114
|
-
name: "o1 Mini",
|
|
115
|
-
provider: "openai",
|
|
116
|
-
contextWindow: 128e3,
|
|
117
|
-
capabilities: {
|
|
118
|
-
vision: false,
|
|
119
|
-
tools: true,
|
|
120
|
-
reasoning: true,
|
|
121
|
-
streaming: true
|
|
122
|
-
},
|
|
123
|
-
costPerMillion: {
|
|
124
|
-
input: 3,
|
|
125
|
-
output: 12
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: "claude-sonnet-4-20250514",
|
|
130
|
-
name: "Claude Sonnet 4",
|
|
131
|
-
provider: "anthropic",
|
|
132
|
-
contextWindow: 2e5,
|
|
133
|
-
capabilities: {
|
|
134
|
-
vision: true,
|
|
135
|
-
tools: true,
|
|
136
|
-
reasoning: true,
|
|
137
|
-
streaming: true
|
|
138
|
-
},
|
|
139
|
-
costPerMillion: {
|
|
140
|
-
input: 3,
|
|
141
|
-
output: 15
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: "claude-3-5-sonnet-20241022",
|
|
146
|
-
name: "Claude 3.5 Sonnet",
|
|
147
|
-
provider: "anthropic",
|
|
148
|
-
contextWindow: 2e5,
|
|
149
|
-
capabilities: {
|
|
150
|
-
vision: true,
|
|
151
|
-
tools: true,
|
|
152
|
-
reasoning: false,
|
|
153
|
-
streaming: true
|
|
154
|
-
},
|
|
155
|
-
costPerMillion: {
|
|
156
|
-
input: 3,
|
|
157
|
-
output: 15
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: "claude-3-5-haiku-20241022",
|
|
162
|
-
name: "Claude 3.5 Haiku",
|
|
163
|
-
provider: "anthropic",
|
|
164
|
-
contextWindow: 2e5,
|
|
165
|
-
capabilities: {
|
|
166
|
-
vision: true,
|
|
167
|
-
tools: true,
|
|
168
|
-
reasoning: false,
|
|
169
|
-
streaming: true
|
|
170
|
-
},
|
|
171
|
-
costPerMillion: {
|
|
172
|
-
input: .8,
|
|
173
|
-
output: 4
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
id: "mistral-large-latest",
|
|
178
|
-
name: "Mistral Large",
|
|
179
|
-
provider: "mistral",
|
|
180
|
-
contextWindow: 128e3,
|
|
181
|
-
capabilities: {
|
|
182
|
-
vision: false,
|
|
183
|
-
tools: true,
|
|
184
|
-
reasoning: false,
|
|
185
|
-
streaming: true
|
|
186
|
-
},
|
|
187
|
-
costPerMillion: {
|
|
188
|
-
input: 2,
|
|
189
|
-
output: 6
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
id: "codestral-latest",
|
|
194
|
-
name: "Codestral",
|
|
195
|
-
provider: "mistral",
|
|
196
|
-
contextWindow: 32e3,
|
|
197
|
-
capabilities: {
|
|
198
|
-
vision: false,
|
|
199
|
-
tools: true,
|
|
200
|
-
reasoning: false,
|
|
201
|
-
streaming: true
|
|
202
|
-
},
|
|
203
|
-
costPerMillion: {
|
|
204
|
-
input: .2,
|
|
205
|
-
output: .6
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: "mistral-small-latest",
|
|
210
|
-
name: "Mistral Small",
|
|
211
|
-
provider: "mistral",
|
|
212
|
-
contextWindow: 32e3,
|
|
213
|
-
capabilities: {
|
|
214
|
-
vision: false,
|
|
215
|
-
tools: true,
|
|
216
|
-
reasoning: false,
|
|
217
|
-
streaming: true
|
|
218
|
-
},
|
|
219
|
-
costPerMillion: {
|
|
220
|
-
input: .2,
|
|
221
|
-
output: .6
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
id: "gemini-2.0-flash",
|
|
226
|
-
name: "Gemini 2.0 Flash",
|
|
227
|
-
provider: "gemini",
|
|
228
|
-
contextWindow: 1e6,
|
|
229
|
-
capabilities: {
|
|
230
|
-
vision: true,
|
|
231
|
-
tools: true,
|
|
232
|
-
reasoning: false,
|
|
233
|
-
streaming: true
|
|
234
|
-
},
|
|
235
|
-
costPerMillion: {
|
|
236
|
-
input: .075,
|
|
237
|
-
output: .3
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
id: "gemini-2.5-pro-preview-06-05",
|
|
242
|
-
name: "Gemini 2.5 Pro",
|
|
243
|
-
provider: "gemini",
|
|
244
|
-
contextWindow: 1e6,
|
|
245
|
-
capabilities: {
|
|
246
|
-
vision: true,
|
|
247
|
-
tools: true,
|
|
248
|
-
reasoning: true,
|
|
249
|
-
streaming: true
|
|
250
|
-
},
|
|
251
|
-
costPerMillion: {
|
|
252
|
-
input: 1.25,
|
|
253
|
-
output: 10
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
id: "gemini-2.5-flash-preview-05-20",
|
|
258
|
-
name: "Gemini 2.5 Flash",
|
|
259
|
-
provider: "gemini",
|
|
260
|
-
contextWindow: 1e6,
|
|
261
|
-
capabilities: {
|
|
262
|
-
vision: true,
|
|
263
|
-
tools: true,
|
|
264
|
-
reasoning: true,
|
|
265
|
-
streaming: true
|
|
266
|
-
},
|
|
267
|
-
costPerMillion: {
|
|
268
|
-
input: .15,
|
|
269
|
-
output: .6
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
];
|
|
273
|
-
/**
|
|
274
|
-
* Get models for a specific provider
|
|
275
|
-
*/
|
|
276
|
-
function getModelsForProvider(provider) {
|
|
277
|
-
return MODELS.filter((m) => m.provider === provider);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Get model info by ID
|
|
281
|
-
*/
|
|
282
|
-
function getModelInfo(modelId) {
|
|
283
|
-
return MODELS.find((m) => m.id === modelId);
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Get recommended models for a provider (legacy format)
|
|
287
|
-
*/
|
|
288
|
-
function getRecommendedModels(provider) {
|
|
289
|
-
return getModelsForProvider(provider === "claude" ? "anthropic" : provider === "custom" ? "openai" : provider).map((m) => m.id);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Get default model for a provider
|
|
293
|
-
*/
|
|
294
|
-
function getDefaultModel(provider) {
|
|
295
|
-
return DEFAULT_MODELS[provider];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
//#endregion
|
|
299
|
-
export { DEFAULT_MODELS, MODELS, getDefaultModel, getModelInfo, getModelsForProvider, getRecommendedModels };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { createProvider } from "./factory.js";
|
|
2
|
-
|
|
3
|
-
//#region ../../libs/ai-providers/dist/validation.js
|
|
4
|
-
/**
|
|
5
|
-
* Validate a provider configuration
|
|
6
|
-
*/
|
|
7
|
-
async function validateProvider(config) {
|
|
8
|
-
return createProvider(config).validate();
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Check if a provider has required credentials
|
|
12
|
-
*/
|
|
13
|
-
function hasCredentials(provider) {
|
|
14
|
-
switch (provider) {
|
|
15
|
-
case "ollama": return true;
|
|
16
|
-
case "openai": return Boolean(process.env.OPENAI_API_KEY);
|
|
17
|
-
case "anthropic": return Boolean(process.env.ANTHROPIC_API_KEY);
|
|
18
|
-
case "mistral": return Boolean(process.env.MISTRAL_API_KEY);
|
|
19
|
-
case "gemini": return Boolean(process.env.GOOGLE_API_KEY ?? process.env.GEMINI_API_KEY);
|
|
20
|
-
default: return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get the environment variable name for a provider's API key
|
|
25
|
-
*/
|
|
26
|
-
function getEnvVarName(provider) {
|
|
27
|
-
switch (provider) {
|
|
28
|
-
case "ollama": return null;
|
|
29
|
-
case "openai": return "OPENAI_API_KEY";
|
|
30
|
-
case "anthropic": return "ANTHROPIC_API_KEY";
|
|
31
|
-
case "mistral": return "MISTRAL_API_KEY";
|
|
32
|
-
case "gemini": return "GOOGLE_API_KEY";
|
|
33
|
-
default: return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Check if Ollama is running
|
|
38
|
-
*/
|
|
39
|
-
async function isOllamaRunning(baseUrl = "http://localhost:11434") {
|
|
40
|
-
try {
|
|
41
|
-
return (await fetch(`${baseUrl}/api/tags`)).ok;
|
|
42
|
-
} catch {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* List available Ollama models
|
|
48
|
-
*/
|
|
49
|
-
async function listOllamaModels(baseUrl = "http://localhost:11434") {
|
|
50
|
-
try {
|
|
51
|
-
const response = await fetch(`${baseUrl}/api/tags`);
|
|
52
|
-
if (!response.ok) return [];
|
|
53
|
-
return ((await response.json()).models ?? []).map((m) => m.name);
|
|
54
|
-
} catch {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
export { getEnvVarName, hasCredentials, isOllamaRunning, listOllamaModels, validateProvider };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Button } from "../../ui-kit-web/dist/ui/button.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Loader2 } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
//#region ../../libs/design-system/dist/components/atoms/Button.js
|
|
7
|
-
function Button$1({ children, loading, spinnerPlacement = "start", onPress, onPressIn, onPressOut, onLongPress, onTouchStart, onTouchEnd, onTouchCancel, onMouseDown, onMouseUp, onClick, className, disabled, ...rest }) {
|
|
8
|
-
const isDisabled = Boolean(disabled || loading);
|
|
9
|
-
const content = !rest.asChild ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
-
loading && spinnerPlacement === "start" ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : null,
|
|
11
|
-
children,
|
|
12
|
-
loading && spinnerPlacement === "end" ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : null
|
|
13
|
-
] }) : children;
|
|
14
|
-
return /* @__PURE__ */ jsx(Button, {
|
|
15
|
-
...rest,
|
|
16
|
-
className,
|
|
17
|
-
disabled: isDisabled,
|
|
18
|
-
"aria-busy": loading ? true : void 0,
|
|
19
|
-
"aria-disabled": isDisabled ? true : void 0,
|
|
20
|
-
onPress: onPress || onClick,
|
|
21
|
-
onClick: onPress || onClick,
|
|
22
|
-
onMouseDown: onMouseDown || onPressIn,
|
|
23
|
-
onMouseUp: onMouseUp || onPressOut,
|
|
24
|
-
onTouchStart,
|
|
25
|
-
onTouchEnd: onTouchEnd || onPressOut,
|
|
26
|
-
onTouchCancel: onTouchCancel || onPressOut,
|
|
27
|
-
type: rest?.type ?? "button",
|
|
28
|
-
children: content
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { Button$1 };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { mapKeyboardToWeb } from "../../lib/keyboard.js";
|
|
2
|
-
import { Textarea } from "../../ui-kit-web/dist/ui/textarea.js";
|
|
3
|
-
import * as React$1 from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
//#region ../../libs/design-system/dist/components/atoms/Textarea.js
|
|
7
|
-
function Textarea$1({ value, defaultValue, onChange, onSubmit, onFocus, onBlur, placeholder, disabled, readOnly, maxLength, name, className, rows, keyboard, ...rest }) {
|
|
8
|
-
const webKeyboard = mapKeyboardToWeb(keyboard);
|
|
9
|
-
const handleChange = React$1.useCallback((e) => onChange?.(e), [onChange]);
|
|
10
|
-
const handleKeyDown = React$1.useCallback((e) => {
|
|
11
|
-
if (e.key === "Enter" && webKeyboard.type !== "search") {
|
|
12
|
-
if (e.metaKey || e.ctrlKey) onSubmit?.(e);
|
|
13
|
-
}
|
|
14
|
-
}, [onSubmit, webKeyboard.type]);
|
|
15
|
-
return /* @__PURE__ */ jsx(Textarea, {
|
|
16
|
-
...rest,
|
|
17
|
-
className,
|
|
18
|
-
value,
|
|
19
|
-
defaultValue,
|
|
20
|
-
onChange: handleChange,
|
|
21
|
-
onKeyDown: handleKeyDown,
|
|
22
|
-
onFocus,
|
|
23
|
-
onBlur,
|
|
24
|
-
placeholder,
|
|
25
|
-
disabled,
|
|
26
|
-
readOnly,
|
|
27
|
-
maxLength,
|
|
28
|
-
name,
|
|
29
|
-
rows,
|
|
30
|
-
...webKeyboard
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { Textarea$1 };
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
//#region ../../libs/design-system/dist/lib/keyboard.js
|
|
2
|
-
function deriveKindFromAutoComplete(ac) {
|
|
3
|
-
if (!ac) return void 0;
|
|
4
|
-
switch (ac) {
|
|
5
|
-
case "email": return "email";
|
|
6
|
-
case "url": return "url";
|
|
7
|
-
case "username": return "username";
|
|
8
|
-
case "new-password": return "new-password";
|
|
9
|
-
case "current-password": return "password";
|
|
10
|
-
case "one-time-code": return "otp";
|
|
11
|
-
case "tel":
|
|
12
|
-
case "tel-country-code":
|
|
13
|
-
case "tel-national":
|
|
14
|
-
case "tel-area-code":
|
|
15
|
-
case "tel-local":
|
|
16
|
-
case "tel-local-prefix":
|
|
17
|
-
case "tel-local-suffix":
|
|
18
|
-
case "tel-extension": return "tel";
|
|
19
|
-
case "postal-code":
|
|
20
|
-
case "cc-number":
|
|
21
|
-
case "cc-csc":
|
|
22
|
-
case "bday-day":
|
|
23
|
-
case "bday-month":
|
|
24
|
-
case "bday-year": return "int";
|
|
25
|
-
case "cc-exp":
|
|
26
|
-
case "cc-exp-month":
|
|
27
|
-
case "cc-exp-year": return "numbers-and-punctuation";
|
|
28
|
-
case "bday": return "date";
|
|
29
|
-
default: return "text";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function applyAutoCompleteDefaultsWeb(res, ac) {
|
|
33
|
-
if (!ac) return;
|
|
34
|
-
if ([
|
|
35
|
-
"name",
|
|
36
|
-
"given-name",
|
|
37
|
-
"additional-name",
|
|
38
|
-
"family-name",
|
|
39
|
-
"honorific-prefix",
|
|
40
|
-
"honorific-suffix",
|
|
41
|
-
"nickname",
|
|
42
|
-
"organization",
|
|
43
|
-
"organization-title",
|
|
44
|
-
"cc-name",
|
|
45
|
-
"cc-given-name",
|
|
46
|
-
"cc-additional-name",
|
|
47
|
-
"cc-family-name"
|
|
48
|
-
].includes(ac)) res.autoCapitalize = "words";
|
|
49
|
-
if ([
|
|
50
|
-
"username",
|
|
51
|
-
"new-password",
|
|
52
|
-
"current-password",
|
|
53
|
-
"one-time-code",
|
|
54
|
-
"email",
|
|
55
|
-
"url"
|
|
56
|
-
].includes(ac)) res.autoCapitalize = "none";
|
|
57
|
-
}
|
|
58
|
-
function mapKeyboardToWeb(opts) {
|
|
59
|
-
const kind = opts?.kind ?? deriveKindFromAutoComplete(opts?.autoComplete) ?? "text";
|
|
60
|
-
const res = {};
|
|
61
|
-
switch (kind) {
|
|
62
|
-
case "password":
|
|
63
|
-
res.type = "password";
|
|
64
|
-
res.autoCapitalize = "none";
|
|
65
|
-
res.autoComplete = opts?.autoComplete ?? "current-password";
|
|
66
|
-
if (opts?.autoCorrect != null) res.autoCorrect = opts.autoCorrect;
|
|
67
|
-
break;
|
|
68
|
-
case "new-password":
|
|
69
|
-
res.type = "password";
|
|
70
|
-
res.autoCapitalize = "none";
|
|
71
|
-
res.autoComplete = opts?.autoComplete ?? "new-password";
|
|
72
|
-
if (opts?.autoCorrect != null) res.autoCorrect = opts.autoCorrect;
|
|
73
|
-
break;
|
|
74
|
-
case "username":
|
|
75
|
-
res.type = "text";
|
|
76
|
-
res.autoCapitalize = "none";
|
|
77
|
-
res.autoComplete = opts?.autoComplete ?? "username";
|
|
78
|
-
break;
|
|
79
|
-
case "email":
|
|
80
|
-
res.type = "email";
|
|
81
|
-
res.inputMode = "email";
|
|
82
|
-
res.autoCapitalize = "none";
|
|
83
|
-
res.autoComplete = opts?.autoComplete ?? "email";
|
|
84
|
-
break;
|
|
85
|
-
case "url":
|
|
86
|
-
res.type = "url";
|
|
87
|
-
res.inputMode = "url";
|
|
88
|
-
res.autoComplete = opts?.autoComplete ?? "url";
|
|
89
|
-
break;
|
|
90
|
-
case "search":
|
|
91
|
-
res.type = "search";
|
|
92
|
-
res.inputMode = "search";
|
|
93
|
-
res.enterKeyHint = opts?.enterKeyHint ?? "search";
|
|
94
|
-
res.autoComplete = opts?.autoComplete ?? "off";
|
|
95
|
-
break;
|
|
96
|
-
case "phone":
|
|
97
|
-
case "tel":
|
|
98
|
-
res.type = "tel";
|
|
99
|
-
res.inputMode = "tel";
|
|
100
|
-
res.autoComplete = opts?.autoComplete ?? "tel";
|
|
101
|
-
break;
|
|
102
|
-
case "number":
|
|
103
|
-
case "int":
|
|
104
|
-
res.type = "text";
|
|
105
|
-
res.inputMode = "numeric";
|
|
106
|
-
res.pattern = "[0-9]*";
|
|
107
|
-
break;
|
|
108
|
-
case "decimal":
|
|
109
|
-
res.type = "text";
|
|
110
|
-
res.inputMode = "decimal";
|
|
111
|
-
res.step = "any";
|
|
112
|
-
break;
|
|
113
|
-
case "numbers-and-punctuation":
|
|
114
|
-
res.type = "text";
|
|
115
|
-
res.inputMode = "text";
|
|
116
|
-
res.pattern = "[0-9.,-]*";
|
|
117
|
-
break;
|
|
118
|
-
case "otp":
|
|
119
|
-
res.type = "text";
|
|
120
|
-
res.inputMode = "numeric";
|
|
121
|
-
res.autoComplete = opts?.autoComplete ?? "one-time-code";
|
|
122
|
-
res.autoCapitalize = "none";
|
|
123
|
-
break;
|
|
124
|
-
case "name":
|
|
125
|
-
res.type = "text";
|
|
126
|
-
res.autoComplete = opts?.autoComplete ?? "name";
|
|
127
|
-
res.autoCapitalize = opts?.autoCapitalize ?? "words";
|
|
128
|
-
break;
|
|
129
|
-
case "given-name":
|
|
130
|
-
res.type = "text";
|
|
131
|
-
res.autoComplete = opts?.autoComplete ?? "given-name";
|
|
132
|
-
res.autoCapitalize = opts?.autoCapitalize ?? "words";
|
|
133
|
-
break;
|
|
134
|
-
case "family-name":
|
|
135
|
-
res.type = "text";
|
|
136
|
-
res.autoComplete = opts?.autoComplete ?? "family-name";
|
|
137
|
-
res.autoCapitalize = opts?.autoCapitalize ?? "words";
|
|
138
|
-
break;
|
|
139
|
-
case "address-line1":
|
|
140
|
-
res.type = "text";
|
|
141
|
-
res.autoComplete = opts?.autoComplete ?? "address-line1";
|
|
142
|
-
break;
|
|
143
|
-
case "address-line2":
|
|
144
|
-
res.type = "text";
|
|
145
|
-
res.autoComplete = opts?.autoComplete ?? "address-line2";
|
|
146
|
-
break;
|
|
147
|
-
case "postal-code":
|
|
148
|
-
res.type = "text";
|
|
149
|
-
res.inputMode = "numeric";
|
|
150
|
-
res.pattern = "[0-9]*";
|
|
151
|
-
res.autoComplete = opts?.autoComplete ?? "postal-code";
|
|
152
|
-
break;
|
|
153
|
-
case "cc-number":
|
|
154
|
-
res.type = "text";
|
|
155
|
-
res.inputMode = "numeric";
|
|
156
|
-
res.pattern = "[0-9]*";
|
|
157
|
-
res.autoComplete = opts?.autoComplete ?? "cc-number";
|
|
158
|
-
break;
|
|
159
|
-
case "cc-exp":
|
|
160
|
-
res.type = "text";
|
|
161
|
-
res.inputMode = "numeric";
|
|
162
|
-
res.pattern = "[0-9/]*";
|
|
163
|
-
res.autoComplete = opts?.autoComplete ?? "cc-exp";
|
|
164
|
-
break;
|
|
165
|
-
case "cc-csc":
|
|
166
|
-
res.type = "text";
|
|
167
|
-
res.inputMode = "numeric";
|
|
168
|
-
res.pattern = "[0-9]*";
|
|
169
|
-
res.autoComplete = opts?.autoComplete ?? "cc-csc";
|
|
170
|
-
break;
|
|
171
|
-
case "off":
|
|
172
|
-
res.type = "text";
|
|
173
|
-
res.autoComplete = "off";
|
|
174
|
-
break;
|
|
175
|
-
case "date":
|
|
176
|
-
res.type = "date";
|
|
177
|
-
res.inputMode = "date";
|
|
178
|
-
res.pattern = "[0-9./-]*";
|
|
179
|
-
break;
|
|
180
|
-
default:
|
|
181
|
-
res.type = "text";
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
if (opts?.autoCapitalize) res.autoCapitalize = opts.autoCapitalize;
|
|
185
|
-
if (opts?.autoComplete) res.autoComplete = opts.autoComplete;
|
|
186
|
-
if (opts?.autoCorrect != null) res.autoCorrect = opts.autoCorrect;
|
|
187
|
-
if (opts?.enterKeyHint) res.enterKeyHint = opts.enterKeyHint;
|
|
188
|
-
applyAutoCompleteDefaultsWeb(res, opts?.autoComplete);
|
|
189
|
-
return res;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
//#endregion
|
|
193
|
-
export { mapKeyboardToWeb };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { cn, init_utils } from "../ui-kit-core/dist/utils.js";
|
|
2
|
-
import * as React$1 from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { cva } from "class-variance-authority";
|
|
5
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
-
|
|
7
|
-
//#region ../../libs/design-system/dist/ui-kit-web/dist/ui/button.js
|
|
8
|
-
init_utils();
|
|
9
|
-
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-hidden focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
14
|
-
outline: "border bg-background shadow-2xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
15
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
16
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
17
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
18
|
-
},
|
|
19
|
-
size: {
|
|
20
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
21
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
22
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
23
|
-
icon: "size-9"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
variant: "default",
|
|
28
|
-
size: "default"
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const Button = React$1.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
32
|
-
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
33
|
-
"data-slot": "button",
|
|
34
|
-
className: cn(buttonVariants({
|
|
35
|
-
variant,
|
|
36
|
-
size,
|
|
37
|
-
className
|
|
38
|
-
})),
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
return /* @__PURE__ */ jsx("button", {
|
|
42
|
-
ref,
|
|
43
|
-
"data-slot": "button",
|
|
44
|
-
className: cn(buttonVariants({
|
|
45
|
-
variant,
|
|
46
|
-
size,
|
|
47
|
-
className
|
|
48
|
-
})),
|
|
49
|
-
...props
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
Button.displayName = "Button";
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
export { Button };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { cn, init_utils } from "../ui-kit-core/dist/utils.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region ../../libs/design-system/dist/ui-kit-web/dist/ui/textarea.js
|
|
6
|
-
init_utils();
|
|
7
|
-
function Textarea({ className, ...props }) {
|
|
8
|
-
return /* @__PURE__ */ jsx("textarea", {
|
|
9
|
-
"data-slot": "textarea",
|
|
10
|
-
className: cn("aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-2xs outline-hidden transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className),
|
|
11
|
-
...props
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { Textarea };
|