uncial 0.0.1

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +228 -0
  3. package/dist/core/attributes.d.ts +11 -0
  4. package/dist/core/attributes.js +149 -0
  5. package/dist/core/defineBlock.d.ts +2 -0
  6. package/dist/core/defineBlock.js +77 -0
  7. package/dist/core/index.d.ts +7 -0
  8. package/dist/core/index.js +6 -0
  9. package/dist/core/normalize.d.ts +5 -0
  10. package/dist/core/normalize.js +38 -0
  11. package/dist/core/registry.d.ts +4 -0
  12. package/dist/core/registry.js +41 -0
  13. package/dist/core/types.d.ts +130 -0
  14. package/dist/core/types.js +1 -0
  15. package/dist/core/validate.d.ts +4 -0
  16. package/dist/core/validate.js +181 -0
  17. package/dist/editor/BlockAttributesPanel.svelte +354 -0
  18. package/dist/editor/BlockAttributesPanel.svelte.d.ts +9 -0
  19. package/dist/editor/BlockMenu.svelte +63 -0
  20. package/dist/editor/BlockMenu.svelte.d.ts +24 -0
  21. package/dist/editor/BlockNodeView.svelte +88 -0
  22. package/dist/editor/BlockNodeView.svelte.d.ts +14 -0
  23. package/dist/editor/Editor.svelte +453 -0
  24. package/dist/editor/Editor.svelte.d.ts +17 -0
  25. package/dist/editor/LinkAttributesPanel.svelte +96 -0
  26. package/dist/editor/LinkAttributesPanel.svelte.d.ts +17 -0
  27. package/dist/editor/RichTextAttributeEditor.svelte +232 -0
  28. package/dist/editor/RichTextAttributeEditor.svelte.d.ts +11 -0
  29. package/dist/editor/Toolbar.svelte +124 -0
  30. package/dist/editor/Toolbar.svelte.d.ts +14 -0
  31. package/dist/editor/attributesController.d.ts +64 -0
  32. package/dist/editor/attributesController.js +608 -0
  33. package/dist/editor/bindEditor.d.ts +15 -0
  34. package/dist/editor/bindEditor.js +159 -0
  35. package/dist/editor/createEditorExtensions.d.ts +1 -0
  36. package/dist/editor/createEditorExtensions.js +1 -0
  37. package/dist/editor/index.d.ts +11 -0
  38. package/dist/editor/index.js +8 -0
  39. package/dist/editor/toolbarFeatures.d.ts +26 -0
  40. package/dist/editor/toolbarFeatures.js +144 -0
  41. package/dist/index.d.ts +3 -0
  42. package/dist/index.js +3 -0
  43. package/dist/render/ContainerBlockFixture.svelte +22 -0
  44. package/dist/render/ContainerBlockFixture.svelte.d.ts +10 -0
  45. package/dist/render/Renderer.svelte +40 -0
  46. package/dist/render/Renderer.svelte.d.ts +11 -0
  47. package/dist/render/RichContent.svelte +30 -0
  48. package/dist/render/RichContent.svelte.d.ts +10 -0
  49. package/dist/render/RichNode.svelte +105 -0
  50. package/dist/render/RichNode.svelte.d.ts +10 -0
  51. package/dist/render/RichText.svelte +29 -0
  52. package/dist/render/RichText.svelte.d.ts +8 -0
  53. package/dist/render/index.d.ts +2 -0
  54. package/dist/render/index.js +2 -0
  55. package/dist/render/sanitize.d.ts +1 -0
  56. package/dist/render/sanitize.js +17 -0
  57. package/dist/shared/codeBlockAttributes.d.ts +31 -0
  58. package/dist/shared/codeBlockAttributes.js +25 -0
  59. package/dist/shared/content.d.ts +2 -0
  60. package/dist/shared/content.js +7 -0
  61. package/dist/shared/document.d.ts +18 -0
  62. package/dist/shared/document.js +1 -0
  63. package/dist/shared/richText.d.ts +11 -0
  64. package/dist/shared/richText.js +108 -0
  65. package/dist/shared/syntaxHighlight.d.ts +16 -0
  66. package/dist/shared/syntaxHighlight.js +47 -0
  67. package/dist/shared/tiptap.d.ts +7 -0
  68. package/dist/shared/tiptap.js +259 -0
  69. package/package.json +116 -0
