mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Update svelte to v5.0
Only do the minimal changes possible to be able to keep updating dependencies.
This commit is contained in:
Generated
+753
-729
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -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",
|
||||
@@ -36,7 +36,7 @@
|
||||
"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",
|
||||
@@ -44,7 +44,7 @@
|
||||
"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",
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
|
||||
{#if !hideShortcuts}
|
||||
<div class="divider" />
|
||||
<div class="divider"></div>
|
||||
<div class="item">
|
||||
Keyboard shortcuts <KeyHint>?</KeyHint>
|
||||
</div>
|
||||
|
||||
@@ -23,4 +23,5 @@
|
||||
role="progressbar"
|
||||
aria-label="Page loading"
|
||||
class="loading-bar"
|
||||
class:visible={$isLoading} />
|
||||
class:visible={$isLoading}>
|
||||
</div>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<div slot="popover">
|
||||
<Help hideShortcuts />
|
||||
<div class="divider" />
|
||||
<div class="divider"></div>
|
||||
<Settings />
|
||||
</div>
|
||||
</Popover>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
}}>
|
||||
<Icon name="sun" />
|
||||
</Button>
|
||||
<div class="global-spacer" />
|
||||
<div class="global-spacer"></div>
|
||||
<Button
|
||||
ariaLabel="Dark Mode"
|
||||
styleBorderRadius="0"
|
||||
@@ -65,7 +65,7 @@
|
||||
}}>
|
||||
<Icon name="moon" />
|
||||
</Button>
|
||||
<div class="global-spacer" />
|
||||
<div class="global-spacer"></div>
|
||||
<Button
|
||||
ariaLabel="System Theme"
|
||||
styleBorderRadius="0"
|
||||
@@ -93,7 +93,7 @@
|
||||
: "not-selected"}>
|
||||
{font.displayName}
|
||||
</Button>
|
||||
<div class="global-spacer" />
|
||||
<div class="global-spacer"></div>
|
||||
{/each}
|
||||
</Radio>
|
||||
</div>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
@@ -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" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" strictEvents>
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
import IconButton from "./IconButton.svelte";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" strictEvent>
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
import Loading from "./Loading.svelte";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" strictEvents>
|
||||
<script lang="ts">
|
||||
import type { Route } from "@app/lib/router/definitions";
|
||||
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -517,12 +517,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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" strictEvents>
|
||||
<script lang="ts">
|
||||
import debounce from "lodash/debounce";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
+2
-1
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
+8
-10
@@ -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;
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -452,65 +452,67 @@
|
||||
{#if fileDiff.type === "plain"}
|
||||
{#if fileDiff.hunks.length > 0 && !preview}
|
||||
<table class="diff" data-file-diff-select>
|
||||
{#each fileDiff.hunks as hunk, hunkIdx}
|
||||
<tr
|
||||
class="diff-line hunk-header"
|
||||
class:selected={hunkHeaderSelected(selection, hunkIdx)}>
|
||||
<td colspan={2} style:position="relative">
|
||||
<div class="selection-indicator-left" />
|
||||
</td>
|
||||
<td
|
||||
colspan={6}
|
||||
class="diff-expand-header"
|
||||
style:position="relative">
|
||||
{hunk.header}
|
||||
<div class="selection-indicator-right" />
|
||||
</td>
|
||||
</tr>
|
||||
{#each hunk.lines as line, lineIdx}
|
||||
<tbody>
|
||||
{#each fileDiff.hunks as hunk, hunkIdx}
|
||||
<tr
|
||||
style:position="relative"
|
||||
class={`diff-line type-${line.type}`}
|
||||
class:selection-start={selection?.startHunk === hunkIdx &&
|
||||
selection.startLine === lineIdx}
|
||||
class:selection-end={(selection?.endHunk === hunkIdx &&
|
||||
selection.endLine === lineIdx) ||
|
||||
(selection?.startHunk === hunkIdx &&
|
||||
selection.startLine === lineIdx &&
|
||||
selection?.endHunk === undefined)}
|
||||
class:selected={isLineSelected(selection, hunkIdx, lineIdx)}>
|
||||
<td
|
||||
id={[filePath, "H" + hunkIdx, "L" + lineIdx].join("-")}
|
||||
class="diff-line-number left"
|
||||
on:click={e => selectLine(hunkIdx, lineIdx, e)}>
|
||||
<div class="selection-indicator-left" />
|
||||
{lineNumberL(line)}
|
||||
class="diff-line hunk-header"
|
||||
class:selected={hunkHeaderSelected(selection, hunkIdx)}>
|
||||
<td colspan={2} style:position="relative">
|
||||
<div class="selection-indicator-left"></div>
|
||||
</td>
|
||||
<td
|
||||
class="diff-line-number right"
|
||||
on:click={e => selectLine(hunkIdx, lineIdx, e)}>
|
||||
{lineNumberR(line)}
|
||||
colspan={6}
|
||||
class="diff-expand-header"
|
||||
style:position="relative">
|
||||
{hunk.header}
|
||||
<div class="selection-indicator-right"></div>
|
||||
</td>
|
||||
<td class="diff-line-type" data-line-type={line.type}>
|
||||
{lineSign(line)}
|
||||
</td>
|
||||
<td class="diff-line-content">
|
||||
{#if highlighting}
|
||||
{#if line.type === "addition" && highlighting.new}
|
||||
{@html highlighting.new[line.lineNo - 1]}
|
||||
{:else if line.type === "context" && highlighting.new}
|
||||
{@html highlighting.new[line.lineNoNew - 1]}
|
||||
{:else if line.type === "deletion" && highlighting.old}
|
||||
{@html highlighting.old[line.lineNo - 1]}
|
||||
{/if}
|
||||
{:else}
|
||||
{line.line}
|
||||
{/if}
|
||||
</td>
|
||||
<div class="selection-indicator-right" />
|
||||
</tr>
|
||||
{#each hunk.lines as line, lineIdx}
|
||||
<tr
|
||||
style:position="relative"
|
||||
class={`diff-line type-${line.type}`}
|
||||
class:selection-start={selection?.startHunk === hunkIdx &&
|
||||
selection.startLine === lineIdx}
|
||||
class:selection-end={(selection?.endHunk === hunkIdx &&
|
||||
selection.endLine === lineIdx) ||
|
||||
(selection?.startHunk === hunkIdx &&
|
||||
selection.startLine === lineIdx &&
|
||||
selection?.endHunk === undefined)}
|
||||
class:selected={isLineSelected(selection, hunkIdx, lineIdx)}>
|
||||
<td
|
||||
id={[filePath, "H" + hunkIdx, "L" + lineIdx].join("-")}
|
||||
class="diff-line-number left"
|
||||
on:click={e => selectLine(hunkIdx, lineIdx, e)}>
|
||||
<div class="selection-indicator-left"></div>
|
||||
{lineNumberL(line)}
|
||||
</td>
|
||||
<td
|
||||
class="diff-line-number right"
|
||||
on:click={e => selectLine(hunkIdx, lineIdx, e)}>
|
||||
{lineNumberR(line)}
|
||||
</td>
|
||||
<td class="diff-line-type" data-line-type={line.type}>
|
||||
{lineSign(line)}
|
||||
</td>
|
||||
<td class="diff-line-content">
|
||||
{#if highlighting}
|
||||
{#if line.type === "addition" && highlighting.new}
|
||||
{@html highlighting.new[line.lineNo - 1]}
|
||||
{:else if line.type === "context" && highlighting.new}
|
||||
{@html highlighting.new[line.lineNoNew - 1]}
|
||||
{:else if line.type === "deletion" && highlighting.old}
|
||||
{@html highlighting.old[line.lineNo - 1]}
|
||||
{/if}
|
||||
{:else}
|
||||
{line.line}
|
||||
{/if}
|
||||
</td>
|
||||
<td class="selection-indicator-right"></td>
|
||||
</tr>
|
||||
{/each}
|
||||
{/each}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{:else if isImagePath(filePath) && extension && content}
|
||||
<div style:margin="1rem 0" style:text-align="center">
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
previousRevBase !== revisionBase
|
||||
? revisionBase
|
||||
: (previousRevBase ?? revisionBase);
|
||||
$: baseMismatch = previousRevBase !== revisionBase;
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
@@ -321,7 +322,6 @@
|
||||
items={previousRevOid && previousRevId
|
||||
? [revisionBase, previousRevOid]
|
||||
: [revisionBase]}>
|
||||
{@const baseMismatch = previousRevBase !== revisionBase}
|
||||
<Link
|
||||
let:item
|
||||
disabled={item !== revisionBase && baseMismatch}
|
||||
@@ -439,7 +439,7 @@
|
||||
<div class="commits">
|
||||
{#each response.commits.toReversed() as commit}
|
||||
<div class="commit" style:position="relative">
|
||||
<div class="commit-dot" />
|
||||
<div class="commit-dot"></div>
|
||||
<CobCommitTeaser {commit} {baseUrl} {repoId} />
|
||||
</div>
|
||||
{/each}
|
||||
@@ -464,13 +464,13 @@
|
||||
{#if timelines.length > 0}
|
||||
{#each timelines as element}
|
||||
{#if element.type === "thread"}
|
||||
<div class="connector" />
|
||||
<div class="connector"></div>
|
||||
<Thread
|
||||
{baseUrl}
|
||||
thread={element.inner}
|
||||
rawPath={rawPath(revisionBase)} />
|
||||
{:else if element.type === "merge"}
|
||||
<div class="connector" />
|
||||
<div class="connector"></div>
|
||||
<div class="action merge">
|
||||
<div class="authorship-header">
|
||||
<div style:color="var(--color-fill-primary)">
|
||||
@@ -496,7 +496,7 @@
|
||||
</div>
|
||||
{:else if element.type === "review"}
|
||||
{@const [author, review] = element.inner}
|
||||
<div class="connector" />
|
||||
<div class="connector"></div>
|
||||
<div
|
||||
class="action"
|
||||
class:comment-review={review.verdict === null}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<Icon name="logo" />
|
||||
Radicle
|
||||
</Button>
|
||||
<div class="global-spacer" />
|
||||
<div class="global-spacer"></div>
|
||||
<Button
|
||||
styleWidth="100%"
|
||||
styleBorderRadius="0"
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
</CobHeader>
|
||||
<div class="bottom">
|
||||
{#if threads.length > 0}
|
||||
<div class="connector" />
|
||||
<div class="connector"></div>
|
||||
<div class="threads">
|
||||
{#each threads as thread, i (thread.root.id)}
|
||||
<ThreadComponent
|
||||
@@ -240,7 +240,7 @@
|
||||
repo.payloads["xyz.radicle.project"].meta.head,
|
||||
)} />
|
||||
{#if i < threads.length - 1}
|
||||
<div class="connector" />
|
||||
<div class="connector"></div>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -403,7 +403,7 @@
|
||||
</CobHeader>
|
||||
|
||||
<div class="tabs">
|
||||
<div class="tabs-spacer" />
|
||||
<div class="tabs-spacer"></div>
|
||||
<Radio styleGap="0.375rem">
|
||||
{#each Object.entries(tabs) as [name, { route, icon }]}
|
||||
<Link {route}>
|
||||
@@ -438,7 +438,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="tabs-spacer" />
|
||||
<div class="tabs-spacer"></div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
{#if view.name === "changes"}
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
}}>
|
||||
<Icon name="eye-open" />Preview
|
||||
</Button>
|
||||
<div class="global-spacer" />
|
||||
<div class="global-spacer"></div>
|
||||
</Radio>
|
||||
{/if}
|
||||
<a href="{rawPath}/{blob.path}" target="_blank" rel="noreferrer">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" strictEvents>
|
||||
<script lang="ts">
|
||||
import type { BaseUrl, Tree } from "@http-client";
|
||||
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" strictEvents>
|
||||
<script lang="ts">
|
||||
import type { BaseUrl, Tree } from "@http-client";
|
||||
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
@@ -41,8 +41,8 @@ test("modified file", async ({ page }) => {
|
||||
).toBeVisible();
|
||||
|
||||
// Diff.
|
||||
await expect(page.getByText("- # Git test repository")).toBeVisible();
|
||||
await expect(page.getByText("+ Updated readme")).toBeVisible();
|
||||
await expect(page.getByText("# Git test repository")).toBeVisible();
|
||||
await expect(page.getByText("Updated readme")).toBeVisible();
|
||||
});
|
||||
|
||||
test("created file", async ({ page }) => {
|
||||
|
||||
Reference in New Issue
Block a user