Skip to content

Commit

Permalink
chore: fixing migration errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shivan-s committed Nov 2, 2024
1 parent 0559b90 commit 4bfcf09
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/lib/characters/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const WAVE = '👋';
export const ROCK = '🪨';
export const ACADEMY = '🎓';
export const POLE = '💈';
export const PROGRESS = '📈';
export const JOINED = '🫶';
Expand Down
2 changes: 0 additions & 2 deletions src/lib/components/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import { fade } from 'svelte/transition';
import type { Directive } from './types';
import type { HTMLButtonAttributes } from 'svelte/elements';
import type { Snippet } from 'svelte';
interface Props extends HTMLButtonAttributes {
directive?: Directive;
children?: Snippet;
}
let { directive = 'primary', children, ...rest }: Props = $props();
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { cubicInOut } from 'svelte/easing';
import { fade } from 'svelte/transition';
import type { Snippet } from 'svelte';
interface Props {
import type { HTMLAttributes } from 'svelte/elements';
interface Props extends HTMLAttributes<HTMLElement> {
header?: Snippet;
children?: Snippet;
}
let { header, children, ...rest }: Props = $props();
Expand Down
8 changes: 1 addition & 7 deletions src/lib/components/Img.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<script lang="ts">
import type { HTMLImgAttributes } from 'svelte/elements';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Props {
alt: HTMLImgAttributes['alt'];
[key: string]: any;
}
interface Props extends HTMLImgAttributes {}
let { alt, ...rest }: Props = $props();
</script>

Expand Down
14 changes: 5 additions & 9 deletions src/lib/components/Input.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<!-- @migration-task Error while migrating Svelte code: $$props is used together with named props in a way that cannot be automatically migrated. -->
<script lang="ts">
import type { HTMLInputAttributes } from 'svelte/elements';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface $$Props extends HTMLInputAttributes {
value?: HTMLInputAttributes['value'];
}
export let value: HTMLInputAttributes['value'] = null;
interface Props extends HTMLInputAttributes {}
let { value = $bindable(), type, ...rest }: Props = $props();
</script>

{#if $$props['type'] === 'checkbox'}
<span><input type="checkbox" bind:value {...$$restProps} /></span>
{#if type === 'checkbox'}
<span><input type="checkbox" bind:value {...rest} /></span>
{:else}
<span><input bind:value {...$$restProps} /></span>
<span><input bind:value {...rest} /></span>
{/if}

<style>
Expand Down
12 changes: 4 additions & 8 deletions src/lib/components/Label.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<script>
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/** @type {Props & { [key: string]: any }} */
let { children, ...rest } = $props();
<script lang="ts">
import type { HTMLLabelAttributes } from 'svelte/elements';
interface Props extends HTMLLabelAttributes {}
let { children, ...rest }: Props = $props();
</script>

<label {...rest}>
Expand Down
12 changes: 6 additions & 6 deletions src/lib/components/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import CloseIcon from '$lib/components/icons/CloseIcon.svelte';
import { cubicInOut } from 'svelte/easing';
import { fade } from 'svelte/transition';
import type { Snippet } from 'svelte';
import type { HTMLDialogAttributes } from 'svelte/elements';
import Card from './Card.svelte';
interface Props {
interface Props extends HTMLDialogAttributes {
header?: Snippet;
id: string;
header?: import('svelte').Snippet;
children?: import('svelte').Snippet;
[key: string]: any;
}
let { id, header, children, ...rest }: Props = $props();
let { id, children, ...rest }: Props = $props();
</script>

<dialog transition:fade={{ easing: cubicInOut }} popover="auto" {id} {...rest}>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { loading } from '$lib/stores';
import { navigating, page } from '$app/stores';
import type { SelectUser } from '$lib/server/db/schema';
import { ROCK, POLE } from '$lib/characters';
import { ACADEMY, POLE } from '$lib/characters';
import Modal from '$lib/components/Modal.svelte';
interface Props {
Expand All @@ -18,7 +18,7 @@
{/if}
<nav>
<span>
<a href="/" title="Pole Rocks">{POLE} {ROCK}{ROCK} Pole Rocks</a>
<a href="/" title="Pole Academy">{POLE}{ACADEMY} Pole Academy</a>
{#if user?.isAdmin}
<a class:current={$page.url.pathname.startsWith('/admin')} href="/admin">Admin</a>
{/if}
Expand Down
3 changes: 0 additions & 3 deletions src/lib/components/Spinner.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<script lang="ts">
</script>

<span class="loader"></span>

<style>
Expand Down
15 changes: 8 additions & 7 deletions src/lib/components/TextArea.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<script lang="ts">
interface Props {
[key: string]: any;
}
let { ...rest }: Props = $props();
import { browser } from '$app/environment';
let { ...rest } = $props();
let content: string | null = $state(null);
</script>

<div contenteditable bind:innerHTML={content} {...rest}></div>
<input type="hidden" {...rest} value={content} />
{#if browser}
<div contenteditable bind:innerHTML={content} {...rest}></div>
<input type="hidden" {...rest} value={content} />
{:else}
<textarea bind:value={content}></textarea>
{/if}

<style>
div {
Expand Down
13 changes: 4 additions & 9 deletions src/lib/components/UL.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<script lang="ts">
import type { HTMLOlAttributes } from 'svelte/elements';
interface Props {
children?: import('svelte').Snippet;
[key: string]: any;
}
import type { HTMLAttributes } from 'svelte/elements';
interface Props extends HTMLAttributes<HTMLUListElement> {}
let { ...props }: Props = $props();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface $$Props extends HTMLOlAttributes {}
let { children, ...rest }: Props = $props();
</script>

<ul {...props}>{@render props.children?.()}</ul>
<ul {...rest}>{@render children?.()}</ul>

<style>
ul {
Expand Down
7 changes: 1 addition & 6 deletions src/lib/components/icons/GitHub.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<script lang="ts">
import type { SVGAttributes } from 'svelte/elements';
interface Props {
[key: string]: any;
}
interface Props extends SVGAttributes<SVGElement> {}
let { ...props }: Props = $props();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface $$Props extends SVGAttributes<SVGElement> {}
</script>

<svg {...props} viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"
Expand Down

0 comments on commit 4bfcf09

Please sign in to comment.