@@ -0,0 +1,63 @@
1
+ <script lang="ts">
2
+ import type { Editor } from '@tiptap/core';
3
+ import type { BlockDefinition, BlockRegistry, ContentSchema } from '../core/types.js';
4
+ import { resolveRegistry } from '../core/registry.js';
5
+ import { getBlockDefaultAttrs } from '../shared/tiptap.js';
6
+
7
+ export let editor: Editor | null = null;
8
+ export let blocks: BlockRegistry | BlockDefinition[] = [];
9
+ export let schema: ContentSchema | undefined = undefined;
10
+
11
+ let query = '';
12
+
13
+ $: registry = resolveRegistry(blocks);
14
+ $: availableBlocks = registry.blocks
15
+ .filter((block: BlockDefinition) => !schema || schema.allowedBlocks.has(block.id))
16
+ .filter((block: BlockDefinition) => block.label.toLowerCase().includes(query.toLowerCase()));
17
+
18
+ function insertBlock(id: string): void {
19
+ if (!editor) return;
20
+ const block = registry.get(id);
21
+ if (!block) return;
22
+
23
+ editor
24
+ .chain()
25
+ .focus()
26
+ .insertContent({
27
+ type: block.id,
28
+ attrs: getBlockDefaultAttrs(block)
29
+ })
30
+ .run();
31
+ }
32
+ </script>
33
+
34
+ <div class="uncial-toolbar">
35
+ <input type="search" placeholder="Filter blocks..." bind:value={query} />
36
+ {#each availableBlocks as block (block.id)}
37
+ <button type="button" on:click={() => insertBlock(block.id)}>{block.label}</button>
38
+ {/each}
39
+ </div>
40
+
41
+ <style>
42
+ .uncial-toolbar {
43
+ display: flex;
44
+ flex-wrap: wrap;
45
+ gap: 0.5rem;
46
+ padding: 0.75rem;
47
+ border-bottom: 1px solid #ececec;
48
+ background: #f9f9f9;
49
+ }
50
+
51
+ .uncial-toolbar button,
52
+ .uncial-toolbar input {
53
+ font: inherit;
54
+ padding: 0.35rem 0.55rem;
55
+ border: 1px solid #cfcfcf;
56
+ border-radius: 8px;
57
+ background: #fff;
58
+ }
59
+
60
+ .uncial-toolbar button {
61
+ cursor: pointer;
62
+ }
63
+ </style>
@@ -0,0 +1,24 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ import type { BlockDefinition, BlockRegistry, ContentSchema } from '../core/types.js';
3
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
+ $$bindings?: Bindings;
6
+ } & Exports;
7
+ (internal: unknown, props: Props & {
8
+ $$events?: Events;
9
+ $$slots?: Slots;
10
+ }): Exports & {
11
+ $set?: any;
12
+ $on?: any;
13
+ };
14
+ z_$$bindings?: Bindings;
15
+ }
16
+ declare const BlockMenu: $$__sveltets_2_IsomorphicComponent<{
17
+ editor?: Editor | null;
18
+ blocks?: BlockRegistry | BlockDefinition[];
19
+ schema?: ContentSchema | undefined;
20
+ }, {
21
+ [evt: string]: CustomEvent<any>;
22
+ }, {}, {}, string>;
23
+ type BlockMenu = InstanceType<typeof BlockMenu>;
24
+ export default BlockMenu;
@@ -0,0 +1,88 @@
1
+ <script lang="ts">
2
+ import type { Component, Snippet } from 'svelte';
3
+ import DotsSixVerticalIcon from 'phosphor-svelte/lib/DotsSixVerticalIcon';
4
+
5
+ interface Props {
6
+ component: Component<Record<string, unknown>>;
7
+ attrs?: Record<string, unknown>;
8
+ content?: unknown[];
9
+ children?: Snippet;
10
+ blockId: string;
11
+ label: string;
12
+ draggable?: boolean;
13
+ onActivate?: () => void;
14
+ }
15
+
16
+ interface PointerStart {
17
+ x: number;
18
+ y: number;
19
+ pointerId: number;
20
+ }
21
+
22
+ let {
23
+ component: BlockComponent,
24
+ attrs = {},
25
+ content = [],
26
+ children,
27
+ blockId,
28
+ label,
29
+ draggable = true,
30
+ onActivate
31
+ }: Props = $props();
32
+
33
+ let pointerStart: PointerStart | null = null;
34
+
35
+ const componentProps = $derived({
36
+ ...attrs,
37
+ content,
38
+ children
39
+ });
40
+
41
+ function handleActivationPointerDown(event: PointerEvent): void {
42
+ event.stopPropagation();
43
+ pointerStart = { x: event.clientX, y: event.clientY, pointerId: event.pointerId };
44
+ }
45
+
46
+ function handleActivationPointerUp(event: PointerEvent): void {
47
+ event.stopPropagation();
48
+ if (!pointerStart || pointerStart.pointerId !== event.pointerId) return;
49
+ const distance = Math.hypot(event.clientX - pointerStart.x, event.clientY - pointerStart.y);
50
+ pointerStart = null;
51
+ if (distance <= 4) {
52
+ onActivate?.();
53
+ }
54
+ }
55
+
56
+ function stopActivationClick(event: MouseEvent): void {
57
+ event.stopPropagation();
58
+ }
59
+ </script>
60
+
61
+ <div class="uncial-nodeview-frame" contenteditable={children ? undefined : 'false'}>
62
+ <div class="uncial-nodeview-gutter" contenteditable="false">
63
+ {#if draggable}
64
+ <button
65
+ type="button"
66
+ class="uncial-gutter-drag"
67
+ data-drag-handle
68
+ draggable="true"
69
+ style="cursor: grab;"
70
+ aria-label={`Drag ${label || blockId} block`}
71
+ onpointerdown={handleActivationPointerDown}
72
+ onpointerup={handleActivationPointerUp}
73
+ onclick={stopActivationClick}
74
+ >
75
+ <DotsSixVerticalIcon size={14} weight="bold" aria-hidden="true" />
76
+ </button>
77
+ {/if}
78
+ <button
79
+ type="button"
80
+ class="uncial-gutter-label"
81
+ onpointerdown={handleActivationPointerDown}
82
+ onpointerup={handleActivationPointerUp}
83
+ onclick={stopActivationClick}>{label}</button
84
+ >
85
+ </div><div class="uncial-nodeview-body">
86
+ <BlockComponent {...componentProps} />
87
+ </div>
88
+ </div>
@@ -0,0 +1,14 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ interface Props {
3
+ component: Component<Record<string, unknown>>;
4
+ attrs?: Record<string, unknown>;
5
+ content?: unknown[];
6
+ children?: Snippet;
7
+ blockId: string;
8
+ label: string;
9
+ draggable?: boolean;
10
+ onActivate?: () => void;
11
+ }
12
+ declare const BlockNodeView: Component<Props, {}, "">;
13
+ type BlockNodeView = ReturnType<typeof BlockNodeView>;
14
+ export default BlockNodeView;
@@ -0,0 +1,453 @@
1
+ <script lang="ts">
2
+ import type { AnyExtension, Editor as TiptapEditor, JSONContent } from '@tiptap/core';
3
+ import PlusIcon from 'phosphor-svelte/lib/PlusIcon';
4
+ import CaretDownIcon from 'phosphor-svelte/lib/CaretDownIcon';
5
+ import { resolveRegistry } from '../core/registry.js';
6
+ import type {
7
+ BlockDefinition,
8
+ BlockRegistry,
9
+ ContentSchema,
10
+ ValidationIssue
11
+ } from '../core/types.js';
12
+ import { emptyDocument } from '../shared/content.js';
13
+ import {
14
+ createBlockAttributesController,
15
+ type BlockAttributesController,
16
+ type BlockAttributesState
17
+ } from './attributesController.js';
18
+ import { bindEditor, type BindEditorOptions } from './bindEditor.js';
19
+ import Toolbar from './Toolbar.svelte';
20
+ import type { ToolbarFeature, ToolbarFeatureSelection } from './toolbarFeatures.js';
21
+
22
+ interface Props {
23
+ blocks?: BlockRegistry | BlockDefinition[];
24
+ schema?: ContentSchema;
25
+ json?: JSONContent;
26
+ extensions?: AnyExtension[];
27
+ toolbarFeatures?: ToolbarFeatureSelection;
28
+ toolbarExtensions?: ToolbarFeature[];
29
+ attributesController?: BlockAttributesController | null;
30
+ onIssue?: (issue: ValidationIssue) => void;
31
+ }
32
+
33
+ let {
34
+ blocks = [],
35
+ schema = undefined,
36
+ json = $bindable(emptyDocument()),
37
+ extensions = [],
38
+ toolbarFeatures = undefined,
39
+ toolbarExtensions = [],
40
+ attributesController = null,
41
+ onIssue
42
+ }: Props = $props();
43
+
44
+ let editorHost: HTMLDivElement;
45
+ let editor = $state<TiptapEditor | null>(null);
46
+ let interactedNodeView = $state<HTMLElement | null>(null);
47
+ let controllerState = $state<BlockAttributesState>({
48
+ open: false,
49
+ mode: null,
50
+ selectedBlockId: '',
51
+ draftAttrs: {},
52
+ validationErrors: {},
53
+ activeBlock: null,
54
+ allowedBlockIds: [],
55
+ containerChildren: [],
56
+ link: {
57
+ open: false,
58
+ attrs: {}
59
+ }
60
+ });
61
+ let attrsTriggerEl = $state<HTMLElement | null>(null);
62
+ const internalController = createBlockAttributesController();
63
+
64
+ const registry = $derived(resolveRegistry(blocks));
65
+ const controller = $derived(attributesController ?? internalController);
66
+ const editorBinding = $derived<BindEditorOptions>({
67
+ blocks,
68
+ schema,
69
+ json,
70
+ extensions,
71
+ attributesController: controller,
72
+ onIssue,
73
+ onChange: (nextDocument) => {
74
+ json = nextDocument;
75
+ },
76
+ onEditor: (nextEditor) => {
77
+ editor = nextEditor;
78
+ }
79
+ });
80
+ const activeBlocks = $derived.by(() =>
81
+ registry.blocks.filter((block) =>
82
+ controllerState.allowedBlockIds.length
83
+ ? controllerState.allowedBlockIds.includes(block.id)
84
+ : !schema || schema.allowedBlocks.has(block.id)
85
+ )
86
+ );
87
+ function insertBlock(blockId: string): void {
88
+ const ok = controller.insertBlock(blockId);
89
+ // Close the dropdown after an insert attempt.
90
+ attrsTriggerEl?.closest('details')?.removeAttribute('open');
91
+ if (!ok) return;
92
+
93
+ requestAnimationFrame(() => {
94
+ controller.syncFromSelection();
95
+ if (controller.getActiveBlock()?.id === blockId) {
96
+ controller.openAttributes(blockId);
97
+ }
98
+ });
99
+ }
100
+
101
+ function syncActiveBlockIndicator(): void {
102
+ if (!editorHost) return;
103
+
104
+ const activeNodes = editorHost.querySelectorAll<HTMLElement>(
105
+ '.uncial-nodeview.uncial-active-block'
106
+ );
107
+ activeNodes.forEach((node) => {
108
+ node.classList.remove('uncial-active-block');
109
+ });
110
+
111
+ const activePos = controllerState.activeBlock?.pos;
112
+ if (activePos === undefined) {
113
+ const domActiveNode = interactedNodeView ?? resolveSelectionNodeView();
114
+ domActiveNode?.classList.add('uncial-active-block');
115
+ return;
116
+ }
117
+
118
+ const activeNode = editorHost.querySelector<HTMLElement>(
119
+ `.uncial-nodeview[data-uncial-block-pos="${activePos}"]`
120
+ );
121
+ if (activeNode) {
122
+ activeNode.classList.add('uncial-active-block');
123
+ return;
124
+ }
125
+
126
+ const domActiveNode = interactedNodeView ?? resolveSelectionNodeView();
127
+ domActiveNode?.classList.add('uncial-active-block');
128
+ }
129
+
130
+ function resolveSelectionNodeView(): HTMLElement | null {
131
+ const selection = window.getSelection();
132
+ const anchorNode = selection?.anchorNode;
133
+ if (!anchorNode) return null;
134
+
135
+ const target =
136
+ anchorNode instanceof Element
137
+ ? anchorNode
138
+ : (anchorNode.parentElement ?? anchorNode.parentNode);
139
+ if (!(target instanceof Element)) return null;
140
+
141
+ return target.closest<HTMLElement>('.uncial-nodeview');
142
+ }
143
+
144
+ $effect(() => {
145
+ const unsubscribe = controller.subscribe((state) => {
146
+ controllerState = state;
147
+ });
148
+
149
+ return unsubscribe;
150
+ });
151
+
152
+ $effect(() => {
153
+ void controllerState.activeBlock;
154
+ requestAnimationFrame(() => {
155
+ syncActiveBlockIndicator();
156
+ });
157
+ });
158
+
159
+ $effect(() => {
160
+ if (!editorHost) return;
161
+
162
+ const syncFromDomSelection = () => {
163
+ requestAnimationFrame(() => {
164
+ syncActiveBlockIndicator();
165
+ });
166
+ };
167
+
168
+ const trackInteractedNodeView = (event: Event) => {
169
+ const target = event.target;
170
+ if (!(target instanceof Element)) return;
171
+ interactedNodeView = target.closest<HTMLElement>('.uncial-nodeview');
172
+ syncFromDomSelection();
173
+ };
174
+
175
+ editorHost.addEventListener('mousedown', trackInteractedNodeView, true);
176
+ editorHost.addEventListener('mouseup', syncFromDomSelection);
177
+ editorHost.addEventListener('keyup', syncFromDomSelection);
178
+ editorHost.addEventListener('focusin', trackInteractedNodeView, true);
179
+
180
+ return () => {
181
+ editorHost.removeEventListener('mousedown', trackInteractedNodeView, true);
182
+ editorHost.removeEventListener('mouseup', syncFromDomSelection);
183
+ editorHost.removeEventListener('keyup', syncFromDomSelection);
184
+ editorHost.removeEventListener('focusin', trackInteractedNodeView, true);
185
+ };
186
+ });
187
+ </script>
188
+
189
+ <div class="uncial-editor-shell min-w-0 rounded-box bg-base-100 shadow-sm">
190
+ <div
191
+ class="uncial-toolbar flex flex-wrap items-center gap-2 border-b border-base-300 bg-base-200/60 px-3 py-2"
192
+ >
193
+ <Toolbar
194
+ {editor}
195
+ {schema}
196
+ {toolbarFeatures}
197
+ {toolbarExtensions}
198
+ onEditLink={() => controller.openLinkAttributes()}
199
+ />
200
+ {#if activeBlocks.length > 0}
201
+ <div class="ml-auto flex items-center gap-2">
202
+ <details class="dropdown dropdown-end">
203
+ <summary
204
+ bind:this={attrsTriggerEl}
205
+ aria-label="Insert block"
206
+ class="btn btn-sm btn-primary gap-1.5"
207
+ >
208
+ <PlusIcon size={14} weight="bold" />
209
+ <span>Insert block</span>
210
+ <CaretDownIcon size={12} weight="bold" />
211
+ </summary>
212
+ <ul
213
+ class="menu dropdown-content z-20 mt-2 w-56 rounded-box border border-base-300 bg-base-100 p-2 shadow-xl"
214
+ >
215
+ {#each activeBlocks as block (block.id)}
216
+ <li>
217
+ <button type="button" onclick={() => insertBlock(block.id)}>
218
+ {block.label}
219
+ </button>
220
+ </li>
221
+ {/each}
222
+ </ul>
223
+ </details>
224
+ </div>
225
+ {/if}
226
+ </div>
227
+ <div class="uncial-editor-body min-w-0">
228
+ <div
229
+ class="uncial-content uncial-rich-content uncial-gutter-enabled min-h-112 min-w-0 p-5 leading-7 sm:p-8"
230
+ bind:this={editorHost}
231
+ use:bindEditor={editorBinding}
232
+ ></div>
233
+ </div>
234
+ </div>
235
+
236
+ <style>
237
+ .uncial-content:focus-visible {
238
+ outline: 2px solid var(--color-primary, #2563eb);
239
+ outline-offset: -2px;
240
+ }
241
+
242
+ .uncial-content :global(.ProseMirror:focus) {
243
+ outline: none;
244
+ box-shadow: none;
245
+ }
246
+
247
+ /* --- Gutter layout --- */
248
+ .uncial-editor-body {
249
+ position: relative;
250
+ }
251
+
252
+ .uncial-content.uncial-gutter-enabled {
253
+ padding-left: 5.5rem;
254
+ }
255
+
256
+ @media (max-width: 639px) {
257
+ .uncial-content.uncial-gutter-enabled {
258
+ padding-left: 3.5rem;
259
+ }
260
+
261
+ .uncial-content :global(.uncial-nodeview-gutter) {
262
+ left: -3rem;
263
+ width: 2.5rem;
264
+ }
265
+
266
+ .uncial-content :global(.uncial-gutter-label) {
267
+ font-size: 0.5rem;
268
+ max-width: 2.25rem;
269
+ }
270
+
271
+ .uncial-content
272
+ :global(.uncial-nodeview[data-uncial-block-id='row'] .uncial-row-items .uncial-nodeview) {
273
+ flex-basis: 100%;
274
+ }
275
+ }
276
+
277
+ @media (max-width: 419px) {
278
+ .uncial-content.uncial-gutter-enabled {
279
+ padding-left: 1rem;
280
+ }
281
+
282
+ .uncial-content :global(.uncial-nodeview-gutter) {
283
+ position: static;
284
+ width: auto;
285
+ margin-bottom: 0.35rem;
286
+ flex-direction: row;
287
+ align-items: center;
288
+ justify-content: flex-start;
289
+ }
290
+
291
+ .uncial-content :global(.uncial-gutter-label) {
292
+ max-width: none;
293
+ word-break: normal;
294
+ }
295
+ }
296
+
297
+ /* --- Block node views --- */
298
+ .uncial-content :global(.uncial-nodeview) {
299
+ position: relative;
300
+ border-radius: 12px;
301
+ transition:
302
+ box-shadow 140ms ease,
303
+ transform 140ms ease;
304
+ }
305
+
306
+ /* --- Gutter strip per block --- */
307
+ .uncial-content :global(.uncial-nodeview-frame),
308
+ .uncial-content :global(.uncial-nodeview-host) {
309
+ display: block;
310
+ line-height: normal;
311
+ }
312
+
313
+ .uncial-content :global(.uncial-nodeview-body) {
314
+ display: flow-root;
315
+ line-height: normal;
316
+ }
317
+
318
+ .uncial-content :global(.uncial-nodeview-gutter) {
319
+ position: absolute;
320
+ left: -4.75rem;
321
+ top: 0;
322
+ bottom: 0;
323
+ width: 4rem;
324
+ display: flex;
325
+ flex-direction: column;
326
+ align-items: center;
327
+ justify-content: center;
328
+ gap: 0.25rem;
329
+ user-select: none;
330
+ pointer-events: auto;
331
+ }
332
+
333
+ .uncial-content :global(.uncial-gutter-drag) {
334
+ display: flex;
335
+ align-items: center;
336
+ justify-content: center;
337
+ width: 1.5rem;
338
+ height: 1.5rem;
339
+ border-radius: 0.375rem;
340
+ border: none;
341
+ background: var(--color-base-200, #f0f0f0);
342
+ color: var(--color-base-content, #333);
343
+ opacity: 0.5;
344
+ transition:
345
+ opacity 140ms ease,
346
+ background 140ms ease;
347
+ padding: 0;
348
+ }
349
+
350
+ .uncial-content :global(.uncial-nodeview-gutter:hover .uncial-gutter-drag) {
351
+ opacity: 1;
352
+ background: var(--color-base-300, #e0e0e0);
353
+ }
354
+
355
+ .uncial-content :global(.uncial-gutter-drag:active) {
356
+ cursor: grabbing;
357
+ }
358
+
359
+ .uncial-content :global(.uncial-gutter-label) {
360
+ border: none;
361
+ background: transparent;
362
+ padding: 0;
363
+ border-radius: 0.25rem;
364
+ cursor: pointer;
365
+ font-size: 0.6rem;
366
+ font-weight: 700;
367
+ text-transform: uppercase;
368
+ letter-spacing: 0.06em;
369
+ color: var(--color-base-content, #333);
370
+ opacity: 0.4;
371
+ line-height: 1;
372
+ text-align: center;
373
+ word-break: break-word;
374
+ max-width: 3.5rem;
375
+ transition:
376
+ opacity 140ms ease,
377
+ background 140ms ease,
378
+ color 140ms ease;
379
+ }
380
+
381
+ .uncial-content :global(.uncial-nodeview-gutter:hover .uncial-gutter-label) {
382
+ opacity: 0.8;
383
+ }
384
+
385
+ .uncial-content :global(.uncial-gutter-label:hover),
386
+ .uncial-content :global(.uncial-gutter-label:focus-visible) {
387
+ background: color-mix(in srgb, var(--color-primary, #2563eb) 12%, transparent);
388
+ color: var(--color-primary, #2563eb);
389
+ opacity: 1;
390
+ }
391
+
392
+ /* --- Hover highlight: outline the block when gutter is hovered --- */
393
+ .uncial-content
394
+ :global(.uncial-nodeview:has(.uncial-nodeview-gutter:hover) > .uncial-nodeview-host .uncial-nodeview-body > *) {
395
+ outline: 2px dashed color-mix(in srgb, var(--color-primary, #2563eb) 35%, transparent);
396
+ outline-offset: 4px;
397
+ }
398
+
399
+ /* --- Row block editor layout --- */
400
+ .uncial-content
401
+ :global(
402
+ .uncial-nodeview[data-uncial-block-id='row'] .uncial-row-items .uncial-nodeview-content
403
+ ),
404
+ .uncial-content
405
+ :global(.uncial-nodeview[data-uncial-block-id='row'] .uncial-row-items .uncial-nodeview-host),
406
+ .uncial-content
407
+ :global(.uncial-nodeview[data-uncial-block-id='row'] .uncial-row-items .uncial-nodeview-frame),
408
+ .uncial-content
409
+ :global(.uncial-nodeview[data-uncial-block-id='row'] .uncial-row-items .uncial-nodeview-body) {
410
+ display: contents;
411
+ }
412
+
413
+ .uncial-content
414
+ :global(.uncial-nodeview[data-uncial-block-id='row'] .uncial-row-items .uncial-nodeview) {
415
+ flex: 1 1 16rem;
416
+ min-width: 0;
417
+ }
418
+
419
+ /* --- Nested block gutter: label visible on hover, no drag handle --- */
420
+ .uncial-content :global(.uncial-nodeview .uncial-nodeview .uncial-nodeview-gutter) {
421
+ left: 0;
422
+ top: -0.125rem;
423
+ bottom: auto;
424
+ width: auto;
425
+ flex-direction: row;
426
+ padding: 0.125rem 0.375rem;
427
+ border-right: none;
428
+ opacity: 0;
429
+ z-index: 10;
430
+ transition: opacity 140ms ease;
431
+ background: var(--color-base-200, #f0f0f0);
432
+ border-radius: 0.25rem 0.25rem 0 0;
433
+ }
434
+
435
+ .uncial-content :global(.uncial-nodeview .uncial-nodeview:hover .uncial-nodeview-gutter) {
436
+ opacity: 1;
437
+ }
438
+
439
+ /* Hide drag handle in nested blocks — reordering via sidebar */
440
+ .uncial-content :global(.uncial-nodeview .uncial-nodeview .uncial-gutter-drag) {
441
+ display: none;
442
+ }
443
+
444
+ /* --- Selected / active block --- */
445
+ .uncial-content
446
+ :global(.uncial-nodeview.ProseMirror-selectednode > .uncial-nodeview-host .uncial-nodeview-body > *),
447
+ .uncial-content
448
+ :global(.uncial-nodeview.uncial-active-block > .uncial-nodeview-host .uncial-nodeview-body > *) {
449
+ outline: 2px solid color-mix(in srgb, var(--color-primary, #2563eb) 55%, transparent);
450
+ outline-offset: 4px;
451
+ box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-primary, #2563eb) 10%, transparent);
452
+ }
453
+ </style>
@@ -0,0 +1,17 @@
1
+ import type { AnyExtension, JSONContent } from '@tiptap/core';
2
+ import type { BlockDefinition, BlockRegistry, ContentSchema, ValidationIssue } from '../core/types.js';
3
+ import { type BlockAttributesController } from './attributesController.js';
4
+ import type { ToolbarFeature, ToolbarFeatureSelection } from './toolbarFeatures.js';
5
+ interface Props {
6
+ blocks?: BlockRegistry | BlockDefinition[];
7
+ schema?: ContentSchema;
8
+ json?: JSONContent;
9
+ extensions?: AnyExtension[];
10
+ toolbarFeatures?: ToolbarFeatureSelection;
11
+ toolbarExtensions?: ToolbarFeature[];
12
+ attributesController?: BlockAttributesController | null;
13
+ onIssue?: (issue: ValidationIssue) => void;
14
+ }
15
+ declare const Editor: import("svelte").Component<Props, {}, "json">;
16
+ type Editor = ReturnType<typeof Editor>;
17
+ export default Editor;