Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dfa4c35
Initial migration
WarningImHack3r Oct 19, 2024
4451791
Other basic migration
WarningImHack3r Oct 19, 2024
09eac3b
First batch of run functions bye bye
WarningImHack3r Oct 19, 2024
a3b2d6a
Second batch
WarningImHack3r Oct 19, 2024
f3b34d1
Prepare preview build, fix ScreenSize
WarningImHack3r Oct 19, 2024
58fefca
Update to 5.0.1
WarningImHack3r Oct 19, 2024
e0682b7
No more any, code improvements
WarningImHack3r Oct 27, 2024
7d8423b
Remove temporary navbar stuff
WarningImHack3r Oct 27, 2024
feafa60
Update Svelte 5 (libs)
WarningImHack3r Oct 27, 2024
1c0b6fe
Initial shadcn-svelte beta migration
WarningImHack3r Oct 27, 2024
7cb1f7b
Type fixes
WarningImHack3r Oct 27, 2024
906f888
Fix Prettier lol
WarningImHack3r Oct 27, 2024
30dbf0c
Update comment
WarningImHack3r Oct 27, 2024
10dfb26
Fix lockfile
WarningImHack3r Nov 27, 2024
2fc5a69
Merge branch 'main' into svelte-5
WarningImHack3r Nov 27, 2024
0925fd4
Update shadcn-svelte
WarningImHack3r Nov 27, 2024
86894e0
Remove $derived's for data, likely fix long-standing issue, adding mi…
WarningImHack3r Feb 7, 2025
3bf96e5
Merge branch 'main' into svelte-5
WarningImHack3r Feb 7, 2025
8dbc561
Fix lockfile
WarningImHack3r Feb 7, 2025
66df23c
Fix lint
WarningImHack3r Feb 7, 2025
5c0d5ae
Fix yoinked typography plugin, adjust styles
WarningImHack3r Feb 7, 2025
bf56f27
Revert TW config tweaks
WarningImHack3r Feb 7, 2025
f73aeaa
Fix lint again
WarningImHack3r Feb 7, 2025
58674b7
Update components and bits-ui
WarningImHack3r Feb 7, 2025
4be7dac
Migrate to $app/state
WarningImHack3r Feb 7, 2025
7c0de2e
Fix navbar button size
WarningImHack3r Feb 7, 2025
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
10 changes: 7 additions & 3 deletions components.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://shadcn-svelte.com/schema.json",
"$schema": "https://next.shadcn-svelte.com/schema.json",
"style": "default",
"tailwind": {
"config": "tailwind.config.ts",
Expand All @@ -8,6 +8,10 @@
},
"aliases": {
"components": "$lib/components",
"utils": "$lib/utils"
}
"utils": "$lib/utils",
"ui": "$lib/components/ui",
"hooks": "$lib/hooks"
},
"typescript": true,
"registry": "https://next.shadcn-svelte.com/registry"
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
},
"devDependencies": {
"@neoconfetti/svelte": "^2.2.1",
"@octokit/graphql-schema": "^15.25.0",
"@shikijs/langs": "^1.25.1",
"@shikijs/rehype": "^1.25.1",
"@shikijs/themes": "^1.25.1",
"@sveltejs/adapter-vercel": "^5.5.2",
"@sveltejs/kit": "^2.15.1",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@tailwindcss/typography": "^0.5.15",
"@total-typescript/ts-reset": "^0.6.1",
"@types/eslint-config-prettier": "^6.11.3",
"@types/semver": "^7.5.8",
"@vercel/speed-insights": "^1.1.0",
"arctic": "^1.9.2",
"autoprefixer": "^10.4.20",
"bits-ui": "^0.22.0",
"bits-ui": "1.0.0-next.74",
"clsx": "^2.1.1",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -44,16 +45,17 @@
"rehype-raw": "^7.0.0",
"semver": "^7.6.3",
"shiki": "^1.25.1",
"svelte": "^4.2.19",
"svelte": "^5.1.3",
"svelte-check": "^4.1.1",
"svelte-exmarkdown": "^3.0.5",
"svelte-meta-tags": "^3.1.4",
"svelte-exmarkdown": "^4.0.1",
"svelte-meta-tags": "^4.0.4",
"svelte-persisted-store": "^0.12.0",
"svelte-sonner": "^0.3.28",
"sveltekit-search-params": "^3.0.0",
"tailwind-merge": "^2.6.0",
"tailwind-variants": "^0.3.0",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.19.0",
Expand Down
1,228 changes: 663 additions & 565 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

33 changes: 19 additions & 14 deletions src/lib/components/BlinkingBadge.svelte
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<script lang="ts">
import { onMount } from "svelte";
import { onMount, type Snippet } from "svelte";
import { get } from "svelte/store";
import { persisted } from "svelte-persisted-store";
import { plainTextSerializer } from "$lib/stores";

/**
* The name of the localStorage item to get the date from.
*/
export let storedDateItem: string;
/**
* Whether to show the pulse animation.
*/
export let show = false;
type Props = {
/**
* The name of the localStorage item to get the date from.
*/
storedDateItem: string;
/**
* Whether to show the pulse animation.
*/
show?: boolean;
children?: Snippet;
};

let shouldShowPulse = false;
let { storedDateItem, show = false, children }: Props = $props();

let shouldShowPulse = $state(false);

onMount(() => {
if (!storedDateItem) return;
Expand All @@ -30,14 +35,14 @@

{#if show && shouldShowPulse}
<div class="relative inline-flex">
<slot />
{@render children?.()}
<span class="absolute right-0 top-0 -mr-0.5 -mt-0.5 flex size-2.5">
<span
class="absolute inline-flex h-full w-full animate-ping rounded-full bg-primary opacity-75"
/>
<span class="inline-flex size-2.5 rounded-full bg-primary" />
></span>
<span class="inline-flex size-2.5 rounded-full bg-primary"></span>
</span>
</div>
{:else}
<slot />
{@render children?.()}
{/if}
19 changes: 12 additions & 7 deletions src/lib/components/GHBadge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
} from "lucide-svelte";

type CommonStatus = "open" | "closed";
type Props =
type PropsObj =
| {
type: "pull";
status: "draft" | CommonStatus | "merged";
Expand All @@ -22,12 +22,16 @@
status: CommonStatus | "solved";
};

export let type: Props["type"];
export let status: Props["status"]; // NOT type-safe for now, waiting for Svelte 5 props declaration
type Props = {
type: PropsObj["type"];
status: PropsObj["status"];
};

let icon: ComponentType<Icon> | null = null;
let label = "";
let color = "";
let { type, status }: Props = $props();

let icon = $state<ComponentType<Icon>>();
let label = $state("");
let color = $state("");

switch (type) {
case "pull":
Expand Down Expand Up @@ -77,7 +81,8 @@

<div class="flex items-center rounded-full px-4 py-2 text-white {color}">
{#if icon}
<svelte:component this={icon} class="mr-2 size-5" />
{@const SvelteComponent = icon}
<SvelteComponent class="mr-2 size-5" />
{/if}
<span class="font-semibold">{label}</span>
</div>
22 changes: 15 additions & 7 deletions src/lib/components/MarkdownRenderer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@
import rehypeRaw from "rehype-raw";
import { cn } from "$lib/utils";

export let markdown: string;
export let inline = false;
export let parseRawHtml = false;
export let additionalPlugins: Plugin[] = [];
type Props = {
markdown: string;
inline?: boolean;
parseRawHtml?: boolean;
additionalPlugins?: Plugin[];
class?: string | undefined | null;
};

let className: string | undefined | null = undefined;
export { className as class };
let {
markdown: md,
inline = false,
parseRawHtml = false,
additionalPlugins = [],
class: className = undefined
}: Props = $props();
</script>

<!-- TODO: actually figure out how to overflow-x-auto the code blocks -->
Expand All @@ -30,7 +38,7 @@
)}
>
<Markdown
md={markdown}
{md}
plugins={[
gfmPlugin(),
...(parseRawHtml ? [{ rehypePlugin: rehypeRaw }] : []),
Expand Down
11 changes: 5 additions & 6 deletions src/lib/components/ScreenSize.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
size: parseInt(configScreens[screen as keyof typeof configScreens].replace("px", ""))
}))
.sort((a, b) => a.size - b.size);
let matchingScreen: (typeof screens)[number] | undefined;
$: matchingScreen = screens.findLast(screen => screen.size <= width);

let width = 0;
let height = 0;
let width = $state(0);
let height = $state(0);

let showAllScreens = false;
let matchingScreen = $derived(screens.findLast(screen => screen.size <= width));
let showAllScreens = $state(false);
</script>

<svelte:window bind:innerWidth={width} bind:innerHeight={height} />
Expand All @@ -36,7 +35,7 @@
<button
type="button"
class="inline rounded-l-sm rounded-r-full px-1 hover:bg-neutral-500 active:bg-neutral-600"
on:click={() => (showAllScreens = !showAllScreens)}
onclick={() => (showAllScreens = !showAllScreens)}
>
{matchingScreen.name.toUpperCase()}
</button>
Expand Down
16 changes: 11 additions & 5 deletions src/lib/components/Step.svelte
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { cn } from "$lib/utils";

let className: string | undefined | null = undefined;
export { className as class };
type Props = {
class?: string | undefined | null;
stepIcon?: Snippet;
children?: Snippet;
};

let { class: className = undefined, stepIcon, children }: Props = $props();
</script>

<div class={cn("step relative", className)}>
<span
class="absolute -ml-[50px] -mt-0.5 inline-flex size-9 items-center justify-center rounded-full border-4 border-background bg-muted text-center -indent-[1px] font-mono text-base font-normal"
>
{#if $$slots.stepIcon}
<slot name="stepIcon" />
{#if stepIcon}
{@render stepIcon?.()}
{:else}
<span class="[counter-increment:step] before:content-[counter(step)]"></span>
{/if}
</span>
<slot />
{@render children?.()}
</div>
14 changes: 10 additions & 4 deletions src/lib/components/Steps.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { cn } from "$lib/utils";

let className: string | undefined | null = undefined;
export { className as class };
type Props = {
class?: string | undefined | null;
children?: Snippet;
[key: string]: unknown;
};

let { class: className = undefined, children, ...rest }: Props = $props();
</script>

<div
class={cn("ml-4 border-l pl-8 [counter-reset:step] [&>.step:not(:first-child)]:mt-8", className)}
{...$$restProps}
{...rest}
>
<slot />
{@render children?.()}
</div>
21 changes: 13 additions & 8 deletions src/lib/components/renderers/BodyRenderer.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<script lang="ts">
import { page } from "$app/stores";
let data: HTMLParagraphElement | undefined = undefined;
import type { Snippet } from "svelte";
import { page } from "$app/state";

const org = $page.data.org;
const repo = $page.data.repo;
type Props = {
children?: Snippet;
};

$: if (data) {
let { children }: Props = $props();
let data = $state<HTMLParagraphElement>();

$effect(() => {
if (!data) return;
let replaced = data.innerHTML;
const issuesCandidates = replaced.matchAll(/ #(\d+)/g) || [];
for (let candidate of issuesCandidates) {
Expand All @@ -14,13 +19,13 @@
if (!wholeMatch || !matchedGroup) continue;
replaced = replaced.replace(
wholeMatch,
` <a href="https://github.com/${org}/${repo}/issues/${matchedGroup}">${wholeMatch.trim()}</a>`
` <a href="https://github.com/${page.data.org}/${page.data.repo}/issues/${matchedGroup}">${wholeMatch.trim()}</a>`
);
}
data.innerHTML = replaced;
}
});
</script>

<p bind:this={data}>
<slot />
{@render children?.()}
</p>
34 changes: 21 additions & 13 deletions src/lib/components/renderers/ListElementRenderer.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { ArrowRight } from "lucide-svelte";
import { Button } from "$lib/components/ui/button";

let data: HTMLLIElement | undefined = undefined;
type Props = {
children?: Snippet;
};

let { children }: Props = $props();

let data = $state<HTMLLIElement>();
let pullsLinks: string[] = [];
let issuesLinks: string[] = [];
let allLinks: string[] = [];

$: if (data) {
const links = data.innerHTML.match(/https?:\/\/[^"]+/g) || [];
for (const link of links) {
if (link.includes("/pull/")) {
pullsLinks.push(link);
} else if (link.includes("/issues/")) {
issuesLinks.push(link);
let allLinks = $derived.by(() => {
if (data) {
const links = data.innerHTML.match(/https?:\/\/[^"]+/g) || [];
for (const link of links) {
if (link.includes("/pull/")) {
pullsLinks.push(link);
} else if (link.includes("/issues/")) {
issuesLinks.push(link);
}
}
return [...pullsLinks, ...issuesLinks];
}
allLinks = [...pullsLinks, ...issuesLinks];
}
return [];
});

/**
* Replaces a link with `https://github.com/username/repo/[pull|issues]/123`
Expand All @@ -39,7 +47,7 @@
class:font-semibold={data?.innerText.startsWith("breaking:")}
class="group *:inline"
>
<slot />
{@render children?.()}
{#if allLinks.length > 0}
<Button
href={ghLinkToHref(allLinks[0] ?? "")}
Expand Down
Loading
Loading