Skip to content

Modern Docker Management, Designed for Everyone

refactor: align frontend stores and attachments with sveltes best practices (#3907)

Kyle Mendell2d0ac4a8c93c
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index e7827b76b..24ba65419 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -3536,5 +3536,9 @@
"git_repository_token_url_change": "The repository URL has changed. Re-enter the stored token or select Clear stored token before saving.",
"git_repository_ssh_key_url_change": "The repository URL has changed. Re-enter the stored SSH key or select Clear stored SSH key before saving.",
"git_repository_clear_token": "Clear stored token",
- "git_repository_clear_ssh_key": "Clear stored SSH key"
+ "git_repository_clear_ssh_key": "Clear stored SSH key",
+ "host_ip_placeholder": "0.0.0.0",
+ "container_port_placeholder": "80",
+ "protocol_tcp": "TCP",
+ "protocol_udp": "UDP"
}
diff --git a/frontend/src/lib/components/accent-color/accent-color-picker.svelte b/frontend/src/lib/components/accent-color/accent-color-picker.svelte
index 2c1ff33ff..23ca3e923 100644
--- a/frontend/src/lib/components/accent-color/accent-color-picker.svelte
+++ b/frontend/src/lib/components/accent-color/accent-color-picker.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import { Label } from '#lib/components/ui/label/index.js';
import * as RadioGroup from '#lib/components/ui/radio-group/index.js';
- import { applyAccentColor } from '#lib/utils/theme.js';
+ import { applyAccentColor } from '#lib/utils/theme.svelte.js';
import CustomColorDialog from './custom-color.svelte';
import { CheckIcon, AddIcon } from '#lib/icons/index.js';
diff --git a/frontend/src/lib/components/accent-color/custom-color.svelte b/frontend/src/lib/components/accent-color/custom-color.svelte
index 2a9da4cd6..eb454c389 100644
--- a/frontend/src/lib/components/accent-color/custom-color.svelte
+++ b/frontend/src/lib/components/accent-color/custom-color.svelte
@@ -4,7 +4,7 @@
import { Input } from '#lib/components/ui/input/index.js';
import { Label } from '#lib/components/ui/label/index.js';
import { m } from '#lib/paraglide/messages.js';
- import { preventDefault } from '#lib/utils/settings.js';
+ import { preventDefault } from '#lib/utils/settings.svelte.js';
let {
open = $bindable(false),
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index e8036bca6..183442892 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -13,7 +13,7 @@
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
import { cn } from '#lib/utils.js';
import { m } from '#lib/paraglide/messages.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { deployOptionsStore } from '#lib/stores/deploy-options.store.svelte.js';
import { containerService } from '#lib/services/container-service.js';
import { projectService } from '#lib/services/project-service.js';
@@ -225,9 +225,9 @@
const canPull = $derived(type === 'project' && hasPermission('projects:deploy', currentEnvId));
const canBuild = $derived(type === 'project' && hasPermission('projects:deploy', currentEnvId));
const deployButtonLabel = $derived(projectHasBuildDirective ? m.compose_build_and_deploy() : m.common_up());
- const depotAvailable = $derived(isDepotBuildAvailable($settingsStore));
+ const depotAvailable = $derived(isDepotBuildAvailable(settingsStore.current));
const projectBuildProvider = $derived.by<'local' | 'depot'>(() => {
- const configuredProvider = ($settingsStore?.buildProvider as 'local' | 'depot') ?? 'local';
+ const configuredProvider = (settingsStore.current?.buildProvider as 'local' | 'depot') ?? 'local';
if (configuredProvider === 'depot' && !depotAvailable) {
return 'local';
}
diff --git a/frontend/src/lib/components/activity/activity-center-trigger.svelte b/frontend/src/lib/components/activity/activity-center-trigger.svelte
index 3758e2270..c19c95632 100644
--- a/frontend/src/lib/components/activity/activity-center-trigger.svelte
+++ b/frontend/src/lib/components/activity/activity-center-trigger.svelte
@@ -3,8 +3,7 @@
import { activityStore } from '#lib/stores/activity.store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { cn } from '#lib/utils.js';
- import userStore, { userHasPermissionInAnyEnvironment } from '#lib/stores/user-store.js';
- import { fromStore } from 'svelte/store';
+ import userStore, { userHasPermissionInAnyEnvironment } from '#lib/stores/user-store.svelte.js';
let {
collapsed = false,
@@ -22,7 +21,7 @@
const activeCount = $derived(activityStore.activeCount);
const isActive = $derived(activeCount > 0);
- const currentUser = fromStore(userStore);
+ const currentUser = userStore;
const canReadActivities = $derived(userHasPermissionInAnyEnvironment(currentUser.current, 'activities:read'));
function handleOpenInternal() {
diff --git a/frontend/src/lib/components/application-theme/application-theme-picker.svelte b/frontend/src/lib/components/application-theme/application-theme-picker.svelte
index 65f5da6ec..6f1b0e85f 100644
--- a/frontend/src/lib/components/application-theme/application-theme-picker.svelte
+++ b/frontend/src/lib/components/application-theme/application-theme-picker.svelte
@@ -6,7 +6,7 @@
import * as RadioGroup from '#lib/components/ui/radio-group/index.js';
import { mode } from 'mode-watcher';
import { m } from '#lib/paraglide/messages.js';
- import { APPLICATION_THEME_OPTIONS, applyApplicationTheme, resolveApplicationTheme } from '#lib/utils/theme.js';
+ import { APPLICATION_THEME_OPTIONS, applyApplicationTheme, resolveApplicationTheme } from '#lib/utils/theme.svelte.js';
import type { CarouselAPI } from '#lib/components/ui/carousel/context.js';
import type { ApplicationTheme } from '#lib/types/settings.js';
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte b/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte
index 2ed2d9584..6c72116e4 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte
@@ -259,8 +259,10 @@
{#if hasExpand}
<Table.Cell class="w-8 px-2" data-row-select-ignore>
<button
- class="flex items-center justify-center text-muted-foreground transition-transform duration-200 hover:text-foreground"
- class:rotate-90={isExpanded}
+ class={cn(
+ 'flex items-center justify-center text-muted-foreground transition-transform duration-200 hover:text-foreground',
+ isExpanded && 'rotate-90'
+ )}
onclick={(e) => {
e.stopPropagation();
onToggleRowExpanded?.(rowId);
diff --git a/frontend/src/lib/components/arcane-tooltip/context.svelte.ts b/frontend/src/lib/components/arcane-tooltip/context.svelte.ts
index 7850a2e5e..17cb496e3 100644
--- a/frontend/src/lib/components/arcane-tooltip/context.svelte.ts
+++ b/frontend/src/lib/components/arcane-tooltip/context.svelte.ts
@@ -1,6 +1,4 @@
-import { getContext, setContext } from 'svelte';
-
-const CONTEXT_KEY = 'arcane-tooltip-context';
+import { createContext } from 'svelte';
export interface ArcaneTooltipContext {
isTouch: boolean;
@@ -9,10 +7,4 @@ export interface ArcaneTooltipContext {
setOpen: (value: boolean) => void;
}
-export function setArcaneTooltipContext(context: ArcaneTooltipContext) {
- setContext(CONTEXT_KEY, context);
-}
-
-export function getArcaneTooltipContext(): ArcaneTooltipContext {
- return getContext(CONTEXT_KEY);
-}
+export const [getArcaneTooltipContext, setArcaneTooltipContext] = createContext<ArcaneTooltipContext>();
diff --git a/frontend/src/lib/components/backup-file-picker.svelte b/frontend/src/lib/components/backup-file-picker.svelte
index 0b7c68746..73d177b74 100644
--- a/frontend/src/lib/components/backup-file-picker.svelte
+++ b/frontend/src/lib/components/backup-file-picker.svelte
@@ -272,7 +272,7 @@
class="absolute top-0 left-0 w-full"
style={`transform: translateY(${virtualItem.start}px)`}
data-index={virtualItem.index}
- use:rowVirtualizer.measureElement
+ {@attach rowVirtualizer.measureElement}
>
{#if row.kind === 'entry'}
<FileTreeRow
diff --git a/frontend/src/lib/components/badges/port-badge.svelte b/frontend/src/lib/components/badges/port-badge.svelte
index 506e824d8..7eac003d6 100644
--- a/frontend/src/lib/components/badges/port-badge.svelte
+++ b/frontend/src/lib/components/badges/port-badge.svelte
@@ -5,7 +5,7 @@
import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
import { badgeVariants } from '#lib/components/ui/badge/index.js';
import { cn } from '#lib/utils.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { toPortHref } from '#lib/utils/navigation.js';
import { mergeProps } from 'bits-ui';
@@ -26,7 +26,7 @@
let expanded = $state(false);
- const baseServerUrl = $derived($settingsStore?.baseServerUrl ?? 'http://localhost');
+ const baseServerUrl = $derived(settingsStore.current?.baseServerUrl ?? 'http://localhost');
type PortBadgePort = ContainerPorts | ServicePort;
type NormalizedPort = {
@@ -98,7 +98,7 @@
<span class="text-xs text-muted-foreground">{m.containers_no_ports()}</span>
{:else}
<div class="flex gap-1.5 {wrap ? 'flex-wrap' : 'flex-nowrap'}">
- {#each published as p, i (i)}
+ {#each published as p (`${p.ip ?? ''}:${p.hostPort ?? ''}:${p.containerPort}/${p.proto ?? ''}`)}
<ArcaneTooltip.Root interactive>
<ArcaneTooltip.Trigger>
{#snippet child({ props })}
@@ -126,7 +126,7 @@
</ArcaneTooltip.Content>
</ArcaneTooltip.Root>
{/each}
- {#each exposedOnly as p, i (i)}
+ {#each exposedOnly as p (`${p.ip ?? ''}:${p.hostPort ?? ''}:${p.containerPort}/${p.proto ?? ''}`)}
<ArcaneTooltip.Root>
<ArcaneTooltip.Trigger>
<span class={badgeVariants({ variant: 'gray', size: 'sm' })}>
diff --git a/frontend/src/lib/components/badges/ui-config-disabled-tag.svelte b/frontend/src/lib/components/badges/ui-config-disabled-tag.svelte
index 024a22290..840617797 100644
--- a/frontend/src/lib/components/badges/ui-config-disabled-tag.svelte
+++ b/frontend/src/lib/components/badges/ui-config-disabled-tag.svelte
@@ -1,11 +1,11 @@
<script lang="ts">
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { LockIcon } from '#lib/icons/index.js';
import { Badge } from '#lib/components/ui/badge/index.js';
import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
- const active = $derived.by(() => $settingsStore.uiConfigDisabled);
+ const active = $derived.by(() => settingsStore.current?.uiConfigDisabled);
</script>
{#if active}
diff --git a/frontend/src/lib/components/code-editor/editor.svelte b/frontend/src/lib/components/code-editor/editor.svelte
index 82aa454ab..6ce18be73 100644
--- a/frontend/src/lib/components/code-editor/editor.svelte
+++ b/frontend/src/lib/components/code-editor/editor.svelte
@@ -24,12 +24,12 @@
import { type Extension } from '@codemirror/state';
import { browser } from '$app/env';
import { m } from '#lib/paraglide/messages.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { mode } from 'mode-watcher';
import { arcaneDarkInit, arcaneLightInit } from './theme';
import { createDefaultSummary, ENV_SNIPPETS, YAML_SNIPPETS } from './editor-constants';
import { createEnterIndentKeymap } from './enter-indentation';
- import { createMergeHostAction, type MergeActionParams } from './merge-editor';
+ import { createMergeHostAttachment, type MergeAttachmentParams } from './merge-editor.svelte.js';
import { analyzeEnvContent } from './analysis/env-analysis';
import type { YamlPositionContext } from './analysis/compose-analysis';
import type { ComposeSchemaContext } from './analysis/compose-schema';
@@ -108,7 +108,7 @@
let activeOutlineItems = $state<OutlineItem[]>([]);
let activeView = $state<EditorView | null>(null);
let schemaState = $state<ComposeSchemaContext | null>(null);
- let shortcutsEnabled = $derived($userStore?.preferences?.keyboardShortcutsEnabled !== false);
+ let shortcutsEnabled = $derived(userStore.current?.preferences?.keyboardShortcutsEnabled !== false);
let schemaHoverSuppressedUntil = 0;
const schemaHoverSelectionSuppressionMs = 2500;
@@ -122,12 +122,12 @@
globalVariables: editorContext?.globalVariables ?? {}
});
- const mergeActionParams = $derived({
+ const mergeAttachmentParams = $derived({
diffActive: isDiffActive,
language,
value,
baseline: originalValue ?? ''
- } satisfies MergeActionParams);
+ } satisfies MergeAttachmentParams);
function updateSummary(patch: Partial<DiagnosticSummary>) {
let changed = false;
@@ -713,25 +713,28 @@
const theme = $derived.by(() => {
// Re-derive when the user's theme/accent preferences change.
- $userStore;
+ userStore.current;
return mode.current === 'dark' ? arcaneDarkInit() : arcaneLightInit();
});
- const mergeHostAction = createMergeHostAction({
- getTheme: () => theme,
- getLanguageExtension,
- getReadonlyLanguageExtension: getBasicLanguageExtension,
- onValueChange: (nextValue) => {
- value = nextValue;
+ const mergeHostAttachment = createMergeHostAttachment(
+ {
+ getTheme: () => theme,
+ getLanguageExtension,
+ getReadonlyLanguageExtension: getBasicLanguageExtension,
+ onValueChange: (nextValue) => {
+ value = nextValue;
+ },
+ onPrimaryViewReady: (view) => {
+ activeView = view;
+ restoreEditorState(view);
+ updateCursorSummary(view);
+ markReadOnlyReady();
+ markValidationNotRequiredReady();
+ }
},
- onPrimaryViewReady: (view) => {
- activeView = view;
- restoreEditorState(view);
- updateCursorSummary(view);
- markReadOnlyReady();
- markValidationNotRequiredReady();
- }
- });
+ () => mergeAttachmentParams
+ );
const extensions = $derived([...getLanguageExtension(language), theme]);
@@ -784,7 +787,7 @@
<span class="merge-badge merge-badge-add">+ Added</span>
<span class="merge-badge merge-badge-del">- Removed</span>
</div>
- <div class="merge-host" use:mergeHostAction={mergeActionParams}></div>
+ <div class="merge-host" {@attach mergeHostAttachment}></div>
</div>
{:else}
<CodeMirror bind:value {extensions} {styles} {placeholder} readonly={readOnly} nodebounce={true} onready={wireNormalView} />
@@ -817,22 +820,20 @@
</div>
<Command.Dialog bind:open={commandPaletteOpen} title={m.editor_commands()} description={m.editor_commands_desc()}>
- {#snippet children()}
- <Command.Input placeholder={m.editor_search_commands()} />
- <Command.List>
- <Command.Empty>{m.common_no_results_found()}</Command.Empty>
- <Command.Group>
- {#each commandItems as item (item.id)}
- <Command.Item value={item.label} onSelect={() => executeCommand(item.id)}>
- <span class="flex-1">{item.label}</span>
- {#if item.shortcut}
- <Command.Shortcut>{item.shortcut}</Command.Shortcut>
- {/if}
- </Command.Item>
- {/each}
- </Command.Group>
- </Command.List>
- {/snippet}
+ <Command.Input placeholder={m.editor_search_commands()} />
+ <Command.List>
+ <Command.Empty>{m.common_no_results_found()}</Command.Empty>
+ <Command.Group>
+ {#each commandItems as item (item.id)}
+ <Command.Item value={item.label} onSelect={() => executeCommand(item.id)}>
+ <span class="flex-1">{item.label}</span>
+ {#if item.shortcut}
+ <Command.Shortcut>{item.shortcut}</Command.Shortcut>
+ {/if}
+ </Command.Item>
+ {/each}
+ </Command.Group>
+ </Command.List>
</Command.Dialog>
</div>
diff --git a/frontend/src/lib/components/code-editor/merge-editor.ts b/frontend/src/lib/components/code-editor/merge-editor.svelte.ts
similarity index 81%
rename from frontend/src/lib/components/code-editor/merge-editor.ts
rename to frontend/src/lib/components/code-editor/merge-editor.svelte.ts
index 5db3b50a6..af30a6108 100644
--- a/frontend/src/lib/components/code-editor/merge-editor.ts
+++ b/frontend/src/lib/components/code-editor/merge-editor.svelte.ts
@@ -1,17 +1,18 @@
import { EditorState, type Extension } from '@codemirror/state';
import { MergeView } from '@codemirror/merge';
import { EditorView } from '@codemirror/view';
-import type { Action } from 'svelte/action';
+import { untrack } from 'svelte';
+import type { Attachment } from 'svelte/attachments';
import type { CodeLanguage } from './analysis/types';
-export type MergeActionParams = {
+export type MergeAttachmentParams = {
diffActive: boolean;
language: CodeLanguage;
value: string;
baseline: string;
};
-type CreateMergeHostActionOptions = {
+type CreateMergeHostAttachmentOptions = {
getTheme: () => Extension;
getLanguageExtension: (lang: CodeLanguage, options?: { lightweight?: boolean }) => Extension[];
getReadonlyLanguageExtension: (lang: CodeLanguage) => Extension[];
@@ -19,11 +20,14 @@ type CreateMergeHostActionOptions = {
onPrimaryViewReady: (view: EditorView) => void;
};
-export function createMergeHostAction(options: CreateMergeHostActionOptions): Action<HTMLDivElement, MergeActionParams> {
+export function createMergeHostAttachment(
+ options: CreateMergeHostAttachmentOptions,
+ getParams: () => MergeAttachmentParams
+): Attachment<HTMLDivElement> {
const { getTheme, getLanguageExtension, getReadonlyLanguageExtension, onValueChange, onPrimaryViewReady } = options;
- return (node, params) => {
- let currentParams = params;
+ return (node) => {
+ let currentParams = untrack(getParams);
let currentMergeView: MergeView | null = null;
const destroyCurrentMergeView = () => {
@@ -87,7 +91,7 @@ export function createMergeHostAction(options: CreateMergeHostActionOptions): Ac
}
};
- const applyParams = (nextParams: MergeActionParams) => {
+ const applyParams = (nextParams: MergeAttachmentParams) => {
const mustRecreate = Boolean(currentMergeView && nextParams.language !== currentParams.language);
currentParams = nextParams;
@@ -104,15 +108,13 @@ export function createMergeHostAction(options: CreateMergeHostActionOptions): Ac
syncCurrentMergeView();
};
- applyParams(params);
+ untrack(() => applyParams(currentParams));
- return {
- update(nextParams: MergeActionParams) {
- applyParams(nextParams);
- },
- destroy() {
- destroyCurrentMergeView();
- }
- };
+ $effect(() => {
+ const nextParams = getParams();
+ untrack(() => applyParams(nextParams));
+ });
+
+ return destroyCurrentMergeView;
};
}
diff --git a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
index 4a4f5bdc2..dabf61341 100644
--- a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
+++ b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
@@ -2,7 +2,8 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import * as Dialog from '#lib/components/ui/dialog/index.js';
import { AlertIcon } from '#lib/icons/index.js';
- import { confirmDialogStore } from './store';
+ import { confirmDialogState } from './store.svelte.js';
+ const dialog = $derived(confirmDialogState.current);
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { Label } from '#lib/components/ui/label/index.js';
import Checkbox from '../ui/checkbox/checkbox.svelte';
@@ -10,9 +11,10 @@
import { toast } from 'svelte-sonner';
async function handleConfirm() {
- const action = $confirmDialogStore.confirm.action;
- const states = $state.snapshot($confirmDialogStore.checkboxStates);
- $confirmDialogStore.open = false;
+ if (!dialog) return;
+ const action = dialog.confirm.action;
+ const states = $state.snapshot(dialog.checkboxStates);
+ dialog.open = false;
// Keep synchronous action failures inside the promise boundary.
const result = await tryCatch(Promise.resolve().then(() => action(states)));
if (result.error !== null) {
@@ -22,73 +24,75 @@
}
</script>
-<Dialog.Root bind:open={$confirmDialogStore.open}>
- <Dialog.Content
- class="z-[var(--arcane-z-critical-surface)] w-full max-w-md sm:max-w-lg"
- overlayClass="z-[var(--arcane-z-critical-surface)]"
- >
- <Dialog.Header class="space-y-3">
- <Dialog.Title class="flex items-start gap-3 text-lg leading-tight font-semibold">
- <AlertIcon class="mt-0.5 size-5 shrink-0 text-destructive" />
- <span class="min-w-0 break-words">
- {$confirmDialogStore.title}
- </span>
- </Dialog.Title>
- </Dialog.Header>
+{#if dialog}
+ <Dialog.Root bind:open={dialog.open}>
+ <Dialog.Content
+ class="z-[var(--arcane-z-critical-surface)] w-full max-w-md sm:max-w-lg"
+ overlayClass="z-[var(--arcane-z-critical-surface)]"
+ >
+ <Dialog.Header class="space-y-3">
+ <Dialog.Title class="flex items-start gap-3 text-lg leading-tight font-semibold">
+ <AlertIcon class="mt-0.5 size-5 shrink-0 text-destructive" />
+ <span class="min-w-0 break-words">
+ {dialog.title}
+ </span>
+ </Dialog.Title>
+ </Dialog.Header>
- <div class="mt-4 min-w-0 text-sm leading-relaxed break-words whitespace-pre-wrap text-muted-foreground">
- {$confirmDialogStore.message}
- </div>
+ <div class="mt-4 min-w-0 text-sm leading-relaxed break-words whitespace-pre-wrap text-muted-foreground">
+ {dialog.message}
+ </div>
- {#if $confirmDialogStore.checkboxes && $confirmDialogStore.checkboxes.length > 0}
- <div class="mt-6 flex flex-col gap-4 border-t border-border pt-4">
- {#each $confirmDialogStore.checkboxes as checkbox (checkbox.id)}
- <div class="flex items-start space-x-3">
- {#if $confirmDialogStore.checkboxStates[checkbox.id] !== undefined}
- <Checkbox
- id={checkbox.id}
- bind:checked={$confirmDialogStore.checkboxStates[checkbox.id]}
- aria-labelledby={`${checkbox.id}-label`}
- class="mt-0.5"
- />
- {:else}
- <Checkbox
- id={checkbox.id}
- checked={false}
- onchange={() => ($confirmDialogStore.checkboxStates[checkbox.id] = true)}
- aria-labelledby={`${checkbox.id}-label`}
- class="mt-0.5"
- />
- {/if}
+ {#if dialog.checkboxes && dialog.checkboxes.length > 0}
+ <div class="mt-6 flex flex-col gap-4 border-t border-border pt-4">
+ {#each dialog.checkboxes as checkbox (checkbox.id)}
+ <div class="flex items-start space-x-3">
+ {#if dialog.checkboxStates[checkbox.id] !== undefined}
+ <Checkbox
+ id={checkbox.id}
+ bind:checked={dialog.checkboxStates[checkbox.id]}
+ aria-labelledby={`${checkbox.id}-label`}
+ class="mt-0.5"
+ />
+ {:else}
+ <Checkbox
+ id={checkbox.id}
+ checked={false}
+ onchange={() => (dialog.checkboxStates[checkbox.id] = true)}
+ aria-labelledby={`${checkbox.id}-label`}
+ class="mt-0.5"
+ />
+ {/if}
- <div class="min-w-0">
- <Label
- id={`${checkbox.id}-label`}
- for={checkbox.id}
- class="min-w-0 text-sm leading-relaxed font-medium break-words peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- >
- {checkbox.label}
- </Label>
+ <div class="min-w-0">
+ <Label
+ id={`${checkbox.id}-label`}
+ for={checkbox.id}
+ class="min-w-0 text-sm leading-relaxed font-medium break-words peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ >
+ {checkbox.label}
+ </Label>
- {#if checkbox.id === 'files' && $confirmDialogStore.checkboxStates[checkbox.id]}
- <div class="mt-1 text-xs leading-snug text-destructive">{m.confirm_remove_project_files_warning()}</div>
- {/if}
+ {#if checkbox.id === 'files' && dialog.checkboxStates[checkbox.id]}
+ <div class="mt-1 text-xs leading-snug text-destructive">{m.confirm_remove_project_files_warning()}</div>
+ {/if}
+ </div>
</div>
- </div>
- {/each}
- </div>
- {/if}
+ {/each}
+ </div>
+ {/if}
- <Dialog.Footer class="mt-6">
- <div class="flex w-full justify-end gap-3">
- <ArcaneButton class="min-w-[80px]" action="cancel" onclick={() => ($confirmDialogStore.open = false)} />
- <ArcaneButton
- class="min-w-[80px]"
- action={$confirmDialogStore.confirm.button ?? ($confirmDialogStore.confirm.destructive ? 'remove' : 'confirm')}
- customLabel={$confirmDialogStore.confirm.label}
- onclick={handleConfirm}
- />
- </div>
- </Dialog.Footer>
- </Dialog.Content>
-</Dialog.Root>
+ <Dialog.Footer class="mt-6">
+ <div class="flex w-full justify-end gap-3">
+ <ArcaneButton class="min-w-[80px]" action="cancel" onclick={() => (dialog.open = false)} />
+ <ArcaneButton
+ class="min-w-[80px]"
+ action={dialog.confirm.button ?? (dialog.confirm.destructive ? 'remove' : 'confirm')}
+ customLabel={dialog.confirm.label}
+ onclick={handleConfirm}
+ />
+ </div>
+ </Dialog.Footer>
+ </Dialog.Content>
+ </Dialog.Root>
+{/if}
diff --git a/frontend/src/lib/components/confirm-dialog/index.ts b/frontend/src/lib/components/confirm-dialog/index.ts
index a165f44d5..a57150fa0 100644
--- a/frontend/src/lib/components/confirm-dialog/index.ts
+++ b/frontend/src/lib/components/confirm-dialog/index.ts
@@ -1,4 +1,4 @@
import ConfirmDialog from './confirm-dialog.svelte';
-export { confirmDialogStore, openConfirmDialog } from './store';
+export { confirmDialogState, openConfirmDialog } from './store.svelte.js';
export { ConfirmDialog };
diff --git a/frontend/src/lib/components/confirm-dialog/store.ts b/frontend/src/lib/components/confirm-dialog/store.svelte.ts
similarity index 52%
rename from frontend/src/lib/components/confirm-dialog/store.ts
rename to frontend/src/lib/components/confirm-dialog/store.svelte.ts
index 7e3b2afe5..5ccae1f1f 100644
--- a/frontend/src/lib/components/confirm-dialog/store.ts
+++ b/frontend/src/lib/components/confirm-dialog/store.svelte.ts
@@ -1,21 +1,10 @@
-import { writable } from 'svelte/store';
import { m } from '#lib/paraglide/messages.js';
-import type { ConfirmDialogOptions } from '#lib/types/confirm-dialog.js';
+import type { ConfirmDialogOptions, ConfirmDialogState } from '#lib/types/confirm-dialog.js';
-export const confirmDialogStore = writable<ConfirmDialogOptions & { open: boolean; checkboxStates: Record<string, boolean> }>({
- open: false,
- checkboxStates: {},
- title: '',
- message: '',
- confirm: {
- label: m.common_confirm(),
- destructive: false,
- action: () => {}
- }
-});
+export const confirmDialogState = $state<ConfirmDialogState>({ current: null });
export function openConfirmDialog({ title, message, confirm, checkboxes }: ConfirmDialogOptions) {
- confirmDialogStore.update(() => ({
+ confirmDialogState.current = {
open: true,
checkboxStates: Object.fromEntries((checkboxes ?? []).map((checkbox) => [checkbox.id, Boolean(checkbox.initialState)])),
title,
@@ -27,5 +16,5 @@ export function openConfirmDialog({ title, message, confirm, checkboxes }: Confi
action: confirm.action
},
checkboxes
- }));
+ };
}
diff --git a/frontend/src/lib/components/containers/container-form/container-form.svelte b/frontend/src/lib/components/containers/container-form/container-form.svelte
index cb3c2b0f4..1f84ddd6d 100644
--- a/frontend/src/lib/components/containers/container-form/container-form.svelte
+++ b/frontend/src/lib/components/containers/container-form/container-form.svelte
@@ -17,7 +17,8 @@
import { Badge } from '#lib/components/ui/badge/index.js';
import { m } from '#lib/paraglide/messages.js';
import { CloseIcon, ContainersIcon, NetworksIcon, SettingsIcon, VariableIcon, VolumesIcon } from '#lib/icons/index.js';
- import { preventDefault, createForm } from '#lib/utils/settings.js';
+ import { preventDefault, createForm } from '#lib/utils/settings.svelte.js';
+
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
import { volumeService } from '#lib/services/volume-service.js';
@@ -92,7 +93,7 @@
let imageSearchTimer: ReturnType<typeof setTimeout> | undefined;
function onImageInput() {
clearTimeout(imageSearchTimer);
- const term = $inputs.image.value.trim();
+ const term = inputs.image.value.trim();
if (term.length < 2 || term.includes(':')) {
imageSuggestions = [];
return;
@@ -117,7 +118,7 @@
function handleSubmit() {
onSubmit();
// Required fields live on the general tab; bring failed validation into view.
- if ($inputs.name.error || $inputs.image.error) {
+ if (inputs.name.error || inputs.image.error) {
selectedTab = 'general';
}
}
@@ -184,11 +185,11 @@
type="text"
placeholder={m.container_name_placeholder()}
disabled={submitting}
- bind:value={$inputs.name.value}
- class={$inputs.name.error ? 'border-destructive' : ''}
+ bind:value={inputs.name.value}
+ class={inputs.name.error ? 'border-destructive' : ''}
/>
- {#if $inputs.name.error}
- <p class="text-xs text-destructive">{$inputs.name.error}</p>
+ {#if inputs.name.error}
+ <p class="text-xs text-destructive">{inputs.name.error}</p>
{/if}
</div>
<div class="relative space-y-2">
@@ -200,9 +201,9 @@
type="text"
placeholder={m.nginx_latest_placeholder()}
disabled={submitting}
- bind:value={$inputs.image.value}
+ bind:value={inputs.image.value}
oninput={onImageInput}
- class={$inputs.image.error ? 'border-destructive' : ''}
+ class={inputs.image.error ? 'border-destructive' : ''}
autocomplete="off"
/>
{#if imageSuggestions.length > 0}
@@ -221,8 +222,8 @@
{/each}
</div>
{/if}
- {#if $inputs.image.error}
- <p class="text-xs text-destructive">{$inputs.image.error}</p>
+ {#if inputs.image.error}
+ <p class="text-xs text-destructive">{inputs.image.error}</p>
{/if}
{#if mode === 'edit'}
<p class="text-xs text-muted-foreground">{m.image_pull_if_missing_note()}</p>
@@ -233,28 +234,28 @@
type="text"
placeholder={m.container_command_placeholder()}
disabled={submitting}
- bind:input={$inputs.command}
+ bind:input={inputs.command}
/>
<FormInput
label={m.common_entrypoint()}
type="text"
placeholder="/docker-entrypoint.sh"
disabled={submitting}
- bind:input={$inputs.entrypoint}
+ bind:input={inputs.entrypoint}
/>
<FormInput
label={m.common_working_directory()}
type="text"
placeholder={m.app_placeholder()}
disabled={submitting}
- bind:input={$inputs.workingDir}
+ bind:input={inputs.workingDir}
/>
<FormInput
label={m.common_user()}
type="text"
placeholder={m.container_user_placeholder()}
disabled={submitting}
- bind:input={$inputs.user}
+ bind:input={inputs.user}
/>
</div>
</Tabs.Content>
@@ -304,45 +305,39 @@
type="number"
placeholder="0"
disabled={submitting}
- bind:input={$inputs.memoryMb}
+ bind:input={inputs.memoryMb}
/>
<FormInput
label={m.memory_swap_mb()}
type="number"
placeholder="0"
disabled={submitting}
- bind:input={$inputs.memorySwapMb}
- />
- <FormInput label={m.common_cpus()} type="number" placeholder="0" disabled={submitting} bind:input={$inputs.cpus} />
- <FormInput
- label={m.cpu_shares()}
- type="number"
- placeholder="0"
- disabled={submitting}
- bind:input={$inputs.cpuShares}
+ bind:input={inputs.memorySwapMb}
/>
+ <FormInput label={m.common_cpus()} type="number" placeholder="0" disabled={submitting} bind:input={inputs.cpus} />
+ <FormInput label={m.cpu_shares()} type="number" placeholder="0" disabled={submitting} bind:input={inputs.cpuShares} />
</div>
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<SelectWithLabel
id="restart-policy"
- bind:value={$inputs.restartPolicy.value}
+ bind:value={inputs.restartPolicy.value}
label={m.restart_policy_label()}
options={restartPolicies}
placeholder={m.container_select_restart_policy()}
disabled={submitting}
/>
- {#if $inputs.restartPolicy.value === 'on-failure'}
+ {#if inputs.restartPolicy.value === 'on-failure'}
<FormInput
label={m.max_retry_label()}
type="number"
placeholder={m.max_retry_placeholder()}
disabled={submitting}
- bind:input={$inputs.restartMaxRetries}
+ bind:input={inputs.restartMaxRetries}
/>
{/if}
</div>
<div class="flex items-center space-x-2">
- <Checkbox id="auto-remove" bind:checked={$inputs.autoRemove.value} disabled={submitting} />
+ <Checkbox id="auto-remove" bind:checked={inputs.autoRemove.value} disabled={submitting} />
<Label for="auto-remove" class="text-sm font-normal">{m.auto_remove_label()}</Label>
</div>
</div>
@@ -351,11 +346,11 @@
{@render groupTitle(m.common_security())}
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div class="flex items-center space-x-2">
- <Checkbox id="privileged" bind:checked={$inputs.privileged.value} disabled={submitting} />
+ <Checkbox id="privileged" bind:checked={inputs.privileged.value} disabled={submitting} />
<Label for="privileged" class="text-sm font-normal">{m.privileged_label()}</Label>
</div>
<div class="flex items-center space-x-2">
- <Checkbox id="readonly-rootfs" bind:checked={$inputs.readonlyRootfs.value} disabled={submitting} />
+ <Checkbox id="readonly-rootfs" bind:checked={inputs.readonlyRootfs.value} disabled={submitting} />
<Label for="readonly-rootfs" class="text-sm font-normal">{m.readonly_rootfs_label()}</Label>
</div>
</div>
@@ -370,50 +365,50 @@
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<SelectWithLabel
id="health-mode"
- bind:value={$inputs.healthMode.value}
+ bind:value={inputs.healthMode.value}
label={m.common_mode()}
options={healthModes}
disabled={submitting}
/>
- {#if $inputs.healthMode.value === 'custom'}
+ {#if inputs.healthMode.value === 'custom'}
<FormInput
label={m.health_test_command()}
type="text"
placeholder="curl -f http://localhost/ || exit 1"
disabled={submitting}
- bind:input={$inputs.healthTest}
+ bind:input={inputs.healthTest}
/>
{/if}
</div>
- {#if $inputs.healthMode.value === 'custom'}
+ {#if inputs.healthMode.value === 'custom'}
<div class="grid grid-cols-2 gap-6 lg:grid-cols-4">
<FormInput
label={`${m.health_interval()} (s)`}
type="number"
placeholder="30"
disabled={submitting}
- bind:input={$inputs.healthInterval}
+ bind:input={inputs.healthInterval}
/>
<FormInput
label={`${m.health_timeout()} (s)`}
type="number"
placeholder="30"
disabled={submitting}
- bind:input={$inputs.healthTimeout}
+ bind:input={inputs.healthTimeout}
/>
<FormInput
label={`${m.health_start_period()} (s)`}
type="number"
placeholder="0"
disabled={submitting}
- bind:input={$inputs.healthStartPeriod}
+ bind:input={inputs.healthStartPeriod}
/>
<FormInput
label={m.health_retries()}
type="number"
placeholder="3"
disabled={submitting}
- bind:input={$inputs.healthRetries}
+ bind:input={inputs.healthRetries}
/>
</div>
{/if}
diff --git a/frontend/src/lib/components/dialogs/docker-info-dialog.svelte b/frontend/src/lib/components/dialogs/docker-info-dialog.svelte
index c83c5b912..7f8c2b3cc 100644
--- a/frontend/src/lib/components/dialogs/docker-info-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/docker-info-dialog.svelte
@@ -7,8 +7,7 @@
import { CheckIcon, CloseIcon } from '#lib/icons/index.js';
import type { DockerInfo } from '#lib/types/docker.js';
import { m } from '#lib/paraglide/messages.js';
- import { bytes } from '#lib/utils/formatting.js';
- import { formatDateTimeShort } from '#lib/utils/formatting.js';
+ import { bytes, formatDateTimeShort, withOccurrenceKeys } from '#lib/utils/formatting.js';
interface Props {
open: boolean;
@@ -111,7 +110,7 @@
{m.docker_info_warnings_section()}
</h3>
<ul class="space-y-0.5">
- {#each warnings as warning, i (i)}
+ {#each withOccurrenceKeys(warnings) as { value: warning, key } (key)}
<li class="text-xs [overflow-wrap:anywhere] text-amber-700 dark:text-amber-300">{warning}</li>
{/each}
</ul>
@@ -239,7 +238,7 @@
{m.docker_info_storage_details_section()}
</h3>
<div class="space-y-0.5">
- {#each info.DriverStatus ?? [] as entry, i (i)}
+ {#each info.DriverStatus ?? [] as entry (entry)}
{@render infoRow(entry[0] ?? '', entry[1], false)}
{/each}
</div>
@@ -324,7 +323,7 @@
{m.docker_info_labels_section()}
</h3>
<div class="flex flex-wrap gap-1">
- {#each info.Labels ?? [] as label, i (i)}
+ {#each withOccurrenceKeys(info.Labels) as { value: label, key } (key)}
<Badge variant="outline" size="sm" class="font-mono">{label}</Badge>
{/each}
</div>
@@ -335,7 +334,7 @@
<div class="grid grid-cols-[minmax(96px,32%)_minmax(0,1fr)] items-baseline gap-x-3">
<span class="text-[10px] leading-4 tracking-tight text-muted-foreground uppercase">{label}</span>
<div class="flex flex-wrap justify-end gap-1">
- {#each items ?? [] as item, i (i)}
+ {#each withOccurrenceKeys(items) as { value: item, key } (key)}
<Badge variant="outline" size="sm">{item}</Badge>
{:else}
<span class="text-xs text-muted-foreground">-</span>
diff --git a/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte b/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte
index 273f763d8..9f4efae39 100644
--- a/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte
@@ -13,10 +13,10 @@
import { toast } from 'svelte-sonner';
import { m } from '#lib/paraglide/messages.js';
import { cn } from '#lib/utils.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { debounced } from '#lib/utils/ws.js';
import type { SearchPaginationSortRequest } from '#lib/types/shared.js';
- import { tick } from 'svelte';
+ import { tick, untrack } from 'svelte';
import { EnvironmentsIcon, RemoteEnvironmentIcon, AddIcon, SearchIcon, CloseIcon, SettingsIcon } from '#lib/icons/index.js';
import { useQueryClient } from '@tanstack/svelte-query';
import IfPermitted from '#lib/components/if-permitted.svelte';
@@ -141,14 +141,8 @@
}
function openSession(_node: HTMLElement) {
- // Runs when the dialog content mounts (i.e., when `open` becomes true)
- startInitialLoad();
- return {
- destroy() {
- // Runs when the dialog content unmounts (i.e., when `open` becomes false)
- resetDialogState();
- }
- };
+ untrack(startInitialLoad);
+ return resetDialogState;
}
const debouncedSearch = debounced((query: string) => {
@@ -250,7 +244,7 @@
function getConnectionString(env: Environment): string {
if (env.id === '0') {
- const host = $settingsStore ? $settingsStore.dockerHost : 'unix:///var/run/docker.sock';
+ const host = settingsStore.current ? settingsStore.current?.dockerHost : 'unix:///var/run/docker.sock';
return host || 'unix:///var/run/docker.sock';
} else {
return env.apiUrl;
@@ -259,120 +253,115 @@
</script>
<ResponsiveDialog bind:open title={m.sidebar_select_environment()} contentClass="max-w-2xl">
- {#snippet children()}
- <div class="m-2 flex flex-col gap-4">
- {#if open}
- <div class="hidden" use:openSession aria-hidden="true"></div>
+ <div class="m-2 flex flex-col gap-4">
+ {#if open}
+ <div class="hidden" {@attach openSession} aria-hidden="true"></div>
+ {/if}
+ <div class="relative">
+ <SearchIcon class="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ type="text"
+ placeholder={m.common_search()}
+ value={searchQuery}
+ oninput={(e) => {
+ searchQuery = (e.target as HTMLInputElement).value;
+ debouncedSearch(searchQuery);
+ }}
+ class="h-9 pr-10 pl-10"
+ />
+ {#if searchQuery}
+ <button
+ type="button"
+ onclick={clearSearch}
+ class="absolute top-1/2 right-3 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
+ title={m.common_clear_search()}
+ >
+ <CloseIcon class="size-4" />
+ </button>
{/if}
- <div class="relative">
- <SearchIcon class="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
- <Input
- type="text"
- placeholder={m.common_search()}
- value={searchQuery}
- oninput={(e) => {
- searchQuery = (e.target as HTMLInputElement).value;
- debouncedSearch(searchQuery);
- }}
- class="h-9 pr-10 pl-10"
- />
- {#if searchQuery}
- <button
- type="button"
- onclick={clearSearch}
- class="absolute top-1/2 right-3 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
- title={m.common_clear_search()}
- >
- <CloseIcon class="size-4" />
- </button>
- {/if}
- </div>
-
- <div bind:this={scrollContainer} onscroll={handleScroll} class="max-h-[50vh] min-h-[200px] overflow-y-auto">
- {#if isLoading}
- <div class="flex items-center justify-center py-10">
- <Spinner class="size-6" />
- </div>
- {:else if loadError}
- <div class="py-10 text-center text-destructive">
- <p>{m.error_generic()}</p>
- </div>
- {:else if environments.length === 0}
- <div class="py-10 text-center text-muted-foreground">
- <EnvironmentsIcon class="mx-auto mb-4 size-12 opacity-50" />
- <p>{m.sidebar_no_environments()}</p>
- </div>
- {:else}
- <div class="space-y-1">
- {#each environments as env (env.id)}
- {@const isActive = environmentStore.selected?.id === env.id}
- {@const isDisabled = !env.enabled}
- <div
- class={cn(
- 'flex items-center gap-2 rounded-lg border p-1 transition-colors',
- isActive && 'border-primary bg-primary/10 font-medium',
- !isActive && !isDisabled && 'hover:bg-muted/50',
- !isActive && isDisabled && 'opacity-50'
- )}
+ </div>
+
+ <div bind:this={scrollContainer} onscroll={handleScroll} class="max-h-[50vh] min-h-[200px] overflow-y-auto">
+ {#if isLoading}
+ <div class="flex items-center justify-center py-10">
+ <Spinner class="size-6" />
+ </div>
+ {:else if loadError}
+ <div class="py-10 text-center text-destructive">
+ <p>{m.error_generic()}</p>
+ </div>
+ {:else if environments.length === 0}
+ <div class="py-10 text-center text-muted-foreground">
+ <EnvironmentsIcon class="mx-auto mb-4 size-12 opacity-50" />
+ <p>{m.sidebar_no_environments()}</p>
+ </div>
+ {:else}
+ <div class="space-y-1">
+ {#each environments as env (env.id)}
+ {@const isActive = environmentStore.selected?.id === env.id}
+ {@const isDisabled = !env.enabled}
+ <div
+ class={cn(
+ 'flex items-center gap-2 rounded-lg border p-1 transition-colors',
+ isActive && 'border-primary bg-primary/10 font-medium',
+ !isActive && !isDisabled && 'hover:bg-muted/50',
+ !isActive && isDisabled && 'opacity-50'
+ )}
+ >
+ <button
+ type="button"
+ onclick={() => !isActive && !isDisabled && handleSelect(env)}
+ disabled={isDisabled}
+ class={cn('flex min-w-0 flex-1 items-center gap-3 rounded-md p-2 text-left', isDisabled && 'cursor-not-allowed')}
>
- <button
- type="button"
- onclick={() => !isActive && !isDisabled && handleSelect(env)}
- disabled={isDisabled}
+ <div
class={cn(
- 'flex min-w-0 flex-1 items-center gap-3 rounded-md p-2 text-left',
- isDisabled && 'cursor-not-allowed'
+ 'flex size-8 shrink-0 items-center justify-center rounded-md border',
+ isActive ? 'border-primary bg-primary' : 'border-border'
)}
>
- <div
- class={cn(
- 'flex size-8 shrink-0 items-center justify-center rounded-md border',
- isActive ? 'border-primary bg-primary' : 'border-border'
- )}
- >
- {#if env.id === '0'}
- <EnvironmentsIcon class={cn('size-4', isActive && 'text-primary-foreground')} />
- {:else}
- <RemoteEnvironmentIcon class={cn('size-4', isActive && 'text-primary-foreground')} />
- {/if}
- </div>
- <div class="flex min-w-0 flex-1 flex-col">
- <span class="truncate">{env.name}</span>
- <span class={cn('truncate text-xs', isActive ? 'text-primary/70' : 'text-muted-foreground')}>
- {getConnectionString(env)}
- </span>
- </div>
- </button>
- <div class="flex shrink-0 items-center gap-2 pr-2">
- {#if isActive}
- <span class="hidden text-xs font-medium text-primary sm:inline">
- {m.environments_current_environment()}
- </span>
+ {#if env.id === '0'}
+ <EnvironmentsIcon class={cn('size-4', isActive && 'text-primary-foreground')} />
+ {:else}
+ <RemoteEnvironmentIcon class={cn('size-4', isActive && 'text-primary-foreground')} />
{/if}
- <ArcaneButton
- action="base"
- tone="ghost"
- size="icon"
- class="size-8"
- icon={SettingsIcon}
- showLabel={false}
- customLabel={m.settings()}
- onclick={() => handleOpenSettings(env)}
- />
</div>
+ <div class="flex min-w-0 flex-1 flex-col">
+ <span class="truncate">{env.name}</span>
+ <span class={cn('truncate text-xs', isActive ? 'text-primary/70' : 'text-muted-foreground')}>
+ {getConnectionString(env)}
+ </span>
+ </div>
+ </button>
+ <div class="flex shrink-0 items-center gap-2 pr-2">
+ {#if isActive}
+ <span class="hidden text-xs font-medium text-primary sm:inline">
+ {m.environments_current_environment()}
+ </span>
+ {/if}
+ <ArcaneButton
+ action="base"
+ tone="ghost"
+ size="icon"
+ class="size-8"
+ icon={SettingsIcon}
+ showLabel={false}
+ customLabel={m.settings()}
+ onclick={() => handleOpenSettings(env)}
+ />
</div>
- {/each}
-
- {#if isLoadingMore}
- <div class="flex items-center justify-center py-4">
- <Spinner class="size-5" />
- </div>
- {/if}
- </div>
- {/if}
- </div>
+ </div>
+ {/each}
+
+ {#if isLoadingMore}
+ <div class="flex items-center justify-center py-4">
+ <Spinner class="size-5" />
+ </div>
+ {/if}
+ </div>
+ {/if}
</div>
- {/snippet}
+ </div>
{#snippet footer()}
<div class="flex w-full items-center justify-between gap-2">
diff --git a/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte b/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
index ebeef4146..119e1f0b6 100644
--- a/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
@@ -24,7 +24,8 @@
import { settingsService } from '#lib/services/settings-service.js';
import { hasPermission } from '#lib/utils/auth.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { queryKeys } from '#lib/query/query-keys.js';
import { m } from '#lib/paraglide/messages.js';
import { ArrowRightIcon, CodeIcon, FolderOpenIcon, InfoIcon } from '#lib/icons/index.js';
@@ -169,10 +170,11 @@
});
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
const selectedRepository = $derived.by(() => {
- const repository = repositories.find((item) => item.id === $inputs.repositoryId.value);
+ const repository = repositories.find((item) => item.id === inputs.repositoryId.value);
if (!repository) return undefined;
return { value: repository.id, label: repository.name };
});
@@ -239,12 +241,12 @@
}
const selectedBranch = $derived.by(() => {
- if ($inputs.branch.value || isEditMode) return $inputs.branch.value;
+ if (inputs.branch.value || isEditMode) return inputs.branch.value;
return branches.find((branch) => branch.isDefault)?.name ?? '';
});
function handleSubmit() {
- $inputs.branch.value = selectedBranch;
+ inputs.branch.value = selectedBranch;
const data = form.validate();
if (!data) return;
@@ -309,12 +311,7 @@
<form id="sync-form" onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
<div class="space-y-3">
<div class="grid gap-3 sm:grid-cols-2">
- <FormInput
- label={m.git_sync_name()}
- type="text"
- placeholder={m.common_name_placeholder()}
- bind:input={$inputs.name}
- />
+ <FormInput label={m.git_sync_name()} type="text" placeholder={m.common_name_placeholder()} bind:input={inputs.name} />
<SelectWithLabel
id="targetType"
@@ -324,8 +321,8 @@
onValueChange={(value) => {
const previousDefault = defaultComposePath;
selectedTargetType = value as GitOpsSyncTargetType;
- if ($inputs.composePath.value === previousDefault) {
- $inputs.composePath.value = defaultComposePath;
+ if (inputs.composePath.value === previousDefault) {
+ inputs.composePath.value = defaultComposePath;
}
}}
/>
@@ -341,12 +338,12 @@
if (v) {
const repo = repositories.find((r) => r.id === v);
if (repo) {
- $inputs.repositoryId.value = v;
+ inputs.repositoryId.value = v;
}
}
}}
>
- <Select.Trigger id="repository" class="w-full" aria-invalid={$inputs.repositoryId.error ? 'true' : undefined}>
+ <Select.Trigger id="repository" class="w-full" aria-invalid={inputs.repositoryId.error ? 'true' : undefined}>
<span>{selectedRepository?.label ?? m.common_select_placeholder()}</span>
</Select.Trigger>
<Select.Content style="width: var(--bits-select-anchor-width);">
@@ -355,8 +352,8 @@
{/each}
</Select.Content>
</Select.Root>
- {#if $inputs.repositoryId.error}
- <p class="mt-1 text-sm text-red-500">{$inputs.repositoryId.error}</p>
+ {#if inputs.repositoryId.error}
+ <p class="mt-1 text-sm text-red-500">{inputs.repositoryId.error}</p>
{/if}
</div>
@@ -373,11 +370,11 @@
value={selectedBranch}
onValueChange={(v) => {
if (v) {
- $inputs.branch.value = v;
+ inputs.branch.value = v;
}
}}
>
- <Select.Trigger id="branch" class="w-full" aria-invalid={$inputs.branch.error ? 'true' : undefined}>
+ <Select.Trigger id="branch" class="w-full" aria-invalid={inputs.branch.error ? 'true' : undefined}>
<span>{selectedBranch || m.common_select_placeholder()}</span>
</Select.Trigger>
<Select.Content style="width: var(--bits-select-anchor-width);">
@@ -392,10 +389,10 @@
</Select.Content>
</Select.Root>
{:else}
- <FormInput type="text" placeholder="main" bind:input={$inputs.branch} />
+ <FormInput type="text" placeholder="main" bind:input={inputs.branch} />
{/if}
- {#if $inputs.branch.error}
- <p class="mt-1 text-sm text-red-500">{$inputs.branch.error}</p>
+ {#if inputs.branch.error}
+ <p class="mt-1 text-sm text-red-500">{inputs.branch.error}</p>
{/if}
</div>
</div>
@@ -407,7 +404,7 @@
<FormInput
type="text"
placeholder={selectedTargetType === 'swarm_stack' ? 'compose.yml' : 'docker-compose.yml'}
- bind:input={$inputs.composePath}
+ bind:input={inputs.composePath}
/>
</div>
{@render BrowseFilesButton('compose')}
@@ -418,26 +415,26 @@
<div class="grid gap-3 rounded-lg border border-border/70 bg-muted/20 p-3 sm:grid-cols-[minmax(0,1fr)_8rem]">
<div class="grid gap-3 sm:grid-cols-2">
<div class="flex items-start gap-3">
- <Switch id="syncDirectorySwitch" bind:checked={$inputs.syncDirectory.value} disabled={lockSyncDirectory} />
+ <Switch id="syncDirectorySwitch" bind:checked={inputs.syncDirectory.value} disabled={lockSyncDirectory} />
<div class="space-y-1">
<Label for="syncDirectorySwitch" class="mb-0 text-sm leading-none font-medium">{m.git_sync_sync_files()}</Label>
<p class="text-xs text-muted-foreground">{m.git_sync_sync_files_description()}</p>
{#if lockSyncDirectory}
<p class="text-xs text-muted-foreground italic">{m.git_sync_sync_files_locked_hint()}</p>
{/if}
- {#if $inputs.syncDirectory.error}
- <p class="text-xs font-medium text-destructive">{$inputs.syncDirectory.error}</p>
+ {#if inputs.syncDirectory.error}
+ <p class="text-xs font-medium text-destructive">{inputs.syncDirectory.error}</p>
{/if}
</div>
</div>
<div class="flex items-start gap-3">
- <Switch id="autoSyncSwitch" bind:checked={$inputs.autoSync.value} />
+ <Switch id="autoSyncSwitch" bind:checked={inputs.autoSync.value} />
<div class="space-y-1">
<Label for="autoSyncSwitch" class="mb-0 text-sm leading-none font-medium">{m.git_sync_auto_sync()}</Label>
<p class="text-xs text-muted-foreground">{m.common_auto_sync_description()}</p>
- {#if $inputs.autoSync.error}
- <p class="text-xs font-medium text-destructive">{$inputs.autoSync.error}</p>
+ {#if inputs.autoSync.error}
+ <p class="text-xs font-medium text-destructive">{inputs.autoSync.error}</p>
{/if}
</div>
</div>
@@ -445,33 +442,33 @@
<div class="flex items-start gap-3">
<Switch
id="pullImageAfterSyncSwitch"
- bind:checked={$inputs.pullImageAfterSync.value}
- disabled={$inputs.redeployAfterSync.value}
+ bind:checked={inputs.pullImageAfterSync.value}
+ disabled={inputs.redeployAfterSync.value}
/>
<div class="space-y-1">
<Label for="pullImageAfterSyncSwitch" class="mb-0 text-sm leading-none font-medium"
>{m.git_sync_pull_image_after_sync()}</Label
>
<p class="text-xs text-muted-foreground">
- {$inputs.redeployAfterSync.value
+ {inputs.redeployAfterSync.value
? m.git_sync_pull_image_after_sync_redundant_description()
: m.git_sync_pull_image_after_sync_description()}
</p>
- {#if $inputs.pullImageAfterSync.error}
- <p class="text-xs font-medium text-destructive">{$inputs.pullImageAfterSync.error}</p>
+ {#if inputs.pullImageAfterSync.error}
+ <p class="text-xs font-medium text-destructive">{inputs.pullImageAfterSync.error}</p>
{/if}
</div>
</div>
<div class="flex items-start gap-3">
- <Switch id="redeployAfterSyncSwitch" bind:checked={$inputs.redeployAfterSync.value} />
+ <Switch id="redeployAfterSyncSwitch" bind:checked={inputs.redeployAfterSync.value} />
<div class="space-y-1">
<Label for="redeployAfterSyncSwitch" class="mb-0 text-sm leading-none font-medium"
>{m.git_sync_redeploy_after_sync()}</Label
>
<p class="text-xs text-muted-foreground">{m.git_sync_redeploy_after_sync_description()}</p>
- {#if $inputs.redeployAfterSync.error}
- <p class="text-xs font-medium text-destructive">{$inputs.redeployAfterSync.error}</p>
+ {#if inputs.redeployAfterSync.error}
+ <p class="text-xs font-medium text-destructive">{inputs.redeployAfterSync.error}</p>
{/if}
</div>
</div>
@@ -488,11 +485,11 @@
id="syncInterval"
type="number"
placeholder="5"
- bind:value={$inputs.syncInterval.value}
- aria-invalid={$inputs.syncInterval.error ? 'true' : undefined}
+ bind:value={inputs.syncInterval.value}
+ aria-invalid={inputs.syncInterval.error ? 'true' : undefined}
/>
- {#if $inputs.syncInterval.error}
- <p class="text-xs font-medium text-destructive">{$inputs.syncInterval.error}</p>
+ {#if inputs.syncInterval.error}
+ <p class="text-xs font-medium text-destructive">{inputs.syncInterval.error}</p>
{/if}
</div>
</div>
@@ -516,21 +513,21 @@
type="number"
placeholder="0"
helpText={m.git_sync_max_files_per_sync_help()}
- bind:input={$inputs.maxSyncFiles}
+ bind:input={inputs.maxSyncFiles}
/>
<FormInput
label={m.git_sync_max_total_size_label()}
type="number"
placeholder="0"
helpText={m.git_sync_max_total_size_per_sync_help()}
- bind:input={$inputs.maxSyncTotalSizeMb}
+ bind:input={inputs.maxSyncTotalSizeMb}
/>
<FormInput
label={m.git_sync_max_binary_size_label()}
type="number"
placeholder="0"
helpText={m.git_sync_max_binary_size_per_sync_help()}
- bind:input={$inputs.maxSyncBinarySizeMb}
+ bind:input={inputs.maxSyncBinarySizeMb}
/>
</div>
</div>
@@ -571,15 +568,15 @@
id="preDeployScriptPath"
type="text"
placeholder={m.git_sync_pre_deploy_script_path_placeholder()}
- bind:value={$inputs.preDeployScriptPath.value}
- aria-invalid={$inputs.preDeployScriptPath.error ? 'true' : undefined}
+ bind:value={inputs.preDeployScriptPath.value}
+ aria-invalid={inputs.preDeployScriptPath.error ? 'true' : undefined}
/>
</div>
{@render BrowseFilesButton('preDeployScript')}
</div>
<p class="text-xs text-muted-foreground">{m.git_sync_pre_deploy_script_path_help()}</p>
- {#if $inputs.preDeployScriptPath.error}
- <p class="text-xs font-medium text-destructive">{$inputs.preDeployScriptPath.error}</p>
+ {#if inputs.preDeployScriptPath.error}
+ <p class="text-xs font-medium text-destructive">{inputs.preDeployScriptPath.error}</p>
{/if}
</div>
@@ -588,7 +585,7 @@
type="text"
placeholder={m.git_sync_pre_deploy_runner_image_placeholder()}
helpText={m.git_sync_pre_deploy_runner_image_help()}
- bind:input={$inputs.preDeployRunnerImage}
+ bind:input={inputs.preDeployRunnerImage}
/>
<div class="grid gap-3 sm:grid-cols-2">
@@ -597,14 +594,14 @@
type="number"
placeholder="60"
helpText={m.git_sync_pre_deploy_timeout_help()}
- bind:input={$inputs.preDeployTimeoutSec}
+ bind:input={inputs.preDeployTimeoutSec}
/>
<FormInput
label={m.resource_network_cap()}
type="text"
placeholder={m.git_sync_pre_deploy_network_mode_placeholder()}
helpText={m.git_sync_pre_deploy_network_mode_help()}
- bind:input={$inputs.preDeployNetworkMode}
+ bind:input={inputs.preDeployNetworkMode}
/>
</div>
@@ -613,7 +610,7 @@
label={m.git_sync_pre_deploy_env_label()}
placeholder={m.git_sync_pre_deploy_env_placeholder()}
helpText={m.git_sync_pre_deploy_env_help()}
- bind:input={$inputs.preDeployEnv}
+ bind:input={inputs.preDeployEnv}
class="[&_textarea]:font-mono [&_textarea]:text-xs"
/>
@@ -622,7 +619,7 @@
label={m.git_sync_pre_deploy_extra_mounts_label()}
placeholder={m.git_sync_pre_deploy_extra_mounts_placeholder()}
helpText={m.git_sync_pre_deploy_extra_mounts_help()}
- bind:input={$inputs.preDeployExtraMounts}
+ bind:input={inputs.preDeployExtraMounts}
class="[&_textarea]:font-mono [&_textarea]:text-xs"
/>
</div>
@@ -702,8 +699,8 @@
? m.git_sync_browse_files_description_script()
: m.git_sync_browse_files_description()}
rootPath={fileBrowserTarget === 'preDeployScript'
- ? $inputs.composePath.value.includes('/')
- ? $inputs.composePath.value.replace(/\/[^/]*$/, '')
+ ? inputs.composePath.value.includes('/')
+ ? inputs.composePath.value.replace(/\/[^/]*$/, '')
: ''
: ''}
fileFilter={fileBrowserTarget === 'preDeployScript' ? undefined : composeFileFilter}
@@ -711,9 +708,9 @@
footerHint={fileBrowserTarget === 'preDeployScript' ? undefined : composeFooterHint}
onSelect={(path) => {
if (fileBrowserTarget === 'preDeployScript') {
- $inputs.preDeployScriptPath.value = path;
+ inputs.preDeployScriptPath.value = path;
} else {
- $inputs.composePath.value = path;
+ inputs.composePath.value = path;
}
}}
/>
diff --git a/frontend/src/lib/components/dialogs/service-editor-dialog.svelte b/frontend/src/lib/components/dialogs/service-editor-dialog.svelte
index 5e7858927..d78587e33 100644
--- a/frontend/src/lib/components/dialogs/service-editor-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/service-editor-dialog.svelte
@@ -3,7 +3,8 @@
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { Input } from '#lib/components/ui/input/index.js';
import * as Select from '#lib/components/ui/select/index.js';
- import { preventDefault } from '#lib/utils/settings.js';
+ import { preventDefault } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
import { AddIcon, TrashIcon } from '#lib/icons/index.js';
import * as Accordion from '#lib/components/ui/accordion/index.js';
@@ -417,7 +418,7 @@
<Accordion.Trigger class="text-sm font-medium">{m.common_ports()}</Accordion.Trigger>
<Accordion.Content class="pt-6 pb-5">
<div class="space-y-4">
- {#each form.ports as port, i (i)}
+ {#each form.ports as port, i (port)}
<div class="flex items-center gap-4">
<Input placeholder="8080" bind:value={port.target} disabled={isLoading} class="flex-1" />
<span class="text-muted-foreground">:</span>
@@ -451,7 +452,7 @@
<Accordion.Trigger class="text-sm font-medium">{m.common_environment_variables()}</Accordion.Trigger>
<Accordion.Content class="pt-6 pb-5">
<div class="space-y-4">
- {#each form.envVars as env, i (i)}
+ {#each form.envVars as env, i (env)}
<div class="flex items-center gap-4">
<Input placeholder="KEY" bind:value={env.key} disabled={isLoading} class="flex-1" />
<span class="text-muted-foreground">=</span>
@@ -476,7 +477,7 @@
<Accordion.Trigger class="text-sm font-medium">{m.swarm_service_form_mounts()}</Accordion.Trigger>
<Accordion.Content class="pt-6 pb-5">
<div class="space-y-4">
- {#each form.mounts as mount, i (i)}
+ {#each form.mounts as mount, i (mount)}
<div class="flex items-center gap-4">
<Select.Root type="single" bind:value={mount.type} disabled={isLoading}>
<Select.Trigger class="w-24">
@@ -510,7 +511,7 @@
<Accordion.Trigger class="text-sm font-medium">{m.common_labels()}</Accordion.Trigger>
<Accordion.Content class="pt-6 pb-5">
<div class="space-y-4">
- {#each form.labels as label, i (i)}
+ {#each form.labels as label, i (label)}
<div class="flex items-center gap-4">
<Input placeholder="key" bind:value={label.key} disabled={isLoading} class="flex-1" />
<span class="text-muted-foreground">=</span>
diff --git a/frontend/src/lib/components/dialogs/template-selection-dialog.svelte b/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
index 18df01d26..de0bf7935 100644
--- a/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { SvelteSet } from 'svelte/reactivity';
import { tryCatch } from '#lib/utils/try-catch.js';
import { ResponsiveDialog } from '#lib/components/ui/responsive-dialog/index.js';
@@ -37,7 +38,7 @@
let { open = $bindable(), templates = [], onSelect, onDownloadSuccess }: Props = $props();
void open;
- let loadingStates = $state<Set<string>>(new Set());
+ const loadingStates = new SvelteSet<string>();
let sortBy = $state<'name-asc' | 'name-desc'>('name-asc');
let groupByRegistry = $state(true);
const selectTemplateMutation = createMutation(() => ({
@@ -216,6 +217,7 @@
{#if normalizeTags(template.metadata?.tags).length > 0}
<div class="mb-3 flex flex-wrap gap-1">
+ <!-- Template metadata may contain duplicate tags; badges have no local state. -->
{#each normalizeTags(template.metadata?.tags) as tag}
<Badge variant="outline" size="sm">{tag}</Badge>
{/each}
@@ -279,7 +281,7 @@
{filters[sortBy]}
</Select.Trigger>
<Select.Content>
- {#each Object.entries(filters) as [value, label]}
+ {#each Object.entries(filters) as [value, label] (value)}
<Select.Item {value}>{label}</Select.Item>
{/each}
</Select.Content>
@@ -300,7 +302,7 @@
</div>
{:else if groupByRegistry && groupedTemplates.length > 0}
<div class="space-y-3">
- {#each groupedTemplates as group}
+ {#each groupedTemplates as group (group.name)}
<Collapsible.Root class="w-full">
<Card class="border-2">
<Collapsible.Trigger class="flex w-full items-center justify-between px-4 py-3 text-left">
@@ -314,7 +316,7 @@
<Collapsible.Content>
<div class="px-6 pb-6">
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- {#each group.items as template}
+ {#each group.items as template (template.id)}
{@render templateCard(template)}
{/each}
</div>
@@ -326,7 +328,7 @@
</div>
{:else}
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- {#each sortedTemplates as template}
+ {#each sortedTemplates as template (template.id)}
{@render templateCard(template, true)}
{/each}
</div>
diff --git a/frontend/src/lib/components/dialogs/version-info-dialog.svelte b/frontend/src/lib/components/dialogs/version-info-dialog.svelte
index 088e06635..b6d936adb 100644
--- a/frontend/src/lib/components/dialogs/version-info-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/version-info-dialog.svelte
@@ -6,10 +6,10 @@
import { m } from '#lib/paraglide/messages.js';
import { CopyButton } from '#lib/components/ui/copy-button/index.js';
import { getApplicationLogo } from '#lib/utils/docker.js';
- import { accentColorPreviewStore } from '#lib/utils/theme.js';
+ import { accentColorPreview } from '#lib/utils/theme.svelte.js';
import { ExternalLinkIcon, GithubIcon, BookOpenIcon } from '#lib/icons/index.js';
import { hasPermission } from '#lib/utils/auth.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { settingsService } from '#lib/services/settings-service.js';
import { handleApiResultWithCallbacks } from '#lib/utils/api.js';
import { tryCatch } from '#lib/utils/try-catch.js';
@@ -41,11 +41,11 @@
const displayInfo = $derived(debugMode ? mockVersionInfo : versionInfo);
const enabledFeatures = $derived((displayInfo.enabledFeatures ?? []).filter(Boolean).join(', '));
- const accentColor = $derived($accentColorPreviewStore);
+ const accentColor = $derived(accentColorPreview.current);
const logoUrl = $derived(getApplicationLogo(false, accentColor, accentColor));
const canToggleExperimental = $derived(hasPermission('settings:write'));
- const experimentalEnabled = $derived($settingsStore?.experimentalFeaturesEnabled === true);
+ const experimentalEnabled = $derived(settingsStore.current?.experimentalFeaturesEnabled === true);
let savingExperimental = $state(false);
async function handleExperimentalToggle(enabled: boolean) {
diff --git a/frontend/src/lib/components/env-vars-list.svelte b/frontend/src/lib/components/env-vars-list.svelte
index 3483028be..a40694c62 100644
--- a/frontend/src/lib/components/env-vars-list.svelte
+++ b/frontend/src/lib/components/env-vars-list.svelte
@@ -11,7 +11,8 @@
</script>
<KeyValueGrid>
- {#each envVars as env, index (index)}
+ <!-- Docker environment entries can repeat; these cards have no row-local state. -->
+ {#each envVars as env}
{#if env.includes('=')}
{@const [key, ...valueParts] = env.split('=')}
{@const value = valueParts.join('=')}
diff --git a/frontend/src/lib/components/error.svelte b/frontend/src/lib/components/error.svelte
index 8a59be7a7..7c0b850b4 100644
--- a/frontend/src/lib/components/error.svelte
+++ b/frontend/src/lib/components/error.svelte
@@ -6,7 +6,7 @@
import { goto } from '$app/navigation';
import EnvironmentSwitcherDialog from '#lib/components/dialogs/environment-switcher-dialog.svelte';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
let {
message,
@@ -51,7 +51,7 @@
const connectionErrorMessage = $derived.by(() => {
if (environmentStore.selected?.id === '0') {
- const host = $settingsStore ? $settingsStore.dockerHost : 'unix:///var/run/docker.sock';
+ const host = settingsStore.current ? settingsStore.current?.dockerHost : 'unix:///var/run/docker.sock';
return m.error_connection_local_docker_desc({
host: host || 'unix:///var/run/docker.sock'
});
diff --git a/frontend/src/lib/components/font-size-picker.svelte b/frontend/src/lib/components/font-size-picker.svelte
index e3c0554f3..65c276e0e 100644
--- a/frontend/src/lib/components/font-size-picker.svelte
+++ b/frontend/src/lib/components/font-size-picker.svelte
@@ -2,20 +2,20 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import * as Slider from '#lib/components/ui/slider/index.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { userService } from '#lib/services/user-service.js';
- import { applyFontSize, FONT_SIZE_MIN, FONT_SIZE_MAX, FONT_SIZE_DEFAULT } from '#lib/utils/theme.js';
+ import { applyFontSize, FONT_SIZE_MIN, FONT_SIZE_MAX, FONT_SIZE_DEFAULT } from '#lib/utils/theme.svelte.js';
import { debounced } from '#lib/utils/ws.js';
import { queryKeys } from '#lib/query/query-keys.js';
import { useQueryClient } from '@tanstack/svelte-query';
- import { get } from 'svelte/store';
+
import { m } from '#lib/paraglide/messages.js';
let { id = 'fontSizePicker', class: className = '' }: { id?: string; class?: string } = $props();
const queryClient = useQueryClient();
- const initialSize = get(userStore)?.fontSize ?? FONT_SIZE_DEFAULT;
+ const initialSize = userStore.current?.fontSize ?? FONT_SIZE_DEFAULT;
let currentSize = $state(initialSize);
let lastPersisted = initialSize;
diff --git a/frontend/src/lib/components/form/form-input.svelte b/frontend/src/lib/components/form/form-input.svelte
index 7f7996c58..0aaeab7f9 100644
--- a/frontend/src/lib/components/form/form-input.svelte
+++ b/frontend/src/lib/components/form/form-input.svelte
@@ -8,7 +8,7 @@
import type { Temporal } from 'temporal-polyfill';
import type { Snippet } from 'svelte';
import type { HTMLAttributes } from 'svelte/elements';
- import type { FormInput } from '#lib/utils/settings.js';
+ import type { FormInput } from '#lib/types/form.js';
let {
input = $bindable(),
diff --git a/frontend/src/lib/components/form/key-value-editor.svelte b/frontend/src/lib/components/form/key-value-editor.svelte
index c01f62f75..cdfafe155 100644
--- a/frontend/src/lib/components/form/key-value-editor.svelte
+++ b/frontend/src/lib/components/form/key-value-editor.svelte
@@ -10,8 +10,8 @@
let {
rows = $bindable([]),
- keyPlaceholder = 'KEY',
- valuePlaceholder = 'value',
+ keyPlaceholder = m.key_placeholder(),
+ valuePlaceholder = m.value_placeholder(),
addLabel,
disabled = false
}: {
@@ -32,7 +32,7 @@
</script>
<div class="space-y-3">
- {#each rows as row, index (index)}
+ {#each rows as row, index (row)}
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
<Input type="text" placeholder={keyPlaceholder} bind:value={row.key} {disabled} class="flex-1 font-mono" />
<span class="hidden font-mono text-muted-foreground sm:inline">=</span>
diff --git a/frontend/src/lib/components/form/network-attachment-editor.svelte b/frontend/src/lib/components/form/network-attachment-editor.svelte
index ef9ba7578..7284a17a0 100644
--- a/frontend/src/lib/components/form/network-attachment-editor.svelte
+++ b/frontend/src/lib/components/form/network-attachment-editor.svelte
@@ -37,7 +37,7 @@
</script>
<div class="space-y-3">
- {#each rows as row, index (index)}
+ {#each rows as row, index (row)}
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
<SearchableSelect items={networkItems} bind:value={row.network} {disabled} class="min-w-40 flex-1" />
<Input
diff --git a/frontend/src/lib/components/form/port-mapping-editor.svelte b/frontend/src/lib/components/form/port-mapping-editor.svelte
index 26e80ec4a..ee065500f 100644
--- a/frontend/src/lib/components/form/port-mapping-editor.svelte
+++ b/frontend/src/lib/components/form/port-mapping-editor.svelte
@@ -31,15 +31,34 @@
</script>
<div class="space-y-3">
- {#each rows as row, index (index)}
+ {#each rows as row, index (row)}
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
- <Input type="text" placeholder="0.0.0.0" bind:value={row.hostIp} {disabled} class="flex-1 font-mono" title={m.host()} />
- <Input type="text" placeholder="8080" bind:value={row.hostPort} {disabled} class="flex-1 font-mono" />
+ <Input
+ type="text"
+ placeholder={m.host_ip_placeholder()}
+ bind:value={row.hostIp}
+ {disabled}
+ class="flex-1 font-mono"
+ title={m.host()}
+ />
+ <Input
+ type="text"
+ placeholder={m.notifications_signal_port_placeholder()}
+ bind:value={row.hostPort}
+ {disabled}
+ class="flex-1 font-mono"
+ />
<span class="hidden text-muted-foreground sm:inline">→</span>
- <Input type="text" placeholder="80" bind:value={row.containerPort} {disabled} class="flex-1 font-mono" />
+ <Input
+ type="text"
+ placeholder={m.container_port_placeholder()}
+ bind:value={row.containerPort}
+ {disabled}
+ class="flex-1 font-mono"
+ />
<select bind:value={row.protocol} {disabled} class="min-w-16 rounded-md border bg-background px-3 py-2 text-sm">
- <option value="tcp">TCP</option>
- <option value="udp">UDP</option>
+ <option value="tcp">{m.protocol_tcp()}</option>
+ <option value="udp">{m.protocol_udp()}</option>
</select>
<ArcaneButton
action="base"
diff --git a/frontend/src/lib/components/form/repo-tag-fields.svelte b/frontend/src/lib/components/form/repo-tag-fields.svelte
index 0682d695a..34ec91c1e 100644
--- a/frontend/src/lib/components/form/repo-tag-fields.svelte
+++ b/frontend/src/lib/components/form/repo-tag-fields.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import FormInput from '#lib/components/form/form-input.svelte';
import { m } from '#lib/paraglide/messages.js';
- import type { FormInput as FormInputType } from '#lib/utils/settings.js';
+ import type { FormInput as FormInputType } from '#lib/types/form.js';
interface Props {
repository: FormInputType<string | boolean | number | undefined>;
diff --git a/frontend/src/lib/components/form/volume-mount-editor.svelte b/frontend/src/lib/components/form/volume-mount-editor.svelte
index c9a5a3231..2f9116f0a 100644
--- a/frontend/src/lib/components/form/volume-mount-editor.svelte
+++ b/frontend/src/lib/components/form/volume-mount-editor.svelte
@@ -43,11 +43,15 @@
</script>
<div class="space-y-3">
- {#each rows as row, index (index)}
+ {#each rows as row, index (row)}
<div class="space-y-2 rounded-lg border border-border/50 p-3">
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
<Badge variant="outline" class="w-fit shrink-0 font-mono text-xs">
- {row.kind === 'mount' ? (row.mountType ?? 'mount') : row.kind}
+ {row.kind === 'mount'
+ ? (row.mountType ?? m.common_mount())
+ : row.kind === 'bind'
+ ? m.containers_mount_type_bind()
+ : m.containers_mount_type_volume()}
</Badge>
{#if row.kind === 'volume'}
<SearchableSelect items={volumeItems} bind:value={row.source} {disabled} class="flex-1" />
diff --git a/frontend/src/lib/components/locale-picker.svelte b/frontend/src/lib/components/locale-picker.svelte
index 94435f8a7..b9029c5c0 100644
--- a/frontend/src/lib/components/locale-picker.svelte
+++ b/frontend/src/lib/components/locale-picker.svelte
@@ -2,7 +2,7 @@
import * as Select from '#lib/components/ui/select/index.js';
import { getLocale, type Locale } from '#lib/paraglide/runtime.js';
import { m } from '#lib/paraglide/messages.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { setLocale } from '#lib/utils/formatting.js';
import { Label } from '#lib/components/ui/label/index.js';
import { queryKeys } from '#lib/query/query-keys.js';
@@ -52,7 +52,7 @@
const updateLocaleMutation = createMutation(() => ({
mutationFn: async (locale: Locale) => {
- if ($userStore) {
+ if (userStore.current) {
await userService.updateMyProfile({ locale });
}
await setLocale(locale);
diff --git a/frontend/src/lib/components/logs/log-viewer.svelte b/frontend/src/lib/components/logs/log-viewer.svelte
index f9c562c30..ccceebdc7 100644
--- a/frontend/src/lib/components/logs/log-viewer.svelte
+++ b/frontend/src/lib/components/logs/log-viewer.svelte
@@ -58,7 +58,7 @@
searchTerm = ''
}: Props = $props();
- let logs: LogViewerEntry[] = $state([]);
+ let logs = $state.raw<LogViewerEntry[]>([]);
let pending: LogViewerEntry[] = [];
let flushScheduled = false;
let seq = 0;
@@ -291,16 +291,14 @@
await wsClient.connect();
}
- function processLogObject(obj: any) {
- if (!obj || typeof obj !== 'object') return;
- const { level = 'stdout', message = '', timestamp = nowInstantString(), service, containerId } = obj;
-
+ function processLogObject(obj: unknown) {
+ if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return;
addLogEntry({
- level,
- message,
- timestamp,
- service,
- containerId
+ level: 'level' in obj && typeof obj.level === 'string' ? obj.level : 'stdout',
+ message: 'message' in obj && typeof obj.message === 'string' ? obj.message : '',
+ timestamp: 'timestamp' in obj && typeof obj.timestamp === 'string' ? obj.timestamp : nowInstantString(),
+ service: 'service' in obj && typeof obj.service === 'string' ? obj.service : undefined,
+ containerId: 'containerId' in obj && typeof obj.containerId === 'string' ? obj.containerId : undefined
});
}
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
index 0d179a321..cd3aa9ef4 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
@@ -3,7 +3,7 @@
import type { NavigationItem } from '#lib/config/navigation-config.js';
import { cn } from '#lib/utils.js';
import { page } from '$app/state';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import MobileUserCard from './mobile-user-card.svelte';
@@ -32,7 +32,7 @@
} = $props();
const currentPath = $derived(page.url.pathname);
- const memoizedUser = $derived(user ?? $userStore);
+ const memoizedUser = $derived(user ?? userStore.current);
const currentEnvId = $derived(environmentStore.selected?.id || '0');
const managementItemsRaw = $derived(getManagementItems(currentEnvId));
const managementItems = $derived(
diff --git a/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte b/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte
index b27b39e7b..e3d269249 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-user-card.svelte
@@ -6,8 +6,8 @@
import type { User } from '#lib/types/auth.js';
import LocalePicker from '#lib/components/locale-picker.svelte';
import EnvironmentSwitcherDialog from '#lib/components/dialogs/environment-switcher-dialog.svelte';
- import settingsStore from '#lib/stores/config-store.js';
- import userStore from '#lib/stores/user-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import IfPermitted from '#lib/components/if-permitted.svelte';
import {
@@ -36,7 +36,7 @@
function getConnectionString(): string {
if (!environmentStore.selected) return '';
if (environmentStore.selected.id === '0') {
- return $settingsStore.dockerHost || 'unix:///var/run/docker.sock';
+ return settingsStore.current?.dockerHost || 'unix:///var/run/docker.sock';
} else {
return environmentStore.selected.apiUrl;
}
@@ -67,7 +67,7 @@
>
<ArrowDownIcon class="size-8" />
</div>
- {#if !$autoLoginEnabled}
+ {#if !autoLoginEnabled.current}
<form action="/logout" method="POST">
<ArcaneButton
action="base"
diff --git a/frontend/src/lib/components/oidc-status-panel.svelte b/frontend/src/lib/components/oidc-status-panel.svelte
index 09bda9f86..211ef16cf 100644
--- a/frontend/src/lib/components/oidc-status-panel.svelte
+++ b/frontend/src/lib/components/oidc-status-panel.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import { getApplicationLogo } from '#lib/utils/docker.js';
- import { accentColorPreviewStore } from '#lib/utils/theme.js';
- import userStore from '#lib/stores/user-store.js';
+ import { accentColorPreview } from '#lib/utils/theme.svelte.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
interface Props {
@@ -15,8 +15,8 @@
let { busy, busyTitle, busyDescription, error, children }: Props = $props();
- const accentColor = $derived($accentColorPreviewStore);
- const animationsEnabled = $derived($userStore?.preferences?.animationsEnabled ?? true);
+ const accentColor = $derived(accentColorPreview.current);
+ const animationsEnabled = $derived(userStore.current?.preferences?.animationsEnabled ?? true);
const loaderLogoUrl = $derived(
getApplicationLogo(false, accentColor, accentColor, { animated: animationsEnabled, loop: animationsEnabled })
);
diff --git a/frontend/src/lib/components/operation-watch-dialog.svelte b/frontend/src/lib/components/operation-watch-dialog.svelte
index 5cab7ae5e..8d6721fde 100644
--- a/frontend/src/lib/components/operation-watch-dialog.svelte
+++ b/frontend/src/lib/components/operation-watch-dialog.svelte
@@ -35,6 +35,7 @@
itemCount={operationWatchStore.lines.length}
class="max-h-[70vh] min-h-[280px] overflow-auto rounded-lg border border-border/50 bg-zinc-950 p-4 font-mono text-[12px] leading-relaxed text-zinc-100"
>
+ <!-- Lines only append within a session, so their positions are stable identities. -->
{#each operationWatchStore.lines as line, idx (idx)}
<!-- eslint-disable-next-line svelte/no-at-html-tags -- ansiToHtml escapes markup before adding color spans -->
<div class="break-words whitespace-pre-wrap">{@html ansiToHtml(line)}</div>
diff --git a/frontend/src/lib/components/resource-detail/detail-meta-strip.svelte b/frontend/src/lib/components/resource-detail/detail-meta-strip.svelte
index de62320a7..db022b894 100644
--- a/frontend/src/lib/components/resource-detail/detail-meta-strip.svelte
+++ b/frontend/src/lib/components/resource-detail/detail-meta-strip.svelte
@@ -23,9 +23,7 @@
</script>
<div class={cn('flex flex-wrap items-center gap-x-4 gap-y-2 rounded-lg bg-muted/40 px-4 py-3', className)}>
- <!-- Keyed by index on purpose: rows are stateless (icon + text from props) and
- labels are not guaranteed unique, so a label-based key could collide. -->
- {#each items as item, i (i)}
+ {#each items as item (item)}
<div class="flex items-center gap-1.5 text-sm text-muted-foreground">
{#if item.icon}
<item.icon class="size-4 shrink-0" />
diff --git a/frontend/src/lib/components/role-editor/role-editor.svelte b/frontend/src/lib/components/role-editor/role-editor.svelte
index b1142dcd4..efdb7dc46 100644
--- a/frontend/src/lib/components/role-editor/role-editor.svelte
+++ b/frontend/src/lib/components/role-editor/role-editor.svelte
@@ -8,7 +8,8 @@
import { normalizePermissionSelection } from '#lib/utils/permissions.js';
import { CopyIcon } from '#lib/icons/index.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
type Props = {
@@ -36,9 +37,10 @@
permissions: normalizePermissionSelection(manifest, role?.permissions ?? [])
});
- const { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ const form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
- const selectedCount = $derived($inputs.permissions?.value?.length ?? 0);
+ const selectedCount = $derived(inputs.permissions?.value?.length ?? 0);
function handleSubmit() {
if (isBuiltIn) return;
@@ -70,7 +72,7 @@
type="text"
placeholder={m.roles_name_placeholder()}
disabled={isBuiltIn || isLoading}
- bind:input={$inputs.name}
+ bind:input={inputs.name}
/>
<FormInput
@@ -78,15 +80,15 @@
type="text"
placeholder={m.roles_description_placeholder()}
disabled={isBuiltIn || isLoading}
- bind:input={$inputs.description}
+ bind:input={inputs.description}
/>
<div>
<div class="text-xs text-muted-foreground">
{m.roles_permissions_count({ count: selectedCount, total: totalPermissions })}
</div>
- {#if $inputs.permissions?.error}
- <p class="mt-1 text-sm text-red-500">{$inputs.permissions.error}</p>
+ {#if inputs.permissions?.error}
+ <p class="mt-1 text-sm text-red-500">{inputs.permissions.error}</p>
{/if}
</div>
@@ -123,6 +125,6 @@
</div>
<div>
- <PermissionPicker {manifest} bind:selected={$inputs.permissions.value} disabled={isBuiltIn || isLoading} />
+ <PermissionPicker {manifest} bind:selected={inputs.permissions.value} disabled={isBuiltIn || isLoading} />
</div>
</form>
diff --git a/frontend/src/lib/components/settings/image-patch-settings.svelte b/frontend/src/lib/components/settings/image-patch-settings.svelte
index 4f0c942cf..5e0f43bfd 100644
--- a/frontend/src/lib/components/settings/image-patch-settings.svelte
+++ b/frontend/src/lib/components/settings/image-patch-settings.svelte
@@ -4,7 +4,7 @@
import SettingsRow from '#lib/components/settings/settings-row.svelte';
import { SecurityIcon } from '#lib/icons/index.js';
import { m } from '#lib/paraglide/messages.js';
- import type { Readable } from 'svelte/store';
+
import SectionCard from '#lib/components/section-card.svelte';
type ImagePatchFormValues = {
@@ -19,13 +19,11 @@
error: string | null;
};
- type ImagePatchFormInputs = Readable<
- Record<string, FormField<unknown>> & {
- [K in keyof ImagePatchFormValues]: FormField<ImagePatchFormValues[K]>;
- }
- >;
+ type ImagePatchFormInputs = Record<string, FormField<unknown>> & {
+ [K in keyof ImagePatchFormValues]: FormField<ImagePatchFormValues[K]>;
+ };
- let { formInputs }: { formInputs: ImagePatchFormInputs } = $props();
+ let { formInputs = $bindable() }: { formInputs: ImagePatchFormInputs } = $props();
</script>
<SectionCard
@@ -40,7 +38,7 @@
description={m.security_image_auto_patch_enabled_description()}
layout="inline"
>
- <Switch id="imageAutoPatchEnabledSwitch" bind:checked={$formInputs.imageAutoPatchEnabled.value} />
+ <Switch id="imageAutoPatchEnabledSwitch" bind:checked={formInputs.imageAutoPatchEnabled.value} />
</SettingsRow>
<SettingsRow
@@ -48,13 +46,13 @@
description={m.security_image_patch_all_platforms_description()}
layout="inline"
>
- <Switch id="imagePatchAllPlatformsSwitch" bind:checked={$formInputs.imagePatchAllPlatforms.value} />
+ <Switch id="imagePatchAllPlatformsSwitch" bind:checked={formInputs.imagePatchAllPlatforms.value} />
</SettingsRow>
<div class="max-w-xl">
<TextInputWithLabel
- bind:value={$formInputs.imagePatchSuffix.value}
- error={$formInputs.imagePatchSuffix.error}
+ bind:value={formInputs.imagePatchSuffix.value}
+ error={formInputs.imagePatchSuffix.error}
label={m.security_image_patch_suffix_label()}
description={m.security_image_patch_suffix_description()}
placeholder="patched"
@@ -64,8 +62,8 @@
<div class="max-w-xs">
<TextInputWithLabel
- bind:value={$formInputs.imagePatchTimeoutSec.value}
- error={$formInputs.imagePatchTimeoutSec.error}
+ bind:value={formInputs.imagePatchTimeoutSec.value}
+ error={formInputs.imagePatchTimeoutSec.error}
label={m.security_image_patch_timeout_label()}
description={m.security_image_patch_timeout_description()}
placeholder="600"
diff --git a/frontend/src/lib/components/settings/lifecycle-security-settings.svelte b/frontend/src/lib/components/settings/lifecycle-security-settings.svelte
index 75e463a44..2b35f586f 100644
--- a/frontend/src/lib/components/settings/lifecycle-security-settings.svelte
+++ b/frontend/src/lib/components/settings/lifecycle-security-settings.svelte
@@ -5,7 +5,7 @@
import SettingsRow from '#lib/components/settings/settings-row.svelte';
import { AlertIcon, CodeIcon } from '#lib/icons/index.js';
import { m } from '#lib/paraglide/messages.js';
- import type { Readable } from 'svelte/store';
+
import SectionCard from '#lib/components/section-card.svelte';
type LifecycleSecurityFormValues = {
@@ -19,13 +19,11 @@
error: string | null;
};
- type LifecycleSecurityFormInputs = Readable<
- Record<string, FormField<unknown>> & {
- [K in keyof LifecycleSecurityFormValues]: FormField<LifecycleSecurityFormValues[K]>;
- }
- >;
+ type LifecycleSecurityFormInputs = Record<string, FormField<unknown>> & {
+ [K in keyof LifecycleSecurityFormValues]: FormField<LifecycleSecurityFormValues[K]>;
+ };
- let { formInputs }: { formInputs: LifecycleSecurityFormInputs } = $props();
+ let { formInputs = $bindable() }: { formInputs: LifecycleSecurityFormInputs } = $props();
</script>
<SectionCard
@@ -40,13 +38,13 @@
description={m.security_lifecycle_enabled_description()}
layout="inline"
>
- <Switch id="lifecycleEnabledSwitch" bind:checked={$formInputs.lifecycleEnabled.value} />
+ <Switch id="lifecycleEnabledSwitch" bind:checked={formInputs.lifecycleEnabled.value} />
</SettingsRow>
<div class="max-w-xl">
<TextInputWithLabel
- bind:value={$formInputs.lifecycleDefaultRunnerImage.value}
- error={$formInputs.lifecycleDefaultRunnerImage.error}
+ bind:value={formInputs.lifecycleDefaultRunnerImage.value}
+ error={formInputs.lifecycleDefaultRunnerImage.error}
label={m.security_lifecycle_runner_image_label()}
description={m.security_lifecycle_runner_image_description()}
helpText={m.security_lifecycle_runner_image_help()}
@@ -57,8 +55,8 @@
<div class="max-w-xs">
<TextInputWithLabel
- bind:value={$formInputs.lifecycleMaxTimeoutSec.value}
- error={$formInputs.lifecycleMaxTimeoutSec.error}
+ bind:value={formInputs.lifecycleMaxTimeoutSec.value}
+ error={formInputs.lifecycleMaxTimeoutSec.error}
label={m.security_lifecycle_max_timeout_label()}
description={m.security_lifecycle_max_timeout_description()}
helpText={m.security_lifecycle_max_timeout_help()}
diff --git a/frontend/src/lib/components/settings/trivy-security-settings.svelte b/frontend/src/lib/components/settings/trivy-security-settings.svelte
index f47225698..f96caacd8 100644
--- a/frontend/src/lib/components/settings/trivy-security-settings.svelte
+++ b/frontend/src/lib/components/settings/trivy-security-settings.svelte
@@ -3,7 +3,7 @@
import { createQuery, useQueryClient } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
import { Switch } from '#lib/components/ui/switch/index.js';
import { Textarea } from '#lib/components/ui/textarea/index.js';
@@ -18,7 +18,7 @@
import { networkService } from '#lib/services/network-service.js';
import type { SearchPaginationSortRequest } from '#lib/types/shared.js';
import type { Settings } from '#lib/types/settings.js';
- import type { Readable } from 'svelte/store';
+
import SectionCard from '#lib/components/section-card.svelte';
import { arcaneImageRegistryOptions, arcaneTrivyDbImages } from '#lib/utils/registry.js';
@@ -43,14 +43,12 @@
error: string | null;
};
- type TrivySecurityFormInputs = Readable<
- Record<string, FormField<unknown>> & {
- [K in keyof TrivySecurityFormValues]: FormField<TrivySecurityFormValues[K]>;
- }
- >;
+ type TrivySecurityFormInputs = Record<string, FormField<unknown>> & {
+ [K in keyof TrivySecurityFormValues]: FormField<TrivySecurityFormValues[K]>;
+ };
let {
- formInputs,
+ formInputs = $bindable(),
environmentId = undefined
}: {
formInputs: TrivySecurityFormInputs;
@@ -82,7 +80,7 @@
const targetEnvironmentId = $derived(environmentId ?? environmentStore.selected?.id);
const networksQuery = createQuery(() => {
const requestedEnvironmentId = targetEnvironmentId;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.networks.list(requestedEnvironmentId ?? '', networkRequest),
queryFn: async () => {
@@ -107,7 +105,7 @@
}
}
- const selectedNetwork = ($formInputs.trivyNetwork.value || '').trim();
+ const selectedNetwork = (formInputs.trivyNetwork.value || '').trim();
if (selectedNetwork && !options.some((option) => option.value === selectedNetwork)) {
options.push({
value: selectedNetwork,
@@ -120,10 +118,10 @@
});
function handleTrivyResourceLimitsChange(checked: boolean) {
- $formInputs.trivyResourceLimitsEnabled.value = checked;
+ formInputs.trivyResourceLimitsEnabled.value = checked;
if (!checked) {
- $formInputs.trivyCpuLimit.value = 0;
- $formInputs.trivyMemoryLimitMb.value = 0;
+ formInputs.trivyCpuLimit.value = 0;
+ formInputs.trivyMemoryLimitMb.value = 0;
}
}
@@ -158,14 +156,14 @@
<SelectWithLabel
id="trivyDbRegistry"
name="trivyDbRegistry"
- bind:value={$formInputs.trivyDbRegistry.value}
+ bind:value={formInputs.trivyDbRegistry.value}
label={m.trivy_db_registry_label()}
description={m.trivy_db_registry_description()}
options={arcaneImageRegistryOptions()}
- onValueChange={(v) => ($formInputs.trivyDbRegistry.value = v as 'ghcr.io' | 'docker.io')}
+ onValueChange={(v) => (formInputs.trivyDbRegistry.value = v as 'ghcr.io' | 'docker.io')}
/>
<ul class="mt-2 space-y-0.5 font-mono text-xs text-muted-foreground">
- {#each arcaneTrivyDbImages($formInputs.trivyDbRegistry.value) as image (image)}
+ {#each arcaneTrivyDbImages(formInputs.trivyDbRegistry.value) as image (image)}
<li>{image}</li>
{/each}
</ul>
@@ -176,7 +174,7 @@
description={m.security_trivy_ignore_unfixed_description()}
layout="inline"
>
- <Switch id="trivyIgnoreUnfixedSwitch" bind:checked={$formInputs.trivyIgnoreUnfixed.value} />
+ <Switch id="trivyIgnoreUnfixedSwitch" bind:checked={formInputs.trivyIgnoreUnfixed.value} />
</SettingsRow>
<SettingsRow
@@ -192,13 +190,13 @@
label: option.label,
hint: option.description
}))}
- bind:value={$formInputs.trivyNetwork.value}
- onSelect={(value) => ($formInputs.trivyNetwork.value = value)}
+ bind:value={formInputs.trivyNetwork.value}
+ onSelect={(value) => (formInputs.trivyNetwork.value = value)}
placeholder={false}
class="w-full justify-between"
/>
- {#if $formInputs.trivyNetwork.error}
- <p class="mt-2 text-sm text-destructive">{$formInputs.trivyNetwork.error}</p>
+ {#if formInputs.trivyNetwork.error}
+ <p class="mt-2 text-sm text-destructive">{formInputs.trivyNetwork.error}</p>
{/if}
</SettingsRow>
@@ -208,21 +206,21 @@
description={m.security_trivy_server_enabled_description()}
layout="inline"
>
- <Switch id="trivyServerEnabledSwitch" bind:checked={$formInputs.trivyServerEnabled.value} />
+ <Switch id="trivyServerEnabledSwitch" bind:checked={formInputs.trivyServerEnabled.value} />
</SettingsRow>
- {#if $formInputs.trivyServerEnabled.value}
+ {#if formInputs.trivyServerEnabled.value}
<div class="space-y-4 border-l-2 border-border/60 pl-5">
<TextInputWithLabel
- bind:value={$formInputs.trivyServerUrl.value}
- error={$formInputs.trivyServerUrl.error}
+ bind:value={formInputs.trivyServerUrl.value}
+ error={formInputs.trivyServerUrl.error}
label={m.security_trivy_server_url_label()}
description={m.security_trivy_server_url_description()}
placeholder={m.security_trivy_server_url_placeholder()}
type="url"
/>
<TextInputWithLabel
- bind:value={$formInputs.trivyServerToken.value}
- error={$formInputs.trivyServerToken.error}
+ bind:value={formInputs.trivyServerToken.value}
+ error={formInputs.trivyServerToken.error}
label={m.security_trivy_server_token_label()}
description={m.security_trivy_server_token_description()}
type="password"
@@ -243,14 +241,14 @@
helpText={m.security_trivy_security_opts_help()}
>
<Textarea
- bind:value={$formInputs.trivySecurityOpts.value}
+ bind:value={formInputs.trivySecurityOpts.value}
aria-label={m.security_trivy_security_opts_label()}
class="min-h-28 font-mono text-sm"
placeholder={m.security_trivy_security_opts_placeholder()}
rows={4}
/>
- {#if $formInputs.trivySecurityOpts.error}
- <p class="mt-2 text-sm text-destructive">{$formInputs.trivySecurityOpts.error}</p>
+ {#if formInputs.trivySecurityOpts.error}
+ <p class="mt-2 text-sm text-destructive">{formInputs.trivySecurityOpts.error}</p>
{/if}
</SettingsRow>
@@ -259,9 +257,9 @@
description={m.security_trivy_privileged_description()}
layout="inline"
>
- <Switch id="trivyPrivilegedSwitch" bind:checked={$formInputs.trivyPrivileged.value} />
+ <Switch id="trivyPrivilegedSwitch" bind:checked={formInputs.trivyPrivileged.value} />
</SettingsRow>
- {#if $formInputs.trivyPrivileged.value}
+ {#if formInputs.trivyPrivileged.value}
<Alert.Root variant="default" class="border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950">
<InfoIcon class="h-4 w-4 text-amber-900 dark:text-amber-100" />
<Alert.Description class="text-amber-800 dark:text-amber-200">
@@ -278,25 +276,25 @@
>
<Switch
id="trivyResourceLimitsEnabledSwitch"
- bind:checked={$formInputs.trivyResourceLimitsEnabled.value}
+ bind:checked={formInputs.trivyResourceLimitsEnabled.value}
onCheckedChange={handleTrivyResourceLimitsChange}
/>
</SettingsRow>
- {#if $formInputs.trivyResourceLimitsEnabled.value}
+ {#if formInputs.trivyResourceLimitsEnabled.value}
<div class="space-y-4 border-l-2 border-border/60 pl-5">
<div class="grid gap-4 sm:grid-cols-2">
<TextInputWithLabel
- bind:value={$formInputs.trivyCpuLimit.value}
- error={$formInputs.trivyCpuLimit.error}
- disabled={!$formInputs.trivyResourceLimitsEnabled.value}
+ bind:value={formInputs.trivyCpuLimit.value}
+ error={formInputs.trivyCpuLimit.error}
+ disabled={!formInputs.trivyResourceLimitsEnabled.value}
label={m.security_trivy_cpu_limit_label()}
helpText={m.security_trivy_cpu_limit_help()}
type="number"
/>
<TextInputWithLabel
- bind:value={$formInputs.trivyMemoryLimitMb.value}
- error={$formInputs.trivyMemoryLimitMb.error}
- disabled={!$formInputs.trivyResourceLimitsEnabled.value}
+ bind:value={formInputs.trivyMemoryLimitMb.value}
+ error={formInputs.trivyMemoryLimitMb.error}
+ disabled={!formInputs.trivyResourceLimitsEnabled.value}
label={m.security_trivy_memory_limit_label()}
reserveHelpTextSpace={true}
type="number"
@@ -304,8 +302,8 @@
</div>
<div class="max-w-xs">
<TextInputWithLabel
- bind:value={$formInputs.trivyConcurrentScanContainers.value}
- error={$formInputs.trivyConcurrentScanContainers.error}
+ bind:value={formInputs.trivyConcurrentScanContainers.value}
+ error={formInputs.trivyConcurrentScanContainers.error}
label={m.security_trivy_concurrent_scan_containers_label()}
helpText={m.security_trivy_concurrent_scan_containers_help()}
type="number"
diff --git a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
index ca5517a9a..d33d9b700 100644
--- a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
+++ b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
@@ -4,7 +4,8 @@
import FormInput from '#lib/components/form/form-input.svelte';
import SwitchWithLabel from '#lib/components/form/labeled-switch.svelte';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import * as Alert from '#lib/components/ui/alert/index.js';
import { m } from '#lib/paraglide/messages.js';
import { templateService } from '#lib/services/template-service.js';
@@ -29,7 +30,8 @@
enabled: true
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
let submitError = $state<string | null>(null);
const validateRegistryMutation = createMutation(() => ({
@@ -84,14 +86,14 @@
type="text"
placeholder={m.templates_registry_url_placeholder()}
description={m.templates_registry_url_description()}
- bind:input={$inputs.url}
+ bind:input={inputs.url}
/>
<SwitchWithLabel
id="enabledSwitch"
label={m.templates_enable_registry_label()}
description={m.templates_enable_registry_description()}
- bind:checked={$inputs.enabled.value}
+ bind:checked={inputs.enabled.value}
/>
{#if submitError}
diff --git a/frontend/src/lib/components/sheets/api-key-form-sheet.svelte b/frontend/src/lib/components/sheets/api-key-form-sheet.svelte
index b06cc983a..b53f65528 100644
--- a/frontend/src/lib/components/sheets/api-key-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/api-key-form-sheet.svelte
@@ -9,7 +9,8 @@
import { plainDateFromInstant, plainDateToInstantString } from '#lib/utils/formatting.js';
import { Temporal } from 'temporal-polyfill';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import * as m from '#lib/paraglide/messages.js';
type ApiKeyFormProps = {
@@ -72,7 +73,8 @@
)
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
function handleSubmit() {
if (isReadOnlyApiKey) return;
@@ -130,7 +132,7 @@
type="text"
placeholder={m.api_key_name_placeholder()}
description={m.api_key_name_description()}
- bind:input={$inputs.name}
+ bind:input={inputs.name}
disabled={isReadOnlyApiKey}
/>
<FormInput
@@ -138,14 +140,14 @@
type="text"
placeholder={m.optional_description_placeholder()}
description={m.api_key_description_help()}
- bind:input={$inputs.description}
+ bind:input={inputs.description}
disabled={isReadOnlyApiKey}
/>
<FormInput
label={m.api_key_expires_at()}
type="date"
description={m.api_key_expires_at_description()}
- bind:input={$inputs.expiresAt}
+ bind:input={inputs.expiresAt}
disabled={isReadOnlyApiKey}
/>
{#if !isReadOnlyApiKey}
@@ -155,9 +157,9 @@
<div>
<label for="permissions" class="text-sm font-medium">{m.permissions()}</label>
<p class="mb-3 text-xs text-muted-foreground">{m.api_key_permissions_description()}</p>
- <PermissionPicker {manifest} bind:selected={$inputs.permissions.value} showSearch />
- {#if $inputs.permissions.error}
- <p class="mt-1 text-xs text-destructive">{$inputs.permissions.error}</p>
+ <PermissionPicker {manifest} bind:selected={inputs.permissions.value} showSearch />
+ {#if inputs.permissions.error}
+ <p class="mt-1 text-xs text-destructive">{inputs.permissions.error}</p>
{/if}
</div>
{/if}
diff --git a/frontend/src/lib/components/sheets/container-registry-sheet.svelte b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
index a3ac1d8fd..38ff90462 100644
--- a/frontend/src/lib/components/sheets/container-registry-sheet.svelte
+++ b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
@@ -11,7 +11,8 @@
RegistryType
} from '#lib/types/docker.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { parseLines } from '#lib/utils/form-parsers.js';
import { m } from '#lib/paraglide/messages.js';
@@ -100,9 +101,10 @@
awsRegion: open && registryToEdit ? (registryToEdit.awsRegion ?? '') : ''
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
- let isECR = $derived($inputs.registryType.value === 'ecr');
+ let isECR = $derived(inputs.registryType.value === 'ecr');
function handleSubmit() {
const data = form.validate();
@@ -132,7 +134,7 @@
id="registryTypeSelect"
label={m.registries_type_label()}
options={registryTypeOptions}
- bind:value={$inputs.registryType.value}
+ bind:value={inputs.registryType.value}
disabled={isEditMode}
/>
@@ -141,7 +143,7 @@
type="text"
placeholder={m.registries_url_placeholder()}
description={m.registries_url_description()}
- bind:input={$inputs.url}
+ bind:input={inputs.url}
/>
{#if !isECR}
@@ -149,28 +151,28 @@
label={m.common_username()}
type="text"
description={m.common_username_required()}
- bind:input={$inputs.username}
+ bind:input={inputs.username}
/>
<FormInput
label={m.common_token()}
type="password"
placeholder={isEditMode ? m.registries_token_keep_placeholder() : m.registries_token_placeholder()}
description={m.registries_token_description()}
- bind:input={$inputs.token}
+ bind:input={inputs.token}
/>
{:else}
- <FormInput label={m.registries_aws_access_key_id()} type="text" bind:input={$inputs.awsAccessKeyId} />
+ <FormInput label={m.registries_aws_access_key_id()} type="text" bind:input={inputs.awsAccessKeyId} />
<FormInput
label={m.registries_aws_secret_access_key()}
type="password"
placeholder={isEditMode ? m.registries_token_keep_placeholder() : ''}
- bind:input={$inputs.awsSecretAccessKey}
+ bind:input={inputs.awsSecretAccessKey}
/>
<FormInput
label={m.registries_aws_region()}
type="text"
placeholder={m.registries_aws_region_placeholder()}
- bind:input={$inputs.awsRegion}
+ bind:input={inputs.awsRegion}
/>
{/if}
@@ -178,7 +180,7 @@
label={m.common_description()}
type="text"
placeholder={m.registries_description_placeholder()}
- bind:input={$inputs.description}
+ bind:input={inputs.description}
/>
<FormInput
label={m.registries_repository_names()}
@@ -186,20 +188,20 @@
rows={3}
placeholder={m.registries_repository_names_placeholder()}
description={m.registries_repository_names_description()}
- bind:input={$inputs.repositoryNames}
+ bind:input={inputs.repositoryNames}
/>
<SwitchWithLabel
id="isEnabledSwitch"
label={m.common_enabled()}
description={m.registries_enabled_description()}
- bind:checked={$inputs.enabled.value}
+ bind:checked={inputs.enabled.value}
/>
{#if !isECR}
<SwitchWithLabel
id="insecureSwitch"
label={m.registries_allow_insecure_label()}
description={m.registries_allow_insecure_description()}
- bind:checked={$inputs.insecure.value}
+ bind:checked={inputs.insecure.value}
/>
{/if}
<!-- fallow-ignore-next-line code-duplication -- per-sheet footer wrapper ({#snippet footer} -> shared SheetFooterActions); ResponsiveDialog requires a footer snippet in each sheet -->
diff --git a/frontend/src/lib/components/sheets/create-network-sheet.svelte b/frontend/src/lib/components/sheets/create-network-sheet.svelte
index 385522b96..1f3febdfb 100644
--- a/frontend/src/lib/components/sheets/create-network-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-network-sheet.svelte
@@ -9,7 +9,8 @@
import { Textarea } from '#lib/components/ui/textarea/index.js';
import type { NetworkCreateOptions } from '#lib/types/docker.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { parseKeyValuePairs } from '#lib/utils/form-parsers.js';
import SelectWithLabel from '../form/select-with-label.svelte';
import { m } from '#lib/paraglide/messages.js';
@@ -55,7 +56,8 @@
gateway: ''
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
// Dynamic labels state for the key-value pairs
let labels = $state<{ key: string; value: string }[]>([{ key: '', value: '' }]);
@@ -121,15 +123,15 @@
open = newOpenState;
if (!newOpenState) {
// Reset form data
- $inputs.networkName.value = '';
- $inputs.networkDriver.value = 'bridge';
- $inputs.checkDuplicate.value = true;
- $inputs.internal.value = false;
- $inputs.networkLabels.value = '';
- $inputs.driverOptions.value = '';
- $inputs.enableIpam.value = false;
- $inputs.subnet.value = '';
- $inputs.gateway.value = '';
+ inputs.networkName.value = '';
+ inputs.networkDriver.value = 'bridge';
+ inputs.checkDuplicate.value = true;
+ inputs.internal.value = false;
+ inputs.networkLabels.value = '';
+ inputs.driverOptions.value = '';
+ inputs.enableIpam.value = false;
+ inputs.subnet.value = '';
+ inputs.gateway.value = '';
labels = [{ key: '', value: '' }];
}
}
@@ -152,18 +154,18 @@
type="text"
placeholder={m.network_name_placeholder()}
disabled={isLoading}
- bind:value={$inputs.networkName.value}
- class={$inputs.networkName.error ? 'border-destructive' : ''}
+ bind:value={inputs.networkName.value}
+ class={inputs.networkName.error ? 'border-destructive' : ''}
/>
- {#if $inputs.networkName.error}
- <p class="text-xs text-destructive">{$inputs.networkName.error}</p>
+ {#if inputs.networkName.error}
+ <p class="text-xs text-destructive">{inputs.networkName.error}</p>
{/if}
<p class="text-xs text-muted-foreground">{m.network_name_description()}</p>
</div>
<SelectWithLabel
id="driver-select"
- bind:value={$inputs.networkDriver.value}
+ bind:value={inputs.networkDriver.value}
label={m.network_driver_label()}
description={m.network_driver_description()}
options={drivers}
@@ -173,11 +175,11 @@
<div class="space-y-4">
<div class="flex items-center space-x-4">
<div class="flex items-center space-x-2">
- <Checkbox id="check-duplicate" bind:checked={$inputs.checkDuplicate.value} disabled={isLoading} />
+ <Checkbox id="check-duplicate" bind:checked={inputs.checkDuplicate.value} disabled={isLoading} />
<Label for="check-duplicate" class="text-sm font-normal">{m.network_check_duplicate_label()}</Label>
</div>
<div class="flex items-center space-x-2">
- <Checkbox id="internal" bind:checked={$inputs.internal.value} disabled={isLoading} />
+ <Checkbox id="internal" bind:checked={inputs.internal.value} disabled={isLoading} />
<Label for="internal" class="text-sm font-normal">{m.network_internal_label()}</Label>
</div>
</div>
@@ -190,7 +192,7 @@
<div class="space-y-4">
<div class="space-y-2">
<Label class="text-sm font-medium">{m.labels_key_value_label()}</Label>
- {#each labels as label, index (index)}
+ {#each labels as label, index (label)}
<div class="flex items-center gap-2">
<Input type="text" placeholder="Key" bind:value={label.key} disabled={isLoading} class="flex-1" />
<Input type="text" placeholder="Value" bind:value={label.value} disabled={isLoading} class="flex-1" />
@@ -223,11 +225,11 @@
placeholder={m.network_labels_placeholder()}
disabled={isLoading}
rows={3}
- bind:value={$inputs.networkLabels.value}
- class={$inputs.networkLabels.error ? 'border-destructive' : ''}
+ bind:value={inputs.networkLabels.value}
+ class={inputs.networkLabels.error ? 'border-destructive' : ''}
/>
- {#if $inputs.networkLabels.error}
- <p class="text-xs text-destructive">{$inputs.networkLabels.error}</p>
+ {#if inputs.networkLabels.error}
+ <p class="text-xs text-destructive">{inputs.networkLabels.error}</p>
{/if}
<p class="text-xs text-muted-foreground">{m.network_labels_description()}</p>
</div>
@@ -245,11 +247,11 @@
placeholder={m.network_driver_options_placeholder()}
disabled={isLoading}
rows={3}
- bind:value={$inputs.driverOptions.value}
- class={$inputs.driverOptions.error ? 'border-destructive' : ''}
+ bind:value={inputs.driverOptions.value}
+ class={inputs.driverOptions.error ? 'border-destructive' : ''}
/>
- {#if $inputs.driverOptions.error}
- <p class="text-xs text-destructive">{$inputs.driverOptions.error}</p>
+ {#if inputs.driverOptions.error}
+ <p class="text-xs text-destructive">{inputs.driverOptions.error}</p>
{/if}
<p class="text-xs text-muted-foreground">{m.network_driver_options_description()}</p>
</div>
@@ -261,11 +263,11 @@
<Accordion.Content class="pt-4">
<div class="space-y-4">
<div class="flex items-center space-x-2">
- <Checkbox id="enable-ipam" bind:checked={$inputs.enableIpam.value} disabled={isLoading} />
+ <Checkbox id="enable-ipam" bind:checked={inputs.enableIpam.value} disabled={isLoading} />
<Label for="enable-ipam" class="text-sm font-medium">{m.network_enable_ipam_label()}</Label>
</div>
- {#if $inputs.enableIpam.value}
+ {#if inputs.enableIpam.value}
<div class="space-y-4 border-l-2 border-muted pl-6">
<div class="space-y-2">
<Label for="subnet" class="text-sm font-medium">{m.common_subnet()}</Label>
@@ -274,11 +276,11 @@
type="text"
placeholder={m.network_example_subnet()}
disabled={isLoading}
- bind:value={$inputs.subnet.value}
- class={$inputs.subnet.error ? 'border-destructive' : ''}
+ bind:value={inputs.subnet.value}
+ class={inputs.subnet.error ? 'border-destructive' : ''}
/>
- {#if $inputs.subnet.error}
- <p class="text-xs text-destructive">{$inputs.subnet.error}</p>
+ {#if inputs.subnet.error}
+ <p class="text-xs text-destructive">{inputs.subnet.error}</p>
{/if}
<p class="text-xs text-muted-foreground">{m.network_subnet_description()}</p>
</div>
@@ -290,11 +292,11 @@
type="text"
placeholder={m.network_example_gateway()}
disabled={isLoading}
- bind:value={$inputs.gateway.value}
- class={$inputs.gateway.error ? 'border-destructive' : ''}
+ bind:value={inputs.gateway.value}
+ class={inputs.gateway.error ? 'border-destructive' : ''}
/>
- {#if $inputs.gateway.error}
- <p class="text-xs text-destructive">{$inputs.gateway.error}</p>
+ {#if inputs.gateway.error}
+ <p class="text-xs text-destructive">{inputs.gateway.error}</p>
{/if}
<p class="text-xs text-muted-foreground">{m.network_gateway_description()}</p>
</div>
diff --git a/frontend/src/lib/components/sheets/create-volume-sheet.svelte b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
index bf88ba6d5..24a5a1c4c 100644
--- a/frontend/src/lib/components/sheets/create-volume-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
@@ -5,7 +5,8 @@
import * as Accordion from '#lib/components/ui/accordion/index.js';
import type { VolumeCreateRequest } from '#lib/types/docker.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { parseKeyValuePairs } from '#lib/utils/form-parsers.js';
import SelectWithLabel from '../form/select-with-label.svelte';
import { m } from '#lib/paraglide/messages.js';
@@ -40,7 +41,8 @@
volumeLabels: ''
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
function handleSubmit() {
const data = form.validate();
@@ -62,10 +64,10 @@
function handleOpenChange(newOpenState: boolean) {
open = newOpenState;
if (!newOpenState) {
- $inputs.volumeName.value = '';
- $inputs.volumeDriver.value = 'local';
- $inputs.volumeOptText.value = '';
- $inputs.volumeLabels.value = '';
+ inputs.volumeName.value = '';
+ inputs.volumeDriver.value = 'local';
+ inputs.volumeOptText.value = '';
+ inputs.volumeLabels.value = '';
}
}
</script>
@@ -87,12 +89,12 @@
placeholder={m.volume_name_placeholder()}
description={m.volume_name_description()}
disabled={isLoading}
- bind:input={$inputs.volumeName}
+ bind:input={inputs.volumeName}
/>
<SelectWithLabel
id="driver-select"
- bind:value={$inputs.volumeDriver.value}
+ bind:value={inputs.volumeDriver.value}
label={m.volume_driver_label()}
description={m.volume_driver_description()}
options={drivers}
@@ -111,7 +113,7 @@
description={m.volume_driver_options_description()}
disabled={isLoading}
rows={3}
- bind:input={$inputs.volumeOptText}
+ bind:input={inputs.volumeOptText}
/>
<FormInput
@@ -121,7 +123,7 @@
description={m.volumes_labels_description()}
disabled={isLoading}
rows={3}
- bind:input={$inputs.volumeLabels}
+ bind:input={inputs.volumeLabels}
/>
</div>
</Accordion.Content>
diff --git a/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte b/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte
index 76a548528..5c66a4922 100644
--- a/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte
@@ -10,7 +10,8 @@
import type { CreateFederatedCredential, FederatedCredential, FederatedCredentialMatchType, Role } from '#lib/types/auth.js';
import type { Environment } from '#lib/types/environment.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { plainDateFromInstant, plainDateToInstantString } from '#lib/utils/formatting.js';
import * as m from '#lib/paraglide/messages.js';
import { InfoIcon } from '#lib/icons/index.js';
@@ -74,10 +75,11 @@
expiresAt: plainDateFromInstant(credentialToEdit?.expiresAt)
});
- const { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ const form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
const hasWildcardWarning = $derived.by(() => {
- const value = String($inputs.subjectMatch.value ?? '').trim();
+ const value = String(inputs.subjectMatch.value ?? '').trim();
return shouldWarnSubjectMatchInternal(value);
});
@@ -150,14 +152,14 @@
label={m.common_name()}
type="text"
placeholder={m.federated_credential_name_placeholder()}
- bind:input={$inputs.name}
+ bind:input={inputs.name}
disabled={isLoading}
/>
<FormInput
label={m.common_description()}
type="text"
placeholder={m.optional_description_placeholder()}
- bind:input={$inputs.description}
+ bind:input={inputs.description}
disabled={isLoading}
/>
<FormInput
@@ -165,7 +167,7 @@
type="text"
placeholder={m.federated_credential_issuer_placeholder()}
description={m.federated_credential_issuer_description()}
- bind:input={$inputs.issuerUrl}
+ bind:input={inputs.issuerUrl}
disabled={isLoading}
/>
<FormInput
@@ -174,7 +176,7 @@
rows={3}
placeholder={m.federated_credential_audiences_placeholder()}
description={m.federated_credential_audiences_description()}
- bind:input={$inputs.audience}
+ bind:input={inputs.audience}
disabled={isLoading}
/>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
@@ -182,14 +184,14 @@
label={m.federated_credential_subject_claim_label()}
type="text"
placeholder={m.federated_credential_subject_claim_placeholder()}
- bind:input={$inputs.subjectClaim}
+ bind:input={inputs.subjectClaim}
disabled={isLoading}
/>
<div class="space-y-2">
<Label for="federated-match-type" class="mb-0">{m.federated_credential_match_type_label()}</Label>
- <Select.Root type="single" bind:value={$inputs.matchType.value} disabled={isLoading}>
+ <Select.Root type="single" bind:value={inputs.matchType.value} disabled={isLoading}>
<Select.Trigger id="federated-match-type" class="w-full">
- <span>{matchTypeLabel($inputs.matchType.value)}</span>
+ <span>{matchTypeLabel(inputs.matchType.value)}</span>
</Select.Trigger>
<Select.Content>
{#each MATCH_TYPES as option (option.value)}
@@ -206,7 +208,7 @@
type="text"
placeholder={m.federated_credential_subject_match_placeholder()}
description={m.federated_credential_subject_match_description()}
- bind:input={$inputs.subjectMatch}
+ bind:input={inputs.subjectMatch}
disabled={isLoading}
/>
{#if hasWildcardWarning}
@@ -224,9 +226,9 @@
scopeLabel={m.common_scope()}
{roles}
{envOptions}
- bind:roleValue={$inputs.roleId.value}
- bind:environmentValue={$inputs.environmentId.value}
- roleError={$inputs.roleId.error}
+ bind:roleValue={inputs.roleId.value}
+ bind:environmentValue={inputs.environmentId.value}
+ roleError={inputs.roleId.error}
{roleSelectedLabel}
{envSelectedLabel}
disabled={isLoading}
@@ -237,19 +239,19 @@
label={m.federated_credential_ttl_label()}
type="number"
description={m.federated_credential_ttl_description()}
- bind:input={$inputs.tokenTtlSeconds}
+ bind:input={inputs.tokenTtlSeconds}
disabled={isLoading}
/>
<FormInput
label={m.federated_credential_expires_at_label()}
type="date"
description={m.federated_credential_expires_at_description()}
- bind:input={$inputs.expiresAt}
+ bind:input={inputs.expiresAt}
disabled={isLoading}
/>
</div>
<div class="flex items-center space-x-2">
- <Switch id="federated-enabled" bind:checked={$inputs.enabled.value} disabled={isLoading} />
+ <Switch id="federated-enabled" bind:checked={inputs.enabled.value} disabled={isLoading} />
<div class="grid gap-1.5 leading-none">
<Label for="federated-enabled" class="mb-0 text-sm leading-none font-medium">
{m.common_enabled()}
diff --git a/frontend/src/lib/components/sheets/git-repository-sheet.svelte b/frontend/src/lib/components/sheets/git-repository-sheet.svelte
index 77d0c3ce8..d84c975a0 100644
--- a/frontend/src/lib/components/sheets/git-repository-sheet.svelte
+++ b/frontend/src/lib/components/sheets/git-repository-sheet.svelte
@@ -8,7 +8,8 @@
import { Label } from '#lib/components/ui/label/index.js';
import type { GitRepository, GitRepositoryCreateDto, GitRepositoryUpdateDto } from '#lib/types/automation.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
type GitRepositoryFormProps = {
@@ -55,13 +56,14 @@
enabled: repositoryToEdit?.enabled ?? true
}));
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, formData);
+ const form = createForm<typeof formSchema>(formSchema, formData);
+ let inputs = $derived(form.inputs);
let hasToken = $derived(!!repositoryToEdit?.hasToken);
let hasSshKey = $derived(!!repositoryToEdit?.hasSshKey);
- let urlChanged = $derived(isEditMode && $inputs.url.value.trim() !== repositoryToEdit?.url);
- let tokenNeedsAttention = $derived(urlChanged && hasToken && !clearToken && !$inputs.token?.value?.trim());
- let sshKeyNeedsAttention = $derived(urlChanged && hasSshKey && !clearSshKey && !$inputs.sshKey?.value?.trim());
+ let urlChanged = $derived(isEditMode && inputs.url.value.trim() !== repositoryToEdit?.url);
+ let tokenNeedsAttention = $derived(urlChanged && hasToken && !clearToken && !inputs.token?.value?.trim());
+ let sshKeyNeedsAttention = $derived(urlChanged && hasSshKey && !clearSshKey && !inputs.sshKey?.value?.trim());
let selectedAuthType = $state<{ value: string; label: string }>({
value: formData.authType,
@@ -96,14 +98,14 @@
}
function clearCredentialErrors() {
- if ($inputs.token) $inputs.token.error = null;
- if ($inputs.sshKey) $inputs.sshKey.error = null;
+ if (inputs.token) inputs.token.error = null;
+ if (inputs.sshKey) inputs.sshKey.error = null;
}
function handleSubmit() {
const data = form.validate();
- if (tokenNeedsAttention && $inputs.token) $inputs.token.error = m.git_repository_token_url_change();
- if (sshKeyNeedsAttention && $inputs.sshKey) $inputs.sshKey.error = m.git_repository_ssh_key_url_change();
+ if (tokenNeedsAttention && inputs.token) inputs.token.error = m.git_repository_token_url_change();
+ if (sshKeyNeedsAttention && inputs.sshKey) inputs.sshKey.error = m.git_repository_ssh_key_url_change();
if (!data || tokenNeedsAttention || sshKeyNeedsAttention) return;
const payload: GitRepositoryCreateDto | GitRepositoryUpdateDto = {
@@ -145,19 +147,14 @@
>
{#snippet children()}
<form id="git-repository-form" onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-6">
- <FormInput
- label={m.git_repository_name()}
- type="text"
- placeholder={m.common_name_placeholder()}
- bind:input={$inputs.name}
- />
+ <FormInput label={m.git_repository_name()} type="text" placeholder={m.common_name_placeholder()} bind:input={inputs.name} />
<FormInput
label={m.git_repository_url()}
type="text"
placeholder={m.git_repository_url_placeholder()}
oninput={clearCredentialErrors}
- bind:input={$inputs.url}
+ bind:input={inputs.url}
/>
<div class="space-y-2">
@@ -168,7 +165,7 @@
onValueChange={(v) => {
if (v === 'none' || v === 'http' || v === 'ssh') {
selectedAuthType = { value: v, label: getAuthTypeLabel(v) };
- $inputs.authType.value = v;
+ inputs.authType.value = v;
}
}}
>
@@ -184,7 +181,7 @@
</div>
{#if selectedAuthType.value === 'http'}
- <FormInput label={m.common_username()} type="text" bind:input={$inputs.username} />
+ <FormInput label={m.common_username()} type="text" bind:input={inputs.username} />
{/if}
{#if selectedAuthType.value === 'http' || hasToken}
<FormInput
@@ -198,7 +195,7 @@
warningText={tokenNeedsAttention ? m.git_repository_token_url_change() : undefined}
disabled={clearToken}
oninput={clearCredentialErrors}
- bind:input={$inputs.token}
+ bind:input={inputs.token}
/>
{#if hasToken}
<SwitchWithLabel
@@ -218,7 +215,7 @@
disabled={clearSshKey}
rows={6}
oninput={clearCredentialErrors}
- bind:input={$inputs.sshKey}
+ bind:input={inputs.sshKey}
/>
{#if hasSshKey}
<SwitchWithLabel
@@ -238,7 +235,7 @@
onValueChange={(v) => {
if (v === 'strict' || v === 'accept_new' || v === 'skip') {
selectedSshHostKeyVerification = { value: v, label: getSshHostKeyVerificationLabel(v) };
- $inputs.sshHostKeyVerification.value = v;
+ inputs.sshHostKeyVerification.value = v;
}
}}
>
@@ -274,14 +271,14 @@
label={m.common_description()}
type="text"
placeholder={m.common_description_placeholder()}
- bind:input={$inputs.description}
+ bind:input={inputs.description}
/>
<SwitchWithLabel
id="isEnabledSwitch"
label={m.common_enabled()}
description={m.common_enabled_description()}
- bind:checked={$inputs.enabled.value}
+ bind:checked={inputs.enabled.value}
/>
</form>
{/snippet}
diff --git a/frontend/src/lib/components/sheets/image-pull-sheet.svelte b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
index 8fd48c0e2..740e9a3ff 100644
--- a/frontend/src/lib/components/sheets/image-pull-sheet.svelte
+++ b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
@@ -3,7 +3,8 @@
import SheetFooterActions from '#lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '#lib/components/form/form-input.svelte';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { toast } from 'svelte-sonner';
import { m } from '#lib/paraglide/messages.js';
import { imageService } from '#lib/services/image-service.js';
@@ -25,7 +26,8 @@
tag: 'latest'
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
let isPulling = $state(false);
@@ -71,8 +73,8 @@
open = newOpenState;
if (!newOpenState || newOpenState) {
- $inputs.imageRef.value = '';
- $inputs.tag.value = 'latest';
+ inputs.imageRef.value = '';
+ inputs.tag.value = 'latest';
}
}
</script>
@@ -92,14 +94,14 @@
type="text"
placeholder={m.images_image_name_placeholder()}
description={m.images_image_name_description()}
- bind:input={$inputs.imageRef}
+ bind:input={inputs.imageRef}
/>
<FormInput
label={m.tag()}
type="text"
placeholder={m.images_tag_latest()}
description={m.images_tag_description()}
- bind:input={$inputs.tag}
+ bind:input={inputs.tag}
/>
</form>
{/snippet}
diff --git a/frontend/src/lib/components/sheets/new-environment-sheet.svelte b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
index b53594e91..b2c100dd4 100644
--- a/frontend/src/lib/components/sheets/new-environment-sheet.svelte
+++ b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
@@ -13,7 +13,8 @@
import AgentCommandBlock from '#lib/components/agent-command-block.svelte';
import type { CreateEnvironmentDTO, DeploymentSnippetFile } from '#lib/types/environment.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
import { environmentManagementService } from '#lib/services/env-mgmt-service.js';
import { queryKeys } from '#lib/query/query-keys.js';
@@ -116,14 +117,16 @@
name: z.string().min(1, m.environments_name_required()).max(25, m.environments_name_too_long())
});
- const { inputs: directInputs, ...directForm } = createForm<typeof directFormSchema>(directFormSchema, {
+ const directForm = createForm<typeof directFormSchema>(directFormSchema, {
name: '',
apiUrl: ''
});
+ let directInputs = $derived(directForm.inputs);
- const { inputs: edgeInputs, ...edgeForm } = createForm<typeof edgeFormSchema>(edgeFormSchema, {
+ const edgeForm = createForm<typeof edgeFormSchema>(edgeFormSchema, {
name: ''
});
+ let edgeInputs = $derived(edgeForm.inputs);
// Reset on open/close
@@ -310,7 +313,7 @@
<FormInput
label={m.common_name()}
placeholder={m.environments_production_docker()}
- bind:input={$directInputs.name}
+ bind:input={directInputs.name}
/>
<UrlInput
@@ -318,11 +321,11 @@
label={m.environments_agent_address()}
placeholder={m.environments_agent_address_placeholder()}
description={m.environments_agent_address_description()}
- bind:value={$directInputs.apiUrl.value}
+ bind:value={directInputs.apiUrl.value}
bind:protocol={newAgentUrlProtocol}
disabled={isSubmittingNewAgent}
required
- error={$directInputs.apiUrl.error ?? undefined}
+ error={directInputs.apiUrl.error ?? undefined}
/>
<ArcaneButton
@@ -341,7 +344,7 @@
{m.environments_edge_desc()}
</p>
<form onsubmit={preventDefault(handleEdgeSubmit)} class="space-y-4">
- <FormInput label={m.common_name()} placeholder={m.env_remote_docker_host()} bind:input={$edgeInputs.name} />
+ <FormInput label={m.common_name()} placeholder={m.env_remote_docker_host()} bind:input={edgeInputs.name} />
<LabeledSwitch
id="new-edge-agent-mtls"
diff --git a/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte b/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte
index 6c15f9936..52d9b78ef 100644
--- a/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte
@@ -6,7 +6,8 @@
import type { OidcRoleMapping, Role } from '#lib/types/auth.js';
import type { Environment } from '#lib/types/environment.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
import {
buildGlobalEnvironmentOptions,
@@ -42,7 +43,8 @@
environmentId: mappingToEdit?.environmentId ?? GLOBAL_ENVIRONMENT_OPTION_ID
});
- const { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ const form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
function handleSubmit() {
const data = form.validate();
@@ -74,7 +76,7 @@
type="text"
placeholder={m.oidc_mappings_claim_placeholder()}
disabled={isLoading}
- bind:input={$inputs.claimValue}
+ bind:input={inputs.claimValue}
/>
<RoleScopeSelects
@@ -83,9 +85,9 @@
scopeLabel={m.oidc_mappings_scope_label()}
{roles}
{envOptions}
- bind:roleValue={$inputs.roleId.value}
- bind:environmentValue={$inputs.environmentId.value}
- roleError={$inputs.roleId.error}
+ bind:roleValue={inputs.roleId.value}
+ bind:environmentValue={inputs.environmentId.value}
+ roleError={inputs.roleId.error}
roleSelectedLabel={selectedLabel.role}
envSelectedLabel={selectedLabel.environment}
disabled={isLoading}
diff --git a/frontend/src/lib/components/sheets/user-form-sheet.svelte b/frontend/src/lib/components/sheets/user-form-sheet.svelte
index 3dd4d1b38..7af8dedc4 100644
--- a/frontend/src/lib/components/sheets/user-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/user-form-sheet.svelte
@@ -8,7 +8,8 @@
import type { Role } from '#lib/types/auth.js';
import type { Environment } from '#lib/types/environment.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { isValidUserEmail } from '#lib/utils/formatting.js';
import { m } from '#lib/paraglide/messages.js';
import IfPermitted from '#lib/components/if-permitted.svelte';
@@ -95,7 +96,8 @@
roleAssignments: availableRoleAssignments
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
async function submitUser(data: UserFormSubmission) {
if (await onSubmit(data)) {
@@ -106,7 +108,7 @@
async function handleSubmit() {
// createForm trims strings for ordinary text fields. Passwords are opaque,
// so preserve exactly what the user entered after validating the raw value.
- const password = $inputs.password.value;
+ const password = inputs.password.value;
const data = form.validate();
if (!data) return;
@@ -169,7 +171,7 @@
type="text"
description={m.users_username_description()}
disabled={!canEditUsername || isOidcUser}
- bind:input={$inputs.username}
+ bind:input={inputs.username}
/>
<FormInput
label={isEditMode ? m.common_password() : m.users_password_required_label()}
@@ -185,7 +187,7 @@
? m.users_password_description_edit()
: m.users_password_description_create()}
disabled={isOidcUser}
- bind:input={$inputs.password}
+ bind:input={inputs.password}
/>
<FormInput
label={m.common_display_name()}
@@ -193,7 +195,7 @@
placeholder={m.users_display_name_placeholder()}
description={m.users_display_name_description()}
disabled={isOidcUser}
- bind:input={$inputs.displayName}
+ bind:input={inputs.displayName}
/>
<FormInput
label={m.common_email()}
@@ -202,7 +204,7 @@
description={m.users_email_description()}
autocomplete="email"
disabled={isOidcUser}
- bind:input={$inputs.email}
+ bind:input={inputs.email}
/>
<IfPermitted adminOnly>
<div>
@@ -225,9 +227,9 @@
</div>
</div>
{/if}
- <RoleAssignmentsEditor bind:assignments={$inputs.roleAssignments.value} {roles} {environments} />
- {#if $inputs.roleAssignments.error}
- <p class="mt-1 text-xs text-destructive">{$inputs.roleAssignments.error}</p>
+ <RoleAssignmentsEditor bind:assignments={inputs.roleAssignments.value} {roles} {environments} />
+ {#if inputs.roleAssignments.error}
+ <p class="mt-1 text-xs text-destructive">{inputs.roleAssignments.error}</p>
{/if}
</div>
</IfPermitted>
diff --git a/frontend/src/lib/components/sheets/variable-form-sheet.svelte b/frontend/src/lib/components/sheets/variable-form-sheet.svelte
index 3a3d5b10e..ab4113447 100644
--- a/frontend/src/lib/components/sheets/variable-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/variable-form-sheet.svelte
@@ -13,7 +13,8 @@
import type { GlobalVariable, GlobalVariableCreateDto, GlobalVariableUpdateDto } from '#lib/types/variable.js';
import { parseEnvText, normalizeVariableKeyInput } from '#lib/utils/env-file.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import * as m from '#lib/paraglide/messages.js';
type VariableFormPayload =
@@ -97,7 +98,8 @@
return { key: variableToEdit?.key ?? '', value, isSecret: variableToEdit?.isSecret ?? false };
});
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, formData);
+ const form = createForm<typeof formSchema>(formSchema, formData);
+ let inputs = $derived(form.inputs);
const parsed = $derived(parseEnvText(bulkText));
@@ -211,7 +213,7 @@
<p class="px-3 py-4 text-sm text-muted-foreground">{m.paste_env_empty_preview()}</p>
{:else}
<ul class="max-h-48 divide-y divide-border/50 overflow-y-auto">
- {#each parsed.entries as entry, index (index)}
+ {#each parsed.entries as entry (entry)}
<li class="flex items-center gap-3 px-3 py-1.5 text-sm">
<span class="font-mono font-medium">{entry.key}</span>
<span class="min-w-0 flex-1 truncate text-right font-mono text-muted-foreground">
@@ -254,11 +256,11 @@
type="text"
class="mt-2 font-mono"
placeholder={m.key_placeholder()}
- bind:value={$inputs.key.value}
- oninput={(e) => normalizeVariableKeyInput(e, (value) => ($inputs.key.value = value))}
+ bind:value={inputs.key.value}
+ oninput={(e) => normalizeVariableKeyInput(e, (value) => (inputs.key.value = value))}
/>
- {#if $inputs.key.error}
- <p class="mt-1 text-sm text-destructive">{$inputs.key.error}</p>
+ {#if inputs.key.error}
+ <p class="mt-1 text-sm text-destructive">{inputs.key.error}</p>
{/if}
</div>
@@ -269,10 +271,10 @@
rows={3}
class="mt-2 font-mono"
placeholder={variableToEdit?.isSecret ? m.secret_value_placeholder() : m.value_placeholder()}
- bind:value={$inputs.value.value}
+ bind:value={inputs.value.value}
/>
- {#if $inputs.value.error}
- <p class="mt-1 text-sm text-destructive">{$inputs.value.error}</p>
+ {#if inputs.value.error}
+ <p class="mt-1 text-sm text-destructive">{inputs.value.error}</p>
{/if}
</div>
@@ -280,7 +282,7 @@
id="variable-secret"
label={m.secret()}
description={m.secret_description()}
- bind:checked={$inputs.isSecret.value}
+ bind:checked={inputs.isSecret.value}
/>
{@render scopeSelector()}
diff --git a/frontend/src/lib/components/sheets/webhook-form-sheet.svelte b/frontend/src/lib/components/sheets/webhook-form-sheet.svelte
index f04197b32..4f9b8f231 100644
--- a/frontend/src/lib/components/sheets/webhook-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/webhook-form-sheet.svelte
@@ -11,7 +11,8 @@
import { gitOpsSyncService } from '#lib/services/gitops-sync-service.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import * as m from '#lib/paraglide/messages.js';
type WebhookFormProps = {
@@ -93,7 +94,8 @@
});
let formData = $derived({ name: '' });
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
async function loadTargetOptions(type: WebhookTargetType) {
if (type === 'updater') {
@@ -187,7 +189,7 @@
type="text"
placeholder={m.webhook_name_placeholder()}
description={m.webhook_name_description()}
- bind:input={$inputs.name}
+ bind:input={inputs.name}
/>
<SelectWithLabel
diff --git a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
index 6cfc78ee3..8b8121a55 100644
--- a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
@@ -2,7 +2,7 @@
import * as Sidebar from '#lib/components/ui/sidebar/index.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { EnvironmentsIcon, RemoteEnvironmentIcon, EdgeConnectionIcon, ArrowsUpDownIcon } from '#lib/icons/index.js';
type Props = {
@@ -14,7 +14,7 @@
function getConnectionString(): string {
if (!environmentStore.selected) return '';
if (environmentStore.selected.id === '0') {
- return $settingsStore.dockerHost || 'unix:///var/run/docker.sock';
+ return settingsStore.current?.dockerHost || 'unix:///var/run/docker.sock';
} else if (environmentStore.selected.isEdge) {
return 'Edge connection';
} else {
diff --git a/frontend/src/lib/components/sidebar/sidebar-item-tooltip-content.svelte b/frontend/src/lib/components/sidebar/sidebar-item-tooltip-content.svelte
index d945783ab..5b322d9da 100644
--- a/frontend/src/lib/components/sidebar/sidebar-item-tooltip-content.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-item-tooltip-content.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import * as Kbd from '#lib/components/ui/kbd/index.js';
import { formatShortcutKeys, type ShortcutKey } from '#lib/utils/navigation.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
let {
title,
@@ -13,7 +13,7 @@
includeTitle?: boolean;
} = $props();
- const showShortcut = $derived($userStore?.preferences?.keyboardShortcutsEnabled ?? true);
+ const showShortcut = $derived(userStore.current?.preferences?.keyboardShortcutsEnabled ?? true);
</script>
<div class="flex flex-wrap items-center gap-2">
@@ -23,7 +23,8 @@
{#if showShortcut && shortcut?.length}
{@const displayKeys = formatShortcutKeys(shortcut)}
<Kbd.Group class="inline-flex items-center gap-1 text-muted-foreground">
- {#each displayKeys as key, index (index)}
+ <!-- Shortcut sequences may repeat keys; these keycaps have no local state. -->
+ {#each displayKeys as key, index}
<Kbd.Root
class="text-popover-foreground! in-data-[slot=tooltip-content]:text-popover-foreground! dark:in-data-[slot=tooltip-content]:text-popover-foreground!"
>
diff --git a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
index dcf962bcd..61243a6b6 100644
--- a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
@@ -8,7 +8,7 @@
import { ArrowRightIcon } from '#lib/icons/index.js';
import SidebarCollapsibleItem from './sidebar-collapsible-item.svelte';
import SidebarItemTooltipContent from './sidebar-item-tooltip-content.svelte';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
let {
items,
@@ -72,7 +72,7 @@
const collapsed = $derived(sidebar.state === 'collapsed');
const includeTitleInTooltip = $derived(collapsed && !(sidebar.hoverExpansionEnabled && sidebar.isHovered));
- const shortcutsEnabled = $derived($userStore?.preferences?.keyboardShortcutsEnabled ?? true);
+ const shortcutsEnabled = $derived(userStore.current?.preferences?.keyboardShortcutsEnabled ?? true);
</script>
{#snippet itemAnchor(entry: { title: string; url: string; icon?: typeof ArrowRightIcon }, props: Record<string, unknown>)}
diff --git a/frontend/src/lib/components/sidebar/sidebar-logo.svelte b/frontend/src/lib/components/sidebar/sidebar-logo.svelte
index 93647160a..280abf871 100644
--- a/frontend/src/lib/components/sidebar/sidebar-logo.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-logo.svelte
@@ -2,13 +2,13 @@
import { cn } from '#lib/utils.js';
import { m } from '#lib/paraglide/messages.js';
import { getApplicationLogo } from '#lib/utils/docker.js';
- import { accentColorPreviewStore } from '#lib/utils/theme.js';
- import userStore from '#lib/stores/user-store.js';
+ import { accentColorPreview } from '#lib/utils/theme.svelte.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
let { isCollapsed }: { isCollapsed: boolean } = $props();
- const accentColor = $derived($accentColorPreviewStore);
- const animationsEnabled = $derived($userStore?.preferences?.animationsEnabled ?? true);
+ const accentColor = $derived(accentColorPreview.current);
+ const animationsEnabled = $derived(userStore.current?.preferences?.animationsEnabled ?? true);
const logoUrl = $derived(getApplicationLogo(!isCollapsed, accentColor, accentColor, { animated: animationsEnabled }));
</script>
diff --git a/frontend/src/lib/components/sidebar/sidebar-user.svelte b/frontend/src/lib/components/sidebar/sidebar-user.svelte
index c48a23e93..303903f9c 100644
--- a/frontend/src/lib/components/sidebar/sidebar-user.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-user.svelte
@@ -5,7 +5,7 @@
import * as Sidebar from '#lib/components/ui/sidebar/index.js';
import { useSidebar } from '#lib/components/ui/sidebar/index.js';
import type { User } from '#lib/types/auth.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { goto } from '$app/navigation';
import { ArrowsUpDownIcon, LogoutIcon, SettingsIcon, UserIcon } from '#lib/icons/index.js';
@@ -46,7 +46,7 @@
<Avatar.Root class="size-8 rounded-lg">
{#if user?.avatarUrl}
<Avatar.Image src={`${user.avatarUrl}?t=${user.updatedAt}`} alt={displayLabel} />
- {:else if $settingsStore.enableGravatar}
+ {:else if settingsStore.current?.enableGravatar}
{#await getGravatarUrl(user?.email)}
<!-- Loading gravatar, show fallback -->
{:then url}
@@ -93,7 +93,7 @@
<Avatar.Root class="size-8 shrink-0 rounded-lg">
{#if user?.avatarUrl}
<Avatar.Image src={`${user.avatarUrl}?t=${user.updatedAt}`} alt={displayLabel} />
- {:else if $settingsStore.enableGravatar}
+ {:else if settingsStore.current?.enableGravatar}
{#await getGravatarUrl(user?.email)}
<!-- Loading gravatar, show fallback -->
{:then url}
diff --git a/frontend/src/lib/components/sidebar/sidebar.svelte b/frontend/src/lib/components/sidebar/sidebar.svelte
index 581fc7b26..8ea109e78 100644
--- a/frontend/src/lib/components/sidebar/sidebar.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar.svelte
@@ -21,12 +21,11 @@
import SidebarUpdatebanner from './sidebar-updatebanner.svelte';
import SidebarPinButton from './sidebar-pin-button.svelte';
import ActivityCenterTrigger from '#lib/components/activity/activity-center-trigger.svelte';
- import userStore from '#lib/stores/user-store.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import VersionInfoDialog from '#lib/components/dialogs/version-info-dialog.svelte';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import { fromStore } from 'svelte/store';
let {
ref = $bindable(null),
@@ -44,12 +43,12 @@
permissionsManifest?: PermissionsManifest | null;
} = $props();
- const autoLogin = fromStore(settingsStore.autoLoginEnabled);
+ const autoLogin = settingsStore.autoLoginEnabled;
const autoLoginEnabled = $derived(autoLogin.current);
const sidebar = useSidebar();
- const storeUser = fromStore(userStore);
+ const storeUser = userStore;
let showVersionDialog = $state(false);
const effectiveUser = $derived(storeUser.current ?? user);
diff --git a/frontend/src/lib/components/tab-bar/tab-bar.svelte b/frontend/src/lib/components/tab-bar/tab-bar.svelte
index 12813335f..17388130a 100644
--- a/frontend/src/lib/components/tab-bar/tab-bar.svelte
+++ b/frontend/src/lib/components/tab-bar/tab-bar.svelte
@@ -14,7 +14,7 @@
</script>
<Tabs.List class={cn('scrollbar-hide inline-flex max-w-full justify-start gap-1 overflow-x-auto', className)}>
- {#each items as item}
+ {#each items as item (item.value)}
{@const IconComponent = item.icon}
<Tabs.Trigger
value={item.value}
diff --git a/frontend/src/lib/components/terminal/terminal.svelte b/frontend/src/lib/components/terminal/terminal.svelte
index a4e224160..6fe5fcabb 100644
--- a/frontend/src/lib/components/terminal/terminal.svelte
+++ b/frontend/src/lib/components/terminal/terminal.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { onMount } from 'svelte';
+ import { untrack } from 'svelte';
import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit';
import '@xterm/xterm/css/xterm.css';
@@ -18,14 +18,14 @@
onDisconnected?: () => void;
} = $props();
- let container: HTMLDivElement;
+ let container: HTMLDivElement | null = null;
let terminal: Terminal | null = null;
let fitAddon: FitAddon | null = null;
let ws: WebSocket | null = null;
let isReconnecting = false;
let openedAt = 0;
let resizeObserver: ResizeObserver | null = null;
- let isReady = $state(false);
+ let fitFrame = 0;
const darkTheme = {
background: '#09090b',
@@ -75,8 +75,8 @@
brightWhite: '#ffffff'
};
- function initializeTerminal() {
- if (!container) return;
+ function initializeTerminal(node: HTMLDivElement) {
+ container = node;
if (terminal) {
terminal.dispose();
@@ -92,10 +92,10 @@
fitAddon = new FitAddon();
terminal.loadAddon(fitAddon);
- terminal.open(container);
+ terminal.open(node);
- requestAnimationFrame(() => {
- if (fitAddon && container.offsetParent !== null) {
+ fitFrame = requestAnimationFrame(() => {
+ if (fitAddon && node.offsetParent !== null) {
fitAddon.fit();
}
});
@@ -109,12 +109,13 @@
resizeObserver = new ResizeObserver(() => {
handleResize();
});
- resizeObserver.observe(container);
+ resizeObserver.observe(node);
}
- function connectWebSocket() {
+ function connectWebSocket(url: string) {
if (ws) {
isReconnecting = true;
+ ws.onopen = null;
ws.onclose = null;
ws.onerror = null;
ws.onmessage = null;
@@ -123,7 +124,7 @@
}
isReconnecting = false;
- ws = new WebSocket(websocketUrl);
+ ws = new WebSocket(url);
ws.binaryType = 'arraybuffer';
ws.onopen = () => {
@@ -175,35 +176,46 @@
}
}
- onMount(() => {
- initializeTerminal();
- window.addEventListener('resize', handleResize);
- isReady = true;
+ function attachTerminal(node: HTMLDivElement) {
+ untrack(() => initializeTerminal(node));
+
+ $effect(() => {
+ if (websocketUrl) {
+ terminal?.clear();
+ connectWebSocket(websocketUrl);
+ }
+ });
+
+ $effect(() => {
+ if (terminal && mode.current) {
+ terminal.options.theme = mode.current === 'dark' ? darkTheme : lightTheme;
+ }
+ });
return () => {
- window.removeEventListener('resize', handleResize);
+ cancelAnimationFrame(fitFrame);
resizeObserver?.disconnect();
+ resizeObserver = null;
isReconnecting = true;
- ws?.close();
+ if (ws) {
+ ws.onopen = null;
+ ws.onclose = null;
+ ws.onerror = null;
+ ws.onmessage = null;
+ ws.close();
+ ws = null;
+ }
terminal?.dispose();
+ terminal = null;
+ fitAddon = null;
+ container = null;
};
- });
-
- $effect(() => {
- if (isReady && websocketUrl && terminal) {
- terminal.clear();
- connectWebSocket();
- }
- });
-
- $effect(() => {
- if (terminal && mode.current) {
- terminal.options.theme = mode.current === 'dark' ? darkTheme : lightTheme;
- }
- });
+ }
</script>
-<div bind:this={container} class="terminal-container h-full w-full" style="height: {height}"></div>
+<svelte:window onresize={handleResize} />
+
+<div {@attach attachTerminal} class="terminal-container h-full w-full" style="height: {height}"></div>
<style>
:global(.terminal-container .xterm) {
diff --git a/frontend/src/lib/components/theme-mode/theme-mode-selector.svelte b/frontend/src/lib/components/theme-mode/theme-mode-selector.svelte
index 9deeffbb5..7e7b85a00 100644
--- a/frontend/src/lib/components/theme-mode/theme-mode-selector.svelte
+++ b/frontend/src/lib/components/theme-mode/theme-mode-selector.svelte
@@ -6,7 +6,7 @@
import { SunIcon, MoonIcon, MonitorIcon } from '#lib/icons/index.js';
import { cn } from '#lib/utils.js';
import { userService } from '#lib/services/user-service.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
type Props = {
disabled?: boolean;
@@ -27,7 +27,7 @@
// choice follows the user to their other devices.
async function selectMode(value: 'light' | 'dark' | 'system') {
setMode(value);
- if (!$userStore) return;
+ if (!userStore.current) return;
const operationResult1 = await tryCatch(
(async () => {
diff --git a/frontend/src/lib/components/time-format-picker.svelte b/frontend/src/lib/components/time-format-picker.svelte
index b3fdafbf6..59eb9fae7 100644
--- a/frontend/src/lib/components/time-format-picker.svelte
+++ b/frontend/src/lib/components/time-format-picker.svelte
@@ -5,7 +5,7 @@
import { queryKeys } from '#lib/query/query-keys.js';
import { userService } from '#lib/services/user-service.js';
import { timeFormatStore } from '#lib/stores/time-format.store.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import type { TimeFormat } from '#lib/types/auth.js';
let {
diff --git a/frontend/src/lib/components/ui/carousel/carousel-content.svelte b/frontend/src/lib/components/ui/carousel/carousel-content.svelte
index 5cb7df2e8..891e006f5 100644
--- a/frontend/src/lib/components/ui/carousel/carousel-content.svelte
+++ b/frontend/src/lib/components/ui/carousel/carousel-content.svelte
@@ -1,7 +1,8 @@
<script lang="ts">
+ import { fromAction } from 'svelte/attachments';
import emblaCarouselSvelte from 'embla-carousel-svelte';
import type { HTMLAttributes } from 'svelte/elements';
- import { getEmblaContext } from './context.js';
+ import { getEmblaContext, type EmblaCarouselConfig } from './context.js';
import { cn, type WithElementRef } from '#lib/utils.js';
let {
@@ -11,13 +12,13 @@
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
- const emblaCtx = getEmblaContext('<Carousel.Content/>');
+ const emblaCtx = getEmblaContext();
</script>
<div
data-slot="carousel-content"
class="overflow-hidden"
- use:emblaCarouselSvelte={{
+ {@attach fromAction(emblaCarouselSvelte, (): EmblaCarouselConfig => ({
options: {
container: '[data-embla-container]',
slides: '[data-embla-slide]',
@@ -25,8 +26,8 @@
axis: emblaCtx.orientation === 'horizontal' ? 'x' : 'y'
},
plugins: emblaCtx.plugins
- }}
- onemblaInit={emblaCtx.onInit}
+ }))}
+ {...{ onemblaInit: emblaCtx.onInit }}
>
<div
bind:this={ref}
diff --git a/frontend/src/lib/components/ui/carousel/carousel-control.svelte b/frontend/src/lib/components/ui/carousel/carousel-control.svelte
index ebe13ed2e..65d024a62 100644
--- a/frontend/src/lib/components/ui/carousel/carousel-control.svelte
+++ b/frontend/src/lib/components/ui/carousel/carousel-control.svelte
@@ -20,8 +20,7 @@
label: string;
} = $props();
- // svelte-ignore state_referenced_locally -- direction is fixed per wrapper component.
- const emblaCtx = getEmblaContext(direction === 'next' ? '<Carousel.Next/>' : '<Carousel.Previous/>');
+ const emblaCtx = getEmblaContext();
const isNext = $derived(direction === 'next');
const canScroll = $derived(isNext ? emblaCtx.canScrollNext : emblaCtx.canScrollPrev);
const positionClass = $derived(
diff --git a/frontend/src/lib/components/ui/carousel/carousel-item.svelte b/frontend/src/lib/components/ui/carousel/carousel-item.svelte
index 77bd91b02..696f22cfd 100644
--- a/frontend/src/lib/components/ui/carousel/carousel-item.svelte
+++ b/frontend/src/lib/components/ui/carousel/carousel-item.svelte
@@ -10,7 +10,7 @@
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
- const emblaCtx = getEmblaContext('<Carousel.Item/>');
+ const emblaCtx = getEmblaContext();
</script>
<div
diff --git a/frontend/src/lib/components/ui/carousel/carousel.svelte b/frontend/src/lib/components/ui/carousel/carousel.svelte
index d7510efb8..86585ebca 100644
--- a/frontend/src/lib/components/ui/carousel/carousel.svelte
+++ b/frontend/src/lib/components/ui/carousel/carousel.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { type CarouselAPI, type CarouselProps, type EmblaContext, setEmblaContext } from './context.js';
+ import { type CarouselAPI, type CarouselProps, setEmblaContext } from './context.js';
import { onDestroy } from 'svelte';
import { cn, type WithElementRef } from '#lib/utils.js';
@@ -7,49 +7,68 @@
ref = $bindable(null),
opts = {},
plugins = [],
- setApi = () => {},
+ setApi,
orientation = 'horizontal',
class: className,
children,
...restProps
}: WithElementRef<CarouselProps> = $props();
- // svelte-ignore state_referenced_locally
- let carouselState = $state<EmblaContext>({
- api: undefined,
+ let api = $state.raw<CarouselAPI>();
+ let canScrollNext = $state(false);
+ let canScrollPrev = $state(false);
+ let scrollSnaps = $state.raw<number[]>([]);
+ let selectedIndex = $state(0);
+
+ setEmblaContext({
+ get api() {
+ return api;
+ },
+ get orientation() {
+ return orientation;
+ },
+ get options() {
+ return opts;
+ },
+ get plugins() {
+ return plugins;
+ },
+ get canScrollNext() {
+ return canScrollNext;
+ },
+ get canScrollPrev() {
+ return canScrollPrev;
+ },
+ get scrollSnaps() {
+ return scrollSnaps;
+ },
+ get selectedIndex() {
+ return selectedIndex;
+ },
scrollPrev,
scrollNext,
- orientation,
- canScrollNext: false,
- canScrollPrev: false,
handleKeyDown,
- options: opts,
- plugins,
onInit,
- scrollSnaps: [],
- selectedIndex: 0,
scrollTo
});
- setEmblaContext(carouselState);
-
function scrollPrev() {
- carouselState.api?.scrollPrev();
+ api?.scrollPrev();
}
function scrollNext() {
- carouselState.api?.scrollNext();
+ api?.scrollNext();
}
function scrollTo(index: number, jump?: boolean) {
- carouselState.api?.scrollTo(index, jump);
+ api?.scrollTo(index, jump);
}
function onSelect() {
- if (!carouselState.api) return;
- carouselState.selectedIndex = carouselState.api.selectedScrollSnap();
- carouselState.canScrollNext = carouselState.api.canScrollNext();
- carouselState.canScrollPrev = carouselState.api.canScrollPrev();
+ if (!api) return;
+ selectedIndex = api.selectedScrollSnap();
+ canScrollNext = api.canScrollNext();
+ canScrollPrev = api.canScrollPrev();
}
function handleKeyDown(e: KeyboardEvent) {
@@ -63,15 +82,25 @@
}
function onInit(event: CustomEvent<CarouselAPI>) {
- carouselState.api = event.detail;
- setApi(carouselState.api);
+ api = event.detail;
+ setApi?.(api);
+
+ scrollSnaps = api.scrollSnapList();
+ api.on('select', onSelect);
+ api.on('reInit', onReInit);
+ onSelect();
+ }
- carouselState.scrollSnaps = carouselState.api.scrollSnapList();
- carouselState.api.on('select', onSelect);
+ function onReInit() {
+ if (!api) return;
+ scrollSnaps = api.scrollSnapList();
onSelect();
}
- onDestroy(() => carouselState.api?.off('select', onSelect));
+ onDestroy(() => {
+ api?.off('select', onSelect);
+ api?.off('reInit', onReInit);
+ });
</script>
<div
diff --git a/frontend/src/lib/components/ui/carousel/context.ts b/frontend/src/lib/components/ui/carousel/context.ts
index fd98822b1..6a9195b92 100644
--- a/frontend/src/lib/components/ui/carousel/context.ts
+++ b/frontend/src/lib/components/ui/carousel/context.ts
@@ -1,6 +1,6 @@
import type { WithElementRef } from '#lib/utils.js';
import type { EmblaCarouselSvelteType, default as emblaCarouselSvelte } from 'embla-carousel-svelte';
-import { getContext, hasContext, setContext } from 'svelte';
+import { createContext } from 'svelte';
import type { HTMLAttributes } from 'svelte/elements';
export type CarouselAPI =
@@ -10,7 +10,7 @@ export type CarouselAPI =
? CarouselAPI
: never;
-type EmblaCarouselConfig = NonNullable<Parameters<typeof emblaCarouselSvelte>[1]>;
+export type EmblaCarouselConfig = NonNullable<Parameters<typeof emblaCarouselSvelte>[1]>;
export type CarouselOptions = EmblaCarouselConfig['options'];
export type CarouselPlugins = EmblaCarouselConfig['plugins'];
@@ -24,8 +24,6 @@ export type CarouselProps = {
orientation?: 'horizontal' | 'vertical';
} & WithElementRef<HTMLAttributes<HTMLDivElement>>;
-const EMBLA_CAROUSEL_CONTEXT = Symbol('EMBLA_CAROUSEL_CONTEXT');
-
export type EmblaContext = {
api: CarouselAPI | undefined;
orientation: 'horizontal' | 'vertical';
@@ -42,14 +40,4 @@ export type EmblaContext = {
selectedIndex: number;
};
-export function setEmblaContext(config: EmblaContext): EmblaContext {
- setContext(EMBLA_CAROUSEL_CONTEXT, config);
- return config;
-}
-
-export function getEmblaContext(name = 'This component') {
- if (!hasContext(EMBLA_CAROUSEL_CONTEXT)) {
- throw new Error(`${name} must be used within a <Carousel.Root> component`);
- }
- return getContext<ReturnType<typeof setEmblaContext>>(EMBLA_CAROUSEL_CONTEXT);
-}
+export const [getEmblaContext, setEmblaContext] = createContext<EmblaContext>();
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-context.ts b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-context.ts
index deaf51177..a9b14594b 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-context.ts
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-context.ts
@@ -1,5 +1,7 @@
+import { createContext } from 'svelte';
+
export type DropdownMenuContext = {
close: () => void;
};
-export const dropdownMenuContextKey = Symbol('dropdown-menu');
+export const [getDropdownMenuContext, setDropdownMenuContext, hasDropdownMenuContext] = createContext<DropdownMenuContext>();
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte
index 1bf38086c..38cd23a68 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte
@@ -1,8 +1,7 @@
<script lang="ts">
import { cn } from '#lib/utils.js';
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
- import { getContext } from 'svelte';
- import { dropdownMenuContextKey, type DropdownMenuContext } from './dropdown-menu-context';
+ import { getDropdownMenuContext, hasDropdownMenuContext } from './dropdown-menu-context';
let {
ref = $bindable(null),
@@ -19,7 +18,7 @@
onclick?: (event: MouseEvent) => void;
} = $props();
- const menuContext = getContext<DropdownMenuContext | null>(dropdownMenuContextKey);
+ const menuContext = hasDropdownMenuContext() ? getDropdownMenuContext() : undefined;
function handleClick(event: MouseEvent) {
onclick?.(event);
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-root.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-root.svelte
index 6ff6ef561..c5904feab 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-root.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-root.svelte
@@ -1,11 +1,10 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
- import { setContext } from 'svelte';
- import { dropdownMenuContextKey } from './dropdown-menu-context';
+ import { setDropdownMenuContext } from './dropdown-menu-context';
let { open = $bindable(false), ...restProps }: DropdownMenuPrimitive.RootProps = $props();
- setContext(dropdownMenuContextKey, {
+ setDropdownMenuContext({
close: () => {
open = false;
}
diff --git a/frontend/src/lib/components/ui/sidebar/context.svelte.ts b/frontend/src/lib/components/ui/sidebar/context.svelte.ts
index d08d123bd..474d5ed02 100644
--- a/frontend/src/lib/components/ui/sidebar/context.svelte.ts
+++ b/frontend/src/lib/components/ui/sidebar/context.svelte.ts
@@ -1,7 +1,7 @@
import { IsTablet } from '#lib/hooks/is-tablet.svelte.js';
-import { getContext, setContext, onDestroy } from 'svelte';
-import { fromStore } from 'svelte/store';
-import userStore from '#lib/stores/user-store.js';
+import { createContext, onDestroy } from 'svelte';
+
+import userStore from '#lib/stores/user-store.svelte.js';
import { PersistedState } from 'runed';
import { SIDEBAR_KEYBOARD_SHORTCUT } from './constants.js';
@@ -32,7 +32,7 @@ class SidebarState {
setOpen: SidebarStateProps['setOpen'];
#isTablet: IsTablet;
#isPinnedState = new PersistedState('sidebar-pinned', true);
- #user = fromStore(userStore);
+ #user = userStore;
#isHovered = $state(false);
#hoverTimeout: ReturnType<typeof setTimeout> | null = null;
state = $derived.by(() => (this.open ? 'expanded' : 'collapsed'));
@@ -121,7 +121,7 @@ class SidebarState {
};
}
-const SYMBOL_KEY = 'scn-sidebar';
+export const [useSidebar, setSidebarContext] = createContext<SidebarState>();
/**
* Instantiates a new `SidebarState` instance and sets it in the context.
@@ -130,14 +130,5 @@ const SYMBOL_KEY = 'scn-sidebar';
* @returns The `SidebarState` instance.
*/
export function setSidebar(props: SidebarStateProps): SidebarState {
- return setContext(Symbol.for(SYMBOL_KEY), new SidebarState(props));
-}
-
-/**
- * Retrieves the `SidebarState` instance from the context. This is a class instance,
- * so you cannot destructure it.
- * @returns The `SidebarState` instance.
- */
-export function useSidebar(): SidebarState {
- return getContext(Symbol.for(SYMBOL_KEY));
+ return setSidebarContext(new SidebarState(props));
}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
index 7091b77ad..4e56a4d37 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
@@ -4,7 +4,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON } from './constants.js';
import { setSidebar } from './context.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
let {
ref = $bindable(null),
@@ -33,7 +33,7 @@
<svelte:window
onkeydown={(event) => {
- if ($userStore?.preferences?.keyboardShortcutsEnabled !== false) {
+ if (userStore.current?.preferences?.keyboardShortcutsEnabled !== false) {
sidebar.handleShortcutKeydown(event);
}
}}
diff --git a/frontend/src/lib/components/ui/snippet/snippet.svelte b/frontend/src/lib/components/ui/snippet/snippet.svelte
index 798417e94..f77bb9b4e 100644
--- a/frontend/src/lib/components/ui/snippet/snippet.svelte
+++ b/frontend/src/lib/components/ui/snippet/snippet.svelte
@@ -40,7 +40,8 @@
{text}
</pre>
{:else}
- {#each text as line, i (i)}
+ <!-- Repeated lines are valid; each line renders only text. -->
+ {#each text as line}
<pre class={cn('overflow-y-auto text-left font-mono text-sm font-light whitespace-nowrap')}>
{line}
</pre>
diff --git a/frontend/src/lib/components/ui/virtualizer.svelte.ts b/frontend/src/lib/components/ui/virtualizer.svelte.ts
index 72c34c609..943d990dc 100644
--- a/frontend/src/lib/components/ui/virtualizer.svelte.ts
+++ b/frontend/src/lib/components/ui/virtualizer.svelte.ts
@@ -1,4 +1,4 @@
-import { onMount } from 'svelte';
+import { onMount, untrack } from 'svelte';
import {
Virtualizer,
elementScroll,
@@ -72,8 +72,10 @@ export function createVirtualizer<TScroll extends Element, TItem extends Element
get totalSize() {
return totalSize;
},
- /** `use:` action target that measures real row heights for accurate offsets. */
- measureElement: (node: TItem | null) => instance.measureElement(node),
+ measureElement: (node: TItem | null) => {
+ untrack(() => instance.measureElement(node));
+ if (node) return () => queueMicrotask(() => instance.measureElement(null));
+ },
measure: () => {
instance.measure();
for (const node of instance.elementsCache.values()) {
diff --git a/frontend/src/lib/components/workspace-file-tree-panel.svelte b/frontend/src/lib/components/workspace-file-tree-panel.svelte
index 8448ea10b..fc0c4f869 100644
--- a/frontend/src/lib/components/workspace-file-tree-panel.svelte
+++ b/frontend/src/lib/components/workspace-file-tree-panel.svelte
@@ -727,7 +727,7 @@
class="absolute top-0 left-0 w-full"
style={`transform: translateY(${virtualItem.start}px)`}
data-index={virtualItem.index}
- use:rowVirtualizer.measureElement
+ {@attach rowVirtualizer.measureElement}
>
{@render workspaceRow(row)}
</div>
diff --git a/frontend/src/lib/hooks/settings-form-context.ts b/frontend/src/lib/hooks/settings-form-context.ts
new file mode 100644
index 000000000..e8dacf223
--- /dev/null
+++ b/frontend/src/lib/hooks/settings-form-context.ts
@@ -0,0 +1,4 @@
+import { createContext } from 'svelte';
+import type { SettingsFormContext } from '#lib/types/settings-form.js';
+
+export const [getSettingsFormContext, setSettingsFormContext, hasSettingsFormContext] = createContext<SettingsFormContext>();
diff --git a/frontend/src/lib/hooks/use-easy-join-candidates.svelte.ts b/frontend/src/lib/hooks/use-easy-join-candidates.svelte.ts
index daec8038f..61d070f3b 100644
--- a/frontend/src/lib/hooks/use-easy-join-candidates.svelte.ts
+++ b/frontend/src/lib/hooks/use-easy-join-candidates.svelte.ts
@@ -1,14 +1,14 @@
import { createQuery } from '@tanstack/svelte-query';
-import { fromStore } from 'svelte/store';
+
import { queryKeys } from '#lib/query/query-keys.js';
import { userHasPermission } from '#lib/utils/auth.js';
import { swarmService } from '#lib/services/swarm-service.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
-import userStore from '#lib/stores/user-store.js';
+import userStore from '#lib/stores/user-store.svelte.js';
import type { SwarmJoinCandidate } from '#lib/types/swarm.js';
export function useEasyJoinCandidates() {
- const user = fromStore(userStore);
+ const user = userStore;
const managerEnvironmentId = $derived(environmentStore.selected?.id ?? null);
const canDiscover = $derived(
managerEnvironmentId !== null && userHasPermission(user.current, 'swarm:join', managerEnvironmentId)
diff --git a/frontend/src/lib/hooks/use-settings-form.svelte.ts b/frontend/src/lib/hooks/use-settings-form.svelte.ts
index 7121bebad..14c8b009a 100644
--- a/frontend/src/lib/hooks/use-settings-form.svelte.ts
+++ b/frontend/src/lib/hooks/use-settings-form.svelte.ts
@@ -1,15 +1,16 @@
-import { getContext, onDestroy } from 'svelte';
-import settingsStore from '#lib/stores/config-store.js';
+import { getSettingsFormContext, hasSettingsFormContext } from '#lib/hooks/settings-form-context.js';
+import { onDestroy } from 'svelte';
+import settingsStore from '#lib/stores/config-store.svelte.js';
import { settingsService } from '#lib/services/settings-service.js';
import type { Settings } from '#lib/types/settings.js';
import { tryCatch } from '#lib/utils/try-catch.js';
-import { fromStore, type Readable } from 'svelte/store';
+
import type { SettingsFormContext } from '#lib/types/settings-form.js';
type SettingsPayload = Partial<Settings> & Record<string, unknown>;
type Options<TFormInputs, TSaveData extends SettingsPayload> = {
- formInputs: Readable<TFormInputs>;
+ formInputs: () => TFormInputs;
getCurrentSettings: () => TSaveData;
/**
* Custom save handler. If provided, this will be called instead of the default
@@ -23,7 +24,7 @@ export class UseSettingsForm<
TSaveData extends SettingsPayload
> {
#isLoading = $state(false);
- #formValues: { readonly current: TFormInputs };
+ #formValues: () => TFormInputs;
#saveFunction: (() => Promise<void> | void) | null = null;
#resetFunction: (() => void) | null = null;
private formContext: SettingsFormContext | undefined;
@@ -33,9 +34,9 @@ export class UseSettingsForm<
constructor({ formInputs, getCurrentSettings, onSave }: Options<TFormInputs, TSaveData>) {
this.getCurrentSettings = getCurrentSettings;
this.customOnSave = onSave;
- this.#formValues = fromStore(formInputs);
+ this.#formValues = formInputs;
- this.formContext = getContext<SettingsFormContext | undefined>('settingsFormState');
+ this.formContext = hasSettingsFormContext() ? getSettingsFormContext() : undefined;
if (this.formContext) {
onDestroy(() => {
@@ -47,7 +48,7 @@ export class UseSettingsForm<
}
#hasChanges = $derived.by(() => {
- const currentFormValues = this.#formValues.current;
+ const currentFormValues = this.#formValues();
const settingsToCompare = this.getCurrentSettings();
const keys = Object.keys(currentFormValues) as (keyof TFormInputs)[];
diff --git a/frontend/src/lib/layouts/settings-page-layout.svelte b/frontend/src/lib/layouts/settings-page-layout.svelte
index a2ea3ae91..3d64ca814 100644
--- a/frontend/src/lib/layouts/settings-page-layout.svelte
+++ b/frontend/src/lib/layouts/settings-page-layout.svelte
@@ -1,11 +1,10 @@
<script lang="ts">
+ import { getSettingsFormContext, hasSettingsFormContext } from '#lib/hooks/settings-form-context.js';
import type { Snippet } from 'svelte';
import { UiConfigDisabledTag } from '#lib/components/badges/index.js';
import StatCard from '#lib/components/stat-card.svelte';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
- import { getContext } from 'svelte';
- import type { SettingsFormContext } from '#lib/types/settings-form.js';
import { m } from '#lib/paraglide/messages.js';
import { EllipsisIcon, ResetIcon, type IconType, ArrowDownIcon } from '#lib/icons/index.js';
import { cn } from '#lib/utils.js';
@@ -40,12 +39,12 @@
const mobileVisibleButtons = $derived(actionButtons.filter((btn) => btn.showOnMobile));
const mobileDropdownButtons = $derived(actionButtons.filter((btn) => !btn.showOnMobile));
- const formContext = getContext<SettingsFormContext | undefined>('settingsFormState');
+ const formContext = hasSettingsFormContext() ? getSettingsFormContext() : undefined;
const formState = $derived(formContext?.activeForm);
</script>
{#snippet ActionOptions(options: SettingsActionOption[], disabled = false, showIcons = true)}
- {#each options as option}
+ {#each options as option (option)}
<DropdownMenu.Item onclick={option.onclick} disabled={disabled || option.disabled}>
{#if showIcons && option.icon}
{@const OptionIcon = option.icon}
@@ -57,7 +56,7 @@
{/snippet}
{#snippet ActionButtonList(buttons: SettingsActionButton[])}
- {#each buttons as button}
+ {#each buttons as button (button.id)}
{#if button.options?.length}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -116,7 +115,7 @@
{/if}
{#if pageType === 'management' && statCards.length > 0}
<div class="mt-2 flex flex-wrap items-center gap-x-4 gap-y-1">
- {#each statCards as card, i}
+ {#each statCards as card, i (card)}
{#if i > 0}
<div class="h-4 w-px bg-border/50"></div>
{/if}
@@ -195,7 +194,7 @@
class="z-[var(--arcane-z-surface)] min-w-[160px] rounded-xl border bg-popover/90 p-1 shadow-lg backdrop-blur-md"
>
<DropdownMenu.Group>
- {#each mobileDropdownButtons as button}
+ {#each mobileDropdownButtons as button (button.id)}
{#if button.options?.length}
<DropdownMenu.Label>{button.label}</DropdownMenu.Label>
{@render ActionOptions(button.options, button.disabled, false)}
diff --git a/frontend/src/lib/services/auth-service.ts b/frontend/src/lib/services/auth-service.ts
index 2fbecddad..a4bb2cbec 100644
--- a/frontend/src/lib/services/auth-service.ts
+++ b/frontend/src/lib/services/auth-service.ts
@@ -1,7 +1,7 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import { goto, refreshAll } from '$app/navigation';
import BaseAPIService, { APIError } from './api-service';
-import userStore from '#lib/stores/user-store.js';
+import userStore from '#lib/stores/user-store.svelte.js';
import type { User, MFAChallenge, AuthenticationResponse } from '#lib/types/auth.js';
import type { OidcStatusInfo } from '#lib/types/settings.js';
import type { LoginCredentials, AutoLoginConfig } from '#lib/types/auth.js';
diff --git a/frontend/src/lib/services/settings-service.ts b/frontend/src/lib/services/settings-service.ts
index 90dd520f8..aa752022b 100644
--- a/frontend/src/lib/services/settings-service.ts
+++ b/frontend/src/lib/services/settings-service.ts
@@ -1,7 +1,7 @@
import BaseAPIService from './api-service';
import type { Settings, OidcStatusInfo } from '#lib/types/settings.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
-import { isLocalSetting, extractLocalSettings, extractEnvironmentSettings } from '#lib/utils/settings.js';
+import { isLocalSetting, extractLocalSettings, extractEnvironmentSettings } from '#lib/utils/settings.svelte.js';
type KeyValuePair = { key: string; value: string };
diff --git a/frontend/src/lib/stores/activity.store.svelte.ts b/frontend/src/lib/stores/activity.store.svelte.ts
index 4dcc8040b..9ec4b7ccc 100644
--- a/frontend/src/lib/stores/activity.store.svelte.ts
+++ b/frontend/src/lib/stores/activity.store.svelte.ts
@@ -21,8 +21,7 @@ import type {
ActivityType
} from '#lib/types/activity.type.js';
import type { Environment } from '#lib/types/environment.js';
-import userStore from '#lib/stores/user-store.js';
-import { get } from 'svelte/store';
+import userStore from '#lib/stores/user-store.svelte.js';
import {
discardPendingActivityToasts,
queueActivityCompletionToast
@@ -185,7 +184,7 @@ function createActivityStore() {
}
// Only the initiating user's own actions toast — scheduled jobs and
// other users' work carry no/another userId and stay silent.
- const currentUserId = get(userStore)?.id;
+ const currentUserId = userStore.current?.id;
if (!activity.startedBy?.userId || !currentUserId || activity.startedBy.userId !== currentUserId) {
return;
}
@@ -195,7 +194,7 @@ function createActivityStore() {
const core = createEnvironmentStreamStore<ActivityEnvironmentState, ActivityStreamEvent>({
label: 'Activity',
includeEnvironment: (environment) => userStore.hasPermission('activities:read', environment.id),
- subscribeEnvironmentFilter: (reconcile) => userStore.subscribe(reconcile),
+ subscribeEnvironmentFilter: (reconcile) => userStore.onChange(reconcile),
createEnvironmentState(environment: Pick<Environment, 'id' | 'name'>): ActivityEnvironmentState {
return {
id: environment.id || LOCAL_DOCKER_ENVIRONMENT_ID,
diff --git a/frontend/src/lib/stores/config-store.ts b/frontend/src/lib/stores/config-store.svelte.ts
similarity index 66%
rename from frontend/src/lib/stores/config-store.ts
rename to frontend/src/lib/stores/config-store.svelte.ts
index 32755847c..2c113ed45 100644
--- a/frontend/src/lib/stores/config-store.ts
+++ b/frontend/src/lib/stores/config-store.svelte.ts
@@ -1,8 +1,9 @@
import { settingsService } from '#lib/services/settings-service.js';
import type { Settings } from '#lib/types/settings.js';
-import { get, writable } from 'svelte/store';
+import { untrack } from 'svelte';
-const settingsStore = writable<Settings>();
+let current = $state.raw<Settings>();
+const listeners = new Set<(settings: Settings | undefined) => void>();
const reload = async () => {
const settings = await settingsService.getSettings();
@@ -11,19 +12,18 @@ const reload = async () => {
};
const set = (settings: Settings) => {
- settingsStore.set(settings);
+ current = settings;
+ untrack(() => {
+ for (const listener of listeners) listener(settings);
+ });
};
// Auto-login state management
const AUTO_LOGIN_DISABLED_KEY = 'arcane_auto_login_disabled';
-const autoLoginEnabledStore = writable<boolean>(false);
+let autoLoginEnabled = $state(false);
const setAutoLoginEnabled = (enabled: boolean) => {
- autoLoginEnabledStore.set(enabled);
-};
-
-const isAutoLoginEnabled = (): boolean => {
- return get(autoLoginEnabledStore);
+ autoLoginEnabled = enabled;
};
const cacheAutoLoginDisabled = (): void => {
@@ -44,14 +44,24 @@ const clearAutoLoginDisabledCache = (): void => {
};
export default {
- subscribe: settingsStore.subscribe,
+ get current() {
+ return current;
+ },
+ onChange(listener: (settings: Settings | undefined) => void) {
+ listeners.add(listener);
+ untrack(() => listener(current));
+ return () => {
+ listeners.delete(listener);
+ };
+ },
reload,
set,
// Auto-login
autoLoginEnabled: {
- subscribe: autoLoginEnabledStore.subscribe,
+ get current() {
+ return autoLoginEnabled;
+ },
set: setAutoLoginEnabled,
- isEnabled: isAutoLoginEnabled,
cacheDisabled: cacheAutoLoginDisabled,
isKnownDisabled: isAutoLoginKnownDisabled,
clearDisabledCache: clearAutoLoginDisabledCache
diff --git a/frontend/src/lib/stores/dashboard.store.svelte.ts b/frontend/src/lib/stores/dashboard.store.svelte.ts
index b13946e84..09e232bd5 100644
--- a/frontend/src/lib/stores/dashboard.store.svelte.ts
+++ b/frontend/src/lib/stores/dashboard.store.svelte.ts
@@ -11,7 +11,7 @@ import {
} from '#lib/stores/environment-stream.svelte.js';
import type { DashboardSnapshot, DashboardStreamErrorCode, DashboardStreamEvent } from '#lib/types/shared.js';
import type { Environment } from '#lib/types/environment.js';
-import userStore from '#lib/stores/user-store.js';
+import userStore from '#lib/stores/user-store.svelte.js';
type DashboardEnvironmentState = StreamEnvStateBase & {
snapshot: DashboardSnapshot | null;
@@ -28,7 +28,7 @@ function createDashboardStore() {
const core = createEnvironmentStreamStore<DashboardEnvironmentState, DashboardStreamEvent>({
label: 'Dashboard',
includeEnvironment: (environment) => userStore.hasPermission('dashboard:read', environment.id),
- subscribeEnvironmentFilter: (reconcile) => userStore.subscribe(reconcile),
+ subscribeEnvironmentFilter: (reconcile) => userStore.onChange(reconcile),
refreshOnStart: true,
clearErrorExtra: { errorCode: undefined },
createEnvironmentState(environment: Pick<Environment, 'id' | 'name'>): DashboardEnvironmentState {
diff --git a/frontend/src/lib/stores/deploy-options.store.svelte.ts b/frontend/src/lib/stores/deploy-options.store.svelte.ts
index 61e44e16f..993d73b19 100644
--- a/frontend/src/lib/stores/deploy-options.store.svelte.ts
+++ b/frontend/src/lib/stores/deploy-options.store.svelte.ts
@@ -1,5 +1,5 @@
import { PersistedState } from 'runed';
-import settingsStore from './config-store';
+import settingsStore from './config-store.svelte.js';
export type DeployPullPolicy = 'missing' | 'always' | 'never';
@@ -50,7 +50,7 @@ function persistState() {
};
}
-settingsStore.subscribe((settings) => {
+settingsStore.onChange((settings) => {
if (!settings || userOverrodePullPolicy.current) {
return;
}
diff --git a/frontend/src/lib/stores/environment-stream.svelte.ts b/frontend/src/lib/stores/environment-stream.svelte.ts
index a2528ceb9..61e806af7 100644
--- a/frontend/src/lib/stores/environment-stream.svelte.ts
+++ b/frontend/src/lib/stores/environment-stream.svelte.ts
@@ -57,7 +57,7 @@ export interface EnvStreamCoreConfig<TState extends StreamEnvStateBase, TEvent e
export function createEnvironmentStreamStore<TState extends StreamEnvStateBase, TEvent extends StreamEventBase>(
config: EnvStreamCoreConfig<TState, TEvent>
) {
- let _environmentStates = $state<Record<string, TState>>({});
+ let _environmentStates = $state.raw<Record<string, TState>>({});
let started = false;
// REST snapshots belong to this store lifecycle, not the shared transport's reconnect lifecycle.
diff --git a/frontend/src/lib/stores/user-store.ts b/frontend/src/lib/stores/user-store.svelte.ts
similarity index 85%
rename from frontend/src/lib/stores/user-store.ts
rename to frontend/src/lib/stores/user-store.svelte.ts
index b856fa75e..988898517 100644
--- a/frontend/src/lib/stores/user-store.ts
+++ b/frontend/src/lib/stores/user-store.svelte.ts
@@ -1,6 +1,6 @@
import type { User } from '#lib/types/auth.js';
import { GLOBAL_SCOPE, SUDO_PERMISSION } from '#lib/types/auth.js';
-import { writable, get } from 'svelte/store';
+import { untrack } from 'svelte';
import { setLocale } from '#lib/utils/formatting.js';
import {
applyAccentColor,
@@ -10,11 +10,12 @@ import {
applyInterfaceAnimations,
applyOledMode,
FONT_SIZE_DEFAULT
-} from '#lib/utils/theme.js';
+} from '#lib/utils/theme.svelte.js';
import { setMode } from 'mode-watcher';
import { timeFormatStore } from '#lib/stores/time-format.store.svelte.js';
-const userStore = writable<User | null>(null);
+let current = $state.raw<User | null>(null);
+const listeners = new Set<(user: User | null) => void>();
export const userHasPermissionInAnyEnvironment = (user: User | null | undefined, perm: string): boolean => {
if (!user?.permissionsByEnv) return false;
@@ -42,7 +43,10 @@ const setUser = async (user: User) => {
setMode(preferences.themeMode);
}
- userStore.set(user);
+ current = user;
+ untrack(() => {
+ for (const listener of listeners) listener(user);
+ });
};
const clearUser = () => {
@@ -55,7 +59,10 @@ const clearUser = () => {
applyInterfaceAnimations(true);
// Light/dark mode is deliberately left alone on logout: it is a device-local
// preference and flipping it mid-session is jarring.
- userStore.set(null);
+ current = null;
+ untrack(() => {
+ for (const listener of listeners) listener(null);
+ });
};
/**
@@ -66,7 +73,7 @@ const clearUser = () => {
* checking org-level permissions, or as a fallback before an env is selected).
*/
const permissions = (envId?: string): Set<string> => {
- const user = get(userStore);
+ const user = current;
if (!user?.permissionsByEnv) return new Set();
const out = new Set<string>();
const global = user.permissionsByEnv[GLOBAL_SCOPE];
@@ -95,12 +102,12 @@ const hasAnyPermission = (perms: string[], envId?: string): boolean => {
/** Returns true if the caller may perform `perm` in at least one effective environment scope. */
const hasPermissionInAnyEnvironment = (perm: string): boolean => {
- return userHasPermissionInAnyEnvironment(get(userStore), perm);
+ return userHasPermissionInAnyEnvironment(current, perm);
};
/** Returns true if the caller effectively holds global administrator access. */
const isGlobalAdmin = (): boolean => {
- const user = get(userStore);
+ const user = current;
if (!user) return false;
if (typeof user.isGlobalAdmin === 'boolean') return user.isGlobalAdmin;
const global = user.permissionsByEnv?.[GLOBAL_SCOPE];
@@ -109,7 +116,16 @@ const isGlobalAdmin = (): boolean => {
};
export default {
- subscribe: userStore.subscribe,
+ get current() {
+ return current;
+ },
+ onChange(listener: (user: User | null) => void) {
+ listeners.add(listener);
+ untrack(() => listener(current));
+ return () => {
+ listeners.delete(listener);
+ };
+ },
setUser,
clearUser,
permissions,
diff --git a/frontend/src/lib/types/confirm-dialog.ts b/frontend/src/lib/types/confirm-dialog.ts
index 703962a9f..3d66e8631 100644
--- a/frontend/src/lib/types/confirm-dialog.ts
+++ b/frontend/src/lib/types/confirm-dialog.ts
@@ -16,3 +16,7 @@ export interface ConfirmDialogOptions {
initialState?: boolean;
}>;
}
+
+export type ConfirmDialogState = {
+ current: (ConfirmDialogOptions & { open: boolean; checkboxStates: Record<string, boolean> }) | null;
+};
diff --git a/frontend/src/lib/types/form.ts b/frontend/src/lib/types/form.ts
new file mode 100644
index 000000000..f06b5fabc
--- /dev/null
+++ b/frontend/src/lib/types/form.ts
@@ -0,0 +1,8 @@
+export type FormInput<T> = {
+ value: T;
+ error: string | null;
+};
+
+export type FormInputs<T> = {
+ [K in keyof T]: FormInput<T[K]>;
+};
diff --git a/frontend/src/lib/utils/auth.ts b/frontend/src/lib/utils/auth.ts
index ace8d15db..0f9c6e45a 100644
--- a/frontend/src/lib/utils/auth.ts
+++ b/frontend/src/lib/utils/auth.ts
@@ -1,4 +1,4 @@
-import userStore from '#lib/stores/user-store.js';
+import userStore from '#lib/stores/user-store.svelte.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { APIError } from '#lib/services/api-service.js';
diff --git a/frontend/src/lib/utils/formatting.ts b/frontend/src/lib/utils/formatting.ts
index 8f05550eb..9e262e402 100644
--- a/frontend/src/lib/utils/formatting.ts
+++ b/frontend/src/lib/utils/formatting.ts
@@ -24,6 +24,15 @@ export function truncateImageDigest(image: string): string {
return image.replace(/@sha256:([a-f0-9]{7})[a-f0-9]+/g, '@sha256:$1');
}
+export function withOccurrenceKeys(values?: readonly string[] | null) {
+ const occurrences = new Map<string, number>();
+ return (values ?? []).map((value) => {
+ const occurrence = occurrences.get(value) ?? 0;
+ occurrences.set(value, occurrence + 1);
+ return { value, key: JSON.stringify([value, occurrence]) };
+ });
+}
+
// --- Byte formatting (MIT, TJ Holowaychuk / Jed Watson) ---
export type BytesFormatOptions = {
diff --git a/frontend/src/lib/utils/navigation.ts b/frontend/src/lib/utils/navigation.ts
index f971eb26d..9ebf00455 100644
--- a/frontend/src/lib/utils/navigation.ts
+++ b/frontend/src/lib/utils/navigation.ts
@@ -1,6 +1,5 @@
import { browser } from '$app/env';
import { PersistedState } from 'runed';
-import { get } from 'svelte/store';
import { createContext } from 'svelte';
import {
DEFAULT_LANDING_PAGE,
@@ -8,7 +7,7 @@ import {
getLandingPageNavItems,
type MobileNavigationSettings
} from '#lib/config/navigation-config.js';
-import userStore from '#lib/stores/user-store.js';
+import userStore from '#lib/stores/user-store.svelte.js';
// --- Mobile nav state ---
@@ -20,7 +19,7 @@ export const [getMobileNavigation, setMobileNavigation] = createContext<{
}>();
export function getEffectiveNavigationSettings(): MobileNavigationSettings {
- const preferences = get(userStore)?.preferences;
+ const preferences = userStore.current?.preferences;
const mode = preferences?.mobileNavigationMode ?? defaultMobileNavigationSettings.mode;
return {
@@ -37,7 +36,7 @@ export function getEffectiveNavigationSettings(): MobileNavigationSettings {
* that no longer exists) falls back to the default rather than 404ing.
*/
export function getEffectiveLandingPage(): string {
- const candidate = get(userStore)?.preferences?.defaultLandingPage ?? DEFAULT_LANDING_PAGE;
+ const candidate = userStore.current?.preferences?.defaultLandingPage ?? DEFAULT_LANDING_PAGE;
return getLandingPageNavItems().some((item) => item.url === candidate) ? candidate : DEFAULT_LANDING_PAGE;
}
diff --git a/frontend/src/lib/utils/settings-form.ts b/frontend/src/lib/utils/settings-form.ts
index 273843e3b..24fa73a11 100644
--- a/frontend/src/lib/utils/settings-form.ts
+++ b/frontend/src/lib/utils/settings-form.ts
@@ -4,11 +4,11 @@ import { z } from 'zod/v4';
import { UseSettingsForm } from '#lib/hooks/use-settings-form.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import type { Settings } from '#lib/types/settings.js';
-import { createForm } from '#lib/utils/settings.js';
+import { createForm } from '#lib/utils/settings.svelte.js';
type SettingsPayload = Partial<Settings> & Record<string, unknown>;
-export interface SettingsFormConfig<T extends z.ZodType<SettingsPayload, any>> {
+export interface SettingsFormConfig<T extends z.ZodType<SettingsPayload>> {
schema: T;
currentSettings: z.infer<T>;
getCurrentSettings?: () => z.infer<T>;
@@ -24,7 +24,7 @@ export interface SettingsFormConfig<T extends z.ZodType<SettingsPayload, any>> {
errorMessage?: string;
}
-export function createSettingsForm<T extends z.ZodType<any, any>>(config: SettingsFormConfig<T>) {
+export function createSettingsForm<T extends z.ZodType<SettingsPayload>>(config: SettingsFormConfig<T>) {
const {
schema,
currentSettings,
@@ -36,10 +36,11 @@ export function createSettingsForm<T extends z.ZodType<any, any>>(config: Settin
errorMessage = m.common_update_failed({ resource: m.settings() })
} = config;
- const { inputs: formInputs, ...form } = createForm(schema, currentSettings);
+ const form = createForm(schema, currentSettings);
+ const formInputs = form.inputs;
const settingsForm = new UseSettingsForm({
- formInputs,
+ formInputs: () => formInputs,
getCurrentSettings: getCurrentSettings ?? (() => currentSettings),
onSave
});
diff --git a/frontend/src/lib/utils/settings.svelte.ts b/frontend/src/lib/utils/settings.svelte.ts
new file mode 100644
index 000000000..cbe1aef89
--- /dev/null
+++ b/frontend/src/lib/utils/settings.svelte.ts
@@ -0,0 +1,103 @@
+import { z } from 'zod/v4';
+import type { FormInputs } from '#lib/types/form.js';
+
+const LOCAL_SETTING_KEYS = new Set([
+ 'avatarMaxUploadSizeMb',
+ 'authLocalEnabled',
+ 'authSessionTimeout',
+ 'authPasswordPolicy',
+ 'authOidcConfig',
+ 'oidcEnabled',
+ 'oidcMergeAccounts',
+ 'oidcSkipTlsVerify',
+ 'oidcAutoRedirectToProvider',
+ 'oidcClientId',
+ 'oidcClientSecret',
+ 'oidcIssuerUrl',
+ 'oidcScopes',
+ 'oidcGroupsClaim',
+ 'oidcProviderName',
+ 'oidcProviderLogoUrl',
+ 'edgeMTLSManagerCAAvailable',
+ 'experimentalFeaturesEnabled',
+ 'apnsEnabled'
+]);
+
+export function isLocalSetting(key: string): boolean {
+ return LOCAL_SETTING_KEYS.has(key);
+}
+
+export function extractLocalSettings<T extends object>(settings: T): Partial<T> {
+ return Object.fromEntries(Object.entries(settings).filter(([key]) => isLocalSetting(key))) as Partial<T>;
+}
+
+export function extractEnvironmentSettings<T extends object>(settings: T): Partial<T> {
+ return Object.fromEntries(Object.entries(settings).filter(([key]) => !isLocalSetting(key))) as Partial<T>;
+}
+
+export function preventDefault<T extends Event>(fn: (event: T) => unknown) {
+ return (event: T) => {
+ event.preventDefault();
+ fn(event);
+ };
+}
+
+export function createForm<T extends z.ZodType<Record<string, unknown>>>(schema: T, initialValues: z.infer<T>) {
+ const inputs = $state<FormInputs<z.infer<T>>>(initializeInputs(initialValues));
+ let errors = $state.raw<z.ZodError<z.infer<T>>>();
+
+ function initializeInputs(values: z.infer<T>): FormInputs<z.infer<T>> {
+ const fields = {} as FormInputs<z.infer<T>>;
+ const schemaShape = schema instanceof z.ZodObject ? schema.shape : {};
+ for (const key of Object.keys(schemaShape) as (keyof z.infer<T>)[]) {
+ if (Object.prototype.hasOwnProperty.call(values, key)) {
+ fields[key] = { value: values[key], error: null };
+ }
+ }
+ return fields;
+ }
+
+ function validate() {
+ const values = Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, input.value]));
+ const result = schema.safeParse(values);
+ errors = result.error;
+ for (const key of Object.keys(inputs) as (keyof z.infer<T>)[]) {
+ inputs[key].error = result.error?.issues.find((issue) => issue.path[0] === key)?.message ?? null;
+ }
+ return result.success ? data() : null;
+ }
+
+ function data() {
+ const values = Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, trimValue(input.value)]));
+ const result = schema.safeParse(values);
+ return (result.success ? result.data : values) as z.infer<T>;
+ }
+
+ function reset(values: z.infer<T> = initialValues) {
+ for (const key of Object.keys(inputs) as (keyof z.infer<T>)[]) {
+ inputs[key] = { value: values[key], error: null };
+ }
+ }
+
+ function setValue<K extends keyof z.infer<T>>(key: K, value: z.infer<T>[K]) {
+ inputs[key].value = value;
+ }
+
+ function trimValue(value: unknown): unknown {
+ if (typeof value === 'string') return value.trim();
+ if (Array.isArray(value)) return value.map((item: unknown) => (typeof item === 'string' ? item.trim() : item));
+ return value;
+ }
+
+ return {
+ schema,
+ inputs,
+ get errors() {
+ return errors;
+ },
+ data,
+ validate,
+ setValue,
+ reset
+ };
+}
diff --git a/frontend/src/lib/utils/settings.ts b/frontend/src/lib/utils/settings.ts
deleted file mode 100644
index 679bb1da9..000000000
--- a/frontend/src/lib/utils/settings.ts
+++ /dev/null
@@ -1,181 +0,0 @@
-import { get, writable } from 'svelte/store';
-import { z } from 'zod/v4';
-
-// --- Local vs environment settings classification ---
-
-export type LocalSettings = {
- edgeMTLSManagerCAAvailable?: boolean;
- avatarMaxUploadSizeMb: number;
- experimentalFeaturesEnabled?: boolean;
- apnsEnabled?: boolean;
-};
-
-const LOCAL_SETTING_KEYS = new Set([
- 'avatarMaxUploadSizeMb',
- 'authLocalEnabled',
- 'authSessionTimeout',
- 'authPasswordPolicy',
- 'authOidcConfig',
- 'oidcEnabled',
- 'oidcMergeAccounts',
- 'oidcSkipTlsVerify',
- 'oidcAutoRedirectToProvider',
- 'oidcClientId',
- 'oidcClientSecret',
- 'oidcIssuerUrl',
- 'oidcScopes',
- 'oidcGroupsClaim',
- 'oidcProviderName',
- 'oidcProviderLogoUrl',
- 'edgeMTLSManagerCAAvailable',
- 'experimentalFeaturesEnabled',
- 'apnsEnabled'
-]);
-
-export function isLocalSetting(key: string): boolean {
- return LOCAL_SETTING_KEYS.has(key);
-}
-
-export function extractLocalSettings(settings: Record<string, any>): Partial<LocalSettings> {
- const local: Partial<LocalSettings> = {};
- for (const key of LOCAL_SETTING_KEYS) {
- if (key in settings) {
- local[key as keyof LocalSettings] = settings[key];
- }
- }
- return local;
-}
-
-export function extractEnvironmentSettings(settings: Record<string, any>): Record<string, any> {
- const env: Record<string, any> = {};
- for (const key in settings) {
- if (!LOCAL_SETTING_KEYS.has(key)) {
- env[key] = settings[key];
- }
- }
- return env;
-}
-
-// --- Generic Zod-backed form state ---
-
-export function preventDefault(fn: (event: Event) => any) {
- return function (this: any, event: Event) {
- event.preventDefault();
- fn.call(this, event);
- };
-}
-
-export type FormInput<T> = {
- value: T;
- error: string | null;
-};
-
-export type FormInputs<T> = {
- [K in keyof T]: FormInput<T[K]>;
-};
-
-export function createForm<T extends z.ZodType<any, any>>(schema: T, initialValues: z.infer<T>) {
- const inputsStore = writable<FormInputs<z.infer<T>>>(initializeInputs(initialValues));
- const errorsStore = writable<z.ZodError<any> | undefined>();
-
- function initializeInputs(initialValues: z.infer<T>): FormInputs<z.infer<T>> {
- const inputs: FormInputs<z.infer<T>> = {} as FormInputs<z.infer<T>>;
-
- const schemaShape = schema instanceof z.ZodObject ? schema.shape : {};
- const schemaKeys = Object.keys(schemaShape);
-
- for (const key of schemaKeys) {
- if (Object.prototype.hasOwnProperty.call(initialValues, key)) {
- inputs[key as keyof z.infer<T>] = {
- value: initialValues[key as keyof z.infer<T>],
- error: null
- };
- }
- }
- return inputs;
- }
-
- function validate() {
- let success = true;
- inputsStore.update((inputs) => {
- const values = Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, input.value]));
-
- const result = schema.safeParse(values);
- errorsStore.set(result.error);
-
- if (!result.success) {
- success = false;
- for (const input of Object.keys(inputs)) {
- const error = result.error.issues.find((e) => e.path[0] === input);
- if (error) {
- inputs[input as keyof z.infer<T>].error = error.message;
- } else {
- inputs[input as keyof z.infer<T>].error = null;
- }
- }
- } else {
- for (const input of Object.keys(inputs)) {
- inputs[input as keyof z.infer<T>].error = null;
- }
- }
- return inputs;
- });
- return success ? data() : null;
- }
-
- function data() {
- const inputs = get(inputsStore);
-
- const values = Object.fromEntries(
- Object.entries(inputs).map(([key, input]) => {
- return [key, trimValue(input.value)];
- })
- );
-
- const result = schema.safeParse(values);
- return (result.success ? result.data : values) as z.infer<T>;
- }
-
- function reset(values: z.infer<T> = initialValues) {
- inputsStore.update((inputs) => {
- for (const input of Object.keys(inputs)) {
- inputs[input as keyof z.infer<T>] = {
- value: values[input as keyof z.infer<T>],
- error: null
- };
- }
- return inputs;
- });
- }
-
- function setValue(key: keyof z.infer<T>, value: z.infer<T>[keyof z.infer<T>]) {
- inputsStore.update((inputs) => {
- inputs[key].value = value;
- return inputs;
- });
- }
-
- function trimValue(value: any) {
- if (typeof value === 'string') {
- value = value.trim();
- } else if (Array.isArray(value)) {
- value = value.map((item: any) => {
- if (typeof item === 'string') {
- return item.trim();
- }
- return item;
- });
- }
- return value;
- }
-
- return {
- schema,
- inputs: inputsStore,
- errors: errorsStore,
- data,
- validate,
- setValue,
- reset
- };
-}
diff --git a/frontend/src/lib/utils/theme.ts b/frontend/src/lib/utils/theme.svelte.ts
similarity index 97%
rename from frontend/src/lib/utils/theme.ts
rename to frontend/src/lib/utils/theme.svelte.ts
index 5c319243b..e8b94a479 100644
--- a/frontend/src/lib/utils/theme.ts
+++ b/frontend/src/lib/utils/theme.svelte.ts
@@ -1,4 +1,3 @@
-import { writable } from 'svelte/store';
import type { ApplicationTheme } from '#lib/types/settings.js';
const APPLICATION_THEME_VALUES = [
@@ -259,9 +258,7 @@ function updateAppearanceCache(partial: AppearanceCache): void {
}
}
-// fallow-ignore-next-line unused-export
-export const accentColorPreviewStore = writable<string>(DEFAULT_ACCENT_COLOR);
-const oledModeStore = writable<boolean>(false);
+export const accentColorPreview = $state({ current: DEFAULT_ACCENT_COLOR });
export function resolveApplicationTheme(value?: string | null): ApplicationTheme {
if (!value) {
@@ -340,7 +337,7 @@ function syncBrowserThemeColor(): void {
export function applyAccentColor(accentValue: string) {
const resolvedAccent = accentValue === 'default' ? DEFAULT_ACCENT_COLOR : accentValue;
- accentColorPreviewStore.set(resolvedAccent);
+ accentColorPreview.current = resolvedAccent;
if (typeof document === 'undefined') {
return;
@@ -401,8 +398,6 @@ function getColorBrightness(color: string): number {
}
export function applyOledMode(enabled: boolean): void {
- oledModeStore.set(enabled);
-
if (typeof document === 'undefined') {
return;
}
diff --git a/frontend/src/routes/(app)/+layout.svelte b/frontend/src/routes/(app)/+layout.svelte
index 210b0ee07..0dc0f6f81 100644
--- a/frontend/src/routes/(app)/+layout.svelte
+++ b/frontend/src/routes/(app)/+layout.svelte
@@ -22,7 +22,7 @@
} from '#lib/config/navigation-config.js';
import { isEditableTarget, matchesShortcutEvent } from '#lib/utils/navigation.js';
import { cn } from '#lib/utils.js';
- import userStore, { userHasPermissionInAnyEnvironment } from '#lib/stores/user-store.js';
+ import userStore, { userHasPermissionInAnyEnvironment } from '#lib/stores/user-store.svelte.js';
let { data, children }: LayoutProps = $props();
const versionInformation = $derived(data.versionInformation);
@@ -38,7 +38,7 @@
const navigationSettings = $derived.by(() => {
// Track the store, not the loader snapshot: saving a preference calls
// userStore.setUser() without re-running load().
- void $userStore;
+ void userStore.current;
return getEffectiveNavigationSettings();
});
const navigationMode = $derived(navigationSettings.mode);
@@ -76,17 +76,20 @@
return () => environmentStatusStore.stop();
});
- $effect(() => {
- const redirectPath = getAuthRedirectPath(
+ const authRedirectPath = $derived(
+ getAuthRedirectPath(
page.url.pathname,
user,
currentEnvId,
permissionsManifest,
permissionsManifestLoadFailed,
getEffectiveLandingPage()
- );
- if (redirectPath) {
- goto(redirectPath);
+ )
+ );
+
+ $effect(() => {
+ if (authRedirectPath) {
+ goto(authRedirectPath);
}
});
@@ -104,7 +107,7 @@
function handleNavigationShortcut(event: KeyboardEvent) {
if (event.defaultPrevented) return;
- if ($userStore?.preferences?.keyboardShortcutsEnabled === false) return;
+ if (userStore.current?.preferences?.keyboardShortcutsEnabled === false) return;
if (isMobile.current || isTablet.current) return;
if (isEditableTarget(event.target)) return;
diff --git a/frontend/src/routes/(app)/account/+page.svelte b/frontend/src/routes/(app)/account/+page.svelte
index 54c60d148..57337293e 100644
--- a/frontend/src/routes/(app)/account/+page.svelte
+++ b/frontend/src/routes/(app)/account/+page.svelte
@@ -1,7 +1,6 @@
<script lang="ts">
import { tryCatch } from '#lib/utils/try-catch.js';
- import { fromStore } from 'svelte/store';
import { toast } from 'svelte-sonner';
import HeaderCard from '#lib/components/header-card.svelte';
import * as Tabs from '#lib/components/ui/tabs/index.js';
@@ -13,8 +12,8 @@
import TextInputWithLabel from '#lib/components/form/text-input-with-label.svelte';
import { m } from '#lib/paraglide/messages.js';
import { userService } from '#lib/services/user-service.js';
- import userStore from '#lib/stores/user-store.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { getDefaultProfilePicture } from '#lib/utils/docker.js';
import { avatarUploadLimitBytes, prepareAvatarUploadFile } from '#lib/utils/avatar-upload.js';
import { formatDate, formatRelativeTime } from '#lib/utils/formatting.js';
@@ -52,10 +51,10 @@
return BUILT_IN_ROLE_LABELS[roleId]?.() ?? roleId.replace(/^role_/, '').replace(/_/g, ' ');
}
- const currentUser = $derived($userStore);
+ const currentUser = $derived(userStore.current);
const isOidcUser = $derived(Boolean(currentUser?.oidcSubjectId));
- const settings = fromStore(settingsStore);
+ const settings = settingsStore;
const gravatarEnabled = $derived(Boolean(settings.current?.enableGravatar));
const avatarMaxUploadSizeMb = $derived(
Number(settings.current?.avatarMaxUploadSizeMb) > 0 ? Number(settings.current?.avatarMaxUploadSizeMb) : 2
diff --git a/frontend/src/routes/(app)/account/account-preferences-panel.svelte b/frontend/src/routes/(app)/account/account-preferences-panel.svelte
index 1e76d3927..8ed9fe904 100644
--- a/frontend/src/routes/(app)/account/account-preferences-panel.svelte
+++ b/frontend/src/routes/(app)/account/account-preferences-panel.svelte
@@ -13,11 +13,11 @@
import { Switch } from '#lib/components/ui/switch/index.js';
import { DEFAULT_LANDING_PAGE, getLandingPageNavItems } from '#lib/config/navigation-config.js';
import { getMobileNavigation } from '#lib/utils/navigation.js';
- import { applyGlassEffects, applyInterfaceAnimations, applyOledMode, DEFAULT_ACCENT_COLOR } from '#lib/utils/theme.js';
+ import { applyGlassEffects, applyInterfaceAnimations, applyOledMode, DEFAULT_ACCENT_COLOR } from '#lib/utils/theme.svelte.js';
import { debounced } from '#lib/utils/ws.js';
import { m } from '#lib/paraglide/messages.js';
import { userService } from '#lib/services/user-service.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import type { UserPreferences } from '#lib/types/auth.js';
import type { ApplicationTheme, IconCatalog } from '#lib/types/settings.js';
import { DockIcon, MonitorSpeakerIcon } from '#lib/icons/index.js';
@@ -25,7 +25,7 @@
import { toast } from 'svelte-sonner';
const mobileNavigation = getMobileNavigation();
- const currentUser = $derived($userStore);
+ const currentUser = $derived(userStore.current);
const preferences = $derived(currentUser?.preferences ?? {});
const applicationThemeValue = $derived<ApplicationTheme>(preferences.applicationTheme ?? 'default');
const accentColorValue = $derived(
diff --git a/frontend/src/routes/(app)/account/account-security-panel.svelte b/frontend/src/routes/(app)/account/account-security-panel.svelte
index 5e8e7123a..73eb651e4 100644
--- a/frontend/src/routes/(app)/account/account-security-panel.svelte
+++ b/frontend/src/routes/(app)/account/account-security-panel.svelte
@@ -1,7 +1,6 @@
<script lang="ts">
import { tryCatch } from '#lib/utils/try-catch.js';
- import { fromStore } from 'svelte/store';
import { toast } from 'svelte-sonner';
import PasskeySettings from '#lib/components/auth/passkey-settings.svelte';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
@@ -9,12 +8,12 @@
import { LogoutIcon, ShieldAlertIcon } from '#lib/icons/index.js';
import { m } from '#lib/paraglide/messages.js';
import { userService } from '#lib/services/user-service.js';
- import settingsStore from '#lib/stores/config-store.js';
- import userStore from '#lib/stores/user-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
- const currentUser = $derived($userStore);
+ const currentUser = $derived(userStore.current);
const isOidcUser = $derived(Boolean(currentUser?.oidcSubjectId));
- const autoLogin = fromStore(settingsStore.autoLoginEnabled);
+ const autoLogin = settingsStore.autoLoginEnabled;
const autoLoginEnabled = $derived(autoLogin.current);
let currentPassword = $state('');
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
index 94ee458db..d7726948c 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
@@ -3,7 +3,7 @@
import { ArcaneButton, type ArcaneButtonSize } from '#lib/components/arcane-button/index.js';
import { goto, refreshAll } from '$app/navigation';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import ActionButtons from '#lib/components/action-buttons.svelte';
import { Badge } from '#lib/components/ui/badge/index.js';
import { bytes } from '#lib/utils/formatting.js';
@@ -54,7 +54,7 @@
import { imageService } from '#lib/services/image-service.js';
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { isAutoUpdateIgnored, isAutoUpdateLabelDisabled } from '#lib/utils/container-auto-update.js';
import KillContainerDialog from '../components/kill-container-dialog.svelte';
import { useUrlTab } from '#lib/hooks/use-url-tab.svelte.js';
@@ -149,7 +149,7 @@
const canConvertToCompose = $derived(
hasPermission('projects:create', currentEnvId) &&
!container?.composeInfo &&
- $settingsStore?.experimentalFeaturesEnabled === true
+ settingsStore.current?.experimentalFeaturesEnabled === true
);
const containerStatus = $derived(container?.state?.status ?? '');
const isContainerRunning = $derived(containerStatus === 'running' || !!container?.state?.running);
@@ -163,7 +163,7 @@
const imageUpdateQuery = createQuery(() => {
const environmentId = environmentStore.selected?.id;
const image = container?.image;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.images.updateInfoByRef(environmentId ?? '', image ?? ''),
queryFn: async () => {
diff --git a/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte
index c699aa1f8..8cc07a101 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte
@@ -7,7 +7,8 @@
rowsFromEditConfig,
toEditRequest
} from '#lib/components/containers/container-form/container-form-state.js';
- import { createForm } from '#lib/utils/settings.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { containerService } from '#lib/services/container-service.js';
import { queryKeys } from '#lib/query/query-keys.js';
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
diff --git a/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte b/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
index 15a1f0912..bc2b860a0 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
@@ -261,7 +261,8 @@
{m.containers_aliases()}
</div>
<div class="space-y-1 text-sm font-medium text-foreground">
- {#each rawNetworkConfig.aliases as alias, index (index)}
+ <!-- Docker may repeat aliases; these rows render only text. -->
+ {#each rawNetworkConfig.aliases as alias}
<div class="cursor-pointer font-mono break-all select-all" title={m.common_click_to_select()}>
{alias}
</div>
diff --git a/frontend/src/routes/(app)/containers/components/ContainerShell.svelte b/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
index b0cfb827c..aa4fc0a3b 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
@@ -5,7 +5,7 @@
import TerminalControls from '#lib/components/terminal/terminal-controls.svelte';
import { m } from '#lib/paraglide/messages.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { TerminalIcon } from '#lib/icons/index.js';
let {
@@ -15,7 +15,7 @@
} = $props();
let isConnected = $state(false);
- let selectedShell = $derived($settingsStore.defaultShell || '/bin/sh');
+ let selectedShell = $derived(settingsStore.current?.defaultShell || '/bin/sh');
let reconnectKey = $state(0);
const websocketUrl = $derived.by(() => {
if (!containerId || !selectedShell) return '';
diff --git a/frontend/src/routes/(app)/containers/components/ContainerStats.svelte b/frontend/src/routes/(app)/containers/components/ContainerStats.svelte
index 86cddf4bb..802f79be0 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerStats.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerStats.svelte
@@ -110,6 +110,7 @@
</div>
<Skeleton class="h-3 w-full" />
<div class="grid grid-cols-2 gap-x-4 gap-y-2">
+ <!-- Skeleton slots have fixed positions and no resource identity. -->
{#each Array(4) as _, i (i)}
<div class="flex justify-between">
<Skeleton class="h-3 w-24" />
diff --git a/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte b/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte
index c861b24ed..891653c0d 100644
--- a/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte
+++ b/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte
@@ -6,7 +6,8 @@
import * as Alert from '#lib/components/ui/alert/index.js';
import FormInput from '#lib/components/form/form-input.svelte';
import RepoTagFields from '#lib/components/form/repo-tag-fields.svelte';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { containerService } from '#lib/services/container-service.js';
import { m } from '#lib/paraglide/messages.js';
import { toast } from 'svelte-sonner';
@@ -39,7 +40,8 @@
noPause: false
});
- let { inputs, ...form } = $derived(createForm<typeof schema>(schema, formData));
+ let form = $derived(createForm<typeof schema>(schema, formData));
+ let inputs = $derived(form.inputs);
let isCommitting = $state(false);
function handleOpenChange(nextOpen: boolean) {
@@ -99,15 +101,15 @@
<InfoIcon class="size-4" />
<Alert.Description class="text-sm">{m.containers_commit_registry_note()}</Alert.Description>
</Alert.Root>
- <RepoTagFields bind:repository={$inputs.repository} bind:tag={$inputs.tag} />
+ <RepoTagFields bind:repository={inputs.repository} bind:tag={inputs.tag} />
<FormInput
label={m.common_description()}
placeholder={m.containers_commit_comment_placeholder()}
- bind:input={$inputs.comment}
+ bind:input={inputs.comment}
/>
- <FormInput label={m.common_author()} placeholder={m.arcane_placeholder()} bind:input={$inputs.author} />
+ <FormInput label={m.common_author()} placeholder={m.arcane_placeholder()} bind:input={inputs.author} />
<label class="flex items-center gap-2 text-sm">
- <input type="checkbox" bind:checked={$inputs.noPause.value} class="size-4 accent-primary" />
+ <input type="checkbox" bind:checked={inputs.noPause.value} class="size-4 accent-primary" />
<span>{m.containers_commit_no_pause()}</span>
</label>
</form>
diff --git a/frontend/src/routes/(app)/containers/container-table.svelte b/frontend/src/routes/(app)/containers/container-table.svelte
index 88e6975af..394fc8f36 100644
--- a/frontend/src/routes/(app)/containers/container-table.svelte
+++ b/frontend/src/routes/(app)/containers/container-table.svelte
@@ -35,7 +35,7 @@
import { hasAnyLoadingState } from '#lib/utils/bulk-actions.js';
import { Temporal } from 'temporal-polyfill';
import { createContainerActions } from './container-table.actions';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import {
getActionStatusMessage,
getContainerDisplayName,
@@ -208,7 +208,7 @@
const canDeleteContainers = $derived(hasPermission('containers:delete', currentEnvId));
const canKillContainers = $derived(hasPermission('containers:kill', currentEnvId));
const canConvertToCompose = $derived(
- hasPermission('projects:create', currentEnvId) && $settingsStore?.experimentalFeaturesEnabled === true
+ hasPermission('projects:create', currentEnvId) && settingsStore.current?.experimentalFeaturesEnabled === true
);
function handleBulkConvert(ids: string[]) {
diff --git a/frontend/src/routes/(app)/containers/new/+page.svelte b/frontend/src/routes/(app)/containers/new/+page.svelte
index 396869736..1d2029de2 100644
--- a/frontend/src/routes/(app)/containers/new/+page.svelte
+++ b/frontend/src/routes/(app)/containers/new/+page.svelte
@@ -7,7 +7,8 @@
emptyContainerFormValues,
toCreateRequest
} from '#lib/components/containers/container-form/container-form-state.js';
- import { createForm } from '#lib/utils/settings.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { containerService } from '#lib/services/container-service.js';
import { queryKeys } from '#lib/query/query-keys.js';
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
diff --git a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
index 5385c5a1f..1c68bd400 100644
--- a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
@@ -14,7 +14,8 @@
import { templateService } from '#lib/services/template-service.js';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
import { toast } from 'svelte-sonner';
- import { createForm } from '#lib/utils/settings.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { formatDateTimeShort } from '#lib/utils/formatting.js';
import { globalVariablesToMap } from '#lib/utils/template-load.js';
import {
@@ -71,13 +72,14 @@
envContent: originalEnv
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
const hasChanges = $derived(
- $inputs.name.value !== originalName ||
- $inputs.description.value !== originalDescription ||
- $inputs.composeContent.value !== originalCompose ||
- $inputs.envContent.value !== originalEnv
+ inputs.name.value !== originalName ||
+ inputs.description.value !== originalDescription ||
+ inputs.composeContent.value !== originalCompose ||
+ inputs.envContent.value !== originalEnv
);
// fallow-ignore-next-line code-duplication -- template editor form wiring (createForm + getTemplateEditorSaveState); hasChanges fields differ per page
const saveState = $derived(getTemplateEditorSaveState(validation, hasChanges));
@@ -111,19 +113,19 @@
function handleReset() {
resetTemplateEditorFields([
{
- set: (value) => ($inputs.name.value = value),
+ set: (value) => (inputs.name.value = value),
value: originalName
},
{
- set: (value) => ($inputs.description.value = value),
+ set: (value) => (inputs.description.value = value),
value: originalDescription
},
{
- set: (value) => ($inputs.composeContent.value = value),
+ set: (value) => (inputs.composeContent.value = value),
value: originalCompose
},
{
- set: (value) => ($inputs.envContent.value = value),
+ set: (value) => (inputs.envContent.value = value),
value: originalEnv
}
]);
@@ -240,7 +242,7 @@
{#if !template.isRemote}
<!-- Editor workspace for custom templates (same chrome as the create page) -->
<TemplateEditorWorkspace
- {inputs}
+ bind:inputs
bind:validation
{originalName}
{originalCompose}
diff --git a/frontend/src/routes/(app)/customize/templates/components/template-editor-workspace.svelte b/frontend/src/routes/(app)/customize/templates/components/template-editor-workspace.svelte
index fd897ef53..646d38e2f 100644
--- a/frontend/src/routes/(app)/customize/templates/components/template-editor-workspace.svelte
+++ b/frontend/src/routes/(app)/customize/templates/components/template-editor-workspace.svelte
@@ -6,9 +6,10 @@
import { ComposeEditorSplit } from '#lib/components/compose/index.js';
import { goto } from '$app/navigation';
import { m } from '#lib/paraglide/messages.js';
- import { preventDefault, type FormInputs } from '#lib/utils/settings.js';
+ import { preventDefault } from '#lib/utils/settings.svelte.js';
+ import type { FormInputs } from '#lib/types/form.js';
import { ArrowLeftIcon } from '#lib/icons/index.js';
- import type { Writable } from 'svelte/store';
+
import type { Snippet } from 'svelte';
interface ValidationState {
@@ -26,7 +27,7 @@
};
let {
- inputs,
+ inputs = $bindable(),
validation = $bindable(),
originalName = '',
originalCompose,
@@ -37,7 +38,7 @@
onSubmit,
toolbarActions
}: {
- inputs: Writable<FormInputs<NamedTemplateValues>>;
+ inputs: FormInputs<NamedTemplateValues>;
validation: ValidationState;
originalName?: string;
originalCompose?: string;
@@ -69,10 +70,10 @@
<div class="hidden h-4 w-px bg-border sm:block"></div>
<div class="hidden min-w-0 items-center gap-3 sm:flex">
<EditableName
- bind:value={$inputs.name.value}
+ bind:value={inputs.name.value}
bind:ref={nameInputRef}
variant="inline"
- error={$inputs.name.error ?? undefined}
+ error={inputs.name.error ?? undefined}
originalValue={originalName}
placeholder={m.templates_template_name_placeholder()}
canEdit={!saving}
@@ -92,10 +93,10 @@
<form class="flex min-h-0 flex-1 flex-col gap-4" onsubmit={preventDefault(onSubmit)}>
<div class="block flex-shrink-0 py-4 sm:hidden">
<EditableName
- bind:value={$inputs.name.value}
+ bind:value={inputs.name.value}
bind:ref={nameInputRef}
variant="block"
- error={$inputs.name.error ?? undefined}
+ error={inputs.name.error ?? undefined}
originalValue={originalName}
placeholder={m.templates_template_name_placeholder()}
canEdit={!saving}
@@ -105,7 +106,7 @@
<div class="flex-shrink-0 px-1 pt-1">
<div class="max-w-2xl">
<FormInput
- input={$inputs.description}
+ input={inputs.description}
label={m.common_description()}
placeholder={m.templates_template_description_placeholder()}
disabled={saving}
@@ -118,8 +119,8 @@
<CodePanel
title="compose.yaml"
language="yaml"
- bind:value={$inputs.composeContent.value}
- error={$inputs.composeContent.error ?? undefined}
+ bind:value={inputs.composeContent.value}
+ error={inputs.composeContent.error ?? undefined}
readOnly={saving}
bind:hasErrors={validation.composeHasErrors}
bind:validationReady={validation.composeValidationReady}
@@ -127,8 +128,8 @@
originalValue={originalCompose}
{enableDiff}
editorContext={{
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value],
+ envContent: inputs.envContent.value,
+ composeContents: [inputs.composeContent.value],
globalVariables: globalVariableMap
}}
/>
@@ -138,8 +139,8 @@
<CodePanel
title=".env"
language="env"
- bind:value={$inputs.envContent.value}
- error={$inputs.envContent.error ?? undefined}
+ bind:value={inputs.envContent.value}
+ error={inputs.envContent.error ?? undefined}
readOnly={saving}
bind:hasErrors={validation.envHasErrors}
bind:validationReady={validation.envValidationReady}
@@ -147,8 +148,8 @@
originalValue={originalEnv}
{enableDiff}
editorContext={{
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value],
+ envContent: inputs.envContent.value,
+ composeContents: [inputs.composeContent.value],
globalVariables: globalVariableMap
}}
/>
diff --git a/frontend/src/routes/(app)/customize/templates/create/+page.svelte b/frontend/src/routes/(app)/customize/templates/create/+page.svelte
index f712795a5..a7c85cbe3 100644
--- a/frontend/src/routes/(app)/customize/templates/create/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/create/+page.svelte
@@ -4,7 +4,8 @@
import { m } from '#lib/paraglide/messages.js';
import { templateService } from '#lib/services/template-service.js';
import { handleApiResultWithCallbacks } from '#lib/utils/api.js';
- import { createForm } from '#lib/utils/settings.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { tryCatch } from '#lib/utils/try-catch.js';
import { toast } from 'svelte-sonner';
import TemplateEditorWorkspace from '../components/template-editor-workspace.svelte';
@@ -37,7 +38,8 @@
envContent: ''
};
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, initialValues);
+ const form = createForm<typeof formSchema>(formSchema, initialValues);
+ let inputs = $derived(form.inputs);
const hasEditorErrors = $derived(
hasTemplateEditorErrors(
@@ -49,7 +51,7 @@
)
)
);
- const canCreate = $derived(!!$inputs.name.value && !!$inputs.composeContent.value && !hasEditorErrors && !saving);
+ const canCreate = $derived(!!inputs.name.value && !!inputs.composeContent.value && !hasEditorErrors && !saving);
async function handleCreate() {
const validated = validateTemplateEditorForm(
@@ -84,7 +86,7 @@
</script>
<TemplateEditorWorkspace
- {inputs}
+ bind:inputs
bind:validation
fileIdPrefix="templates:create"
{globalVariableMap}
diff --git a/frontend/src/routes/(app)/customize/templates/default/+page.svelte b/frontend/src/routes/(app)/customize/templates/default/+page.svelte
index df3ebe7fb..799b2918d 100644
--- a/frontend/src/routes/(app)/customize/templates/default/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/default/+page.svelte
@@ -3,7 +3,8 @@
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { toast } from 'svelte-sonner';
- import { createForm } from '#lib/utils/settings.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
import { templateService } from '#lib/services/template-service.js';
import { goto } from '$app/navigation';
@@ -46,10 +47,11 @@
envContent: originalEnvContent
});
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let form = $derived(createForm<typeof formSchema>(formSchema, formData));
+ let inputs = $derived(form.inputs);
const hasChanges = $derived(
- $inputs.composeContent.value !== originalComposeContent || $inputs.envContent.value !== originalEnvContent
+ inputs.composeContent.value !== originalComposeContent || inputs.envContent.value !== originalEnvContent
);
const saveState = $derived(getTemplateEditorSaveState(validation, hasChanges));
const validationState = $derived(saveState.validationState);
@@ -64,8 +66,8 @@
setLoading: (value) => (ui.saving = value),
onSuccess: async () => {
toast.success(m.templates_save_success());
- originalComposeContent = $inputs.composeContent.value;
- originalEnvContent = $inputs.envContent.value;
+ originalComposeContent = inputs.composeContent.value;
+ originalEnvContent = inputs.envContent.value;
}
});
}
@@ -73,11 +75,11 @@
async function handleReset() {
resetTemplateEditorFields([
{
- set: (value) => ($inputs.composeContent.value = value),
+ set: (value) => (inputs.composeContent.value = value),
value: originalComposeContent
},
{
- set: (value) => ($inputs.envContent.value = value),
+ set: (value) => (inputs.envContent.value = value),
value: originalEnvContent
}
]);
@@ -91,8 +93,8 @@
const operationResult = await tryCatch(
(async () => {
const templateContent = await templateService.getTemplateContent(template.id);
- $inputs.composeContent.value = templateContent.content ?? template.content ?? '';
- $inputs.envContent.value = templateContent.envContent ?? template.envContent ?? '';
+ inputs.composeContent.value = templateContent.content ?? template.content ?? '';
+ inputs.envContent.value = templateContent.envContent ?? template.envContent ?? '';
toast.success(m.compose_template_loaded({ name: template.name }));
})()
);
@@ -146,16 +148,16 @@
</div>
<ComposeTemplateEditor
- bind:composeValue={$inputs.composeContent.value}
- bind:envValue={$inputs.envContent.value}
+ bind:composeValue={inputs.composeContent.value}
+ bind:envValue={inputs.envContent.value}
originalCompose={originalComposeContent}
originalEnv={originalEnvContent}
bind:validation
{globalVariableMap}
fileIdPrefix="templates:defaults"
readOnly={ui.saving || ui.isLoadingTemplate}
- composeError={$inputs.composeContent.error}
- envError={$inputs.envContent.error}
+ composeError={inputs.composeContent.error}
+ envError={inputs.envContent.error}
/>
</div>
diff --git a/frontend/src/routes/(app)/customize/variables/variable-table.svelte b/frontend/src/routes/(app)/customize/variables/variable-table.svelte
index 917c9ad34..074f3ebe8 100644
--- a/frontend/src/routes/(app)/customize/variables/variable-table.svelte
+++ b/frontend/src/routes/(app)/customize/variables/variable-table.svelte
@@ -146,8 +146,8 @@
{:else}
{@const names = scopeNames(item)}
<div class="flex flex-wrap items-center gap-1">
- {#each names.slice(0, 2) as name, index (index)}
- <Badge variant="outline" size="sm" class="max-w-40 truncate">{name}</Badge>
+ {#each item.environmentIds.slice(0, 2) as environmentId (environmentId)}
+ <Badge variant="outline" size="sm" class="max-w-40 truncate">{envNameById.get(environmentId) ?? environmentId}</Badge>
{/each}
{#if names.length > 2}
<Badge variant="gray" size="sm">{m.plus_count({ count: names.length - 2 })}</Badge>
diff --git a/frontend/src/routes/(app)/dashboard/+page.svelte b/frontend/src/routes/(app)/dashboard/+page.svelte
index 5bbb2023a..b4b6f4fed 100644
--- a/frontend/src/routes/(app)/dashboard/+page.svelte
+++ b/frontend/src/routes/(app)/dashboard/+page.svelte
@@ -1,9 +1,8 @@
<script lang="ts">
import type { PageProps } from './$types';
- import { createSubscriber } from 'svelte/reactivity';
- import { get } from 'svelte/store';
+
import DashboardAllEnvironmentsView from './dashboard-all-environments-view.svelte';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { Temporal } from 'temporal-polyfill';
@@ -11,19 +10,7 @@
const debugAllGood = $derived(data.debugAllGood ?? false);
- const subscribeToUser = createSubscriber((update) => {
- let initialized = false;
- return userStore.subscribe(() => {
- if (initialized) {
- update();
- }
- initialized = true;
- });
- });
- const currentUser = $derived.by(() => {
- subscribeToUser();
- return get(userStore);
- });
+ const currentUser = $derived(userStore.current);
const greetingBase = $derived.by(() => {
const hour = Temporal.Now.zonedDateTimeISO().hour;
diff --git a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
index 7567faea1..10dfb55cb 100644
--- a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
+++ b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
@@ -15,7 +15,7 @@
import { activityStore } from '#lib/stores/activity.store.svelte.js';
import { dashboardStore } from '#lib/stores/dashboard.store.svelte.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { hasAnyPermission, hasPermission } from '#lib/utils/auth.js';
import type {
DashboardActionItemKind,
@@ -111,7 +111,7 @@
let dockerInfoPromiseByEnvironmentId = $state<Record<string, Promise<DockerInfo> | undefined>>({});
const availableEnvironments = $derived.by(() => {
- if (!$userStore) {
+ if (!userStore.current) {
return [];
}
diff --git a/frontend/src/routes/(app)/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelte
index 6937ba487..ada0eb0b1 100644
--- a/frontend/src/routes/(app)/environments/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/+page.svelte
@@ -431,7 +431,7 @@
function handleShellSelectChange(value: string) {
if (value !== 'custom') {
- $formInputs.defaultShell.value = value;
+ formInputs.defaultShell.value = value;
}
}
@@ -513,7 +513,7 @@
const operationResult = await tryCatch(
(async () => {
isTestingConnection = true;
- const customUrl = $formInputs.apiUrl.value !== environment.apiUrl ? $formInputs.apiUrl.value : undefined;
+ const customUrl = formInputs.apiUrl.value !== environment.apiUrl ? formInputs.apiUrl.value : undefined;
const result = await environmentManagementService.testConnection(environment.id, customUrl);
const nextStatus = result.status as EnvironmentStatus;
@@ -592,10 +592,10 @@
<div class="min-w-0 flex-1">
<div class="flex min-h-9 min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
<EditableName
- bind:value={$formInputs.name.value}
+ bind:value={formInputs.name.value}
bind:ref={nameInputRef}
variant="inline"
- error={$formInputs.name.error ?? undefined}
+ error={formInputs.name.error ?? undefined}
originalValue={environment.name}
placeholder={m.environments_name_placeholder()}
class="max-w-[14rem] min-w-0 sm:max-w-[20rem] md:max-w-[26rem]"
@@ -607,26 +607,26 @@
<div
class={cn(
'size-2 rounded-full transition-colors',
- $formInputs.enabled.value
+ formInputs.enabled.value
? 'bg-emerald-500 shadow-[0_0_8px_var(--color-emerald-500)]'
: 'bg-muted-foreground/40'
)}
></div>
<span class="text-sm font-medium">
- {$formInputs.enabled.value ? m.common_enabled() : m.common_disabled()}
+ {formInputs.enabled.value ? m.common_enabled() : m.common_disabled()}
</span>
</div>
{#if environment.id === '0'}
<ArcaneTooltip.Root>
<ArcaneTooltip.Trigger>
- <Switch id="env-enabled-header" disabled={true} bind:checked={$formInputs.enabled.value} />
+ <Switch id="env-enabled-header" disabled={true} bind:checked={formInputs.enabled.value} />
</ArcaneTooltip.Trigger>
<ArcaneTooltip.Content>
<p>{m.environments_local_setting_disabled()}</p>
</ArcaneTooltip.Content>
</ArcaneTooltip.Root>
{:else}
- <Switch id="env-enabled-header" bind:checked={$formInputs.enabled.value} />
+ <Switch id="env-enabled-header" bind:checked={formInputs.enabled.value} />
{/if}
</div>
</div>
@@ -635,8 +635,8 @@
<Input
id="api-url"
type="url"
- bind:value={$formInputs.apiUrl.value}
- class="h-7 w-full max-w-md font-mono text-xs {$formInputs.apiUrl.error ? 'border-destructive' : ''}"
+ bind:value={formInputs.apiUrl.value}
+ class="h-7 w-full max-w-md font-mono text-xs {formInputs.apiUrl.error ? 'border-destructive' : ''}"
placeholder={m.environments_api_url_placeholder()}
autofocus
onkeydown={(e) => {
@@ -645,7 +645,7 @@
isEditingApiUrl = false;
}
if (e.key === 'Escape') {
- $formInputs.apiUrl.value = environment.apiUrl;
+ formInputs.apiUrl.value = environment.apiUrl;
isEditingApiUrl = false;
}
}}
@@ -654,7 +654,7 @@
{:else if environment.id === '0'}
<ArcaneTooltip.Root>
<ArcaneTooltip.Trigger class="min-w-0">
- <span class="block truncate px-1 font-mono text-xs text-muted-foreground">{$formInputs.apiUrl.value}</span>
+ <span class="block truncate px-1 font-mono text-xs text-muted-foreground">{formInputs.apiUrl.value}</span>
</ArcaneTooltip.Trigger>
<ArcaneTooltip.Content>
<p>{m.environments_local_setting_disabled()}</p>
@@ -667,13 +667,13 @@
title={m.environments_api_url()}
onclick={() => (isEditingApiUrl = true)}
>
- {$formInputs.apiUrl.value || m.environments_api_url_placeholder()}
+ {formInputs.apiUrl.value || m.environments_api_url_placeholder()}
</button>
{/if}
- <CopyButton text={$formInputs.apiUrl.value} size="icon" class="size-6 shrink-0" />
+ <CopyButton text={formInputs.apiUrl.value} size="icon" class="size-6 shrink-0" />
</div>
- {#if $formInputs.apiUrl.error}
- <p class="mt-1 text-xs text-destructive">{$formInputs.apiUrl.error}</p>
+ {#if formInputs.apiUrl.error}
+ <p class="mt-1 text-xs text-destructive">{formInputs.apiUrl.error}</p>
{/if}
</div>
</div>
@@ -780,11 +780,11 @@
{#if showSettingsTabs}
<Tabs.Content value="storage">
- <StorageTab {formInputs} />
+ <StorageTab bind:formInputs />
</Tabs.Content>
<Tabs.Content value="docker">
- <DockerTab {formInputs} environmentId={environment.id} {shellSelectValue} {handleShellSelectChange} {shellOptions} />
+ <DockerTab bind:formInputs environmentId={environment.id} {shellSelectValue} {handleShellSelectChange} {shellOptions} />
</Tabs.Content>
<Tabs.Content value="security">
@@ -799,19 +799,19 @@
/>
</div>
<Tabs.Content value="trivy">
- <TrivySecuritySettings {formInputs} environmentId={environment.id} />
+ <TrivySecuritySettings bind:formInputs environmentId={environment.id} />
</Tabs.Content>
<Tabs.Content value="patching">
- <ImagePatchSettings {formInputs} />
+ <ImagePatchSettings bind:formInputs />
</Tabs.Content>
<Tabs.Content value="lifecycle">
- <LifecycleSecuritySettings {formInputs} />
+ <LifecycleSecuritySettings bind:formInputs />
</Tabs.Content>
</Tabs.Root>
</Tabs.Content>
<Tabs.Content value="jobs">
- <JobsTab {formInputs} environmentId={environment.id} />
+ <JobsTab bind:formInputs environmentId={environment.id} />
</Tabs.Content>
{/if}
diff --git a/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte b/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte
index 708a99f12..1e3374add 100644
--- a/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte
@@ -10,7 +10,13 @@
import type { DockerTabProps } from './tab-props';
import { arcaneImageRegistryOptions, arcaneToolsImage, arcaneUpdateCheckImage } from '#lib/utils/registry.js';
- let { formInputs, environmentId, shellSelectValue, handleShellSelectChange, shellOptions }: DockerTabProps = $props();
+ let {
+ formInputs = $bindable(),
+ environmentId,
+ shellSelectValue,
+ handleShellSelectChange,
+ shellOptions
+ }: DockerTabProps = $props();
const deployPullPolicyOptions = [
{ value: 'missing', label: 'Missing', description: m.deploy_pull_policy_missing() },
@@ -19,7 +25,7 @@
];
const registryOptions = arcaneImageRegistryOptions();
- const updateCheckImage = $derived(arcaneUpdateCheckImage($formInputs.updateCheckRegistry.value, environmentId === '0'));
+ const updateCheckImage = $derived(arcaneUpdateCheckImage(formInputs.updateCheckRegistry.value, environmentId === '0'));
const pruneContainerModes = [
{ value: 'none', label: m.none() },
@@ -76,8 +82,8 @@
{#if shellSelectValue === 'custom'}
<div class="pt-2">
<TextInputWithLabel
- bind:value={$formInputs.defaultShell.value}
- error={$formInputs.defaultShell.error}
+ bind:value={formInputs.defaultShell.value}
+ error={formInputs.defaultShell.error}
label={m.custom()}
placeholder={m.bin_sh_placeholder()}
helpText={m.docker_shell_custom_path_help()}
@@ -91,11 +97,11 @@
<SelectWithLabel
id="defaultDeployPullPolicy"
name="defaultDeployPullPolicy"
- bind:value={$formInputs.defaultDeployPullPolicy.value}
+ bind:value={formInputs.defaultDeployPullPolicy.value}
label={m.settings_default_deploy_pull_policy()}
description={m.settings_default_deploy_pull_policy_description()}
options={deployPullPolicyOptions}
- onValueChange={(v) => ($formInputs.defaultDeployPullPolicy.value = v as 'missing' | 'always' | 'never')}
+ onValueChange={(v) => (formInputs.defaultDeployPullPolicy.value = v as 'missing' | 'always' | 'never')}
/>
</div>
@@ -103,24 +109,24 @@
<SelectWithLabel
id="toolsImageRegistry"
name="toolsImageRegistry"
- bind:value={$formInputs.toolsImageRegistry.value}
+ bind:value={formInputs.toolsImageRegistry.value}
label={m.tools_image_registry_label()}
description={m.tools_image_registry_description()}
options={registryOptions}
- onValueChange={(v) => ($formInputs.toolsImageRegistry.value = v as 'ghcr.io' | 'docker.io')}
+ onValueChange={(v) => (formInputs.toolsImageRegistry.value = v as 'ghcr.io' | 'docker.io')}
/>
- <p class="font-mono text-xs text-muted-foreground">{arcaneToolsImage($formInputs.toolsImageRegistry.value)}</p>
+ <p class="font-mono text-xs text-muted-foreground">{arcaneToolsImage(formInputs.toolsImageRegistry.value)}</p>
</div>
<div class="space-y-2">
<SelectWithLabel
id="updateCheckRegistry"
name="updateCheckRegistry"
- bind:value={$formInputs.updateCheckRegistry.value}
+ bind:value={formInputs.updateCheckRegistry.value}
label={m.update_check_registry_label()}
description={m.update_check_registry_description()}
options={[{ value: 'auto', label: m.auto() }, ...registryOptions]}
- onValueChange={(v) => ($formInputs.updateCheckRegistry.value = v as 'auto' | 'ghcr.io' | 'docker.io')}
+ onValueChange={(v) => (formInputs.updateCheckRegistry.value = v as 'auto' | 'ghcr.io' | 'docker.io')}
/>
<p class="text-xs text-muted-foreground {updateCheckImage ? 'font-mono' : ''}">
{updateCheckImage ?? m.follows_running_image()}
@@ -130,15 +136,15 @@
<TextInputWithLabel
id="base-server-url"
label={m.general_base_url_label()}
- bind:value={$formInputs.baseServerUrl.value}
- error={$formInputs.baseServerUrl.error}
+ bind:value={formInputs.baseServerUrl.value}
+ error={formInputs.baseServerUrl.error}
helpText={m.general_base_url_help()}
/>
</div>
<div class="border-t pt-6">
<SettingsRow layout="inline" label={m.docker_auto_inject_env_label()} description={m.docker_auto_inject_env_description()}>
- <Switch id="auto-inject-env" bind:checked={$formInputs.autoInjectEnv.value} />
+ <Switch id="auto-inject-env" bind:checked={formInputs.autoInjectEnv.value} />
</SettingsRow>
</div>
@@ -153,21 +159,21 @@
title={m.containers()}
description={m.scheduled_prune_containers_description()}
modeOptions={pruneContainerModes}
- bind:value={$formInputs.pruneContainerMode.value}
- bind:untilValue={$formInputs.pruneContainerUntil.value}
+ bind:value={formInputs.pruneContainerMode.value}
+ bind:untilValue={formInputs.pruneContainerUntil.value}
/>
<PruneModeCard
title={m.images()}
description={m.scheduled_prune_images_description()}
modeOptions={pruneImageModes}
- bind:value={$formInputs.pruneImageMode.value}
- bind:untilValue={$formInputs.pruneImageUntil.value}
+ bind:value={formInputs.pruneImageMode.value}
+ bind:untilValue={formInputs.pruneImageUntil.value}
/>
<PruneModeCard
title={m.resource_volumes_cap()}
description={m.scheduled_prune_volumes_description()}
modeOptions={pruneVolumeModes}
- bind:value={$formInputs.pruneVolumeMode.value}
+ bind:value={formInputs.pruneVolumeMode.value}
warningTitle={m.prune_volumes_warning_title()}
warningDescription={m.scheduled_prune_volumes_warning()}
/>
@@ -175,15 +181,15 @@
title={m.resource_networks_cap()}
description={m.scheduled_prune_networks_description()}
modeOptions={pruneNetworkModes}
- bind:value={$formInputs.pruneNetworkMode.value}
- bind:untilValue={$formInputs.pruneNetworkUntil.value}
+ bind:value={formInputs.pruneNetworkMode.value}
+ bind:untilValue={formInputs.pruneNetworkUntil.value}
/>
<PruneModeCard
title={m.build_cache()}
description={m.scheduled_prune_build_cache_description()}
modeOptions={pruneBuildCacheModes}
- bind:value={$formInputs.pruneBuildCacheMode.value}
- bind:untilValue={$formInputs.pruneBuildCacheUntil.value}
+ bind:value={formInputs.pruneBuildCacheMode.value}
+ bind:untilValue={formInputs.pruneBuildCacheUntil.value}
/>
</div>
</div>
diff --git a/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte b/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte
index 75c6e08f5..7a8cda5cf 100644
--- a/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte
@@ -24,7 +24,7 @@
parseExcludedContainerSet
} from '#lib/utils/container-auto-update.js';
- let { formInputs, environmentId }: JobsTabProps = $props();
+ let { formInputs = $bindable(), environmentId }: JobsTabProps = $props();
const jobsQuery = createQuery(() => ({
queryKey: queryKeys.jobs.list(environmentId),
@@ -48,7 +48,7 @@
const containersPromise = $derived.by(async () => {
if (!environmentId) return [];
- if (!$formInputs.autoUpdate.value && !$formInputs.autoHealEnabled.value) return [];
+ if (!formInputs.autoUpdate.value && !formInputs.autoHealEnabled.value) return [];
const result = await tryCatch(
containerService.getContainersForEnvironment(environmentId, { pagination: { page: 1, limit: 100 } })
);
@@ -72,7 +72,7 @@
}
const excludedContainers = $derived.by(() => {
- return parseExcludedContainerSet($formInputs.autoUpdateExcludedContainers?.value);
+ return parseExcludedContainerSet(formInputs.autoUpdateExcludedContainers?.value);
});
function resolveSettingsUrl(_job: JobStatus, prereq: JobPrerequisite): string | undefined {
@@ -100,18 +100,18 @@
}
function toggleContainerExclusion(containerName: string) {
- if ($formInputs.autoUpdateExcludedContainers) {
- $formInputs.autoUpdateExcludedContainers.value = toggleExcludedContainerValue(excludedContainers, containerName);
+ if (formInputs.autoUpdateExcludedContainers) {
+ formInputs.autoUpdateExcludedContainers.value = toggleExcludedContainerValue(excludedContainers, containerName);
}
}
const autoHealExcludedContainers = $derived.by(() => {
- return parseExcludedContainerSet($formInputs.autoHealExcludedContainers?.value);
+ return parseExcludedContainerSet(formInputs.autoHealExcludedContainers?.value);
});
function toggleAutoHealContainerExclusion(containerName: string) {
- if ($formInputs.autoHealExcludedContainers) {
- $formInputs.autoHealExcludedContainers.value = toggleExcludedContainerValue(autoHealExcludedContainers, containerName);
+ if (formInputs.autoHealExcludedContainers) {
+ formInputs.autoHealExcludedContainers.value = toggleExcludedContainerValue(autoHealExcludedContainers, containerName);
}
}
@@ -145,15 +145,15 @@
function getEnabledOverride(job: JobStatus): boolean | undefined {
switch (job.id) {
case 'scheduled-prune':
- return $formInputs.scheduledPruneEnabled.value;
+ return formInputs.scheduledPruneEnabled.value;
case 'auto-update':
- return $formInputs.autoUpdate.value;
+ return formInputs.autoUpdate.value;
case 'image-polling':
- return $formInputs.pollingEnabled.value;
+ return formInputs.pollingEnabled.value;
case 'vulnerability-scan':
- return $formInputs.vulnerabilityScanEnabled.value;
+ return formInputs.vulnerabilityScanEnabled.value;
case 'auto-heal':
- return $formInputs.autoHealEnabled.value;
+ return formInputs.autoHealEnabled.value;
default:
return undefined;
}
@@ -195,7 +195,7 @@
{/snippet}
{#snippet autoUpdateSettings(job: JobStatus)}
- {#if job.id === 'auto-update' && $formInputs.autoUpdate.value}
+ {#if job.id === 'auto-update' && formInputs.autoUpdate.value}
<div class="space-y-3 border-t border-border/20 pt-3">
<div class="space-y-1">
<Label class="text-sm font-medium">
@@ -230,7 +230,7 @@
<Label class="text-sm font-medium">{m.jobs_image_event_watcher_label()}</Label>
<p class="text-xs text-muted-foreground">{m.jobs_image_event_watcher_description()}</p>
</div>
- <Switch id="image-event-watcher-enabled" bind:checked={$formInputs.imageEventWatcherEnabled.value} />
+ <Switch id="image-event-watcher-enabled" bind:checked={formInputs.imageEventWatcherEnabled.value} />
</div>
<Alert.Root variant="warning" class="py-2 [&>svg]:top-2">
<AlertTriangleIcon class="size-4" />
@@ -241,7 +241,7 @@
{/snippet}
{#snippet autoHealSettings(job: JobStatus)}
- {#if job.id === 'auto-heal' && $formInputs.autoHealEnabled.value}
+ {#if job.id === 'auto-heal' && formInputs.autoHealEnabled.value}
<div class="space-y-3 border-t border-border/20 pt-3">
<div class="grid gap-3 sm:grid-cols-2">
<div class="space-y-1">
@@ -252,7 +252,7 @@
type="number"
min="1"
class="h-8 w-full"
- bind:value={$formInputs.autoHealMaxRestarts.value}
+ bind:value={formInputs.autoHealMaxRestarts.value}
/>
</div>
<div class="space-y-1">
@@ -263,7 +263,7 @@
type="number"
min="1"
class="h-8 w-full"
- bind:value={$formInputs.autoHealRestartWindow.value}
+ bind:value={formInputs.autoHealRestartWindow.value}
/>
</div>
</div>
@@ -295,15 +295,15 @@
{#snippet jobEnableControl(job: JobStatus)}
{#if job.id === 'image-polling'}
- <Switch aria-label={job.name} bind:checked={$formInputs.pollingEnabled.value} />
+ <Switch aria-label={job.name} bind:checked={formInputs.pollingEnabled.value} />
{:else if job.id === 'auto-update'}
- <Switch aria-label={job.name} bind:checked={$formInputs.autoUpdate.value} disabled={!$formInputs.pollingEnabled.value} />
+ <Switch aria-label={job.name} bind:checked={formInputs.autoUpdate.value} disabled={!formInputs.pollingEnabled.value} />
{:else if job.id === 'scheduled-prune'}
- <Switch aria-label={job.name} bind:checked={$formInputs.scheduledPruneEnabled.value} />
+ <Switch aria-label={job.name} bind:checked={formInputs.scheduledPruneEnabled.value} />
{:else if job.id === 'vulnerability-scan'}
- <Switch aria-label={job.name} bind:checked={$formInputs.vulnerabilityScanEnabled.value} />
+ <Switch aria-label={job.name} bind:checked={formInputs.vulnerabilityScanEnabled.value} />
{:else if job.id === 'auto-heal'}
- <Switch aria-label={job.name} bind:checked={$formInputs.autoHealEnabled.value} />
+ <Switch aria-label={job.name} bind:checked={formInputs.autoHealEnabled.value} />
{/if}
{/snippet}
@@ -316,8 +316,8 @@
onScheduleUpdate={loadJobs}
enabledOverride={capabilityUnknown ? undefined : getEnabledOverride(job)}
collapsibleSettings={job.id === 'image-polling' ||
- (job.id === 'auto-update' && $formInputs.autoUpdate.value) ||
- (job.id === 'auto-heal' && $formInputs.autoHealEnabled.value)}
+ (job.id === 'auto-update' && formInputs.autoUpdate.value) ||
+ (job.id === 'auto-heal' && formInputs.autoHealEnabled.value)}
>
{#snippet headerAccessory()}
{@render jobEnableControl(job)}
diff --git a/frontend/src/routes/(app)/environments/[id]/components/StorageTab.svelte b/frontend/src/routes/(app)/environments/[id]/components/StorageTab.svelte
index 92c4130f3..88efb3e7e 100644
--- a/frontend/src/routes/(app)/environments/[id]/components/StorageTab.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/components/StorageTab.svelte
@@ -7,7 +7,7 @@
import { FolderOpenIcon, UploadIcon } from '#lib/icons/index.js';
import type { StorageTabProps } from './tab-props';
- let { formInputs }: StorageTabProps = $props();
+ let { formInputs = $bindable() }: StorageTabProps = $props();
</script>
<div class="space-y-6">
@@ -25,29 +25,29 @@
<TextInputWithLabel
id="projects-directory"
label={m.general_projects_directory_label()}
- bind:value={$formInputs.projectsDirectory.value}
- error={$formInputs.projectsDirectory.error}
+ bind:value={formInputs.projectsDirectory.value}
+ error={formInputs.projectsDirectory.error}
helpText={m.general_projects_directory_help()}
/>
<TextInputWithLabel
id="templates-directory"
label={m.general_templates_directory_label()}
- bind:value={$formInputs.templatesDirectory.value}
- error={$formInputs.templatesDirectory.error}
+ bind:value={formInputs.templatesDirectory.value}
+ error={formInputs.templatesDirectory.error}
helpText={m.general_templates_directory_help()}
/>
<TextInputWithLabel
id="swarm-stack-sources-directory"
label={m.environments_swarm_stack_source_label()}
- bind:value={$formInputs.swarmStackSourcesDirectory.value}
- error={$formInputs.swarmStackSourcesDirectory.error}
+ bind:value={formInputs.swarmStackSourcesDirectory.value}
+ error={formInputs.swarmStackSourcesDirectory.error}
helpText={m.environments_swarm_stack_source_help()}
/>
<TextInputWithLabel
id="disk-usage-path"
label={m.disk_usage_settings()}
- bind:value={$formInputs.diskUsagePath.value}
- error={$formInputs.diskUsagePath.error}
+ bind:value={formInputs.diskUsagePath.value}
+ error={formInputs.diskUsagePath.error}
helpText={m.disk_usage_settings_description()}
/>
</div>
@@ -58,7 +58,7 @@
label={m.general_follow_project_symlinks_label()}
description={m.general_follow_project_symlinks_help()}
>
- <Switch id="follow-project-symlinks" bind:checked={$formInputs.followProjectSymlinks.value} />
+ <Switch id="follow-project-symlinks" bind:checked={formInputs.followProjectSymlinks.value} />
</SettingsRow>
</div>
</Card.Content>
@@ -79,8 +79,8 @@
id="max-upload-size"
type="number"
label={m.docker_max_upload_size_label()}
- bind:value={$formInputs.maxImageUploadSize.value}
- error={$formInputs.maxImageUploadSize.error}
+ bind:value={formInputs.maxImageUploadSize.value}
+ error={formInputs.maxImageUploadSize.error}
helpText={m.docker_max_upload_size_description()}
/>
</div>
@@ -95,24 +95,24 @@
id="git-sync-max-files"
type="number"
label={m.git_sync_max_files_label()}
- bind:value={$formInputs.gitSyncMaxFiles.value}
- error={$formInputs.gitSyncMaxFiles.error}
+ bind:value={formInputs.gitSyncMaxFiles.value}
+ error={formInputs.gitSyncMaxFiles.error}
helpText={m.git_sync_max_files_help()}
/>
<TextInputWithLabel
id="git-sync-max-total-size"
type="number"
label={m.git_sync_max_total_size_label()}
- bind:value={$formInputs.gitSyncMaxTotalSizeMb.value}
- error={$formInputs.gitSyncMaxTotalSizeMb.error}
+ bind:value={formInputs.gitSyncMaxTotalSizeMb.value}
+ error={formInputs.gitSyncMaxTotalSizeMb.error}
helpText={m.git_sync_max_total_size_help()}
/>
<TextInputWithLabel
id="git-sync-max-binary-size"
type="number"
label={m.git_sync_max_binary_size_label()}
- bind:value={$formInputs.gitSyncMaxBinarySizeMb.value}
- error={$formInputs.gitSyncMaxBinarySizeMb.error}
+ bind:value={formInputs.gitSyncMaxBinarySizeMb.value}
+ error={formInputs.gitSyncMaxBinarySizeMb.error}
helpText={m.git_sync_max_binary_size_help()}
/>
</div>
diff --git a/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts b/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts
index 752d66d1b..675d581b1 100644
--- a/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts
+++ b/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts
@@ -1,9 +1,8 @@
-import type { Writable } from 'svelte/store';
-import type { FormInputs } from '#lib/utils/settings.js';
+import type { FormInputs } from '#lib/types/form.js';
import type { Environment, EnvironmentStatus } from '#lib/types/environment.js';
import type { EnvironmentFormValues } from './environment-form-schema';
-export type EnvironmentFormInputs = Writable<FormInputs<EnvironmentFormValues>>;
+export type EnvironmentFormInputs = FormInputs<EnvironmentFormValues>;
export interface ConnectionEdgeTabProps {
environment: Environment;
diff --git a/frontend/src/routes/(app)/images/[imageId]/+page.svelte b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
index ecafb3690..61f118d48 100644
--- a/frontend/src/routes/(app)/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
@@ -10,7 +10,7 @@
import { onMount, onDestroy, tick } from 'svelte';
import { createQuery, useQueryClient } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { m } from '#lib/paraglide/messages.js';
import { imageService } from '#lib/services/image-service.js';
@@ -83,7 +83,7 @@
const scanQuery = createQuery(() => {
const environmentId = currentEnvId;
const imageId = image?.id;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.vulnerabilities.scanResult(environmentId, imageId ?? ''),
queryFn: async () => {
diff --git a/frontend/src/routes/(app)/images/[imageId]/image-history-panel.svelte b/frontend/src/routes/(app)/images/[imageId]/image-history-panel.svelte
index f4e81d823..7407f27eb 100644
--- a/frontend/src/routes/(app)/images/[imageId]/image-history-panel.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/image-history-panel.svelte
@@ -2,7 +2,7 @@
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
import * as Card from '#lib/components/ui/card/index.js';
@@ -18,7 +18,7 @@
const historyQuery = createQuery(() => {
const environmentId = environmentStore.selected?.id;
const requestedImageId = imageId;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.images.history(environmentId ?? '', requestedImageId),
queryFn: async () => {
diff --git a/frontend/src/routes/(app)/images/builds/+page.svelte b/frontend/src/routes/(app)/images/builds/+page.svelte
index 6c11683ac..bc12a5ddc 100644
--- a/frontend/src/routes/(app)/images/builds/+page.svelte
+++ b/frontend/src/routes/(app)/images/builds/+page.svelte
@@ -5,8 +5,9 @@
import { z } from 'zod/v4';
import * as Tabs from '#lib/components/ui/tabs/index.js';
import { m } from '#lib/paraglide/messages.js';
- import settingsStore from '#lib/stores/config-store.js';
- import { createForm } from '#lib/utils/settings.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { isDepotBuildAvailable } from '#lib/utils/build-provider.js';
import { toast } from 'svelte-sonner';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
@@ -39,7 +40,7 @@
isGitBuildContextSource
} from './image-build-history';
- const buildsRoot = $derived((($settingsStore?.buildsDirectory ?? '/builds') as string).trim() || '/builds');
+ const buildsRoot = $derived(((settingsStore.current?.buildsDirectory ?? '/builds') as string).trim() || '/builds');
const buildsRootLabel = $derived.by(() => {
const raw = buildsRoot.trim();
if (!raw) return '/builds';
@@ -50,7 +51,7 @@
return `…/${tail}`;
});
- const depotAvailable = $derived(isDepotBuildAvailable($settingsStore));
+ const depotAvailable = $derived(isDepotBuildAvailable(settingsStore.current));
const providerOptions = $derived.by<BuildProviderOption[]>(() => {
const options: BuildProviderOption[] = [
@@ -105,7 +106,7 @@
load: z.boolean().default(true)
});
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, {
+ const form = createForm<typeof formSchema>(formSchema, {
dockerfile: '',
tags: '',
registryId: '',
@@ -126,10 +127,11 @@
platforms: '',
noCache: false,
pull: false,
- provider: ($settingsStore?.buildProvider as 'local' | 'depot') ?? 'local',
+ provider: (settingsStore.current?.buildProvider as 'local' | 'depot') ?? 'local',
push: false,
load: true
});
+ let inputs = $derived(form.inputs);
let isBuilding = $state(false);
let isDesktop = $state(true);
@@ -150,8 +152,8 @@
const selectedEnvId = $derived(environmentStore.selected?.id || '0');
const queryClient = useQueryClient();
- const resolvedProvider = $derived(depotAvailable ? $inputs.provider.value : 'local');
- const isPushMode = $derived(resolvedProvider === 'depot' ? true : $inputs.push.value);
+ const resolvedProvider = $derived(depotAvailable ? inputs.provider.value : 'local');
+ const isPushMode = $derived(resolvedProvider === 'depot' ? true : inputs.push.value);
const registryRequestOptions = {
pagination: { page: 1, limit: 100 },
@@ -179,7 +181,7 @@
})
);
- const selectedRegistry = $derived(registries.find((registry) => registry.id === $inputs.registryId.value));
+ const selectedRegistry = $derived(registries.find((registry) => registry.id === inputs.registryId.value));
const repositoryOptions = $derived<SelectOption[]>(
(selectedRegistry?.repositoryNames ?? []).map((name) => ({ label: name, value: name }))
@@ -187,7 +189,7 @@
const fullImageReference = $derived(
isPushMode && selectedRegistry
- ? buildImageReference(selectedRegistry.url, $inputs.repositoryName.value, $inputs.pushTag.value)
+ ? buildImageReference(selectedRegistry.url, inputs.repositoryName.value, inputs.pushTag.value)
: ''
);
@@ -616,7 +618,7 @@
{#snippet configPanel()}
<BuildConfigPanel
- {inputs}
+ bind:inputs
provider={resolvedProvider}
bind:showAdvanced
{isPushMode}
@@ -662,7 +664,7 @@
</Tabs.List>
<div class="flex items-center gap-3 pr-2">
- <BuildControls {inputs} provider={resolvedProvider} {providerOptions} {isBuilding} onBuild={handleSubmit} />
+ <BuildControls bind:inputs provider={resolvedProvider} {providerOptions} {isBuilding} onBuild={handleSubmit} />
<div class="hidden h-4 w-px bg-border xl:block"></div>
<div class="flex items-center gap-2">
<div class="relative flex items-center">
@@ -771,7 +773,7 @@
{#snippet headerActions()}
{#if mainTab === 'build'}
- <BuildControls {inputs} provider={resolvedProvider} {providerOptions} {isBuilding} onBuild={handleSubmit} />
+ <BuildControls bind:inputs provider={resolvedProvider} {providerOptions} {isBuilding} onBuild={handleSubmit} />
{/if}
{/snippet}
@@ -791,7 +793,7 @@
</div>
{/snippet}
{#snippet headerActions()}
- <BuildControls {inputs} provider={resolvedProvider} {providerOptions} {isBuilding} onBuild={handleSubmit} />
+ <BuildControls bind:inputs provider={resolvedProvider} {providerOptions} {isBuilding} onBuild={handleSubmit} />
{/snippet}
{#snippet tabContent(buildTabValue)}
{#if buildTabValue === 'workspace'}
diff --git a/frontend/src/routes/(app)/images/builds/components/build-config-panel.svelte b/frontend/src/routes/(app)/images/builds/components/build-config-panel.svelte
index 3ea4fec8e..6034452d1 100644
--- a/frontend/src/routes/(app)/images/builds/components/build-config-panel.svelte
+++ b/frontend/src/routes/(app)/images/builds/components/build-config-panel.svelte
@@ -3,12 +3,13 @@
import { ArrowDownIcon } from '#lib/icons/index.js';
import FormInput from '#lib/components/form/form-input.svelte';
import SelectWithLabel from '#lib/components/form/select-with-label.svelte';
- import { preventDefault } from '#lib/utils/settings.js';
+ import { preventDefault } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
- import type { BuildFormInputsStore, SelectOption } from './build-form.types';
+ import type { BuildFormInputs, SelectOption } from './build-form.types';
let {
- inputs,
+ inputs = $bindable(),
provider,
showAdvanced = $bindable(false),
isPushMode = false,
@@ -18,7 +19,7 @@
registryLoadFailed = false,
onSubmit
}: {
- inputs: BuildFormInputsStore;
+ inputs: BuildFormInputs;
provider: 'local' | 'depot';
showAdvanced?: boolean;
isPushMode?: boolean;
@@ -45,11 +46,11 @@
description={!registryLoadFailed && registryOptions.length === 0 ? m.registries_none_enabled() : undefined}
error={registryLoadFailed ? m.registries_no_list_permission() : null}
bind:value={
- () => $inputs.registryId.value,
+ () => inputs.registryId.value,
(value) => {
- if (value === $inputs.registryId.value) return;
- $inputs.registryId.value = value;
- $inputs.repositoryName.value = '';
+ if (value === inputs.registryId.value) return;
+ inputs.registryId.value = value;
+ inputs.repositoryName.value = '';
}
}
/>
@@ -59,13 +60,13 @@
label={m.repository_name()}
placeholder={m.select_a_repository_name()}
options={repositoryOptions}
- description={$inputs.registryId.value && !registryLoadFailed && repositoryOptions.length === 0
+ description={inputs.registryId.value && !registryLoadFailed && repositoryOptions.length === 0
? m.registries_no_repository_names()
: undefined}
- bind:value={$inputs.repositoryName.value}
+ bind:value={inputs.repositoryName.value}
/>
- <FormInput label={m.tag()} type="text" placeholder={m.tag_placeholder()} bind:input={$inputs.pushTag} />
+ <FormInput label={m.tag()} type="text" placeholder={m.tag_placeholder()} bind:input={inputs.pushTag} />
{#if fullImageReference}
<div class="space-y-1">
@@ -81,7 +82,7 @@
type="text"
placeholder={m.image_tags_placeholder()}
description={m.image_tags_description()}
- bind:input={$inputs.tags}
+ bind:input={inputs.tags}
/>
{/if}
@@ -101,7 +102,7 @@
type="text"
placeholder={m.dockerfile()}
description={m.dockerfile_description()}
- bind:input={$inputs.dockerfile}
+ bind:input={inputs.dockerfile}
/>
<FormInput
@@ -109,7 +110,7 @@
type="text"
placeholder={m.target_placeholder()}
description={m.target_description()}
- bind:input={$inputs.target}
+ bind:input={inputs.target}
/>
</div>
@@ -118,7 +119,7 @@
type="text"
placeholder={m.platforms_placeholder()}
description={m.platforms_description()}
- bind:input={$inputs.platforms}
+ bind:input={inputs.platforms}
warningText={providerIsLocal ? m.build_provider_warning_single_platform_local() : undefined}
/>
@@ -128,7 +129,7 @@
rows={3}
placeholder={m.build_args_placeholder()}
description={m.build_args_description()}
- bind:input={$inputs.buildArgs}
+ bind:input={inputs.buildArgs}
/>
<FormInput
@@ -137,7 +138,7 @@
rows={3}
placeholder={m.build_labels_placeholder()}
description={m.build_labels_description()}
- bind:input={$inputs.labels}
+ bind:input={inputs.labels}
/>
<FormInput
@@ -146,7 +147,7 @@
rows={2}
placeholder={m.build_cache_from_placeholder()}
description={m.build_cache_from_description()}
- bind:input={$inputs.cacheFrom}
+ bind:input={inputs.cacheFrom}
/>
<FormInput
@@ -155,7 +156,7 @@
rows={2}
placeholder={m.build_cache_to_placeholder()}
description={m.build_cache_to_description()}
- bind:input={$inputs.cacheTo}
+ bind:input={inputs.cacheTo}
disabled={providerIsLocal}
warningText={providerIsLocal ? m.build_provider_warning_unsupported_local() : undefined}
/>
@@ -166,7 +167,7 @@
type="text"
placeholder={m.build_network_placeholder()}
description={m.build_network_description()}
- bind:input={$inputs.network}
+ bind:input={inputs.network}
disabled={providerIsDepot}
warningText={providerIsDepot ? m.build_provider_warning_unsupported_depot() : undefined}
/>
@@ -176,7 +177,7 @@
type="text"
placeholder={m.build_isolation_placeholder()}
description={m.build_isolation_description()}
- bind:input={$inputs.isolation}
+ bind:input={inputs.isolation}
disabled={providerIsDepot}
warningText={providerIsDepot ? m.build_provider_warning_unsupported_depot() : undefined}
/>
@@ -188,7 +189,7 @@
type="text"
placeholder={m.build_shm_size_placeholder()}
description={m.build_shm_size_description()}
- bind:input={$inputs.shmSize}
+ bind:input={inputs.shmSize}
disabled={providerIsDepot}
warningText={providerIsDepot ? m.build_provider_warning_unsupported_depot() : undefined}
/>
@@ -199,7 +200,7 @@
rows={2}
placeholder={m.build_entitlements_placeholder()}
description={m.build_entitlements_description()}
- bind:input={$inputs.entitlements}
+ bind:input={inputs.entitlements}
disabled={providerIsLocal}
warningText={providerIsLocal ? m.build_provider_warning_unsupported_local() : undefined}
/>
@@ -211,7 +212,7 @@
rows={2}
placeholder={m.build_ulimits_placeholder()}
description={m.build_ulimits_description()}
- bind:input={$inputs.ulimits}
+ bind:input={inputs.ulimits}
disabled={providerIsDepot}
warningText={providerIsDepot ? m.build_provider_warning_unsupported_depot() : undefined}
/>
@@ -222,7 +223,7 @@
rows={2}
placeholder={m.build_extra_hosts_placeholder()}
description={m.build_extra_hosts_description()}
- bind:input={$inputs.extraHosts}
+ bind:input={inputs.extraHosts}
disabled={providerIsDepot}
warningText={providerIsDepot ? m.build_provider_warning_unsupported_depot() : undefined}
/>
@@ -232,7 +233,7 @@
label={m.build_privileged_label()}
type="switch"
description={m.build_privileged_description()}
- bind:input={$inputs.privileged}
+ bind:input={inputs.privileged}
disabled={providerIsLocal}
warningText={providerIsLocal ? m.build_provider_warning_unsupported_local() : undefined}
/>
@@ -241,7 +242,7 @@
label={m.build_no_cache_label()}
type="switch"
description={m.build_no_cache_description()}
- bind:input={$inputs.noCache}
+ bind:input={inputs.noCache}
/>
</div>
@@ -249,7 +250,7 @@
label={m.build_pull_base_images_label()}
type="switch"
description={m.build_pull_base_images_description()}
- bind:input={$inputs.pull}
+ bind:input={inputs.pull}
/>
</div>
</Collapsible.Content>
diff --git a/frontend/src/routes/(app)/images/builds/components/build-controls.svelte b/frontend/src/routes/(app)/images/builds/components/build-controls.svelte
index 31aaef90b..a89c59169 100644
--- a/frontend/src/routes/(app)/images/builds/components/build-controls.svelte
+++ b/frontend/src/routes/(app)/images/builds/components/build-controls.svelte
@@ -5,16 +5,16 @@
import { Switch } from '#lib/components/ui/switch/index.js';
import { m } from '#lib/paraglide/messages.js';
import IfPermitted from '#lib/components/if-permitted.svelte';
- import type { BuildFormInputsStore, BuildProviderOption } from './build-form.types';
+ import type { BuildFormInputs, BuildProviderOption } from './build-form.types';
let {
- inputs,
+ inputs = $bindable(),
provider,
providerOptions,
isBuilding = false,
onBuild
}: {
- inputs: BuildFormInputsStore;
+ inputs: BuildFormInputs;
provider: 'local' | 'depot';
providerOptions: BuildProviderOption[];
isBuilding?: boolean;
@@ -33,8 +33,8 @@
bind:value={
() => provider,
(value) => {
- if (value === 'depot') $inputs.provider.value = 'depot';
- else $inputs.provider.value = 'local';
+ if (value === 'depot') inputs.provider.value = 'depot';
+ else inputs.provider.value = 'local';
}
}
/>
@@ -42,15 +42,15 @@
<div class="hidden h-6 w-px bg-border lg:block"></div>
<div class="flex items-center gap-2">
- <Switch id="build-push" checked={$inputs.push.value} onCheckedChange={(v) => ($inputs.push.value = v === true)} />
+ <Switch id="build-push" checked={inputs.push.value} onCheckedChange={(v) => (inputs.push.value = v === true)} />
<Label for="build-push" class="text-sm">{m.push()}</Label>
</div>
<div class="flex items-center gap-2">
<Switch
id="build-load"
- checked={$inputs.load.value}
- onCheckedChange={(v) => ($inputs.load.value = v === true)}
+ checked={inputs.load.value}
+ onCheckedChange={(v) => (inputs.load.value = v === true)}
disabled={provider === 'depot'}
/>
<Label for="build-load" class="text-sm">{m.load()}</Label>
diff --git a/frontend/src/routes/(app)/images/builds/components/build-form.types.ts b/frontend/src/routes/(app)/images/builds/components/build-form.types.ts
index 9e753d45b..d31020535 100644
--- a/frontend/src/routes/(app)/images/builds/components/build-form.types.ts
+++ b/frontend/src/routes/(app)/images/builds/components/build-form.types.ts
@@ -1,5 +1,4 @@
-import type { FormInput } from '#lib/utils/settings.js';
-import type { Writable } from 'svelte/store';
+import type { FormInput } from '#lib/types/form.js';
export type SelectOption = {
label: string;
@@ -36,5 +35,3 @@ export type BuildFormInputs = {
push: FormInput<boolean>;
load: FormInput<boolean>;
};
-
-export type BuildFormInputsStore = Writable<BuildFormInputs>;
diff --git a/frontend/src/routes/(app)/images/builds/components/build-output-panel.svelte b/frontend/src/routes/(app)/images/builds/components/build-output-panel.svelte
index 81a1e98e4..5fef52b35 100644
--- a/frontend/src/routes/(app)/images/builds/components/build-output-panel.svelte
+++ b/frontend/src/routes/(app)/images/builds/components/build-output-panel.svelte
@@ -6,11 +6,6 @@
import { m } from '#lib/paraglide/messages.js';
import { ansiToHtml } from '#lib/utils/formatting.js';
- type AutoScrollParams = {
- enabled: boolean;
- key: number;
- };
-
let {
logLines,
aggregateStatus,
@@ -29,19 +24,9 @@
onReset?: () => void;
} = $props();
- function autoScrollToBottom(node: HTMLElement, params: AutoScrollParams) {
- let current = params;
- const scroll = () => {
- if (!current.enabled) return;
- node.scrollTop = node.scrollHeight;
- };
- scroll();
- return {
- update(next: AutoScrollParams) {
- current = next;
- scroll();
- }
- };
+ function autoScrollToBottom(node: HTMLElement) {
+ logLines.length;
+ if (autoScroll) node.scrollTop = node.scrollHeight;
}
</script>
@@ -78,7 +63,7 @@
<!-- Terminal output with refined styling -->
<div
- use:autoScrollToBottom={{ enabled: autoScroll, key: logLines.length }}
+ {@attach autoScrollToBottom}
class="group relative min-h-0 flex-1 overflow-auto rounded-2xl border border-border/50 bg-zinc-950 p-5 font-mono text-[13px] leading-[1.7] text-zinc-50 shadow-2xl shadow-black/50 dark:bg-zinc-950"
>
<div class="relative">
diff --git a/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte b/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte
index a93e6b82e..9be2a05c2 100644
--- a/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte
+++ b/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte
@@ -4,7 +4,8 @@
import SheetFooterActions from '#lib/components/sheets/sheet-footer-actions.svelte';
import * as ResponsiveDialog from '#lib/components/ui/responsive-dialog/index.js';
import RepoTagFields from '#lib/components/form/repo-tag-fields.svelte';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { imageService } from '#lib/services/image-service.js';
import { m } from '#lib/paraglide/messages.js';
import { toast } from 'svelte-sonner';
@@ -30,7 +31,8 @@
tag: 'latest'
});
- let { inputs, ...form } = $derived(createForm<typeof schema>(schema, formData));
+ let form = $derived(createForm<typeof schema>(schema, formData));
+ let inputs = $derived(form.inputs);
let isTagging = $state(false);
function handleOpenChange(nextOpen: boolean) {
@@ -77,7 +79,7 @@
>
{#snippet children()}
<form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <RepoTagFields bind:repository={$inputs.repository} bind:tag={$inputs.tag} />
+ <RepoTagFields bind:repository={inputs.repository} bind:tag={inputs.tag} />
</form>
{/snippet}
diff --git a/frontend/src/routes/(app)/images/image-table.svelte b/frontend/src/routes/(app)/images/image-table.svelte
index c01bcfbc3..03b61082e 100644
--- a/frontend/src/routes/(app)/images/image-table.svelte
+++ b/frontend/src/routes/(app)/images/image-table.svelte
@@ -29,7 +29,7 @@
import { isLikelyStaleFailedSummary, isVulnerabilityScanInProgress } from '#lib/utils/docker.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast.js';
import { bulkConfirmAndRun } from '#lib/utils/bulk-actions.js';
import InUseStatus from '#lib/components/arcane-table/cells/in-use-status.svelte';
@@ -76,27 +76,27 @@
// Track the user store: hasPermission reads it non-reactively, so without
// this the deriveds would cache pre-hydration falses forever.
const canDeleteImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('images:delete', currentEnvId);
});
const canPullImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('images:pull', currentEnvId);
});
const canScanImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('vulnerabilities:scan', currentEnvId);
});
const canTagImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('images:tag', currentEnvId);
});
const canPatchImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('images:patch', currentEnvId);
});
const canReadImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('images:read', currentEnvId);
});
diff --git a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
index 4318cff34..09fc0f5d8 100644
--- a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
@@ -231,7 +231,7 @@
{#if network.ipam?.config && network.ipam.config.length > 0}
<DetailSection title={m.networks_ipam_title()} icon={SettingsIcon}>
<div class="space-y-3">
- {#each network.ipam.config as config, i (i)}
+ {#each network.ipam.config as config (config)}
{@render ipamSubnet(config)}
{/each}
</div>
diff --git a/frontend/src/routes/(app)/networks/ports/port-table.svelte b/frontend/src/routes/(app)/networks/ports/port-table.svelte
index 6ca2c7a6a..3e01ecce3 100644
--- a/frontend/src/routes/(app)/networks/ports/port-table.svelte
+++ b/frontend/src/routes/(app)/networks/ports/port-table.svelte
@@ -70,7 +70,7 @@
</script>
{#snippet HostPortCell({ item }: { item: PortMappingDto })}
- <span class:text-muted-foreground={!item.isPublished} class="font-mono text-sm">
+ <span class={['font-mono text-sm', { 'text-muted-foreground': !item.isPublished }]}>
{formatHostPort(item)}
</span>
{/snippet}
@@ -90,7 +90,7 @@
{/snippet}
{#snippet HostIpCell({ item }: { item: PortMappingDto })}
- <span class:text-muted-foreground={!item.isPublished} class="font-mono text-sm">
+ <span class={['font-mono text-sm', { 'text-muted-foreground': !item.isPublished }]}>
{formatHostIp(item)}
</span>
{/snippet}
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 9a78a62b7..47ae79600 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -34,7 +34,8 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import { handleApiResultWithCallbacks } from '#lib/utils/api.js';
import { z } from 'zod/v4';
- import { createForm } from '#lib/utils/settings.js';
+ import { createForm } from '#lib/utils/settings.svelte.js';
+
import { m } from '#lib/paraglide/messages.js';
import { gitOpsComposeEditUrl, gitOpsFileEditUrl, gitOpsProjectUrl } from '#lib/utils/gitops.js';
import { toGitRouteUrl, toSafeHref } from '#lib/utils/navigation.js';
@@ -53,7 +54,7 @@
import { afterNavigate } from '$app/navigation';
import { projectService } from '#lib/services/project-service.js';
import { projectWorkspaceService } from '#lib/services/project-workspace-service.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { gitOpsSyncService } from '#lib/services/gitops-sync-service.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
@@ -124,7 +125,7 @@
let projectWorkspaceStagedUploadedText = $state<Record<string, string>>({});
let projectWorkspaceFilePromises: Record<string, Promise<IncludeFile | ProjectWorkspaceFileContent> | undefined> = {};
const globalVariableMap = $derived(globalVariablesToMap(data.globalVariables));
- const projectWorkspaceMaxFileSizeMb = $derived($settingsStore?.projectWorkspaceMaxFileSizeMb ?? 10);
+ const projectWorkspaceMaxFileSizeMb = $derived(settingsStore.current?.projectWorkspaceMaxFileSizeMb ?? 10);
const projectDetailQuery = createQuery(() => ({
queryKey: queryKeys.projects.detail(envId, projectId),
@@ -200,7 +201,8 @@
overrideContent: data.editorState.originalOverrideContent || ''
}));
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, initialFormData);
+ const form = createForm<typeof formSchema>(formSchema, initialFormData);
+ let inputs = $derived(form.inputs);
function withLoadedProjectIncludeContent(details: Project | null | undefined): Project | null {
if (!details) return null;
@@ -249,16 +251,16 @@
)
);
- const composeYamlName = $derived(extractComposeYamlName($inputs.composeContent.value));
+ const composeYamlName = $derived(extractComposeYamlName(inputs.composeContent.value));
// The compose file's top-level `name:` is authoritative; surface it as the
// effective name without writing to form state reactively.
- const effectiveName = $derived(composeYamlName ?? $inputs.name.value);
+ const effectiveName = $derived(composeYamlName ?? inputs.name.value);
let hasChanges = $derived(
effectiveName !== serverName ||
- $inputs.composeContent.value !== serverComposeContent ||
- $inputs.overrideContent.value !== serverOverrideContent ||
- $inputs.envContent.value !== serverEnvContent ||
+ inputs.composeContent.value !== serverComposeContent ||
+ inputs.overrideContent.value !== serverOverrideContent ||
+ inputs.envContent.value !== serverEnvContent ||
Object.entries(includeFilesState).some(([relativePath, content]) => content !== serverIncludeFiles[relativePath]) ||
projectWorkspaceChanges.length > 0 ||
changedProjectWorkspacePaths.length > 0
@@ -429,9 +431,9 @@
if (directoryFilePaths.has(selectedIncludeTabPreference)) return selectedIncludeTabPreference;
return null;
});
- let composeHasChanges = $derived($inputs.composeContent.value !== serverComposeContent);
- let overrideHasChanges = $derived($inputs.overrideContent.value !== serverOverrideContent);
- let envHasChanges = $derived($inputs.envContent.value !== serverEnvContent);
+ let composeHasChanges = $derived(inputs.composeContent.value !== serverComposeContent);
+ let overrideHasChanges = $derived(inputs.overrideContent.value !== serverOverrideContent);
+ let envHasChanges = $derived(inputs.envContent.value !== serverEnvContent);
let changedIncludeFilePaths = $derived.by(() =>
Object.keys(includeFilesState).filter((relativePath) => includeFilesState[relativePath] !== serverIncludeFiles[relativePath])
);
@@ -565,7 +567,7 @@
}
function rebaseEditorDraft(details: Project, options: RebaseEditorDraftOptions = {}) {
- const envDraft = $inputs.envContent.value;
+ const envDraft = inputs.envContent.value;
const shouldPreserveEnvDraft = options.preserveEditableDrafts === true && envDraft !== serverEnvContent;
const dirtyIncludeDrafts = options.preserveEditableDrafts === true ? getDirtyIncludeDrafts() : {};
@@ -578,10 +580,10 @@
const savedProjectWorkspaceContents =
options.preserveProjectWorkspaceContents === true ? { ...projectWorkspaceContents } : {};
- $inputs.name.value = normalizedProject.name || '';
- $inputs.composeContent.value = normalizedProject.composeContent || '';
- $inputs.overrideContent.value = normalizedProject.overrideContent || '';
- $inputs.envContent.value = shouldPreserveEnvDraft ? envDraft : normalizedProject.envContent || '';
+ inputs.name.value = normalizedProject.name || '';
+ inputs.composeContent.value = normalizedProject.composeContent || '';
+ inputs.overrideContent.value = normalizedProject.overrideContent || '';
+ inputs.envContent.value = shouldPreserveEnvDraft ? envDraft : normalizedProject.envContent || '';
projectWorkspaceChanges = [];
projectWorkspaceContents = savedProjectWorkspaceContents;
// Seed the per-file UI-state records for every retained path. A mounted
@@ -1012,7 +1014,7 @@
// nothing on disk to keep, so the override reverts to the add affordance.
if (key === 'override' && !overrideExists) {
overrideEditorRequested = false;
- $inputs.overrideContent.value = '';
+ inputs.overrideContent.value = '';
}
const index = openTabs.indexOf(key);
const remaining = openTabs.filter((tab) => tab !== key);
@@ -1070,7 +1072,7 @@
overrideEditorRequested = false;
overrideOpen = false;
const existed = overrideExists;
- $inputs.overrideContent.value = '';
+ inputs.overrideContent.value = '';
if (existed) {
await handleSaveChanges();
}
@@ -1343,12 +1345,12 @@
}
const allComposeContents = $derived.by(() => {
- return [$inputs.composeContent.value, $inputs.overrideContent.value, ...Object.values(includeFilesState)].filter(
+ return [inputs.composeContent.value, inputs.overrideContent.value, ...Object.values(includeFilesState)].filter(
(value) => value.length > 0
);
});
const codeEditorContext = $derived({
- envContent: $inputs.envContent.value,
+ envContent: inputs.envContent.value,
composeContents: allComposeContents,
globalVariables: globalVariableMap
});
@@ -1417,7 +1419,7 @@
title: composeFileName,
language: 'yaml',
validationMode: 'compose',
- error: $inputs.composeContent.error ?? undefined,
+ error: inputs.composeContent.error ?? undefined,
readOnly: !canEditCompose,
fileId: `project:${projectId}:compose`,
originalValue: serverComposeContent,
@@ -1432,7 +1434,7 @@
title: overrideFileName,
language: 'yaml',
validationMode: 'compose',
- error: $inputs.overrideContent.error ?? undefined,
+ error: inputs.overrideContent.error ?? undefined,
readOnly: !canEditOverride,
fileId: `project:${projectId}:override`,
originalValue: serverOverrideContent,
@@ -1447,7 +1449,7 @@
title: '.env',
language: 'env',
validationMode: 'env',
- error: $inputs.envContent.error ?? undefined,
+ error: inputs.envContent.error ?? undefined,
readOnly: !canEditEnv,
fileId: `project:${projectId}:env`,
originalValue: serverEnvContent,
@@ -1566,7 +1568,7 @@
<CodePanel
{...envPanelProps()}
bind:open={envOpen}
- bind:value={$inputs.envContent.value}
+ bind:value={inputs.envContent.value}
bind:hasErrors={envHasErrors}
bind:validationReady={envValidationReady}
/>
@@ -1873,7 +1875,8 @@
<Alert.Description>
{m.compose_multiple_files_description()}
<div class="mt-2 flex flex-wrap gap-1.5">
- {#each composeFiles as file, i (i)}
+ <!-- COMPOSE_FILE preserves repeated paths; these badges render only text. -->
+ {#each composeFiles as file}
<span class="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">{file}</span>
{/each}
</div>
@@ -1889,7 +1892,7 @@
variant="plain"
{...composePanelProps()}
bind:open={composeOpen}
- bind:value={$inputs.composeContent.value}
+ bind:value={inputs.composeContent.value}
bind:hasErrors={composeHasErrors}
bind:validationReady={composeValidationReady}
bind:outlineOpen={treeOutlineOpen}
@@ -1915,7 +1918,7 @@
variant="plain"
open={true}
{...overridePanelProps()}
- bind:value={$inputs.overrideContent.value}
+ bind:value={inputs.overrideContent.value}
bind:hasErrors={overrideHasErrors}
bind:validationReady={overrideValidationReady}
bind:outlineOpen={treeOutlineOpen}
@@ -1928,7 +1931,7 @@
variant="plain"
{...envPanelProps()}
bind:open={envOpen}
- bind:value={$inputs.envContent.value}
+ bind:value={inputs.envContent.value}
bind:hasErrors={envHasErrors}
bind:validationReady={envValidationReady}
bind:outlineOpen={treeOutlineOpen}
@@ -1996,7 +1999,7 @@
<CodePanel
{...composePanelProps()}
bind:open={composeOpen}
- bind:value={$inputs.composeContent.value}
+ bind:value={inputs.composeContent.value}
bind:hasErrors={composeHasErrors}
bind:validationReady={composeValidationReady}
/>
@@ -2014,7 +2017,7 @@
<CodePanel
{...overridePanelProps()}
variant="plain"
- bind:value={$inputs.overrideContent.value}
+ bind:value={inputs.overrideContent.value}
bind:hasErrors={overrideHasErrors}
bind:validationReady={overrideValidationReady}
bind:outlineOpen={overrideOutlineOpen}
@@ -2049,11 +2052,11 @@
<div class="min-w-0 flex-1">
<div class="flex min-h-9 min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
<EditableName
- bind:value={$inputs.name.value}
+ bind:value={inputs.name.value}
displayValue={effectiveName}
bind:ref={nameInputRef}
variant="inline"
- error={$inputs.name.error ?? undefined}
+ error={inputs.name.error ?? undefined}
originalValue={serverName}
canEdit={canEditName}
disabledMessage={composeYamlName ? m.compose_project_name_defined_in_yaml() : undefined}
@@ -2080,7 +2083,7 @@
{#if project.urls && project.urls.length > 0}
<div class="mt-1 flex min-w-0 flex-wrap items-center gap-1.5">
- {#each project.urls as url, i (i)}
+ {#each project.urls as url (url)}
<a
class="inline-flex h-6 max-w-[10rem] min-w-0 items-center gap-1.5 rounded-[var(--radius)] border border-sky-700/20 bg-background/70 px-2.5 text-[12px] font-semibold ring-offset-background transition-colors hover:border-sky-700/40 hover:bg-sky-500/10 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none sm:max-w-[14rem] md:max-w-[18rem] dark:border-sky-400/40 dark:bg-sky-500/20 dark:text-sky-100 dark:hover:border-sky-300/60 dark:hover:bg-sky-500/30"
href={toSafeHref(url)}
diff --git a/frontend/src/routes/(app)/projects/new/+page.svelte b/frontend/src/routes/(app)/projects/new/+page.svelte
index a25053bd4..8f9375e59 100644
--- a/frontend/src/routes/(app)/projects/new/+page.svelte
+++ b/frontend/src/routes/(app)/projects/new/+page.svelte
@@ -3,7 +3,8 @@
import { ArrowLeftIcon } from '#lib/icons/index.js';
import { goto, refreshAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
- import { preventDefault, createForm } from '#lib/utils/settings.js';
+ import { preventDefault, createForm } from '#lib/utils/settings.svelte.js';
+
import TemplateSelectionDialog from '#lib/components/dialogs/template-selection-dialog.svelte';
import { m } from '#lib/paraglide/messages.js';
import { projectService } from '#lib/services/project-service.js';
@@ -29,7 +30,7 @@
import ProjectTagEditor from '#lib/components/project-tag-editor.svelte';
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import {
planProjectWorkspaceFileCreate,
planProjectWorkspaceFileRename,
@@ -62,7 +63,7 @@
const canCreateProject = $derived(hasPermission('projects:create', currentEnvId));
const canDeleteContainers = $derived(hasPermission('containers:delete', currentEnvId));
const sourceContainerIds = $derived(data.sourceContainerIds ?? []);
- const projectWorkspaceMaxFileSizeMb = $derived($settingsStore?.projectWorkspaceMaxFileSizeMb ?? 10);
+ const projectWorkspaceMaxFileSizeMb = $derived(settingsStore.current?.projectWorkspaceMaxFileSizeMb ?? 10);
let ui = $state({
saving: false,
@@ -87,7 +88,8 @@
envContent: data.envTemplate || ''
};
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, formData);
+ const form = createForm<typeof formSchema>(formSchema, formData);
+ let inputs = $derived(form.inputs);
let composeOpen = $state(true);
let envOpen = $state(true);
@@ -146,17 +148,17 @@
);
let hasEditorErrors = $derived(hasTemplateEditorErrors(validationState));
const codeEditorContext = $derived({
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value].filter((value) => value.length > 0),
+ envContent: inputs.envContent.value,
+ composeContents: [inputs.composeContent.value].filter((value) => value.length > 0),
globalVariables: globalVariableMap
});
let nameInputRef = $state<HTMLInputElement | null>(null);
- const composeYamlName = $derived(extractComposeYamlName($inputs.composeContent.value));
+ const composeYamlName = $derived(extractComposeYamlName(inputs.composeContent.value));
// The compose file's top-level `name:` is authoritative; surface it as the
// effective name without writing to form state reactively.
- const effectiveName = $derived(composeYamlName ?? $inputs.name.value);
+ const effectiveName = $derived(composeYamlName ?? inputs.name.value);
const createMenuBusy = $derived(ui.saving || ui.converting || ui.isLoadingTemplateContent);
async function handleSubmit() {
@@ -209,7 +211,7 @@
}
const { composeHandlers, handleCreateTemplate } = createComposeTemplateDialogFlow({
- getInputs: () => $inputs,
+ getInputs: () => inputs,
setInputValue: (key, value) => form.setValue(key, value),
closeTemplateDialog: () => (ui.showTemplateDialog = false),
validate: form.validate,
@@ -222,7 +224,7 @@
title: m.compose_compose_file_title(),
language: 'yaml',
validationMode: 'compose',
- error: $inputs.composeContent.error ?? undefined,
+ error: inputs.composeContent.error ?? undefined,
fileId: 'projects:new:compose',
editorContext: codeEditorContext
} as const;
@@ -233,7 +235,7 @@
title: m.compose_env_title(),
language: 'env',
validationMode: 'env',
- error: $inputs.envContent.error ?? undefined,
+ error: inputs.envContent.error ?? undefined,
fileId: 'projects:new:env',
editorContext: codeEditorContext
} as const;
@@ -247,7 +249,7 @@
variant="plain"
{...composePanelProps()}
bind:open={composeOpen}
- bind:value={$inputs.composeContent.value}
+ bind:value={inputs.composeContent.value}
bind:hasErrors={validation.composeHasErrors}
bind:validationReady={validation.composeValidationReady}
bind:outlineOpen={treeOutlineOpen}
@@ -259,7 +261,7 @@
variant="plain"
{...envPanelProps()}
bind:open={envOpen}
- bind:value={$inputs.envContent.value}
+ bind:value={inputs.envContent.value}
bind:hasErrors={validation.envHasErrors}
bind:validationReady={validation.envValidationReady}
bind:outlineOpen={treeOutlineOpen}
@@ -297,11 +299,11 @@
{#snippet projectNameField(variant: 'inline' | 'block')}
<EditableName
- bind:value={$inputs.name.value}
+ bind:value={inputs.name.value}
displayValue={effectiveName}
bind:ref={nameInputRef}
{variant}
- error={$inputs.name.error ?? undefined}
+ error={inputs.name.error ?? undefined}
originalValue=""
placeholder={m.compose_project_name_placeholder()}
canEdit={!ui.saving && !ui.isLoadingTemplateContent && !composeYamlName}
@@ -338,7 +340,7 @@
tooltipDescription={m.compose_project_name_tooltip_description()}
tooltipExample={m.compose_project_name_tooltip_example()}
showCreateButton={!hasEditorErrors && canCreateProject}
- createDisabled={!effectiveName || !$inputs.composeContent.value || hasEditorErrors || createMenuBusy}
+ createDisabled={!effectiveName || !inputs.composeContent.value || hasEditorErrors || createMenuBusy}
createLoading={ui.saving}
createLabel={m.compose_create_project()}
createLoadingLabel={m.common_action_creating()}
@@ -354,8 +356,8 @@
fromGitLabel={m.git_from_git_repo()}
onFromGit={async () => goto(`/environments/${await environmentStore.getCurrentEnvironmentId()}/gitops?action=create`)}
createTemplateLabel={m.templates_create_template()}
- createTemplateDisabled={!$inputs.name.value ||
- !$inputs.composeContent.value ||
+ createTemplateDisabled={!inputs.name.value ||
+ !inputs.composeContent.value ||
hasEditorErrors ||
createMenuBusy ||
ui.creatingTemplate}
@@ -455,7 +457,7 @@
<CodePanel
{...composePanelProps()}
bind:open={composeOpen}
- bind:value={$inputs.composeContent.value}
+ bind:value={inputs.composeContent.value}
bind:hasErrors={validation.composeHasErrors}
bind:validationReady={validation.composeValidationReady}
/>
@@ -465,7 +467,7 @@
<CodePanel
{...envPanelProps()}
bind:open={envOpen}
- bind:value={$inputs.envContent.value}
+ bind:value={inputs.envContent.value}
bind:hasErrors={validation.envHasErrors}
bind:validationReady={validation.envValidationReady}
/>
diff --git a/frontend/src/routes/(app)/security/security-patch-table.svelte b/frontend/src/routes/(app)/security/security-patch-table.svelte
index 16a34c37f..cba902606 100644
--- a/frontend/src/routes/(app)/security/security-patch-table.svelte
+++ b/frontend/src/routes/(app)/security/security-patch-table.svelte
@@ -17,7 +17,7 @@
import { formatDateTimeShort } from '#lib/utils/formatting.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { toast } from 'svelte-sonner';
type PatchTargetRow = ImagePatchTargetDto & { id: string };
@@ -34,7 +34,7 @@
// Track the user store: hasPermission reads it non-reactively, so without
// this the derived would cache a pre-hydration false forever.
const canPatchImage = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('images:patch', currentEnvId);
});
diff --git a/frontend/src/routes/(app)/settings/+layout.svelte b/frontend/src/routes/(app)/settings/+layout.svelte
index 7ad3af855..af46d0d91 100644
--- a/frontend/src/routes/(app)/settings/+layout.svelte
+++ b/frontend/src/routes/(app)/settings/+layout.svelte
@@ -2,12 +2,12 @@
import type { LayoutProps } from './$types';
import { page } from '$app/state';
import { goto } from '$app/navigation';
- import { setContext } from 'svelte';
+ import { setSettingsFormContext } from '#lib/hooks/settings-form-context.js';
import type { SettingsFormContext, SettingsFormState } from '#lib/types/settings-form.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { SettingsIcon, ArrowRightIcon, ArrowLeftIcon } from '#lib/icons/index.js';
import { m } from '#lib/paraglide/messages.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { IsMobile } from '#lib/hooks/is-mobile.svelte.js';
import { cn } from '#lib/utils.js';
import MobileFloatingFormActions from '#lib/components/form/mobile-floating-form-actions.svelte';
@@ -18,7 +18,7 @@
let currentPageName = $derived(page.url.pathname.split('/').pop() || 'settings');
const isMobile = new IsMobile();
- const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
let pageTitle = $derived.by(() => {
switch (currentPageName) {
case 'jobs':
@@ -38,7 +38,7 @@
case 'webhooks':
return m.webhook_page_title();
case 'build':
- return 'Build';
+ return m.build();
case 'diagnostics':
return m.diagnostics();
default:
@@ -55,7 +55,7 @@
formState = form;
}
};
- setContext('settingsFormState', formContext);
+ setSettingsFormContext(formContext);
function goBackToSettings() {
goto('/settings');
diff --git a/frontend/src/routes/(app)/settings/activity/+page.svelte b/frontend/src/routes/(app)/settings/activity/+page.svelte
index c1538d50c..b83bd6106 100644
--- a/frontend/src/routes/(app)/settings/activity/+page.svelte
+++ b/frontend/src/routes/(app)/settings/activity/+page.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { z } from 'zod/v4';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { SettingsPageLayout } from '#lib/layouts/index.js';
import { Label } from '#lib/components/ui/label/index.js';
@@ -10,7 +10,7 @@
let { data } = $props();
- const isReadOnly = $derived.by(() => $settingsStore?.uiConfigDisabled);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
const formSchema = z.object({
activityHistoryRetentionDays: z.coerce.number().int().min(0).max(3650),
@@ -19,7 +19,7 @@
});
const getFormDefaults = () => {
- const settings = $settingsStore || data.settings!;
+ const settings = settingsStore.current || data.settings!;
return {
activityHistoryRetentionDays: settings.activityHistoryRetentionDays,
activityHistoryMaxEntries: settings.activityHistoryMaxEntries,
@@ -55,8 +55,8 @@
</div>
<div class="max-w-xs">
<TextInputWithLabel
- bind:value={$formInputs.activityHistoryRetentionDays.value}
- error={$formInputs.activityHistoryRetentionDays.error}
+ bind:value={formInputs.activityHistoryRetentionDays.value}
+ error={formInputs.activityHistoryRetentionDays.error}
label={m.activity_history_retention_days()}
placeholder={m.activity_history_retention_days_placeholder()}
helpText={m.activity_history_retention_days_help()}
@@ -73,8 +73,8 @@
</div>
<div class="max-w-xs">
<TextInputWithLabel
- bind:value={$formInputs.activityHistoryMaxEntries.value}
- error={$formInputs.activityHistoryMaxEntries.error}
+ bind:value={formInputs.activityHistoryMaxEntries.value}
+ error={formInputs.activityHistoryMaxEntries.error}
label={m.activity_history_max_entries()}
placeholder={m.activity_history_max_entries_placeholder()}
helpText={m.activity_history_max_entries_help()}
@@ -92,8 +92,8 @@
</div>
<div class="max-w-xs">
<TextInputWithLabel
- bind:value={$formInputs.maxConcurrentActivities.value}
- error={$formInputs.maxConcurrentActivities.error}
+ bind:value={formInputs.maxConcurrentActivities.value}
+ error={formInputs.maxConcurrentActivities.error}
label={m.activity_max_concurrent()}
placeholder={m.activity_max_concurrent_placeholder()}
helpText={m.activity_max_concurrent_help()}
diff --git a/frontend/src/routes/(app)/settings/authentication/+page.svelte b/frontend/src/routes/(app)/settings/authentication/+page.svelte
index a0ca86883..ddaf9a6ce 100644
--- a/frontend/src/routes/(app)/settings/authentication/+page.svelte
+++ b/frontend/src/routes/(app)/settings/authentication/+page.svelte
@@ -12,7 +12,7 @@
import { Badge } from '#lib/components/ui/badge/index.js';
import { m } from '#lib/paraglide/messages.js';
import { LockIcon, InfoIcon, ArrowDownIcon } from '#lib/icons/index.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { SettingsPageLayout } from '#lib/layouts/index.js';
import { CopyButton } from '#lib/components/ui/copy-button/index.js';
import { createSettingsForm } from '#lib/utils/settings-form.js';
@@ -106,9 +106,9 @@
});
}
}
- const currentSettings = $derived<Settings>($settingsStore || data.settings!);
- const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
- const isAutoLoginEnabled = $derived(settingsStore.autoLoginEnabled.isEnabled());
+ const currentSettings = $derived<Settings>(settingsStore.current || data.settings!);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
+ const isAutoLoginEnabled = $derived(settingsStore.autoLoginEnabled.current);
const formSchema = z
.object({
@@ -168,20 +168,20 @@
schema: formSchema,
currentSettings: formDefaults,
getCurrentSettings: () => ({
- authLocalEnabled: ($settingsStore || data.settings!).authLocalEnabled,
- authSessionTimeout: ($settingsStore || data.settings!).authSessionTimeout,
- authPasswordPolicy: ($settingsStore || data.settings!).authPasswordPolicy,
- oidcEnabled: ($settingsStore || data.settings!).oidcEnabled,
- oidcMergeAccounts: ($settingsStore || data.settings!).oidcMergeAccounts,
- oidcSkipTlsVerify: ($settingsStore || data.settings!).oidcSkipTlsVerify,
- oidcAutoRedirectToProvider: ($settingsStore || data.settings!).oidcAutoRedirectToProvider,
- oidcClientId: ($settingsStore || data.settings!).oidcClientId,
+ authLocalEnabled: (settingsStore.current || data.settings!).authLocalEnabled,
+ authSessionTimeout: (settingsStore.current || data.settings!).authSessionTimeout,
+ authPasswordPolicy: (settingsStore.current || data.settings!).authPasswordPolicy,
+ oidcEnabled: (settingsStore.current || data.settings!).oidcEnabled,
+ oidcMergeAccounts: (settingsStore.current || data.settings!).oidcMergeAccounts,
+ oidcSkipTlsVerify: (settingsStore.current || data.settings!).oidcSkipTlsVerify,
+ oidcAutoRedirectToProvider: (settingsStore.current || data.settings!).oidcAutoRedirectToProvider,
+ oidcClientId: (settingsStore.current || data.settings!).oidcClientId,
oidcClientSecret: '',
- oidcIssuerUrl: ($settingsStore || data.settings!).oidcIssuerUrl,
- oidcScopes: ($settingsStore || data.settings!).oidcScopes,
- oidcGroupsClaim: ($settingsStore || data.settings!).oidcGroupsClaim,
- oidcProviderName: ($settingsStore || data.settings!).oidcProviderName,
- oidcProviderLogoUrl: ($settingsStore || data.settings!).oidcProviderLogoUrl
+ oidcIssuerUrl: (settingsStore.current || data.settings!).oidcIssuerUrl,
+ oidcScopes: (settingsStore.current || data.settings!).oidcScopes,
+ oidcGroupsClaim: (settingsStore.current || data.settings!).oidcGroupsClaim,
+ oidcProviderName: (settingsStore.current || data.settings!).oidcProviderName,
+ oidcProviderLogoUrl: (settingsStore.current || data.settings!).oidcProviderLogoUrl
}),
successMessage: m.security_settings_saved()
})
@@ -192,9 +192,9 @@
const isOidcForcedEnabled = $derived(isOidcEnvForced && currentSettings.oidcEnabled);
const isOidcForcedDisabled = $derived(isOidcEnvForced && !currentSettings.oidcEnabled);
const isOidcEnabledForAuthValidation = $derived.by(() =>
- isOidcEnvForced ? currentSettings.oidcEnabled : $formInputs.oidcEnabled.value
+ isOidcEnvForced ? currentSettings.oidcEnabled : formInputs.oidcEnabled.value
);
- const showOidcDetails = $derived($formInputs.oidcEnabled.value || isOidcForcedEnabled);
+ const showOidcDetails = $derived(formInputs.oidcEnabled.value || isOidcForcedEnabled);
async function customSubmit() {
const formData = form.validate();
@@ -231,7 +231,7 @@
oidcProviderLogoUrl: formData.oidcProviderLogoUrl,
...(formData.oidcClientSecret && { oidcClientSecret: formData.oidcClientSecret })
});
- $formInputs.oidcClientSecret.value = '';
+ formInputs.oidcClientSecret.value = '';
toast.success(m.security_settings_saved());
})()
);
@@ -248,41 +248,41 @@
function customReset() {
form.reset(formDefaults);
- $formInputs.oidcClientSecret.value = '';
+ formInputs.oidcClientSecret.value = '';
}
function handleLocalSwitchChange(checked: boolean) {
if (!checked && !isOidcEnabledForAuthValidation) {
- $formInputs.authLocalEnabled.value = true;
+ formInputs.authLocalEnabled.value = true;
toast.error(m.security_enable_one_provider_error());
return;
}
- $formInputs.authLocalEnabled.value = checked;
+ formInputs.authLocalEnabled.value = checked;
}
function handleOidcEnabledChange(checked: boolean) {
- if (!checked && !$formInputs.authLocalEnabled.value && !isOidcEnvForced) {
- $formInputs.authLocalEnabled.value = true;
+ if (!checked && !formInputs.authLocalEnabled.value && !isOidcEnvForced) {
+ formInputs.authLocalEnabled.value = true;
toast.info(m.security_local_enabled_info());
}
- $formInputs.oidcEnabled.value = checked;
+ formInputs.oidcEnabled.value = checked;
}
function handleMergeAccountsChange(checked: boolean) {
if (checked && !currentSettings.oidcMergeAccounts) {
showMergeAccountsAlert = true;
} else {
- $formInputs.oidcMergeAccounts.value = checked;
+ formInputs.oidcMergeAccounts.value = checked;
}
}
function confirmMergeAccounts() {
- $formInputs.oidcMergeAccounts.value = true;
+ formInputs.oidcMergeAccounts.value = true;
showMergeAccountsAlert = false;
}
function cancelMergeAccounts() {
- $formInputs.oidcMergeAccounts.value = false;
+ formInputs.oidcMergeAccounts.value = false;
showMergeAccountsAlert = false;
}
@@ -294,13 +294,13 @@
<ArcaneTooltip.Trigger>
{#snippet child({ props })}
{@const triggerProps = mergeProps(props, {
- onclick: () => ($formInputs.authPasswordPolicy.value = value),
+ onclick: () => (formInputs.authPasswordPolicy.value = value),
class: 'h-12 w-full text-xs sm:text-sm'
})}
<ArcaneButton
{...triggerProps}
action="base"
- tone={$formInputs.authPasswordPolicy.value === value ? 'outline-primary' : 'outline'}
+ tone={formInputs.authPasswordPolicy.value === value ? 'outline-primary' : 'outline'}
customLabel={label}
/>
{/snippet}
@@ -342,7 +342,7 @@
>
<Switch
id="localAuthSwitch"
- bind:checked={$formInputs.authLocalEnabled.value}
+ bind:checked={formInputs.authLocalEnabled.value}
onCheckedChange={handleLocalSwitchChange}
/>
</SettingsRow>
@@ -381,7 +381,7 @@
<Switch
id="oidcEnabledSwitch"
disabled={isOidcEnvForced}
- bind:checked={$formInputs.oidcEnabled.value}
+ bind:checked={formInputs.oidcEnabled.value}
onCheckedChange={handleOidcEnabledChange}
/>
{#if showOidcDetails}
@@ -404,8 +404,8 @@
label={m.oidc_client_id_label()}
placeholder={m.oidc_client_id_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcClientId.value}
- error={$formInputs.oidcClientId.error}
+ bind:value={formInputs.oidcClientId.value}
+ error={formInputs.oidcClientId.error}
/>
<TextInputWithLabel
id="oidcClientSecret"
@@ -413,8 +413,8 @@
label={m.oidc_client_secret_label()}
placeholder={m.oidc_client_secret_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcClientSecret.value}
- error={$formInputs.oidcClientSecret.error}
+ bind:value={formInputs.oidcClientSecret.value}
+ error={formInputs.oidcClientSecret.error}
helpText={m.security_oidc_client_secret_help()}
/>
</div>
@@ -425,8 +425,8 @@
description={m.oidc_issuer_url_description()}
placeholder={m.oidc_issuer_url_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcIssuerUrl.value}
- error={$formInputs.oidcIssuerUrl.error}
+ bind:value={formInputs.oidcIssuerUrl.value}
+ error={formInputs.oidcIssuerUrl.error}
/>
<div class="grid gap-5 sm:grid-cols-2">
@@ -436,8 +436,8 @@
description={m.oidc_provider_name_description()}
placeholder={m.oidc_provider_name_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcProviderName.value}
- error={$formInputs.oidcProviderName.error}
+ bind:value={formInputs.oidcProviderName.value}
+ error={formInputs.oidcProviderName.error}
/>
<TextInputWithLabel
id="oidcProviderLogoUrl"
@@ -445,8 +445,8 @@
description={m.oidc_provider_logo_url_description()}
placeholder={m.oidc_provider_logo_url_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcProviderLogoUrl.value}
- error={$formInputs.oidcProviderLogoUrl.error}
+ bind:value={formInputs.oidcProviderLogoUrl.value}
+ error={formInputs.oidcProviderLogoUrl.error}
/>
</div>
@@ -455,8 +455,8 @@
label={m.oidc_scopes_label()}
placeholder={m.oidc_scopes_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcScopes.value}
- error={$formInputs.oidcScopes.error}
+ bind:value={formInputs.oidcScopes.value}
+ error={formInputs.oidcScopes.error}
/>
<TextInputWithLabel
@@ -464,8 +464,8 @@
label={m.oidc_groups_claim_label()}
placeholder={m.oidc_groups_claim_placeholder()}
disabled={isOidcEnvForced}
- bind:value={$formInputs.oidcGroupsClaim.value}
- error={$formInputs.oidcGroupsClaim.error}
+ bind:value={formInputs.oidcGroupsClaim.value}
+ error={formInputs.oidcGroupsClaim.error}
helpText={m.oidc_groups_claim_help()}
/>
@@ -478,7 +478,7 @@
<Switch
id="oidcMergeAccountsSwitch"
disabled={isOidcEnvForced}
- bind:checked={$formInputs.oidcMergeAccounts.value}
+ bind:checked={formInputs.oidcMergeAccounts.value}
onCheckedChange={handleMergeAccountsChange}
/>
</SettingsRow>
@@ -491,7 +491,7 @@
<Switch
id="oidcSkipTlsVerifySwitch"
disabled={isOidcEnvForced}
- bind:checked={$formInputs.oidcSkipTlsVerify.value}
+ bind:checked={formInputs.oidcSkipTlsVerify.value}
/>
</SettingsRow>
@@ -503,7 +503,7 @@
<Switch
id="oidcAutoRedirectSwitch"
disabled={isOidcEnvForced}
- bind:checked={$formInputs.oidcAutoRedirectToProvider.value}
+ bind:checked={formInputs.oidcAutoRedirectToProvider.value}
/>
</SettingsRow>
</div>
@@ -566,8 +566,8 @@
type="number"
label={m.security_session_timeout_label()}
description={m.security_session_timeout_description()}
- bind:value={$formInputs.authSessionTimeout.value}
- error={$formInputs.authSessionTimeout.error}
+ bind:value={formInputs.authSessionTimeout.value}
+ error={formInputs.authSessionTimeout.error}
/>
</div>
</div>
diff --git a/frontend/src/routes/(app)/settings/backups/+page.svelte b/frontend/src/routes/(app)/settings/backups/+page.svelte
index c52f5dfea..a25d79e86 100644
--- a/frontend/src/routes/(app)/settings/backups/+page.svelte
+++ b/frontend/src/routes/(app)/settings/backups/+page.svelte
@@ -3,11 +3,11 @@
import { goto, afterNavigate } from '$app/navigation';
import { onMount, onDestroy } from 'svelte';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { useBackupActivity } from '#lib/hooks/use-backup-activity.svelte.js';
import { activityStore } from '#lib/stores/activity.store.svelte.js';
import { toast } from 'svelte-sonner';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
import { AlertIcon, BackupIcon, CloudStorageIcon, InfoIcon, LockIcon, ResetIcon, UploadIcon } from '#lib/icons/index.js';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
@@ -82,7 +82,7 @@
let restoreFilesSearch = $state('');
let restoreFilesLoaded = $state(false);
let restoringFiles = $state(false);
- const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
const canManageRecoveryKey = $derived(hasPermission('system-backups:recovery-key'));
const destinationOptions = $derived(backupDestinationOptions(data.destinations.length > 0));
const s3Options = $derived(s3DestinationOptions(data.destinations));
@@ -387,7 +387,7 @@
}
onMount(() => {
mounted = true;
- return userStore.subscribe(() => {
+ return userStore.onChange(() => {
void discoverStoredBackups();
});
});
diff --git a/frontend/src/routes/(app)/settings/backups/s3/+page.svelte b/frontend/src/routes/(app)/settings/backups/s3/+page.svelte
index 26acd041d..8b785618a 100644
--- a/frontend/src/routes/(app)/settings/backups/s3/+page.svelte
+++ b/frontend/src/routes/(app)/settings/backups/s3/+page.svelte
@@ -2,7 +2,7 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import { toast } from 'svelte-sonner';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
import { RemoteEnvironmentIcon } from '#lib/icons/index.js';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
@@ -20,7 +20,7 @@
let dialogOpen = $state(false);
let destinationSession = $state(0);
let saving = $state(false);
- const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
function openCreate() {
selected = null;
diff --git a/frontend/src/routes/(app)/settings/backups/s3/s3-destination-dialog.svelte b/frontend/src/routes/(app)/settings/backups/s3/s3-destination-dialog.svelte
index 960fbd83e..3b9fc76f1 100644
--- a/frontend/src/routes/(app)/settings/backups/s3/s3-destination-dialog.svelte
+++ b/frontend/src/routes/(app)/settings/backups/s3/s3-destination-dialog.svelte
@@ -7,7 +7,8 @@
import FormInput from '#lib/components/form/form-input.svelte';
import LabeledSwitch from '#lib/components/form/labeled-switch.svelte';
import type { CreateS3Destination, S3Destination } from '#lib/types/s3-destination.js';
- import { createForm, preventDefault } from '#lib/utils/settings.js';
+ import { createForm, preventDefault } from '#lib/utils/settings.svelte.js';
+
import { s3DestinationService } from '#lib/services/s3-destination-service.js';
import { toast } from 'svelte-sonner';
import { z } from 'zod/v4';
@@ -66,19 +67,20 @@
forcePathStyle: destination?.forcePathStyle ?? true
}));
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, formData);
+ const form = createForm<typeof formSchema>(formSchema, formData);
+ let inputs = $derived(form.inputs);
let testing = $state(false);
let testedConfiguration = $state<string | null>(null);
const currentConfiguration = $derived(
JSON.stringify({
- endpoint: $inputs.endpoint.value.trim(),
- bucket: $inputs.bucket.value.trim(),
- region: $inputs.region.value.trim(),
- accessKeyId: $inputs.accessKeyId.value.trim(),
- secretAccessKey: $inputs.secretAccessKey.value.trim(),
- prefix: $inputs.prefix.value.trim().replace(/^\/+|\/+$/g, ''),
- useSsl: $inputs.useSsl.value,
- forcePathStyle: $inputs.forcePathStyle.value
+ endpoint: inputs.endpoint.value.trim(),
+ bucket: inputs.bucket.value.trim(),
+ region: inputs.region.value.trim(),
+ accessKeyId: inputs.accessKeyId.value.trim(),
+ secretAccessKey: inputs.secretAccessKey.value.trim(),
+ prefix: inputs.prefix.value.trim().replace(/^\/+|\/+$/g, ''),
+ useSsl: inputs.useSsl.value,
+ forcePathStyle: inputs.forcePathStyle.value
})
);
const connectionVerified = $derived(testedConfiguration === currentConfiguration);
@@ -123,20 +125,20 @@
</script>
{#snippet destinationFields()}
- <FormInput bind:input={$inputs.name} label={m.common_name()} />
+ <FormInput bind:input={inputs.name} label={m.common_name()} />
<FormInput
- bind:input={$inputs.endpoint}
+ bind:input={inputs.endpoint}
label={m.backups_s3_endpoint_label()}
description={m.backups_s3_endpoint_description()}
/>
- <FormInput bind:input={$inputs.bucket} label={m.backups_s3_bucket_label()} />
- <FormInput bind:input={$inputs.region} label={m.backups_s3_region_label()} description={m.backups_s3_region_description()} />
+ <FormInput bind:input={inputs.bucket} label={m.backups_s3_bucket_label()} />
+ <FormInput bind:input={inputs.region} label={m.backups_s3_region_label()} description={m.backups_s3_region_description()} />
{/snippet}
{#snippet credentialFields()}
- <FormInput bind:input={$inputs.accessKeyId} label={m.backups_s3_access_key_label()} autocomplete="off" />
+ <FormInput bind:input={inputs.accessKeyId} label={m.backups_s3_access_key_label()} autocomplete="off" />
<FormInput
- bind:input={$inputs.secretAccessKey}
+ bind:input={inputs.secretAccessKey}
label={m.backups_s3_secret_key_label()}
description={destination?.secretConfigured ? m.s3_destination_secret_keep_description() : undefined}
type="password"
@@ -145,17 +147,17 @@
{/snippet}
{#snippet connectionOptions()}
- <FormInput bind:input={$inputs.prefix} label={m.backups_s3_prefix_label()} description={m.backups_s3_prefix_description()} />
+ <FormInput bind:input={inputs.prefix} label={m.backups_s3_prefix_label()} description={m.backups_s3_prefix_description()} />
<div class="mt-1 grid gap-4 border-t pt-5 sm:grid-cols-2">
<LabeledSwitch
id="s3-destination-ssl"
- bind:checked={$inputs.useSsl.value}
+ bind:checked={inputs.useSsl.value}
label={m.backups_s3_ssl_label()}
description={m.backups_s3_ssl_description()}
/>
<LabeledSwitch
id="s3-destination-path-style"
- bind:checked={$inputs.forcePathStyle.value}
+ bind:checked={inputs.forcePathStyle.value}
label={m.backups_s3_path_style_label()}
description={m.backups_s3_path_style_description()}
/>
diff --git a/frontend/src/routes/(app)/settings/builds/+page.svelte b/frontend/src/routes/(app)/settings/builds/+page.svelte
index cc7d27c0c..27edbe251 100644
--- a/frontend/src/routes/(app)/settings/builds/+page.svelte
+++ b/frontend/src/routes/(app)/settings/builds/+page.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { z } from 'zod/v4';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { SettingsPageLayout } from '#lib/layouts/index.js';
import { CodeIcon } from '#lib/icons/index.js';
import TextInputWithLabel from '#lib/components/form/text-input-with-label.svelte';
@@ -11,8 +11,8 @@
let { data } = $props();
- const currentSettings = $derived($settingsStore || data.settings!);
- const isReadOnly = $derived.by(() => $settingsStore?.uiConfigDisabled);
+ const currentSettings = $derived(settingsStore.current || data.settings!);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
const formSchema = z.object({
buildProvider: z.enum(['local', 'depot']).default('local'),
@@ -23,7 +23,7 @@
});
const getFormDefaults = () => {
- const settings = $settingsStore || data.settings!;
+ const settings = settingsStore.current || data.settings!;
let buildProvider = settings.buildProvider;
if (!settings.depotConfigured && !((settings.depotProjectId ?? '').trim() && (settings.depotToken ?? '').trim())) {
buildProvider = 'local';
@@ -50,10 +50,10 @@
await settingsService.updateSettings(updated);
},
onSuccess: () => {
- $formInputs.depotToken.value = '';
+ formInputs.depotToken.value = '';
},
onReset: () => {
- $formInputs.depotToken.value = '';
+ formInputs.depotToken.value = '';
},
successMessage: m.build_settings_saved()
});
@@ -63,8 +63,8 @@
const depotConfigured = $derived(Boolean(currentSettings.depotConfigured));
const depotCredentialsPresent = $derived.by(() => {
- const projectId = ($formInputs.depotProjectId.value ?? '').trim() || existingDepotProjectId;
- const token = ($formInputs.depotToken.value ?? '').trim() || existingDepotToken;
+ const projectId = (formInputs.depotProjectId.value ?? '').trim() || existingDepotProjectId;
+ const token = (formInputs.depotToken.value ?? '').trim() || existingDepotToken;
return (Boolean(projectId) && Boolean(token)) || depotConfigured;
});
@@ -78,7 +78,7 @@
const resolvedProvider = $derived.by(() => {
if (!depotCredentialsPresent) return 'local';
- return $formInputs.buildProvider.value;
+ return formInputs.buildProvider.value;
});
</script>
@@ -95,8 +95,8 @@
<h3 class="text-base font-semibold">{m.build_workspace()}</h3>
<div class="max-w-xl">
<TextInputWithLabel
- bind:value={$formInputs.buildsDirectory.value}
- error={$formInputs.buildsDirectory.error}
+ bind:value={formInputs.buildsDirectory.value}
+ error={formInputs.buildsDirectory.error}
label={m.build_settings_directory_label()}
description={m.build_settings_directory_description()}
placeholder={m.build_settings_directory_placeholder()}
@@ -115,11 +115,11 @@
bind:value={
() => resolvedProvider,
(value) => {
- if (value === 'depot' && depotCredentialsPresent) $formInputs.buildProvider.value = 'depot';
- else $formInputs.buildProvider.value = 'local';
+ if (value === 'depot' && depotCredentialsPresent) formInputs.buildProvider.value = 'depot';
+ else formInputs.buildProvider.value = 'local';
}
}
- error={$formInputs.buildProvider.error}
+ error={formInputs.buildProvider.error}
label={m.build_settings_default_provider_label()}
description={m.build_settings_default_provider_description()}
options={providerOptions}
@@ -129,8 +129,8 @@
{/if}
</div>
<TextInputWithLabel
- bind:value={$formInputs.buildTimeout.value}
- error={$formInputs.buildTimeout.error}
+ bind:value={formInputs.buildTimeout.value}
+ error={formInputs.buildTimeout.error}
label={m.build_settings_timeout_label()}
description={m.build_settings_timeout_description()}
placeholder={m.build_settings_timeout_placeholder()}
@@ -145,26 +145,26 @@
<div class="grid gap-5 sm:grid-cols-2">
<TextInputWithLabel
bind:value={
- () => $formInputs.depotProjectId.value,
+ () => formInputs.depotProjectId.value,
(value) => {
- $formInputs.depotProjectId.value = value;
- if (!depotCredentialsPresent) $formInputs.buildProvider.value = 'local';
+ formInputs.depotProjectId.value = value;
+ if (!depotCredentialsPresent) formInputs.buildProvider.value = 'local';
}
}
- error={$formInputs.depotProjectId.error}
+ error={formInputs.depotProjectId.error}
label={m.build_settings_depot_project_id_label()}
description={m.build_settings_depot_project_id_description()}
placeholder={m.build_settings_depot_project_id_placeholder()}
/>
<TextInputWithLabel
bind:value={
- () => $formInputs.depotToken.value,
+ () => formInputs.depotToken.value,
(value) => {
- $formInputs.depotToken.value = value;
- if (!depotCredentialsPresent) $formInputs.buildProvider.value = 'local';
+ formInputs.depotToken.value = value;
+ if (!depotCredentialsPresent) formInputs.buildProvider.value = 'local';
}
}
- error={$formInputs.depotToken.error}
+ error={formInputs.depotToken.error}
label={m.build_settings_depot_token_label()}
description={m.build_settings_depot_token_description()}
placeholder={m.build_settings_depot_token_placeholder()}
diff --git a/frontend/src/routes/(app)/settings/diagnostics/+page.svelte b/frontend/src/routes/(app)/settings/diagnostics/+page.svelte
index 9d6a263d5..5a3fe468b 100644
--- a/frontend/src/routes/(app)/settings/diagnostics/+page.svelte
+++ b/frontend/src/routes/(app)/settings/diagnostics/+page.svelte
@@ -458,7 +458,8 @@
<div>
<div class="mb-1 text-[11px] text-muted-foreground">{m.diagnostics_gc_recent_pauses()}</div>
<div class="flex h-12 items-end gap-0.5">
- {#each diag.gc.recentPausesNs as p, i (i)}
+ <!-- Pause durations can repeat; bars render the current snapshot without local state. -->
+ {#each diag.gc.recentPausesNs as p}
<div
class="flex-1 rounded-sm bg-amber-500/70"
style="height: {maxPause ? Math.max(4, (p / maxPause) * 100) : 4}%"
diff --git a/frontend/src/routes/(app)/settings/notifications/+page.svelte b/frontend/src/routes/(app)/settings/notifications/+page.svelte
index 598fcfdf1..e41bc8290 100644
--- a/frontend/src/routes/(app)/settings/notifications/+page.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/+page.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { getSettingsFormContext, hasSettingsFormContext } from '#lib/hooks/settings-form-context.js';
import * as Tabs from '#lib/components/ui/tabs/index.js';
import * as Dialog from '#lib/components/ui/dialog/index.js';
import * as Alert from '#lib/components/ui/alert/index.js';
@@ -6,10 +7,10 @@
import SettingsRow from '#lib/components/settings/settings-row.svelte';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { toast } from 'svelte-sonner';
- import { getContext, onDestroy, onMount } from 'svelte';
- import type { SettingsFormContext, SettingsFormState } from '#lib/types/settings-form.js';
+ import { onDestroy, onMount } from 'svelte';
+ import type { SettingsFormState } from '#lib/types/settings-form.js';
import { SettingsPageLayout } from '#lib/layouts/index.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { useUrlTab } from '#lib/hooks/use-url-tab.svelte.js';
import { notificationService } from '#lib/services/notification-service.js';
@@ -61,16 +62,16 @@
{ value: 'mobile', label: m.notifications_mobile_push_tab() }
];
- const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
const canToggleMobilePush = $derived(hasPermission('settings:write'));
- const mobilePushEnabled = $derived($settingsStore?.apnsEnabled === true);
+ const mobilePushEnabled = $derived(settingsStore.current?.apnsEnabled === true);
let savingMobilePush = $state(false);
let mobileDevices = $state<ApnsDevice[]>([]);
let testingDeviceId = $state<string | null>(null);
type ProviderFormRef = { isValid: () => boolean };
- const formContext = getContext<SettingsFormContext | undefined>('settingsFormState');
+ const formContext = hasSettingsFormContext() ? getSettingsFormContext() : undefined;
let providerFormRefs = $state<Partial<Record<NotificationProviderKey, ProviderFormRef>>>({});
let savedSettings = $state<NotificationSettingsByProvider>(createNotificationSettingsByProvider());
let providerValues = $state<NotificationProviderFormState>(createNotificationProviderFormState());
diff --git a/frontend/src/routes/(app)/settings/roles/+page.svelte b/frontend/src/routes/(app)/settings/roles/+page.svelte
index 3624f2647..db2c5763d 100644
--- a/frontend/src/routes/(app)/settings/roles/+page.svelte
+++ b/frontend/src/routes/(app)/settings/roles/+page.svelte
@@ -6,7 +6,7 @@
import { m } from '#lib/paraglide/messages.js';
import { roleService } from '#lib/services/role-service.js';
import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
let { data } = $props();
diff --git a/frontend/src/routes/(app)/settings/roles/roles-table.svelte b/frontend/src/routes/(app)/settings/roles/roles-table.svelte
index bf3823913..5d783bf2f 100644
--- a/frontend/src/routes/(app)/settings/roles/roles-table.svelte
+++ b/frontend/src/routes/(app)/settings/roles/roles-table.svelte
@@ -14,7 +14,7 @@
import { m } from '#lib/paraglide/messages.js';
import { roleService } from '#lib/services/role-service.js';
import { ShieldAlertIcon, TrashIcon, EditIcon } from '#lib/icons/index.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import IfPermitted from '#lib/components/if-permitted.svelte';
import { bulkConfirmAndRun, confirmAndRun } from '#lib/utils/bulk-actions.js';
diff --git a/frontend/src/routes/(app)/settings/timeouts/+page.svelte b/frontend/src/routes/(app)/settings/timeouts/+page.svelte
index 5469062c1..b9bf22d03 100644
--- a/frontend/src/routes/(app)/settings/timeouts/+page.svelte
+++ b/frontend/src/routes/(app)/settings/timeouts/+page.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { z } from 'zod/v4';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { SettingsPageLayout } from '#lib/layouts/index.js';
import { ClockIcon } from '#lib/icons/index.js';
@@ -9,7 +9,7 @@
let { data } = $props();
- const isReadOnly = $derived.by(() => $settingsStore?.uiConfigDisabled);
+ const isReadOnly = $derived.by(() => settingsStore.current?.uiConfigDisabled);
const formSchema = z.object({
dockerApiTimeout: z.coerce.number().int().min(1).max(3600),
@@ -23,7 +23,7 @@
});
const getFormDefaults = () => {
- const settings = $settingsStore || data.settings!;
+ const settings = settingsStore.current || data.settings!;
return {
dockerApiTimeout: settings.dockerApiTimeout,
dockerImagePullTimeout: settings.dockerImagePullTimeout,
@@ -58,8 +58,8 @@
<h3 class="text-base font-semibold">{m.timeouts_docker_operations()}</h3>
<div class="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
<TextInputWithLabel
- bind:value={$formInputs.dockerApiTimeout.value}
- error={$formInputs.dockerApiTimeout.error}
+ bind:value={formInputs.dockerApiTimeout.value}
+ error={formInputs.dockerApiTimeout.error}
label={m.docker_api_timeout()}
description={m.docker_api_timeout_description()}
placeholder="30"
@@ -67,8 +67,8 @@
type="number"
/>
<TextInputWithLabel
- bind:value={$formInputs.dockerImagePullTimeout.value}
- error={$formInputs.dockerImagePullTimeout.error}
+ bind:value={formInputs.dockerImagePullTimeout.value}
+ error={formInputs.dockerImagePullTimeout.error}
label={m.docker_image_pull_timeout()}
description={m.docker_image_pull_timeout_description()}
placeholder="600"
@@ -76,8 +76,8 @@
type="number"
/>
<TextInputWithLabel
- bind:value={$formInputs.deployWaitTimeout.value}
- error={$formInputs.deployWaitTimeout.error}
+ bind:value={formInputs.deployWaitTimeout.value}
+ error={formInputs.deployWaitTimeout.error}
label={m.deploy_wait_timeout()}
description={m.deploy_wait_timeout_description()}
placeholder="600"
@@ -85,8 +85,8 @@
type="number"
/>
<TextInputWithLabel
- bind:value={$formInputs.trivyScanTimeout.value}
- error={$formInputs.trivyScanTimeout.error}
+ bind:value={formInputs.trivyScanTimeout.value}
+ error={formInputs.trivyScanTimeout.error}
label={m.trivy_scan_timeout()}
description={m.trivy_scan_timeout_description()}
placeholder="900"
@@ -101,8 +101,8 @@
<h3 class="text-base font-semibold">{m.timeouts_git_operations()}</h3>
<div class="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
<TextInputWithLabel
- bind:value={$formInputs.gitOperationTimeout.value}
- error={$formInputs.gitOperationTimeout.error}
+ bind:value={formInputs.gitOperationTimeout.value}
+ error={formInputs.gitOperationTimeout.error}
label={m.git_operation_timeout()}
description={m.git_operation_timeout_description()}
placeholder="300"
@@ -117,8 +117,8 @@
<h3 class="text-base font-semibold">{m.timeouts_network_operations()}</h3>
<div class="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
<TextInputWithLabel
- bind:value={$formInputs.httpClientTimeout.value}
- error={$formInputs.httpClientTimeout.error}
+ bind:value={formInputs.httpClientTimeout.value}
+ error={formInputs.httpClientTimeout.error}
label={m.http_client_timeout()}
description={m.http_client_timeout_description()}
placeholder="30"
@@ -126,8 +126,8 @@
type="number"
/>
<TextInputWithLabel
- bind:value={$formInputs.registryTimeout.value}
- error={$formInputs.registryTimeout.error}
+ bind:value={formInputs.registryTimeout.value}
+ error={formInputs.registryTimeout.error}
label={m.registry_timeout()}
description={m.registry_timeout_description()}
placeholder="30"
@@ -135,8 +135,8 @@
type="number"
/>
<TextInputWithLabel
- bind:value={$formInputs.proxyRequestTimeout.value}
- error={$formInputs.proxyRequestTimeout.error}
+ bind:value={formInputs.proxyRequestTimeout.value}
+ error={formInputs.proxyRequestTimeout.error}
label={m.proxy_request_timeout()}
description={m.proxy_request_timeout_description()}
placeholder="60"
diff --git a/frontend/src/routes/(app)/settings/users/+page.svelte b/frontend/src/routes/(app)/settings/users/+page.svelte
index a74d32313..18dae7346 100644
--- a/frontend/src/routes/(app)/settings/users/+page.svelte
+++ b/frontend/src/routes/(app)/settings/users/+page.svelte
@@ -13,8 +13,8 @@
import { userService } from '#lib/services/user-service.js';
import { roleService } from '#lib/services/role-service.js';
import { settingsService } from '#lib/services/settings-service.js';
- import userStore from '#lib/stores/user-store.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
import SettingsRow from '#lib/components/settings/settings-row.svelte';
import { Switch } from '#lib/components/ui/switch/index.js';
@@ -163,10 +163,10 @@
}
// Avatar policy: server-wide settings that belong with user management.
- const isReadOnly = $derived(Boolean($settingsStore?.uiConfigDisabled));
- const gravatarEnabled = $derived(Boolean($settingsStore?.enableGravatar));
+ const isReadOnly = $derived(Boolean(settingsStore.current?.uiConfigDisabled));
+ const gravatarEnabled = $derived(Boolean(settingsStore.current?.enableGravatar));
const avatarMaxUploadSizeMb = $derived(
- Number($settingsStore?.avatarMaxUploadSizeMb) > 0 ? Number($settingsStore?.avatarMaxUploadSizeMb) : 2
+ Number(settingsStore.current?.avatarMaxUploadSizeMb) > 0 ? Number(settingsStore.current?.avatarMaxUploadSizeMb) : 2
);
let avatarSizeInput = $derived(String(avatarMaxUploadSizeMb));
let avatarSizeError = $state<string | null>(null);
diff --git a/frontend/src/routes/(app)/swarm/cluster/+page.svelte b/frontend/src/routes/(app)/swarm/cluster/+page.svelte
index 6c3cb96db..dd6b310d0 100644
--- a/frontend/src/routes/(app)/swarm/cluster/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/cluster/+page.svelte
@@ -13,7 +13,7 @@
import { m } from '#lib/paraglide/messages.js';
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { swarmService } from '#lib/services/swarm-service.js';
import { hasPermission } from '#lib/utils/auth.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
@@ -29,7 +29,7 @@
const swarmInfoQuery = createQuery(() => {
const environmentId = currentEnvId;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.swarm.info(environmentId ?? ''),
queryFn: async () => {
@@ -42,7 +42,7 @@
});
const joinTokensQuery = createQuery(() => {
const environmentId = currentEnvId;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.swarm.joinTokens(environmentId ?? ''),
queryFn: async () => {
@@ -55,7 +55,7 @@
});
const unlockKeyQuery = createQuery(() => {
const environmentId = currentEnvId;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.swarm.unlockKey(environmentId ?? ''),
queryFn: async () => {
diff --git a/frontend/src/routes/(app)/swarm/cluster/easy-join-dialog.svelte b/frontend/src/routes/(app)/swarm/cluster/easy-join-dialog.svelte
index 143f2f142..3c8af694a 100644
--- a/frontend/src/routes/(app)/swarm/cluster/easy-join-dialog.svelte
+++ b/frontend/src/routes/(app)/swarm/cluster/easy-join-dialog.svelte
@@ -3,7 +3,7 @@
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
import { onDestroy } from 'svelte';
@@ -29,7 +29,7 @@
const candidatesQuery = createQuery(() => {
const environmentId = requestedManagerId;
return {
- queryKey: queryKeys.swarm.joinCandidates(environmentId ?? null, $userStore),
+ queryKey: queryKeys.swarm.joinCandidates(environmentId ?? null, userStore.current),
queryFn: async () => {
await environmentStore.ready;
return swarmService.getSwarmJoinCandidates(environmentId!);
diff --git a/frontend/src/routes/(app)/swarm/nodes/+page.svelte b/frontend/src/routes/(app)/swarm/nodes/+page.svelte
index 38c25da58..4e7f7ddac 100644
--- a/frontend/src/routes/(app)/swarm/nodes/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/nodes/+page.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { tryCatch } from '#lib/utils/try-catch.js';
import * as Alert from '#lib/components/ui/alert/index.js';
@@ -50,7 +50,7 @@
if (!active || environmentId !== environmentStore.selected?.id || result.error !== null) return;
await refresh();
}
- const unsubscribeUser = userStore.subscribe(() => {
+ const unsubscribeUser = userStore.onChange(() => {
void reconcileSelectedEnvironment();
});
const unsubscribeEnvironment = environmentStore.subscribeSelected(() => {
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte
index f68882522..6a9959b7a 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { untrack } from 'svelte';
import * as Card from '#lib/components/ui/card/index.js';
import LogViewer from '#lib/components/logs/log-viewer.svelte';
import LogControls from '#lib/components/logs/log-controls.svelte';
@@ -41,8 +42,8 @@
}
$effect(() => {
- if (preferences.autoStartLogs && !isStreaming && serviceId && viewer) {
- viewer.startLogStream();
+ if (preferences.autoStartLogs && serviceId && viewer) {
+ untrack(handleStart);
}
});
</script>
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceStorage.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceStorage.svelte
index 8381c1e62..f25f97bea 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceStorage.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceStorage.svelte
@@ -59,7 +59,7 @@
<Card.Content class="p-4">
{#if mounts.length > 0}
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3">
- {#each mounts as mount, i (i)}
+ {#each mounts as mount (mount.target)}
{@const type = getMountType(mount)}
{@const source = getMountSource(mount)}
{@const target = getMountTarget(mount)}
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceTasksPanel.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceTasksPanel.svelte
index 7c5cde9a8..2a1f549b9 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceTasksPanel.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceTasksPanel.svelte
@@ -2,7 +2,7 @@
import { createQuery } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
import * as Card from '#lib/components/ui/card/index.js';
@@ -24,7 +24,7 @@
const tasksQuery = createQuery(() => {
const environmentId = environmentStore.selected?.id;
const requestedServiceId = serviceId;
- $userStore;
+ userStore.current;
return {
queryKey: queryKeys.swarm.serviceTasks(environmentId ?? '', requestedServiceId),
queryFn: async () => {
diff --git a/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte b/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte
index 2b590a2a0..fd24a1e68 100644
--- a/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte
@@ -3,7 +3,8 @@
import { goto, refreshAll } from '$app/navigation';
import { untrack } from 'svelte';
import { toast } from 'svelte-sonner';
- import { preventDefault, createForm } from '#lib/utils/settings.js';
+ import { preventDefault, createForm } from '#lib/utils/settings.svelte.js';
+
import TemplateSelectionDialog from '#lib/components/dialogs/template-selection-dialog.svelte';
import { m } from '#lib/paraglide/messages.js';
import { swarmService } from '#lib/services/swarm-service.js';
@@ -31,7 +32,7 @@
workspaceFileLanguage
} from '#lib/utils/workspace-files.js';
import { WorkspaceDraftState } from '#lib/components/workspace-editor/workspace-draft-state.svelte.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import {
createComposeEditorSchema,
createComposeTemplateDialogFlow,
@@ -40,7 +41,7 @@
} from '#lib/utils/compose-flow.js';
let { data } = $props();
- const workspaceMaxFileSizeMb = $derived($settingsStore?.projectWorkspaceMaxFileSizeMb ?? 10);
+ const workspaceMaxFileSizeMb = $derived(settingsStore.current?.projectWorkspaceMaxFileSizeMb ?? 10);
let ui = $state({
saving: false,
@@ -77,7 +78,8 @@
const submitLabel = $derived(isEditMode ? m.common_save() : m.common_create_button({ resource: m.swarm_stack() }));
const submitLoadingLabel = $derived(isEditMode ? m.common_saving() : m.common_action_creating());
- const { inputs, ...form } = createForm<typeof formSchema>(formSchema, getInitialFormData());
+ const form = createForm<typeof formSchema>(formSchema, getInitialFormData());
+ let inputs = $derived(form.inputs);
let composeOpen = $state(true);
let envOpen = $state(true);
@@ -187,8 +189,8 @@
const globalVariableMap = $derived(globalVariablesToMap(data.globalVariables));
const stackEditorContext = $derived({
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value, overrideContent].filter((content) => content.length > 0),
+ envContent: inputs.envContent.value,
+ composeContents: [inputs.composeContent.value, overrideContent].filter((content) => content.length > 0),
globalVariables: globalVariableMap
});
@@ -243,7 +245,7 @@
}
const { composeHandlers, handleCreateTemplate } = createComposeTemplateDialogFlow({
- getInputs: () => $inputs,
+ getInputs: () => inputs,
setInputValue: (key, value) => form.setValue(key, value),
closeTemplateDialog: () => (ui.showTemplateDialog = false),
validate: form.validate,
@@ -251,7 +253,7 @@
});
const canSubmit = $derived(
- !!$inputs.name.value && !!$inputs.composeContent.value && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent
+ !!inputs.name.value && !!inputs.composeContent.value && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent
);
</script>
@@ -271,10 +273,10 @@
<div class="hidden h-4 w-px bg-border sm:block"></div>
<div class="hidden items-center gap-3 sm:flex">
<EditableName
- bind:value={$inputs.name.value}
+ bind:value={inputs.name.value}
bind:ref={nameInputRef}
variant="inline"
- error={$inputs.name.error ?? undefined}
+ error={inputs.name.error ?? undefined}
originalValue={initialName}
placeholder={m.compose_project_name_placeholder()}
canEdit={!isEditMode && !ui.saving && !ui.isLoadingTemplateContent}
@@ -285,8 +287,8 @@
<div class="flex items-center gap-2">
<ComposeCreateMenu
- tooltipOpen={!$inputs.name.value && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent ? undefined : false}
- tooltipVisible={$inputs.name.value === ''}
+ tooltipOpen={!inputs.name.value && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent ? undefined : false}
+ tooltipVisible={inputs.name.value === ''}
tooltipTitle={m.compose_project_name_tooltip_title()}
tooltipDescription={m.compose_project_name_tooltip_description()}
tooltipExample={m.compose_project_name_tooltip_example()}
@@ -317,10 +319,10 @@
<div class="flex h-full min-h-0 flex-col">
<div class="block flex-shrink-0 px-2 py-4 sm:hidden sm:px-6">
<EditableName
- bind:value={$inputs.name.value}
+ bind:value={inputs.name.value}
bind:ref={nameInputRef}
variant="block"
- error={$inputs.name.error ?? undefined}
+ error={inputs.name.error ?? undefined}
originalValue={initialName}
placeholder={m.compose_project_name_placeholder()}
canEdit={!isEditMode && !ui.saving && !ui.isLoadingTemplateContent}
@@ -426,8 +428,8 @@
bind:open={composeOpen}
title="compose.yaml"
language="yaml"
- bind:value={$inputs.composeContent.value}
- error={$inputs.composeContent.error ?? undefined}
+ bind:value={inputs.composeContent.value}
+ error={inputs.composeContent.error ?? undefined}
fileId={isEditMode ? `swarm:stacks:${initialName}:compose` : 'swarm:stacks:new:compose'}
editorContext={stackEditorContext}
bind:outlineOpen={treeOutlineOpen}
@@ -464,8 +466,8 @@
bind:open={envOpen}
title=".env"
language="env"
- bind:value={$inputs.envContent.value}
- error={$inputs.envContent.error ?? undefined}
+ bind:value={inputs.envContent.value}
+ error={inputs.envContent.error ?? undefined}
fileId={isEditMode ? `swarm:stacks:${initialName}:env` : 'swarm:stacks:new:env'}
editorContext={stackEditorContext}
bind:outlineOpen={treeOutlineOpen}
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
index ff6ad1547..c0e181b2c 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
@@ -29,7 +29,7 @@
import { type DetailAction } from '#lib/layouts/index.js';
import TabbedPageLayout from '#lib/layouts/tabbed-page-layout.svelte';
import BackupList from '../components/volume-backup-table.svelte';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast.js';
@@ -74,7 +74,7 @@
let volume = $derived(data.volume);
let containersDetailed = $derived<{ id: string; name: string }[]>(data.containersDetailed ?? []);
- const backupVolumeName = $derived.by(() => $settingsStore?.backupVolumeName || 'arcane-backups');
+ const backupVolumeName = $derived.by(() => settingsStore.current?.backupVolumeName || 'arcane-backups');
const isBackupVolume = $derived(volume?.name === backupVolumeName);
const currentEnvId = $derived(environmentStore.selected?.id || '0');
@@ -82,7 +82,7 @@
const canReadVolume = $derived(hasPermission('volumes:read', currentEnvId));
const canUploadVolume = $derived(hasPermission('volumes:upload', currentEnvId));
const canBackupVolume = $derived(hasPermission('volumes:backup', currentEnvId));
- const volumeWorkspaceMaxFileSizeMb = $derived($settingsStore?.volumeWorkspaceMaxFileSizeMb ?? 10);
+ const volumeWorkspaceMaxFileSizeMb = $derived(settingsStore.current?.volumeWorkspaceMaxFileSizeMb ?? 10);
let isLoading = $state({ remove: false, save: false });
const createdDate = $derived(volume.createdAt ? formatDateTimeShort(volume.createdAt) : m.common_unknown());
diff --git a/frontend/src/routes/(app)/volumes/volume-table.svelte b/frontend/src/routes/(app)/volumes/volume-table.svelte
index 524cedf0c..644ee0af2 100644
--- a/frontend/src/routes/(app)/volumes/volume-table.svelte
+++ b/frontend/src/routes/(app)/volumes/volume-table.svelte
@@ -19,14 +19,14 @@
import { inUseBadge } from '#lib/utils/mobile-card-badges.js';
import { TrashIcon, InspectIcon, VolumesIcon, CalendarIcon, EditIcon } from '#lib/icons/index.js';
import { Spinner } from '#lib/components/ui/spinner/index.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { onMount } from 'svelte';
import { createQuery, useQueryClient } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
import type { ColumnVisibilityState } from '@tanstack/table-core';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast.js';
import { bulkConfirmAndRun } from '#lib/utils/bulk-actions.js';
import RenameVolumeDialog from './components/rename-volume-dialog.svelte';
@@ -56,11 +56,11 @@
// Track the user store: hasPermission reads it non-reactively, so without
// this the derived would cache a pre-hydration false forever.
const canDeleteVolume = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('volumes:delete', currentEnvId);
});
const canRenameVolume = $derived.by(() => {
- $userStore;
+ userStore.current;
return hasPermission('volumes:rename', currentEnvId);
});
let tablePreferences = $state<{ persistCustomSettings(settings: Record<string, unknown>): void }>();
@@ -100,7 +100,7 @@
refreshVolumes(nextOptions);
}
- const backupVolumeName = $derived.by(() => $settingsStore?.backupVolumeName || 'arcane-backups');
+ const backupVolumeName = $derived.by(() => settingsStore.current?.backupVolumeName || 'arcane-backups');
const isBackupVolumeName = (name?: string) => (name ?? '') === backupVolumeName;
const isBackupVolume = (item: VolumeSummaryDto) => isBackupVolumeName(item.name);
@@ -108,7 +108,7 @@
let tablePreferencesReady = $state(false);
const queryClient = useQueryClient();
const sizesEnabled = $derived.by(() => {
- $userStore;
+ userStore.current;
return (
tablePreferencesReady &&
!!environmentStore.selected?.id &&
diff --git a/frontend/src/routes/(auth)/login/+page.svelte b/frontend/src/routes/(auth)/login/+page.svelte
index d1755aebd..58f29614a 100644
--- a/frontend/src/routes/(auth)/login/+page.svelte
+++ b/frontend/src/routes/(auth)/login/+page.svelte
@@ -10,7 +10,7 @@
import * as InputGroup from '#lib/components/ui/input-group/index.js';
import { AlertIcon, ApiKeyIcon, LockIcon, UserIcon, GithubIcon, OpenIdIcon } from '#lib/icons/index.js';
import { goto, refreshAll } from '$app/navigation';
- import userStore from '#lib/stores/user-store.js';
+ import userStore from '#lib/stores/user-store.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { authService, MFARequiredError } from '#lib/services/auth-service.js';
import { passkeyService } from '#lib/services/passkey-service.js';
@@ -19,7 +19,7 @@
import { getEffectiveLandingPage } from '#lib/utils/navigation.js';
import { queryKeys } from '#lib/query/query-keys.js';
import { getApplicationLogo } from '#lib/utils/docker.js';
- import { accentColorPreviewStore } from '#lib/utils/theme.js';
+ import { accentColorPreview } from '#lib/utils/theme.svelte.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import AuthAmbient from '#lib/components/auth/auth-ambient.svelte';
import MFAChallenge from '#lib/components/auth/mfa-challenge.svelte';
@@ -36,8 +36,8 @@
const showPasskeyLoginButton = $derived(passkeySupported && data.passkeyLoginAvailable === true);
const queryClient = useQueryClient();
- const accentColor = $derived($accentColorPreviewStore);
- const animationsEnabled = $derived($userStore?.preferences?.animationsEnabled ?? true);
+ const accentColor = $derived(accentColorPreview.current);
+ const animationsEnabled = $derived(userStore.current?.preferences?.animationsEnabled ?? true);
const logoUrl = $derived(getApplicationLogo(true, accentColor, accentColor, { animated: animationsEnabled }));
const oidcEnabledBySettings = $derived(data.settings?.oidcEnabled === true);
diff --git a/frontend/src/routes/(auth)/oidc/callback/+page.svelte b/frontend/src/routes/(auth)/oidc/callback/+page.svelte
index 3f871cc26..95755962c 100644
--- a/frontend/src/routes/(auth)/oidc/callback/+page.svelte
+++ b/frontend/src/routes/(auth)/oidc/callback/+page.svelte
@@ -7,7 +7,7 @@
import { toast } from 'svelte-sonner';
import type { AuthenticationResponse, MFAChallenge as MFAChallengeData, User } from '#lib/types/auth.js';
import { m } from '#lib/paraglide/messages.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { settingsService } from '#lib/services/settings-service.js';
import { queryKeys } from '#lib/query/query-keys.js';
import { authService } from '#lib/services/auth-service.js';
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index 7ba23a825..f7afe9a48 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -13,7 +13,7 @@
import { IsTablet } from '#lib/hooks/is-tablet.svelte.js';
import { m } from '#lib/paraglide/messages.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
- import settingsStore from '#lib/stores/config-store.js';
+ import settingsStore from '#lib/stores/config-store.svelte.js';
import { cn } from '#lib/utils.js';
import { QueryClientProvider } from '@tanstack/svelte-query';
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools';
@@ -42,7 +42,7 @@
String(page.url.pathname).startsWith('/mobile/passkey')
);
- const autoLoginEnabled = $derived(settingsStore.autoLoginEnabled.isEnabled());
+ const autoLoginEnabled = $derived(settingsStore.autoLoginEnabled.current);
const showPasswordChangeDialog = $derived(
!!(data.user && data.user.requiresPasswordChange && !isAuthPage && !autoLoginEnabled)
);
diff --git a/frontend/src/routes/+layout.ts b/frontend/src/routes/+layout.ts
index a8c6d2892..2807ad0d9 100644
--- a/frontend/src/routes/+layout.ts
+++ b/frontend/src/routes/+layout.ts
@@ -5,9 +5,9 @@ import { roleService } from '#lib/services/role-service.js';
import { swarmService } from '#lib/services/swarm-service.js';
import { userService } from '#lib/services/user-service.js';
import versionService from '#lib/services/version-service.js';
-import settingsStore from '#lib/stores/config-store.js';
+import settingsStore from '#lib/stores/config-store.svelte.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
-import userStore from '#lib/stores/user-store.js';
+import userStore from '#lib/stores/user-store.svelte.js';
import { type AppVersionInformation } from '#lib/types/settings.js';
import type { SearchPaginationSortRequest } from '#lib/types/shared.js';
import type { PermissionsManifest } from '#lib/types/auth.js';