@dwelle/excalidraw 0.4.0-e1bdbb6 → 0.4.0-e587816

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 (240) hide show
  1. package/CHANGELOG.md +714 -0
  2. package/README.md +18 -1422
  3. package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js → vendor-d415b28e9024dee4bb1b.js} +2 -2
  4. package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
  5. package/dist/excalidraw.development.js +3257 -1444
  6. package/dist/excalidraw.production.min.js +1 -1
  7. package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
  8. package/main.js +1 -8
  9. package/package.json +9 -4
  10. package/types/actions/actionAddToLibrary.d.ts +124 -64
  11. package/types/actions/actionAlign.d.ts +33 -40
  12. package/types/actions/actionBoundText.d.ts +182 -25
  13. package/types/actions/actionCanvas.d.ts +754 -220
  14. package/types/actions/actionClipboard.d.ts +236 -115
  15. package/types/actions/actionDeleteSelected.d.ts +133 -72
  16. package/types/actions/actionDistribute.d.ts +11 -16
  17. package/types/actions/actionDuplicateSelection.d.ts +4 -7
  18. package/types/actions/actionElementLock.d.ts +271 -0
  19. package/types/actions/actionExport.d.ts +440 -277
  20. package/types/actions/actionFinalize.d.ts +85 -51
  21. package/types/actions/actionFlip.d.ts +8 -11
  22. package/types/actions/actionFrame.d.ts +423 -0
  23. package/types/actions/actionGroup.d.ts +252 -19
  24. package/types/actions/actionHistory.d.ts +1 -1
  25. package/types/actions/actionLinearEditor.d.ts +44 -24
  26. package/types/actions/actionMenu.d.ts +132 -79
  27. package/types/actions/actionNavigate.d.ts +2 -3
  28. package/types/actions/actionProperties.d.ts +569 -334
  29. package/types/actions/actionSelectAll.d.ts +123 -4
  30. package/types/actions/actionStyles.d.ts +46 -27
  31. package/types/actions/actionToggleGridMode.d.ts +46 -25
  32. package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +56 -35
  33. package/types/actions/actionToggleStats.d.ts +45 -25
  34. package/types/actions/actionToggleViewMode.d.ts +46 -25
  35. package/types/actions/actionToggleZenMode.d.ts +46 -25
  36. package/types/actions/actionZindex.d.ts +16 -24
  37. package/types/actions/index.d.ts +2 -1
  38. package/types/actions/manager.d.ts +3 -2
  39. package/types/actions/shortcuts.d.ts +2 -1
  40. package/types/actions/types.d.ts +16 -13
  41. package/types/appState.d.ts +27 -28
  42. package/types/charts.d.ts +2 -2
  43. package/types/clients.d.ts +5 -6
  44. package/types/clipboard.d.ts +9 -3
  45. package/types/colors.d.ts +60 -5
  46. package/types/components/Actions.d.ts +7 -12
  47. package/types/components/ActiveConfirmDialog.d.ts +4 -0
  48. package/types/components/App.d.ts +102 -86
  49. package/types/components/Avatar.d.ts +1 -2
  50. package/types/components/BraveMeasureTextError.d.ts +2 -0
  51. package/types/components/Button.d.ts +16 -0
  52. package/types/components/ButtonIconSelect.d.ts +11 -3
  53. package/types/components/Card.d.ts +6 -0
  54. package/types/components/ColorPicker/ColorInput.d.ts +9 -0
  55. package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
  56. package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
  57. package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
  58. package/types/components/ColorPicker/Picker.d.ts +18 -0
  59. package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
  60. package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
  61. package/types/components/ColorPicker/ShadeList.d.ts +8 -0
  62. package/types/components/ColorPicker/TopPicks.d.ts +9 -0
  63. package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
  64. package/types/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
  65. package/types/components/ContextMenu.d.ts +9 -22
  66. package/types/components/DefaultSidebar.d.ts +29 -0
  67. package/types/components/Dialog.d.ts +3 -4
  68. package/types/components/ErrorDialog.d.ts +3 -2
  69. package/types/components/ExcalidrawLogo.d.ts +15 -0
  70. package/types/components/EyeDropper.d.ts +28 -0
  71. package/types/components/FilledButton.d.ts +17 -0
  72. package/types/components/FixedSideContainer.d.ts +1 -1
  73. package/types/components/HandButton.d.ts +10 -0
  74. package/types/components/HelpButton.d.ts +1 -2
  75. package/types/components/HintViewer.d.ts +4 -5
  76. package/types/components/HomeButton.d.ts +1 -1
  77. package/types/components/ImageExportDialog.d.ts +8 -13
  78. package/types/components/Island.d.ts +1 -1
  79. package/types/components/JSONExportDialog.d.ts +7 -5
  80. package/types/components/LaserTool/LaserPathManager.d.ts +28 -0
  81. package/types/components/LaserTool/LaserPointerButton.d.ts +10 -0
  82. package/types/components/LaserTool/LaserTool.d.ts +7 -0
  83. package/types/components/LayerUI.d.ts +11 -19
  84. package/types/components/LibraryMenu.d.ts +13 -14
  85. package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
  86. package/types/components/LibraryMenuControlButtons.d.ts +9 -0
  87. package/types/components/LibraryMenuHeaderContent.d.ts +10 -5
  88. package/types/components/LibraryMenuItems.d.ts +6 -7
  89. package/types/components/LibraryMenuSection.d.ts +22 -0
  90. package/types/components/LibraryUnit.d.ts +6 -3
  91. package/types/components/LoadingMessage.d.ts +0 -1
  92. package/types/components/LockButton.d.ts +1 -2
  93. package/types/components/MobileMenu.d.ts +9 -15
  94. package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
  95. package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
  96. package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  97. package/types/components/PasteChartDialog.d.ts +4 -5
  98. package/types/components/PenModeButton.d.ts +1 -1
  99. package/types/components/Popover.d.ts +1 -1
  100. package/types/components/ProjectName.d.ts +2 -1
  101. package/types/components/PublishLibrary.d.ts +2 -2
  102. package/types/components/RadioGroup.d.ts +12 -0
  103. package/types/components/Section.d.ts +1 -1
  104. package/types/components/Sidebar/Sidebar.d.ts +66 -63
  105. package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
  106. package/types/components/Sidebar/SidebarTab.d.ts +8 -0
  107. package/types/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
  108. package/types/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
  109. package/types/components/Sidebar/SidebarTabs.d.ts +6 -0
  110. package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
  111. package/types/components/Sidebar/common.d.ts +24 -7
  112. package/types/components/Spinner.d.ts +2 -1
  113. package/types/components/Stack.d.ts +4 -3
  114. package/types/components/Stats.d.ts +3 -3
  115. package/types/components/Switch.d.ts +9 -0
  116. package/types/components/ToolButton.d.ts +6 -5
  117. package/types/components/Tooltip.d.ts +1 -1
  118. package/types/components/Trans.d.ts +9 -0
  119. package/types/components/UserList.d.ts +0 -2
  120. package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
  121. package/types/components/canvases/StaticCanvas.d.ts +18 -0
  122. package/types/components/canvases/index.d.ts +3 -0
  123. package/types/components/dropdownMenu/DropdownMenu.d.ts +70 -0
  124. package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
  125. package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
  126. package/types/components/dropdownMenu/DropdownMenuItem.d.ts +13 -0
  127. package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
  128. package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
  129. package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +14 -0
  130. package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
  131. package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -0
  132. package/types/components/dropdownMenu/common.d.ts +6 -0
  133. package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
  134. package/types/components/footer/Footer.d.ts +12 -0
  135. package/types/components/footer/FooterCenter.d.ts +8 -0
  136. package/types/components/hoc/withInternalFallback.d.ts +4 -0
  137. package/types/components/icons.d.ts +17 -2
  138. package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -0
  139. package/types/components/main-menu/DefaultItems.d.ts +47 -0
  140. package/types/components/main-menu/MainMenu.d.ts +64 -0
  141. package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +57 -0
  142. package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
  143. package/types/components/welcome-screen/WelcomeScreen.d.ts +84 -0
  144. package/types/constants.d.ts +105 -18
  145. package/types/context/tunnels.d.ts +19 -0
  146. package/types/context/ui-appState.d.ts +4 -0
  147. package/types/cursor.d.ts +5 -0
  148. package/types/data/blob.d.ts +5 -3
  149. package/types/data/encode.d.ts +1 -1
  150. package/types/data/filesystem.d.ts +2 -1
  151. package/types/data/index.d.ts +1 -1
  152. package/types/data/library.d.ts +3 -45
  153. package/types/data/restore.d.ts +10 -4
  154. package/types/data/transform.d.ts +73 -0
  155. package/types/data/types.d.ts +3 -5
  156. package/types/data/url.d.ts +7 -0
  157. package/types/element/Hyperlink.d.ts +57 -36
  158. package/types/element/binding.d.ts +4 -3
  159. package/types/element/bounds.d.ts +41 -10
  160. package/types/element/collision.d.ts +7 -7
  161. package/types/element/dragElements.d.ts +12 -2
  162. package/types/element/embeddable.d.ts +153 -0
  163. package/types/element/image.d.ts +11 -1
  164. package/types/element/index.d.ts +3 -2
  165. package/types/element/linearElementEditor.d.ts +77 -30
  166. package/types/element/mutateElement.d.ts +3 -2
  167. package/types/element/newElement.d.ts +48 -15
  168. package/types/element/resizeElements.d.ts +3 -3
  169. package/types/element/resizeTest.d.ts +2 -1
  170. package/types/element/showSelectedShapeActions.d.ts +2 -2
  171. package/types/element/sizeHelpers.d.ts +8 -1
  172. package/types/element/sortElements.d.ts +2 -0
  173. package/types/element/textElement.d.ts +57 -9
  174. package/types/element/textWysiwyg.d.ts +7 -2
  175. package/types/element/transformHandles.d.ts +15 -8
  176. package/types/element/typeChecks.d.ts +14 -2
  177. package/types/element/types.d.ts +66 -35
  178. package/types/emitter.d.ts +1 -2
  179. package/types/errors.d.ts +1 -1
  180. package/types/frame.d.ts +46 -0
  181. package/types/ga.d.ts +5 -5
  182. package/types/groups.d.ts +15 -11
  183. package/types/history.d.ts +3 -3
  184. package/types/hooks/useCreatePortalContainer.d.ts +4 -0
  185. package/types/hooks/useLibraryItemSvg.d.ts +11 -0
  186. package/types/hooks/useOutsideClick.d.ts +19 -2
  187. package/types/hooks/useScrollPosition.d.ts +1 -0
  188. package/types/hooks/useStable.d.ts +1 -0
  189. package/types/hooks/useTransition.d.ts +2 -0
  190. package/types/i18n.d.ts +11 -2
  191. package/types/jotai.d.ts +20 -108
  192. package/types/keys.d.ts +7 -4
  193. package/types/math.d.ts +7 -1
  194. package/types/packages/bbox.d.ts +11 -0
  195. package/types/packages/excalidraw/example/App.d.ts +7 -1
  196. package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
  197. package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
  198. package/types/packages/excalidraw/example/initialData.d.ts +182 -64
  199. package/types/packages/excalidraw/index.d.ts +22 -4
  200. package/types/packages/excalidraw/main.d.ts +3 -1
  201. package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
  202. package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
  203. package/types/packages/utils.d.ts +30 -24
  204. package/types/packages/withinBounds.d.ts +19 -0
  205. package/types/renderer/renderElement.d.ts +13 -22
  206. package/types/renderer/renderScene.d.ts +19 -29
  207. package/types/renderer/renderSnaps.d.ts +2 -0
  208. package/types/renderer/roundRect.d.ts +1 -1
  209. package/types/scene/Fonts.d.ts +21 -0
  210. package/types/scene/Renderer.d.ts +25 -0
  211. package/types/scene/Scene.d.ts +42 -5
  212. package/types/scene/Shape.d.ts +12 -0
  213. package/types/scene/ShapeCache.d.ts +20 -0
  214. package/types/scene/comparisons.d.ts +2 -4
  215. package/types/scene/export.d.ts +183 -10
  216. package/types/scene/index.d.ts +1 -1
  217. package/types/scene/scroll.d.ts +1 -1
  218. package/types/scene/scrollbars.d.ts +2 -6
  219. package/types/scene/selection.d.ts +27 -6
  220. package/types/scene/types.d.ts +70 -26
  221. package/types/snapping.d.ts +108 -0
  222. package/types/types.d.ts +227 -91
  223. package/types/utility-types.d.ts +24 -0
  224. package/types/utils.d.ts +75 -14
  225. package/types/zindex.d.ts +4 -4
  226. package/types/components/ActiveFile.d.ts +0 -7
  227. package/types/components/ClearCanvas.d.ts +0 -4
  228. package/types/components/CollabButton.d.ts +0 -6
  229. package/types/components/ColorPicker.d.ts +0 -14
  230. package/types/components/Footer.d.ts +0 -10
  231. package/types/components/LibraryButton.d.ts +0 -8
  232. package/types/components/MenuItem.d.ts +0 -11
  233. package/types/components/MenuUtils.d.ts +0 -1
  234. package/types/components/SingleLibraryItem.d.ts +0 -10
  235. package/types/components/WelcomeScreen.d.ts +0 -10
  236. package/types/components/WelcomeScreenDecor.d.ts +0 -6
  237. package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
  238. /package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js.LICENSE.txt → vendor-d415b28e9024dee4bb1b.js.LICENSE.txt} +0 -0
  239. /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.d.ts → vendor-d415b28e9024dee4bb1b.d.ts} +0 -0
  240. /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
