@widgetic/canvas 0.5.44 → 0.5.45

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 (160) hide show
  1. package/dist/canvas/DomCanvas.svelte +52 -3
  2. package/dist/canvas/DomCanvas.svelte.d.ts +59 -34
  3. package/dist/canvas/autosaveScheduler.js +89 -37
  4. package/dist/canvas/boardFrame.js +1 -1
  5. package/dist/canvas/boardSurface.js +1 -1
  6. package/dist/canvas/canvasLogger.js +19 -7
  7. package/dist/canvas/chromeLayout.js +21 -19
  8. package/dist/canvas/eventScope.js +14 -10
  9. package/dist/canvas/host/CanvasHost.d.ts +68 -1
  10. package/dist/canvas/host/CanvasHost.js +1901 -1407
  11. package/dist/canvas/host/CanvasHostApi.d.ts +2 -2
  12. package/dist/canvas/host/CanvasHostApi.js +28 -5
  13. package/dist/canvas/host/boardFiles.d.ts +90 -0
  14. package/dist/canvas/host/boardFiles.js +155 -0
  15. package/dist/canvas/host/browserServices.d.ts +17 -0
  16. package/dist/canvas/host/browserServices.js +211 -65
  17. package/dist/canvas/host/conversion.js +170 -82
  18. package/dist/canvas/host/hostObject.js +7 -7
  19. package/dist/canvas/host/nearCards.js +21 -18
  20. package/dist/canvas/host/pageEvents.js +5 -5
  21. package/dist/canvas/host/pictureSaves.js +11 -9
  22. package/dist/canvas/host/screenRects.js +31 -28
  23. package/dist/canvas/host/storedPictures.js +243 -149
  24. package/dist/canvas/host/strokeSnap.js +143 -88
  25. package/dist/canvas/index.d.ts +1 -0
  26. package/dist/canvas/openMarks.js +2 -2
  27. package/dist/canvas/outsideClickDeselect.js +7 -6
  28. package/dist/canvas/panZoomPosition.js +2 -2
  29. package/dist/canvas/preferredTextFont.js +25 -13
  30. package/dist/canvas/shapes/ShapeLibrary.js +148 -138
  31. package/dist/canvas/shapes/shapeImageStore.js +4 -4
  32. package/dist/canvas/shapes/strokeShapeSnap.js +233 -188
  33. package/dist/canvas/toolbarPosition.js +2 -2
  34. package/dist/canvas/ui/CanvasContextMenu.svelte +7 -0
  35. package/dist/canvas/ui/CanvasToolbar.svelte +4 -1
  36. package/dist/canvas/ui/CanvasToolbar.svelte.d.ts +2 -0
  37. package/dist/canvas/ui/SelectionPanel.svelte +78 -17
  38. package/dist/canvas/ui/ShapesMenu.svelte +65 -31
  39. package/dist/canvas/ui/ShapesMenu.svelte.d.ts +2 -0
  40. package/dist/canvas/ui/ShortcutTooltip.svelte +64 -0
  41. package/dist/canvas/ui/ShortcutTooltip.svelte.d.ts +24 -0
  42. package/dist/canvas/ui/ToolButton.svelte +34 -55
  43. package/dist/canvas/ui/ToolButton.svelte.d.ts +4 -1
  44. package/dist/canvas/ui/colorModel.js +32 -21
  45. package/dist/canvas/ui/colorPickerMessages.js +5 -5
  46. package/dist/canvas/ui/floatingCard.d.ts +26 -4
  47. package/dist/canvas/ui/floatingCard.js +43 -21
  48. package/dist/canvas/ui/floatingLayer.js +6 -5
  49. package/dist/canvas/ui/icons.d.ts +1 -1
  50. package/dist/canvas/ui/icons.js +1 -1
  51. package/dist/canvas/ui/keyHints.js +11 -9
  52. package/dist/canvas/ui/popoverSide.js +3 -2
  53. package/dist/canvas/ui/selectionTraits.d.ts +12 -0
  54. package/dist/canvas/ui/selectionTraits.js +66 -35
  55. package/dist/canvas/ui/sizeLabelVisibility.d.ts +4 -2
  56. package/dist/canvas/ui/sizeLabelVisibility.js +5 -5
  57. package/dist/canvas/view/CanvasStage.svelte +7 -2
  58. package/dist/canvas/view/CanvasStage.svelte.d.ts +2 -0
  59. package/dist/canvas/view/SelectionOverlay.svelte +17 -10
  60. package/dist/canvas/view/WidgetChromeLayer.svelte +15 -3
  61. package/dist/canvas/view/erasingMarks.js +7 -7
  62. package/dist/canvas/view/geometry.d.ts +1 -1
  63. package/dist/canvas/view/geometry.js +90 -71
  64. package/dist/canvas/view/liftedScene.js +36 -24
  65. package/dist/canvas/view/mountedScene.js +79 -76
  66. package/dist/components/CanvasBoardPoster.svelte +206 -0
  67. package/dist/components/CanvasBoardPoster.svelte.d.ts +17 -0
  68. package/dist/components/CanvasToolbarPlaceholder.svelte +115 -0
  69. package/dist/components/CanvasToolbarPlaceholder.svelte.d.ts +9 -0
  70. package/dist/components/index.d.ts +7 -0
  71. package/dist/components/index.js +8 -0
  72. package/dist/components/preferenceStorage.js +2 -2
  73. package/dist/engine/EngineCore.d.ts +37 -2
  74. package/dist/engine/EngineCore.js +946 -768
  75. package/dist/engine/codec/canvasDocument.d.ts +7 -0
  76. package/dist/engine/codec/canvasDocument.js +172 -186
  77. package/dist/engine/codec/hostReadableKeys.js +1 -1
  78. package/dist/engine/core/arrange.js +38 -26
  79. package/dist/engine/core/arrow.d.ts +18 -8
  80. package/dist/engine/core/arrow.js +109 -84
  81. package/dist/engine/core/arrowBinding.d.ts +1 -1
  82. package/dist/engine/core/arrowBinding.js +126 -101
  83. package/dist/engine/core/arrowBindingRecords.d.ts +9 -3
  84. package/dist/engine/core/arrowBindingRecords.js +48 -29
  85. package/dist/engine/core/brush.d.ts +8 -0
  86. package/dist/engine/core/brush.js +98 -78
  87. package/dist/engine/core/cameraMove.d.ts +6 -0
  88. package/dist/engine/core/cameraMove.js +56 -38
  89. package/dist/engine/core/defaults.js +51 -90
  90. package/dist/engine/core/freehand.js +163 -147
  91. package/dist/engine/core/geometry.js +54 -47
  92. package/dist/engine/core/history.js +55 -38
  93. package/dist/engine/core/hitTest.js +81 -68
  94. package/dist/engine/core/matrix.js +20 -18
  95. package/dist/engine/core/pathData.js +210 -183
  96. package/dist/engine/core/rotationReset.js +6 -5
  97. package/dist/engine/core/scene.d.ts +22 -0
  98. package/dist/engine/core/scene.js +288 -139
  99. package/dist/engine/core/scribble.js +84 -59
  100. package/dist/engine/core/shapePaths.js +15 -12
  101. package/dist/engine/core/shapeTools.js +63 -72
  102. package/dist/engine/core/snapping.js +117 -65
  103. package/dist/engine/core/style.d.ts +10 -0
  104. package/dist/engine/core/style.js +82 -33
  105. package/dist/engine/core/transform.d.ts +6 -0
  106. package/dist/engine/core/transform.js +103 -83
  107. package/dist/engine/core/types.d.ts +7 -0
  108. package/dist/engine/core/types.js +4 -4
  109. package/dist/engine/core/viewport.js +36 -23
  110. package/dist/engine/input/PointerController.d.ts +15 -1
  111. package/dist/engine/input/PointerController.js +547 -476
  112. package/dist/engine/input/arrowHandles.js +12 -12
  113. package/dist/engine/input/gestures.d.ts +3 -1
  114. package/dist/engine/input/gestures.js +340 -266
  115. package/dist/engine/input/hoverCursor.js +1 -1
  116. package/dist/engine/input/keyboard.d.ts +22 -3
  117. package/dist/engine/input/keyboard.js +131 -32
  118. package/dist/engine/input/selectionHandles.js +50 -45
  119. package/dist/engine/input/types.d.ts +7 -0
  120. package/dist/engine/input/types.js +1 -1
  121. package/dist/engine/render/rasterize.js +158 -86
  122. package/dist/engine/state.d.ts +18 -0
  123. package/dist/engine/state.js +25 -4
  124. package/dist/engine/text/layoutText.js +62 -43
  125. package/dist/engine/text/textMetrics.js +10 -8
  126. package/dist/engine/widgets.js +137 -101
  127. package/dist/fonts/interFont.js +83 -30
  128. package/dist/fonts/workspaceFonts.d.ts +6 -0
  129. package/dist/fonts/workspaceFonts.js +108 -34
  130. package/dist/i18n/labels.js +4 -4
  131. package/dist/i18n/language.d.ts +3 -3
  132. package/dist/i18n/language.js +4 -4
  133. package/dist/i18n/messages.d.ts +6 -0
  134. package/dist/i18n/messages.js +7 -1
  135. package/dist/i18n/shortcuts.d.ts +6 -4
  136. package/dist/i18n/shortcuts.js +30 -26
  137. package/dist/index.d.ts +1 -0
  138. package/dist/poster/boardPlacement.d.ts +80 -0
  139. package/dist/poster/boardPlacement.js +140 -0
  140. package/dist/poster/boardPoster.d.ts +80 -0
  141. package/dist/poster/boardPoster.js +251 -0
  142. package/dist/poster/paintBoardPoster.d.ts +49 -0
  143. package/dist/poster/paintBoardPoster.js +112 -0
  144. package/dist/poster/posterPictures.d.ts +32 -0
  145. package/dist/poster/posterPictures.js +138 -0
  146. package/dist/settings/workspaceToolSettings.d.ts +6 -0
  147. package/dist/settings/workspaceToolSettings.js +58 -34
  148. package/dist/tools/components/catalog.js +74 -64
  149. package/dist/tools/components/grouping.js +28 -6
  150. package/dist/tools/definitions.js +31 -9
  151. package/dist/tools/executors.js +214 -106
  152. package/dist/tools/hostAdapter.d.ts +5 -1
  153. package/dist/tools/hostAdapter.js +15 -11
  154. package/dist/tools/sceneSummary.js +57 -43
  155. package/dist/tools/sketchIntent.js +21 -13
  156. package/dist/tools/styleArguments.d.ts +35 -0
  157. package/dist/tools/styleArguments.js +93 -0
  158. package/dist/tools/types.d.ts +26 -1
  159. package/dist/tools/types.js +2 -1
  160. package/package.json +1 -1
