Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bump all svelte related dependencies #4828

Merged
merged 10 commits into from
Sep 6, 2024
24 changes: 11 additions & 13 deletions apps/desktop/src/lib/branch/ActiveBranchStatus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,16 @@
>
{/if}
{#if !isUnapplied && !isLaneCollapsed}
{#await normalizedBranchName then name}
<Button
clickable={false}
size="tag"
style="neutral"
shrinkable
disabled
tooltip={'Branch name that will be used when pushing.\nChange it from the lane menu'}
>
{name}
</Button>
{/await}
<Button
clickable={false}
size="tag"
style="neutral"
shrinkable
disabled
tooltip={'Branch name that will be used when pushing.\nChange it from the lane menu'}
>
{normalizedBranchName}
</Button>
{/if}
{:else}
<Button
Expand All @@ -90,7 +88,7 @@
style="ghost"
outline
shrinkable
onclick={(e) => {
onclick={(e: MouseEvent) => {
const url = gitHostBranch?.url;
if (url) openExternalUrl(url);
e.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/lib/branch/BranchPreviewHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
style="ghost"
outline
shrinkable
onclick={(e) => {
onclick={(e: MouseEvent) => {
const url = gitHostBranch.url;
if (url) openExternalUrl(url);
e.preventDefault();
Expand All @@ -81,7 +81,7 @@
icon="pr-small"
style="ghost"
outline
onclick={(e) => {
onclick={(e: MouseEvent) => {
const url = pr?.htmlUrl;
if (url) openExternalUrl(url);
e.preventDefault();
Expand Down
5 changes: 3 additions & 2 deletions apps/desktop/src/lib/commit/CommitCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,12 @@
style="ghost"
outline
icon="undo-small"
onclick={(e) => {
onclick={(e: MouseEvent) => {
currentCommitMessage.set(commit.description);
e.stopPropagation();
undoCommit(commit);
}}>Undo</Button
}}
>Undo</Button
>
{/if}
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
{:else}
<Button
style="error"
onclick={(e) => {
onclick={(e: MouseEvent) => {
e.stopPropagation();
deletePrompt();
}}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/components/Board.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" async="true">
<script lang="ts">
import BoardEmptyState from './BoardEmptyState.svelte';
import FullviewLoading from './FullviewLoading.svelte';
import BranchDropzone from '$lib/branch/BranchDropzone.svelte';
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/lib/components/BranchPreview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
const fileIdSelection = new FileIdSelection(project.id, writable([]));
setContext(FileIdSelection, fileIdSelection);

// eslint-disable-next-line svelte/valid-compile
$: selectedFile = fileIdSelection.selectedFile;

const defaultBranchWidthRem = 30;
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/components/ProjectSetup.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script async lang="ts">
<script lang="ts">
import ProjectSetupTarget from './ProjectSetupTarget.svelte';
import newProjectSvg from '$lib/assets/illustrations/new-project.svg?raw';
import { Project, ProjectService } from '$lib/backend/projects';
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/components/ProjectSetupTarget.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script async lang="ts">
<script lang="ts">
import ProjectNameLabel from '../shared/ProjectNameLabel.svelte';
import { ProjectService, Project } from '$lib/backend/projects';
import Login from '$lib/components/Login.svelte';
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/components/SectionCard.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script module lang="ts">
export type SectionCardBackground = 'loading' | 'success' | 'error' | undefined;
</script>

Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/components/SyncButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
icon="update-small"
tooltip="Last fetch from upstream"
{loading}
onmousedown={async (e) => {
onmousedown={async (e: MouseEvent) => {
e.preventDefault();
e.stopPropagation();
loading = true;
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/file/BranchFilesHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
small
{checked}
{indeterminate}
onchange={(e) => {
onchange={(e: Event & { currentTarget: EventTarget & HTMLInputElement; }) => {
const isChecked = e.currentTarget.checked;
if (isChecked) {
selectAll(files);
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/navigation/ChunkyList.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
// If this is not present, eslint complains that T is not defined below
type T = unknown;
</script>
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/lib/navigation/Navigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
let isResizerHovered = false;
let isResizerDragging = false;

// eslint-disable-next-line svelte/valid-compile
$: isNavCollapsed = persisted<boolean>(false, 'projectNavCollapsed_' + project.id);

function toggleNavCollapse() {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/lib/navigation/TargetCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
const baseBranchService = getContext(BaseBranchService);
const project = getContext(Project);

// eslint-disable-next-line svelte/valid-compile
$: base = baseBranchService.base;
$: selected = $page.url.href.endsWith('/base');
</script>
Expand Down
17 changes: 7 additions & 10 deletions apps/desktop/src/lib/pr/PullRequestButton.svelte
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
<script lang="ts" context="module">
export enum Action {
<script lang="ts">
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte';
import { persisted } from '$lib/persisted/persisted';
import DropDownButton from '$lib/shared/DropDownButton.svelte';

enum Action {
Create = 'createPr',
CreateDraft = 'createDraftPr'
}

const actions = Object.values(Action);
const labels = {
[Action.Create]: 'Create PR',
[Action.CreateDraft]: 'Create Draft PR'
};
</script>

<script lang="ts">
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte';
import { persisted } from '$lib/persisted/persisted';
import DropDownButton from '$lib/shared/DropDownButton.svelte';

type Props = {
loading: boolean;
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/lib/pr/ViewPrButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
outline
shrinkable
bind:el={viewPrButton}
onclick={(e) => {
onclick={(e: MouseEvent) => {
openExternalUrl(url);
e.preventDefault();
e.stopPropagation();
}}
oncontextmenu={(e) => {
oncontextmenu={(e: MouseEvent) => {
e.preventDefault();
copyLinkContextMenu?.openByMouse(e);
}}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/scroll/Scrollbar.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
export type ScrollbarPaddingType = {
top?: number;
right?: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/select/Select.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
export type SelectItem = {
label: string;
value: string;
Expand Down
6 changes: 4 additions & 2 deletions apps/desktop/src/lib/shared/InfoMessage.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<script lang="ts" context="module">
<script lang="ts" module>
import type { ComponentColor } from '@gitbutler/ui/utils/colorTypes';
export type MessageStyle = Exclude<ComponentColor, 'ghost' | 'purple'>;
</script>

<script lang="ts">
import Button from '@gitbutler/ui/Button.svelte';
import Icon, { type IconColor } from '@gitbutler/ui/Icon.svelte';
import Icon from '@gitbutler/ui/Icon.svelte';
import { createEventDispatcher } from 'svelte';
import type iconsJson from '@gitbutler/ui/data/icons.json';

type IconColor = ComponentColor | undefined;

export let icon: keyof typeof iconsJson | undefined = undefined;
export let style: MessageStyle = 'neutral';
export let outlined: boolean = true;
Expand Down
8 changes: 3 additions & 5 deletions apps/desktop/src/routes/[projectId]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,20 @@
const mode = $derived(modeService.mode);
const head = $derived(modeService.head);

// We end up with a `state_unsafe_mutation` when switching projects if we
// don't use $effect.pre here.
// TODO: can we eliminate the need to debounce?
const fetch = $derived(fetchSignal.event);
const debouncedBaseBranchResfresh = debounce(() => baseBranchService.refresh(), 500);
$effect.pre(() => {
$effect(() => {
if ($fetch || $head) debouncedBaseBranchResfresh();
});

// TODO: can we eliminate the need to debounce?
const debouncedRemoteBranchRefresh = debounce(() => remoteBranchService.refresh(), 500);
$effect.pre(() => {
$effect(() => {
if ($baseBranch || $head || $fetch) debouncedRemoteBranchRefresh();
});

$effect.pre(() => {
$effect(() => {
const gitHost =
repoInfo && baseBranchName
? gitHostFactory.build(
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/routes/[projectId]/base/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
const fileIdSelection = new FileIdSelection(project.id, writable([]));
setContext(FileIdSelection, fileIdSelection);

// eslint-disable-next-line svelte/valid-compile
$: selectedFile = fileIdSelection.selectedFile;

let rsViewport: HTMLDivElement;
let laneWidth: number;

// eslint-disable-next-line svelte/valid-compile
$: error = baseBranchService.error;

onMount(() => {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/routes/[projectId]/board/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

$: {
if ($mode?.type === 'Edit') {
// eslint-disable-next-line svelte/valid-compile
goto(`/${project.id}/edit`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: vitePreprocess(),
preprocess: vitePreprocess({ script: true }),
Copy link
Contributor Author

@ndom91 ndom91 Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required in vite-plugin-svelte@4.0.0+ in order to use enums in .svelte files (Source)

kit: {
adapter: staticAdapter({
pages: 'build',
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/routes/downloads/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
margin-block: 0.5rem;
overflow: hidden;
display: -webkit-box;
line-clamp: 5;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.4",
"svelte-eslint-parser": "^0.41.0",
"turbo": "2.1.1-canary.0",
"turbo": "2.1.1",
"typescript": "5.4.5",
"typescript-eslint": "^7.13.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/Badge.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
import type { ComponentColor, ComponentStyleKind } from '$lib/utils/colorTypes';

export interface BadgeProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
export interface ButtonProps {
el?: HTMLElement;
// Interaction props
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/Checkbox.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
export interface CheckboxProps {
name?: string;
small?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
import { pxToRem } from '$lib/utils/pxToRem';
export type IconColor = ComponentColor | undefined;
</script>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/Tooltip.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script lang="ts" module>
export type TooltipPosition = 'top' | 'bottom';
export type TooltipAlign = 'start' | 'center' | 'end';
</script>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/avatar/AvatarGroup.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" context="module">
<script module lang="ts">
export interface Props {
avatars: {
srcUrl: string;
Expand Down
32 changes: 22 additions & 10 deletions packages/ui/src/stories/button/DemoAllButtons.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import type { ComponentColor } from '$lib/utils/colorTypes';
import Button from '$lib/Button.svelte';

interface Props {
Expand All @@ -9,32 +10,43 @@
const { label, reversedDirection }: Props = $props();
</script>

{#snippet buttons({ label, outline, style, reversedDirection })}
{#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}
>{label}</Button
>
<Button size="cta" {style} kind="solid" {outline} icon="plus-small" {reversedDirection}>
{label}
</Button>
<Button size="cta" {style} {reversedDirection}>{label}</Button>
<Button size="cta" {style} kind="solid" {outline} {reversedDirection}>{label}</Button>
<Button size="cta" {style} icon="plus-small" />
<Button size="cta" {style} kind="solid" {outline} icon="plus-small" />
</div>
<div class="group">
<Button size="button" {style} icon="plus-small" {reversedDirection}>{label}</Button>
<Button size="button" {style} kind="solid" {outline} icon="plus-small" {reversedDirection}
>{label}</Button
>
<Button size="button" {style} kind="solid" {outline} icon="plus-small" {reversedDirection}>
{label}
</Button>
<Button size="button" {style} {reversedDirection}>{label}</Button>
<Button size="button" {style} kind="solid" {outline} {reversedDirection}>{label}</Button>
<Button size="button" {style} icon="plus-small" />
<Button size="button" {style} kind="solid" {outline} icon="plus-small" />
</div>
<div class="group">
<Button size="tag" {style} icon="plus-small" {reversedDirection}>{label}</Button>
<Button size="tag" {style} kind="solid" {outline} icon="plus-small" {reversedDirection}
>{label}</Button
>
<Button size="tag" {style} kind="solid" {outline} icon="plus-small" {reversedDirection}>
{label}
</Button>
<Button size="tag" {style} {reversedDirection}>{label}</Button>
<Button size="tag" {style} kind="solid" {outline} {reversedDirection}>{label}</Button>
<Button size="tag" {style} icon="plus-small" />
Expand Down
Loading