@flowdrop/flowdrop 2.0.0-beta.7 → 2.0.0-beta.9
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/CHANGELOG.md +18 -0
- package/dist/components/App.svelte +467 -182
- package/dist/components/App.svelte.d.ts +14 -1
- package/dist/components/ConfigPanel.svelte +230 -12
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/SettingsPanel.svelte +22 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/svelte-app.d.ts +12 -1
- package/dist/svelte-app.js +3 -1
- package/dist/types/settings.d.ts +16 -0
- package/dist/types/settings.js +3 -1
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import type { AuthProvider } from '../types/auth.js';
|
|
|
6
6
|
import type { FlowDropEventHandlers, FlowDropFeatures } from '../types/events.js';
|
|
7
7
|
import type { FlowDropTheme, FlowDropThemeName } from '../types/theme.js';
|
|
8
8
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
9
|
-
import type { SettingsCategory } from '../types/settings.js';
|
|
9
|
+
import type { SettingsCategory, SurfacePlacement } from '../types/settings.js';
|
|
10
10
|
import type { MessagesOverride } from '../messages/index.js';
|
|
11
11
|
/**
|
|
12
12
|
* Configuration props for runtime customization
|
|
@@ -24,6 +24,19 @@ interface Props {
|
|
|
24
24
|
showNavbar?: boolean;
|
|
25
25
|
/** Disable the node sidebar */
|
|
26
26
|
disableSidebar?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Default host for the node/workflow configuration panel: `sidebar` (right
|
|
29
|
+
* rail), `modal` (centered overlay), or `below` (bottom panel). Seeds the
|
|
30
|
+
* user setting on first load — a value the user later changes wins.
|
|
31
|
+
* @default 'sidebar'
|
|
32
|
+
*/
|
|
33
|
+
configPlacement?: SurfacePlacement;
|
|
34
|
+
/**
|
|
35
|
+
* Default host for the console / AI Assistant group. Seeds the user setting
|
|
36
|
+
* on first load — a value the user later changes wins.
|
|
37
|
+
* @default 'below'
|
|
38
|
+
*/
|
|
39
|
+
consolePlacement?: SurfacePlacement;
|
|
27
40
|
/**
|
|
28
41
|
* Editor interaction mode. Replaces the former `readOnly` + `lockWorkflow`
|
|
29
42
|
* boolean pair (2.0 breaking change).
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import ReadOnlyDetails from './ReadOnlyDetails.svelte';
|
|
13
13
|
import { getUiSettings } from '../stores/settingsStore.svelte.js';
|
|
14
14
|
import { m } from '../messages/index.js';
|
|
15
|
+
import { portal } from '../utils/portal.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* A single detail item with label and value
|
|
@@ -41,6 +42,12 @@
|
|
|
41
42
|
onClose: () => void;
|
|
42
43
|
/** Optional callback to initiate node swap — when provided, shows swap button */
|
|
43
44
|
onSwap?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to show the "pop out" control that opens the panel content in a
|
|
47
|
+
* wide centered modal — useful when the narrow sidebar cramps fields such
|
|
48
|
+
* as prompts. Defaults to true.
|
|
49
|
+
*/
|
|
50
|
+
expandable?: boolean;
|
|
44
51
|
/** Slot content for the configuration form */
|
|
45
52
|
children?: Snippet;
|
|
46
53
|
}
|
|
@@ -53,15 +60,65 @@
|
|
|
53
60
|
configTitle = 'Configuration',
|
|
54
61
|
onClose,
|
|
55
62
|
onSwap,
|
|
63
|
+
expandable = true,
|
|
56
64
|
children
|
|
57
65
|
}: Props = $props();
|
|
58
66
|
|
|
67
|
+
/** Whether the panel content is currently popped out into the modal. */
|
|
68
|
+
let expanded = $state(false);
|
|
69
|
+
|
|
70
|
+
// Unique per component instance so two FlowDrop editors on one page don't
|
|
71
|
+
// render colliding DOM ids (a11y).
|
|
72
|
+
const uid = $props.id();
|
|
73
|
+
const titleId = `${uid}-config-panel-title`;
|
|
74
|
+
|
|
59
75
|
/**
|
|
60
76
|
* Check if details section should be shown
|
|
61
77
|
*/
|
|
62
78
|
const hasDetails = $derived(id !== undefined || details.length > 0 || description !== undefined);
|
|
79
|
+
|
|
80
|
+
/** Dock the popped-out content back into the sidebar (Esc / backdrop click). */
|
|
81
|
+
function dock() {
|
|
82
|
+
expanded = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function handleModalKeydown(event: KeyboardEvent) {
|
|
86
|
+
if (event.key === 'Escape') {
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
dock();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function handleBackdropClick(event: MouseEvent) {
|
|
93
|
+
if (event.target === event.currentTarget) {
|
|
94
|
+
dock();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
63
97
|
</script>
|
|
64
98
|
|
|
99
|
+
<!--
|
|
100
|
+
The details + configuration content is rendered as a snippet so it can live
|
|
101
|
+
in exactly one place at a time — the sidebar rail while docked, or the modal
|
|
102
|
+
while popped out — without duplicating the form (a Snippet can only be
|
|
103
|
+
rendered once).
|
|
104
|
+
-->
|
|
105
|
+
{#snippet panelContent()}
|
|
106
|
+
{#if hasDetails && id}
|
|
107
|
+
<div class="config-panel__details">
|
|
108
|
+
<ReadOnlyDetails {id} {description} {details} />
|
|
109
|
+
</div>
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
<div class="config-panel__content">
|
|
113
|
+
{#if children}
|
|
114
|
+
<div class="config-panel__section">
|
|
115
|
+
<h3 class="config-panel__section-title">{configTitle}</h3>
|
|
116
|
+
{@render children()}
|
|
117
|
+
</div>
|
|
118
|
+
{/if}
|
|
119
|
+
</div>
|
|
120
|
+
{/snippet}
|
|
121
|
+
|
|
65
122
|
<div class="config-panel" class:config-panel--compact={getUiSettings().compactMode}>
|
|
66
123
|
<!-- Header -->
|
|
67
124
|
<div class="config-panel__header">
|
|
@@ -77,6 +134,16 @@
|
|
|
77
134
|
<Icon icon="heroicons:arrows-right-left" />
|
|
78
135
|
</button>
|
|
79
136
|
{/if}
|
|
137
|
+
{#if expandable && !expanded}
|
|
138
|
+
<button
|
|
139
|
+
class="config-panel__action-btn"
|
|
140
|
+
onclick={() => (expanded = true)}
|
|
141
|
+
aria-label="Pop out configuration"
|
|
142
|
+
title="Pop out to a larger window"
|
|
143
|
+
>
|
|
144
|
+
<Icon icon="heroicons:arrows-pointing-out" />
|
|
145
|
+
</button>
|
|
146
|
+
{/if}
|
|
80
147
|
<button
|
|
81
148
|
class="config-panel__close"
|
|
82
149
|
onclick={onClose}
|
|
@@ -87,23 +154,61 @@
|
|
|
87
154
|
</div>
|
|
88
155
|
</div>
|
|
89
156
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<div class="config-
|
|
93
|
-
<
|
|
157
|
+
{#if expanded}
|
|
158
|
+
<!-- Content is popped out into the modal; show a lightweight placeholder. -->
|
|
159
|
+
<div class="config-panel__popped">
|
|
160
|
+
<Icon icon="heroicons:window" class="config-panel__popped-icon" />
|
|
161
|
+
<p class="config-panel__popped-text">Configuration is open in a larger window.</p>
|
|
162
|
+
<button class="config-panel__popped-btn" onclick={dock}> Dock back to sidebar </button>
|
|
94
163
|
</div>
|
|
164
|
+
{:else}
|
|
165
|
+
{@render panelContent()}
|
|
95
166
|
{/if}
|
|
167
|
+
</div>
|
|
96
168
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
169
|
+
{#if expanded}
|
|
170
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
171
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
172
|
+
<div
|
|
173
|
+
class="config-panel-modal__backdrop"
|
|
174
|
+
use:portal
|
|
175
|
+
onclick={handleBackdropClick}
|
|
176
|
+
onkeydown={handleModalKeydown}
|
|
177
|
+
>
|
|
178
|
+
<div
|
|
179
|
+
class="config-panel-modal"
|
|
180
|
+
role="dialog"
|
|
181
|
+
aria-modal="true"
|
|
182
|
+
aria-labelledby={titleId}
|
|
183
|
+
tabindex="-1"
|
|
184
|
+
>
|
|
185
|
+
<div class="config-panel-modal__header">
|
|
186
|
+
<h2 id={titleId} class="config-panel-modal__title">{title}</h2>
|
|
187
|
+
<div class="config-panel__actions">
|
|
188
|
+
<button
|
|
189
|
+
class="config-panel__action-btn"
|
|
190
|
+
onclick={dock}
|
|
191
|
+
aria-label="Dock configuration back to sidebar"
|
|
192
|
+
title="Dock back to sidebar"
|
|
193
|
+
>
|
|
194
|
+
<Icon icon="heroicons:arrows-pointing-in" />
|
|
195
|
+
</button>
|
|
196
|
+
<button
|
|
197
|
+
class="config-panel__close"
|
|
198
|
+
onclick={onClose}
|
|
199
|
+
aria-label={m().layout.closeConfigPanel}
|
|
200
|
+
>
|
|
201
|
+
×
|
|
202
|
+
</button>
|
|
203
|
+
</div>
|
|
103
204
|
</div>
|
|
104
|
-
|
|
205
|
+
|
|
206
|
+
<div class="config-panel-modal__body">
|
|
207
|
+
{@render panelContent()}
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
105
210
|
</div>
|
|
106
|
-
|
|
211
|
+
{/if}
|
|
107
212
|
|
|
108
213
|
<style>
|
|
109
214
|
.config-panel {
|
|
@@ -236,4 +341,117 @@
|
|
|
236
341
|
.config-panel--compact .config-panel__section {
|
|
237
342
|
gap: 0.5rem;
|
|
238
343
|
}
|
|
344
|
+
|
|
345
|
+
/* Popped-out placeholder (shown in the rail while the modal is open) */
|
|
346
|
+
.config-panel__popped {
|
|
347
|
+
flex: 1;
|
|
348
|
+
display: flex;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
align-items: center;
|
|
351
|
+
justify-content: center;
|
|
352
|
+
gap: 0.75rem;
|
|
353
|
+
padding: 2rem 1rem;
|
|
354
|
+
text-align: center;
|
|
355
|
+
color: var(--fd-muted-foreground);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.config-panel__popped :global(.config-panel__popped-icon) {
|
|
359
|
+
width: 2rem;
|
|
360
|
+
height: 2rem;
|
|
361
|
+
opacity: 0.6;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.config-panel__popped-text {
|
|
365
|
+
margin: 0;
|
|
366
|
+
font-size: var(--fd-text-sm);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.config-panel__popped-btn {
|
|
370
|
+
border: 1px solid var(--fd-border);
|
|
371
|
+
background-color: var(--fd-card);
|
|
372
|
+
color: var(--fd-foreground);
|
|
373
|
+
padding: 0.375rem 0.75rem;
|
|
374
|
+
border-radius: var(--fd-radius-sm);
|
|
375
|
+
font-size: var(--fd-text-sm);
|
|
376
|
+
cursor: pointer;
|
|
377
|
+
transition:
|
|
378
|
+
color var(--fd-transition-fast),
|
|
379
|
+
background-color var(--fd-transition-fast),
|
|
380
|
+
border-color var(--fd-transition-fast);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.config-panel__popped-btn:hover {
|
|
384
|
+
color: var(--fd-primary);
|
|
385
|
+
border-color: var(--fd-primary);
|
|
386
|
+
background-color: var(--fd-subtle);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* Pop-out modal */
|
|
390
|
+
.config-panel-modal__backdrop {
|
|
391
|
+
position: fixed;
|
|
392
|
+
inset: 0;
|
|
393
|
+
/*
|
|
394
|
+
Portalled to document.body, this shell sits outside the editor container
|
|
395
|
+
that carries the app font, so it would otherwise inherit the host page's
|
|
396
|
+
default (e.g. serif on a bare Drupal page). Re-establish the font here,
|
|
397
|
+
mirroring the mount container's declaration.
|
|
398
|
+
*/
|
|
399
|
+
font-family: var(--fd-font-family, system-ui, -apple-system, sans-serif);
|
|
400
|
+
background-color: var(--fd-backdrop, rgba(0, 0, 0, 0.5));
|
|
401
|
+
display: flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
justify-content: center;
|
|
404
|
+
z-index: 1000;
|
|
405
|
+
padding: 1rem;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.config-panel-modal {
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
width: 100%;
|
|
412
|
+
max-width: 48rem;
|
|
413
|
+
max-height: 90vh;
|
|
414
|
+
background-color: var(--fd-panel-bg, var(--fd-card));
|
|
415
|
+
border: 1px solid var(--fd-border);
|
|
416
|
+
border-radius: var(--fd-radius-lg, 0.75rem);
|
|
417
|
+
box-shadow: var(--fd-shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.25));
|
|
418
|
+
overflow: hidden;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.config-panel-modal__header {
|
|
422
|
+
display: flex;
|
|
423
|
+
justify-content: space-between;
|
|
424
|
+
align-items: center;
|
|
425
|
+
padding: 0.875rem 1rem;
|
|
426
|
+
border-bottom: 1px solid var(--fd-border);
|
|
427
|
+
background-color: var(--fd-card);
|
|
428
|
+
flex-shrink: 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.config-panel-modal__title {
|
|
432
|
+
margin: 0;
|
|
433
|
+
font-size: 1rem;
|
|
434
|
+
font-weight: 600;
|
|
435
|
+
color: var(--fd-foreground);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.config-panel-modal__body {
|
|
439
|
+
flex: 1;
|
|
440
|
+
min-height: 0;
|
|
441
|
+
overflow-y: auto;
|
|
442
|
+
display: flex;
|
|
443
|
+
flex-direction: column;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* Inside the modal the content area should breathe on a wider canvas. */
|
|
447
|
+
.config-panel-modal__body .config-panel__content {
|
|
448
|
+
padding: 1.25rem 1.5rem;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
@media (max-width: 640px) {
|
|
452
|
+
.config-panel-modal {
|
|
453
|
+
max-width: 100%;
|
|
454
|
+
max-height: 95vh;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
239
457
|
</style>
|
|
@@ -26,6 +26,12 @@ interface Props {
|
|
|
26
26
|
onClose: () => void;
|
|
27
27
|
/** Optional callback to initiate node swap — when provided, shows swap button */
|
|
28
28
|
onSwap?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to show the "pop out" control that opens the panel content in a
|
|
31
|
+
* wide centered modal — useful when the narrow sidebar cramps fields such
|
|
32
|
+
* as prompts. Defaults to true.
|
|
33
|
+
*/
|
|
34
|
+
expandable?: boolean;
|
|
29
35
|
/** Slot content for the configuration form */
|
|
30
36
|
children?: Snippet;
|
|
31
37
|
}
|
|
@@ -202,6 +202,28 @@
|
|
|
202
202
|
{ const: 'drafter', title: 'Drafter' }
|
|
203
203
|
],
|
|
204
204
|
default: 'default'
|
|
205
|
+
},
|
|
206
|
+
configPlacement: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
title: 'Config Panel Location',
|
|
209
|
+
description: 'Where the node/workflow configuration panel opens',
|
|
210
|
+
oneOf: [
|
|
211
|
+
{ const: 'sidebar', title: 'Right sidebar' },
|
|
212
|
+
{ const: 'modal', title: 'Modal window' },
|
|
213
|
+
{ const: 'below', title: 'Bottom panel' }
|
|
214
|
+
],
|
|
215
|
+
default: 'sidebar'
|
|
216
|
+
},
|
|
217
|
+
consolePlacement: {
|
|
218
|
+
type: 'string',
|
|
219
|
+
title: 'Console / AI Assistant Location',
|
|
220
|
+
description: 'Where the console and AI Assistant open',
|
|
221
|
+
oneOf: [
|
|
222
|
+
{ const: 'sidebar', title: 'Right sidebar' },
|
|
223
|
+
{ const: 'modal', title: 'Modal window' },
|
|
224
|
+
{ const: 'below', title: 'Bottom panel' }
|
|
225
|
+
],
|
|
226
|
+
default: 'below'
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
229
|
},
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SurfaceOverlay
|
|
3
|
+
A reusable centered modal shell used to host a surface (or a TabbedSurface of
|
|
4
|
+
several) in the `modal` placement. Portals to `document.body` so the fixed
|
|
5
|
+
backdrop escapes any ancestor that establishes a containing block (transform,
|
|
6
|
+
filter, backdrop-filter, …). Esc and backdrop-click close it.
|
|
7
|
+
|
|
8
|
+
Promotes the modal shell first built inline in ConfigPanel so config, console,
|
|
9
|
+
and chat can all float when their placement is `modal`.
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import type { Snippet } from 'svelte';
|
|
14
|
+
import { portal } from '../../utils/portal.js';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
/** Header title. */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Accessible label for the close button. */
|
|
20
|
+
closeLabel?: string;
|
|
21
|
+
/** Called on Esc, backdrop click, or the close button. */
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
/** Overlay body. */
|
|
24
|
+
children: Snippet;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { title, closeLabel = 'Close', onClose, children }: Props = $props();
|
|
28
|
+
|
|
29
|
+
const uid = $props.id();
|
|
30
|
+
const titleId = `${uid}-surface-overlay-title`;
|
|
31
|
+
|
|
32
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
33
|
+
if (event.key === 'Escape') {
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
onClose();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function handleBackdropClick(event: MouseEvent) {
|
|
40
|
+
if (event.target === event.currentTarget) {
|
|
41
|
+
onClose();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
47
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
48
|
+
<div
|
|
49
|
+
class="surface-overlay__backdrop"
|
|
50
|
+
use:portal
|
|
51
|
+
onclick={handleBackdropClick}
|
|
52
|
+
onkeydown={handleKeydown}
|
|
53
|
+
>
|
|
54
|
+
<div
|
|
55
|
+
class="surface-overlay"
|
|
56
|
+
role="dialog"
|
|
57
|
+
aria-modal="true"
|
|
58
|
+
aria-labelledby={titleId}
|
|
59
|
+
tabindex="-1"
|
|
60
|
+
>
|
|
61
|
+
<div class="surface-overlay__header">
|
|
62
|
+
<h2 id={titleId} class="surface-overlay__title">{title}</h2>
|
|
63
|
+
<button class="surface-overlay__close" onclick={onClose} aria-label={closeLabel}> × </button>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="surface-overlay__body">
|
|
66
|
+
{@render children()}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.surface-overlay__backdrop {
|
|
73
|
+
position: fixed;
|
|
74
|
+
inset: 0;
|
|
75
|
+
/*
|
|
76
|
+
Portalled to document.body, this shell sits outside the editor container
|
|
77
|
+
that carries the app font, so it would otherwise inherit the host page's
|
|
78
|
+
default (e.g. serif on a bare Drupal page). Re-establish the font here,
|
|
79
|
+
mirroring the mount container's declaration.
|
|
80
|
+
*/
|
|
81
|
+
font-family: var(--fd-font-family, system-ui, -apple-system, sans-serif);
|
|
82
|
+
background-color: var(--fd-backdrop, rgba(0, 0, 0, 0.5));
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
z-index: 1000;
|
|
87
|
+
padding: 1rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.surface-overlay {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
width: 100%;
|
|
94
|
+
max-width: 48rem;
|
|
95
|
+
max-height: 90vh;
|
|
96
|
+
background-color: var(--fd-panel-bg, var(--fd-card));
|
|
97
|
+
border: 1px solid var(--fd-border);
|
|
98
|
+
border-radius: var(--fd-radius-lg, 0.75rem);
|
|
99
|
+
box-shadow: var(--fd-shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.25));
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.surface-overlay__header {
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: space-between;
|
|
106
|
+
align-items: center;
|
|
107
|
+
padding: 0.875rem 1rem;
|
|
108
|
+
border-bottom: 1px solid var(--fd-border);
|
|
109
|
+
background-color: var(--fd-card);
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.surface-overlay__title {
|
|
114
|
+
margin: 0;
|
|
115
|
+
font-size: 1rem;
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
color: var(--fd-foreground);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.surface-overlay__close {
|
|
121
|
+
background: none;
|
|
122
|
+
border: none;
|
|
123
|
+
font-size: 1.25rem;
|
|
124
|
+
line-height: 1;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
color: var(--fd-muted-foreground);
|
|
127
|
+
padding: 0.25rem;
|
|
128
|
+
border-radius: var(--fd-radius-sm);
|
|
129
|
+
transition:
|
|
130
|
+
color var(--fd-transition-fast),
|
|
131
|
+
background-color var(--fd-transition-fast);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.surface-overlay__close:hover {
|
|
135
|
+
color: var(--fd-foreground);
|
|
136
|
+
background-color: var(--fd-subtle);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.surface-overlay__body {
|
|
140
|
+
flex: 1;
|
|
141
|
+
min-height: 0;
|
|
142
|
+
overflow-y: auto;
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@media (max-width: 640px) {
|
|
148
|
+
.surface-overlay {
|
|
149
|
+
max-width: 100%;
|
|
150
|
+
max-height: 95vh;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Header title. */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Accessible label for the close button. */
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
/** Called on Esc, backdrop click, or the close button. */
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
/** Overlay body. */
|
|
10
|
+
children: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const SurfaceOverlay: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type SurfaceOverlay = ReturnType<typeof SurfaceOverlay>;
|
|
14
|
+
export default SurfaceOverlay;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
TabbedSurface
|
|
3
|
+
A reusable tabbed container that hosts one or more "surfaces" (config panel,
|
|
4
|
+
console, AI Assistant). Promotes the bottom-panel tab strip so the same
|
|
5
|
+
container can host surfaces in the sidebar, bottom panel, or a modal overlay.
|
|
6
|
+
|
|
7
|
+
All tab bodies stay mounted (toggled via `display`) so surface state — console
|
|
8
|
+
scrollback, chat history, in-progress form edits — survives tab switches. The
|
|
9
|
+
tab bar hides itself when only a single surface is present, so a lone surface
|
|
10
|
+
reads as a plain panel with no redundant chrome.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import type { Snippet } from 'svelte';
|
|
15
|
+
|
|
16
|
+
/** A single hostable surface. */
|
|
17
|
+
export interface SurfaceTab {
|
|
18
|
+
/** Stable identifier, unique within the host. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Tab-strip label. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Body content. Rendered once — a surface has exactly one host. */
|
|
23
|
+
content: Snippet;
|
|
24
|
+
/**
|
|
25
|
+
* `display` value applied while active. Some surfaces (the console) expect
|
|
26
|
+
* to be a direct flex child of the content area and use `contents`; most
|
|
27
|
+
* use `flex`. Defaults to `flex`.
|
|
28
|
+
*/
|
|
29
|
+
display?: 'flex' | 'contents';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface Props {
|
|
33
|
+
/** Surfaces to host, in tab order. */
|
|
34
|
+
tabs: SurfaceTab[];
|
|
35
|
+
/** Currently active tab id. */
|
|
36
|
+
activeId: string;
|
|
37
|
+
/** Called when a tab is selected. */
|
|
38
|
+
onSelect: (id: string) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const { tabs, activeId, onSelect }: Props = $props();
|
|
42
|
+
|
|
43
|
+
// Fall back to the first tab when `activeId` doesn't match any present tab
|
|
44
|
+
// (e.g. the active surface was just routed to a different host).
|
|
45
|
+
const resolvedActiveId = $derived(
|
|
46
|
+
tabs.some((t) => t.id === activeId) ? activeId : (tabs[0]?.id ?? '')
|
|
47
|
+
);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<div class="tabbed-surface">
|
|
51
|
+
{#if tabs.length > 1}
|
|
52
|
+
<div class="tabbed-surface__bar" role="tablist">
|
|
53
|
+
{#each tabs as tab (tab.id)}
|
|
54
|
+
<button
|
|
55
|
+
class="tabbed-surface__tab {tab.id === resolvedActiveId
|
|
56
|
+
? 'tabbed-surface__tab--active'
|
|
57
|
+
: ''}"
|
|
58
|
+
role="tab"
|
|
59
|
+
aria-selected={tab.id === resolvedActiveId}
|
|
60
|
+
onclick={() => onSelect(tab.id)}
|
|
61
|
+
>
|
|
62
|
+
{tab.label}
|
|
63
|
+
</button>
|
|
64
|
+
{/each}
|
|
65
|
+
</div>
|
|
66
|
+
{/if}
|
|
67
|
+
|
|
68
|
+
<div class="tabbed-surface__content">
|
|
69
|
+
{#each tabs as tab (tab.id)}
|
|
70
|
+
<div
|
|
71
|
+
class="tabbed-surface__panel"
|
|
72
|
+
style:display={tab.id === resolvedActiveId ? (tab.display ?? 'flex') : 'none'}
|
|
73
|
+
>
|
|
74
|
+
{@render tab.content()}
|
|
75
|
+
</div>
|
|
76
|
+
{/each}
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<style>
|
|
81
|
+
.tabbed-surface {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
height: 100%;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.tabbed-surface__bar {
|
|
89
|
+
display: flex;
|
|
90
|
+
gap: 0;
|
|
91
|
+
background: var(--fd-muted);
|
|
92
|
+
border-bottom: 1px solid var(--fd-border);
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tabbed-surface__tab {
|
|
97
|
+
padding: 0.375rem 0.75rem;
|
|
98
|
+
font-size: 0.75rem;
|
|
99
|
+
font-weight: 500;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
border: none;
|
|
102
|
+
border-bottom: 2px solid transparent;
|
|
103
|
+
background: transparent;
|
|
104
|
+
color: var(--fd-muted-foreground);
|
|
105
|
+
transition: all var(--fd-transition-fast);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tabbed-surface__tab:hover {
|
|
109
|
+
color: var(--fd-foreground);
|
|
110
|
+
background: var(--fd-background);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.tabbed-surface__tab--active {
|
|
114
|
+
color: var(--fd-foreground);
|
|
115
|
+
border-bottom-color: var(--fd-primary);
|
|
116
|
+
background: var(--fd-background);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.tabbed-surface__content {
|
|
120
|
+
flex: 1;
|
|
121
|
+
min-height: 0;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.tabbed-surface__panel {
|
|
128
|
+
flex: 1;
|
|
129
|
+
min-height: 0;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
/** A single hostable surface. */
|
|
3
|
+
export interface SurfaceTab {
|
|
4
|
+
/** Stable identifier, unique within the host. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Tab-strip label. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Body content. Rendered once — a surface has exactly one host. */
|
|
9
|
+
content: Snippet;
|
|
10
|
+
/**
|
|
11
|
+
* `display` value applied while active. Some surfaces (the console) expect
|
|
12
|
+
* to be a direct flex child of the content area and use `contents`; most
|
|
13
|
+
* use `flex`. Defaults to `flex`.
|
|
14
|
+
*/
|
|
15
|
+
display?: 'flex' | 'contents';
|
|
16
|
+
}
|
|
17
|
+
interface Props {
|
|
18
|
+
/** Surfaces to host, in tab order. */
|
|
19
|
+
tabs: SurfaceTab[];
|
|
20
|
+
/** Currently active tab id. */
|
|
21
|
+
activeId: string;
|
|
22
|
+
/** Called when a tab is selected. */
|
|
23
|
+
onSelect: (id: string) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const TabbedSurface: import("svelte").Component<Props, {}, "">;
|
|
26
|
+
type TabbedSurface = ReturnType<typeof TabbedSurface>;
|
|
27
|
+
export default TabbedSurface;
|