Fix errors that appeared after svelte plugin upgrade

This commit is contained in:
Mattias Granlund 2024-10-02 11:02:44 +02:00
parent a93d87331f
commit 3008244201
14 changed files with 67 additions and 52 deletions

View File

@ -223,7 +223,7 @@
</Dropzones>
{/if}
{#snippet pushButton({disabled}: {disabled: boolean})}
{#snippet pushButton({ disabled }: { disabled: boolean })}
<Button
style="pop"
kind="solid"

View File

@ -106,7 +106,10 @@
isApplying = true;
try {
if (localBranch) {
await branchController.createvBranchFromBranch(localBranch.name, remoteBranch?.name);
await branchController.createvBranchFromBranch(
localBranch.name,
remoteBranch?.name
);
} else {
await branchController.createvBranchFromBranch(remoteBranch!.name);
}

View File

@ -385,8 +385,7 @@
currentCommitMessage.set(commit.description);
e.stopPropagation();
undoCommit(commit);
}}
>Undo</Button
}}>Undo</Button
>
{/if}
<Button

View File

@ -224,15 +224,15 @@
isDragTargeted = false;
}}
ondrag={(e) => {
const target = e.target as HTMLElement;
const targetHeight = target.offsetHeight;
const targetTop = target.getBoundingClientRect().top;
const mouseY = e.clientY;
const target = e.target as HTMLElement;
const targetHeight = target.offsetHeight;
const targetTop = target.getBoundingClientRect().top;
const mouseY = e.clientY;
const isTop = mouseY < targetTop + targetHeight / 2;
const isTop = mouseY < targetTop + targetHeight / 2;
dragDirection = isTop ? 'up' : 'down';
}}
dragDirection = isTop ? 'up' : 'down';
}}
use:draggableCommit={commit instanceof DetailedCommit && !isUnapplied && type !== 'integrated'
? {
label: commit.descriptionTitle,
@ -375,11 +375,10 @@
outline
icon="undo-small"
onclick={(e: MouseEvent) => {
currentCommitMessage.set(commit.description);
e.stopPropagation();
undoCommit(commit);
}}
>Undo</Button
currentCommitMessage.set(commit.description);
e.stopPropagation();
undoCommit(commit);
}}>Undo</Button
>
{/if}
<Button
@ -395,7 +394,9 @@
style="ghost"
outline
icon="virtual-branch-small"
onclick={(e: Event) => {openCreateRefModal(e, commit)}}>Create ref</Button
onclick={(e: Event) => {
openCreateRefModal(e, commit);
}}>Create ref</Button
>
{/if}
{#if commit instanceof DetailedCommit && commit.remoteRef}

View File

@ -166,10 +166,13 @@
<Select
value={results.get(branch.id)!.approach.type}
onselect={(value) => {
const result = results.get(branch.id)!
const result = results.get(branch.id)!;
results.set(branch.id, {...result, approach: { type: value as "rebase" | "merge" | "unapply" }})
}}
results.set(branch.id, {
...result,
approach: { type: value as 'rebase' | 'merge' | 'unapply' }
});
}}
options={[
{ label: 'Rebase', value: 'rebase' },
{ label: 'Merge', value: 'merge' },

View File

@ -28,7 +28,7 @@
<svelte:self {...token} />
{/each}
{:else if renderers[type]}
{@const CurrentComponent = renderers[type] as Component<Omit<Props, "type">>}
{@const CurrentComponent = renderers[type] as Component<Omit<Props, 'type'>>}
{#if type === 'list'}
{@const listItems = (rest as Extract<Props, { type: 'list' }>).items}
<CurrentComponent {...rest}>

View File

@ -58,7 +58,7 @@
{checked}
{indeterminate}
style={indeterminate ? 'neutral' : 'default'}
onchange={(e: Event & { currentTarget: EventTarget & HTMLInputElement; }) => {
onchange={(e: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
const isChecked = e.currentTarget.checked;
if (isChecked) {
selectAll(files);

View File

@ -412,11 +412,16 @@
class:diff-line-addition={row.type === SectionType.AddedLines}
class:is-last={row.isLast}
oncontextmenu={(event) => {
const lineNumber = (row.beforeLineNumber
? row.beforeLineNumber
: row.afterLineNumber) as number;
handleLineContextMenu({ event, hunk, lineNumber, subsection: subsections[0] as ContentSection });
}}
const lineNumber = (
row.beforeLineNumber ? row.beforeLineNumber : row.afterLineNumber
) as number;
handleLineContextMenu({
event,
hunk,
lineNumber,
subsection: subsections[0] as ContentSection
});
}}
>
{@html row.tokens.join('')}
</td>

View File

@ -75,7 +75,7 @@
{#if props.icon || props.selected}
<div class="icon">
{#if props.icon}
<Icon name={props.loading ? 'spinner' : props.icon as keyof typeof iconsJson} />
<Icon name={props.loading ? 'spinner' : (props.icon as keyof typeof iconsJson)} />
{:else}
<Icon name="tick" />
{/if}

View File

@ -84,7 +84,7 @@
{#if uniqueRemotes(remoteBranches).length > 1}
<Select
value={selectedRemote.name}
options={uniqueRemotes(remoteBranches).map((r) => ({ label: r.name!, value: r.name!}))}
options={uniqueRemotes(remoteBranches).map((r) => ({ label: r.name!, value: r.name! }))}
onselect={(value) => {
selectedRemote = { name: value };
}}

View File

@ -62,7 +62,9 @@
id="use-pull-request-template-boolean"
bind:checked={useTemplate}
on:click={(e) => {
setUsePullRequestTemplate((e.target as MouseEvent['target'] & { checked: boolean }).checked);
setUsePullRequestTemplate(
(e.target as MouseEvent['target'] & { checked: boolean }).checked
);
}}
/>
</svelte:fragment>

View File

@ -116,13 +116,16 @@
// TODO: can we eliminate the need to debounce?
const fetch = $derived(fetchSignal.event);
const debouncedBaseBranchRefresh = debounce(() => baseBranchService.refresh(), 500);
const debouncedBaseBranchRefresh = debounce(async () => await baseBranchService.refresh(), 500);
$effect(() => {
if ($fetch || $head) debouncedBaseBranchRefresh();
});
// TODO: can we eliminate the need to debounce?
const debouncedRemoteBranchRefresh = debounce(() => remoteBranchService.refresh(), 500);
const debouncedRemoteBranchRefresh = debounce(
async () => await remoteBranchService.refresh(),
500
);
$effect(() => {
if ($baseBranch || $head || $fetch) debouncedRemoteBranchRefresh();
});

View File

@ -173,8 +173,8 @@
options={keyOptions}
label="Do you want to provide your own key?"
onselect={(value) => {
openAIKeyOption = value as KeyOption;
}}
openAIKeyOption = value as KeyOption;
}}
>
{#snippet itemSnippet({ item, highlighted })}
<SelectItem selected={item.value === openAIKeyOption} {highlighted}>
@ -203,8 +203,8 @@
options={openAIModelOptions}
label="Model version"
onselect={(value) => {
openAIModelName = value as OpenAIModelName;
}}
openAIModelName = value as OpenAIModelName;
}}
>
{#snippet itemSnippet({ item, highlighted })}
<SelectItem selected={item.value === openAIModelName} {highlighted}>
@ -237,8 +237,8 @@
options={keyOptions}
label="Do you want to provide your own key?"
onselect={(value) => {
anthropicKeyOption = value as KeyOption;
}}
anthropicKeyOption = value as KeyOption;
}}
>
{#snippet itemSnippet({ item, highlighted })}
<SelectItem selected={item.value === anthropicKeyOption} {highlighted}>
@ -272,8 +272,8 @@
options={anthropicModelOptions}
label="Model version"
onselect={(value) => {
anthropicModelName = value as AnthropicModelName;
}}
anthropicModelName = value as AnthropicModelName;
}}
>
{#snippet itemSnippet({ item, highlighted })}
<SelectItem selected={item.value === anthropicModelName} {highlighted}>

View File

@ -10,18 +10,17 @@
const { label, reversedDirection }: Props = $props();
</script>
{#snippet buttons({
label,
outline,
style,
reversedDirection
}: {
label: string,
outline: boolean,
style?: ComponentColor,
reversedDirection?: boolean
}
)}
{#snippet buttons({
label,
outline,
style,
reversedDirection
}: {
label: string;
outline: boolean;
style?: ComponentColor;
reversedDirection?: boolean;
})}
<div class="group">
<Button size="cta" {style} icon="plus-small" {reversedDirection}>{label}</Button>
<Button size="cta" {style} kind="solid" {outline} icon="plus-small" {reversedDirection}>