@@ -4,14 +4,15 @@
4
4
  */
5
5
  import { normalizeDegrees, normalizeSignedDegrees } from './matrix.js';
6
6
  /** How long the upright animation runs, in milliseconds. */
7
- export const ROTATION_RESET_DURATION_MS = 220;
7
+ export var ROTATION_RESET_DURATION_MS = 220;
8
8
  /** Ease-out progress in [0, 1] for `elapsed` ms since the animation started. */
9
- export function rotationResetProgress(elapsed, duration = ROTATION_RESET_DURATION_MS) {
10
- const t = Math.min(1, Math.max(0, elapsed / duration));
11
- return 1 - (1 - t) ** 3;
9
+ export function rotationResetProgress(elapsed, duration) {
10
+ if (duration === void 0) { duration = ROTATION_RESET_DURATION_MS; }
11
+ var t = Math.min(1, Math.max(0, elapsed / duration));
12
+ return 1 - Math.pow((1 - t), 3);
12
13
  }
13
14
  /** Rotation in degrees after `progress` of the upright animation from `startRotation`. */
14
15
  export function rotationAfterResetProgress(startRotation, progress) {
15
- const delta = -normalizeSignedDegrees(startRotation);
16
+ var delta = -normalizeSignedDegrees(startRotation);
16
17
  return normalizeDegrees(startRotation + delta * progress);
17
18
  }
@@ -79,6 +79,28 @@ export declare function movingShapeIds(scene: Scene, ids: Iterable<ObjectId>): S
79
79
  export declare function translateShapes(scene: Scene, moving: ReadonlySet<ObjectId>, deltaX: number, deltaY: number): Scene;
80
80
  /** Moves the shapes drawn by the given objects by a distance. */
81
81
  export declare function translateObjects(scene: Scene, ids: Iterable<ObjectId>, deltaX: number, deltaY: number): Scene;
82
+ /**
83
+ * What is joined to the given objects by arrows, at any distance: an arrow and the shapes its ends are tied to, the other arrows
84
+ * tied to those shapes, and so on to the last one. The given objects come back too (and the members of a group among them: a group
85
+ * stands for the shapes inside it, so an arrow tied to one of its members joins the whole group to what is at the arrow's other end).
86
+ *
87
+ * The ids of the result are the leaf shapes, the arrows and the groups that were given; `withConnectedObjects` turns them into
88
+ * the objects that are put in front of or behind the others.
89
+ */
90
+ export declare function connectedObjectIds(scene: Scene, ids: Iterable<ObjectId>): Set<ObjectId>;
91
+ /**
92
+ * The object that is `id` itself or the group above it, whichever sits directly in the list of `parentId` (null is the board),
93
+ * or null when `id` is not under that parent at all.
94
+ */
95
+ export declare function ancestorWithin(index: ReadonlyMap<ObjectId, SceneObject>, id: ObjectId, parentId: ObjectId | null): ObjectId | null;
96
+ /**
97
+ * The given objects and everything that arrows join to them: shapes that are tied together are one diagram, and putting any
98
+ * one of them in front of the others puts the whole diagram there. What is joined is taken at the level of the given objects,
99
+ * each as the object that sits in the same list of siblings as one of them (a shape inside a group stands for its group when
100
+ * the given objects are on the board, and is left alone when they are inside another group: a layer is only ever moved
101
+ * among its own siblings). In paint order, with no repeats. The same ids, normalised, when nothing is joined.
102
+ */
103
+ export declare function withConnectedObjects(scene: Scene, ids: Iterable<ObjectId>): ObjectId[];
82
104
  /**
83
105
  * Changes the paint order of the objects, each among its own siblings (a member of a group moves inside the
84
106
  * group, never out of it).