@@ -1,21 +1,23 @@
1
1
  import { Point } from "../types";
2
- import { FONT_FAMILY, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
3
- export declare type ChartType = "bar" | "line";
4
- export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
5
- export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
6
- export declare type FontFamilyValues = typeof FONT_FAMILY[FontFamilyKeys];
7
- export declare type Theme = typeof THEME[keyof typeof THEME];
8
- export declare type FontString = string & {
2
+ import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
3
+ import { MarkNonNullable, ValueOf } from "../utility-types";
4
+ export type ChartType = "bar" | "line";
5
+ export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
6
+ export type FontFamilyKeys = keyof typeof FONT_FAMILY;
7
+ export type FontFamilyValues = typeof FONT_FAMILY[FontFamilyKeys];
8
+ export type Theme = typeof THEME[keyof typeof THEME];
9
+ export type FontString = string & {
9
10
  _brand: "fontString";
10
11
  };
11
- export declare type GroupId = string;
12
- export declare type PointerType = "mouse" | "pen" | "touch";
13
- export declare type StrokeSharpness = "round" | "sharp";
14
- export declare type StrokeStyle = "solid" | "dashed" | "dotted";
15
- export declare type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
16
- declare type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
17
- export declare type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
18
- declare type _ExcalidrawElementBase = Readonly<{
12
+ export type GroupId = string;
13
+ export type PointerType = "mouse" | "pen" | "touch";
14
+ export type StrokeRoundness = "round" | "sharp";
15
+ export type RoundnessType = ValueOf<typeof ROUNDNESS>;
16
+ export type StrokeStyle = "solid" | "dashed" | "dotted";
17
+ export type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
18
+ type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
19
+ export type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
20
+ type _ExcalidrawElementBase = Readonly<{
19
21
  id: string;
20
22
  x: number;
21
23
  y: number;
@@ -24,7 +26,10 @@ declare type _ExcalidrawElementBase = Readonly<{
24
26
  fillStyle: FillStyle;
25
27
  strokeWidth: number;
26
28
  strokeStyle: StrokeStyle;
27
- strokeSharpness: StrokeSharpness;
29
+ roundness: null | {
30
+ type: RoundnessType;
31
+ value?: number;
32
+ };
28
33
  roughness: number;
29
34
  opacity: number;
30
35
  width: number;
@@ -44,6 +49,7 @@ declare type _ExcalidrawElementBase = Readonly<{
44
49
  /** List of groups the element belongs to.
45
50
  Ordered from deepest to shallowest. */
46
51
  groupIds: readonly GroupId[];
52
+ frameId: string | null;
47
53
  /** other elements that are bound to this element */
48
54
  boundElements: readonly Readonly<{
49
55
  id: ExcalidrawLinearElement["id"];
@@ -55,19 +61,30 @@ declare type _ExcalidrawElementBase = Readonly<{
55
61
  locked: boolean;
56
62
  customData?: Record<string, any>;
57
63
  }>;
58
- export declare type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
64
+ export type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
59
65
  type: "selection";
60
66
  };
61
- export declare type ExcalidrawRectangleElement = _ExcalidrawElementBase & {
67
+ export type ExcalidrawRectangleElement = _ExcalidrawElementBase & {
62
68
  type: "rectangle";
63
69
  };
64
- export declare type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
70
+ export type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
65
71
  type: "diamond";
66
72
  };
67
- export declare type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
73
+ export type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
68
74
  type: "ellipse";
69
75
  };
70
- export declare type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
76
+ export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
77
+ type: "embeddable";
78
+ /**
79
+ * indicates whether the embeddable src (url) has been validated for rendering.
80
+ * null value indicates that the validation is pending. We reset the
81
+ * value on each restore (or url change) so that we can guarantee
82
+ * the validation came from a trusted source (the editor). Also because we
83
+ * may not have access to host-app supplied url validator during restore.
84
+ */
85
+ validated: boolean | null;
86
+ }>;
87
+ export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
71
88
  type: "image";
72
89
  fileId: FileId | null;
73
90
  /** whether respective file is persisted */
@@ -75,22 +92,26 @@ export declare type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
75
92
  /** X and Y scale factors <-1, 1>, used for image axis flipping */
76
93
  scale: [number, number];
77
94
  }>;
78
- export declare type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
95
+ export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
96
+ export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
97
+ type: "frame";
98
+ name: string | null;
99
+ };
79
100
  /**
80
101
  * These are elements that don't have any additional properties.
81
102
  */
82
- export declare type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
103
+ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
83
104
  /**
84
105
  * ExcalidrawElement should be JSON serializable and (eventually) contain
85
106
  * no computed data. The list of all ExcalidrawElements should be shareable
86
107
  * between peers and contain no state local to the peer.
87
108
  */
88
- export declare type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement;
89
- export declare type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
109
+ export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawEmbeddableElement;
110
+ export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
90
111
  isDeleted: boolean;
91
112
  };
92
- export declare type NonDeletedExcalidrawElement = NonDeleted<ExcalidrawElement>;
93
- export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
113
+ export type NonDeletedExcalidrawElement = NonDeleted<ExcalidrawElement>;
114
+ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
94
115
  type: "text";
95
116
  fontSize: number;
96
117
  fontFamily: FontFamilyValues;
@@ -100,19 +121,26 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
100
121
  verticalAlign: VerticalAlign;
101
122
  containerId: ExcalidrawGenericElement["id"] | null;
102
123
  originalText: string;
124
+ /**
125
+ * Unitless line height (aligned to W3C). To get line height in px, multiply
126
+ * with font size (using `getLineHeightInPx` helper).
127
+ */
128
+ lineHeight: number & {
129
+ _brand: "unitlessLineHeight";
130
+ };
103
131
  }>;
