@alwith/module-editor 0.0.0-stage → 0.1.0-rc.13

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.
Files changed (66) hide show
  1. package/LICENSE +94 -0
  2. package/README.md +47 -2
  3. package/THIRD_PARTY_NOTICES.md +3 -0
  4. package/dist/core.d.ts +56 -0
  5. package/dist/core.js +8 -0
  6. package/dist/index.d.ts +89 -0
  7. package/dist/index.js +1 -0
  8. package/dist/monaco.d.ts +16 -0
  9. package/dist/monaco.js +1 -0
  10. package/dist/new-tab.d.ts +43 -0
  11. package/dist/new-tab.js +1 -0
  12. package/dist/preview-source-mode-toggle.d.ts +8 -0
  13. package/dist/preview-source-mode-toggle.js +1 -0
  14. package/dist/previews/excel-data.d.ts +20 -0
  15. package/dist/previews/excel-data.js +3 -0
  16. package/dist/previews/excel-navigation.d.ts +4 -0
  17. package/dist/previews/excel-navigation.js +1 -0
  18. package/dist/previews/excel.d.ts +3 -0
  19. package/dist/previews/excel.js +1 -0
  20. package/dist/previews/html-resources.d.ts +3 -0
  21. package/dist/previews/html-resources.js +2 -0
  22. package/dist/previews/html-session.d.ts +8 -0
  23. package/dist/previews/html-session.js +1 -0
  24. package/dist/previews/html.d.ts +3 -0
  25. package/dist/previews/html.js +1 -0
  26. package/dist/previews/index.d.ts +83 -0
  27. package/dist/previews/index.js +1 -0
  28. package/dist/previews/markdown-outline.d.ts +6 -0
  29. package/dist/previews/markdown-outline.js +1 -0
  30. package/dist/previews/markdown-readonly.d.ts +4 -0
  31. package/dist/previews/markdown-readonly.js +2 -0
  32. package/dist/previews/markdown.css +918 -0
  33. package/dist/previews/markdown.d.ts +5 -0
  34. package/dist/previews/markdown.js +1 -0
  35. package/dist/previews/media-types.d.ts +1 -0
  36. package/dist/previews/media-types.js +1 -0
  37. package/dist/previews/media.d.ts +2 -0
  38. package/dist/previews/media.js +1 -0
  39. package/dist/previews/pdf-controls.d.ts +1 -0
  40. package/dist/previews/pdf-controls.js +1 -0
  41. package/dist/previews/pdf.d.ts +2 -0
  42. package/dist/previews/pdf.js +1 -0
  43. package/dist/previews/shared.d.ts +7 -0
  44. package/dist/previews/shared.js +1 -0
  45. package/dist/previews/styles.css +142 -0
  46. package/dist/previews/tiff.d.ts +2 -0
  47. package/dist/previews/tiff.js +1 -0
  48. package/dist/previews/viewers.css +221 -0
  49. package/dist/previews/word.d.ts +2 -0
  50. package/dist/previews/word.js +1 -0
  51. package/dist/quick-start-assets.d.ts +4 -0
  52. package/dist/quick-start-assets.js +1 -0
  53. package/dist/quick-start-data.d.ts +11 -0
  54. package/dist/quick-start-data.js +1 -0
  55. package/dist/quick-start-icons.d.ts +9 -0
  56. package/dist/quick-start-icons.js +1 -0
  57. package/dist/shortcut-hint.d.ts +4 -0
  58. package/dist/shortcut-hint.js +0 -0
  59. package/dist/styles.css +726 -0
  60. package/dist/workspace-assets.d.ts +2 -0
  61. package/dist/workspace-assets.js +1 -0
  62. package/dist/workspace-tabs.d.ts +27 -0
  63. package/dist/workspace-tabs.js +1 -0
  64. package/dist/workspace.d.ts +31 -0
  65. package/dist/workspace.js +1 -0
  66. package/package.json +163 -4
