uncial 0.0.7 → 2.0.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/README.md +82 -15
- package/dist/core/attributes.d.ts +21 -3
- package/dist/core/attributes.js +86 -15
- package/dist/core/defineBlock.js +26 -12
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +2 -1
- package/dist/core/issues.d.ts +7 -0
- package/dist/core/issues.js +9 -0
- package/dist/core/meta.js +2 -7
- package/dist/core/migrations.d.ts +30 -0
- package/dist/core/migrations.js +50 -0
- package/dist/core/normalize.d.ts +12 -1
- package/dist/core/normalize.js +123 -22
- package/dist/core/registry.d.ts +7 -0
- package/dist/core/registry.js +35 -4
- package/dist/core/runtime.d.ts +7 -0
- package/dist/core/types.d.ts +31 -3
- package/dist/core/validate.js +27 -7
- package/dist/editor/AttributeFieldControl.svelte +155 -7
- package/dist/editor/AttributeFieldControl.svelte.d.ts +1 -0
- package/dist/editor/BlockAttributesPanel.svelte +76 -44
- package/dist/editor/BlockAttributesPanel.svelte.d.ts +9 -1
- package/dist/editor/Editor.svelte +149 -27
- package/dist/editor/Editor.svelte.d.ts +37 -0
- package/dist/editor/RichTextAttributeEditor.svelte +75 -145
- package/dist/editor/RichTextAttributeEditor.svelte.d.ts +2 -1
- package/dist/editor/Toolbar.svelte +2 -3
- package/dist/editor/attributeTargets.d.ts +23 -0
- package/dist/editor/attributeTargets.js +21 -0
- package/dist/editor/attributesController.d.ts +12 -0
- package/dist/editor/attributesController.js +142 -230
- package/dist/editor/bindEditor.d.ts +7 -0
- package/dist/editor/bindEditor.js +141 -27
- package/dist/editor/chooseAttribute.d.ts +26 -0
- package/dist/editor/chooseAttribute.js +10 -0
- package/dist/editor/containerChildOps.d.ts +33 -0
- package/dist/editor/containerChildOps.js +115 -0
- package/dist/editor/dropdownDismiss.d.ts +18 -0
- package/dist/editor/dropdownDismiss.js +46 -0
- package/dist/editor/dropdownFloat.d.ts +16 -0
- package/dist/editor/dropdownFloat.js +127 -0
- package/dist/editor/index.d.ts +3 -1
- package/dist/editor/index.js +2 -1
- package/dist/editor/linkController.d.ts +19 -0
- package/dist/editor/linkController.js +72 -0
- package/dist/editor/toolbarFeatures.d.ts +12 -0
- package/dist/editor/toolbarFeatures.js +36 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/render/Renderer.svelte +1 -1
- package/dist/render/RichContent.svelte +12 -4
- package/dist/render/RichContent.svelte.d.ts +2 -0
- package/dist/render/RichNode.svelte +80 -10
- package/dist/render/RichNode.svelte.d.ts +2 -0
- package/dist/render/Tab.svelte +27 -0
- package/dist/render/Tab.svelte.d.ts +10 -0
- package/dist/render/Tabs.svelte +57 -0
- package/dist/render/Tabs.svelte.d.ts +10 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/index.js +6 -0
- package/dist/render/sanitize.d.ts +6 -0
- package/dist/render/sanitize.js +20 -1
- package/dist/render/tabSelection.svelte.d.ts +8 -0
- package/dist/render/tabSelection.svelte.js +40 -0
- package/dist/runtime/reactiveProps.svelte.d.ts +16 -0
- package/dist/runtime/reactiveProps.svelte.js +16 -0
- package/dist/runtime/svelte.d.ts +2 -1
- package/dist/runtime/svelte.js +26 -6
- package/dist/shared/EditorBlockFixture.svelte +24 -0
- package/dist/shared/EditorBlockFixture.svelte.d.ts +9 -0
- package/dist/shared/content.js +2 -1
- package/dist/shared/documentIdentity.d.ts +6 -0
- package/dist/shared/documentIdentity.js +64 -0
- package/dist/shared/guards.d.ts +13 -0
- package/dist/shared/guards.js +16 -0
- package/dist/shared/richText.js +20 -4
- package/dist/shared/runtimeId.d.ts +8 -0
- package/dist/shared/runtimeId.js +8 -0
- package/dist/shared/syntaxHighlight.d.ts +14 -0
- package/dist/shared/syntaxHighlight.js +36 -3
- package/dist/shared/tiptap.js +140 -27
- package/dist/styles/base.css +177 -0
- package/dist/styles/prose.css +26 -0
- package/dist/styles/tokens.css +53 -69
- package/dist/tabs.d.ts +6 -0
- package/dist/tabs.js +36 -0
- package/dist/web-components/UncialEditor.svelte +23 -7
- package/dist/web-components/UncialEditor.svelte.d.ts +7 -2
- package/dist/web-components/index.d.ts +45 -10
- package/dist/web-components/index.js +98 -36
- package/dist/web-components/reactiveProps.svelte.d.ts +10 -0
- package/dist/web-components/reactiveProps.svelte.js +13 -0
- package/package.json +134 -133
package/dist/styles/base.css
CHANGED
|
@@ -22,12 +22,46 @@
|
|
|
22
22
|
border: 1px solid var(--uncial-color-border);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/* The toolbar spans the full width; the document and the attributes sidebar
|
|
26
|
+
share the row beneath it. The sidebar is optional (`attributesPanel={false}`),
|
|
27
|
+
so the second track only exists when one is actually rendered. */
|
|
28
|
+
.uncial-editor-shell {
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-columns: minmax(0, 1fr);
|
|
31
|
+
grid-template-areas: 'toolbar' 'body';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.uncial-editor-shell:has(> .uncial-editor-sidebar:not(.uncial-editor-sidebar--overlay)) {
|
|
35
|
+
grid-template-columns: minmax(0, 1fr) var(--uncial-panel-width);
|
|
36
|
+
grid-template-areas: 'toolbar toolbar' 'body sidebar';
|
|
37
|
+
}
|
|
38
|
+
|
|
25
39
|
.uncial-editor-body {
|
|
40
|
+
grid-area: body;
|
|
26
41
|
position: relative;
|
|
27
42
|
min-width: 0;
|
|
28
43
|
}
|
|
29
44
|
|
|
45
|
+
.uncial-editor-sidebar {
|
|
46
|
+
grid-area: sidebar;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
border-left: 1px solid var(--uncial-color-border);
|
|
49
|
+
padding: var(--uncial-space-4);
|
|
50
|
+
overflow-wrap: break-word;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* The sidebar stretches to the document's full height, so the panel itself
|
|
54
|
+
sticks: on a long document the selected block's attributes stay on screen
|
|
55
|
+
however far down the block sits. */
|
|
56
|
+
.uncial-editor-sidebar > .uncial-attrs-panel {
|
|
57
|
+
position: sticky;
|
|
58
|
+
top: var(--uncial-space-4);
|
|
59
|
+
max-height: calc(100dvh - 2 * var(--uncial-space-4));
|
|
60
|
+
overflow-y: auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
30
63
|
.uncial-toolbar {
|
|
64
|
+
grid-area: toolbar;
|
|
31
65
|
display: flex;
|
|
32
66
|
flex-wrap: wrap;
|
|
33
67
|
align-items: center;
|
|
@@ -312,6 +346,26 @@
|
|
|
312
346
|
.uncial-child-item__content {
|
|
313
347
|
min-width: 0;
|
|
314
348
|
flex: 1;
|
|
349
|
+
display: block;
|
|
350
|
+
border: none;
|
|
351
|
+
background: transparent;
|
|
352
|
+
padding: 0;
|
|
353
|
+
margin: 0;
|
|
354
|
+
font: inherit;
|
|
355
|
+
color: inherit;
|
|
356
|
+
text-align: left;
|
|
357
|
+
cursor: pointer;
|
|
358
|
+
border-radius: var(--uncial-radius-sm);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.uncial-child-item__content:hover .uncial-child-item__label,
|
|
362
|
+
.uncial-child-item__content:focus-visible .uncial-child-item__label {
|
|
363
|
+
color: var(--uncial-color-primary);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.uncial-child-item:has(.uncial-child-item__content[aria-current]) {
|
|
367
|
+
border-color: var(--uncial-color-primary);
|
|
368
|
+
background: color-mix(in srgb, var(--uncial-color-primary) 8%, transparent);
|
|
315
369
|
}
|
|
316
370
|
|
|
317
371
|
.uncial-child-item__label {
|
|
@@ -330,6 +384,32 @@
|
|
|
330
384
|
gap: 0.125rem;
|
|
331
385
|
}
|
|
332
386
|
|
|
387
|
+
.uncial-list-field {
|
|
388
|
+
display: grid;
|
|
389
|
+
gap: var(--uncial-space-2);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.uncial-list-item {
|
|
393
|
+
border: 1px solid var(--uncial-color-border);
|
|
394
|
+
border-radius: var(--uncial-radius-lg);
|
|
395
|
+
background: color-mix(in srgb, var(--uncial-color-surface-elevated) 50%, transparent);
|
|
396
|
+
padding: var(--uncial-space-2);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.uncial-list-item__head {
|
|
400
|
+
display: flex;
|
|
401
|
+
align-items: center;
|
|
402
|
+
justify-content: space-between;
|
|
403
|
+
gap: var(--uncial-space-2);
|
|
404
|
+
margin-bottom: var(--uncial-space-2);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* The item's own fields are the last thing in its box; the box supplies the
|
|
408
|
+
spacing the field's bottom margin would otherwise double. */
|
|
409
|
+
.uncial-list-item > .uncial-field:last-child {
|
|
410
|
+
margin-bottom: 0;
|
|
411
|
+
}
|
|
412
|
+
|
|
333
413
|
.uncial-richtext-wrapper {
|
|
334
414
|
border-radius: var(--uncial-radius-lg);
|
|
335
415
|
}
|
|
@@ -357,6 +437,21 @@
|
|
|
357
437
|
}
|
|
358
438
|
|
|
359
439
|
@media (max-width: 639px) {
|
|
440
|
+
.uncial-editor-shell:has(> .uncial-editor-sidebar:not(.uncial-editor-sidebar--overlay)) {
|
|
441
|
+
grid-template-columns: minmax(0, 1fr);
|
|
442
|
+
grid-template-areas: 'toolbar' 'body' 'sidebar';
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.uncial-editor-sidebar {
|
|
446
|
+
border-left: none;
|
|
447
|
+
border-top: 1px solid var(--uncial-color-border);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.uncial-editor-sidebar > .uncial-attrs-panel {
|
|
451
|
+
position: static;
|
|
452
|
+
max-height: none;
|
|
453
|
+
}
|
|
454
|
+
|
|
360
455
|
.uncial-content.uncial-gutter-enabled {
|
|
361
456
|
padding-left: max(
|
|
362
457
|
var(--uncial-gutter-width-sm),
|
|
@@ -416,3 +511,85 @@
|
|
|
416
511
|
word-break: normal;
|
|
417
512
|
}
|
|
418
513
|
}
|
|
514
|
+
|
|
515
|
+
/* An overlay attributes panel: outside the shell's grid, against the viewport
|
|
516
|
+
edge, so selecting a block costs the document no width. */
|
|
517
|
+
.uncial-editor-sidebar--overlay {
|
|
518
|
+
position: fixed;
|
|
519
|
+
inset-block: 0;
|
|
520
|
+
right: 0;
|
|
521
|
+
z-index: 30;
|
|
522
|
+
width: min(var(--uncial-panel-width), 100vw);
|
|
523
|
+
overflow-y: auto;
|
|
524
|
+
border-left: 1px solid var(--uncial-color-border);
|
|
525
|
+
background: var(--uncial-color-surface);
|
|
526
|
+
box-shadow: var(--uncial-shadow-md);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.uncial-editor-sidebar__head {
|
|
530
|
+
display: flex;
|
|
531
|
+
justify-content: flex-end;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.uncial-editor-sidebar--overlay > .uncial-attrs-panel {
|
|
535
|
+
position: static;
|
|
536
|
+
max-height: none;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/* Bare presentation: the editor draws no surface of its own and reserves no
|
|
540
|
+
inline space, so `.uncial-content`'s content box is the box the host gave the
|
|
541
|
+
shell — the premise every width the host's CSS derives from its container
|
|
542
|
+
(bleed, measure, container queries) depends on. The block handles are the
|
|
543
|
+
other half of that promise: they float over each block's top-left corner
|
|
544
|
+
rather than pushing the document inwards, which also keeps them on screen for
|
|
545
|
+
a block that bleeds past the document column. */
|
|
546
|
+
.uncial-editor-shell--bare {
|
|
547
|
+
border-radius: 0;
|
|
548
|
+
background: none;
|
|
549
|
+
box-shadow: none;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.uncial-editor-shell--bare .uncial-content,
|
|
553
|
+
.uncial-editor-shell--bare .uncial-content.uncial-gutter-enabled {
|
|
554
|
+
padding: 0;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.uncial-editor-shell--bare .uncial-nodeview-gutter {
|
|
558
|
+
/* The block's own body is positioned and comes later in the DOM, so the
|
|
559
|
+
handles need a layer of their own to sit above it. */
|
|
560
|
+
z-index: 5;
|
|
561
|
+
left: 0.5rem;
|
|
562
|
+
top: 0.5rem;
|
|
563
|
+
bottom: auto;
|
|
564
|
+
width: auto;
|
|
565
|
+
flex-direction: row;
|
|
566
|
+
gap: 0.35rem;
|
|
567
|
+
border-radius: var(--uncial-radius-md);
|
|
568
|
+
padding: 0.15rem 0.4rem;
|
|
569
|
+
background: color-mix(in srgb, var(--uncial-color-surface) 88%, transparent);
|
|
570
|
+
box-shadow: var(--uncial-shadow-sm);
|
|
571
|
+
opacity: 0.55;
|
|
572
|
+
transition: opacity var(--uncial-transition);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.uncial-editor-shell--bare .uncial-nodeview-gutter:hover,
|
|
576
|
+
.uncial-editor-shell--bare .uncial-nodeview-gutter:focus-within {
|
|
577
|
+
opacity: 1;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.uncial-editor-shell--bare .uncial-gutter-label {
|
|
581
|
+
max-width: none;
|
|
582
|
+
white-space: nowrap;
|
|
583
|
+
word-break: normal;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
@media (max-width: 639px) {
|
|
587
|
+
/* No room beside the panel on a phone: the overlay becomes a bottom sheet. */
|
|
588
|
+
.uncial-editor-sidebar--overlay {
|
|
589
|
+
inset: auto 0 0 0;
|
|
590
|
+
width: auto;
|
|
591
|
+
max-height: 60dvh;
|
|
592
|
+
border-left: none;
|
|
593
|
+
border-top: 1px solid var(--uncial-color-border);
|
|
594
|
+
}
|
|
595
|
+
}
|
package/dist/styles/prose.css
CHANGED
|
@@ -57,6 +57,32 @@
|
|
|
57
57
|
font-size: 0.9em;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
.uncial-table-scroll {
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
min-width: 0;
|
|
63
|
+
overflow-x: auto;
|
|
64
|
+
margin: 1rem 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.uncial-table-scroll table {
|
|
68
|
+
min-width: 100%;
|
|
69
|
+
width: max-content;
|
|
70
|
+
border-collapse: collapse;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.uncial-table-scroll th,
|
|
74
|
+
.uncial-table-scroll td {
|
|
75
|
+
padding: 0.65rem 0.8rem;
|
|
76
|
+
border: 1px solid color-mix(in srgb, var(--uncial-color-text) 16%, transparent);
|
|
77
|
+
text-align: left;
|
|
78
|
+
vertical-align: top;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.uncial-table-scroll th {
|
|
82
|
+
background: var(--uncial-color-surface-elevated);
|
|
83
|
+
font-weight: var(--uncial-font-weight-strong);
|
|
84
|
+
}
|
|
85
|
+
|
|
60
86
|
.uncial-rich-content pre {
|
|
61
87
|
background: var(--uncial-color-code-bg, oklch(24% 0.04 45));
|
|
62
88
|
color: var(--uncial-color-code-text, oklch(96% 0.015 85));
|
package/dist/styles/tokens.css
CHANGED
|
@@ -1,77 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
.
|
|
3
|
-
|
|
4
|
-
.
|
|
5
|
-
|
|
6
|
-
.uncial-block-menu {
|
|
7
|
-
--uncial-color-bg: oklch(99% 0.006 85);
|
|
8
|
-
--uncial-color-surface: oklch(99% 0.006 85);
|
|
9
|
-
--uncial-color-surface-elevated: oklch(96% 0.022 85);
|
|
10
|
-
--uncial-color-border: oklch(91% 0.032 82);
|
|
11
|
-
--uncial-color-border-strong: color-mix(
|
|
12
|
-
in srgb,
|
|
13
|
-
var(--uncial-color-text) 22%,
|
|
14
|
-
var(--uncial-color-border)
|
|
15
|
-
);
|
|
16
|
-
--uncial-color-text: oklch(22% 0.04 45);
|
|
17
|
-
--uncial-color-text-muted: color-mix(in srgb, var(--uncial-color-text) 62%, transparent);
|
|
18
|
-
--uncial-color-text-inverted: oklch(98% 0.015 85);
|
|
19
|
-
--uncial-color-primary: oklch(46% 0.14 260);
|
|
20
|
-
--uncial-color-primary-contrast: oklch(98% 0.015 85);
|
|
21
|
-
--uncial-color-accent: oklch(58% 0.12 75);
|
|
22
|
-
--uncial-color-danger: oklch(48% 0.18 25);
|
|
23
|
-
--uncial-color-focus-ring: var(--uncial-color-primary);
|
|
24
|
-
--uncial-color-code-bg: oklch(24% 0.04 45);
|
|
25
|
-
--uncial-color-code-text: oklch(96% 0.015 85);
|
|
26
|
-
|
|
27
|
-
--uncial-font-body: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
|
|
28
|
-
--uncial-font-display: var(--uncial-font-body);
|
|
29
|
-
--uncial-font-mono:
|
|
30
|
-
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
|
31
|
-
monospace;
|
|
32
|
-
--uncial-font-size-base: 1rem;
|
|
33
|
-
--uncial-line-height: 1.75;
|
|
34
|
-
--uncial-font-weight-regular: 400;
|
|
35
|
-
--uncial-font-weight-strong: 700;
|
|
36
|
-
|
|
37
|
-
--uncial-radius-sm: 0.25rem;
|
|
38
|
-
--uncial-radius-md: 0.375rem;
|
|
39
|
-
--uncial-radius-lg: 0.5rem;
|
|
40
|
-
|
|
41
|
-
--uncial-space-1: 0.25rem;
|
|
42
|
-
--uncial-space-2: 0.5rem;
|
|
43
|
-
--uncial-space-3: 0.75rem;
|
|
44
|
-
--uncial-space-4: 1rem;
|
|
45
|
-
--uncial-space-5: 1.25rem;
|
|
46
|
-
--uncial-space-6: 1.5rem;
|
|
47
|
-
--uncial-gutter-width: 5.5rem;
|
|
48
|
-
--uncial-gutter-width-sm: 3.5rem;
|
|
49
|
-
--uncial-toolbar-gap: var(--uncial-space-2);
|
|
50
|
-
--uncial-panel-width: 20rem;
|
|
51
|
-
|
|
52
|
-
--uncial-shadow-sm: 0 1px 2px color-mix(in srgb, black 8%, transparent);
|
|
53
|
-
--uncial-shadow-md: 0 10px 25px color-mix(in srgb, black 14%, transparent);
|
|
54
|
-
--uncial-transition: 140ms ease;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@media (prefers-color-scheme: dark) {
|
|
1
|
+
/* Uncial's token defaults, in a cascade layer so that a host's own
|
|
2
|
+
* `--uncial-*` values win whatever order the stylesheets load in. `EditorPage`
|
|
3
|
+
* imports the chrome stylesheet at runtime, which lands after the host's CSS;
|
|
4
|
+
* unlayered these defaults would take the host's overrides back. */
|
|
5
|
+
@layer uncial-tokens {
|
|
58
6
|
.uncial-editor-shell,
|
|
59
7
|
.uncial-renderer,
|
|
60
8
|
.uncial-attrs-panel,
|
|
61
9
|
.uncial-link-panel,
|
|
62
10
|
.uncial-richtext-wrapper,
|
|
63
11
|
.uncial-block-menu {
|
|
64
|
-
--uncial-color-bg: oklch(18% 0.015 60);
|
|
65
|
-
--uncial-color-surface: oklch(18% 0.015 60);
|
|
66
|
-
--uncial-color-surface-elevated: oklch(22% 0.02 60);
|
|
67
|
-
--uncial-color-border: oklch(27% 0.025 60);
|
|
68
|
-
--uncial-color-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
--uncial-color-
|
|
74
|
-
--uncial-color-
|
|
75
|
-
--uncial-color-
|
|
12
|
+
--uncial-color-bg: light-dark(oklch(99% 0.006 85), oklch(18% 0.015 60));
|
|
13
|
+
--uncial-color-surface: light-dark(oklch(99% 0.006 85), oklch(18% 0.015 60));
|
|
14
|
+
--uncial-color-surface-elevated: light-dark(oklch(96% 0.022 85), oklch(22% 0.02 60));
|
|
15
|
+
--uncial-color-border: light-dark(oklch(91% 0.032 82), oklch(27% 0.025 60));
|
|
16
|
+
--uncial-color-border-strong: color-mix(
|
|
17
|
+
in srgb,
|
|
18
|
+
var(--uncial-color-text) 22%,
|
|
19
|
+
var(--uncial-color-border)
|
|
20
|
+
);
|
|
21
|
+
--uncial-color-text: light-dark(oklch(22% 0.04 45), oklch(92% 0.015 85));
|
|
22
|
+
--uncial-color-text-muted: color-mix(in srgb, var(--uncial-color-text) 62%, transparent);
|
|
23
|
+
--uncial-color-text-inverted: light-dark(oklch(98% 0.015 85), oklch(16% 0.03 260));
|
|
24
|
+
--uncial-color-primary: light-dark(oklch(46% 0.14 260), oklch(72% 0.13 260));
|
|
25
|
+
--uncial-color-primary-contrast: light-dark(oklch(98% 0.015 85), oklch(16% 0.03 260));
|
|
26
|
+
--uncial-color-accent: light-dark(oklch(58% 0.12 75), oklch(78% 0.13 75));
|
|
27
|
+
--uncial-color-danger: light-dark(oklch(48% 0.18 25), oklch(72% 0.16 25));
|
|
28
|
+
--uncial-color-focus-ring: var(--uncial-color-primary);
|
|
29
|
+
--uncial-color-code-bg: light-dark(oklch(24% 0.04 45), oklch(13% 0.015 60));
|
|
30
|
+
--uncial-color-code-text: light-dark(oklch(96% 0.015 85), oklch(94% 0.015 85));
|
|
31
|
+
|
|
32
|
+
--uncial-font-body: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
|
|
33
|
+
--uncial-font-display: var(--uncial-font-body);
|
|
34
|
+
--uncial-font-mono:
|
|
35
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
|
36
|
+
monospace;
|
|
37
|
+
--uncial-font-size-base: 1rem;
|
|
38
|
+
--uncial-line-height: 1.75;
|
|
39
|
+
--uncial-font-weight-regular: 400;
|
|
40
|
+
--uncial-font-weight-strong: 700;
|
|
41
|
+
|
|
42
|
+
--uncial-radius-sm: 0.25rem;
|
|
43
|
+
--uncial-radius-md: 0.375rem;
|
|
44
|
+
--uncial-radius-lg: 0.5rem;
|
|
45
|
+
|
|
46
|
+
--uncial-space-1: 0.25rem;
|
|
47
|
+
--uncial-space-2: 0.5rem;
|
|
48
|
+
--uncial-space-3: 0.75rem;
|
|
49
|
+
--uncial-space-4: 1rem;
|
|
50
|
+
--uncial-space-5: 1.25rem;
|
|
51
|
+
--uncial-space-6: 1.5rem;
|
|
52
|
+
--uncial-gutter-width: 5.5rem;
|
|
53
|
+
--uncial-gutter-width-sm: 3.5rem;
|
|
54
|
+
--uncial-toolbar-gap: var(--uncial-space-2);
|
|
55
|
+
--uncial-panel-width: 20rem;
|
|
56
|
+
|
|
57
|
+
--uncial-shadow-sm: 0 1px 2px color-mix(in srgb, black 8%, transparent);
|
|
58
|
+
--uncial-shadow-md: 0 10px 25px color-mix(in srgb, black 14%, transparent);
|
|
59
|
+
--uncial-transition: 140ms ease;
|
|
76
60
|
}
|
|
77
61
|
}
|
package/dist/tabs.d.ts
ADDED
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineSvelteBlock } from './runtime/svelte.js';
|
|
2
|
+
import Tab from './render/Tab.svelte';
|
|
3
|
+
import Tabs from './render/Tabs.svelte';
|
|
4
|
+
function isNonEmptyString(value) {
|
|
5
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
6
|
+
}
|
|
7
|
+
export const tabsBlock = defineSvelteBlock({
|
|
8
|
+
id: 'tabs',
|
|
9
|
+
label: 'Tabs',
|
|
10
|
+
description: 'A linked group of labelled content tabs.',
|
|
11
|
+
attributes: {
|
|
12
|
+
group: {
|
|
13
|
+
default: '',
|
|
14
|
+
required: true,
|
|
15
|
+
validate: isNonEmptyString,
|
|
16
|
+
placeholder: 'framework'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
component: Tabs,
|
|
20
|
+
content: { kind: 'flow', allowedBlocks: ['tab'] }
|
|
21
|
+
});
|
|
22
|
+
export const tabBlock = defineSvelteBlock({
|
|
23
|
+
id: 'tab',
|
|
24
|
+
label: 'Tab',
|
|
25
|
+
description: 'One labelled panel inside a tabs block.',
|
|
26
|
+
attributes: {
|
|
27
|
+
label: {
|
|
28
|
+
default: '',
|
|
29
|
+
required: true,
|
|
30
|
+
validate: isNonEmptyString,
|
|
31
|
+
placeholder: 'Vue'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
component: Tab,
|
|
35
|
+
content: { kind: 'flow' }
|
|
36
|
+
});
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
ToolbarFeatureSelection
|
|
8
8
|
} from '../editor/index.js';
|
|
9
9
|
import type {
|
|
10
|
+
AttributeSpec,
|
|
10
11
|
BlockDefinition,
|
|
11
12
|
BlockRegistry,
|
|
12
13
|
ContentSchema,
|
|
14
|
+
DocumentMetaSchema,
|
|
13
15
|
ValidationIssue
|
|
14
16
|
} from '../core/types.js';
|
|
15
17
|
import { emptyDocument } from '../shared/content.js';
|
|
@@ -18,43 +20,57 @@
|
|
|
18
20
|
blocks?: BlockRegistry | BlockDefinition[];
|
|
19
21
|
schema?: ContentSchema;
|
|
20
22
|
json?: JSONContent;
|
|
23
|
+
meta?: Record<string, unknown>;
|
|
24
|
+
metaFields?: DocumentMetaSchema | ReadonlyMap<string, AttributeSpec<unknown>>;
|
|
21
25
|
extensions?: AnyExtension[];
|
|
22
26
|
toolbarFeatures?: ToolbarFeatureSelection;
|
|
23
27
|
toolbarExtensions?: ToolbarFeature[];
|
|
24
28
|
attributesController?: BlockAttributesController | null;
|
|
29
|
+
attributesPanel?: boolean | 'docked' | 'overlay' | 'off';
|
|
30
|
+
presentation?: 'card' | 'bare';
|
|
25
31
|
onIssue?: (issue: ValidationIssue) => void;
|
|
26
32
|
onChange?: (document: JSONContent) => void;
|
|
33
|
+
onMetaChange?: (meta: Record<string, unknown>) => void;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
let {
|
|
30
37
|
blocks = [],
|
|
31
38
|
schema = undefined,
|
|
32
39
|
json = $bindable(emptyDocument()),
|
|
40
|
+
meta = $bindable({}),
|
|
41
|
+
metaFields = undefined,
|
|
33
42
|
extensions = [],
|
|
34
43
|
toolbarFeatures = undefined,
|
|
35
44
|
toolbarExtensions = [],
|
|
36
45
|
attributesController = null,
|
|
46
|
+
attributesPanel = true,
|
|
47
|
+
presentation = 'card',
|
|
37
48
|
onIssue,
|
|
38
|
-
onChange
|
|
49
|
+
onChange,
|
|
50
|
+
onMetaChange
|
|
39
51
|
}: Props = $props();
|
|
40
52
|
|
|
41
53
|
function dispatchIssue(issue: ValidationIssue): void {
|
|
42
54
|
onIssue?.(issue);
|
|
43
55
|
}
|
|
44
|
-
|
|
45
|
-
function setJson(nextDocument: JSONContent): void {
|
|
46
|
-
json = nextDocument;
|
|
47
|
-
onChange?.(nextDocument);
|
|
48
|
-
}
|
|
49
56
|
</script>
|
|
50
57
|
|
|
58
|
+
<!-- `Editor` reports edits itself, so the bindings here only mirror its state.
|
|
59
|
+
They were get/set pairs while forwarding an edit meant intercepting the
|
|
60
|
+
assignment, which could not tell an edit from a document the host loaded. -->
|
|
51
61
|
<Editor
|
|
52
62
|
{blocks}
|
|
53
63
|
{schema}
|
|
54
|
-
bind:json
|
|
64
|
+
bind:json
|
|
65
|
+
bind:meta
|
|
66
|
+
{metaFields}
|
|
55
67
|
{extensions}
|
|
56
68
|
{toolbarFeatures}
|
|
57
69
|
{toolbarExtensions}
|
|
58
70
|
{attributesController}
|
|
71
|
+
{attributesPanel}
|
|
72
|
+
{presentation}
|
|
59
73
|
onIssue={dispatchIssue}
|
|
74
|
+
{onChange}
|
|
75
|
+
{onMetaChange}
|
|
60
76
|
/>
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import type { AnyExtension, JSONContent } from '@tiptap/core';
|
|
2
2
|
import type { BlockAttributesController, ToolbarFeature, ToolbarFeatureSelection } from '../editor/index.js';
|
|
3
|
-
import type { BlockDefinition, BlockRegistry, ContentSchema, ValidationIssue } from '../core/types.js';
|
|
3
|
+
import type { AttributeSpec, BlockDefinition, BlockRegistry, ContentSchema, DocumentMetaSchema, ValidationIssue } from '../core/types.js';
|
|
4
4
|
interface Props {
|
|
5
5
|
blocks?: BlockRegistry | BlockDefinition[];
|
|
6
6
|
schema?: ContentSchema;
|
|
7
7
|
json?: JSONContent;
|
|
8
|
+
meta?: Record<string, unknown>;
|
|
9
|
+
metaFields?: DocumentMetaSchema | ReadonlyMap<string, AttributeSpec<unknown>>;
|
|
8
10
|
extensions?: AnyExtension[];
|
|
9
11
|
toolbarFeatures?: ToolbarFeatureSelection;
|
|
10
12
|
toolbarExtensions?: ToolbarFeature[];
|
|
11
13
|
attributesController?: BlockAttributesController | null;
|
|
14
|
+
attributesPanel?: boolean | 'docked' | 'overlay' | 'off';
|
|
15
|
+
presentation?: 'card' | 'bare';
|
|
12
16
|
onIssue?: (issue: ValidationIssue) => void;
|
|
13
17
|
onChange?: (document: JSONContent) => void;
|
|
18
|
+
onMetaChange?: (meta: Record<string, unknown>) => void;
|
|
14
19
|
}
|
|
15
|
-
declare const UncialEditor: import("svelte").Component<Props, {}, "json">;
|
|
20
|
+
declare const UncialEditor: import("svelte").Component<Props, {}, "json" | "meta">;
|
|
16
21
|
type UncialEditor = ReturnType<typeof UncialEditor>;
|
|
17
22
|
export default UncialEditor;
|
|
@@ -2,44 +2,74 @@ import UncialEditor from './UncialEditor.svelte';
|
|
|
2
2
|
import UncialRenderer from './UncialRenderer.svelte';
|
|
3
3
|
import type { AnyExtension, JSONContent } from '@tiptap/core';
|
|
4
4
|
import type { BlockAttributesController, ToolbarFeature, ToolbarFeatureSelection } from '../editor/index.js';
|
|
5
|
-
import type { BlockDefinition, BlockRegistry, ContentSchema } from '../core/types.js';
|
|
5
|
+
import type { AttributeSpec, BlockDefinition, BlockRegistry, ContentSchema, DocumentMetaSchema, ValidationIssue } from '../core/types.js';
|
|
6
6
|
type EditorProps = {
|
|
7
7
|
blocks?: BlockRegistry | BlockDefinition[];
|
|
8
8
|
schema?: ContentSchema;
|
|
9
9
|
json?: JSONContent;
|
|
10
|
+
meta?: Record<string, unknown>;
|
|
11
|
+
metaFields?: DocumentMetaSchema | ReadonlyMap<string, AttributeSpec<unknown>>;
|
|
10
12
|
extensions?: AnyExtension[];
|
|
11
13
|
toolbarFeatures?: ToolbarFeatureSelection;
|
|
12
14
|
toolbarExtensions?: ToolbarFeature[];
|
|
13
15
|
attributesController?: BlockAttributesController | null;
|
|
16
|
+
attributesPanel?: boolean | 'docked' | 'overlay' | 'off';
|
|
17
|
+
presentation?: 'card' | 'bare';
|
|
18
|
+
};
|
|
19
|
+
type EditorHostProps = EditorProps & {
|
|
20
|
+
onIssue?: (issue: ValidationIssue) => void;
|
|
21
|
+
onChange?: (document: JSONContent) => void;
|
|
22
|
+
onMetaChange?: (meta: Record<string, unknown>) => void;
|
|
14
23
|
};
|
|
15
24
|
type RendererProps = {
|
|
16
25
|
content?: JSONContent;
|
|
17
26
|
blocks?: BlockRegistry | BlockDefinition[];
|
|
18
27
|
schema?: ContentSchema;
|
|
19
28
|
};
|
|
29
|
+
type RendererHostProps = RendererProps & {
|
|
30
|
+
onIssue?: (issue: ValidationIssue) => void;
|
|
31
|
+
};
|
|
20
32
|
declare const BrowserHTMLElement: {
|
|
21
33
|
new (): HTMLElement;
|
|
22
34
|
prototype: HTMLElement;
|
|
23
35
|
};
|
|
24
36
|
declare abstract class UncialElement<Props extends Record<string, unknown>> extends BrowserHTMLElement {
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
static readonly observedAttributes: string[];
|
|
38
|
+
/**
|
|
39
|
+
* `$state`-backed props shared with the mounted Svelte component. Mutating
|
|
40
|
+
* this object updates the component in place; the component is mounted once
|
|
41
|
+
* per connection instead of being destroyed and recreated per property set.
|
|
42
|
+
*/
|
|
43
|
+
protected readonly props: Props;
|
|
44
|
+
private instance;
|
|
27
45
|
private readonly root;
|
|
46
|
+
private stylesheetLinks;
|
|
28
47
|
connectedCallback(): void;
|
|
29
48
|
disconnectedCallback(): void;
|
|
49
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
50
|
+
/**
|
|
51
|
+
* One or more whitespace-separated stylesheet URLs rendered as
|
|
52
|
+
* `<link rel="stylesheet">` elements inside the shadow root.
|
|
53
|
+
*/
|
|
54
|
+
get stylesheet(): string | null;
|
|
55
|
+
set stylesheet(value: string | null | undefined);
|
|
30
56
|
protected setProp<Key extends keyof Props>(key: Key, value: Props[Key]): void;
|
|
31
57
|
protected emit(type: string, detail: unknown): void;
|
|
32
|
-
protected abstract
|
|
33
|
-
private
|
|
34
|
-
private destroy;
|
|
58
|
+
protected abstract mountComponent(target: ShadowRoot): Record<string, unknown>;
|
|
59
|
+
private renderStylesheetLinks;
|
|
35
60
|
}
|
|
36
|
-
declare class UncialEditorElement extends UncialElement<
|
|
61
|
+
declare class UncialEditorElement extends UncialElement<EditorHostProps> {
|
|
62
|
+
constructor();
|
|
37
63
|
get blocks(): EditorProps['blocks'];
|
|
38
64
|
set blocks(value: EditorProps['blocks']);
|
|
39
65
|
get schema(): EditorProps['schema'];
|
|
40
66
|
set schema(value: EditorProps['schema']);
|
|
41
67
|
get json(): EditorProps['json'];
|
|
42
68
|
set json(value: EditorProps['json']);
|
|
69
|
+
get meta(): EditorProps['meta'];
|
|
70
|
+
set meta(value: EditorProps['meta']);
|
|
71
|
+
get metaFields(): EditorProps['metaFields'];
|
|
72
|
+
set metaFields(value: EditorProps['metaFields']);
|
|
43
73
|
get extensions(): EditorProps['extensions'];
|
|
44
74
|
set extensions(value: EditorProps['extensions']);
|
|
45
75
|
get toolbarFeatures(): EditorProps['toolbarFeatures'];
|
|
@@ -48,15 +78,20 @@ declare class UncialEditorElement extends UncialElement<EditorProps> {
|
|
|
48
78
|
set toolbarExtensions(value: EditorProps['toolbarExtensions']);
|
|
49
79
|
get attributesController(): EditorProps['attributesController'];
|
|
50
80
|
set attributesController(value: EditorProps['attributesController']);
|
|
51
|
-
|
|
81
|
+
get attributesPanel(): EditorProps['attributesPanel'];
|
|
82
|
+
set attributesPanel(value: EditorProps['attributesPanel']);
|
|
83
|
+
get presentation(): EditorProps['presentation'];
|
|
84
|
+
set presentation(value: EditorProps['presentation']);
|
|
85
|
+
protected mountComponent(target: ShadowRoot): Record<string, unknown>;
|
|
52
86
|
}
|
|
53
|
-
declare class UncialRendererElement extends UncialElement<
|
|
87
|
+
declare class UncialRendererElement extends UncialElement<RendererHostProps> {
|
|
88
|
+
constructor();
|
|
54
89
|
get content(): RendererProps['content'];
|
|
55
90
|
set content(value: RendererProps['content']);
|
|
56
91
|
get blocks(): RendererProps['blocks'];
|
|
57
92
|
set blocks(value: RendererProps['blocks']);
|
|
58
93
|
get schema(): RendererProps['schema'];
|
|
59
94
|
set schema(value: RendererProps['schema']);
|
|
60
|
-
protected
|
|
95
|
+
protected mountComponent(target: ShadowRoot): Record<string, unknown>;
|
|
61
96
|
}
|
|
62
97
|
export { UncialEditor, UncialEditorElement, UncialRenderer, UncialRendererElement };
|