@signal9/era-ui 2.1.0 → 2.3.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/actions/action.svelte +41 -0
- package/dist/ai/actions/action.svelte.d.ts +12 -0
- package/dist/ai/actions/actions.svelte +15 -0
- package/dist/ai/actions/actions.svelte.d.ts +8 -0
- package/dist/ai/actions/index.d.ts +2 -0
- package/dist/ai/actions/index.js +2 -0
- package/dist/ai/artifact/artifact-actions.svelte +7 -0
- package/dist/ai/artifact/artifact-actions.svelte.d.ts +8 -0
- package/dist/ai/artifact/artifact-close.svelte +9 -0
- package/dist/ai/artifact/artifact-close.svelte.d.ts +6 -0
- package/dist/ai/artifact/artifact-content.svelte +7 -0
- package/dist/ai/artifact/artifact-content.svelte.d.ts +8 -0
- package/dist/ai/artifact/artifact-description.svelte +7 -0
- package/dist/ai/artifact/artifact-description.svelte.d.ts +8 -0
- package/dist/ai/artifact/artifact-header.svelte +16 -0
- package/dist/ai/artifact/artifact-header.svelte.d.ts +8 -0
- package/dist/ai/artifact/artifact-title.svelte +7 -0
- package/dist/ai/artifact/artifact-title.svelte.d.ts +8 -0
- package/dist/ai/artifact/artifact.svelte +16 -0
- package/dist/ai/artifact/artifact.svelte.d.ts +8 -0
- package/dist/ai/artifact/index.d.ts +8 -0
- package/dist/ai/artifact/index.js +8 -0
- package/dist/ai/chain-of-thought/chain-of-thought-step.svelte +39 -0
- package/dist/ai/chain-of-thought/chain-of-thought-step.svelte.d.ts +11 -0
- package/dist/ai/chain-of-thought/chain-of-thought.svelte +30 -0
- package/dist/ai/chain-of-thought/chain-of-thought.svelte.d.ts +11 -0
- package/dist/ai/chain-of-thought/index.d.ts +3 -0
- package/dist/ai/chain-of-thought/index.js +3 -0
- package/dist/ai/checkpoint.svelte +27 -0
- package/dist/ai/checkpoint.svelte.d.ts +10 -0
- package/dist/ai/confirmation/confirmation-actions.svelte +9 -0
- package/dist/ai/confirmation/confirmation-actions.svelte.d.ts +8 -0
- package/dist/ai/confirmation/confirmation.svelte +36 -0
- package/dist/ai/confirmation/confirmation.svelte.d.ts +11 -0
- package/dist/ai/confirmation/index.d.ts +2 -0
- package/dist/ai/confirmation/index.js +2 -0
- package/dist/ai/context/context.svelte +49 -0
- package/dist/ai/context/context.svelte.d.ts +9 -0
- package/dist/ai/context/index.d.ts +1 -0
- package/dist/ai/context/index.js +1 -0
- package/dist/ai/conversation/context.d.ts +3 -0
- package/dist/ai/conversation/context.js +12 -0
- package/dist/ai/conversation/conversation-content.svelte +32 -0
- package/dist/ai/conversation/conversation-content.svelte.d.ts +8 -0
- package/dist/ai/conversation/conversation-empty-state.svelte +32 -0
- package/dist/ai/conversation/conversation-empty-state.svelte.d.ts +11 -0
- package/dist/ai/conversation/conversation-scroll-button.svelte +27 -0
- package/dist/ai/conversation/conversation-scroll-button.svelte.d.ts +6 -0
- package/dist/ai/conversation/conversation.svelte +21 -0
- package/dist/ai/conversation/conversation.svelte.d.ts +8 -0
- package/dist/ai/conversation/index.d.ts +5 -0
- package/dist/ai/conversation/index.js +5 -0
- package/dist/ai/copy-button.svelte +42 -0
- package/dist/ai/copy-button.svelte.d.ts +8 -0
- package/dist/ai/image.svelte +19 -0
- package/dist/ai/image.svelte.d.ts +8 -0
- package/dist/ai/index.d.ts +29 -0
- package/dist/ai/index.js +31 -0
- package/dist/ai/inline-citation/index.d.ts +1 -0
- package/dist/ai/inline-citation/index.js +1 -0
- package/dist/ai/inline-citation/inline-citation.svelte +66 -0
- package/dist/ai/inline-citation/inline-citation.svelte.d.ts +11 -0
- package/dist/ai/loader.svelte +8 -0
- package/dist/ai/loader.svelte.d.ts +6 -0
- package/dist/ai/message/branch.svelte.d.ts +10 -0
- package/dist/ai/message/branch.svelte.js +28 -0
- package/dist/ai/message/context.d.ts +6 -0
- package/dist/ai/message/context.js +1 -0
- package/dist/ai/message/index.d.ts +8 -0
- package/dist/ai/message/index.js +7 -0
- package/dist/ai/message/message-branch-content.svelte +24 -0
- package/dist/ai/message/message-branch-content.svelte.d.ts +10 -0
- package/dist/ai/message/message-branch-selector.svelte +25 -0
- package/dist/ai/message/message-branch-selector.svelte.d.ts +6 -0
- package/dist/ai/message/message-branch.svelte +25 -0
- package/dist/ai/message/message-branch.svelte.d.ts +9 -0
- package/dist/ai/message/message-content.svelte +24 -0
- package/dist/ai/message/message-content.svelte.d.ts +8 -0
- package/dist/ai/message/message-toolbar.svelte +23 -0
- package/dist/ai/message/message-toolbar.svelte.d.ts +8 -0
- package/dist/ai/message/message.svelte +27 -0
- package/dist/ai/message/message.svelte.d.ts +10 -0
- package/dist/ai/model-selector/index.d.ts +1 -0
- package/dist/ai/model-selector/index.js +1 -0
- package/dist/ai/model-selector/model-selector.svelte +61 -0
- package/dist/ai/model-selector/model-selector.svelte.d.ts +15 -0
- package/dist/ai/open-in-chat/index.d.ts +1 -0
- package/dist/ai/open-in-chat/index.js +1 -0
- package/dist/ai/open-in-chat/open-in-chat.svelte +41 -0
- package/dist/ai/open-in-chat/open-in-chat.svelte.d.ts +32 -0
- package/dist/ai/plan/index.d.ts +3 -0
- package/dist/ai/plan/index.js +3 -0
- package/dist/ai/plan/plan-content.svelte +13 -0
- package/dist/ai/plan/plan-content.svelte.d.ts +8 -0
- package/dist/ai/plan/plan-header.svelte +22 -0
- package/dist/ai/plan/plan-header.svelte.d.ts +9 -0
- package/dist/ai/plan/plan.svelte +23 -0
- package/dist/ai/plan/plan.svelte.d.ts +10 -0
- package/dist/ai/prompt-input/attachments.svelte.d.ts +27 -0
- package/dist/ai/prompt-input/attachments.svelte.js +60 -0
- package/dist/ai/prompt-input/index.d.ts +7 -0
- package/dist/ai/prompt-input/index.js +7 -0
- package/dist/ai/prompt-input/prompt-input-add-attachments.svelte +12 -0
- package/dist/ai/prompt-input/prompt-input-add-attachments.svelte.d.ts +6 -0
- package/dist/ai/prompt-input/prompt-input-attachments.svelte +40 -0
- package/dist/ai/prompt-input/prompt-input-attachments.svelte.d.ts +18 -0
- package/dist/ai/prompt-input/prompt-input-submit.svelte +49 -0
- package/dist/ai/prompt-input/prompt-input-submit.svelte.d.ts +10 -0
- package/dist/ai/prompt-input/prompt-input-textarea.svelte +57 -0
- package/dist/ai/prompt-input/prompt-input-textarea.svelte.d.ts +7 -0
- package/dist/ai/prompt-input/prompt-input-toolbar.svelte +15 -0
- package/dist/ai/prompt-input/prompt-input-toolbar.svelte.d.ts +8 -0
- package/dist/ai/prompt-input/prompt-input.svelte +98 -0
- package/dist/ai/prompt-input/prompt-input.svelte.d.ts +17 -0
- package/dist/ai/queue/index.d.ts +2 -0
- package/dist/ai/queue/index.js +2 -0
- package/dist/ai/queue/queue-item.svelte +26 -0
- package/dist/ai/queue/queue-item.svelte.d.ts +9 -0
- package/dist/ai/queue/queue.svelte +14 -0
- package/dist/ai/queue/queue.svelte.d.ts +8 -0
- package/dist/ai/reasoning/index.d.ts +3 -0
- package/dist/ai/reasoning/index.js +3 -0
- package/dist/ai/reasoning/reasoning-trigger.svelte +22 -0
- package/dist/ai/reasoning/reasoning-trigger.svelte.d.ts +9 -0
- package/dist/ai/reasoning/reasoning.svelte +52 -0
- package/dist/ai/reasoning/reasoning.svelte.d.ts +13 -0
- package/dist/ai/response/index.d.ts +2 -0
- package/dist/ai/response/index.js +2 -0
- package/dist/ai/response/repair.d.ts +7 -0
- package/dist/ai/response/repair.js +26 -0
- package/dist/ai/response/response.svelte +112 -0
- package/dist/ai/response/response.svelte.d.ts +10 -0
- package/dist/ai/shimmer.svelte +15 -0
- package/dist/ai/shimmer.svelte.d.ts +9 -0
- package/dist/ai/sources/index.d.ts +4 -0
- package/dist/ai/sources/index.js +4 -0
- package/dist/ai/sources/source.svelte +16 -0
- package/dist/ai/sources/source.svelte.d.ts +7 -0
- package/dist/ai/sources/sources-trigger.svelte +12 -0
- package/dist/ai/sources/sources-trigger.svelte.d.ts +8 -0
- package/dist/ai/sources/sources.svelte +15 -0
- package/dist/ai/sources/sources.svelte.d.ts +9 -0
- package/dist/ai/stick-to-bottom.svelte.d.ts +38 -0
- package/dist/ai/stick-to-bottom.svelte.js +133 -0
- package/dist/ai/suggestion/index.d.ts +2 -0
- package/dist/ai/suggestion/index.js +2 -0
- package/dist/ai/suggestion/suggestion.svelte +25 -0
- package/dist/ai/suggestion/suggestion.svelte.d.ts +10 -0
- package/dist/ai/suggestion/suggestions.svelte +18 -0
- package/dist/ai/suggestion/suggestions.svelte.d.ts +8 -0
- package/dist/ai/task/index.d.ts +5 -0
- package/dist/ai/task/index.js +5 -0
- package/dist/ai/task/task-content.svelte +14 -0
- package/dist/ai/task/task-content.svelte.d.ts +8 -0
- package/dist/ai/task/task-item-file.svelte +8 -0
- package/dist/ai/task/task-item-file.svelte.d.ts +7 -0
- package/dist/ai/task/task-item.svelte +8 -0
- package/dist/ai/task/task-item.svelte.d.ts +8 -0
- package/dist/ai/task/task-trigger.svelte +12 -0
- package/dist/ai/task/task-trigger.svelte.d.ts +8 -0
- package/dist/ai/task/task.svelte +17 -0
- package/dist/ai/task/task.svelte.d.ts +11 -0
- package/dist/ai/tool/index.d.ts +5 -0
- package/dist/ai/tool/index.js +5 -0
- package/dist/ai/tool/tool-header.svelte +20 -0
- package/dist/ai/tool/tool-header.svelte.d.ts +9 -0
- package/dist/ai/tool/tool-input.svelte +10 -0
- package/dist/ai/tool/tool-input.svelte.d.ts +6 -0
- package/dist/ai/tool/tool-output.svelte +20 -0
- package/dist/ai/tool/tool-output.svelte.d.ts +7 -0
- package/dist/ai/tool/tool.svelte +41 -0
- package/dist/ai/tool/tool.svelte.d.ts +12 -0
- package/dist/ai/web-preview/index.d.ts +1 -0
- package/dist/ai/web-preview/index.js +1 -0
- package/dist/ai/web-preview/web-preview.svelte +48 -0
- package/dist/ai/web-preview/web-preview.svelte.d.ts +8 -0
- package/dist/ai/workflow/canvas.svelte +19 -0
- package/dist/ai/workflow/canvas.svelte.d.ts +11 -0
- package/dist/ai/workflow/index.d.ts +2 -0
- package/dist/ai/workflow/index.js +2 -0
- package/dist/ai/workflow/node.svelte +27 -0
- package/dist/ai/workflow/node.svelte.d.ts +9 -0
- package/dist/era-ui.css +1 -1
- package/dist/generated-docs/llms-full.txt +56 -0
- package/dist/generated-docs/llms.txt +1 -1
- package/dist/generated-docs/manifest.json +14 -0
- package/dist/generated-docs/step.md +51 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/os/motion.d.ts +1 -19
- package/dist/os/motion.js +3 -44
- package/dist/os/taskbar.svelte +6 -3
- package/dist/styles/index.css +26 -0
- package/dist/ui/command-bar/command-bar.svelte +8 -6
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/step/context.d.ts +8 -0
- package/dist/ui/step/context.js +8 -0
- package/dist/ui/step/index.d.ts +5 -0
- package/dist/ui/step/index.js +4 -0
- package/dist/ui/step/step-content.svelte +55 -0
- package/dist/ui/step/step-content.svelte.d.ts +5 -0
- package/dist/ui/step/step-root.svelte +31 -0
- package/dist/ui/step/step-root.svelte.d.ts +9 -0
- package/dist/ui/step/step-section.svelte +23 -0
- package/dist/ui/step/step-section.svelte.d.ts +10 -0
- package/dist/ui/step/step-summary.svelte +55 -0
- package/dist/ui/step/step-summary.svelte.d.ts +5 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/motion.d.ts +19 -0
- package/dist/utils/motion.js +44 -0
- package/package.json +14 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stick-to-bottom contract, distilled from the reference implementations
|
|
3
|
+
* (use-stick-to-bottom, open-webui, vercel/ai-elements):
|
|
4
|
+
*
|
|
5
|
+
* - auto-follow content growth while pinned to the bottom;
|
|
6
|
+
* - ANY user-initiated upward intent breaks the pin instantly (wheel up,
|
|
7
|
+
* touch drag, PageUp/ArrowUp/Home, or a scroll event that moved up and
|
|
8
|
+
* wasn't ours);
|
|
9
|
+
* - scrolling back to within `threshold` px of the bottom re-pins;
|
|
10
|
+
* - content growth is watched with a ResizeObserver on the CONTENT (scroll
|
|
11
|
+
* events alone miss it — images, code blocks, expanding steps), and the
|
|
12
|
+
* scroll events a resize provokes are guarded so a reflow never reads as
|
|
13
|
+
* the user scrolling away;
|
|
14
|
+
* - an active text selection inside the viewport suspends following (never
|
|
15
|
+
* yank text out from under a selecting user);
|
|
16
|
+
* - scrolling is a direct scrollTop write on the container, coalesced through
|
|
17
|
+
* rAF — never scrollIntoView (it scrolls ancestors too).
|
|
18
|
+
*
|
|
19
|
+
* CSS `overflow-anchor` and `column-reverse` are deliberately not used: no
|
|
20
|
+
* Safari support for the former; reversed DOM order breaks screen readers,
|
|
21
|
+
* selection, and `role="log"` semantics for the latter.
|
|
22
|
+
*/
|
|
23
|
+
export class StickToBottom {
|
|
24
|
+
/** True while auto-following. Reactive — drive the ↓ button off it. */
|
|
25
|
+
pinned = $state(true);
|
|
26
|
+
/** Px from the bottom still considered "at bottom" for re-pinning. */
|
|
27
|
+
threshold = 70;
|
|
28
|
+
#el = null;
|
|
29
|
+
#lastTop = 0;
|
|
30
|
+
#programmatic = 0;
|
|
31
|
+
#resizeGuard = 0;
|
|
32
|
+
#raf = 0;
|
|
33
|
+
/** Attach to the scroll container (`overflow-y-auto`). */
|
|
34
|
+
viewport = (el) => {
|
|
35
|
+
this.#el = el;
|
|
36
|
+
this.#lastTop = el.scrollTop;
|
|
37
|
+
const unpin = () => (this.pinned = false);
|
|
38
|
+
const onWheel = (e) => {
|
|
39
|
+
if (e.deltaY < 0)
|
|
40
|
+
unpin();
|
|
41
|
+
};
|
|
42
|
+
const onTouchMove = () => {
|
|
43
|
+
// A touch drag is user intent; if it lands near the bottom the
|
|
44
|
+
// scroll handler re-pins right after.
|
|
45
|
+
if (!this.#nearBottom())
|
|
46
|
+
unpin();
|
|
47
|
+
};
|
|
48
|
+
const onKeyDown = (e) => {
|
|
49
|
+
if (e.key === 'PageUp' || e.key === 'ArrowUp' || e.key === 'Home')
|
|
50
|
+
unpin();
|
|
51
|
+
};
|
|
52
|
+
const onScroll = () => {
|
|
53
|
+
const top = el.scrollTop;
|
|
54
|
+
const wasOurs = this.#programmatic > 0 || this.#resizeGuard > 0;
|
|
55
|
+
if (!wasOurs) {
|
|
56
|
+
if (top < this.#lastTop - 1)
|
|
57
|
+
unpin();
|
|
58
|
+
else if (this.#nearBottom())
|
|
59
|
+
this.pinned = true;
|
|
60
|
+
}
|
|
61
|
+
this.#lastTop = top;
|
|
62
|
+
};
|
|
63
|
+
const onScrollEnd = () => {
|
|
64
|
+
this.#programmatic = 0;
|
|
65
|
+
};
|
|
66
|
+
el.addEventListener('wheel', onWheel, { passive: true });
|
|
67
|
+
el.addEventListener('touchmove', onTouchMove, { passive: true });
|
|
68
|
+
el.addEventListener('keydown', onKeyDown);
|
|
69
|
+
el.addEventListener('scroll', onScroll, { passive: true });
|
|
70
|
+
el.addEventListener('scrollend', onScrollEnd);
|
|
71
|
+
return () => {
|
|
72
|
+
el.removeEventListener('wheel', onWheel);
|
|
73
|
+
el.removeEventListener('touchmove', onTouchMove);
|
|
74
|
+
el.removeEventListener('keydown', onKeyDown);
|
|
75
|
+
el.removeEventListener('scroll', onScroll);
|
|
76
|
+
el.removeEventListener('scrollend', onScrollEnd);
|
|
77
|
+
if (this.#el === el)
|
|
78
|
+
this.#el = null;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/** Attach to the content wrapper INSIDE the viewport. */
|
|
82
|
+
content = (el) => {
|
|
83
|
+
const ro = new ResizeObserver(() => {
|
|
84
|
+
if (!this.#el)
|
|
85
|
+
return;
|
|
86
|
+
// Guard the scroll events this resize provokes for two frames so a
|
|
87
|
+
// code-block reflow never reads as the user scrolling away.
|
|
88
|
+
this.#resizeGuard++;
|
|
89
|
+
if (this.pinned && !this.#selecting())
|
|
90
|
+
this.scrollToBottom();
|
|
91
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
92
|
+
this.#resizeGuard = Math.max(0, this.#resizeGuard - 1);
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
ro.observe(el);
|
|
96
|
+
return () => ro.disconnect();
|
|
97
|
+
};
|
|
98
|
+
#nearBottom() {
|
|
99
|
+
const el = this.#el;
|
|
100
|
+
if (!el)
|
|
101
|
+
return true;
|
|
102
|
+
return el.scrollHeight - el.scrollTop - el.clientHeight <= this.threshold;
|
|
103
|
+
}
|
|
104
|
+
#selecting() {
|
|
105
|
+
if (typeof window === 'undefined')
|
|
106
|
+
return false;
|
|
107
|
+
const sel = window.getSelection();
|
|
108
|
+
return !!sel && !sel.isCollapsed && this.#el?.contains(sel.anchorNode) === true;
|
|
109
|
+
}
|
|
110
|
+
/** Jump the viewport to the bottom (rAF-coalesced; safe to call per token). */
|
|
111
|
+
scrollToBottom() {
|
|
112
|
+
if (this.#raf)
|
|
113
|
+
return;
|
|
114
|
+
this.#raf = requestAnimationFrame(() => {
|
|
115
|
+
this.#raf = 0;
|
|
116
|
+
const el = this.#el;
|
|
117
|
+
if (!el)
|
|
118
|
+
return;
|
|
119
|
+
this.#programmatic++;
|
|
120
|
+
el.scrollTop = el.scrollHeight;
|
|
121
|
+
// scrollend clears the flag; the double-rAF is the fallback for
|
|
122
|
+
// browsers that don't fire it.
|
|
123
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
124
|
+
this.#programmatic = Math.max(0, this.#programmatic - 1);
|
|
125
|
+
}));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** The ↓ button's action: re-pin and go. */
|
|
129
|
+
repin() {
|
|
130
|
+
this.pinned = true;
|
|
131
|
+
this.scrollToBottom();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { Button } from '../../ui/button/index.js';
|
|
4
|
+
import { cn } from '../../utils/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
suggestion,
|
|
8
|
+
onSelect,
|
|
9
|
+
children,
|
|
10
|
+
class: className
|
|
11
|
+
}: {
|
|
12
|
+
suggestion: string;
|
|
13
|
+
onSelect?: (suggestion: string) => void;
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
class?: string;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Button
|
|
20
|
+
size="sm"
|
|
21
|
+
class={cn('shrink-0 rounded-full', className)}
|
|
22
|
+
onclick={() => onSelect?.(suggestion)}
|
|
23
|
+
>
|
|
24
|
+
{#if children}{@render children()}{:else}{suggestion}{/if}
|
|
25
|
+
</Button>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
suggestion: string;
|
|
4
|
+
onSelect?: (suggestion: string) => void;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const Suggestion: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type Suggestion = ReturnType<typeof Suggestion>;
|
|
10
|
+
export default Suggestion;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn } from '../../utils/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: HTMLAttributes<HTMLDivElement> & { children?: Snippet } = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class={cn('scrollbar-none flex w-full flex-nowrap items-center gap-(--era-gap) overflow-x-auto', className)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
>
|
|
17
|
+
{@render children?.()}
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const Suggestions: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Suggestions = ReturnType<typeof Suggestions>;
|
|
8
|
+
export default Suggestions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root } from './task.svelte';
|
|
2
|
+
export { default as Trigger } from './task-trigger.svelte';
|
|
3
|
+
export { default as Content } from './task-content.svelte';
|
|
4
|
+
export { default as Item } from './task-item.svelte';
|
|
5
|
+
export { default as ItemFile } from './task-item-file.svelte';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root } from './task.svelte';
|
|
2
|
+
export { default as Trigger } from './task-trigger.svelte';
|
|
3
|
+
export { default as Content } from './task-content.svelte';
|
|
4
|
+
export { default as Item } from './task-item.svelte';
|
|
5
|
+
export { default as ItemFile } from './task-item-file.svelte';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import * as Step from '../../ui/step/index.js';
|
|
4
|
+
import { cn } from '../../utils/index.js';
|
|
5
|
+
|
|
6
|
+
let { children, class: className }: { children?: Snippet; class?: string } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<!-- The task log rail: items hang off a left border, terminal-trace style. -->
|
|
10
|
+
<Step.Content
|
|
11
|
+
class={cn('border-s-2 border-divider-faded bg-transparent p-0 ps-(--era-pad-sm) shadow-none', className)}
|
|
12
|
+
>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</Step.Content>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children?: Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const TaskContent: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type TaskContent = ReturnType<typeof TaskContent>;
|
|
8
|
+
export default TaskContent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../../utils/index.js';
|
|
4
|
+
|
|
5
|
+
let { children, class: className }: { children?: Snippet; class?: string } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class={cn('min-w-0 text-body text-muted', className)}>{@render children?.()}</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import Search from '@lucide/svelte/icons/search';
|
|
4
|
+
import * as Step from '../../ui/step/index.js';
|
|
5
|
+
|
|
6
|
+
let { title, children }: { title?: string; children?: Snippet } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Step.Summary>
|
|
10
|
+
<Search class="size-(--era-h-xs) shrink-0" aria-hidden="true" />
|
|
11
|
+
{#if children}{@render children()}{:else}{title}{/if}
|
|
12
|
+
</Step.Summary>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const TaskTrigger: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type TaskTrigger = ReturnType<typeof TaskTrigger>;
|
|
8
|
+
export default TaskTrigger;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { StepStatus } from '../../ui/step/index.js';
|
|
4
|
+
import * as Step from '../../ui/step/index.js';
|
|
5
|
+
import { cn } from '../../utils/index.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
open = $bindable(true),
|
|
9
|
+
status = 'done',
|
|
10
|
+
children,
|
|
11
|
+
class: className
|
|
12
|
+
}: { open?: boolean; status?: StepStatus; children?: Snippet; class?: string } = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Step.Root {status} bind:open class={cn(className)}>
|
|
16
|
+
{@render children?.()}
|
|
17
|
+
</Step.Root>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { StepStatus } from '../../ui/step/index.js';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
status?: StepStatus;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const Task: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
10
|
+
type Task = ReturnType<typeof Task>;
|
|
11
|
+
export default Task;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root, type ToolState } from './tool.svelte';
|
|
2
|
+
export { default as Header } from './tool-header.svelte';
|
|
3
|
+
export { default as Input } from './tool-input.svelte';
|
|
4
|
+
export { default as Output } from './tool-output.svelte';
|
|
5
|
+
export { Content } from '../../ui/step/index.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Root } from './tool.svelte';
|
|
2
|
+
export { default as Header } from './tool-header.svelte';
|
|
3
|
+
export { default as Input } from './tool-input.svelte';
|
|
4
|
+
export { default as Output } from './tool-output.svelte';
|
|
5
|
+
export { Content } from '../../ui/step/index.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import Wrench from '@lucide/svelte/icons/wrench';
|
|
4
|
+
import * as Step from '../../ui/step/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
type,
|
|
8
|
+
children
|
|
9
|
+
}: {
|
|
10
|
+
/** The tool name, e.g. `search_flights`. */
|
|
11
|
+
type: string;
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
} = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Step.Summary>
|
|
17
|
+
<Wrench class="size-(--era-h-xs) shrink-0" aria-hidden="true" />
|
|
18
|
+
<span class="truncate text-fg">{type}</span>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</Step.Summary>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The tool name, e.g. `search_flights`. */
|
|
4
|
+
type: string;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const ToolHeader: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ToolHeader = ReturnType<typeof ToolHeader>;
|
|
9
|
+
export default ToolHeader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Step from '../../ui/step/index.js';
|
|
3
|
+
import { CodeBlock } from '../../ui/code-block/index.js';
|
|
4
|
+
|
|
5
|
+
let { input }: { input: unknown } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<Step.Section label="input">
|
|
9
|
+
<CodeBlock code={JSON.stringify(input, null, 2)} />
|
|
10
|
+
</Step.Section>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Step from '../../ui/step/index.js';
|
|
3
|
+
import { CodeBlock } from '../../ui/code-block/index.js';
|
|
4
|
+
|
|
5
|
+
let { output, errorText }: { output?: unknown; errorText?: string } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
{#if errorText}
|
|
9
|
+
<Step.Section label="error">
|
|
10
|
+
<p class="text-body text-destructive">{errorText}</p>
|
|
11
|
+
</Step.Section>
|
|
12
|
+
{:else if output !== undefined}
|
|
13
|
+
<Step.Section label="output">
|
|
14
|
+
{#if typeof output === 'string'}
|
|
15
|
+
<p class="text-body whitespace-pre-wrap text-muted">{output}</p>
|
|
16
|
+
{:else}
|
|
17
|
+
<CodeBlock code={JSON.stringify(output, null, 2)} />
|
|
18
|
+
{/if}
|
|
19
|
+
</Step.Section>
|
|
20
|
+
{/if}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/** AI-SDK tool part lifecycle. */
|
|
3
|
+
export type ToolState =
|
|
4
|
+
| 'input-streaming'
|
|
5
|
+
| 'input-available'
|
|
6
|
+
| 'output-available'
|
|
7
|
+
| 'output-error';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
import * as Step from '../../ui/step/index.js';
|
|
13
|
+
import { cn } from '../../utils/index.js';
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
state: toolState = 'input-streaming',
|
|
17
|
+
open = $bindable(false),
|
|
18
|
+
children,
|
|
19
|
+
class: className
|
|
20
|
+
}: {
|
|
21
|
+
state?: ToolState;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
class?: string;
|
|
25
|
+
} = $props();
|
|
26
|
+
|
|
27
|
+
const status = $derived(
|
|
28
|
+
(
|
|
29
|
+
{
|
|
30
|
+
'input-streaming': 'pending',
|
|
31
|
+
'input-available': 'running',
|
|
32
|
+
'output-available': 'done',
|
|
33
|
+
'output-error': 'error'
|
|
34
|
+
} as const
|
|
35
|
+
)[toolState]
|
|
36
|
+
);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<Step.Root {status} bind:open class={cn(className)}>
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</Step.Root>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** AI-SDK tool part lifecycle. */
|
|
2
|
+
export type ToolState = 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
state?: ToolState;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const Tool: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
11
|
+
type Tool = ReturnType<typeof Tool>;
|
|
12
|
+
export default Tool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Root } from './web-preview.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Root } from './web-preview.svelte';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import RotateCw from '@lucide/svelte/icons/rotate-cw';
|
|
3
|
+
import { Bar } from '../../ui/bar/index.js';
|
|
4
|
+
import { Button } from '../../ui/button/index.js';
|
|
5
|
+
import { Input } from '../../ui/input/index.js';
|
|
6
|
+
import { cn } from '../../utils/index.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
url = $bindable(''),
|
|
10
|
+
onUrlChange,
|
|
11
|
+
class: className
|
|
12
|
+
}: { url?: string; onUrlChange?: (url: string) => void; class?: string } = $props();
|
|
13
|
+
|
|
14
|
+
let draft = $derived(url);
|
|
15
|
+
let nonce = $state(0);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
class={cn(
|
|
20
|
+
'flex min-h-0 flex-col overflow-hidden rounded-(--era-rd-lg) bg-(--era-surface-bg) shadow-(--era-shadow-lg)',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
>
|
|
24
|
+
<Bar size="md" class="shrink-0 rounded-none gap-(--era-gap)">
|
|
25
|
+
<Button icon size="sm" aria-label="Reload" onclick={() => (nonce += 1)}>
|
|
26
|
+
<RotateCw class="size-(--era-h-xs)" />
|
|
27
|
+
</Button>
|
|
28
|
+
<Input
|
|
29
|
+
bind:value={draft}
|
|
30
|
+
class="h-(--era-h-sm) flex-1"
|
|
31
|
+
placeholder="https://…"
|
|
32
|
+
onkeydown={(e: KeyboardEvent) => {
|
|
33
|
+
if (e.key === 'Enter') {
|
|
34
|
+
url = draft;
|
|
35
|
+
onUrlChange?.(url);
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
</Bar>
|
|
40
|
+
{#key nonce}
|
|
41
|
+
<iframe
|
|
42
|
+
src={url}
|
|
43
|
+
title="Web preview"
|
|
44
|
+
sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
|
|
45
|
+
class="min-h-0 w-full flex-1 border-0 bg-white"
|
|
46
|
+
></iframe>
|
|
47
|
+
{/key}
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
url?: string;
|
|
3
|
+
onUrlChange?: (url: string) => void;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const WebPreview: import("svelte").Component<$$ComponentProps, {}, "url">;
|
|
7
|
+
type WebPreview = ReturnType<typeof WebPreview>;
|
|
8
|
+
export default WebPreview;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { SvelteFlow, Background, Controls, type Node, type Edge } from '@xyflow/svelte';
|
|
4
|
+
import '@xyflow/svelte/dist/style.css';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
nodes = $bindable([]),
|
|
8
|
+
edges = $bindable([]),
|
|
9
|
+
children
|
|
10
|
+
}: { nodes?: Node[]; edges?: Edge[]; children?: Snippet } = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<!-- Thin era skin over Svelte Flow — the graph engine is xyflow's. This file
|
|
14
|
+
lives on its own subpath so the dependency stays opt-in. -->
|
|
15
|
+
<SvelteFlow bind:nodes bind:edges fitView class="rounded-(--era-rd-lg) shadow-(--era-shadow)">
|
|
16
|
+
<Background bgColor="var(--color-1)" />
|
|
17
|
+
<Controls />
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</SvelteFlow>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type Node, type Edge } from '@xyflow/svelte';
|
|
3
|
+
import '@xyflow/svelte/dist/style.css';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
nodes?: Node[];
|
|
6
|
+
edges?: Edge[];
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const Canvas: import("svelte").Component<$$ComponentProps, {}, "nodes" | "edges">;
|
|
10
|
+
type Canvas = ReturnType<typeof Canvas>;
|
|
11
|
+
export default Canvas;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { Handle, Position } from '@xyflow/svelte';
|
|
4
|
+
import { cn } from '../../utils/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
title,
|
|
8
|
+
children,
|
|
9
|
+
class: className
|
|
10
|
+
}: { title?: string; children?: Snippet; class?: string } = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class={cn(
|
|
15
|
+
'flex w-56 flex-col overflow-hidden rounded-(--era-rd-md) bg-(--era-surface-bg-elevated) text-body shadow-(--era-shadow-lg)',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
>
|
|
19
|
+
<Handle type="target" position={Position.Left} />
|
|
20
|
+
{#if title}
|
|
21
|
+
<div class="flex h-(--era-h-md) items-center border-b border-divider-faded px-(--era-inset-md) font-medium text-bright">
|
|
22
|
+
{title}
|
|
23
|
+
</div>
|
|
24
|
+
{/if}
|
|
25
|
+
<div class="p-(--era-inset-md) text-fg">{@render children?.()}</div>
|
|
26
|
+
<Handle type="source" position={Position.Right} />
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
class?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const Node: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Node = ReturnType<typeof Node>;
|
|
9
|
+
export default Node;
|