@tldraw/tldraw 5.7.0-canary.ef9966b67dee → 5.7.0-canary.f58edb2cdca7

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.js CHANGED
@@ -19,7 +19,7 @@ var import_tldraw = require("tldraw");
19
19
  __reExport(index_exports, require("tldraw"), module.exports);
20
20
  (0, import_tldraw.registerTldrawLibraryVersion)(
21
21
  "@tldraw/tldraw",
22
- "5.7.0-canary.ef9966b67dee",
22
+ "5.7.0-canary.f58edb2cdca7",
23
23
  "cjs"
24
24
  );
25
25
  //# sourceMappingURL=index.js.map
@@ -2,7 +2,7 @@ import { registerTldrawLibraryVersion } from "tldraw";
2
2
  export * from "tldraw";
3
3
  registerTldrawLibraryVersion(
4
4
  "@tldraw/tldraw",
5
- "5.7.0-canary.ef9966b67dee",
5
+ "5.7.0-canary.f58edb2cdca7",
6
6
  "esm"
7
7
  );
8
8
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/tldraw",
3
3
  "description": "A tiny little drawing editor.",
4
- "version": "5.7.0-canary.ef9966b67dee",
4
+ "version": "5.7.0-canary.f58edb2cdca7",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -39,7 +39,7 @@
39
39
  "src"
40
40
  ],
41
41
  "dependencies": {
42
- "tldraw": "5.7.0-canary.ef9966b67dee"
42
+ "tldraw": "5.7.0-canary.f58edb2cdca7"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^18.2.0 || ^19.2.1",
package/tldraw.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);
@@ -852,6 +855,130 @@ input,
852
855
  padding-left: 3.625ch;
853
856
  }
854
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
+
855
982
  .tl-rich-text h1,
856
983
  .tl-rich-text h2,
857
984
  .tl-rich-text h3,
@@ -3978,12 +4105,19 @@ tldraw? probably.
3978
4105
  }
3979
4106
 
3980
4107
  .tlui-rich-text__toolbar-link-input {
3981
- margin-left: 12px;
4108
+ /* Padding rather than margin, so the invalid outline runs to the toolbar's left edge. */
4109
+ padding-left: 12px;
3982
4110
  /*
3983
4111
  * Nice touch tweak: keep the link editor toolbar the same as the default toolbar.
3984
4112
  * This is so the toolbar size stays stable going in and out of the link editor.
3985
4113
  */
3986
- width: 148px;
4114
+ width: 160px;
4115
+ }
4116
+
4117
+ .tlui-rich-text__toolbar-link-input--invalid {
4118
+ /* An inset shadow rather than a border, so the input doesn't change size. */
4119
+ box-shadow: inset 0 0 0 1px var(--tl-color-danger);
4120
+ border-radius: var(--tl-radius-3) var(--tl-radius-2) var(--tl-radius-2) var(--tl-radius-3);
3987
4121
  }
3988
4122
 
3989
4123
  .tlui-media__toolbar-alt-text-input {