Skip to content

Commit

Permalink
Update svelte to v5.0
Browse files Browse the repository at this point in the history
Only do the minimal changes possible to be able to keep updating
dependencies.
  • Loading branch information
sebastinez committed Feb 1, 2025
1 parent 4c31a81 commit 1135678
Show file tree
Hide file tree
Showing 32 changed files with 859 additions and 834 deletions.
1,458 changes: 741 additions & 717 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"devDependencies": {
"@eslint/js": "^9.11.1",
"@playwright/test": "^1.47.2",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@tsconfig/svelte": "^5.0.4",
"@types/config": "^3.3.5",
"@types/dompurify": "^3.0.5",
Expand All @@ -36,15 +36,15 @@
"config": "^3.3.12",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.44.0",
"eslint-plugin-svelte": "^2.45.1",
"execa": "^9.4.0",
"get-port": "^7.1.0",
"globals": "^15.9.0",
"happy-dom": "^15.7.4",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"svelte-check": "^4.0.2",
"svelte-eslint-parser": "^0.41.1",
"svelte-eslint-parser": "^0.42.0",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.7",
Expand Down Expand Up @@ -72,7 +72,7 @@
"marked-katex-extension": "^5.1.2",
"marked-linkify-it": "^3.1.11",
"md5": "^2.3.0",
"svelte": "^4.2.19",
"svelte": "^5.0.0",
"twemoji": "^14.0.2",
"zod": "^3.23.8"
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/check
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e

npx tsc --noEmit
npx svelte-check --tsconfig tsconfig.json --fail-on-warnings --compiler-warnings missing-custom-element-compile-options:ignore
npx svelte-check --tsconfig tsconfig.json --fail-on-warnings --compiler-warnings options_missing_custom_element:ignore
npx eslint --cache --cache-location node_modules/.cache/eslint --max-warnings 0 .
npx prettier "**/*.@(ts|js|svelte|json|css|html|yml)" --ignore-path .gitignore --check --cache
3 changes: 2 additions & 1 deletion src/App/FullscreenModalPortal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
tabindex="0"
class="overlay"
on:click={hide}
style:cursor={$modalStore.disableHide ? "not-allowed" : "default"} />
style:cursor={$modalStore.disableHide ? "not-allowed" : "default"}>
</div>
<div class="content">
<svelte:component this={$modalStore.component} {...$modalStore.props} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/App/Help.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>

{#if !hideShortcuts}
<div class="divider" />
<div class="divider"></div>
<div class="item">
Keyboard shortcuts <KeyHint>?</KeyHint>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/App/LoadingBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
role="progressbar"
aria-label="Page loading"
class="loading-bar"
class:visible={$isLoading} />
class:visible={$isLoading}>
</div>
2 changes: 1 addition & 1 deletion src/App/MobileFooter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<div slot="popover">
<Help hideShortcuts />
<div class="divider" />
<div class="divider"></div>
<Settings />
</div>
</Popover>
Expand Down
6 changes: 3 additions & 3 deletions src/App/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}}>
<Icon name="sun" />
</Button>
<div class="global-spacer" />
<div class="global-spacer"></div>
<Button
ariaLabel="Dark Mode"
styleBorderRadius="0"
Expand All @@ -65,7 +65,7 @@
}}>
<Icon name="moon" />
</Button>
<div class="global-spacer" />
<div class="global-spacer"></div>
<Button
ariaLabel="System Theme"
styleBorderRadius="0"
Expand Down Expand Up @@ -93,7 +93,7 @@
: "not-selected"}>
{font.displayName}
</Button>
<div class="global-spacer" />
<div class="global-spacer"></div>
{/each}
</Radio>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" strictEvents>
<script lang="ts">
export let ariaLabel: string | undefined = undefined;
export let title: string | undefined = undefined;
export let variant:
Expand Down
2 changes: 1 addition & 1 deletion src/components/Clipboard.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<svelte:options customElement="radicle-clipboard" />

<script lang="ts" strictEvents>
<script lang="ts">
import debounce from "lodash/debounce";
import { createEventDispatcher } from "svelte";
Expand Down
4 changes: 1 addition & 3 deletions src/components/Command.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<script lang="ts">
import { SvelteComponent } from "svelte";
import Clipboard from "@app/components/Clipboard.svelte";
export let command: string;
export let fullWidth: boolean = false;
export let showPrompt: boolean = true;
let clipboard: SvelteComponent;
let clipboard: Clipboard;
</script>

