Repository navigation
Expand file tree
/
Copy path+page.svelte
More file actions
1724 lines (1676 loc) · 85 KB
/
Copy path+page.svelte
File metadata and controls
1724 lines (1676 loc) · 85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<script lang="ts">
import App from '#app/components/App.svelte';
import type { PageData } from './$types';
let { data }: { data: PageData } = $props();
</script>
<!--
Canonical visual recipes. Copy the classes into the element that fits the interaction.
Keep examples explicit; adapt semantics and behavior in the consuming code.
Colors, fonts, and corner radius come from app.css.
-->
<App {...data}>
<div class="bg-(--background) pt-block-generous pb-16 font-sans text-(--foreground)">
<div class="mx-auto max-w-7xl space-y-16 px-5 sm:px-7">
<header class="space-y-3">
<h1 class="display-2">The Editable Design System</h1>
<p class="max-w-xl text-base leading-relaxed text-(--muted-foreground)">
A shared starting point for Editable. Simple styles, ready to use and adapt.
</p>
</header>
<section
id="foundations"
aria-labelledby="foundations-heading"
class="space-y-12 lg:space-y-16"
>
<div class="space-y-2">
<h2 id="foundations-heading" class="text-xl font-medium">Foundations</h2>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Colors, fonts, and corner radii come from the shared tokens in
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>src/app.css</code
>. These specimens follow the current token values.
</p>
</div>
<div class="space-y-5 sm:space-y-7">
<h3 class="text-sm font-medium">Colors and surfaces</h3>
<p class="max-w-prose body-sm text-(--muted-foreground)">
Keep each surface with its foreground color. Neutral controls use the muted surface on
hover and a 10% foreground tint on press. Primary actions and editing actions use their
respective accent treatments.
</p>
<div class="grid grid-cols-1 gap-x-5 gap-y-8 sm:gap-x-7 lg:grid-cols-3 lg:gap-y-7">
<div class="space-y-3">
<div
class="flex min-h-28 items-center rounded-(--image-border-radius) border border-(--stroke) bg-(--background) p-5 body-base text-(--foreground)"
>
Page content
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--background</code
>
/
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--foreground</code
>
</p>
</div>
<div class="space-y-3">
<div
class="flex min-h-28 flex-col justify-center gap-1 rounded-(--image-border-radius) border border-(--stroke) bg-(--muted) p-5 body-base text-(--foreground)"
>
<p>Secondary surface</p>
<p class="body-sm text-(--muted-foreground)">Supporting text</p>
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--muted</code
>
/
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--muted-foreground</code
>
</p>
</div>
<div class="space-y-3">
<div
class="flex min-h-28 items-center rounded-(--image-border-radius) border border-transparent bg-(--accent) p-5 body-base text-(--accent-foreground)"
>
Primary action or highlight
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--accent</code
>
/
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--accent-foreground</code
>
</p>
</div>
<div class="space-y-3">
<div
class="flex min-h-28 items-center rounded-(--image-border-radius) border border-transparent bg-(--editing) p-5 body-base text-(--editing-foreground)"
>
Active editing
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--editing</code
>
/
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--editing-foreground</code
>
</p>
</div>
<div class="space-y-3">
<div
class="flex min-h-28 items-center rounded-(--image-border-radius) border border-(--stroke) bg-(--editing-muted) p-5 body-base text-(--editing)"
>
Passive editing highlight
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--editing-muted</code
>
/
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--editing</code
>
</p>
</div>
<div class="space-y-3">
<div
class="flex min-h-28 flex-col justify-center gap-3 rounded-(--image-border-radius) border border-(--stroke) bg-(--background) p-5 body-base"
>
<p>Borders and dividers</p>
<hr class="border-0 border-t border-(--stroke)" />
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--stroke</code
>
</p>
</div>
</div>
</div>
<div class="space-y-5 sm:space-y-7">
<h3 class="text-sm font-medium">Font families</h3>
<div class="grid grid-cols-1 gap-x-5 gap-y-8 sm:gap-x-7 lg:grid-cols-3 lg:gap-y-7">
<div class="space-y-3">
<p class="font-sans text-2xl">Clear words.</p>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>font-sans</code
> · Inter
</p>
</div>
<div class="space-y-3">
<p class="font-serif text-2xl">Clear words.</p>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>font-serif</code
> · Libertinos Serif Display
</p>
</div>
<div class="space-y-3">
<p class="font-mono text-2xl">Clear words.</p>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>font-mono</code
> · IBM Plex Mono
</p>
</div>
</div>
</div>
<div class="space-y-5 sm:space-y-7">
<h3 class="text-sm font-medium">Corner radii</h3>
<p class="max-w-prose body-sm text-(--muted-foreground)">
Buttons and pill shells use the button radius. Popovers cap it at 1rem; their inner rows
and pill controls subtract 4px padding and a 1px border, clamped at zero. Images use
their own radius. Set either token to zero for square corners.
</p>
<!-- Static shape specimens; interactive recipes appear in the sections below. -->
<div
class="grid grid-cols-1 items-start gap-x-5 gap-y-8 sm:grid-cols-2 sm:gap-x-7 lg:grid-cols-4 lg:gap-y-7"
>
<div class="space-y-3">
<div
class="inline-flex min-h-11 items-center rounded-(--button-border-radius) border border-(--stroke) px-5 py-2 text-base leading-6 font-medium"
>
Button
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--button-border-radius</code
>
</p>
</div>
<div class="space-y-3">
<div
class="inline-flex rounded-(--button-border-radius) border border-(--stroke) bg-(--background) p-1"
>
<div
class="flex min-h-9 items-center rounded-[max(0px,calc(var(--button-border-radius)-0.25rem-1px))] bg-(--muted) px-3 py-2 text-sm leading-5 font-medium"
>
Pill interior
</div>
</div>
<p class="body-sm">Button radius with an inset interior.</p>
</div>
<div class="space-y-3">
<div
class="rounded-[min(1rem,var(--button-border-radius))] border border-(--stroke) bg-(--background) p-1"
>
<div
class="min-h-10 rounded-[max(0px,calc(min(1rem,var(--button-border-radius))-0.25rem-1px))] bg-(--muted) px-3 py-2.5 text-sm leading-5"
>
Popover row
</div>
</div>
<p class="body-sm">Button radius capped at 1rem, with an inset row.</p>
</div>
<div class="space-y-3">
<div
class="flex aspect-video items-center justify-center rounded-(--image-border-radius) border border-(--stroke) bg-(--muted) p-5 body-sm"
>
Image corners
</div>
<p class="body-sm">
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>--image-border-radius</code
>
</p>
</div>
</div>
</div>
</section>
<section id="page-limiter" aria-labelledby="page-limiter-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="page-limiter-heading" class="text-xl font-medium">Page limiter</h2>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Center each block with <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>mx-auto max-w-7xl</code
>, then add
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>px-5 sm:px-7</code
> inside it. The width limit is 80rem (1280px), including side padding: 1.25rem (20px) on
small screens and 1.75rem (28px) from the 40rem (640px) breakpoint, at the default root font
size.
</p>
</div>
<!--
Cancel the reference page padding so this specimen shows the actual page limiter.
The muted surface exposes the side padding; the inner surface marks the content area.
Full-width block backgrounds belong outside the limiter. Vertical spacing belongs to each block.
The reference page combines width and padding on one wrapper for the same geometry.
-->
<div class="-mx-5 sm:-mx-7">
<div class="mx-auto max-w-7xl bg-(--muted)">
<div class="px-5 sm:px-7">
<div class="border-x border-dashed border-(--stroke) bg-(--background) py-8">
<p class="body-base">Page content aligns here.</p>
<p class="mt-2 body-sm text-(--muted-foreground)">
The shaded edges show the shared page padding. Resize the window to compare.
</p>
</div>
</div>
</div>
</div>
<pre
class="overflow-x-auto rounded-(--image-border-radius) border border-(--stroke) bg-(--muted) p-4 text-sm leading-6"><code
><div class="mx-auto max-w-7xl">
<div class="px-5 sm:px-7">
Page content
</div>
</div></code
></pre>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Keep full-width backgrounds outside the limiter and choose vertical spacing per block.
Narrower reading columns can sit inside this shared page width. Apply the side padding
once so adjacent blocks line up.
</p>
</section>
<section id="content-tracks" aria-labelledby="content-tracks-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="content-tracks-heading" class="text-xl font-medium">Content tracks</h2>
<p class="max-w-prose body-sm text-(--muted-foreground)">
A track controls how much of the page limiter a block occupies and where it sits. Prose
and descriptive listings share narrow left, center, and right tracks, plus a wide
layout. Alternating their positions adds variation while keeping shared alignment edges.
</p>
<p class="max-w-prose body-sm text-(--muted-foreground)">
Narrow tracks use <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>max-w-4xl</code
>
(56rem / 896px) inside the
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>max-w-7xl</code
> page limiter (80rem / 1280px). These are maximum widths, not fixed proportions. Both include
the shared side padding.
</p>
</div>
<!-- Use actual track widths and padding so these diagrams respond like application blocks. -->
<div class="space-y-6">
<figure class="space-y-2">
<figcaption class="body-sm">
Narrow left · <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>max-w-4xl</code
>
</figcaption>
<div class="-mx-5 sm:-mx-7">
<div class="mx-auto max-w-7xl bg-(--muted)">
<div class="max-w-4xl px-5 sm:px-7">
<div
class="border-x border-dashed border-(--stroke) bg-(--background) py-5 body-sm"
>
Content starts at the left page edge.
</div>
</div>
</div>
</div>
</figure>
<figure class="space-y-2">
<figcaption class="body-sm">
Narrow center · <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>mx-auto max-w-4xl</code
>
</figcaption>
<div class="-mx-5 sm:-mx-7">
<div class="mx-auto max-w-7xl bg-(--muted)">
<div class="mx-auto max-w-4xl px-5 sm:px-7">
<div
class="border-x border-dashed border-(--stroke) bg-(--background) py-5 body-sm"
>
Content sits in the center of the page.
</div>
</div>
</div>
</div>
</figure>
<figure class="space-y-2">
<figcaption class="body-sm">
Narrow right · <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>ml-auto max-w-4xl</code
>
</figcaption>
<div class="-mx-5 sm:-mx-7">
<div class="mx-auto max-w-7xl bg-(--muted)">
<div class="ml-auto max-w-4xl px-5 sm:px-7">
<div
class="border-x border-dashed border-(--stroke) bg-(--background) py-5 body-sm"
>
Content ends at the right page edge.
</div>
</div>
</div>
</div>
</figure>
<figure class="space-y-2">
<figcaption class="body-sm">Wide · use the full available content width</figcaption>
<div class="-mx-5 sm:-mx-7">
<div class="mx-auto max-w-7xl bg-(--muted)">
<div class="px-5 sm:px-7">
<div
class="border-x border-dashed border-(--stroke) bg-(--background) py-5 body-sm"
>
Content spans the limiter, inside the shared side padding.
</div>
</div>
</div>
</div>
</figure>
<figure class="space-y-2">
<figcaption class="body-sm">
Two columns · descriptive listings · 50:50 after the gap
</figcaption>
<div class="-mx-5 sm:-mx-7">
<div class="mx-auto max-w-7xl bg-(--muted)">
<div class="px-5 sm:px-7">
<div class="grid grid-cols-1 gap-x-10 gap-y-0 lg:grid-cols-2 lg:gap-x-14">
<div
class="border-x border-dashed border-(--stroke) bg-(--background) py-5 body-sm"
>
First column
</div>
<div
class="border-x border-dashed border-(--stroke) bg-(--background) py-5 body-sm"
>
Second column
</div>
</div>
</div>
</div>
</div>
</figure>
</div>
</section>
<section id="block-spacing" aria-labelledby="block-spacing-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="block-spacing-heading" class="text-xl font-medium">Vertical block spacing</h2>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Generous spacing separates sections. Compact spacing pulls related blocks together. Each
block has its own top and bottom padding, chosen independently.
</p>
</div>
<ul class="max-w-prose list-disc space-y-2 pl-5 body-sm">
<li>A standalone block has generous padding above and below.</li>
<li>
In a section, the first block has generous top padding and compact bottom padding.
</li>
<li>Middle blocks have compact padding above and below.</li>
<li>The last block has compact top padding and generous bottom padding.</li>
<li>A section containing just one block has generous padding above and below.</li>
</ul>
<div class="space-y-3">
<h3 class="text-sm font-medium">Padding per edge</h3>
<div class="overflow-x-auto">
<table class="w-full max-w-3xl text-sm leading-6">
<caption class="sr-only">Responsive generous and compact padding values</caption>
<thead
><tr
><th scope="col" class="pr-6 pb-3 text-left font-medium">Viewport width</th><th
scope="col"
class="pr-6 pb-3 text-left font-medium">Generous</th
><th scope="col" class="pb-3 text-left font-medium">Compact</th></tr
></thead
>
<tbody
><tr class="border-t border-(--stroke)"
><th scope="row" class="py-3 pr-6 text-left font-normal">Below 640px</th><td
class="py-3 pr-6">2.5rem · 40px</td
><td class="py-3">1rem · 16px</td></tr
>
<tr class="border-t border-(--stroke)"
><th scope="row" class="py-3 pr-6 text-left font-normal">640–767px</th><td
class="py-3 pr-6">3.5rem · 56px</td
><td class="py-3">1rem · 16px</td></tr
>
<tr class="border-t border-(--stroke)"
><th scope="row" class="py-3 pr-6 text-left font-normal">768–1023px</th><td
class="py-3 pr-6">4rem · 64px</td
><td class="py-3">1rem · 16px</td></tr
>
<tr class="border-t border-(--stroke)"
><th scope="row" class="py-3 pr-6 text-left font-normal">1024px and above</th><td
class="py-3 pr-6">7rem · 112px</td
><td class="py-3">1.75rem · 28px</td></tr
></tbody
>
</table>
</div>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Pixel equivalents assume the default 16px root font size. Adjacent padding adds up: two
compact edges create a 32px gap, or 56px from 1024px. Two generous edges create an 80px,
112px, 128px, or 224px gap across the same viewport ranges.
</p>
</div>
<!--
Reference values mirror Prose.svelte's section boundary rules and the current spacing scale.
Explicit height bands visualize padding at its actual responsive size without extra gaps.
The specimen content has its own inset to make the block boundaries visible.
-->
<div class="grid items-start gap-10 md:grid-cols-2">
<div class="space-y-4">
<h3 class="text-sm font-medium">Standalone block</h3>
<div class="border border-(--stroke)">
<div>
<div
class="flex h-10 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) sm:h-14 md:h-16 lg:h-28"
>
Generous
</div>
<div class="border-y border-dashed border-(--stroke) px-5 py-4 sm:px-7">
<p class="body-base">Independent content</p>
</div>
<div
class="flex h-10 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) sm:h-14 md:h-16 lg:h-28"
>
Generous
</div>
</div>
</div>
</div>
<div class="space-y-4">
<h3 class="text-sm font-medium">Three blocks in one section</h3>
<div class="divide-y divide-(--stroke) border border-(--stroke)">
<div>
<div
class="flex h-10 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) sm:h-14 md:h-16 lg:h-28"
>
Generous
</div>
<div class="border-y border-dashed border-(--stroke) px-5 py-4 sm:px-7">
<p class="body-base">First block</p>
</div>
<div
class="flex h-4 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) lg:h-7"
>
Compact
</div>
</div>
<div>
<div
class="flex h-4 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) lg:h-7"
>
Compact
</div>
<div class="border-y border-dashed border-(--stroke) px-5 py-4 sm:px-7">
<p class="body-base">Middle block</p>
</div>
<div
class="flex h-4 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) lg:h-7"
>
Compact
</div>
</div>
<div>
<div
class="flex h-4 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) lg:h-7"
>
Compact
</div>
<div class="border-y border-dashed border-(--stroke) px-5 py-4 sm:px-7">
<p class="body-base">Last block</p>
</div>
<div
class="flex h-10 items-center justify-center bg-(--muted) text-xs leading-4 text-(--muted-foreground) sm:h-14 md:h-16 lg:h-28"
>
Generous
</div>
</div>
</div>
</div>
</div>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Shaded bands show the padding at its actual size. Resize the window to compare the scale.
Spacing within a block, such as the gap between a heading and a paragraph, is a separate
choice.
</p>
<div id="block-spacing-api" class="space-y-6">
<div class="space-y-2">
<h3 class="text-sm font-medium">Sample block implementation</h3>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
A top-level block receives its section context through <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>mark</code
>, aliased to
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>section</code
>. As in Prose.svelte, the block derives its top and bottom padding from that context.
No extra padding props are needed.
</p>
</div>
<div class="space-y-3">
<h4 class="text-sm text-(--muted-foreground)">Sample prose block</h4>
<pre
class="overflow-x-auto rounded-(--image-border-radius) border border-(--stroke) bg-(--muted) p-4 text-sm leading-6"><code
><script lang="ts">
import { Node, NodeArrayProperty } from 'svedit';
import type { DocumentPath, NodeArrayAttachmentContext } from 'svedit';
let {
path,
mark: section = null
}: {
path: DocumentPath;
mark?: NodeArrayAttachmentContext | null;
} = $props();
let padding_top_generous = $derived(!section || section.is_start);
let padding_bottom_generous = $derived(!section || section.is_end);
</script>
<Node {path} class="bg-(--background) text-(--foreground)">
<div class="mx-auto max-w-7xl">
<div class={[
'px-5 sm:px-7',
padding_top_generous ? 'pt-block-generous' : 'pt-block-compact',
padding_bottom_generous ? 'pb-block-generous' : 'pb-block-compact'
]}>
<NodeArrayProperty
path={[...path, 'body']}
class="flex flex-col gap-5 sm:gap-7"
/>
</div>
</div>
</Node></code
></pre>
</div>
<ul class="max-w-prose list-disc space-y-2 pl-5 body-sm">
<li>No section mark: both edges are generous.</li>
<li>
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>section.is_start</code
>: the top edge is generous.
</li>
<li>
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>section.is_end</code
>: the bottom edge is generous.
</li>
<li>
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>section.is_middle</code
>: both edges are compact; the two boundary checks already cover this case.
</li>
<li>A one-block section is both the start and the end, so both edges are generous.</li>
</ul>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
The app uses shared utilities in <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>src/app.css</code
>
for the default rhythm:
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>pt-block-generous</code
>,
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>pt-block-compact</code
>, and their
<code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>pb-</code
> equivalents. They apply the values above to existing elements without adding a wrapper component.
</p>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
For a custom rhythm, replace the default utility on that edge with explicit responsive
classes, such as <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>pt-8 lg:pt-16</code
>. Avoid combining a default utility with overrides on the same edge. Keep deliberate
exceptions local: flush and full-bleed figures have no vertical padding.
</p>
</div>
</section>
<section id="typography" aria-labelledby="typography-heading" class="space-y-10">
<div class="space-y-2">
<h2 id="typography-heading" class="text-xl font-medium">Typography</h2>
<p class="text-sm leading-relaxed text-(--muted-foreground)">
A shared scale for headings and body text.
</p>
</div>
<!--
Use the typography utilities directly; their Tailwind definitions live in app.css.
Display sizes grow at lg. Weight, line height, and tracking belong to the utility.
Choose the heading element for the document hierarchy, independently of its visual size.
These specimens are all h3 because they sit within the Typography section.
-->
<div class="space-y-10">
<div id="type-display-1" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">display-1</p>
<h3 class="display-1">Make room for what matters.</h3>
</div>
<div id="type-display-2" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">display-2</p>
<h3 class="display-2">Make room for what matters.</h3>
</div>
<div id="type-display-3" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">display-3</p>
<h3 class="display-3">Make room for what matters.</h3>
</div>
<div id="type-display-4" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">display-4</p>
<h3 class="display-4">Make room for what matters.</h3>
</div>
<div id="type-display-5" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">display-5</p>
<h3 class="display-5">Make room for what matters.</h3>
</div>
</div>
<!--
Body sizes share regular weight and 1.5 line height. Body-xl also grows at lg.
Reading width and spacing are layout choices, kept outside the typography utilities.
Use the same copy at each size to compare rhythm and wrapping.
-->
<div class="space-y-10">
<div id="type-body-xl" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">body-xl</p>
<p class="max-w-prose body-xl">
Good design makes everyday things easier to understand. Clear words, comfortable
spacing, and a thoughtful hierarchy help people find what they need and decide what to
do next.
</p>
</div>
<div id="type-body-lg" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">body-lg</p>
<p class="max-w-prose body-lg">
Good design makes everyday things easier to understand. Clear words, comfortable
spacing, and a thoughtful hierarchy help people find what they need and decide what to
do next.
</p>
</div>
<div id="type-body-base" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">body-base</p>
<p class="max-w-prose body-base">
Good design makes everyday things easier to understand. Clear words, comfortable
spacing, and a thoughtful hierarchy help people find what they need and decide what to
do next.
</p>
</div>
<div id="type-body-sm" class="space-y-3">
<p class="text-sm text-(--muted-foreground)">body-sm</p>
<p class="max-w-prose body-sm">
Good design makes everyday things easier to understand. Clear words, comfortable
spacing, and a thoughtful hierarchy help people find what they need and decide what to
do next.
</p>
</div>
</div>
</section>
<section id="formatting" aria-labelledby="formatting-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="formatting-heading" class="text-xl font-medium">Inline formatting</h2>
<p class="text-sm leading-relaxed text-(--muted-foreground)">
Emphasis and detail within the flow of a sentence.
</p>
</div>
<!--
Based on Emphasis, Strong, Link, Code, and Highlight in src/app/components.
Formatting inherits the surrounding size and color unless its meaning calls for a change.
Inline formatting styles are mutually exclusive: never nest or combine them on the same text.
Use semantic HTML and keep marks inline so sentences can wrap naturally.
Application components still own document references and editor behavior.
-->
<div class="space-y-8">
<div id="format-emphasis" class="space-y-3">
<h3 class="text-sm text-(--muted-foreground)">Emphasis · em</h3>
<!-- Italic adds emphasis without introducing another weight or color. -->
<p class="max-w-prose body-base">
Start with what people <em class="italic">actually need</em>.
</p>
</div>
<div id="format-strong" class="space-y-3">
<h3 class="text-sm text-(--muted-foreground)">Bold · strong</h3>
<!-- Semibold distinguishes important text within regular body copy. -->
<p class="max-w-prose body-base">
Keep the <strong class="font-semibold">most important information</strong> easy to find.
</p>
</div>
<div id="format-link" class="space-y-3">
<h3 class="text-sm text-(--muted-foreground)">Link · a</h3>
<!--
Prose links have no padding, minimum size, or flex display.
Inherit the surrounding text color and retain a visible underline.
Scale underline thickness and offset with the font size using em units.
At 16px, thickness is 1px normally and 2px on hover or press.
Use the shared editing outline for keyboard focus.
-->
<p class="max-w-prose body-base">
Explore the
<a
href="#typography"
class="underline decoration-[0.0625em] underline-offset-[0.125em] hover:decoration-[0.125em] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) active:decoration-[0.125em]"
>typography styles</a
>
to see how the scale works.
</p>
</div>
<div id="format-code" class="space-y-3">
<h3 class="text-sm text-(--muted-foreground)">Code · code</h3>
<!--
Code shares the shortcut-key border, muted surface, radius, and horizontal padding.
It keeps monospace typography and may break long identifiers across lines.
-->
<p class="max-w-prose body-base">
Use <code
class="rounded border border-(--stroke) bg-(--muted) box-decoration-clone px-1 font-mono text-[0.9em] leading-4 font-normal wrap-anywhere subpixel-antialiased"
>font-medium</code
>
for button labels.
</p>
</div>
<div id="format-highlight" class="space-y-3">
<h3 class="text-sm text-(--muted-foreground)">Highlight · mark</h3>
<!--
Use the existing accent pair rather than fixed yellow or the editor selection color.
Use em-based padding and the button radius capped at 0.25em, including on wrapped lines.
Highlight is a standalone formatting style.
-->
<p class="max-w-prose body-base">
Highlight <mark
class="rounded-[min(var(--button-border-radius),0.25em)] bg-(--accent) box-decoration-clone px-[0.25em] py-[0.125em] text-(--accent-foreground)"
>the part worth remembering</mark
>, not the whole paragraph.
</p>
</div>
</div>
</section>
<section id="card" aria-labelledby="card-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="card-heading" class="text-xl font-medium">Card</h2>
<p class="body-sm text-(--muted-foreground)">
A 4:3 media area, title, and optional description. Shared by gallery cards; width and
arrangement belong to the surrounding layout. Linked cards underline the title and make
the whole card clickable. Use a div and omit the underline for an unlinked card.
Keyboard focus uses a 2px editing-color outline with a 2px offset; scroll containers use
an inset outline to prevent clipping.
</p>
</div>
<div class="max-w-sm">
<a
href="#card"
class="ew-card group/card block min-w-0 outline-2 outline-transparent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing)"
>
<div class="aspect-4/3 overflow-hidden rounded-(--image-border-radius) bg-(--muted)">
<svg
class="h-full w-full text-(--stroke)"
viewBox="0 0 400 300"
fill="currentColor"
aria-hidden="true"
>
<circle cx="285" cy="85" r="28" />
<path d="M0 300V250L125 105L240 245L300 175L400 280V300Z" />
</svg>
</div>
<div class="pt-4">
<h3
class="body-base underline decoration-[0.0625em] underline-offset-[0.125em] group-hover/card:decoration-[0.125em] group-active/card:decoration-[0.125em]"
>
Card title
</h3>
<p class="pt-1 body-base text-(--muted-foreground)">
An optional description adds context below the title.
</p>
</div>
</a>
</div>
</section>
<section id="buttons" aria-labelledby="buttons-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="buttons-heading" class="text-xl font-medium">Buttons</h2>
<p class="text-sm leading-relaxed text-(--muted-foreground)">
Standard size. Hover, press, or tab to explore the states.
</p>
</div>
<!--
Shared typography: 1rem text and 1.5 line height, with a 2.75rem minimum height.
Primary and secondary share horizontal padding, a reserved 1px border, and normal font weight.
Standalone links align with surrounding text instead of inheriting button padding.
Use an offset outline for keyboard focus, with no shadows or movement.
-->
<div class="grid gap-10 sm:grid-cols-3 sm:gap-8">
<div id="button-primary" class="min-w-0 space-y-4">
<h3 class="text-sm text-(--muted-foreground)">Primary</h3>
<!-- Main action. Mix in sRGB for visible feedback even with black accents; keep text opaque. -->
<button
type="button"
class="inline-flex min-h-11 max-w-full min-w-11 items-center justify-center rounded-(--button-border-radius) border border-transparent bg-(--accent) px-5 py-2 text-center text-base leading-6 font-normal wrap-anywhere text-(--accent-foreground) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) enabled:cursor-pointer enabled:hover:bg-[color-mix(in_srgb,var(--accent),var(--accent-foreground)_20%)] enabled:active:bg-[color-mix(in_srgb,var(--accent),var(--accent-foreground)_30%)] disabled:cursor-default disabled:opacity-40"
>
Continue
</button>
</div>
<div id="button-secondary" class="min-w-0 space-y-4">
<h3 class="text-sm text-(--muted-foreground)">Secondary</h3>
<!-- Supporting action. Use the shared stroke border, muted hover surface, and foreground tint on press. -->
<button
type="button"
class="inline-flex min-h-11 max-w-full min-w-11 items-center justify-center rounded-(--button-border-radius) border border-(--stroke) bg-transparent px-5 py-2 text-center text-base leading-6 font-normal wrap-anywhere text-(--foreground) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) enabled:cursor-pointer enabled:hover:bg-(--muted) enabled:active:bg-(--foreground)/10 disabled:cursor-default disabled:opacity-40"
>
Continue
</button>
</div>
<div id="button-link" class="min-w-0 space-y-4">
<h3 class="text-sm text-(--muted-foreground)">Link</h3>
<!--
Standalone navigation: no horizontal padding or border, so text aligns with its surroundings.
Use normal weight to match inline links. Keep the 44px minimum height and a 24px minimum width, increased to 44px for coarse pointers.
Short labels stay start-aligned.
Inline links within prose need a separate recipe without this vertical sizing.
Target guidance: https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum
This local destination keeps the specimen usable without adding application behavior.
For an action with this appearance, use a button and handle its disabled state explicitly.
-->
<a
href="#buttons"
class="inline-flex min-h-11 max-w-full min-w-6 items-center justify-start py-2.5 text-start text-base leading-6 font-normal wrap-anywhere text-(--foreground) underline decoration-1 underline-offset-4 hover:decoration-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) active:decoration-2 pointer-coarse:min-w-11"
>
Continue
</a>
</div>
</div>
</section>
<section id="buttons-small" aria-labelledby="buttons-small-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="buttons-small-heading" class="text-xl font-medium">Small buttons</h2>
<p class="text-sm leading-relaxed text-(--muted-foreground)">
For navigation and compact layouts. Small buttons keep a 36px minimum height on all
devices.
</p>
</div>
<!--
Compact geometry: 0.875rem text, 1.25rem line height, and a 2.25rem minimum height.
All button variants use normal weight, matching inline text links.
Keep the same dimensions for mouse and touch. Let content wrap and increase the height.
These are explicit recipes, with the same colors and states as the standard size.
-->
<div class="grid gap-10 sm:grid-cols-3 sm:gap-8">
<div id="button-primary-small" class="min-w-0 space-y-4">
<h3 class="text-sm text-(--muted-foreground)">Primary</h3>
<!-- Main action. Mix in sRGB for visible feedback even with black accents; keep text opaque. -->
<button
type="button"
class="inline-flex min-h-9 max-w-full min-w-9 items-center justify-center rounded-(--button-border-radius) border border-transparent bg-(--accent) px-3 py-1.5 text-center text-sm leading-5 font-normal wrap-anywhere text-(--accent-foreground) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) enabled:cursor-pointer enabled:hover:bg-[color-mix(in_srgb,var(--accent),var(--accent-foreground)_20%)] enabled:active:bg-[color-mix(in_srgb,var(--accent),var(--accent-foreground)_30%)] disabled:cursor-default disabled:opacity-40"
>
Continue
</button>
</div>
<div id="button-secondary-small" class="min-w-0 space-y-4">
<h3 class="text-sm text-(--muted-foreground)">Secondary</h3>
<!-- Supporting action. Use the shared stroke border, muted hover surface, and foreground tint on press. -->
<button
type="button"
class="inline-flex min-h-9 max-w-full min-w-9 items-center justify-center rounded-(--button-border-radius) border border-(--stroke) bg-transparent px-3 py-1.5 text-center text-sm leading-5 font-normal wrap-anywhere text-(--foreground) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) enabled:cursor-pointer enabled:hover:bg-(--muted) enabled:active:bg-(--foreground)/10 disabled:cursor-default disabled:opacity-40"
>
Continue
</button>
</div>
<div id="button-link-small" class="min-w-0 space-y-4">
<h3 class="text-sm text-(--muted-foreground)">Link</h3>
<!-- Standalone link: preserve start alignment and omit horizontal padding at both sizes. -->
<a
href="#buttons"
class="inline-flex min-h-9 max-w-full min-w-6 items-center justify-start py-2 text-start text-sm leading-5 font-normal wrap-anywhere text-(--foreground) underline decoration-1 underline-offset-4 hover:decoration-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--editing) active:decoration-2"
>
Continue
</a>
</div>
</div>
</section>
<section id="buttons-disabled" aria-labelledby="buttons-disabled-heading" class="space-y-8">
<div class="space-y-2">
<h2 id="buttons-disabled-heading" class="text-xl font-medium">Disabled buttons</h2>
<p class="max-w-prose text-sm leading-relaxed text-(--muted-foreground)">
Buttons and pill controls use 40% opacity with the default cursor. Native disabled
buttons skip keyboard focus and suppress hover and press feedback. Menu rows instead use
muted text to keep unavailable actions legible.
</p>
</div>
<!-- Copy the enabled recipe unchanged and add the native disabled attribute. -->
<div class="grid items-start gap-6 sm:grid-cols-2 lg:grid-cols-4">
<div class="min-w-0 space-y-4">