@@ -0,0 +1,918 @@
1
+ /* Desktop Markdown typography, using host semantic colors without global preflight. */
2
+ .alwith-markdown-scroll {
3
+ height: 100%;
4
+ min-height: 0;
5
+ overflow: auto;
6
+ padding: 16px;
7
+ }
8
+ .alwith-markdown-view .ProseMirror {
9
+ max-width: none;
10
+ margin: 0;
11
+ min-height: 100%;
12
+ outline: none;
13
+ }
14
+ :is(.alwith-editor .alwith-markdown-action, .alwith-markdown-action) {
15
+ display: inline-flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ width: 24px;
19
+ height: 24px;
20
+ padding: 0;
21
+ border: 0;
22
+ border-radius: var(--radius);
23
+ background: transparent;
24
+ color: var(--foreground);
25
+ cursor: pointer;
26
+ }
27
+ :is(.alwith-editor .alwith-markdown-action, .alwith-markdown-action):hover,
28
+ .alwith-markdown-outline-popup button:hover {
29
+ background: var(--accent);
30
+ color: var(--accent-foreground);
31
+ }
32
+ :is(.alwith-editor .alwith-markdown-action, .alwith-markdown-action):focus-visible,
33
+ .alwith-markdown-outline-popup button:focus-visible {
34
+ outline: 2px solid var(--ring);
35
+ outline-offset: 2px;
36
+ }
37
+ .alwith-markdown-outline-positioner {
38
+ z-index: 50;
39
+ }
40
+ .alwith-markdown-outline-popup {
41
+ box-sizing: border-box;
42
+ width: 288px;
43
+ max-height: 60vh;
44
+ overflow: auto;
45
+ padding: 4px;
46
+ border: 1px solid var(--border);
47
+ border-radius: var(--radius);
48
+ background: var(--popover);
49
+ color: var(--popover-foreground);
50
+ box-shadow: 0 4px 6px -1px color-mix(in srgb, var(--foreground) 10%, transparent);
51
+ }
52
+ .alwith-markdown-outline-popup ul {
53
+ display: flex;
54
+ flex-direction: column;
55
+ margin: 0;
56
+ padding: 0;
57
+ list-style: none;
58
+ }
59
+ .alwith-markdown-outline-popup button {
60
+ display: block;
61
+ width: 100%;
62
+ padding: 4px 8px;
63
+ border: 0;
64
+ border-radius: 4px;
65
+ background: transparent;
66
+ color: inherit;
67
+ text-align: start;
68
+ font-size: 12px;
69
+ line-height: 16px;
70
+ overflow: hidden;
71
+ text-overflow: ellipsis;
72
+ white-space: nowrap;
73
+ cursor: pointer;
74
+ }
75
+ .alwith-markdown-outline-empty {
76
+ padding: 8px 12px;
77
+ font-size: 12px;
78
+ color: var(--muted-foreground);
79
+ }
80
+
81
+ .alwith-markdown-view .ProseMirror {
82
+ color: var(--md-fg);
83
+ font-size: 14px;
84
+ line-height: 1.7;
85
+ word-wrap: break-word;
86
+ }
87
+
88
+ .alwith-markdown-view .ProseMirror {
89
+ --md-fg: var(--foreground);
90
+ --md-fg-muted: var(--muted-foreground);
91
+ --md-bg-code: var(--muted);
92
+ --md-bg-code-inline: color-mix(in srgb, var(--muted-foreground) 20%, transparent);
93
+ --md-bg-tbl-head: var(--muted);
94
+ --md-bg-tbl-row-alt: color-mix(in srgb, var(--muted) 50%, var(--background));
95
+ --md-bg-tbl-cell: var(--background);
96
+ --md-border: var(--border);
97
+ --md-border-muted: var(--border);
98
+ --md-link: var(--primary);
99
+ --md-blockquote-bar: var(--border);
100
+ }
101
+
102
+ .alwith-markdown-view .ProseMirror :where(p) {
103
+ margin: 0 0 12px;
104
+ line-height: 1.7;
105
+ }
106
+
107
+ .alwith-markdown-view .ProseMirror :where(p:last-child) {
108
+ margin-bottom: 0;
109
+ }
110
+
111
+ .alwith-markdown-view .ProseMirror :where(h1, h2, h3, h4, h5, h6) {
112
+ margin: 24px 0 10px;
113
+ font-weight: 600;
114
+ line-height: 1.3;
115
+ color: var(--md-fg);
116
+ }
117
+
118
+ .alwith-markdown-view .ProseMirror :where(h1) {
119
+ font-size: 1.85em;
120
+ padding-bottom: 0.3em;
121
+ border-bottom: 1px solid var(--md-border-muted);
122
+ }
123
+
124
+ .alwith-markdown-view .ProseMirror :where(h2) {
125
+ font-size: 1.45em;
126
+ padding-bottom: 0.3em;
127
+ border-bottom: 1px solid var(--md-border-muted);
128
+ }
129
+
130
+ .alwith-markdown-view .ProseMirror :where(h3) {
131
+ font-size: 1.2em;
132
+ }
133
+
134
+ .alwith-markdown-view .ProseMirror :where(h4) {
135
+ font-size: 1em;
136
+ }
137
+
138
+ .alwith-markdown-view .ProseMirror :where(h5),
139
+ .alwith-markdown-view .ProseMirror :where(h6) {
140
+ font-size: 0.9em;
141
+ color: var(--md-fg-muted);
142
+ }
143
+
144
+ .alwith-markdown-view .ProseMirror :where(h1:first-child, h2:first-child, h3:first-child) {
145
+ margin-top: 0;
146
+ }
147
+
148
+ .alwith-markdown-view .ProseMirror :where(a) {
149
+ color: var(--md-link);
150
+ text-decoration: underline;
151
+ text-underline-offset: 2px;
152
+ text-decoration-thickness: 1px;
153
+ }
154
+
155
+ .alwith-markdown-view .ProseMirror :where(a:hover) {
156
+ opacity: 0.85;
157
+ }
158
+
159
+ .alwith-markdown-view .ProseMirror :where(code):not(pre code) {
160
+ background: var(--md-bg-code-inline);
161
+ color: var(--md-fg);
162
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
163
+ font-size: 85%;
164
+ padding: 0.2em 0.4em;
165
+ border-radius: 4px;
166
+ border: 0;
167
+ }
168
+
169
+ .alwith-markdown-view .ProseMirror :where(code)::before,
170
+ .alwith-markdown-view .ProseMirror :where(code)::after {
171
+ content: none;
172
+ }
173
+
174
+ .alwith-markdown-view .ProseMirror :where(pre) {
175
+ background: var(--md-bg-code);
176
+ color: var(--md-fg);
177
+ border-radius: 6px;
178
+ padding: 16px;
179
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
180
+ font-size: 85%;
181
+ line-height: 1.5;
182
+ overflow-x: auto;
183
+ margin: 12px 0;
184
+ border: 0;
185
+ }
186
+
187
+ .alwith-markdown-view .ProseMirror :where(pre code) {
188
+ background: transparent;
189
+ color: inherit;
190
+ padding: 0;
191
+ font-size: inherit;
192
+ border: 0;
193
+ border-radius: 0;
194
+ }
195
+
196
+ .alwith-markdown-view .ProseMirror :where(blockquote) {
197
+ margin: 12px 0;
198
+ padding: 0 16px;
199
+ border-left: 4px solid var(--md-blockquote-bar);
200
+ color: var(--md-fg-muted);
201
+ background: transparent;
202
+ }
203
+
204
+ .alwith-markdown-view .ProseMirror :where(blockquote p) {
205
+ margin: 6px 0;
206
+ }
207
+
208
+ .alwith-markdown-view .ProseMirror :where(.tableWrapper) {
209
+ margin: 16px 0;
210
+ border-radius: 6px;
211
+ border: 1px solid var(--md-border);
212
+ overflow: hidden;
213
+ }
214
+
215
+ .alwith-markdown-view .ProseMirror :where(table) {
216
+ border-collapse: collapse;
217
+ border-spacing: 0;
218
+ width: 100%;
219
+ margin: 0;
220
+ background: var(--md-bg-tbl-cell);
221
+ }
222
+
223
+ .alwith-markdown-view .ProseMirror :where(thead) {
224
+ background: var(--md-bg-tbl-head);
225
+ }
226
+
227
+ .alwith-markdown-view .ProseMirror :where(th) {
228
+ background: var(--md-bg-tbl-head);
229
+ color: var(--md-fg);
230
+ font-weight: 600;
231
+ padding: 8px 14px;
232
+ border: 1px solid var(--md-border);
233
+ text-align: left;
234
+ }
235
+
236
+ .alwith-markdown-view .ProseMirror :where(td) {
237
+ background: var(--md-bg-tbl-cell);
238
+ color: var(--md-fg);
239
+ padding: 8px 14px;
240
+ border: 1px solid var(--md-border);
241
+ }
242
+
243
+ .alwith-markdown-view .ProseMirror :where(tbody tr:nth-child(even) td) {
244
+ background: var(--md-bg-tbl-row-alt);
245
+ }
246
+
247
+ .alwith-markdown-view .ProseMirror :where(hr) {
248
+ height: 1px;
249
+ background: var(--md-border-muted);
250
+ border: 0;
251
+ margin: 24px 0;
252
+ }
253
+
254
+ .alwith-markdown-view .ProseMirror :where(ul) {
255
+ list-style-type: disc;
256
+ }
257
+
258
+ .alwith-markdown-view .ProseMirror :where(ol) {
259
+ list-style-type: decimal;
260
+ }
261
+
262
+ .alwith-markdown-view .ProseMirror :where(ul ul) {
263
+ list-style-type: circle;
264
+ }
265
+
266
+ .alwith-markdown-view .ProseMirror :where(ul ul ul) {
267
+ list-style-type: square;
268
+ }
269
+
270
+ .alwith-markdown-view .ProseMirror :where(ul, ol) {
271
+ padding-left: 2em;
272
+ margin: 8px 0;
273
+ }
274
+
275
+ .alwith-markdown-view .ProseMirror :where(li) {
276
+ margin: 4px 0;
277
+ line-height: 1.7;
278
+ }
279
+
280
+ .alwith-markdown-view .ProseMirror :where(li > p) {
281
+ margin: 4px 0;
282
+ }
283
+
284
+ .alwith-markdown-view .ProseMirror :where(li::marker) {
285
+ color: var(--md-fg-muted);
286
+ }
287
+
288
+ .alwith-markdown-view .ProseMirror :where(li > ul, li > ol) {
289
+ padding-left: 1.5em;
290
+ margin: 2px 0;
291
+ }
292
+
293
+ .alwith-markdown-view .ProseMirror :where(img) {
294
+ max-width: 100%;
295
+ border-radius: 6px;
296
+ margin: 8px 0;
297
+ }
298
+
299
+ .alwith-markdown-view .ProseMirror > :first-child {
300
+ margin-top: 0;
301
+ }
302
+
303
+ .alwith-markdown-view .ProseMirror > :last-child {
304
+ margin-bottom: 0;
305
+ }
306
+
307
+ .alwith-markdown-view .ProseMirror ::selection {
308
+ background: color-mix(in srgb, var(--primary) 30%, transparent);
309
+ }
310
+
311
+ /* Desktop readonly typeset and code-block styles, scoped to the preview. */
312
+ /*
313
+ * shadcn/typeset
314
+ * https://ui.shadcn.com/docs/typeset.
315
+ */
316
+
317
+ @layer components {
318
+ .alwith-markdown-readonly {
319
+ --typeset-font-body: inherit;
320
+ --typeset-font-heading: var(--font-heading);
321
+ --typeset-font-mono: var(--font-mono);
322
+ --typeset-size: 1em;
323
+ --typeset-leading: 1.75;
324
+ --typeset-flow: 1.25em;
325
+ }
326
+ }
327
+
328
+ @layer components {
329
+ .alwith-markdown-readonly {
330
+ font-family: var(--typeset-font-body);
331
+ font-size: calc(var(--typeset-size) * 1.125);
332
+ line-height: var(--typeset-leading);
333
+ color: var(--foreground, currentColor);
334
+ overflow-wrap: break-word;
335
+ margin-trim: block-start;
336
+
337
+ @media (min-width: 48rem), print {
338
+ font-size: var(--typeset-size);
339
+ }
340
+
341
+ --typeset-muted: var(--muted-foreground, color-mix(in oklab, currentColor 60%, transparent));
342
+ --typeset-rule: var(--border, color-mix(in oklab, currentColor 20%, transparent));
343
+ }
344
+
345
+ .alwith-markdown-readonly *:not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)) {
346
+ /* Paragraphs. */
347
+ &:where(p) {
348
+ margin-block-start: var(--typeset-flow);
349
+ margin-block-end: 0;
350
+ }
351
+
352
+ /* Headings. */
353
+ &:where(h1, h2, h3, h4, h5, h6) {
354
+ color: var(--foreground, currentColor);
355
+ font-family: var(--typeset-font-heading);
356
+ font-weight: 600;
357
+ margin-block-end: 0;
358
+ }
359
+ &:where(h1) {
360
+ font-size: 1.75em;
361
+ line-height: 1.3;
362
+ margin-block-start: var(--typeset-flow);
363
+ }
364
+ &:where(h2) {
365
+ font-size: 1.25em;
366
+ line-height: 1.4;
367
+ margin-block-start: calc(var(--typeset-flow) * 1.4);
368
+ }
369
+ &:where(h3) {
370
+ font-size: 1.125em;
371
+ line-height: 1.45;
372
+ margin-block-start: var(--typeset-flow);
373
+ }
374
+ &:where(h4) {
375
+ font-size: 1em;
376
+ line-height: 1.5;
377
+ margin-block-start: var(--typeset-flow);
378
+ }
379
+ &:where(h5) {
380
+ font-size: 0.875em;
381
+ line-height: 1.5;
382
+ font-weight: 500;
383
+ color: var(--typeset-muted);
384
+ margin-block-start: calc(var(--typeset-flow) / 0.875);
385
+ }
386
+ &:where(h6) {
387
+ font-size: 0.8125em;
388
+ line-height: 1.5;
389
+ font-weight: 500;
390
+ letter-spacing: 0.08em;
391
+ text-transform: uppercase;
392
+ color: var(--typeset-muted);
393
+ margin-block-start: calc(var(--typeset-flow) / 0.8125);
394
+ }
395
+ /* Anchors. */
396
+ &:where([id]) {
397
+ scroll-margin-block-start: var(--typeset-flow);
398
+ }
399
+
400
+ /* Headings own the space below them. */
401
+ &:where(h1 + *, h2 + *, h3 + *, h4 + *, h5 + *, h6 + *) {
402
+ margin-block-start: 1em;
403
+ }
404
+ &:where(:is(h1, h2, h3, h4) :is(code)) {
405
+ font-size: 0.9em;
406
+ }
407
+
408
+ /* Links. */
409
+ &:where(a) {
410
+ color: inherit;
411
+ font-weight: 500;
412
+ text-decoration-line: underline;
413
+ text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
414
+ }
415
+ &:where(a:hover) {
416
+ text-decoration-color: currentColor;
417
+ }
418
+ &:where(a:focus-visible) {
419
+ outline: 2px solid var(--ring, currentColor);
420
+ outline-offset: 2px;
421
+ border-radius: 0.125em;
422
+ }
423
+ &:where(:is(h1, h2, h3, h4, h5, h6) :is(a)) {
424
+ font-weight: inherit;
425
+ }
426
+
427
+ /* Inline semantics. */
428
+ &:where(strong, b) {
429
+ font-weight: 600;
430
+ }
431
+ &:where(:is(h1, h2, h3, h4) :is(strong, b)) {
432
+ font-weight: 600;
433
+ }
434
+ &:where(mark) {
435
+ background-color: color-mix(in oklab, var(--accent) 40%, transparent);
436
+ color: inherit;
437
+ padding: 0.05em 0.15em;
438
+ border-radius: 0.2em;
439
+ }
440
+ &:where(abbr[title]) {
441
+ text-decoration-line: underline;
442
+ text-decoration-style: dotted;
443
+ text-underline-offset: 0.2em;
444
+ cursor: help;
445
+ }
446
+ &:where(del, s) {
447
+ color: var(--typeset-muted);
448
+ text-decoration-line: line-through;
449
+ }
450
+ &:where(sup, sub) {
451
+ font-size: 0.75em;
452
+ line-height: 0;
453
+ position: relative;
454
+ vertical-align: baseline;
455
+ }
456
+ &:where(sup) {
457
+ top: -0.5em;
458
+ }
459
+ &:where(sub) {
460
+ bottom: -0.25em;
461
+ }
462
+ &:where(sup a) {
463
+ text-decoration-line: none;
464
+ font-weight: 500;
465
+ }
466
+
467
+ /* Lists. */
468
+ &:where(ul) {
469
+ list-style-type: disc;
470
+ }
471
+ &:where(ol) {
472
+ list-style-type: decimal;
473
+ }
474
+ &:where(ul ul) {
475
+ list-style-type: circle;
476
+ }
477
+ &:where(ul ul ul) {
478
+ list-style-type: square;
479
+ }
480
+ &:where(ol[type="a" i]) {
481
+ list-style-type: lower-alpha;
482
+ }
483
+ &:where(ol[type="i" i]) {
484
+ list-style-type: lower-roman;
485
+ }
486
+ &:where(ol[type="A" s]) {
487
+ list-style-type: upper-alpha;
488
+ }
489
+ &:where(ol[type="I" s]) {
490
+ list-style-type: upper-roman;
491
+ }
492
+ &:where(ul, ol) {
493
+ margin-block-start: var(--typeset-flow);
494
+ margin-block-end: 0;
495
+ padding-inline-start: 1.5em;
496
+ }
497
+ &:where(li) {
498
+ margin-block-start: 0.5em;
499
+ padding-inline-start: 0.4em;
500
+ }
501
+ &:where(li > p, li > ul, li > ol) {
502
+ margin-block-start: 0.5em;
503
+ }
504
+ &:where(ul > li)::marker {
505
+ color: var(--typeset-muted);
506
+ }
507
+ &:where(ol > li)::marker {
508
+ color: var(--typeset-muted);
509
+ }
510
+
511
+ /* GFM task lists. */
512
+ &:where(ul.contains-task-list) {
513
+ list-style-type: none;
514
+ padding-inline-start: 0.25em;
515
+ }
516
+ &:where(li.task-list-item > input[type="checkbox"]) {
517
+ margin-inline-end: 0.5em;
518
+ vertical-align: -0.1em;
519
+ accent-color: var(--primary, currentColor);
520
+ }
521
+
522
+ /* Disclosures. */
523
+ &:where(details) {
524
+ margin-block-start: var(--typeset-flow);
525
+ margin-block-end: 0;
526
+ }
527
+ &:where(summary) {
528
+ cursor: pointer;
529
+ font-weight: 500;
530
+ }
531
+ &:where(summary)::marker {
532
+ color: var(--typeset-muted);
533
+ }
534
+
535
+ /* Keyboard keys. */
536
+ &:where(kbd) {
537
+ font-family: inherit;
538
+ font-size: 0.85em;
539
+ font-weight: 500;
540
+ border: 1px solid var(--typeset-rule);
541
+ border-block-end-width: 2px;
542
+ border-radius: min(calc(var(--radius, 0.5em) * 0.6), 0.35em);
543
+ padding: 0.0625em 0.35em;
544
+ }
545
+
546
+ /* Definition lists. */
547
+ &:where(dl) {
548
+ margin-block-start: var(--typeset-flow);
549
+ margin-block-end: 0;
550
+ }
551
+ &:where(dt) {
552
+ font-weight: 500;
553
+ margin-block-start: 1em;
554
+ }
555
+ &:where(dt + dt) {
556
+ margin-block-start: 0.25em;
557
+ }
558
+ &:where(dd) {
559
+ margin-block-start: 0.25em;
560
+ margin-inline-start: 0;
561
+ padding-inline-start: 1em;
562
+ color: var(--typeset-muted);
563
+ }
564
+
565
+ /* Inline code. */
566
+ &:where(:not(pre) > code) {
567
+ background-color: var(--muted, color-mix(in oklab, currentColor 8%, transparent));
568
+ font-family: var(--typeset-font-mono);
569
+ font-size: 0.85em;
570
+ border-radius: min(calc(var(--radius, 0.5em) * 0.6), 0.35em);
571
+ padding: 0.125em 0.3em;
572
+ }
573
+
574
+ /* Code blocks. */
575
+ &:where(pre) {
576
+ background-color: var(--muted, color-mix(in oklab, currentColor 8%, transparent));
577
+ font-family: var(--typeset-font-mono);
578
+ font-size: 0.875em;
579
+ line-height: 1.5;
580
+ tab-size: 2;
581
+ direction: ltr;
582
+ border-radius: var(--radius, 0.5em);
583
+ padding: 0.75em 1em;
584
+ overflow-x: auto;
585
+ margin-block-start: calc(var(--typeset-flow) / 0.875);
586
+ margin-block-end: 0;
587
+ }
588
+ &:where(pre code) {
589
+ background-color: transparent;
590
+ font-family: inherit;
591
+ font-size: inherit;
592
+ padding: 0;
593
+ border-radius: 0;
594
+ }
595
+
596
+ /* Blockquote. */
597
+ &:where(blockquote) {
598
+ border-inline-start: 2px solid var(--typeset-rule);
599
+ padding-inline-start: 1em;
600
+ margin-block-start: var(--typeset-flow);
601
+ margin-block-end: 0;
602
+ margin-inline: 0;
603
+ }
604
+
605
+ /* Dividers. */
606
+ &:where(hr) {
607
+ border: 0;
608
+ border-block-start: 1px solid var(--typeset-rule);
609
+ margin-block-start: calc(var(--typeset-flow) * 2.4);
610
+ margin-block-end: 0;
611
+ }
612
+ &:where(hr + h1, hr + h2, hr + h3, hr + h4) {
613
+ margin-block-start: var(--typeset-flow);
614
+ }
615
+
616
+ /* GFM footnotes. */
617
+ &:where(.footnotes, [data-footnotes]) {
618
+ margin-block-start: calc(var(--typeset-flow) * 2);
619
+ border-block-start: 1px solid var(--typeset-rule);
620
+ padding-block-start: var(--typeset-flow);
621
+ font-size: 0.875em;
622
+ color: var(--typeset-muted);
623
+ }
624
+
625
+ /* Math. */
626
+ &:where(math[display="block"]) {
627
+ margin-block-start: var(--typeset-flow);
628
+ margin-block-end: 0;
629
+ overflow-x: auto;
630
+ overflow-y: hidden;
631
+ padding-block: 0.25em;
632
+ }
633
+
634
+ /* Media. */
635
+ &:where(img, video) {
636
+ border-radius: var(--radius, 0.5em);
637
+ max-width: 100%;
638
+ height: auto;
639
+ margin-block-start: var(--typeset-flow);
640
+ margin-block-end: 0;
641
+ }
642
+ &:where(p img) {
643
+ margin-block-start: 0;
644
+ }
645
+ &:where(figure) {
646
+ margin-block-start: var(--typeset-flow);
647
+ margin-block-end: 0;
648
+ margin-inline: 0;
649
+ }
650
+ &:where(figcaption, caption) {
651
+ color: var(--typeset-muted);
652
+ font-size: 0.875em;
653
+ text-align: center;
654
+ margin-block-start: calc(0.75em / 0.875);
655
+ }
656
+ &:where(caption) {
657
+ caption-side: bottom;
658
+ }
659
+
660
+ /* Tables. Separators sit on cells, not tr:last-child: append-safe.
661
+ Bare tables stay real tables (keep their semantics) and wrap to fit. */
662
+ &:where(table) {
663
+ max-width: 100%;
664
+ font-size: 1em;
665
+ line-height: 1.5;
666
+ font-variant-numeric: tabular-nums;
667
+ border-collapse: separate;
668
+ border-spacing: 0;
669
+ border-block-end: 1px solid var(--typeset-rule);
670
+ margin-block-start: var(--typeset-flow);
671
+ margin-block-end: 0;
672
+ }
673
+
674
+ /* Horizontal scroll for any wide block. Wrap it and the wrapper owns the
675
+ flow margin. Tables shrink to fit, so widen the table to make it scroll
676
+ instead of compress. */
677
+ &:where(.alwith-markdown-readonly-scroll) {
678
+ overflow-x: auto;
679
+ margin-block-start: var(--typeset-flow);
680
+ }
681
+ &:where(.alwith-markdown-readonly-scroll > *) {
682
+ margin-block-start: 0;
683
+ }
684
+ &:where(.alwith-markdown-readonly-scroll table) {
685
+ width: max-content;
686
+ max-width: none;
687
+ }
688
+ &:where(thead th) {
689
+ font-weight: 500;
690
+ text-align: start;
691
+ white-space: nowrap;
692
+ padding: 0.65em 1em;
693
+ }
694
+ &:where(:is(tbody, tfoot) :is(td, th)) {
695
+ padding: 0.75em 1em;
696
+ text-align: start;
697
+ vertical-align: top;
698
+ border-block-start: 1px solid var(--typeset-rule);
699
+ }
700
+ &:where(tbody th, tfoot th) {
701
+ font-weight: 500;
702
+ }
703
+ &:where(th:first-child, td:first-child) {
704
+ padding-inline-start: 0;
705
+ }
706
+ &:where(th[align="center"], td[align="center"]) {
707
+ text-align: center;
708
+ }
709
+ &:where(th[align="right"], td[align="right"]) {
710
+ text-align: end;
711
+ }
712
+
713
+ /* Blocks inside list items keep the list's tighter rhythm. */
714
+ &:where(li > blockquote, li > table, li > figure) {
715
+ margin-block-start: 0.5em;
716
+ }
717
+ &:where(li > pre) {
718
+ margin-block-start: calc(0.5em / 0.875);
719
+ }
720
+
721
+ @media print {
722
+ &:where(pre, table, blockquote, figure) {
723
+ break-inside: avoid;
724
+ }
725
+ &:where(h1, h2, h3, h4) {
726
+ break-after: avoid;
727
+ }
728
+ }
729
+
730
+ /* Forced colors strips the code background, so give it a border. */
731
+ @media (forced-colors: active) {
732
+ &:where(:not(pre) > code) {
733
+ border: 1px solid;
734
+ }
735
+ }
736
+ }
737
+
738
+ /* First child adds no space above. Last so it wins ties. */
739
+ .alwith-markdown-readonly
740
+ > :where(:first-child):not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)),
741
+ .alwith-markdown-readonly
742
+ > :where(:first-child)
743
+ > :where(:first-child):not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)),
744
+ .alwith-markdown-readonly
745
+ :where(
746
+ li > :first-child,
747
+ blockquote > :first-child,
748
+ td > :first-child,
749
+ th > :first-child,
750
+ dd > :first-child,
751
+ figure > :first-child,
752
+ figure > picture > img
753
+ ):not(:where(.not-typeset, [data-not-typeset], .not-typeset *, [data-not-typeset] *)) {
754
+ margin-block-start: 0;
755
+ }
756
+ }
757
+
758
+ .alwith-markdown-readonly {
759
+ text-wrap: auto;
760
+ width: 100%;
761
+
762
+ overflow-wrap: anywhere;
763
+ }
764
+ .alwith-markdown-readonly a {
765
+ color: var(--primary);
766
+ text-decoration: underline;
767
+ text-underline-offset: 2px;
768
+ }
769
+ .alwith-markdown-readonly a:hover {
770
+ opacity: 0.8;
771
+ }
772
+
773
+ .alwith-markdown-readonly p {
774
+ white-space: pre-wrap;
775
+ }
776
+ .alwith-markdown-readonly code {
777
+ font-family: var(--font-mono, monospace);
778
+ word-break: break-word;
779
+ border-radius: 3px;
780
+ padding: 2px 4px;
781
+ font-size: 0.9em;
782
+ background-color: var(--muted);
783
+ }
784
+ .alwith-markdown-readonly pre code {
785
+ padding: 0;
786
+ background: none;
787
+ font-size: inherit;
788
+ }
789
+
790
+ .alwith-markdown-readonly > :first-child {
791
+ margin-top: 0;
792
+ }
793
+
794
+ .alwith-markdown-readonly table {
795
+ display: block;
796
+ overflow-x: auto;
797
+ max-width: 100%;
798
+ }
799
+ .alwith-markdown-readonly input[type="checkbox"] {
800
+ appearance: none;
801
+ -webkit-appearance: none;
802
+ border: 1px solid var(--border);
803
+ position: relative;
804
+ pointer-events: none;
805
+ vertical-align: middle;
806
+ border-radius: 2px;
807
+ width: 1em;
808
+ height: 1em;
809
+ margin: 2px 4px 2px 2px;
810
+ }
811
+ .alwith-markdown-readonly input[type="checkbox"]:checked::after {
812
+ content: "✓";
813
+ position: absolute;
814
+ font-size: 0.9em;
815
+ top: 50%;
816
+ left: 50%;
817
+ transform: translate(-50%, -50%);
818
+ }
819
+
820
+ .alwith-markdown-code-block {
821
+ position: relative;
822
+ margin: 8px 0;
823
+ }
824
+ .alwith-markdown-code-block pre {
825
+ overflow-x: auto;
826
+ white-space: pre;
827
+ box-sizing: border-box;
828
+ border-radius: 4px;
829
+ max-width: 100%;
830
+ margin: 0;
831
+ padding: 8px;
832
+ background-color: var(--background);
833
+ border: 0.5px solid var(--border);
834
+ }
835
+ .alwith-markdown-code-language {
836
+ font-family: var(--font-mono, monospace);
837
+ font-size: 0.75rem;
838
+ color: var(--muted-foreground);
839
+ padding: 4px 8px 2px;
840
+ background-color: var(--background);
841
+ border: 0.5px solid var(--border);
842
+ border-bottom: none;
843
+ border-radius: 4px 4px 0 0;
844
+ display: inline-block;
845
+ }
846
+ .alwith-markdown-code-language + pre {
847
+ border-radius: 0 4px 4px 4px;
848
+ }
849
+
850
+ .alwith-markdown-code-toolbar {
851
+ position: absolute;
852
+ top: 4px;
853
+ right: 4px;
854
+ display: flex;
855
+ gap: 2px;
856
+ opacity: 0;
857
+ transition: opacity 0.15s;
858
+ }
859
+ .alwith-markdown-code-block:hover .alwith-markdown-code-toolbar {
860
+ opacity: 1;
861
+ }
862
+ .alwith-markdown-code-toolbar button {
863
+ background: none;
864
+ border: none;
865
+ cursor: pointer;
866
+ color: var(--muted-foreground);
867
+ display: flex;
868
+ align-items: center;
869
+ padding: 4px;
870
+ border-radius: 4px;
871
+ }
872
+ .alwith-markdown-code-toolbar button:hover {
873
+ background: var(--accent);
874
+ color: var(--foreground);
875
+ }
876
+ .alwith-markdown-code-toolbar button[data-active="true"] {
877
+ background: var(--accent);
878
+ color: var(--foreground);
879
+ }
880
+
881
+ .alwith-markdown-code-block[data-wrap="true"] pre {
882
+ white-space: pre-wrap;
883
+ word-break: break-all;
884
+ }
885
+
886
+ .alwith-markdown-line-number {
887
+ user-select: none;
888
+ pointer-events: none;
889
+ display: inline-block;
890
+ width: 3ch;
891
+ text-align: right;
892
+ opacity: 0.3;
893
+ margin-right: 1ch;
894
+ }
895
+ .alwith-markdown-line-numbers {
896
+ float: left;
897
+ display: flex;
898
+ flex-direction: column;
899
+ pointer-events: none;
900
+ user-select: none;
901
+ }
902
+
903
+ .alwith-markdown-readonly .md-math-display {
904
+ display: block;
905
+ text-align: center;
906
+ overflow-x: auto;
907
+ padding: 0.4em 0;
908
+ }
909
+ .alwith-markdown-readonly .md-math-inline {
910
+ display: inline;
911
+ }
912
+
913
+ .dark .alwith-markdown-readonly pre span {
914
+ color: var(--shiki-dark);
915
+ }
916
+ .alwith-markdown-code-block:focus-within .alwith-markdown-code-toolbar {
917
+ opacity: 1;
918
+ }