@ibodr/editor 0.2.6 → 0.2.9
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/dist/index.d.ts +923 -463
- package/dist/index.mjs +3547 -2468
- package/dist/index.mjs.map +1 -1
- package/editor.css +88 -9
- package/package.json +7 -7
package/editor.css
CHANGED
|
@@ -29,15 +29,20 @@
|
|
|
29
29
|
* background, grid, shapes, overlays, and blocker are all children of .dr-canvas,
|
|
30
30
|
* so their z-indices are relative to the canvas, not the container.
|
|
31
31
|
*
|
|
32
|
-
* watermark and canvas-in-front are siblings of .dr-canvas
|
|
33
|
-
* so they compete with the UI layer (.tlui-layout at z-index 300).
|
|
32
|
+
* collaborators, watermark, and canvas-in-front are siblings of .dr-canvas
|
|
33
|
+
* (outside it), so they compete with the UI layer (.tlui-layout at z-index 300).
|
|
34
34
|
* canvas-in-front must be below the UI layer (300) to sit between
|
|
35
|
-
* the canvas and the UI
|
|
35
|
+
* the canvas and the UI; collaborator cursors sit above canvas content
|
|
36
|
+
* (and layers that anchor to it, like comment pins) but below the
|
|
37
|
+
* in-front content and the UI panels. The watermark (a licensing element)
|
|
38
|
+
* sits above that content so it can't be occluded, but still below the
|
|
39
|
+
* in-front content and the UI.
|
|
36
40
|
*/
|
|
37
41
|
--dr-layer-canvas-hidden: -999999;
|
|
38
42
|
--dr-layer-canvas-background: 100;
|
|
39
43
|
--dr-layer-canvas-grid: 150;
|
|
40
|
-
--dr-layer-
|
|
44
|
+
--dr-layer-collaborators: 245;
|
|
45
|
+
--dr-layer-watermark: 248;
|
|
41
46
|
--dr-layer-canvas-in-front: 250;
|
|
42
47
|
--dr-layer-canvas-shapes: 300;
|
|
43
48
|
--dr-layer-canvas-overlays: 500;
|
|
@@ -74,9 +79,10 @@
|
|
|
74
79
|
|
|
75
80
|
/* Cursor SVGs */
|
|
76
81
|
--dr-cursor-none: none;
|
|
82
|
+
/* Hotspot sits between the white outline tip and the black tip: on either tip alone, hit-testing feels offset from one direction (#10855) */
|
|
77
83
|
--dr-cursor-default:
|
|
78
84
|
url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' style='color: black;'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='1' dy='1' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g fill='none' transform='rotate(0 16 16)' filter='url(%23shadow)'><path d='m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z' fill='white'/><path d='m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z' fill='white'/><path d='m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z' fill='black'/><path d='m13 10.814v11.188l2.969-2.866.428-.139h4.768z' fill='black'/></g></svg>")
|
|
79
|
-
12
|
|
85
|
+
12 10,
|
|
80
86
|
default;
|
|
81
87
|
--dr-cursor-pointer:
|
|
82
88
|
url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' style='color: black;'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='1' dy='1' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g fill='none' transform='rotate(0 16 16)' filter='url(%23shadow)'><path d='m13.3315 21.3799c-.284-.359-.629-1.093-1.243-1.984-.348-.504-1.211-1.453-1.468-1.935-.223-.426-.199-.617-.146-.97.094-.628.738-1.117 1.425-1.051.519.049.959.392 1.355.716.239.195.533.574.71.788.163.196.203.277.377.509.23.307.302.459.214.121-.071-.496-.187-1.343-.355-2.092-.128-.568-.159-.657-.281-1.093-.129-.464-.195-.789-.316-1.281-.084-.348-.235-1.059-.276-1.459-.057-.547-.087-1.439.264-1.849.275-.321.906-.418 1.297-.22.512.259.803 1.003.936 1.3.239.534.387 1.151.516 1.961.164 1.031.466 2.462.476 2.763.024-.369-.068-1.146-.004-1.5.058-.321.328-.694.666-.795.286-.085.621-.116.916-.055.313.064.643.288.766.499.362.624.369 1.899.384 1.831.086-.376.071-1.229.284-1.584.14-.234.497-.445.687-.479.294-.052.655-.068.964-.008.249.049.586.345.677.487.218.344.342 1.317.379 1.658.015.141.074-.392.293-.736.406-.639 1.843-.763 1.898.639.025.654.02.624.02 1.064 0 .517-.012.828-.04 1.202-.031.4-.117 1.304-.242 1.742-.086.301-.371.978-.652 1.384 0 0-1.074 1.25-1.191 1.813-.118.562-.079.566-.102.965-.023.398.121.922.121.922s-.802.104-1.234.035c-.391-.063-.875-.841-1-1.079-.172-.328-.539-.265-.682-.023-.225.383-.709 1.07-1.051 1.113-.668.084-2.054.031-3.139.02 0 0 .185-1.011-.227-1.358-.305-.259-.83-.784-1.144-1.06z' fill='white'/><g stroke='black' stroke-linecap='round' stroke-width='.75'><path d='m13.3315 21.3799c-.284-.359-.629-1.093-1.243-1.984-.348-.504-1.211-1.453-1.468-1.935-.223-.426-.199-.617-.146-.97.094-.628.738-1.117 1.425-1.051.519.049.959.392 1.355.716.239.195.533.574.71.788.163.196.203.277.377.509.23.307.302.459.214.121-.071-.496-.187-1.343-.355-2.092-.128-.568-.159-.657-.281-1.093-.129-.464-.195-.789-.316-1.281-.084-.348-.235-1.059-.276-1.459-.057-.547-.087-1.439.264-1.849.275-.321.906-.418 1.297-.22.512.259.803 1.003.936 1.3.239.534.387 1.151.516 1.961.164 1.031.466 2.462.476 2.763.024-.369-.068-1.146-.004-1.5.058-.321.328-.694.666-.795.286-.085.621-.116.916-.055.313.064.643.288.766.499.362.624.369 1.899.384 1.831.086-.376.071-1.229.284-1.584.14-.234.497-.445.687-.479.294-.052.655-.068.964-.008.249.049.586.345.677.487.218.344.342 1.317.379 1.658.015.141.074-.392.293-.736.406-.639 1.843-.763 1.898.639.025.654.02.624.02 1.064 0 .517-.012.828-.04 1.202-.031.4-.117 1.304-.242 1.742-.086.301-.371.978-.652 1.384 0 0-1.074 1.25-1.191 1.813-.118.562-.079.566-.102.965-.023.398.121.922.121.922s-.802.104-1.234.035c-.391-.063-.875-.841-1-1.079-.172-.328-.539-.265-.682-.023-.225.383-.709 1.07-1.051 1.113-.668.084-2.054.031-3.139.02 0 0 .185-1.011-.227-1.358-.305-.259-.83-.784-1.144-1.06z' stroke-linejoin='round'/><path d='m21.5664 21.7344v-3.459'/><path d='m19.5508 21.7461-.016-3.473'/><path d='m17.5547 18.3047.021 3.426'/></g></g></svg>")
|
|
@@ -86,6 +92,10 @@
|
|
|
86
92
|
url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' style='color: black;'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='1' dy='1' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g fill='none' transform='rotate(0 16 16)' filter='url(%23shadow)'><path d='m25 16h-6.01v-6h-2.98v6h-6.01v3h6.01v6h2.98v-6h6.01z' fill='white'/><path d='m23.9902 17.0103h-6v-6.01h-.98v6.01h-6v.98h6v6.01h.98v-6.01h6z' fill='%23231f1f'/></g></svg>")
|
|
87
93
|
16 16,
|
|
88
94
|
crosshair;
|
|
95
|
+
--dr-cursor-comment:
|
|
96
|
+
url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='1' dy='1' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g filter='url(%23shadow)'><path d='M5 19.5 L5 11 A8 8 0 0 1 13 3 A8 8 0 0 1 21 11 A8 8 0 0 1 13 19 Z' fill='white' stroke='black' stroke-width='1' stroke-linejoin='round'/></g></svg>")
|
|
97
|
+
5 19,
|
|
98
|
+
crosshair;
|
|
89
99
|
--dr-cursor-move:
|
|
90
100
|
url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' style='color: black;'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='1' dy='1' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g fill='none' transform='rotate(0 16 16)' filter='url(%23shadow)'><path d='m19 14h1v1h-1zm1 6h-1v-1h1zm-5-5h-1v-1h1zm0 5h-1v-1h1zm2-10.987-7.985 7.988 5.222 5.221 2.763 2.763 7.984-7.985z' fill='white'/><g fill='black'><path d='m23.5664 16.9971-2.557-2.809v1.829h-4.009-4.001v-1.829l-2.571 2.809 2.572 2.808-.001-1.808h4.001 4.009l-.001 1.808z'/><path d='m17.9873 17h.013v-4.001l1.807.001-2.807-2.571-2.809 2.57h1.809v4.001h.008v4.002l-1.828-.001 2.807 2.577 2.805-2.576h-1.805z'/></g></g></svg>")
|
|
91
101
|
16 16,
|
|
@@ -187,6 +197,7 @@
|
|
|
187
197
|
--dr-color-text-0: hsl(0, 0%, 11%);
|
|
188
198
|
--dr-color-text-1: hsl(0, 0%, 18%);
|
|
189
199
|
--dr-color-text-3: hsl(204, 4%, 45%);
|
|
200
|
+
--dr-color-text-disabled: hsl(204, 4%, 55%);
|
|
190
201
|
--dr-color-text-shadow: hsl(0, 0%, 100%);
|
|
191
202
|
--dr-color-text-highlight: hsl(52, 100%, 50%);
|
|
192
203
|
--dr-color-text-highlight-p3: color(display-p3 0.972 0.8205 0.05);
|
|
@@ -247,6 +258,7 @@
|
|
|
247
258
|
--dr-color-text-0: hsl(0, 9%, 94%);
|
|
248
259
|
--dr-color-text-1: hsl(0, 0%, 85%);
|
|
249
260
|
--dr-color-text-3: hsl(204, 4%, 75%);
|
|
261
|
+
--dr-color-text-disabled: hsl(204, 4%, 50%);
|
|
250
262
|
--dr-color-text-shadow: hsl(210, 13%, 18%);
|
|
251
263
|
--dr-color-text-highlight: hsl(52, 100%, 41%);
|
|
252
264
|
--dr-color-text-highlight-p3: color(display-p3 0.8078 0.6225 0.0312);
|
|
@@ -295,6 +307,12 @@
|
|
|
295
307
|
outline: 1px solid var(--dr-color-low);
|
|
296
308
|
}
|
|
297
309
|
|
|
310
|
+
/* The host for <EditorPortal>, last among the container's children. It's a position in the DOM
|
|
311
|
+
rather than a box: `display: contents` keeps what it holds positioned against the container. */
|
|
312
|
+
.dr-portal-host {
|
|
313
|
+
display: contents;
|
|
314
|
+
}
|
|
315
|
+
|
|
298
316
|
input,
|
|
299
317
|
*[contenteditable],
|
|
300
318
|
*[contenteditable] * {
|
|
@@ -328,6 +346,15 @@ input,
|
|
|
328
346
|
z-index: var(--dr-layer-canvas-shapes);
|
|
329
347
|
}
|
|
330
348
|
|
|
349
|
+
.dr-lod-canvas {
|
|
350
|
+
position: absolute;
|
|
351
|
+
inset: 0;
|
|
352
|
+
width: 100%;
|
|
353
|
+
height: 100%;
|
|
354
|
+
pointer-events: none;
|
|
355
|
+
z-index: var(--dr-layer-canvas-shapes);
|
|
356
|
+
}
|
|
357
|
+
|
|
331
358
|
.dr-svg-context {
|
|
332
359
|
position: absolute;
|
|
333
360
|
top: 0px;
|
|
@@ -410,6 +437,30 @@ input,
|
|
|
410
437
|
z-index: var(--dr-layer-canvas-shapes);
|
|
411
438
|
}
|
|
412
439
|
|
|
440
|
+
/* The collaborator cursor layer: a sibling of .dr-canvas, above all canvas content, below the
|
|
441
|
+
in-front layer (250) and the UI panels (300). Display-only — pointer events pass through. */
|
|
442
|
+
.dr-collaborators {
|
|
443
|
+
position: absolute;
|
|
444
|
+
inset: 0px;
|
|
445
|
+
z-index: var(--dr-layer-collaborators);
|
|
446
|
+
pointer-events: none;
|
|
447
|
+
overflow: clip;
|
|
448
|
+
contain: layout style size;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.dr-collaborators__item {
|
|
452
|
+
position: absolute;
|
|
453
|
+
top: 0px;
|
|
454
|
+
left: 0px;
|
|
455
|
+
overflow: visible;
|
|
456
|
+
pointer-events: none;
|
|
457
|
+
transform-origin: top left;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.dr-cursor {
|
|
461
|
+
overflow: visible;
|
|
462
|
+
}
|
|
463
|
+
|
|
413
464
|
/* --------------- Overlay Stack --------------- */
|
|
414
465
|
|
|
415
466
|
/* -------------- Selection foreground -------------- */
|
|
@@ -649,7 +700,15 @@ input,
|
|
|
649
700
|
overflow: hidden;
|
|
650
701
|
}
|
|
651
702
|
|
|
652
|
-
|
|
703
|
+
/**
|
|
704
|
+
* Only when there's actually a highlight to style. ProseMirror hides the native selection whenever
|
|
705
|
+
* it holds a NodeSelection — triple-clicking a list's bullet selects the whole list, for one — by
|
|
706
|
+
* zeroing the ::selection background and nothing else. Painting the selected-contrast color with
|
|
707
|
+
* no highlight behind it leaves the text invisible against the shape, and `inherit` can't undo it:
|
|
708
|
+
* highlight pseudo-elements inherit from the ancestor's ::selection, so it just picks the same
|
|
709
|
+
* color back up.
|
|
710
|
+
*/
|
|
711
|
+
.dr-text-input:not(:has(.ProseMirror-hideselection))::selection {
|
|
653
712
|
background: var(--dr-color-selected);
|
|
654
713
|
color: var(--dr-color-selected-contrast);
|
|
655
714
|
text-shadow: none;
|
|
@@ -802,17 +861,17 @@ input,
|
|
|
802
861
|
.dr-rich-text ol {
|
|
803
862
|
text-align: left;
|
|
804
863
|
margin: 0;
|
|
805
|
-
padding-left:
|
|
864
|
+
padding-left: 1.625ch;
|
|
806
865
|
/* Some resets, like Tailwind, nix the list styling. */
|
|
807
866
|
list-style: revert;
|
|
808
867
|
}
|
|
809
868
|
|
|
810
869
|
.dr-rich-text ol:has(> li:nth-child(10)) {
|
|
811
|
-
padding-left:
|
|
870
|
+
padding-left: 2.625ch;
|
|
812
871
|
}
|
|
813
872
|
|
|
814
873
|
.dr-rich-text ol:has(> li:nth-child(100)) {
|
|
815
|
-
padding-left:
|
|
874
|
+
padding-left: 3.625ch;
|
|
816
875
|
}
|
|
817
876
|
|
|
818
877
|
.dr-rich-text h1,
|
|
@@ -823,6 +882,16 @@ input,
|
|
|
823
882
|
.dr-rich-text h6 {
|
|
824
883
|
margin-top: 5px;
|
|
825
884
|
margin-bottom: 10px;
|
|
885
|
+
/**
|
|
886
|
+
* Headings render at a larger font-size than the body text (via the browser's
|
|
887
|
+
* default h1–h6 sizing), so they can't inherit the container's resolved
|
|
888
|
+
* whole-pixel line-height — that value is derived from the base font size and
|
|
889
|
+
* would cram the taller lines together. Instead, scale line-height with each
|
|
890
|
+
* heading's own font-size using tldraw's unitless line-height multiplier, which
|
|
891
|
+
* the rich-text render/measure paths expose here. The 1.35 fallback mirrors the
|
|
892
|
+
* default theme line-height (see defaultThemes.ts).
|
|
893
|
+
*/
|
|
894
|
+
line-height: var(--dr-rich-text-heading-line-height, 1.35);
|
|
826
895
|
}
|
|
827
896
|
|
|
828
897
|
.dr-rich-text a {
|
|
@@ -851,6 +920,7 @@ input,
|
|
|
851
920
|
.dr-theme__dark .dr-rich-text mark {
|
|
852
921
|
background-color: var(--dr-color-text-highlight);
|
|
853
922
|
color: currentColor;
|
|
923
|
+
text-shadow: none;
|
|
854
924
|
}
|
|
855
925
|
|
|
856
926
|
@supports (color: color(display-p3 1 1 1)) {
|
|
@@ -1023,6 +1093,15 @@ input,
|
|
|
1023
1093
|
color: var(--dr-color-text-1);
|
|
1024
1094
|
}
|
|
1025
1095
|
|
|
1096
|
+
.dr-content-slot {
|
|
1097
|
+
position: absolute;
|
|
1098
|
+
inset: 0px;
|
|
1099
|
+
height: 100%;
|
|
1100
|
+
width: 100%;
|
|
1101
|
+
pointer-events: none;
|
|
1102
|
+
transform-origin: top left;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1026
1105
|
/* -------------------- Group shape ------------------ */
|
|
1027
1106
|
|
|
1028
1107
|
.dr-group {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibodr/editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"eventemitter3": "^4.0.7",
|
|
30
30
|
"idb": "^7.1.1",
|
|
31
31
|
"rbush": "^3.0.1",
|
|
32
|
-
"@ibodr/state": "0.2.
|
|
33
|
-
"@ibodr/schema": "0.2.
|
|
34
|
-
"@ibodr/
|
|
35
|
-
"@ibodr/
|
|
36
|
-
"@ibodr/
|
|
37
|
-
"@ibodr/
|
|
32
|
+
"@ibodr/state-react": "0.2.9",
|
|
33
|
+
"@ibodr/schema": "0.2.9",
|
|
34
|
+
"@ibodr/state": "0.2.9",
|
|
35
|
+
"@ibodr/utils": "0.2.9",
|
|
36
|
+
"@ibodr/store": "0.2.9",
|
|
37
|
+
"@ibodr/validate": "0.2.9"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.2.0 || ^19.2.1",
|