dep updates & little flag :)

This commit is contained in:
cupcakearmy 2022-02-04 12:23:25 +01:00
parent 2a28d7d0a6
commit 95c8c8e8b0
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
12 changed files with 733 additions and 633 deletions

View File

@ -11,26 +11,26 @@
}, },
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@graphql-codegen/cli": "^2.3.0", "@graphql-codegen/cli": "^2.5.0",
"@graphql-codegen/typescript": "^2.4.1", "@graphql-codegen/typescript": "^2.4.3",
"@graphql-codegen/typescript-graphql-request": "^4.3.2", "@graphql-codegen/typescript-graphql-request": "^4.3.4",
"@graphql-codegen/typescript-operations": "^2.2.1", "@graphql-codegen/typescript-operations": "^2.2.4",
"@sveltejs/adapter-static": "next", "@sveltejs/adapter-static": "next",
"@sveltejs/kit": "next", "@sveltejs/kit": "next",
"@types/lunr": "^2.3.4", "@types/lunr": "^2.3.4",
"graphql": "^15.8.0", "graphql": "^15.8.0",
"graphql-request": "^3.7.0", "graphql-request": "^3.7.0",
"graphql-tag": "^2.12.6", "graphql-tag": "^2.12.6",
"svelte": "^3.44.3", "svelte": "^3.46.4",
"svelte-check": "^2.2.11", "svelte-check": "^2.4.2",
"svelte-preprocess": "^4.10.1", "svelte-preprocess": "^4.10.2",
"tslib": "^2.3.1", "tslib": "^2.3.1",
"typescript": "^4.5.4" "typescript": "^4.5.5"
}, },
"dependencies": { "dependencies": {
"dayjs": "^1.10.7", "dayjs": "^1.10.7",
"highlight.js": "^11.3.1", "highlight.js": "^11.4.0",
"lunr": "^2.3.9", "lunr": "^2.3.9",
"svelte-cloudinary": "^0.2.4" "svelte-cloudinary": "^0.2.5"
} }
} }

1305
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
<nav> <nav>
<a href="/"> <a href="/">
<h1 class:active={$page.path === '/'}>NB</h1> <h1 class:active={$page.url.pathname === '/'}>NB</h1>
</a> </a>
<ul> <ul>
<li> <li>
@ -26,7 +26,7 @@
<li> <li>
<a {href}> <a {href}>
<span>{name}</span> <span>{name}</span>
<div class:active={$page.path.startsWith(href)} /> <div class:active={$page.url.pathname.startsWith(href)} />
</a> </a>
</li> </li>
{/each} {/each}

View File

@ -22,6 +22,7 @@
hljs.registerLanguage('css', css) hljs.registerLanguage('css', css)
hljs.registerLanguage('typescript', typescript) hljs.registerLanguage('typescript', typescript)
export let legend = false
export let content: string export let content: string
let headings: ArticleHeading[] | null = null let headings: ArticleHeading[] | null = null
@ -59,7 +60,7 @@
</script> </script>
<div class="adapter"> <div class="adapter">
{#if headings} {#if legend && headings}
<ArticleOverview {headings} /> <ArticleOverview {headings} />
{/if} {/if}
{@html content} {@html content}

View File

@ -22,8 +22,8 @@
let last = '' let last = ''
$: { $: {
const { host, path } = $page const { host, pathname } = $page.url
const full = host + path const full = host + pathname
if (last !== full) { if (last !== full) {
last = full last = full
if (main) setTimeout(() => (main.scrollTop = 0), 150) if (main) setTimeout(() => (main.scrollTop = 0), 150)
@ -52,7 +52,7 @@
<main bind:this={main}> <main bind:this={main}>
<slot /> <slot />
</main> </main>
{#if $page.path !== '/'} {#if $page.url.pathname !== '/'}
<Progress /> <Progress />
{/if} {/if}
</div> </div>

View File

@ -1,7 +1,7 @@
import { SDK } from '$lib/gql' import { SDK } from '$lib/gql'
import type { ServerRequest } from '@sveltejs/kit/types/hooks' import type { RequestHandler } from '@sveltejs/kit'
export async function get(args: ServerRequest) { export const get: RequestHandler<any> = async (args) => {
const { type, slug } = args.params const { type, slug } = args.params
const all = slug === '*' const all = slug === '*'

View File

@ -1,10 +1,10 @@
<script lang="ts" context="module"> <script lang="ts" context="module">
import type { Load } from '@sveltejs/kit' import type { Load } from '@sveltejs/kit'
export const load: Load = async ({ fetch, page }) => { export const load: Load = async ({ fetch, params }) => {
return { return {
props: { props: {
data: await fetch(`/api/posts/${page.params.slug}.json`).then((r) => r.json()), data: await fetch(`/api/posts/${params.slug}.json`).then((r) => r.json()),
}, },
} }
} }
@ -27,7 +27,7 @@
<SimplePage title={data.title} readable> <SimplePage title={data.title} readable>
<PostAttributes post={data} full /> <PostAttributes post={data} full />
{#if data.content} {#if data.content}
<WpAdapter content={data.content} /> <WpAdapter content={data.content} legend />
{/if} {/if}
<Tags tags={data.tags.nodes} /> <Tags tags={data.tags.nodes} />
</SimplePage> </SimplePage>

View File

@ -1,11 +1,11 @@
<script lang="ts" context="module"> <script lang="ts" context="module">
import type { Load } from '@sveltejs/kit' import type { Load } from '@sveltejs/kit'
export const load: Load = async ({ fetch, page }) => { export const load: Load = async ({ fetch, params }) => {
return { return {
props: { props: {
slug: page.params.slug, slug: params.slug,
data: await fetch(`/api/postsByTags/${page.params.slug}.json`).then((r) => r.json()), data: await fetch(`/api/postsByTags/${params.slug}.json`).then((r) => r.json()),
}, },
} }
} }

View File

@ -24,6 +24,6 @@
<SimplePage title={data.title} expanded={false}> <SimplePage title={data.title} expanded={false}>
{#if data.content} {#if data.content}
<WPAdapter content={data.content} /> <WPAdapter content={data.content} legend />
{/if} {/if}
</SimplePage> </SimplePage>

View File

@ -50,6 +50,9 @@
<SimplePage title="Search" expanded={false}> <SimplePage title="Search" expanded={false}>
<input bind:this={input} bind:value={needle} placeholder="needle" /> <input bind:this={input} bind:value={needle} placeholder="needle" />
{#if needle && needle.indexOf('haystack') !== -1}
<p>⛳️✨ Here is a flag for you. ✨⛳</p>
{/if}
{#if needle} {#if needle}
<ul> <ul>
{#each results as result (result.ref)} {#each results as result (result.ref)}

View File

@ -1,10 +1,10 @@
<script lang="ts" context="module"> <script lang="ts" context="module">
import type { Load } from '@sveltejs/kit' import type { Load } from '@sveltejs/kit'
export const load: Load = async ({ fetch, page }) => { export const load: Load = async ({ fetch, params }) => {
return { return {
props: { props: {
data: await fetch(`/api/works/${page.params.slug}.json`).then((r) => r.json()), data: await fetch(`/api/works/${params.slug}.json`).then((r) => r.json()),
}, },
} }
} }

View File

@ -6,7 +6,6 @@ const config = {
preprocess: preprocess(), preprocess: preprocess(),
kit: { kit: {
adapter: adapter(), adapter: adapter(),
target: '#svelte',
}, },
} }