104
- export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
105
- export declare type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawImageElement;
106
- export declare type ExcalidrawTextElementWithContainer = {
132
+ export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement;
133
+ export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
134
+ export type ExcalidrawTextElementWithContainer = {
107
135
  containerId: ExcalidrawTextContainer["id"];
108
136
  } & ExcalidrawTextElement;
109
- export declare type PointBinding = {
137
+ export type PointBinding = {
110
138
  elementId: ExcalidrawBindableElement["id"];
111
139
  focus: number;
112
140
  gap: number;
113
141
  };
114
- export declare type Arrowhead = "arrow" | "bar" | "dot" | "triangle";
115
- export declare type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
142
+ export type Arrowhead = "arrow" | "bar" | "dot" | "triangle";
143
+ export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
116
144
  type: "line" | "arrow";
117
145
  points: readonly Point[];
118
146
  lastCommittedPoint: Point | null;
@@ -121,14 +149,17 @@ export declare type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<
121
149
  startArrowhead: Arrowhead | null;
122
150
  endArrowhead: Arrowhead | null;
123
151
  }>;
124
- export declare type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
152
+ export type ExcalidrawArrowElement = ExcalidrawLinearElement & Readonly<{
153
+ type: "arrow";
154
+ }>;
155
+ export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
125
156
  type: "freedraw";
126
157
  points: readonly Point[];
127
158
  pressures: readonly number[];
128
159
  simulatePressure: boolean;
129
160
  lastCommittedPoint: Point | null;
130
161
  }>;
