@bigbluebutton/tldraw 2.0.0-alpha.23 → 2.0.0-alpha.25

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 (85) hide show
  1. package/dist-cjs/index.d.ts +9 -1
  2. package/dist-cjs/lib/defaultShapeUtils.js +3 -1
  3. package/dist-cjs/lib/defaultShapeUtils.js.map +2 -2
  4. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  5. package/dist-cjs/lib/shapes/poll/PollShapeTool.js +30 -0
  6. package/dist-cjs/lib/shapes/poll/PollShapeTool.js.map +7 -0
  7. package/dist-cjs/lib/shapes/poll/PollShapeUtil.js +121 -0
  8. package/dist-cjs/lib/shapes/poll/PollShapeUtil.js.map +7 -0
  9. package/dist-cjs/lib/shapes/poll/components/poll-content.js +101 -0
  10. package/dist-cjs/lib/shapes/poll/components/poll-content.js.map +7 -0
  11. package/dist-cjs/lib/shapes/poll/components/styles.js +53 -0
  12. package/dist-cjs/lib/shapes/poll/components/styles.js.map +7 -0
  13. package/dist-cjs/lib/shapes/poll/poll-shape-migrations.js +45 -0
  14. package/dist-cjs/lib/shapes/poll/poll-shape-migrations.js.map +7 -0
  15. package/dist-cjs/lib/shapes/poll/poll-shape-props.js +39 -0
  16. package/dist-cjs/lib/shapes/poll/poll-shape-props.js.map +7 -0
  17. package/dist-cjs/lib/shapes/poll/poll-shape-types.js +17 -0
  18. package/dist-cjs/lib/shapes/poll/poll-shape-types.js.map +7 -0
  19. package/dist-cjs/lib/tools/HandTool/HandTool.js +3 -3
  20. package/dist-cjs/lib/tools/HandTool/HandTool.js.map +2 -2
  21. package/dist-cjs/lib/ui/components/ContextMenu.js +0 -1
  22. package/dist-cjs/lib/ui/components/ContextMenu.js.map +2 -2
  23. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  24. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +6 -1
  25. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  26. package/dist-cjs/lib/ui/hooks/useTranslation/translations.js +1 -1
  27. package/dist-cjs/lib/ui/hooks/useTranslation/translations.js.map +2 -2
  28. package/dist-esm/index.d.mts +9 -1
  29. package/dist-esm/lib/defaultShapeUtils.mjs +3 -1
  30. package/dist-esm/lib/defaultShapeUtils.mjs.map +2 -2
  31. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  32. package/dist-esm/lib/shapes/poll/PollShapeTool.mjs +10 -0
  33. package/dist-esm/lib/shapes/poll/PollShapeTool.mjs.map +7 -0
  34. package/dist-esm/lib/shapes/poll/PollShapeUtil.mjs +97 -0
  35. package/dist-esm/lib/shapes/poll/PollShapeUtil.mjs.map +7 -0
  36. package/dist-esm/lib/shapes/poll/components/poll-content.mjs +71 -0
  37. package/dist-esm/lib/shapes/poll/components/poll-content.mjs.map +7 -0
  38. package/dist-esm/lib/shapes/poll/components/styles.mjs +23 -0
  39. package/dist-esm/lib/shapes/poll/components/styles.mjs.map +7 -0
  40. package/dist-esm/lib/shapes/poll/poll-shape-migrations.mjs +25 -0
  41. package/dist-esm/lib/shapes/poll/poll-shape-migrations.mjs.map +7 -0
  42. package/dist-esm/lib/shapes/poll/poll-shape-props.mjs +19 -0
  43. package/dist-esm/lib/shapes/poll/poll-shape-props.mjs.map +7 -0
  44. package/dist-esm/lib/shapes/poll/poll-shape-types.mjs +1 -0
  45. package/dist-esm/lib/shapes/poll/poll-shape-types.mjs.map +7 -0
  46. package/dist-esm/lib/tools/HandTool/HandTool.mjs +3 -3
  47. package/dist-esm/lib/tools/HandTool/HandTool.mjs.map +2 -2
  48. package/dist-esm/lib/ui/components/ContextMenu.mjs +0 -1
  49. package/dist-esm/lib/ui/components/ContextMenu.mjs.map +2 -2
  50. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +6 -1
  51. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  52. package/dist-esm/lib/ui/hooks/useTranslation/translations.mjs +1 -1
  53. package/dist-esm/lib/ui/hooks/useTranslation/translations.mjs.map +2 -2
  54. package/package.json +4 -3
  55. package/src/lib/Tldraw.test.tsx +9 -13
  56. package/src/lib/defaultShapeUtils.ts +2 -0
  57. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +1 -1
  58. package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.ts.snap +6 -6
  59. package/src/lib/shapes/poll/PollShapeTool.tsx +7 -0
  60. package/src/lib/shapes/poll/PollShapeUtil.tsx +108 -0
  61. package/src/lib/shapes/poll/components/poll-content.tsx +100 -0
  62. package/src/lib/shapes/poll/components/styles.ts +21 -0
  63. package/src/lib/shapes/poll/poll-shape-migrations.ts +23 -0
  64. package/src/lib/shapes/poll/poll-shape-props.ts +17 -0
  65. package/src/lib/shapes/poll/poll-shape-types.ts +21 -0
  66. package/src/lib/tools/HandTool/HandTool.ts +4 -5
  67. package/src/lib/ui/components/ContextMenu.tsx +1 -1
  68. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +5 -0
  69. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +5 -0
  70. package/src/lib/ui/hooks/useTranslation/translations.ts +1 -1
  71. package/src/test/Editor.test.tsx +2 -2
  72. package/src/test/HandTool.test.ts +55 -56
  73. package/src/test/TLSessionStateSnapshot.test.ts +5 -5
  74. package/src/test/TestEditor.ts +4 -1
  75. package/src/test/TldrawEditor.test.tsx +28 -30
  76. package/src/test/__snapshots__/resizing.test.ts.snap +8 -8
  77. package/src/test/commands/__snapshots__/packShapes.test.ts.snap +20 -20
  78. package/src/test/commands/__snapshots__/zoomToFit.test.ts.snap +2 -2
  79. package/src/test/commands/createShapes.test.ts +1 -1
  80. package/src/test/commands/putContent.test.ts +4 -4
  81. package/src/test/commands/updateShapes.test.ts +1 -1
  82. package/src/test/resizing.test.ts +203 -203
  83. package/src/test/selection-omnibus.test.ts +41 -41
  84. package/src/test/test-jsx.tsx +7 -3
  85. package/src/test/translating.test.ts +42 -42