<style>
Expand Down
7 changes: 2 additions & 5 deletions src/components/Comment.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
left: -2.5px;
background-color: var(--color-fill-separator);
}
.icon {
color: var(--color-fill-gray);
}
.card-metadata {
color: var(--color-fill-gray);
font-size: var(--font-size-small);
Expand Down Expand Up @@ -101,10 +98,10 @@
<div class="card" class:card-empty-body={!body} {id} class:reply={isReply}>
<div style:position="relative">
{#if isReply}
<div class="reply-dot" />
<div class="reply-dot"></div>
{/if}
{#if isLastReply}
<div class="connector-line" />
<div class="connector-line"></div>
{/if}
<div class="card-header" class:card-header-no-icon={isReply}>
<slot class="icon" name="icon" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExpandButton.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" strictEvents>
<script lang="ts">
import { createEventDispatcher } from "svelte";
import IconButton from "./IconButton.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/components/IconButton.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" strictEvent>
<script lang="ts">
import { createEventDispatcher } from "svelte";
import Loading from "./Loading.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Link.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" strictEvents>
<script lang="ts">
import type { Route } from "@app/lib/router/definitions";
import { createEventDispatcher } from "svelte";
Expand Down
6 changes: 3 additions & 3 deletions src/components/Loading.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@
class:center
class:margins
class:condensed>
<div class="bounce1" style="" />
<div class="bounce1" style=""></div>
{#if !condensed}
<div class="bounce2" />
<div class="bounce3" />
<div class="bounce2"></div>
<div class="bounce3"></div>
{/if}
</div>
</div>
Expand Down
14 changes: 8 additions & 6 deletions src/components/Markdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,14 @@
{#if frontMatter && frontMatter.length > 0}
<div class="front-matter">
<table>
{#each frontMatter as [key, val]}
<tr>
<td><span class="txt-bold">{key}</span></td>
<td>{val}</td>
</tr>
{/each}
<tbody>
{#each frontMatter as [key, val]}
<tr>
<td><span class="txt-bold">{key}</span></td>
<td>{val}</td>
</tr>
{/each}
</tbody>
</table>
</div>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion src/components/RepoCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
}}>
<div class="repo-card" class:compact>
<div class="activity">
<div class="fadeout-overlay" />
<div class="fadeout-overlay"></div>
<ActivityDiagram
id={repo.rid}
viewBoxHeight={200}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextInput.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" strictEvents>
<script lang="ts">
import debounce from "lodash/debounce";
import { createEventDispatcher } from "svelte";
import { onMount } from "svelte";
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import App from "@app/App.svelte";
import { mount } from "svelte";

const app = new App({
const app = mount(App, {
target: document.body,
});

Expand Down
18 changes: 8 additions & 10 deletions src/lib/modal.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { ComponentProps, ComponentType, SvelteComponent } from "svelte";
import type { Component, ComponentProps } from "svelte";

import { derived, get, writable } from "svelte/store";

type HideCallback = () => void;

type Modal = {
component: ComponentType;
component: Component;
props: Record<string, unknown>;
hideCallback?: HideCallback;
disableHide?: boolean;
Expand Down Expand Up @@ -42,15 +42,14 @@ export function hide(): void {
store.set(undefined);
}

interface ShowArgs<T extends SvelteComponent> {
component: ComponentType<T>;
interface ShowArgs<T extends Component> {
component: T;
props: ComponentProps<T>;
hideCallback?: HideCallback;
}

export function show<Component extends SvelteComponent>(
args: ShowArgs<Component>,
): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function show<T extends Component<any>>(args: ShowArgs<T>): void {
// Defocus any active input elements, so that we can always close an open
// modal via the `esc` hotkey.
if (document.activeElement instanceof HTMLElement) {
Expand All @@ -59,9 +58,8 @@ export function show<Component extends SvelteComponent>(
store.set(args);
}

export function toggle<Component extends SvelteComponent>(
args: ShowArgs<Component>,
): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function toggle<T extends Component<any>>(args: ShowArgs<T>): void {
const stored = get(modalStore);

if (stored && stored.component === args.component) {
Expand Down
3 changes: 2 additions & 1 deletion src/modals/ColorPaletteModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
class:unused={!usedColors.includes(color)}
title={color}
class="color"
style:background-color={`var(${color})`} />
style:background-color={`var(${color})`}>
</div>
</div>
{/each}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/nodes/View.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
<PolicyExplainer seedingPolicy={node.config?.seedingPolicy} />
<div class="sidebar-item">
<Seeding count={stats.repos.total}>
<div style:width="2rem" />
<div style:width="2rem"></div>
</Seeding>
</div>
<div class="sidebar-item">
Expand Down
Loading

0 comments on commit 1135678

Please sign in to comment.