@tldraw/editor 5.7.0-next.0ef3ff64787a → 5.7.0-next.147eae59044f
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-cjs/index.d.ts +5 -8
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +91 -29
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +8 -2
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js +3 -1
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ThemeManager/drawFontCheckbox.js +35 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/drawFontCheckbox.js.map +7 -0
- package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
- package/dist-cjs/lib/license/LicenseManager.js +2 -2
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +5 -8
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +91 -29
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +8 -2
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs +3 -1
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ThemeManager/drawFontCheckbox.mjs +15 -0
- package/dist-esm/lib/editor/managers/ThemeManager/drawFontCheckbox.mjs.map +7 -0
- package/dist-esm/lib/license/LicenseManager.mjs +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +266 -58
- package/package.json +7 -7
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +84 -38
- package/src/lib/editor/Editor.ts +6 -2
- package/src/lib/editor/managers/ThemeManager/defaultThemes.ts +2 -0
- package/src/lib/editor/managers/ThemeManager/drawFontCheckbox.ts +18 -0
- package/src/lib/editor/types/emit-types.ts +1 -0
- package/src/lib/license/LicenseManager.test.ts +19 -18
- package/src/lib/license/LicenseManager.ts +5 -5
- package/src/version.ts +3 -3
package/editor.css
CHANGED
|
@@ -141,6 +141,9 @@
|
|
|
141
141
|
--tl-font-sans: 'tldraw_sans', sans-serif;
|
|
142
142
|
--tl-font-serif: 'tldraw_serif', serif;
|
|
143
143
|
--tl-font-mono: 'tldraw_mono', monospace;
|
|
144
|
+
/* checkboxes, for fonts whose theme entry doesn't draw its own */
|
|
145
|
+
--tl-checkbox-box: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect x='6.2' y='27.2' width='66' height='66' rx='14.4' fill='none' stroke='%23000' stroke-width='8.3'/%3E%3C/svg%3E");
|
|
146
|
+
--tl-checkbox-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M24.13 62.63L33.11 73.14L56.02 46.3' fill='none' stroke='%23000' stroke-width='8.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
144
147
|
/* text outline */
|
|
145
148
|
--tl-text-outline-a: calc(min(0.5, 1 / var(--tl-zoom)) * 2px);
|
|
146
149
|
--tl-text-outline-b: calc(min(0.5, 1 / var(--tl-zoom)) * -2px);
|
|
@@ -270,6 +273,33 @@
|
|
|
270
273
|
inset 0px 0px 0px 1px var(--tl-color-panel-contrast);
|
|
271
274
|
}
|
|
272
275
|
|
|
276
|
+
/* The wash an open menu trigger shows: clear at one edge, muted-2 at the other, named for the
|
|
277
|
+
direction it fades in. Declared on the theme element, after both themes' colours, so each stop
|
|
278
|
+
resolves to the current theme's value. */
|
|
279
|
+
.tl-theme__light,
|
|
280
|
+
.tl-theme__dark {
|
|
281
|
+
--tl-muted-gradient-to-bottom: linear-gradient(
|
|
282
|
+
180deg,
|
|
283
|
+
var(--tl-color-muted-none) 0%,
|
|
284
|
+
var(--tl-color-muted-2) 100%
|
|
285
|
+
);
|
|
286
|
+
--tl-muted-gradient-to-top: linear-gradient(
|
|
287
|
+
0deg,
|
|
288
|
+
var(--tl-color-muted-none) 0%,
|
|
289
|
+
var(--tl-color-muted-2) 100%
|
|
290
|
+
);
|
|
291
|
+
--tl-muted-gradient-to-right: linear-gradient(
|
|
292
|
+
90deg,
|
|
293
|
+
var(--tl-color-muted-none) 0%,
|
|
294
|
+
var(--tl-color-muted-2) 100%
|
|
295
|
+
);
|
|
296
|
+
--tl-muted-gradient-to-left: linear-gradient(
|
|
297
|
+
270deg,
|
|
298
|
+
var(--tl-color-muted-none) 0%,
|
|
299
|
+
var(--tl-color-muted-2) 100%
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
273
303
|
.tl-counter-scaled {
|
|
274
304
|
transform: scale(var(--tl-scale));
|
|
275
305
|
transform-origin: top left;
|
|
@@ -825,6 +855,130 @@ input,
|
|
|
825
855
|
padding-left: 3.625ch;
|
|
826
856
|
}
|
|
827
857
|
|
|
858
|
+
/**
|
|
859
|
+
* Task lists. TipTap's TaskItem renders each item as
|
|
860
|
+
* `<li><label><input type="checkbox"><span></span></label><div>…</div></li>`.
|
|
861
|
+
*
|
|
862
|
+
* The `<input>` is the hit target only — it's laid over the label at zero opacity, and the visible
|
|
863
|
+
* box is the `<span>` beside it. Form controls aren't rendered when an SVG is loaded as an image,
|
|
864
|
+
* so an exported PNG would otherwise come back with the checkboxes missing. Everything is sized in
|
|
865
|
+
* `em` and drawn in `currentColor` so a checkbox tracks the font size and color of the shape it
|
|
866
|
+
* lives in.
|
|
867
|
+
*/
|
|
868
|
+
.tl-rich-text ul[data-type='taskList'] {
|
|
869
|
+
padding-left: 0;
|
|
870
|
+
list-style: none;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
.tl-rich-text ul[data-type='taskList'] > li {
|
|
874
|
+
display: flex;
|
|
875
|
+
align-items: flex-start;
|
|
876
|
+
gap: 0.6ch;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.tl-rich-text ul[data-type='taskList'] > li > label {
|
|
880
|
+
/* Center the box on the first line of the item rather than on the whole item. */
|
|
881
|
+
display: flex;
|
|
882
|
+
align-items: center;
|
|
883
|
+
height: 1lh;
|
|
884
|
+
position: relative;
|
|
885
|
+
flex: 0 0 auto;
|
|
886
|
+
user-select: none;
|
|
887
|
+
/**
|
|
888
|
+
* Outside of edit mode the rich text is static HTML with no ProseMirror node view behind it, so
|
|
889
|
+
* a checkbox click would toggle the input without ever reaching the shape and then snap back on
|
|
890
|
+
* the next render. Only the editing copy takes clicks; elsewhere RichTextLabel hit-tests the
|
|
891
|
+
* label's rect itself and writes the toggle to the shape.
|
|
892
|
+
*/
|
|
893
|
+
pointer-events: none;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
.tl-rich-text .ProseMirror ul[data-type='taskList'] > li > label {
|
|
897
|
+
pointer-events: auto;
|
|
898
|
+
/* On the label, not the input: the span paints over the input, so it's what the pointer hits. */
|
|
899
|
+
cursor: pointer;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
.tl-rich-text ul[data-type='taskList'] > li > label > input[type='checkbox'] {
|
|
903
|
+
position: absolute;
|
|
904
|
+
inset: 0;
|
|
905
|
+
margin: 0;
|
|
906
|
+
opacity: 0;
|
|
907
|
+
/* The UA sheet gives form controls their own cursor, and this one is the pointer's target. */
|
|
908
|
+
cursor: inherit;
|
|
909
|
+
/**
|
|
910
|
+
* Above the span, so the pointer lands on the input rather than on the box drawn over it.
|
|
911
|
+
* TaskItem's node view cancels mousedown on the input to stop a click starting a text
|
|
912
|
+
* selection; letting the span take the hit instead defeats that, and a multi-click then
|
|
913
|
+
* selects the whole item and pops the rich text toolbar up over a checkbox.
|
|
914
|
+
*/
|
|
915
|
+
z-index: 1;
|
|
916
|
+
/**
|
|
917
|
+
* In the static copy the input is otherwise still focusable: Tab reaches it inside an
|
|
918
|
+
* aria-hidden label, and Space ticks it on screen without writing to the shape. The box and tick
|
|
919
|
+
* are drawn on the span, so hiding the input doesn't change how it looks.
|
|
920
|
+
*/
|
|
921
|
+
visibility: hidden;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.tl-rich-text .ProseMirror ul[data-type='taskList'] > li > label > input[type='checkbox'] {
|
|
925
|
+
visibility: visible;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
.tl-rich-text ul[data-type='taskList'] > li > label > span {
|
|
929
|
+
position: relative;
|
|
930
|
+
display: block;
|
|
931
|
+
width: 1.08em;
|
|
932
|
+
height: 1.08em;
|
|
933
|
+
/* The box art is centered at 60% of the span, leaving room above for a tick to break out of it;
|
|
934
|
+
lift it so the box itself, not the span, is centered on the line. */
|
|
935
|
+
translate: 0 -10%;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* The box and the tick take a pseudo-element each: a mask clips everything its element paints,
|
|
940
|
+
* pseudo-elements included, so masking the span with the box would erase the tick inside it.
|
|
941
|
+
*
|
|
942
|
+
* The numbered box slots and the tick come from the font's theme entry (see getFontCheckboxStyle).
|
|
943
|
+
*/
|
|
944
|
+
.tl-rich-text ul[data-type='taskList'] > li > label > span::before,
|
|
945
|
+
.tl-rich-text ul[data-type='taskList'] > li > label > input:checked + span::after {
|
|
946
|
+
content: '';
|
|
947
|
+
position: absolute;
|
|
948
|
+
inset: 0;
|
|
949
|
+
background-color: currentColor;
|
|
950
|
+
mask-size: 100% 100%;
|
|
951
|
+
mask-repeat: no-repeat;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.tl-rich-text ul[data-type='taskList'] > li:nth-child(6n + 1) > label > span::before {
|
|
955
|
+
mask-image: var(--tl-checkbox-box-1, var(--tl-checkbox-box));
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
.tl-rich-text ul[data-type='taskList'] > li:nth-child(6n + 2) > label > span::before {
|
|
959
|
+
mask-image: var(--tl-checkbox-box-2, var(--tl-checkbox-box));
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.tl-rich-text ul[data-type='taskList'] > li:nth-child(6n + 3) > label > span::before {
|
|
963
|
+
mask-image: var(--tl-checkbox-box-3, var(--tl-checkbox-box));
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
.tl-rich-text ul[data-type='taskList'] > li:nth-child(6n + 4) > label > span::before {
|
|
967
|
+
mask-image: var(--tl-checkbox-box-4, var(--tl-checkbox-box));
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.tl-rich-text ul[data-type='taskList'] > li:nth-child(6n + 5) > label > span::before {
|
|
971
|
+
mask-image: var(--tl-checkbox-box-5, var(--tl-checkbox-box));
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.tl-rich-text ul[data-type='taskList'] > li:nth-child(6n) > label > span::before {
|
|
975
|
+
mask-image: var(--tl-checkbox-box-6, var(--tl-checkbox-box));
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.tl-rich-text ul[data-type='taskList'] > li > label > input:checked + span::after {
|
|
979
|
+
mask-image: var(--tl-checkbox-tick);
|
|
980
|
+
}
|
|
981
|
+
|
|
828
982
|
.tl-rich-text h1,
|
|
829
983
|
.tl-rich-text h2,
|
|
830
984
|
.tl-rich-text h3,
|
|
@@ -1462,40 +1616,47 @@ it from receiving any pointer events or affecting the cursor. */
|
|
|
1462
1616
|
}
|
|
1463
1617
|
|
|
1464
1618
|
.tl-error-boundary__content {
|
|
1465
|
-
width: fit-content;
|
|
1466
|
-
height: fit-content;
|
|
1467
|
-
max-width: 100%;
|
|
1468
1619
|
width: 400px;
|
|
1620
|
+
max-width: 100%;
|
|
1469
1621
|
max-height: 100%;
|
|
1470
1622
|
background-color: var(--tl-color-panel);
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
font-size: 14px;
|
|
1623
|
+
border-radius: var(--tl-radius-3);
|
|
1624
|
+
box-shadow: var(--tl-shadow-3);
|
|
1625
|
+
font-size: 12px;
|
|
1475
1626
|
font-weight: 400;
|
|
1476
1627
|
display: flex;
|
|
1477
1628
|
flex-direction: column;
|
|
1478
|
-
overflow:
|
|
1629
|
+
overflow: hidden;
|
|
1479
1630
|
z-index: var(--tl-layer-error-content);
|
|
1480
|
-
gap: 12px;
|
|
1481
1631
|
}
|
|
1482
1632
|
|
|
1483
1633
|
.tl-error-boundary__content__expanded {
|
|
1484
1634
|
width: 600px;
|
|
1485
1635
|
}
|
|
1486
1636
|
|
|
1487
|
-
.tl-error-
|
|
1488
|
-
|
|
1637
|
+
.tl-error-boundary__title {
|
|
1638
|
+
flex: 0 0 auto;
|
|
1639
|
+
display: flex;
|
|
1640
|
+
align-items: center;
|
|
1641
|
+
height: 40px;
|
|
1489
1642
|
margin: 0px;
|
|
1643
|
+
padding-inline: var(--tl-space-4);
|
|
1644
|
+
font-size: 12px;
|
|
1490
1645
|
font-weight: 500;
|
|
1646
|
+
color: var(--tl-color-text-1);
|
|
1491
1647
|
}
|
|
1492
1648
|
|
|
1493
|
-
.tl-error-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1649
|
+
.tl-error-boundary__body {
|
|
1650
|
+
flex: 0 1 auto;
|
|
1651
|
+
min-height: 0;
|
|
1652
|
+
display: flex;
|
|
1653
|
+
flex-direction: column;
|
|
1654
|
+
gap: var(--tl-space-4);
|
|
1655
|
+
padding: var(--tl-space-4) var(--tl-space-4);
|
|
1656
|
+
overflow-y: auto;
|
|
1657
|
+
overflow-x: hidden;
|
|
1658
|
+
overflow-wrap: anywhere;
|
|
1659
|
+
color: var(--tl-color-text-1);
|
|
1499
1660
|
}
|
|
1500
1661
|
|
|
1501
1662
|
.tl-error-boundary__content p {
|
|
@@ -1503,27 +1664,28 @@ it from receiving any pointer events or affecting the cursor. */
|
|
|
1503
1664
|
margin: 0px;
|
|
1504
1665
|
}
|
|
1505
1666
|
|
|
1667
|
+
.tl-error-boundary__content strong {
|
|
1668
|
+
font-weight: 600;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1506
1671
|
.tl-error-boundary__content pre {
|
|
1672
|
+
margin: 0px;
|
|
1673
|
+
padding: var(--tl-space-3) var(--tl-space-4);
|
|
1507
1674
|
background-color: var(--tl-color-muted-2);
|
|
1508
|
-
margin-top: 0;
|
|
1509
|
-
padding: var(--tl-space-5);
|
|
1510
1675
|
border-radius: var(--tl-radius-2);
|
|
1511
|
-
|
|
1512
|
-
font-size:
|
|
1513
|
-
|
|
1676
|
+
font-family: var(--tl-font-mono);
|
|
1677
|
+
font-size: 11px;
|
|
1678
|
+
line-height: 1.6;
|
|
1514
1679
|
}
|
|
1515
1680
|
|
|
1516
|
-
.tl-error-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
cursor: var(--tl-cursor-pointer);
|
|
1525
|
-
color: inherit;
|
|
1526
|
-
background-color: transparent;
|
|
1681
|
+
.tl-error-boundary__stack {
|
|
1682
|
+
position: relative;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
.tl-error-boundary__stack pre {
|
|
1686
|
+
overflow: auto;
|
|
1687
|
+
max-height: 240px;
|
|
1688
|
+
overflow-wrap: normal;
|
|
1527
1689
|
}
|
|
1528
1690
|
|
|
1529
1691
|
.tl-error-boundary__content a {
|
|
@@ -1532,43 +1694,93 @@ it from receiving any pointer events or affecting the cursor. */
|
|
|
1532
1694
|
text-decoration: none;
|
|
1533
1695
|
}
|
|
1534
1696
|
|
|
1535
|
-
.
|
|
1697
|
+
/* Mirrors .tlui-button so the fallback looks the same when only editor.css is loaded. */
|
|
1698
|
+
.tl-error-boundary__button {
|
|
1536
1699
|
position: relative;
|
|
1537
|
-
|
|
1700
|
+
isolation: isolate;
|
|
1701
|
+
height: 40px;
|
|
1702
|
+
min-width: 40px;
|
|
1703
|
+
padding: 0px 12px;
|
|
1704
|
+
display: flex;
|
|
1705
|
+
align-items: center;
|
|
1706
|
+
justify-content: center;
|
|
1707
|
+
background: none;
|
|
1708
|
+
border: none;
|
|
1709
|
+
font-family: inherit;
|
|
1710
|
+
font-size: 12px;
|
|
1711
|
+
font-weight: inherit;
|
|
1712
|
+
color: var(--tl-color-text-1);
|
|
1713
|
+
cursor: var(--tl-cursor-pointer);
|
|
1538
1714
|
}
|
|
1539
1715
|
|
|
1540
|
-
.tl-error-
|
|
1716
|
+
.tl-error-boundary__button::after {
|
|
1717
|
+
content: '';
|
|
1718
|
+
position: absolute;
|
|
1719
|
+
inset: 4px;
|
|
1720
|
+
z-index: -1;
|
|
1721
|
+
border-radius: var(--tl-radius-2);
|
|
1722
|
+
background: var(--tl-color-muted-2);
|
|
1723
|
+
opacity: 0;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
.tl-error-boundary__content .tl-error-boundary__copy {
|
|
1541
1727
|
position: absolute;
|
|
1542
1728
|
top: var(--tl-space-2);
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1729
|
+
inset-inline-end: var(--tl-space-2);
|
|
1730
|
+
height: 32px;
|
|
1731
|
+
min-width: 32px;
|
|
1732
|
+
padding: 0px;
|
|
1733
|
+
color: var(--tl-color-text-3);
|
|
1546
1734
|
background-color: var(--tl-color-panel);
|
|
1547
|
-
border-radius: var(--tl-radius-
|
|
1735
|
+
border-radius: var(--tl-radius-2);
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
.tl-error-boundary__content .tl-error-boundary__copy::after {
|
|
1739
|
+
inset: 0px;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
/* Touch screens can't hover, so the button stays visible there. */
|
|
1743
|
+
@media (hover: hover) {
|
|
1744
|
+
.tl-error-boundary__content .tl-error-boundary__copy {
|
|
1745
|
+
opacity: 0;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
.tl-error-boundary__stack:hover .tl-error-boundary__copy,
|
|
1749
|
+
.tl-error-boundary__stack:focus-within .tl-error-boundary__copy,
|
|
1750
|
+
.tl-error-boundary__stack[data-copied='true'] .tl-error-boundary__copy {
|
|
1751
|
+
opacity: 1;
|
|
1752
|
+
}
|
|
1548
1753
|
}
|
|
1549
1754
|
|
|
1550
1755
|
.tl-error-boundary__content__actions {
|
|
1756
|
+
flex: 0 0 auto;
|
|
1551
1757
|
display: flex;
|
|
1758
|
+
align-items: center;
|
|
1552
1759
|
justify-content: space-between;
|
|
1553
|
-
|
|
1554
|
-
margin: 0px;
|
|
1555
|
-
margin-left: -4px;
|
|
1760
|
+
height: 40px;
|
|
1556
1761
|
}
|
|
1762
|
+
|
|
1557
1763
|
.tl-error-boundary__content__actions__group {
|
|
1558
1764
|
display: flex;
|
|
1559
|
-
|
|
1765
|
+
align-items: center;
|
|
1560
1766
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1767
|
+
|
|
1768
|
+
.tl-error-boundary__content__actions__group > .tl-error-boundary__button:nth-last-child(n + 2) {
|
|
1769
|
+
margin-inline-end: -4px;
|
|
1563
1770
|
}
|
|
1771
|
+
|
|
1564
1772
|
.tl-error-boundary__content .tl-error-boundary__refresh {
|
|
1565
|
-
|
|
1566
|
-
color: var(--tl-color-selected-contrast);
|
|
1773
|
+
color: var(--tl-color-primary);
|
|
1567
1774
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1775
|
+
|
|
1776
|
+
.tl-error-boundary__content .tl-error-boundary__reset {
|
|
1777
|
+
color: var(--tl-color-danger);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.tl-container__focused:not(.tl-container__no-focus-ring) .tl-error-boundary__button:focus-visible {
|
|
1781
|
+
border-radius: 10px;
|
|
1782
|
+
outline: 2px solid var(--tl-color-focus);
|
|
1783
|
+
outline-offset: -5px;
|
|
1572
1784
|
}
|
|
1573
1785
|
|
|
1574
1786
|
/* ---------------- Hit test blocker ---------------- */
|
|
@@ -1606,16 +1818,12 @@ it from receiving any pointer events or affecting the cursor. */
|
|
|
1606
1818
|
color: var(--tl-color-selected);
|
|
1607
1819
|
}
|
|
1608
1820
|
|
|
1609
|
-
.tl-error-
|
|
1610
|
-
|
|
1821
|
+
.tl-error-boundary__button:hover::after {
|
|
1822
|
+
opacity: 1;
|
|
1611
1823
|
}
|
|
1612
1824
|
.tl-error-boundary__content a:hover {
|
|
1613
1825
|
color: var(--tl-color-text-1);
|
|
1614
1826
|
}
|
|
1615
|
-
.tl-error-boundary__content .tl-error-boundary__refresh:hover {
|
|
1616
|
-
background-color: var(--tl-color-primary);
|
|
1617
|
-
opacity: 0.9;
|
|
1618
|
-
}
|
|
1619
1827
|
|
|
1620
1828
|
/* These three rules help preserve clicking into specific points in text areas *while*
|
|
1621
1829
|
* already in edit mode when jumping from shape to shape. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/editor",
|
|
3
3
|
"description": "tldraw infinite canvas SDK (editor).",
|
|
4
|
-
"version": "5.7.0-next.
|
|
4
|
+
"version": "5.7.0-next.147eae59044f",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@tiptap/core": "^3.12.1",
|
|
44
44
|
"@tiptap/pm": "^3.12.1",
|
|
45
45
|
"@tiptap/react": "^3.12.1",
|
|
46
|
-
"@tldraw/state": "5.7.0-next.
|
|
47
|
-
"@tldraw/state-react": "5.7.0-next.
|
|
48
|
-
"@tldraw/store": "5.7.0-next.
|
|
49
|
-
"@tldraw/tlschema": "5.7.0-next.
|
|
50
|
-
"@tldraw/utils": "5.7.0-next.
|
|
51
|
-
"@tldraw/validate": "5.7.0-next.
|
|
46
|
+
"@tldraw/state": "5.7.0-next.147eae59044f",
|
|
47
|
+
"@tldraw/state-react": "5.7.0-next.147eae59044f",
|
|
48
|
+
"@tldraw/store": "5.7.0-next.147eae59044f",
|
|
49
|
+
"@tldraw/tlschema": "5.7.0-next.147eae59044f",
|
|
50
|
+
"@tldraw/utils": "5.7.0-next.147eae59044f",
|
|
51
|
+
"@tldraw/validate": "5.7.0-next.147eae59044f",
|
|
52
52
|
"classnames": "^2.5.1",
|
|
53
53
|
"eventemitter3": "^4.0.7",
|
|
54
54
|
"idb": "^7.1.1",
|
|
@@ -38,6 +38,7 @@ const messages = defineMessages({
|
|
|
38
38
|
id: 'error.reset-note',
|
|
39
39
|
defaultMessage: 'Resetting will erase your current project and any unsaved work.',
|
|
40
40
|
},
|
|
41
|
+
// No longer rendered, but still published translation keys that apps may override.
|
|
41
42
|
messageLabel: { id: 'error.message-label', defaultMessage: 'Message:' },
|
|
42
43
|
stackTraceLabel: { id: 'error.stack-trace-label', defaultMessage: 'Stack trace:' },
|
|
43
44
|
copy: { id: 'error.copy', defaultMessage: 'Copy' },
|
|
@@ -95,6 +96,11 @@ export function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {
|
|
|
95
96
|
|
|
96
97
|
const errorMessage = error instanceof Error ? error.message : String(error)
|
|
97
98
|
const errorStack = error instanceof Error ? error.stack : null
|
|
99
|
+
// Chrome's stack starts with the message; Safari and Firefox leave it out.
|
|
100
|
+
const errorDetails =
|
|
101
|
+
errorStack && !errorStack.includes(errorMessage)
|
|
102
|
+
? `${errorMessage}\n${errorStack}`
|
|
103
|
+
: (errorStack ?? errorMessage)
|
|
98
104
|
|
|
99
105
|
const isDarkModeFromApp = useValue(
|
|
100
106
|
'isDarkMode',
|
|
@@ -156,7 +162,7 @@ export function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps) {
|
|
|
156
162
|
const copyError = () => {
|
|
157
163
|
const doc = getOwnerDocument(containerRef.current)
|
|
158
164
|
const textarea = doc.createElement('textarea')
|
|
159
|
-
textarea.value =
|
|
165
|
+
textarea.value = errorDetails
|
|
160
166
|
doc.body.appendChild(textarea)
|
|
161
167
|
textarea.select()
|
|
162
168
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -219,63 +225,79 @@ My browser: ${navigator.userAgent}`
|
|
|
219
225
|
>
|
|
220
226
|
{shouldShowResetConfirmation ? (
|
|
221
227
|
<>
|
|
222
|
-
<h2>{msg(messages.confirmResetTitle)}</h2>
|
|
223
|
-
<
|
|
228
|
+
<h2 className="tl-error-boundary__title">{msg(messages.confirmResetTitle)}</h2>
|
|
229
|
+
<div className="tl-error-boundary__body">
|
|
230
|
+
<p>{msg(messages.confirmResetDescription)}</p>
|
|
231
|
+
</div>
|
|
224
232
|
<div className="tl-error-boundary__content__actions">
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
233
|
+
<div />
|
|
234
|
+
<div className="tl-error-boundary__content__actions__group">
|
|
235
|
+
<button
|
|
236
|
+
className="tlui-button tl-error-boundary__button"
|
|
237
|
+
onClick={() => setShouldShowResetConfirmation(false)}
|
|
238
|
+
>
|
|
239
|
+
{msg(messages.cancel)}
|
|
240
|
+
</button>
|
|
241
|
+
<button
|
|
242
|
+
className="tlui-button tl-error-boundary__button tl-error-boundary__reset"
|
|
243
|
+
onClick={resetLocalState}
|
|
244
|
+
>
|
|
245
|
+
{msg(messages.resetData)}
|
|
246
|
+
</button>
|
|
247
|
+
</div>
|
|
231
248
|
</div>
|
|
232
249
|
</>
|
|
233
250
|
) : (
|
|
234
251
|
<>
|
|
235
|
-
<h2>{msg(messages.title)}</h2>
|
|
236
|
-
<
|
|
237
|
-
<p>{msg(messages.resetHint)}</p>
|
|
238
|
-
<p>
|
|
239
|
-
<strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}
|
|
240
|
-
</p>
|
|
241
|
-
{process.env.NODE_ENV !== 'production' && (
|
|
252
|
+
<h2 className="tl-error-boundary__title">{msg(messages.title)}</h2>
|
|
253
|
+
<div className="tl-error-boundary__body">
|
|
242
254
|
<p>
|
|
243
|
-
|
|
244
|
-
<
|
|
245
|
-
Discord
|
|
246
|
-
</a>
|
|
247
|
-
.
|
|
255
|
+
{msg(messages.refreshHint)} {msg(messages.resetHint)}{' '}
|
|
256
|
+
<strong>{msg(messages.noteLabel)}</strong> {msg(messages.resetNote)}
|
|
248
257
|
</p>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
{process.env.NODE_ENV !== 'production' && (
|
|
259
|
+
<p>
|
|
260
|
+
If you're developing with the SDK and need help, join us on{' '}
|
|
261
|
+
<a href="https://discord.tldraw.com/?utm_source=sdk&utm_medium=organic&utm_campaign=error-screen">
|
|
262
|
+
Discord
|
|
263
|
+
</a>
|
|
264
|
+
.
|
|
265
|
+
</p>
|
|
266
|
+
)}
|
|
267
|
+
{shouldShowError && (
|
|
268
|
+
<div className="tl-error-boundary__stack" data-copied={didCopy}>
|
|
258
269
|
<pre>
|
|
259
|
-
<code>{
|
|
270
|
+
<code>{errorDetails}</code>
|
|
260
271
|
</pre>
|
|
261
|
-
<button
|
|
262
|
-
|
|
272
|
+
<button
|
|
273
|
+
className="tlui-button tl-error-boundary__button tl-error-boundary__copy"
|
|
274
|
+
onClick={copyError}
|
|
275
|
+
title={didCopy ? msg(messages.copied) : msg(messages.copy)}
|
|
276
|
+
aria-label={didCopy ? msg(messages.copied) : msg(messages.copy)}
|
|
277
|
+
>
|
|
278
|
+
{didCopy ? <CheckIcon /> : <CopyIcon />}
|
|
263
279
|
</button>
|
|
264
280
|
</div>
|
|
265
|
-
|
|
266
|
-
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
267
283
|
<div className="tl-error-boundary__content__actions">
|
|
268
|
-
<button
|
|
284
|
+
<button
|
|
285
|
+
className="tlui-button tl-error-boundary__button"
|
|
286
|
+
onClick={() => setShouldShowError(!shouldShowError)}
|
|
287
|
+
>
|
|
269
288
|
{shouldShowError ? msg(messages.hideDetails) : msg(messages.showDetails)}
|
|
270
289
|
</button>
|
|
271
290
|
<div className="tl-error-boundary__content__actions__group">
|
|
272
291
|
<button
|
|
273
|
-
className="tlui-button tl-error-boundary__reset"
|
|
292
|
+
className="tlui-button tl-error-boundary__button tl-error-boundary__reset"
|
|
274
293
|
onClick={() => setShouldShowResetConfirmation(true)}
|
|
275
294
|
>
|
|
276
295
|
{msg(messages.resetData)}
|
|
277
296
|
</button>
|
|
278
|
-
<button
|
|
297
|
+
<button
|
|
298
|
+
className="tlui-button tl-error-boundary__button tl-error-boundary__refresh"
|
|
299
|
+
onClick={refresh}
|
|
300
|
+
>
|
|
279
301
|
{msg(messages.refreshPage)}
|
|
280
302
|
</button>
|
|
281
303
|
</div>
|
|
@@ -286,3 +308,27 @@ My browser: ${navigator.userAgent}`
|
|
|
286
308
|
</div>
|
|
287
309
|
)
|
|
288
310
|
}
|
|
311
|
+
|
|
312
|
+
function CopyIcon() {
|
|
313
|
+
return (
|
|
314
|
+
<svg width="16" height="16" viewBox="0 0 30 30" fill="none" aria-hidden="true">
|
|
315
|
+
<path
|
|
316
|
+
fillRule="evenodd"
|
|
317
|
+
clipRule="evenodd"
|
|
318
|
+
d="M2 19.0001C2 20.6569 3.34315 22.0001 5 22.0001H8L8 20.0001H5C4.44772 20.0001 4 19.5524 4 19.0001L4 5.00009C4 4.44781 4.44772 4.00009 5 4.00009L19 4.00009C19.5523 4.00009 20 4.44781 20 5.00009V8.00001H11C9.34315 8.00001 8 9.34316 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34316 26.6569 8.00001 25 8.00001H22V5.00009C22 3.34324 20.6569 2.00009 19 2.00009H5C3.34315 2.00009 2 3.34324 2 5.00009V19.0001ZM10 11C10 10.4477 10.4477 10 11 10H25C25.5523 10 26 10.4477 26 11V25C26 25.5523 25.5523 26 25 26H11C10.4477 26 10 25.5523 10 25V11Z"
|
|
319
|
+
fill="currentColor"
|
|
320
|
+
/>
|
|
321
|
+
</svg>
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function CheckIcon() {
|
|
326
|
+
return (
|
|
327
|
+
<svg width="16" height="16" viewBox="0 0 30 30" fill="none" aria-hidden="true">
|
|
328
|
+
<path
|
|
329
|
+
d="M22.9339 7.45369C23.5118 7.83148 23.6739 8.60615 23.2961 9.18396L14.7961 22.184C14.5958 22.4903 14.2712 22.6935 13.9082 22.7398C13.5451 22.7862 13.1799 22.6711 12.909 22.4248L7.40905 17.4248C6.89822 16.9604 6.86058 16.1699 7.32496 15.6591C7.78935 15.1482 8.57991 15.1106 9.09073 15.575L13.506 19.5888L21.2037 7.81584C21.5815 7.23803 22.3561 7.07589 22.9339 7.45369Z"
|
|
330
|
+
fill="currentColor"
|
|
331
|
+
/>
|
|
332
|
+
</svg>
|
|
333
|
+
)
|
|
334
|
+
}
|
package/src/lib/editor/Editor.ts
CHANGED
|
@@ -2359,7 +2359,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
2359
2359
|
* can't be tabbed to. Use this for the children of a frame or group, which
|
|
2360
2360
|
* {@link Editor.getCurrentPageShapesInReadingOrder} leaves out.
|
|
2361
2361
|
*
|
|
2362
|
-
* @
|
|
2362
|
+
* @internal
|
|
2363
2363
|
*/
|
|
2364
2364
|
getShapesInReadingOrder(shapes: TLShape[]): TLShape[] {
|
|
2365
2365
|
const SHALLOW_ANGLE = 20
|
|
@@ -9321,7 +9321,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
9321
9321
|
|
|
9322
9322
|
if (opacity !== null) return { type: 'shared', value: opacity }
|
|
9323
9323
|
}
|
|
9324
|
-
return { type: 'shared', value: this.
|
|
9324
|
+
return { type: 'shared', value: this.getOpacityForNextShape() }
|
|
9325
9325
|
}
|
|
9326
9326
|
|
|
9327
9327
|
/**
|
|
@@ -9340,6 +9340,10 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
9340
9340
|
return this
|
|
9341
9341
|
}
|
|
9342
9342
|
|
|
9343
|
+
@computed private getOpacityForNextShape(): number {
|
|
9344
|
+
return this.getInstanceState().opacityForNextShape
|
|
9345
|
+
}
|
|
9346
|
+
|
|
9343
9347
|
/**
|
|
9344
9348
|
* Set the current opacity. This will effect any selected shapes.
|
|
9345
9349
|
*
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
TLTheme,
|
|
6
6
|
TLThemeColors,
|
|
7
7
|
} from '@tldraw/tlschema'
|
|
8
|
+
import { DRAW_FONT_CHECKBOX } from './drawFontCheckbox'
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* The default theme definition containing color palettes for both light and dark modes.
|
|
@@ -39,6 +40,7 @@ export const DEFAULT_THEME: TLTheme = {
|
|
|
39
40
|
style: 'italic',
|
|
40
41
|
},
|
|
41
42
|
],
|
|
43
|
+
checkbox: DRAW_FONT_CHECKBOX,
|
|
42
44
|
},
|
|
43
45
|
sans: {
|
|
44
46
|
fontFamily: DefaultFontFamilies.sans,
|