@webmcp-auto-ui/ui 2.5.33 → 2.5.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmcp-auto-ui/ui",
3
- "version": "2.5.33",
3
+ "version": "2.5.34",
4
4
  "description": "Svelte 5 UI components — primitives, widgets, window manager",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -69,6 +69,7 @@
69
69
  "auto-ui"
70
70
  ],
71
71
  "dependencies": {
72
+ "@internationalized/date": "^3.8.1",
72
73
  "@types/d3": "^7.4.3",
73
74
  "@webmcp-auto-ui/agent": "*",
74
75
  "@webmcp-auto-ui/core": "*",
@@ -3,15 +3,18 @@
3
3
  placeholder?: string;
4
4
  disabled?: boolean;
5
5
  value?: string;
6
+ onsubmit?: (text: string) => void;
7
+ onstop?: () => void;
6
8
  }
7
9
 
8
- let { placeholder = 'Type a message...', disabled = false, value = $bindable('') }: Props = $props();
10
+ let { placeholder = 'Type a message...', disabled = false, value = $bindable(''), onsubmit, onstop }: Props = $props();
9
11
 
10
12
  let inputEl = $state<HTMLInputElement | null>(null);
11
13
 
12
14
  function handleSubmit() {
13
15
  const text = value?.trim();
14
16
  if (!text || disabled) return;
17
+ onsubmit?.(text);
15
18
  inputEl?.dispatchEvent(new CustomEvent('submit', { detail: text, bubbles: true }));
16
19
  value = '';
17
20
  }
@@ -24,6 +27,7 @@
24
27
  }
25
28
 
26
29
  function handleStop() {
30
+ onstop?.();
27
31
  inputEl?.dispatchEvent(new CustomEvent('stop', { bubbles: true }));
28
32
  }
29
33
  </script>
@@ -5,11 +5,12 @@
5
5
  type Props = {
6
6
  class?: string;
7
7
  children?: import('svelte').Snippet;
8
+ onclick?: (e: MouseEvent) => void;
8
9
  };
9
10
 
10
- let { class: className, children: childrenSnippet }: Props = $props();
11
+ let { class: className, children: childrenSnippet, onclick }: Props = $props();
11
12
  </script>
12
13
 
13
- <Dialog.Trigger class={cn(className)}>
14
+ <Dialog.Trigger class={cn(className)} {onclick}>
14
15
  {@render childrenSnippet?.()}
15
16
  </Dialog.Trigger>
@@ -20,8 +20,7 @@
20
20
 
21
21
  let rootEl = $state<HTMLElement | null>(null);
22
22
 
23
- function handleSubmit(e: CustomEvent<string>) {
24
- const text = e.detail;
23
+ function handleSubmit(text: string) {
25
24
  if (!text) return;
26
25
  rootEl?.dispatchEvent(
27
26
  new CustomEvent('widget:interact', {
@@ -18,7 +18,7 @@
18
18
  * - wrapped: data = { spec: { code, ... } }
19
19
  * The cast handles the legacy wrapped shape defensively.
20
20
  */
21
- const resolved = $derived<JsSandboxData>(() => {
21
+ const resolved: JsSandboxData = $derived.by(() => {
22
22
  const d = data as Record<string, unknown> | null | undefined;
23
23
  if (d && typeof d === 'object' && 'spec' in d && d.spec && typeof d.spec === 'object') {
24
24
  return d.spec as JsSandboxData;
@@ -33,15 +33,15 @@
33
33
  <style>
34
34
  *,*::before,*::after{box-sizing:border-box}
35
35
  body{margin:0;padding:8px;font-family:system-ui,sans-serif;font-size:13px;}
36
- ${resolved().css ?? ''}
36
+ ${resolved.css ?? ''}
37
37
  </style>
38
38
  </head>
39
39
  <body>
40
- <div id="root">${resolved().html ?? ''}</div>
40
+ <div id="root">${resolved.html ?? ''}</div>
41
41
  <script>
42
42
  (function(){
43
43
  try{
44
- ${resolved().code ?? '// no code provided'}
44
+ ${resolved.code ?? '// no code provided'}
45
45
  }catch(e){
46
46
  document.getElementById('root').innerHTML='<pre style="color:red;white-space:pre-wrap">'+e+'<\/pre>';
47
47
  }
@@ -52,16 +52,16 @@ document.getElementById('root').innerHTML='<pre style="color:red;white-space:pre
52
52
  </script>
53
53
 
54
54
  <div class="bg-surface border border-border rounded-lg overflow-hidden font-sans">
55
- {#if resolved().title}
55
+ {#if resolved.title}
56
56
  <div class="px-3 py-2 border-b border-border text-sm font-semibold text-text1 flex items-center gap-2">
57
57
  <span class="text-xs opacity-50">JS</span>
58
- {resolved().title}
58
+ {resolved.title}
59
59
  </div>
60
60
  {/if}
61
61
  <iframe
62
62
  {srcdoc}
63
63
  sandbox="allow-scripts"
64
- title={resolved().title ?? 'JS Sandbox'}
65
- style="width:100%;height:{resolved().height ?? '300px'};border:none;display:block;"
64
+ title={resolved.title ?? 'JS Sandbox'}
65
+ style="width:100%;height:{resolved.height ?? '300px'};border:none;display:block;"
66
66
  ></iframe>
67
67
  </div>