This commit is contained in:
Reudy 2026-09-26 19:13:02 +02:00
commit 0ad405c26e
78 changed files with 9127 additions and 0 deletions

View file

@ -0,0 +1,74 @@
<script lang="ts">
import type { Rect } from '$lib/model/layout';
import type { Stroke } from '$lib/model/types';
import type { PageModel } from '$lib/state/doc.svelte';
import MarkdownEditor from './MarkdownEditor.svelte';
import PdfBackground from './PdfBackground.svelte';
import InkLayer from './InkLayer.svelte';
interface Props {
page: PageModel;
rect: Rect;
active: boolean;
invert: boolean;
scale: number;
live: Stroke | null;
tick: number;
erasing: Set<string>;
onchange: () => void;
onactivate: () => void;
}
let { page, rect, active, invert, scale, live, tick, erasing, onchange, onactivate }: Props = $props();
</script>
<div
class="page"
class:active
data-page={page.id}
style="left:{rect.x}px; top:{rect.y}px; width:{rect.width}px; height:{rect.height}px"
>
<div class="paper" class:invert>
{#if page.origin}
<PdfBackground origin={page.origin} width={page.width} height={page.height} {scale} />
{/if}
<MarkdownEditor {page} {onchange} onfocus={onactivate} />
<InkLayer width={page.width} height={page.height} strokes={page.strokes} {live} {tick} {erasing} />
</div>
{#if page.origin && active}
<div class="origin" style="font-size:{11 / scale}px; top:{-18 / scale}px">{page.origin.name} · p. {page.origin.pageIndex + 1}</div>
{/if}
</div>
<style>
.page {
position: absolute;
}
.paper {
position: absolute;
inset: 0;
background: #ffffff;
overflow: hidden;
box-shadow: var(--page-shadow);
}
.paper.invert {
filter: invert(0.88) hue-rotate(180deg);
}
.page.active::after {
content: '';
position: absolute;
/* --s is the zoom, set on the world layer: keep the ring 1.5 screen px. */
inset: calc(-3px / var(--s));
border: calc(1.5px / var(--s)) solid var(--accent);
border-radius: calc(3px / var(--s));
opacity: 0.55;
pointer-events: none;
}
.origin {
position: absolute;
left: 0;
white-space: nowrap;
color: var(--faint);
pointer-events: none;
}
</style>