@@ -1,15 +1,15 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`editor.packShapes packs rotated shapes: packed shapes 1`] = `
4
- Array [
5
- Object {
4
+ [
5
+ {
6
6
  "id": "shape:boxA",
7
7
  "index": "a1",
8
8
  "isLocked": false,
9
- "meta": Object {},
9
+ "meta": {},
10
10
  "opacity": 1,
11
11
  "parentId": "wahtever",
12
- "props": Object {
12
+ "props": {
13
13
  "align": "middle",
14
14
  "color": "black",
15
15
  "dash": "draw",
@@ -31,14 +31,14 @@ Array [
31
31
  "x": 134,
32
32
  "y": 250,
33
33
  },
34
- Object {
34
+ {
35
35
  "id": "shape:boxB",
36
36
  "index": "a2",
37
37
  "isLocked": false,
38
- "meta": Object {},
38
+ "meta": {},
39
39
  "opacity": 1,
40
40
  "parentId": "wahtever",
41
- "props": Object {
41
+ "props": {
42
42
  "align": "middle",
43
43
  "color": "black",
44
44
  "dash": "draw",
@@ -60,14 +60,14 @@ Array [
60
60
  "x": 150,
61
61
  "y": 150,
62
62
  },
63
- Object {
63
+ {
64
64
  "id": "shape:boxC",
65
65
  "index": "a3",
66
66
  "isLocked": false,
67
- "meta": Object {},
67
+ "meta": {},
68
68
  "opacity": 1,
69
69
  "parentId": "wahtever",
70
- "props": Object {
70
+ "props": {
71
71
  "align": "middle",
72
72
  "color": "black",
73
73
  "dash": "draw",
@@ -93,15 +93,15 @@ Array [
93
93
  `;
94
94
 
