Skip to content

Commit

Permalink
migrate to svelte 5
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Dec 1, 2024
1 parent de99763 commit f97ee95
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/components/Tags.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
<script lang="ts">
import { Tag } from "carbon-components-svelte";
export let font;
let { font } = $props();
</script>

<div>
Expand Down
7 changes: 6 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import { Grid } from "carbon-components-svelte";
import Header from '$components/Header.svelte';
import Footer from '$components/Footer.svelte';
interface Props {
children?: import('svelte').Snippet;
}
let { children }: Props = $props();
onMount(() => {
store.set(sortByKey(page.content).filter(item => item.public));
Expand All @@ -18,7 +23,7 @@
<Grid fullWidth>
<Header />

<slot></slot>
{@render children?.()}

<Footer />
</Grid>
Expand Down
11 changes: 6 additions & 5 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
import Tags from '$components/Tags.svelte';
import View from "carbon-icons-svelte/lib/View.svelte";
let searchValue: string = '';
let showCustomText: boolean = false;
$: customText = '';
let isLoading = true;
let publicFonts: Record<string, any>[] = [];
let searchValue: string = $state('');
let showCustomText: boolean = $state(false);
let customText = $state('');
let isLoading = $state(true);
let publicFonts: Record<string, any>[] = $state([]);
let letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
let numbers = "0123456789".split("")
Expand Down
64 changes: 40 additions & 24 deletions src/routes/faq/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
<Column padding>
<Accordion>
<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>Where are these fonts taken from?</strong>
</svelte:fragment>
{#snippet title()}

<strong>Where are these fonts taken from?</strong>

{/snippet}

<p>
All included fonts where hand-drawn from Toshi Omagari's magnificent book
Expand All @@ -26,9 +28,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>Who are these fonts for?</strong>
</svelte:fragment>
{#snippet title()}

<strong>Who are these fonts for?</strong>

{/snippet}

<p>
The fonts have created with Panic's
Expand All @@ -38,9 +42,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>When is a font tagged as incomplete?</strong>
</svelte:fragment>
{#snippet title()}

<strong>When is a font tagged as incomplete?</strong>

{/snippet}

<p>
Fonts are tagged as incomplete, when they lack one or more characters in their supported character range. So when a font supports uppercase letters,
Expand All @@ -50,9 +56,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>Why are some fonts incomplete?</strong>
</svelte:fragment>
{#snippet title()}

<strong>Why are some fonts incomplete?</strong>

{/snippet}

<p>
This question can only be answered by the original designers of these fonts. Drawing only the characters used by a game, saving diskspace,
Expand All @@ -62,9 +70,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>Why are some fonts missing?</strong>
</svelte:fragment>
{#snippet title()}

<strong>Why are some fonts missing?</strong>

{/snippet}

<p>
If you know the book these fonts were taken from, you might wonder why some fonts are missing entirely. That's mostly the case when a font makes
Expand All @@ -75,9 +85,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>What's an unused font?</strong>
</svelte:fragment>
{#snippet title()}

<strong>What's an unused font?</strong>

{/snippet}

<p>
A font considered for a game that didn't make it into the final product. Presumably, they ended
Expand All @@ -88,9 +100,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>How are these fonts licensed?</strong>
</svelte:fragment>
{#snippet title()}

<strong>How are these fonts licensed?</strong>

{/snippet}

<p>
All included fonts are part of the public domain and as such they are available under the terms of the
Expand All @@ -100,9 +114,11 @@
</AccordionItem>

<AccordionItem open={isDev}>
<svelte:fragment slot="title">
<strong>Can I use these fonts for x?</strong>
</svelte:fragment>
{#snippet title()}

<strong>Can I use these fonts for x?</strong>

{/snippet}

<p>
If you want to use these fonts into non-Playdate projects, you might be interested in
Expand Down
12 changes: 6 additions & 6 deletions src/routes/try/[font]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
let defaultText = 'SPHINX OF BLACK QUARTZ JUDGE MY VOW';
let previewArea: HTMLElement;
let previewArea2x: HTMLElement;
let previewArea4x: HTMLElement;
let previewArea: HTMLElement = $state();
let previewArea2x: HTMLElement = $state();
let previewArea4x: HTMLElement = $state();
const font = page.content.find(font => font.name === $pageStore.params.font);
const isUppercase = !font?.features.lowercase && font?.features.uppercase;
let transformCasing = {
let transformCasing = $state({
checked: !(font?.features.lowercase && font?.features.uppercase),
label: `Convert ${isUppercase ? ' lowercase' : 'uppercase'} characters ${isUppercase ? ' to uppercase' : ' to lowercase'}`
}
let textArea: string = isUppercase ? defaultText : defaultText.toLowerCase();
})
let textArea: string = $state(isUppercase ? defaultText : defaultText.toLowerCase());
onMount(() => {
handleChange();
Expand Down

0 comments on commit f97ee95

Please sign in to comment.