131
- export declare type FileId = string & {
162
+ export type FileId = string & {
132
163
  _brand: "FileId";
133
164
  };
134
165
  export {};
@@ -1,4 +1,4 @@
1
- declare type Subscriber<T extends any[]> = (...payload: T) => void;
1
+ type Subscriber<T extends any[]> = (...payload: T) => void;
2
2
  export declare class Emitter<T extends any[] = []> {
3
3
  subscribers: Subscriber<T>[];
4
4
  value: T | undefined;
@@ -13,7 +13,6 @@ export declare class Emitter<T extends any[] = []> {
13
13
  * @returns unsubscribe function
14
14
  */
15
15
  on(...handlers: Subscriber<T>[] | Subscriber<T>[][]): () => void;
16
- once(...handlers: Subscriber<T>[] | Subscriber<T>[][]): () => void;
17
16
  off(...handlers: Subscriber<T>[] | Subscriber<T>[][]): void;
18
17
  trigger(...payload: T): any[];
19
18
  destroy(): void;
package/types/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare type CANVAS_ERROR_NAMES = "CANVAS_ERROR" | "CANVAS_POSSIBLY_TOO_BIG";
1
+ type CANVAS_ERROR_NAMES = "CANVAS_ERROR" | "CANVAS_POSSIBLY_TOO_BIG";
2
2
  export declare class CanvasError extends Error {
3
3
  constructor(message?: string, name?: CANVAS_ERROR_NAMES);
4
4
  }
@@ -0,0 +1,46 @@
1
+ import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
2
+ import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
3
+ import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
4
+ export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
+ export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameElement): boolean;
6
+ export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
7
+ export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
8
+ export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
9
+ export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => boolean;
10
+ export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
11
+ export declare const isCursorInFrame: (cursorCoords: {
12
+ x: number;
13
+ y: number;
14
+ }, frame: NonDeleted<ExcalidrawFrameElement>) => boolean;
15
+ export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
16
+ export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
17
+ /**
18
+ * Returns a map of frameId to frame elements. Includes empty frames.
19
+ */
20
+ export declare const groupByFrames: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
21
+ export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
22
+ export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
23
+ export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
24
+ export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
25
+ /**
26
+ * Retains (or repairs for target frame) the ordering invriant where children
27
+ * elements come right before the parent frame:
28
+ * [el, el, child, child, frame, el]
29
+ */
30
+ export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
31
+ export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
32
+ export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
33
+ export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
34
+ /** does not mutate elements, but returns new ones */
35
+ export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState, app: AppClassProperties) => ExcalidrawElementsIncludingDeleted;
36
+ /**
37
+ * filters out elements that are inside groups that contain a frame element
38
+ * anywhere in the group tree
39
+ */
40
+ export declare const omitGroupsContainingFrames: (allElements: ExcalidrawElementsIncludingDeleted, selectedElements?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
41
+ /**
42
+ * depending on the appState, return target frame, which is the frame the given element
43
+ * is going to be added to or remove from
44
+ */
45
+ export declare const getTargetFrame: (element: ExcalidrawElement, appState: StaticCanvasAppState) => ExcalidrawFrameElement | null;
46
+ export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState: StaticCanvasAppState) => boolean;
package/types/ga.d.ts CHANGED
@@ -16,15 +16,15 @@
16
16
  * See GAPoint, GALine, GADirection and GATransform modules for common
17
17
  * operations.
18
18
  */
19
- export declare type Point = NVector;
20
- export declare type Direction = NVector;
21
- export declare type Line = NVector;
22
- export declare type Transform = NVector;
19
+ export type Point = NVector;
20
+ export type Direction = NVector;
21
+ export type Line = NVector;
22
+ export type Transform = NVector;
23
23
  export declare const point: (x: number, y: number) => NVector;
24
24
  export declare const origin: () => NVector;
25
25
  export declare const direction: (x: number, y: number) => NVector;
26
26
  export declare const offset: (x: number, y: number) => NVector;
27
- declare type NVector = readonly [
27
+ type NVector = readonly [
28
28
  number,
29
29
  number,
30
30
  number,
package/types/groups.d.ts CHANGED
@@ -1,18 +1,21 @@
1
- import { GroupId, ExcalidrawElement, NonDeleted } from "./element/types";
2
- import { AppState } from "./types";
3
- export declare const selectGroup: (groupId: GroupId, appState: AppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => AppState;
1
+ import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
2
+ import { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
3
+ import { Mutable } from "./utility-types";
4
+ export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => Pick<InteractiveCanvasAppState, "selectedGroupIds" | "selectedElementIds" | "editingGroupId">;
5
+ export declare const selectGroupsForSelectedElements: {
6
+ (appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
7
+ clearCache(): void;
8
+ };
4
9
  /**
5
10
  * If the element's group is selected, don't render an individual
6
11
  * selection border around it.
7
12
  */
8
- export declare const isSelectedViaGroup: (appState: AppState, element: ExcalidrawElement) => boolean;
9
- export declare const getSelectedGroupForElement: (appState: AppState, element: ExcalidrawElement) => string | undefined;
10
- export declare const getSelectedGroupIds: (appState: AppState) => GroupId[];
11
- /**
12
- * When you select an element, you often want to actually select the whole group it's in, unless
13
- * you're currently editing that group.
14
- */
15
- export declare const selectGroupsForSelectedElements: (appState: AppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => AppState;
13
+ export declare const isSelectedViaGroup: (appState: InteractiveCanvasAppState, element: ExcalidrawElement) => boolean;
14
+ export declare const getSelectedGroupForElement: (appState: InteractiveCanvasAppState, element: ExcalidrawElement) => string | undefined;
15
+ export declare const getSelectedGroupIds: (appState: InteractiveCanvasAppState) => GroupId[];
16
+ export declare const selectGroupsFromGivenElements: (elements: readonly NonDeleted<ExcalidrawElement>[], appState: InteractiveCanvasAppState) => {
17
+ [groupId: string]: boolean;
18
+ };
16
19
  export declare const editGroupForSelectedElement: (appState: AppState, element: NonDeleted<ExcalidrawElement>) => AppState;
17
20
  export declare const isElementInGroup: (element: ExcalidrawElement, groupId: string) => boolean;
18
21
  export declare const getElementsInGroup: (elements: readonly ExcalidrawElement[], groupId: string) => ExcalidrawElement[];
@@ -25,3 +28,4 @@ export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["gro
25
28
  [groupId: string]: boolean;
26
29
  }) => string[];
27
30
  export declare const getMaximumGroups: (elements: ExcalidrawElement[]) => ExcalidrawElement[][];
31
+ export declare const elementsAreInSameGroup: (elements: ExcalidrawElement[]) => boolean;
@@ -5,9 +5,9 @@ export interface HistoryEntry {
5
5
  elements: ExcalidrawElement[];
6
6
  }
7
7
  declare const clearAppStatePropertiesForHistory: (appState: AppState) => {
8
- selectedElementIds: {
9
- [id: string]: boolean;
10
- };
8
+ selectedElementIds: Readonly<{
9
+ [id: string]: true;
10
+ }>;
11
11
  selectedGroupIds: {
12
12
  [groupId: string]: boolean;
13
13
  };
@@ -0,0 +1,4 @@
1
+ export declare const useCreatePortalContainer: (opts?: {
2
+ className?: string;
3
+ parentSelector?: string;
4
+ }) => HTMLDivElement | null;
@@ -0,0 +1,11 @@
1
+ import { LibraryItem } from "../types";
2
+ export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
3
+ export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
4
+ init: SvgCache;
5
+ };
6
+ export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache) => SVGSVGElement | undefined;
7
+ export declare const useLibraryCache: () => {
8
+ clearLibraryCache: () => void;
9
+ deleteItemsFromLibraryCache: (items: LibraryItem["id"][]) => void;
10
+ svgCache: SvgCache;
11
+ };
@@ -1,2 +1,19 @@
1
- /// <reference types="react" />
2
- export declare const useOutsideClickHook: (handler: (event: Event) => void) => import("react").MutableRefObject<null>;
1
+ export declare function useOutsideClick<T extends HTMLElement>(ref: React.RefObject<T>,
2
+ /** if performance is of concern, memoize the callback */
3
+ callback: (event: Event) => void,
4
+ /**
5
+ * Optional callback which is called on every click.
6
+ *
7
+ * Should return `true` if click should be considered as inside the container,
8
+ * and `false` if it falls outside and should call the `callback`.
9
+ *
10
+ * Returning `true` overrides the default behavior and `callback` won't be
11
+ * called.
12
+ *
13
+ * Returning `undefined` will fallback to the default behavior.
14
+ */
15
+ isInside?: (event: Event & {
16
+ target: HTMLElement;
17
+ },
18
+ /** the element of the passed ref */
19
+ container: T) => boolean | undefined): void;
@@ -0,0 +1 @@
1
+ export declare const useScrollPosition: <T extends HTMLElement>(elementRef: import("react").RefObject<T>) => number;
@@ -0,0 +1 @@
1
+ export declare const useStable: <T extends Record<string, any>>(value: T) => T;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const useTransition: typeof React.useTransition;
package/types/i18n.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ import fallbackLangData from "./locales/en.json";
2
+ import { NestedKeyOf } from "./utility-types";
1
3
  export interface Language {
2
4
  code: string;
3
5
  label: string;
4
6
  rtl?: boolean;
5
7
  }
8
+ export type TranslationKeys = NestedKeyOf<typeof fallbackLangData>;
6
9
  export declare const defaultLang: {
7
10
  code: string;
8
11
  label: string;
@@ -10,6 +13,12 @@ export declare const defaultLang: {
10
13
  export declare const languages: Language[];
11
14
  export declare const setLanguage: (lang: Language) => Promise<void>;
12
15
  export declare const getLanguage: () => Language;
13
- export declare const t: (path: string, replacement?: {
16
+ export declare const t: (path: NestedKeyOf<typeof fallbackLangData>, replacement?: {
14
17
  [key: string]: string | number;
15
- } | undefined) => string;
18
+ } | null | undefined, fallback?: string) => string;
19
+ export declare const useI18n: () => {
20
+ t: (path: NestedKeyOf<typeof fallbackLangData>, replacement?: {
21
+ [key: string]: string | number;
22
+ } | null | undefined, fallback?: string) => string;
23
+ langCode: string;
24
+ };
package/types/jotai.d.ts CHANGED
@@ -1,122 +1,34 @@
1
- import { WritableAtom } from "jotai";
1
+ import { PrimitiveAtom } from "jotai";
2
2
  export declare const jotaiScope: unique symbol;
3
3
  export declare const jotaiStore: {
4
- get: <Value>(atom: import("jotai").Atom<Value>) => (Value extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value) | undefined;
5
- asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Value_1 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_1>;
6
- set: <Value_2, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value_2, Update, Result>, update: Update) => Result;
7
- sub: (atom: {
8
- toString: () => string;
9
- debugLabel?: string | undefined;
10
- read: (get: {
11
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
12
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
13
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
14
- }) => unknown;
15
- }, callback: () => void) => () => void;
4
+ get: <Value>(atom: import("jotai").Atom<Value>) => Awaited<Value> | undefined;
5
+ asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Awaited<Value_1>>;
6
+ set: <Value_2, Update, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_2, Update, Result>, update: Update) => Result;
7
+ sub: (atom: import("jotai").Atom<unknown>, callback: () => void) => () => void;
16
8
  SECRET_INTERNAL_store: {
17
- r: <Value_6>(readingAtom: import("jotai").Atom<Value_6>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_6>;
18
- w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
19
- c: (_atom: {
20
- toString: () => string;
21
- debugLabel?: string | undefined;
22
- read: (get: {
23
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
24
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
25
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
26
- }) => unknown;
27
- } | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
28
- s: (atom: {
29
- toString: () => string;
30
- debugLabel?: string | undefined;
31
- read: (get: {
32
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
33
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
34
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
35
- }) => unknown;
36
- }, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
37
- h: (values: Iterable<readonly [{
38
- toString: () => string;
39
- debugLabel?: string | undefined;
40
- read: (get: {
41
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
42
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
43
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
44
- }) => unknown;
45
- }, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
9
+ r: <Value_3>(readingAtom: import("jotai").Atom<Value_3>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_3>;
10
+ w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
11
+ c: (_atom: import("jotai").Atom<unknown> | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
12
+ s: (atom: import("jotai").Atom<unknown>, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void, version?: import("jotai/core/store").VersionObject | undefined) => () => void;
13
+ h: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
46
14
  n: (l: () => void) => () => void;
47
- l: () => IterableIterator<{
48
- toString: () => string;
49
- debugLabel?: string | undefined;
50
- read: (get: {
51
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
52
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
53
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
54
- }) => unknown;
55
- }>;
56
- a: (a: {
57
- toString: () => string;
58
- debugLabel?: string | undefined;
59
- read: (get: {
60
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
61
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
62
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
63
- }) => unknown;
64
- }) => import("jotai/core/store").AtomState<unknown> | undefined;
65
- m: (a: {
66
- toString: () => string;
67
- debugLabel?: string | undefined;
68
- read: (get: {
69
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
70
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
71
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
72
- }) => unknown;
73
- }) => {
15
+ l: () => IterableIterator<import("jotai").Atom<unknown>>;
16
+ a: (a: import("jotai").Atom<unknown>) => import("jotai/core/store").AtomState<unknown> | undefined;
17
+ m: (a: import("jotai").Atom<unknown>) => {
74
18
  l: Set<(version?: import("jotai/core/store").VersionObject | undefined) => void>;
75
- t: Set<{
76
- toString: () => string;
77
- debugLabel?: string | undefined;
78
- read: (get: {
79
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
80
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
81
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
82
- }) => unknown;
83
- }>;
19
+ t: Set<import("jotai").Atom<unknown>>;
84
20
  u?: (() => void) | undefined;
85
21
  } | undefined;
86
22
  } | {
87
- r: <Value_7>(readingAtom: import("jotai").Atom<Value_7>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_7>;
88
- w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
89
- c: (_atom: {
90
- toString: () => string;
91
- debugLabel?: string | undefined;
92
- read: (get: {
93
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
94
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
95
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
96
- }) => unknown;
97
- } | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
98
- s: (atom: {
99
- toString: () => string;
100
- debugLabel?: string | undefined;
101
- read: (get: {
102
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
103
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
104
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
105
- }) => unknown;
106
- }, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
107
- h: (values: Iterable<readonly [{
108
- toString: () => string;
109
- debugLabel?: string | undefined;
110
- read: (get: {
111
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
112
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
113
- <Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
114
- }) => unknown;
115
- }, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
23
+ r: <Value_4>(readingAtom: import("jotai").Atom<Value_4>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_4>;
24
+ w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
25
+ c: (_atom: import("jotai").Atom<unknown> | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
26
+ s: (atom: import("jotai").Atom<unknown>, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void, version?: import("jotai/core/store").VersionObject | undefined) => () => void;
27
+ h: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
116
28
  n?: undefined;
117
29
  l?: undefined;
118
30
  a?: undefined;
119
31
  m?: undefined;
120
32
  };
121
33
  };
122
- export declare const useAtomWithInitialValue: <T extends unknown, A extends WritableAtom<T, T, void>>(atom: A, initialValue: T | (() => T)) => readonly [T extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : T, import("jotai/core/atom").SetAtom<T, void>];
34
+ export declare const useAtomWithInitialValue: <T extends unknown, A extends PrimitiveAtom<T>>(atom: A, initialValue: T | (() => T)) => readonly [Awaited<T>, import("jotai/core/atom").SetAtom<T | ((prev: T) => T), void>];
package/types/keys.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export declare const isDarwin: boolean;
2
- export declare const isWindows: boolean;
3
- export declare const isAndroid: boolean;
4
1
  export declare const CODES: {
5
2
  readonly EQUAL: "Equal";
6
3
  readonly MINUS: "Minus";
@@ -11,6 +8,7 @@ export declare const CODES: {
11
8
  readonly BRACKET_LEFT: "BracketLeft";
12
9
  readonly ONE: "Digit1";
13
10
  readonly TWO: "Digit2";
11
+ readonly THREE: "Digit3";
14
12
  readonly NINE: "Digit9";
15
13
  readonly QUOTE: "Quote";
16
14
  readonly ZERO: "Digit0";
@@ -21,12 +19,15 @@ export declare const CODES: {
21
19
  readonly V: "KeyV";
22
20
  readonly Z: "KeyZ";
23
21
  readonly R: "KeyR";
22
+ readonly S: "KeyS";
24
23
  };
25
24
  export declare const KEYS: {
26
25
  readonly ARROW_DOWN: "ArrowDown";
27
26
  readonly ARROW_LEFT: "ArrowLeft";
28
27
  readonly ARROW_RIGHT: "ArrowRight";
29
28
  readonly ARROW_UP: "ArrowUp";
29
+ readonly PAGE_UP: "PageUp";
30
+ readonly PAGE_DOWN: "PageDown";
30
31
  readonly BACKSPACE: "Backspace";
31
32
  readonly ALT: "Alt";
32
33
  readonly CTRL_OR_CMD: "metaKey" | "ctrlKey";
@@ -40,6 +41,7 @@ export declare const KEYS: {
40
41
  readonly CHEVRON_RIGHT: ">";
41
42
  readonly PERIOD: ".";
42
43
  readonly COMMA: ",";
44
+ readonly SUBTRACT: "-";
43
45
  readonly A: "a";
44
46
  readonly C: "c";
45
47
  readonly D: "d";
@@ -60,6 +62,7 @@ export declare const KEYS: {
60
62
  readonly Y: "y";
61
63
  readonly Z: "z";
62
64
  readonly K: "k";
65
+ readonly W: "w";
63
66
  readonly 0: "0";
64
67
  readonly 1: "1";
65
68
  readonly 2: "2";
@@ -71,7 +74,7 @@ export declare const KEYS: {
71
74
  readonly 8: "8";
72
75
  readonly 9: "9";
73
76
  };
74
- export declare type Key = keyof typeof KEYS;
77
+ export type Key = keyof typeof KEYS;
75
78
  export declare const isArrowKey: (key: string) => boolean;
76
79
  export declare const shouldResizeFromCenter: (event: MouseEvent | KeyboardEvent) => boolean;
77
80
  export declare const shouldMaintainAspectRatio: (event: MouseEvent | KeyboardEvent) => boolean;