95
95
  exports[`editor.packShapes packs shapes: packed shapes 1`] = `
96
- Array [
97
- Object {
96
+ [
97
+ {
98
98
  "id": "shape:boxA",
99
99
  "index": "a1",
100
100
  "isLocked": false,
101
- "meta": Object {},
101
+ "meta": {},
102
102
  "opacity": 1,
103
103
  "parentId": "wahtever",
104
- "props": Object {
104
+ "props": {
105
105
  "align": "middle",
106
106
  "color": "black",
107
107
  "dash": "draw",
@@ -123,14 +123,14 @@ Array [
123
123
  "x": 84,
124
124
  "y": 200,
125
125
  },
126
- Object {
126
+ {
127
127
  "id": "shape:boxB",
128
128
  "index": "a2",
129
129
  "isLocked": false,
130
- "meta": Object {},
130
+ "meta": {},
131
131
  "opacity": 1,
132
132
  "parentId": "wahtever",
133
- "props": Object {
133
+ "props": {
134
134
  "align": "middle",
135
135
  "color": "black",
136
136
  "dash": "draw",
@@ -152,14 +152,14 @@ Array [
152
152
  "x": 200,
153
153
  "y": 200,
154
154
  },
155
- Object {
155
+ {
156
156
  "id": "shape:boxC",
157
157
  "index": "a3",
158
158
  "isLocked": false,
159
- "meta": Object {},
159
+ "meta": {},
160
160
  "opacity": 1,
161
161
  "parentId": "wahtever",
162
- "props": Object {
162
+ "props": {
163
163
  "align": "middle",
164
164
  "color": "black",
165
165
  "dash": "draw",
@@ -1,9 +1,9 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`converts correctly: Zoom to Fit Camera 1`] = `
4
- Object {
4
+ {
5
5
  "id": "static",
6
- "meta": Object {},
6
+ "meta": {},
7
7
  "typeName": "camera",
8
8
  "x": 330.435496777593,
9
9
  "y": 22.261531457640388,
@@ -79,7 +79,7 @@ it('Uses typescript generics', () => {
79
79
  type: 'arrow',
80
80
  },
81
81
  ])
82
- }).toThrowError()
82
+ }).toThrow()
83
83
  })
84
84
 
85
85
  it('Parents shapes to the current page if the parent is not found', () => {
@@ -16,17 +16,17 @@ describe('Migrations', () => {
16
16
  const withoutSchema = structuredClone(clipboardContent)
17
17
  // @ts-expect-error
18
18
  delete withoutSchema.schema
19
- expect(() => editor.putContentOntoCurrentPage(withoutSchema)).toThrowError()
19
+ expect(() => editor.putContentOntoCurrentPage(withoutSchema)).toThrow()
20
20
  })
21
21
 
22
22
  it('Does not throw error if content has a schema', () => {
23
- expect(() => editor.putContentOntoCurrentPage(clipboardContent)).not.toThrowError()
23
+ expect(() => editor.putContentOntoCurrentPage(clipboardContent)).not.toThrow()
24
24
  })
25
25
 
26
26
  it('Throws error if any shape is invalid due to wrong type', () => {
27
27
  const withInvalidShapeType = structuredClone(clipboardContent)
28
28
  withInvalidShapeType.shapes[0].type = 'invalid'
29
- expect(() => editor.putContentOntoCurrentPage(withInvalidShapeType)).toThrowError()
29
+ expect(() => editor.putContentOntoCurrentPage(withInvalidShapeType)).toThrow()
30
30
  })
31
31
 
32
32
  // we temporarily disabled validations
@@ -34,6 +34,6 @@ describe('Migrations', () => {
34
34
  const withInvalidShapeModel = structuredClone(clipboardContent)
35
35
  // @ts-expect-error
36
36
  withInvalidShapeModel.shapes[0].x = 'invalid'
37
- expect(() => editor.putContentOntoCurrentPage(withInvalidShapeModel)).toThrowError()
37
+ expect(() => editor.putContentOntoCurrentPage(withInvalidShapeModel)).toThrow()
38
38
  })
39
39
  })
@@ -77,7 +77,7 @@ it('Uses typescript generics', () => {
77
77
  type: 'arrow',
78
78
  },
79
79
  ])
80
- }).toThrowError()
80
+ }).toThrow()
81
81
  })
82
82
 
83
83
  it('updates shapes', () => {