@glw907/cairn-cms 0.52.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/components/AdminLayout.svelte +6 -4
- package/dist/components/EditPage.svelte +122 -47
- package/dist/components/EditPage.svelte.d.ts +2 -1
- package/dist/components/EditorToolbar.svelte +3 -43
- package/dist/components/EditorToolbar.svelte.d.ts +3 -11
- package/dist/components/MarkdownEditor.svelte +64 -17
- package/dist/components/MarkdownEditor.svelte.d.ts +3 -0
- package/dist/components/cairn-admin.css +81 -7
- package/dist/components/fonts/{Figtree-OFL.txt → IBMPlexSans-OFL.txt} +2 -2
- package/dist/components/fonts/ibm-plex-sans.woff2 +0 -0
- package/dist/sveltekit/static-admin-page.js +2 -2
- package/package.json +1 -1
- package/src/lib/components/AdminLayout.svelte +6 -4
- package/src/lib/components/EditPage.svelte +122 -47
- package/src/lib/components/EditorToolbar.svelte +3 -43
- package/src/lib/components/MarkdownEditor.svelte +64 -17
- package/src/lib/components/cairn-admin.css +27 -3
- package/src/lib/components/fonts/{Figtree-OFL.txt → IBMPlexSans-OFL.txt} +2 -2
- package/src/lib/components/fonts/ibm-plex-sans.woff2 +0 -0
- package/src/lib/sveltekit/static-admin-page.ts +2 -2
- package/dist/components/fonts/figtree.woff2 +0 -0
- package/src/lib/components/fonts/figtree.woff2 +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are recorded here, most recent first.
|
|
4
4
|
|
|
5
|
+
## 0.53.0
|
|
6
|
+
|
|
7
|
+
An iterative design session on the editor-as-home direction, shipped as one window.
|
|
8
|
+
|
|
9
|
+
The admin's UI face is now IBM Plex Sans (self-hosted, SIL OFL), replacing Figtree: the editor
|
|
10
|
+
writes in iA Writer Mono, which descends from IBM Plex Mono, so the chrome and the manuscript
|
|
11
|
+
share one type skeleton. The brand display face (Bricolage Grotesque) is unchanged.
|
|
12
|
+
|
|
13
|
+
The editor gains two surface postures, persisted and toggled from the card footer: Prose (the
|
|
14
|
+
default) is the writing instrument, a 72ch centered measure at a larger type step; Markup is the
|
|
15
|
+
working surface, a wide dense fill for tables, attributed directives, and long URLs. The footer
|
|
16
|
+
is now the writing-environment strip (word count, postures, focus mode, typewriter, help), the
|
|
17
|
+
insert actions joined the toolbar as icons, and the document title sits on the manuscript's left
|
|
18
|
+
edge. Focus mode now also eases the directive rails and the title back with the dimmed field.
|
|
19
|
+
|
|
20
|
+
The chrome cedes the stage: a narrower nav sidebar and details column, a wider gutter around the
|
|
21
|
+
editor, a quieter details card, rebalanced surface margins, and the topbar pinned to the brand
|
|
22
|
+
band's height so the header hairline meets across the seam.
|
|
23
|
+
|
|
24
|
+
Consumers may: pass the new optional `surface` prop ('prose' | 'markup') when embedding
|
|
25
|
+
`MarkdownEditor` directly. No action required; the release is additive.
|
|
26
|
+
|
|
27
|
+
## 0.52.1
|
|
28
|
+
|
|
29
|
+
Two field reports from the first 0.52.0 session, both in-editor polish with no consumer action.
|
|
30
|
+
In Write mode the editor card now hugs the manuscript (the column caps at 48rem and centers), so
|
|
31
|
+
a wide window no longer frames empty space inside the card; Preview keeps the full column for
|
|
32
|
+
its device widths. The directive rails take a 4px gap between nested bars (twice the bar
|
|
33
|
+
weight, so two rails read as two lines), and directive text gains a matching step of gutter.
|
|
34
|
+
|
|
5
35
|
## 0.52.0
|
|
6
36
|
|
|
7
37
|
The editor became a quiet writing surface. The manuscript renders in self-hosted iA Writer Mono
|
|
@@ -244,8 +244,10 @@ identical on every host regardless of the site's own theme.
|
|
|
244
244
|
|
|
245
245
|
<div class="drawer-content flex flex-col">
|
|
246
246
|
<!-- The topbar is a flat, opaque continuation of the sidebar's brand band: same surface and the
|
|
247
|
-
same hairline, no shadow, so the two form one clean header strip across the sidebar seam.
|
|
248
|
-
|
|
247
|
+
same hairline, no shadow, so the two form one clean header strip across the sidebar seam.
|
|
248
|
+
The height is pinned to the brand band's h-16 (a content-driven navbar drifts with font
|
|
249
|
+
metrics, and the two border-bottoms stop meeting at the seam). -->
|
|
250
|
+
<div class="navbar bg-base-100 border-b border-[var(--cairn-card-border)] sticky top-0 z-30 h-16 min-h-16 gap-2 px-4 py-0 lg:px-8">
|
|
249
251
|
<div class="flex-none lg:hidden">
|
|
250
252
|
<label for="cairn-drawer" aria-label="Open menu" class="btn btn-square btn-ghost">
|
|
251
253
|
<MenuIcon class="h-5 w-5" />
|
|
@@ -293,7 +295,7 @@ identical on every host regardless of the site's own theme.
|
|
|
293
295
|
</div>
|
|
294
296
|
</div>
|
|
295
297
|
|
|
296
|
-
<main class="flex-1 p-4 lg:
|
|
298
|
+
<main class="flex-1 p-4 lg:px-10 lg:py-8">
|
|
297
299
|
{@render children()}
|
|
298
300
|
</main>
|
|
299
301
|
|
|
@@ -380,7 +382,7 @@ identical on every host regardless of the site's own theme.
|
|
|
380
382
|
|
|
381
383
|
<div class="drawer-side">
|
|
382
384
|
<label for="cairn-drawer" aria-label="Close menu" class="drawer-overlay"></label>
|
|
383
|
-
<nav class="bg-base-100 flex min-h-full w-
|
|
385
|
+
<nav class="bg-base-100 flex min-h-full w-56 flex-col border-r border-[var(--cairn-card-border)]" aria-label="Site content">
|
|
384
386
|
<!-- Brand band, the same height as the topbar. The mark sits in a filled "app-icon" tile, which
|
|
385
387
|
anchors the corner as a deliberate brand object rather than a washed box. The logo and
|
|
386
388
|
wordmark link to the admin home. -->
|
|
@@ -12,12 +12,16 @@ sizes to a persisted device width picked from the toolbar's capsule. A sticky gl
|
|
|
12
12
|
carries the breadcrumb, the status badges, the save-state indicator,
|
|
13
13
|
and the lifecycle actions: Save, Publish (riding the same form via formaction while edits are
|
|
14
14
|
pending), and an overflow menu for Discard and Delete. One feedback strip under the header carries the
|
|
15
|
-
transient flashes, and the editor card's footer
|
|
15
|
+
transient flashes, and the editor card's footer is the writing-environment strip: the word
|
|
16
|
+
count, the Prose/Markup posture pair, the focus and typewriter toggles, and the Markdown help.
|
|
16
17
|
-->
|
|
17
18
|
<script lang="ts">
|
|
18
19
|
import { flushSync, untrack } from 'svelte';
|
|
19
20
|
import { beforeNavigate } from '$app/navigation';
|
|
20
21
|
import { page } from '$app/state';
|
|
22
|
+
import BlocksIcon from '@lucide/svelte/icons/blocks';
|
|
23
|
+
import LinkIcon from '@lucide/svelte/icons/link';
|
|
24
|
+
import FileSymlinkIcon from '@lucide/svelte/icons/file-symlink';
|
|
21
25
|
import CsrfField from './CsrfField.svelte';
|
|
22
26
|
import MarkdownEditor from './MarkdownEditor.svelte';
|
|
23
27
|
import EditorToolbar from './EditorToolbar.svelte';
|
|
@@ -178,16 +182,21 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
178
182
|
device = id;
|
|
179
183
|
localStorage.setItem(deviceStorageKey, id);
|
|
180
184
|
}
|
|
181
|
-
// The writing modes (focus, typewriter), per-browser preferences on
|
|
182
|
-
//
|
|
183
|
-
//
|
|
185
|
+
// The writing modes (focus, typewriter) and the surface posture, per-browser preferences on
|
|
186
|
+
// the device pick's pattern: read in an effect so SSR never touches localStorage, written by
|
|
187
|
+
// the card footer's toggles. The effect tracks nothing reactive, so it runs once.
|
|
184
188
|
const focusStorageKey = 'cairn-editor-focus-mode';
|
|
185
189
|
const typewriterStorageKey = 'cairn-editor-typewriter';
|
|
190
|
+
const surfaceStorageKey = 'cairn-editor-surface';
|
|
186
191
|
let focusMode = $state(false);
|
|
187
192
|
let typewriter = $state(false);
|
|
193
|
+
// The surface posture: prose (the writing instrument) by default; markup is the dense
|
|
194
|
+
// working surface.
|
|
195
|
+
let surface = $state<'prose' | 'markup'>('prose');
|
|
188
196
|
$effect(() => {
|
|
189
197
|
focusMode = localStorage.getItem(focusStorageKey) === 'true';
|
|
190
198
|
typewriter = localStorage.getItem(typewriterStorageKey) === 'true';
|
|
199
|
+
if (localStorage.getItem(surfaceStorageKey) === 'markup') surface = 'markup';
|
|
191
200
|
});
|
|
192
201
|
function setFocusMode(on: boolean) {
|
|
193
202
|
focusMode = on;
|
|
@@ -197,6 +206,15 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
197
206
|
typewriter = on;
|
|
198
207
|
localStorage.setItem(typewriterStorageKey, String(on));
|
|
199
208
|
}
|
|
209
|
+
function setSurface(posture: 'prose' | 'markup') {
|
|
210
|
+
surface = posture;
|
|
211
|
+
localStorage.setItem(surfaceStorageKey, posture);
|
|
212
|
+
}
|
|
213
|
+
// One source for the footer toggles' pressed/idle styling. The class names must stay verbatim
|
|
214
|
+
// string literals: the admin CSS build's @source scan reads this file as raw text.
|
|
215
|
+
function footerToggleClass(pressed: boolean): string {
|
|
216
|
+
return `btn btn-ghost btn-xs font-normal ${pressed ? 'bg-primary/10 text-primary' : 'text-[var(--color-muted)]'}`;
|
|
217
|
+
}
|
|
200
218
|
const activeDevice = $derived(previewDevice(device));
|
|
201
219
|
// The iframe document around the rendered html: the site's stylesheets from the adapter's
|
|
202
220
|
// preview knob, or a styleless document (behind the hint below) when the site sets none.
|
|
@@ -633,24 +651,37 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
633
651
|
onsubmit={onEditSubmit}
|
|
634
652
|
oninput={onFormInput}
|
|
635
653
|
oninvalidcapture={onFormInvalid}
|
|
636
|
-
class={mode === 'preview' ? '' : 'lg:grid lg:grid-cols-[
|
|
654
|
+
class={mode === 'preview' ? '' : 'lg:grid lg:grid-cols-[1fr_17rem] lg:gap-10'}
|
|
637
655
|
>
|
|
638
656
|
<CsrfField />
|
|
639
657
|
{#if data.isNew}<input type="hidden" name="new" value="1" />{/if}
|
|
640
658
|
|
|
641
|
-
|
|
659
|
+
<!-- In Write mode the card hugs the manuscript: the column caps near the 70ch measure and
|
|
660
|
+
centers, so the card frame never spans emptiness on a wide window. Preview keeps the full
|
|
661
|
+
column for its device frames. The cap follows the surface posture: prose hugs its 72ch
|
|
662
|
+
measure (49rem covers it at the prose type step), markup puts the ceiling near 89ch of
|
|
663
|
+
the base face for tables, attributed directives, and long URLs. The toggle lives in the
|
|
664
|
+
card footer with the other writing preferences. -->
|
|
665
|
+
<div class={mode === 'preview' ? 'lg:order-1' : `lg:order-1 mx-auto w-full ${surface === 'prose' ? 'max-w-[49rem]' : 'max-w-[56rem]'}`}>
|
|
642
666
|
{#if titleField}
|
|
643
667
|
<!-- The hoisted document title: large, borderless, in the display face, so the manuscript
|
|
644
668
|
reads as the protagonist. It submits as name="title", the same field as before. The
|
|
645
|
-
admin sheet gives it the editor's quiet focus hairline (see .cairn-doc-title there).
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
669
|
+
admin sheet gives it the editor's quiet focus hairline (see .cairn-doc-title there).
|
|
670
|
+
In markup posture the surface fills the card, so shared inline padding is the whole
|
|
671
|
+
alignment; in prose posture the manuscript centers on its measure, so the wrapper
|
|
672
|
+
mirrors that geometry (the editor face at the prose size, the measure, auto margins).
|
|
673
|
+
Under focus mode the title eases back with the rest of the context unless it holds
|
|
674
|
+
focus itself. -->
|
|
675
|
+
<div class={surface === 'prose' ? 'mb-4 mx-auto w-full max-w-[72ch] px-5 text-[1.0625rem] font-[family-name:var(--font-editor,ui-monospace,monospace)]' : 'mb-4 w-full px-5'}>
|
|
676
|
+
<input
|
|
677
|
+
class="cairn-doc-title w-full border-0 bg-transparent text-3xl font-bold tracking-tight font-[family-name:var(--font-display)] placeholder:text-[var(--color-muted)] {focusMode ? 'cairn-doc-title-dim' : ''}"
|
|
678
|
+
name="title"
|
|
679
|
+
value={str(data.frontmatter.title)}
|
|
680
|
+
placeholder={titleField.label}
|
|
681
|
+
aria-label={titleField.label}
|
|
682
|
+
required={titleField.required}
|
|
683
|
+
/>
|
|
684
|
+
</div>
|
|
654
685
|
{/if}
|
|
655
686
|
<!-- The editor card: the toolbar strip and the editing surface share one frame, so the editor
|
|
656
687
|
reads as a single object. The card carries the formatting shortcuts for everything in it. -->
|
|
@@ -660,52 +691,46 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
660
691
|
role="group"
|
|
661
692
|
aria-label="Editor"
|
|
662
693
|
>
|
|
663
|
-
<EditorToolbar
|
|
664
|
-
{format}
|
|
665
|
-
{mode}
|
|
666
|
-
onMode={setMode}
|
|
667
|
-
{device}
|
|
668
|
-
onDevice={setDevice}
|
|
669
|
-
{focusMode}
|
|
670
|
-
onFocusMode={setFocusMode}
|
|
671
|
-
{typewriter}
|
|
672
|
-
onTypewriter={setTypewriter}
|
|
673
|
-
>
|
|
694
|
+
<EditorToolbar {format} {mode} onMode={setMode} {device} onDevice={setDevice}>
|
|
674
695
|
{#snippet insertControls()}
|
|
675
696
|
<!-- Plain triggers only: the dialogs they open hold their own <form> elements, so the
|
|
676
|
-
dialogs themselves mount outside the edit form at the bottom of this component.
|
|
697
|
+
dialogs themselves mount outside the edit form at the bottom of this component.
|
|
698
|
+
Icon buttons like the format strip beside them: the labels live in aria-label and
|
|
699
|
+
the title tooltip, so the Insert group reads as part of one instrument strip. -->
|
|
677
700
|
{#if hasComponents}
|
|
678
701
|
<button
|
|
679
702
|
type="button"
|
|
680
|
-
class="btn btn-sm btn-ghost"
|
|
703
|
+
class="btn btn-sm btn-ghost btn-square"
|
|
681
704
|
aria-haspopup="dialog"
|
|
682
705
|
aria-label="Insert block"
|
|
706
|
+
title="Insert block"
|
|
683
707
|
disabled={insertDisabled}
|
|
684
708
|
onclick={() => insertDialog?.open()}
|
|
685
709
|
>
|
|
686
|
-
|
|
710
|
+
<BlocksIcon class="h-4 w-4" aria-hidden="true" />
|
|
687
711
|
</button>
|
|
688
712
|
{/if}
|
|
689
713
|
<button
|
|
690
714
|
type="button"
|
|
691
|
-
class="btn btn-sm btn-ghost"
|
|
715
|
+
class="btn btn-sm btn-ghost btn-square"
|
|
692
716
|
aria-haspopup="dialog"
|
|
693
717
|
aria-label="Web link (Ctrl+K)"
|
|
694
718
|
title="Web link (Ctrl+K)"
|
|
695
719
|
disabled={insertDisabled}
|
|
696
720
|
onclick={() => webLinkDialog?.open()}
|
|
697
721
|
>
|
|
698
|
-
|
|
722
|
+
<LinkIcon class="h-4 w-4" aria-hidden="true" />
|
|
699
723
|
</button>
|
|
700
724
|
<button
|
|
701
725
|
type="button"
|
|
702
|
-
class="btn btn-sm btn-ghost"
|
|
726
|
+
class="btn btn-sm btn-ghost btn-square"
|
|
703
727
|
aria-haspopup="dialog"
|
|
704
728
|
aria-label="Link to page"
|
|
729
|
+
title="Link to page"
|
|
705
730
|
disabled={insertDisabled}
|
|
706
731
|
onclick={() => linkPicker?.open()}
|
|
707
732
|
>
|
|
708
|
-
|
|
733
|
+
<FileSymlinkIcon class="h-4 w-4" aria-hidden="true" />
|
|
709
734
|
</button>
|
|
710
735
|
<button
|
|
711
736
|
type="button"
|
|
@@ -728,6 +753,7 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
728
753
|
<MarkdownEditor
|
|
729
754
|
bind:value={body}
|
|
730
755
|
name="body"
|
|
756
|
+
{surface}
|
|
731
757
|
registerInsert={(fn) => (insert = fn)}
|
|
732
758
|
registerInsertLink={(fn) => (insertLink = fn)}
|
|
733
759
|
registerGetSelection={(fn) => (getSelection = fn)}
|
|
@@ -788,17 +814,64 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
788
814
|
</div>
|
|
789
815
|
{/if}
|
|
790
816
|
<!-- The card footer, part of the same instrument frame. It stays up in Preview too, so the
|
|
791
|
-
frame never jumps between tabs and the count keeps reading while proofing.
|
|
817
|
+
frame never jumps between tabs and the count keeps reading while proofing. The strip
|
|
818
|
+
carries the writing environment (the count, the persisted writing modes, help) while
|
|
819
|
+
the top toolbar acts on the text; the toggles live here visible rather than buried in
|
|
820
|
+
an overflow menu. -->
|
|
792
821
|
<div class="flex items-center justify-between border-t border-[var(--cairn-card-border)] px-3 py-1 text-xs text-[var(--color-muted)]">
|
|
793
822
|
<span>{wordLabel}</span>
|
|
794
|
-
<
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
aria-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
823
|
+
<div class="flex items-center gap-1">
|
|
824
|
+
<!-- The pressed check is the non-color state cue (WCAG 1.4.1): pressed and idle
|
|
825
|
+
toggles share weight and size, so hue alone must not carry the state. -->
|
|
826
|
+
<div role="group" aria-label="Editing surface" class="flex items-center gap-1">
|
|
827
|
+
<button
|
|
828
|
+
type="button"
|
|
829
|
+
class={footerToggleClass(surface === 'prose')}
|
|
830
|
+
aria-pressed={surface === 'prose'}
|
|
831
|
+
onclick={() => setSurface('prose')}
|
|
832
|
+
>
|
|
833
|
+
{#if surface === 'prose'}<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5" /></svg>{/if}
|
|
834
|
+
Prose
|
|
835
|
+
</button>
|
|
836
|
+
<button
|
|
837
|
+
type="button"
|
|
838
|
+
class={footerToggleClass(surface === 'markup')}
|
|
839
|
+
aria-pressed={surface === 'markup'}
|
|
840
|
+
onclick={() => setSurface('markup')}
|
|
841
|
+
>
|
|
842
|
+
{#if surface === 'markup'}<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5" /></svg>{/if}
|
|
843
|
+
Markup
|
|
844
|
+
</button>
|
|
845
|
+
</div>
|
|
846
|
+
<div class="mx-1 h-4 w-px bg-[var(--cairn-card-border)]" aria-hidden="true"></div>
|
|
847
|
+
<button
|
|
848
|
+
type="button"
|
|
849
|
+
class={footerToggleClass(focusMode)}
|
|
850
|
+
aria-pressed={focusMode}
|
|
851
|
+
onclick={() => setFocusMode(!focusMode)}
|
|
852
|
+
>
|
|
853
|
+
{#if focusMode}<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5" /></svg>{/if}
|
|
854
|
+
Focus mode
|
|
855
|
+
</button>
|
|
856
|
+
<button
|
|
857
|
+
type="button"
|
|
858
|
+
class={footerToggleClass(typewriter)}
|
|
859
|
+
aria-pressed={typewriter}
|
|
860
|
+
onclick={() => setTypewriter(!typewriter)}
|
|
861
|
+
>
|
|
862
|
+
{#if typewriter}<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5" /></svg>{/if}
|
|
863
|
+
Typewriter
|
|
864
|
+
</button>
|
|
865
|
+
<div class="mx-1 h-4 w-px bg-[var(--cairn-card-border)]" aria-hidden="true"></div>
|
|
866
|
+
<button
|
|
867
|
+
type="button"
|
|
868
|
+
class="btn btn-ghost btn-xs font-normal text-[var(--color-muted)]"
|
|
869
|
+
aria-haspopup="dialog"
|
|
870
|
+
onclick={() => helpDialog?.open()}
|
|
871
|
+
>
|
|
872
|
+
Markdown help
|
|
873
|
+
</button>
|
|
874
|
+
</div>
|
|
802
875
|
</div>
|
|
803
876
|
</div>
|
|
804
877
|
</div>
|
|
@@ -808,7 +881,9 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
808
881
|
<aside class="lg:order-2 mt-4 lg:mt-0" class:hidden={mode === 'preview'}>
|
|
809
882
|
<!-- One sidebar card, three labeled groups. Each group is its own fieldset so its eyebrow is
|
|
810
883
|
a real legend that screen readers announce with the fields it holds. -->
|
|
811
|
-
|
|
884
|
+
<!-- Quieter than the editor card on purpose (hairline, no shadow): the editor is the one
|
|
885
|
+
floating object on the page, and the details read as margin furniture beside it. -->
|
|
886
|
+
<div class="rounded-box border border-[var(--cairn-card-border)] bg-base-100 flex flex-col gap-6 p-4">
|
|
812
887
|
{#if detailFields.length}
|
|
813
888
|
<fieldset class="m-0 flex min-w-0 flex-col gap-3 border-0 p-0">
|
|
814
889
|
<legend class={eyebrowClass}>Details</legend>
|
|
@@ -817,12 +892,12 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
817
892
|
{@const f = field as TextareaField}
|
|
818
893
|
<label class="flex flex-col gap-1">
|
|
819
894
|
<span class="text-sm font-medium">{f.label}</span>
|
|
820
|
-
<textarea class="textarea" name={f.name} aria-label={f.label} rows={f.rows ?? 3}>{str(data.frontmatter[f.name])}</textarea>
|
|
895
|
+
<textarea class="textarea textarea-sm" name={f.name} aria-label={f.label} rows={f.rows ?? 3}>{str(data.frontmatter[f.name])}</textarea>
|
|
821
896
|
</label>
|
|
822
897
|
{:else if field.type === 'date'}
|
|
823
898
|
<label class="flex flex-col gap-1">
|
|
824
899
|
<span class="text-sm font-medium">{field.label}</span>
|
|
825
|
-
<input class="input" type="date" name={field.name} aria-label={field.label} value={str(data.frontmatter[field.name])} />
|
|
900
|
+
<input class="input input-sm" type="date" name={field.name} aria-label={field.label} value={str(data.frontmatter[field.name])} />
|
|
826
901
|
</label>
|
|
827
902
|
{:else if field.type === 'boolean'}
|
|
828
903
|
<label class="label cursor-pointer justify-start gap-2">
|
|
@@ -855,7 +930,7 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
855
930
|
<label class="flex flex-col gap-1">
|
|
856
931
|
<span class="text-sm font-medium">{f.label}</span>
|
|
857
932
|
<input
|
|
858
|
-
class="input"
|
|
933
|
+
class="input input-sm"
|
|
859
934
|
name={f.name}
|
|
860
935
|
aria-label={f.label}
|
|
861
936
|
placeholder={f.placeholder}
|
|
@@ -865,7 +940,7 @@ transient flashes, and the editor card's footer holds the word count and the Mar
|
|
|
865
940
|
{:else}
|
|
866
941
|
<label class="flex flex-col gap-1">
|
|
867
942
|
<span class="text-sm font-medium">{field.label}</span>
|
|
868
|
-
<input class="input" name={field.name} aria-label={field.label} value={str(data.frontmatter[field.name])} required={field.required} />
|
|
943
|
+
<input class="input input-sm" name={field.name} aria-label={field.label} value={str(data.frontmatter[field.name])} required={field.required} />
|
|
869
944
|
</label>
|
|
870
945
|
{/if}
|
|
871
946
|
{/each}
|
|
@@ -33,7 +33,8 @@ interface Props {
|
|
|
33
33
|
* carries the breadcrumb, the status badges, the save-state indicator,
|
|
34
34
|
* and the lifecycle actions: Save, Publish (riding the same form via formaction while edits are
|
|
35
35
|
* pending), and an overflow menu for Discard and Delete. One feedback strip under the header carries the
|
|
36
|
-
* transient flashes, and the editor card's footer
|
|
36
|
+
* transient flashes, and the editor card's footer is the writing-environment strip: the word
|
|
37
|
+
* count, the Prose/Markup posture pair, the focus and typewriter toggles, and the Markdown help.
|
|
37
38
|
*/
|
|
38
39
|
declare const EditPage: import("svelte").Component<Props, {}, "">;
|
|
39
40
|
type EditPage = ReturnType<typeof EditPage>;
|
|
@@ -5,9 +5,9 @@ More overflow menu, then the host's Insert controls) and the Write/Preview segme
|
|
|
5
5
|
right. Format buttons ask the host to transform the editor's current selection; the host supplies the
|
|
6
6
|
Insert group through the `insertControls` snippet so the strip stays free of picker wiring. While
|
|
7
7
|
Preview shows, a device trigger joins the segmented capsule and opens a popover menu of preview
|
|
8
|
-
widths, reported to the host through `onDevice`. The
|
|
9
|
-
|
|
10
|
-
house style (24x24 viewBox, `currentColor`, round caps).
|
|
8
|
+
widths, reported to the host through `onDevice`. The writing-mode toggles live in the host's card
|
|
9
|
+
footer (the bottom strip carries the writing environment; this strip acts on the text). The glyphs
|
|
10
|
+
are stroke SVG icons in the admin's house style (24x24 viewBox, `currentColor`, round caps).
|
|
11
11
|
-->
|
|
12
12
|
<script lang="ts">
|
|
13
13
|
import type { Snippet } from 'svelte';
|
|
@@ -26,14 +26,6 @@ house style (24x24 viewBox, `currentColor`, round caps).
|
|
|
26
26
|
/** Pick a preview-frame width. When set, a device trigger joins the Write/Preview capsule
|
|
27
27
|
* while Preview shows. */
|
|
28
28
|
onDevice?: (id: PreviewDeviceId) => void;
|
|
29
|
-
/** Whether focus mode is on; the More menu's toggle reflects it. */
|
|
30
|
-
focusMode?: boolean;
|
|
31
|
-
/** Flip focus mode. When set, the toggle joins the More menu. */
|
|
32
|
-
onFocusMode?: (on: boolean) => void;
|
|
33
|
-
/** Whether typewriter scrolling is on; the More menu's toggle reflects it. */
|
|
34
|
-
typewriter?: boolean;
|
|
35
|
-
/** Flip typewriter scrolling. When set, the toggle joins the More menu. */
|
|
36
|
-
onTypewriter?: (on: boolean) => void;
|
|
37
29
|
/** The host's Insert controls (link picker, component insert, image), rendered in the Insert group. */
|
|
38
30
|
insertControls?: Snippet;
|
|
39
31
|
}
|
|
@@ -44,10 +36,6 @@ house style (24x24 viewBox, `currentColor`, round caps).
|
|
|
44
36
|
onMode,
|
|
45
37
|
device = 'desktop',
|
|
46
38
|
onDevice,
|
|
47
|
-
focusMode = false,
|
|
48
|
-
onFocusMode,
|
|
49
|
-
typewriter = false,
|
|
50
|
-
onTypewriter,
|
|
51
39
|
insertControls,
|
|
52
40
|
}: Props = $props();
|
|
53
41
|
|
|
@@ -265,34 +253,6 @@ house style (24x24 viewBox, `currentColor`, round caps).
|
|
|
265
253
|
ontoggle={(e) => (moreOpen = e.newState === 'open')}
|
|
266
254
|
class="dropdown menu menu-sm bg-base-100 rounded-box w-44 border border-[var(--cairn-card-border)] p-1 shadow-[var(--cairn-shadow)]"
|
|
267
255
|
>
|
|
268
|
-
<!-- The writing modes sit above the format items behind a hairline, persisted by the host.
|
|
269
|
-
The device list's idiom: plain buttons with aria-pressed carrying the on/off state (this
|
|
270
|
-
popover list is not an ARIA menu, so a menuitemcheckbox would sit in an invalid context);
|
|
271
|
-
the check glyph mirrors the state visually. A flip leaves the menu open so the new
|
|
272
|
-
pressed state is perceivable in place; only a format pick dismisses it. -->
|
|
273
|
-
{#if onFocusMode}
|
|
274
|
-
<li>
|
|
275
|
-
<button type="button" aria-pressed={focusMode} onclick={() => onFocusMode(!focusMode)}>
|
|
276
|
-
<span class="grow">Focus mode</span>
|
|
277
|
-
{#if focusMode}
|
|
278
|
-
{@render strokeIcon(checkPaths)}
|
|
279
|
-
{/if}
|
|
280
|
-
</button>
|
|
281
|
-
</li>
|
|
282
|
-
{/if}
|
|
283
|
-
{#if onTypewriter}
|
|
284
|
-
<li>
|
|
285
|
-
<button type="button" aria-pressed={typewriter} onclick={() => onTypewriter(!typewriter)}>
|
|
286
|
-
<span class="grow">Typewriter scrolling</span>
|
|
287
|
-
{#if typewriter}
|
|
288
|
-
{@render strokeIcon(checkPaths)}
|
|
289
|
-
{/if}
|
|
290
|
-
</button>
|
|
291
|
-
</li>
|
|
292
|
-
{/if}
|
|
293
|
-
{#if onFocusMode || onTypewriter}
|
|
294
|
-
<li class="my-1 border-t border-[var(--cairn-card-border)]" role="separator"></li>
|
|
295
|
-
{/if}
|
|
296
256
|
{#each moreItems as item (item.kind)}
|
|
297
257
|
<li><button type="button" onclick={() => pickMore(item.kind)}>{item.label}</button></li>
|
|
298
258
|
{/each}
|
|
@@ -13,14 +13,6 @@ interface Props {
|
|
|
13
13
|
/** Pick a preview-frame width. When set, a device trigger joins the Write/Preview capsule
|
|
14
14
|
* while Preview shows. */
|
|
15
15
|
onDevice?: (id: PreviewDeviceId) => void;
|
|
16
|
-
/** Whether focus mode is on; the More menu's toggle reflects it. */
|
|
17
|
-
focusMode?: boolean;
|
|
18
|
-
/** Flip focus mode. When set, the toggle joins the More menu. */
|
|
19
|
-
onFocusMode?: (on: boolean) => void;
|
|
20
|
-
/** Whether typewriter scrolling is on; the More menu's toggle reflects it. */
|
|
21
|
-
typewriter?: boolean;
|
|
22
|
-
/** Flip typewriter scrolling. When set, the toggle joins the More menu. */
|
|
23
|
-
onTypewriter?: (on: boolean) => void;
|
|
24
16
|
/** The host's Insert controls (link picker, component insert, image), rendered in the Insert group. */
|
|
25
17
|
insertControls?: Snippet;
|
|
26
18
|
}
|
|
@@ -30,9 +22,9 @@ interface Props {
|
|
|
30
22
|
* right. Format buttons ask the host to transform the editor's current selection; the host supplies the
|
|
31
23
|
* Insert group through the `insertControls` snippet so the strip stays free of picker wiring. While
|
|
32
24
|
* Preview shows, a device trigger joins the segmented capsule and opens a popover menu of preview
|
|
33
|
-
* widths, reported to the host through `onDevice`. The
|
|
34
|
-
*
|
|
35
|
-
* house style (24x24 viewBox, `currentColor`, round caps).
|
|
25
|
+
* widths, reported to the host through `onDevice`. The writing-mode toggles live in the host's card
|
|
26
|
+
* footer (the bottom strip carries the writing environment; this strip acts on the text). The glyphs
|
|
27
|
+
* are stroke SVG icons in the admin's house style (24x24 viewBox, `currentColor`, round caps).
|
|
36
28
|
*/
|
|
37
29
|
declare const EditorToolbar: import("svelte").Component<Props, {}, "">;
|
|
38
30
|
type EditorToolbar = ReturnType<typeof EditorToolbar>;
|