Skip to content

Add required changes for svelte@4 #811

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

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
384 changes: 285 additions & 99 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"md5": "^2.3.0",
"plausible-tracker": "^0.3.8",
"sinon": "^15.1.2",
"svelte": "^3.59.1",
"svelte": "^4.0.0",
"twemoji": "^14.0.2",
"zod": "^3.21.4"
}
Expand Down
1 change: 1 addition & 0 deletions src/App/ColorPaletteModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@

<Modal closeAction={false}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div slot="body">
<div class="container" on:click={() => (checkers = !checkers)}>
<div class:checkers>
Expand Down
1 change: 1 addition & 0 deletions src/App/Header/Connect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
</Link>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="dropdown-button rounded"
on:click={() => {
Expand Down
6 changes: 3 additions & 3 deletions src/App/Header/SettingsDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@
<ThemeToggle />
</div>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="item selector"
on:click|stopPropagation={() => (showFonts = !showFonts)}>
<div>Code font</div>
<Icon name={`chevron-${showFonts ? "down" : "right"}`} />
</div>
{#if showFonts}
<div
class="fonts"
transition:slide|local={{ duration: 150, easing: quadIn }}>
<div class="fonts" transition:slide={{ duration: 150, easing: quadIn }}>
{#each codeFonts as font}
{@const isSelectedFont = $codeFont === font.storedName}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
on:click={() => switchFont(font.storedName)}
class="item font"
Expand Down
1 change: 1 addition & 0 deletions src/App/ModalPortal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
{#if $modalStore}
<div class="container">
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="overlay"
on:click={hide}
Expand Down
1 change: 1 addition & 0 deletions src/components/Badge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}
</style>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<span
on:mouseenter
on:mouseleave
Expand Down
1 change: 1 addition & 0 deletions src/components/Clipboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
</style>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span
title={tooltip}
class="clipboard"
Expand Down
1 change: 1 addition & 0 deletions src/components/Dropdown/DropdownItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</style>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="item"
class:selected
Expand Down
1 change: 1 addition & 0 deletions src/components/Floating.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

<div bind:this={thisComponent}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
on:click={toggle}
class="toggle"
Expand Down
1 change: 1 addition & 0 deletions src/components/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
</style>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<svg
role="img"
on:click
Expand Down
1 change: 1 addition & 0 deletions src/components/SquareButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</style>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
{title}
on:click
Expand Down
13 changes: 5 additions & 8 deletions src/lib/modal.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import type { ComponentProps, ComponentType, SvelteComponent } from "svelte";

import { derived, get, writable } from "svelte/store";
import type {
ComponentProps,
ComponentType,
SvelteComponentTyped,
} from "svelte";

type HideCallback = () => void;

Expand Down Expand Up @@ -45,13 +42,13 @@ export function hide(): void {
store.set(undefined);
}

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

export function show<Component extends SvelteComponentTyped>(
export function show<Component extends SvelteComponent>(
args: ShowArgs<Component>,
): void {
// Defocus any active input elements, so that we can always close an open
Expand All @@ -62,7 +59,7 @@ export function show<Component extends SvelteComponentTyped>(
store.set(args);
}

export function toggle<Component extends SvelteComponentTyped>(
export function toggle<Component extends SvelteComponent>(
args: ShowArgs<Component>,
): void {
const stored = get(modalStore);
Expand Down
2 changes: 1 addition & 1 deletion src/views/projects/Blob.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
</span>
<div class="right">
{#if isMarkdown}
<div class="toggle">
<div title="Toggle render method" class="toggle">
<SquareButton clickable on:click={toggleMarkdown}>
{showMarkdown ? "Plain" : "Markdown"}
</SquareButton>
Expand Down
12 changes: 6 additions & 6 deletions src/views/projects/Cob/CobStateButton.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" strictEvents>
type T = $$Generic;
import type { IssueState } from "@httpd-client";

import Button from "@app/components/Button.svelte";
import Dropdown from "@app/components/Dropdown.svelte";
Expand All @@ -11,15 +11,15 @@
import { createEventDispatcher } from "svelte";
import { isEqual } from "lodash";

export let state: T;
export let selectedItem: [string, T];
export let items: [string, T][];
export let state: IssueState;
export let selectedItem: [string, IssueState];
export let items: [string, IssueState][];

const dispatch = createEventDispatcher<{
saveStatus: T;
saveStatus: IssueState;
}>();

function switchCaption(item: [string, T]) {
function switchCaption(item: [string, IssueState]) {
selectedItem = item;
closeFocused();
}
Expand Down
1 change: 1 addition & 0 deletions src/views/projects/SourceBrowser/FileDiff.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
<div id={file.path} class="wrapper">
<header class="header">
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="expand-button" on:click={() => (collapsed = !collapsed)}>
{#if collapsed}
<Icon name="chevron-right" />
Expand Down
1 change: 1 addition & 0 deletions src/views/projects/Tree/Folder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</style>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="folder" on:click={onClick}>
<span class="folder-name">{name}/</span>
</div>
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/project.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ test("markdown files", async ({ page }) => {

// Switch between raw and rendered modes.
{
const plainButton = page.locator('text="Plain"');
await plainButton.click();
const toggleButton = page.getByTitle("Toggle render method");
await expect(toggleButton).toHaveText("Plain");
await toggleButton.click();
await expect(page.locator("text=##### Table of Contents")).toBeVisible();

const markdownButton = page.locator('text="Markdown"');
await markdownButton.click();
await expect(toggleButton).toHaveText("Markdown");
await toggleButton.click();
}

// Internal links go to anchor.
Expand Down