agentgui 1.0.819 → 1.0.821

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.
@@ -6,7 +6,7 @@ class UIComponents {
6
6
  content = '',
7
7
  buttons = [],
8
8
  onClose = null,
9
- size = 'medium' // small, medium, large
9
+ size = 'medium'
10
10
  } = config;
11
11
 
12
12
  const modal = document.createElement('div');
@@ -122,7 +122,7 @@ class UIComponents {
122
122
  static createAlert(config = {}) {
123
123
  const {
124
124
  message = '',
125
- type = 'info', // info, success, warning, error
125
+ type = 'info',
126
126
  duration = 5000,
127
127
  dismissible = true
128
128
  } = config;
@@ -157,7 +157,7 @@ class UIComponents {
157
157
 
158
158
  static createSpinner(config = {}) {
159
159
  const {
160
- size = 'medium', // small, medium, large
160
+ size = 'medium',
161
161
  text = 'Loading...'
162
162
  } = config;
163
163
 
@@ -176,192 +176,10 @@ class UIComponents {
176
176
  return container;
177
177
  }
178
178
 
179
- static createProgressBar(config = {}) {
180
- const {
181
- percentage = 0,
182
- label = '',
183
- showLabel = true
184
- } = config;
185
-
186
- const container = document.createElement('div');
187
- container.className = 'progress-container';
188
-
189
- let html = '';
190
- if (label && showLabel) {
191
- html += `<div class="flex justify-between mb-2 text-sm"><span>${UIComponents.escapeHtml(label)}</span><span>${Math.round(percentage)}%</span></div>`;
192
- }
193
-
194
- html += `
195
- <progress class="progress progress-primary progress-xs w-full" value="${Math.min(100, Math.max(0, percentage))}" max="100"></progress>
196
- `;
197
-
198
- container.innerHTML = html;
199
- return container;
200
- }
201
-
202
- static createCollapsible(config = {}) {
203
- const {
204
- title = 'Details',
205
- content = '',
206
- isOpen = false
207
- } = config;
208
-
209
- const container = document.createElement('div');
210
- container.className = 'collapsible';
211
-
212
- container.innerHTML = `
213
- <details ${isOpen ? 'open' : ''}>
214
- <summary class="cursor-pointer font-semibold hover:bg-base-200 px-2 py-1 rounded transition-colors">
215
- ${UIComponents.escapeHtml(title)}
216
- </summary>
217
- <div class="content mt-2 ml-4">
218
- ${typeof content === 'string' ? content : ''}
219
- </div>
220
- </details>
221
- `;
222
-
223
- return container;
224
- }
225
-
226
- static createInput(config = {}) {
227
- const {
228
- type = 'text',
229
- name = '',
230
- label = '',
231
- placeholder = '',
232
- value = '',
233
- required = false
234
- } = config;
235
-
236
- const container = document.createElement('div');
237
- container.className = 'form-group mb-4';
238
-
239
- let html = '';
240
- if (label) {
241
- html += `<label class="block text-sm font-medium mb-2">${UIComponents.escapeHtml(label)}</label>`;
242
- }
243
-
244
- html += `
245
- <input
246
- type="${type}"
247
- name="${name}"
248
- placeholder="${UIComponents.escapeHtml(placeholder)}"
249
- value="${UIComponents.escapeHtml(value)}"
250
- ${required ? 'required' : ''}
251
- class="input input-block input-solid"
252
- />
253
- `;
254
-
255
- container.innerHTML = html;
256
- return container;
257
- }
258
-
259
- static createSelect(config = {}) {
260
- const {
261
- name = '',
262
- label = '',
263
- options = [],
264
- value = '',
265
- required = false
266
- } = config;
267
-
268
- const container = document.createElement('div');
269
- container.className = 'form-group mb-4';
270
-
271
- let html = '';
272
- if (label) {
273
- html += `<label class="block text-sm font-medium mb-2">${UIComponents.escapeHtml(label)}</label>`;
274
- }
275
-
276
- html += `
277
- <select
278
- name="${name}"
279
- ${required ? 'required' : ''}
280
- class="select select-block select-solid"
281
- >
282
- ${options.map(opt => `
283
- <option value="${opt.value}" ${opt.value === value ? 'selected' : ''}>
284
- ${UIComponents.escapeHtml(opt.label)}
285
- </option>
286
- `).join('')}
287
- </select>
288
- `;
289
-
290
- container.innerHTML = html;
291
- return container;
292
- }
293
-
294
- static createButtonGroup(config = {}) {
295
- const {
296
- buttons = [],
297
- vertical = false
298
- } = config;
299
-
300
- const container = document.createElement('div');
301
- container.className = `button-group flex gap-2 ${vertical ? 'flex-col' : 'flex-row'}`;
302
-
303
- buttons.forEach(btn => {
304
- const button = document.createElement('button');
305
- button.className = `btn btn-${btn.variant || 'secondary'} flex-${vertical ? '1' : 'none'}`;
306
- button.textContent = btn.label;
307
- if (btn.onClick) {
308
- button.addEventListener('click', btn.onClick);
309
- }
310
- container.appendChild(button);
311
- });
312
-
313
- return container;
314
- }
315
-
316
- static createBadge(config = {}) {
317
- const {
318
- label = '',
319
- variant = 'default', // default, primary, success, warning, error
320
- size = 'medium' // small, medium, large
321
- } = config;
322
-
323
- const sizeClasses = {
324
- 'small': 'badge-sm',
325
- 'medium': 'badge-md',
326
- 'large': 'badge-lg'
327
- };
328
-
329
- const variantClasses = {
330
- 'default': 'badge-flat',
331
- 'primary': 'badge-flat-primary',
332
- 'success': 'badge-flat-success',
333
- 'warning': 'badge-flat-warning',
334
- 'error': 'badge-flat-error'
335
- };
336
-
337
- const badge = document.createElement('span');
338
- badge.className = `badge ${sizeClasses[size] || sizeClasses['medium']} ${variantClasses[variant] || variantClasses['default']}`;
339
- badge.textContent = label;
340
- return badge;
341
- }
342
-
343
179
  static escapeHtml(text) {
344
180
  return window._escHtml(text);
345
181
  }
346
182
 
347
- static copyToClipboard(text) {
348
- return navigator.clipboard.writeText(text).catch(err => {
349
- console.error('Failed to copy:', err);
350
- return false;
351
- });
352
- }
353
-
354
- static downloadFile(data, filename, mimeType = 'text/plain') {
355
- const blob = new Blob([data], { type: mimeType });
356
- const url = URL.createObjectURL(blob);
357
- const link = document.createElement('a');
358
- link.href = url;
359
- link.download = filename;
360
- document.body.appendChild(link);
361
- link.click();
362
- document.body.removeChild(link);
363
- URL.revokeObjectURL(url);
364
- }
365
183
  }
366
184
 
367
185
  if (typeof module !== 'undefined' && module.exports) {