@zsviczian/excalidraw 0.17.6-2 → 0.17.6-21

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 (138) hide show
  1. package/dist/excalidraw.development.js +13000 -1495
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +21 -1
  4. package/dist/styles.development.css +425 -347
  5. package/dist/styles.production.css +3 -2
  6. package/package.json +2 -3
  7. package/types/excalidraw/actions/actionAddToLibrary.d.ts +24 -0
  8. package/types/excalidraw/actions/actionBoundText.d.ts +16 -0
  9. package/types/excalidraw/actions/actionCanvas.d.ts +112 -0
  10. package/types/excalidraw/actions/actionClipboard.d.ts +48 -0
  11. package/types/excalidraw/actions/actionCropEditor.d.ts +222 -0
  12. package/types/excalidraw/actions/actionDeleteSelected.d.ts +24 -0
  13. package/types/excalidraw/actions/actionElementLink.d.ts +244 -0
  14. package/types/excalidraw/actions/actionElementLock.d.ts +16 -0
  15. package/types/excalidraw/actions/actionExport.d.ts +69 -0
  16. package/types/excalidraw/actions/actionFinalize.d.ts +16 -0
  17. package/types/excalidraw/actions/actionFrame.d.ts +32 -0
  18. package/types/excalidraw/actions/actionGroup.d.ts +16 -0
  19. package/types/excalidraw/actions/actionLinearEditor.d.ts +8 -0
  20. package/types/excalidraw/actions/actionLink.d.ts +9 -1
  21. package/types/excalidraw/actions/actionMenu.d.ts +21 -0
  22. package/types/excalidraw/actions/actionNavigate.d.ts +16 -0
  23. package/types/excalidraw/actions/actionProperties.d.ts +120 -0
  24. package/types/excalidraw/actions/actionSelectAll.d.ts +8 -0
  25. package/types/excalidraw/actions/actionStyles.d.ts +8 -0
  26. package/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -0
  27. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -0
  28. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +13 -0
  29. package/types/excalidraw/actions/actionToggleStats.d.ts +8 -0
  30. package/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -0
  31. package/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -0
  32. package/types/excalidraw/actions/index.d.ts +1 -0
  33. package/types/excalidraw/actions/types.d.ts +1 -1
  34. package/types/excalidraw/change.d.ts +2 -2
  35. package/types/excalidraw/clipboard.d.ts +27 -5
  36. package/types/excalidraw/components/App.d.ts +20 -5
  37. package/types/excalidraw/components/ElementLinkDialog.d.ts +11 -0
  38. package/types/excalidraw/components/LayerUI.d.ts +2 -1
  39. package/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +1 -7
  40. package/types/excalidraw/components/TTDDialog/MermaidToExcalidrawLib.d.ts +9 -0
  41. package/types/excalidraw/components/TTDDialog/common.d.ts +2 -2
  42. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  43. package/types/excalidraw/components/hyperlink/helpers.d.ts +1 -0
  44. package/types/excalidraw/components/icons.d.ts +2 -0
  45. package/types/excalidraw/constants.d.ts +5 -1
  46. package/types/excalidraw/data/blob.d.ts +4 -0
  47. package/types/excalidraw/data/encode.d.ts +6 -5
  48. package/types/excalidraw/data/image.d.ts +2 -2
  49. package/types/excalidraw/dist/excalidraw.production.min.d.ts +3 -1
  50. package/types/excalidraw/element/binding.d.ts +1 -1
  51. package/types/excalidraw/element/cropElement.d.ts +14 -0
  52. package/types/excalidraw/element/elementLink.d.ts +13 -0
  53. package/types/excalidraw/element/embeddable.d.ts +8 -0
  54. package/types/excalidraw/element/image.d.ts +1 -1
  55. package/types/excalidraw/element/newElement.d.ts +1 -0
  56. package/types/excalidraw/element/textElement.d.ts +14 -4
  57. package/types/excalidraw/element/textWrapping.d.ts +13 -0
  58. package/types/excalidraw/element/transformHandles.d.ts +1 -1
  59. package/types/excalidraw/element/types.d.ts +10 -0
  60. package/types/excalidraw/errors.d.ts +7 -0
  61. package/types/excalidraw/fonts/{woff2/Cascadia → Cascadia}/index.d.ts +1 -1
  62. package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
  63. package/types/excalidraw/fonts/{woff2/Emoji → Emoji}/index.d.ts +1 -1
  64. package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +2 -8
  65. package/types/excalidraw/fonts/{woff2/Excalifont → Excalifont}/index.d.ts +1 -1
  66. package/types/excalidraw/fonts/Fonts.d.ts +117 -0
  67. package/types/excalidraw/fonts/{woff2/Helvetica → Helvetica}/index.d.ts +1 -1
  68. package/types/excalidraw/fonts/{woff2/Liberation → Liberation}/index.d.ts +1 -1
  69. package/types/excalidraw/fonts/{woff2/Lilita → Lilita}/index.d.ts +1 -1
  70. package/types/excalidraw/fonts/{woff2/Nunito → Nunito}/index.d.ts +1 -1
  71. package/types/excalidraw/fonts/{woff2/Virgil → Virgil}/index.d.ts +1 -1
  72. package/types/excalidraw/fonts/{woff2/Xiaolai → Xiaolai}/index.d.ts +1 -1
  73. package/types/excalidraw/fonts/index.d.ts +1 -87
  74. package/types/excalidraw/index.d.ts +2 -1
  75. package/types/excalidraw/keys.d.ts +107 -0
  76. package/types/excalidraw/obsidianUtils.d.ts +5 -3
  77. package/types/excalidraw/renderer/renderElement.d.ts +3 -2
  78. package/types/excalidraw/scene/Scene.d.ts +1 -0
  79. package/types/excalidraw/scene/comparisons.d.ts +1 -0
  80. package/types/excalidraw/scene/export.d.ts +1 -0
  81. package/types/excalidraw/scene/types.d.ts +7 -0
  82. package/types/excalidraw/types.d.ts +24 -2
  83. package/types/math/utils.d.ts +1 -0
  84. package/types/math/vector.d.ts +4 -0
  85. package/types/utils/export.d.ts +5 -3
  86. package/dist/excalidraw-assets/CascadiaCode-Regular.woff2 +0 -0
  87. package/dist/excalidraw-assets/ComicShanns-Regular.woff2 +0 -0
  88. package/dist/excalidraw-assets/Excalifont-Regular.woff2 +0 -0
  89. package/dist/excalidraw-assets/LiberationSans-Regular.woff2 +0 -0
  90. package/dist/excalidraw-assets/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  91. package/dist/excalidraw-assets/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  92. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  93. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  94. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  95. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  96. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  97. package/dist/excalidraw-assets/Virgil-Regular.woff2 +0 -0
  98. package/dist/excalidraw-assets-dev/CascadiaCode-Regular.woff2 +0 -0
  99. package/dist/excalidraw-assets-dev/ComicShanns-Regular.woff2 +0 -0
  100. package/dist/excalidraw-assets-dev/Excalifont-Regular.woff2 +0 -0
  101. package/dist/excalidraw-assets-dev/LiberationSans-Regular.woff2 +0 -0
  102. package/dist/excalidraw-assets-dev/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  103. package/dist/excalidraw-assets-dev/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  104. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  105. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  106. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  107. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  108. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  109. package/dist/excalidraw-assets-dev/Virgil-Regular.woff2 +0 -0
  110. package/types/excalidraw/components/MagicSettings.d.ts +0 -8
  111. package/types/excalidraw/components/Stats.d.ts +0 -11
  112. package/types/excalidraw/data/magic.d.ts +0 -23
  113. package/types/excalidraw/fonts/ExcalidrawFont.d.ts +0 -37
  114. package/types/excalidraw/fonts/wasm/hb-subset.bindings.d.ts +0 -45
  115. package/types/excalidraw/fonts/wasm/hb-subset.loader.d.ts +0 -5
  116. package/types/excalidraw/fonts/wasm/hb-subset.wasm.d.ts +0 -2
  117. package/types/excalidraw/fonts/wasm/woff2.bindings.d.ts +0 -31
  118. package/types/excalidraw/fonts/wasm/woff2.loader.d.ts +0 -6
  119. package/types/excalidraw/fonts/wasm/woff2.wasm.d.ts +0 -2
  120. package/types/excalidraw/fonts/woff2/Comic/index.d.ts +0 -2
  121. package/types/excalidraw/ga.d.ts +0 -63
  122. package/types/excalidraw/gadirections.d.ts +0 -8
  123. package/types/excalidraw/galines.d.ts +0 -22
  124. package/types/excalidraw/gapoints.d.ts +0 -7
  125. package/types/excalidraw/gatransforms.d.ts +0 -10
  126. package/types/excalidraw/math.d.ts +0 -79
  127. package/types/excalidraw/scene/Fonts.d.ts +0 -19
  128. package/types/utils/geometry/geometry.d.ts +0 -89
  129. /package/types/excalidraw/fonts/{metadata.d.ts → FontMetadata.d.ts} +0 -0
  130. /package/types/excalidraw/{fonts/wasm/hb-subset-bindings.d.ts → subset/harfbuzz/harfbuzz-bindings.d.ts} +0 -0
  131. /package/types/excalidraw/{fonts/wasm/hb-subset-loader.d.ts → subset/harfbuzz/harfbuzz-loader.d.ts} +0 -0
  132. /package/types/excalidraw/{fonts/wasm/hb-subset-wasm.d.ts → subset/harfbuzz/harfbuzz-wasm.d.ts} +0 -0
  133. /package/types/excalidraw/{fonts/subset → subset}/subset-main.d.ts +0 -0
  134. /package/types/excalidraw/{fonts/subset → subset}/subset-shared.chunk.d.ts +0 -0
  135. /package/types/excalidraw/{fonts/subset → subset}/subset-worker.chunk.d.ts +0 -0
  136. /package/types/excalidraw/{fonts/wasm → subset/woff2}/woff2-bindings.d.ts +0 -0
  137. /package/types/excalidraw/{fonts/wasm → subset/woff2}/woff2-loader.d.ts +0 -0
  138. /package/types/excalidraw/{fonts/wasm → subset/woff2}/woff2-wasm.d.ts +0 -0
@@ -1,8 +0,0 @@
1
- import "./MagicSettings.scss";
2
- export declare const MagicSettings: (props: {
3
- openAIKey: string | null;
4
- isPersisted: boolean;
5
- onChange: (key: string, shouldPersist: boolean) => void;
6
- onConfirm: (key: string, shouldPersist: boolean) => void;
7
- onClose: () => void;
8
- }) => JSX.Element | null;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import type { NonDeletedExcalidrawElement } from "../element/types";
3
- import type { ExcalidrawProps, UIAppState } from "../types";
4
- import "./Stats.scss";
5
- export declare const Stats: (props: {
6
- appState: UIAppState;
7
- setAppState: React.Component<any, UIAppState>["setState"];
8
- elements: readonly NonDeletedExcalidrawElement[];
9
- onClose: () => void;
10
- renderCustomStats: ExcalidrawProps["renderCustomStats"];
11
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,23 +0,0 @@
1
- import type { Theme } from "../element/types";
2
- import type { DataURL } from "../types";
3
- import type { OpenAIOutput } from "./ai/types";
4
- export type MagicCacheData = {
5
- status: "pending";
6
- } | {
7
- status: "done";
8
- html: string;
9
- } | {
10
- status: "error";
11
- message?: string;
12
- code: "ERR_GENERATION_INTERRUPTED" | string;
13
- };
14
- export declare function diagramToHTML({ image, apiKey, text, theme, }: {
15
- image: DataURL;
16
- apiKey: string;
17
- text: string;
18
- theme?: Theme;
19
- }): Promise<({
20
- ok: true;
21
- } & OpenAIOutput.ChatCompletion) | ({
22
- ok: false;
23
- } & OpenAIOutput.APIError)>;
@@ -1,37 +0,0 @@
1
- export interface Font {
2
- urls: URL[];
3
- fontFace: FontFace;
4
- getContent(codePoints: ReadonlySet<number>): Promise<string>;
5
- getContentLegacy(): Promise<string>;
6
- }
7
- export declare const UNPKG_FALLBACK_URL: string;
8
- export declare class ExcalidrawFont implements Font {
9
- readonly urls: URL[];
10
- readonly fontFace: FontFace;
11
- constructor(family: string, uri: string, descriptors?: FontFaceDescriptors);
12
- /**
13
- * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).
14
- *
15
- * NOTE: assumes usage of `dataurl` outside the browser environment
16
- *
17
- * @returns base64 with subsetted glyphs based on the passed codepoint, last defined url otherwise
18
- */
19
- getContent(codePoints: ReadonlySet<number>): Promise<string>;
20
- /**
21
- * Tries to subset glyphs in a font based on the used codepoints, returning the font as daturl.
22
- *
23
- * @param arrayBuffer font data buffer, preferrably in the woff2 format, though others should work as well
24
- * @param codePoints codepoints used to subset the glyphs
25
- *
26
- * @returns font with subsetted glyphs (all glyphs in case of errors) converted into a dataurl
27
- */
28
- private static subsetGlyphsByCodePoints;
29
- private static toBase64;
30
- private static createUrls;
31
- private static getFormat;
32
- private static normalizeBaseUrl;
33
- /**
34
- * zsviczian https://github.com/zsviczian/excalidraw/commit/b4cfaaa4b4f46ca01f94e27fb7bf651a9da99daa
35
- */
36
- getContentLegacy(): Promise<string>;
37
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Modified version of hb-subset bindings from "subset-font" package https://github.com/papandreou/subset-font/blob/3f711c8aa29a426c7f22655861abfb976950f527/index.js
3
- *
4
- * CHANGELOG:
5
- * - removed dependency on node APIs to work inside the browser
6
- * - removed dependency on font fontverter for brotli compression
7
- * - removed dependencies on lodash and p-limit
8
- * - removed options for preserveNameIds, variationAxes, noLayoutClosure (not needed for now)
9
- * - replaced text input with codepoints
10
- * - rewritten in typescript and with esm modules
11
-
12
- Copyright (c) 2012, Andreas Lind Petersen
13
- All rights reserved.
14
-
15
- Redistribution and use in source and binary forms, with or without
16
- modification, are permitted provided that the following conditions are
17
- met:
18
-
19
- * Redistributions of source code must retain the above copyright
20
- notice, this list of conditions and the following disclaimer.
21
- * Redistributions in binary form must reproduce the above copyright
22
- notice, this list of conditions and the following disclaimer in
23
- the documentation and/or other materials provided with the
24
- distribution.
25
- * Neither the name of the author nor the names of contributors may
26
- be used to endorse or promote products derived from this
27
- software without specific prior written permission.
28
-
29
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
30
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
31
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
32
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
- */
41
- declare function subset(hbSubsetWasm: any, heapu8: Uint8Array, font: ArrayBuffer, codePoints: ReadonlySet<number>): Uint8Array;
42
- declare const _default: {
43
- subset: typeof subset;
44
- };
45
- export default _default;
@@ -1,5 +0,0 @@
1
- declare const load: () => Promise<{
2
- subset: (fontBuffer: ArrayBuffer, codePoints: ReadonlySet<number>) => Uint8Array;
3
- }>;
4
- declare const _default: () => ReturnType<typeof load>;
5
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: Uint8Array;
2
- export default _default;
@@ -1,31 +0,0 @@
1
- /**
2
- * Slitghly modified emscripten bindings of https://github.com/kekee000/fonteditor-core/blob/582bba757aa2915ec2240c61717ff12c50594675/woff2src/woff2.js
3
- *
4
- * CHANGELOG:
5
- * - replaced existing exports with default esm export (`export default Module;`)
6
- * - replaced "instanceof ArrayBuffer" with "Object.prototype.toString.call(d) === "[object ArrayBuffer]", due to unreliability of different ArrayBuffer instances depending on the context (i.e. inside VM)
7
-
8
- The MIT License (MIT)
9
-
10
- Copyright (c) 2014 ecomfe
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy
13
- of this software and associated documentation files (the "Software"), to deal
14
- in the Software without restriction, including without limitation the rights
15
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- copies of the Software, and to permit persons to whom the Software is
17
- furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- SOFTWARE.
29
- */
30
- declare const Module: (Module: any) => any;
31
- export default Module;
@@ -1,6 +0,0 @@
1
- declare const load: () => Promise<{
2
- compress: (buffer: ArrayBuffer) => Uint8Array;
3
- decompress: (buffer: ArrayBuffer) => Uint8Array;
4
- }>;
5
- declare const _default: () => ReturnType<typeof load>;
6
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: Uint8Array;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- import { type ExcalidrawFontFaceDescriptor } from "../..";
2
- export declare const ComicFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -1,63 +0,0 @@
1
- /**
2
- * This is a 2D Projective Geometric Algebra implementation.
3
- *
4
- * For wider context on geometric algebra visit see https://bivector.net.
5
- *
6
- * For this specific algebra see cheatsheet https://bivector.net/2DPGA.pdf.
7
- *
8
- * Converted from generator written by enki, with a ton of added on top.
9
- *
10
- * This library uses 8-vectors to represent points, directions and lines
11
- * in 2D space.
12
- *
13
- * An array `[a, b, c, d, e, f, g, h]` represents a n(8)vector:
14
- * a + b*e0 + c*e1 + d*e2 + e*e01 + f*e20 + g*e12 + h*e012
15
- *
16
- * See GAPoint, GALine, GADirection and GATransform modules for common
17
- * operations.
18
- */
19
- export type Point = NVector;
20
- export type Direction = NVector;
21
- export type Line = NVector;
22
- export type Transform = NVector;
23
- export declare const point: (x: number, y: number) => NVector;
24
- export declare const origin: () => NVector;
25
- export declare const direction: (x: number, y: number) => NVector;
26
- export declare const offset: (x: number, y: number) => NVector;
27
- type NVector = readonly [
28
- number,
29
- number,
30
- number,
31
- number,
32
- number,
33
- number,
34
- number,
35
- number
36
- ];
37
- export declare const nvector: (value?: number, index?: number) => NVector;
38
- export declare const toString: (nvector: NVector) => string;
39
- export declare const reverse: (nvector: NVector) => NVector;
40
- export declare const dual: (nvector: NVector) => NVector;
41
- export declare const conjugate: (nvector: NVector) => NVector;
42
- export declare const involute: (nvector: NVector) => NVector;
43
- export declare const add: (a: NVector, b: NVector | number) => NVector;
44
- export declare const sub: (a: NVector, b: NVector | number) => NVector;
45
- export declare const mul: (a: NVector, b: NVector | number) => NVector;
46
- export declare const mulScalar: (a: NVector, b: NVector) => number;
47
- export declare const meet: (a: NVector, b: NVector) => NVector;
48
- export declare const join: (a: NVector, b: NVector) => NVector;
49
- export declare const joinScalar: (a: NVector, b: NVector) => number;
50
- export declare const dot: (a: NVector, b: NVector) => NVector;
51
- export declare const norm: (a: NVector) => number;
52
- export declare const inorm: (a: NVector) => number;
53
- export declare const normalized: (a: NVector) => NVector;
54
- export declare const inormalized: (a: NVector) => NVector;
55
- export declare const E0: NVector;
56
- export declare const E1: NVector;
57
- export declare const E2: NVector;
58
- export declare const E01: NVector;
59
- export declare const E20: NVector;
60
- export declare const E12: NVector;
61
- export declare const E012: NVector;
62
- export declare const I: NVector;
63
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * A direction is stored as an array `[0, 0, 0, 0, y, x, 0, 0]` representing
3
- * vector `(x, y)`.
4
- */
5
- export declare const from: (point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
6
- export declare const fromTo: (from: readonly [number, number, number, number, number, number, number, number], to: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
7
- export declare const orthogonal: (direction: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
8
- export declare const orthogonalToLine: (line: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
@@ -1,22 +0,0 @@
1
- /**
2
- * A line is stored as an array `[0, c, a, b, 0, 0, 0, 0]` representing:
3
- * c * e0 + a * e1 + b*e2
4
- *
5
- * This maps to a standard formula `a * x + b * y + c`.
6
- *
7
- * `(-b, a)` corresponds to a 2D vector parallel to the line. The lines
8
- * have a natural orientation, corresponding to that vector.
9
- *
10
- * The magnitude ("norm") of the line is `sqrt(a ^ 2 + b ^ 2)`.
11
- * `c / norm(line)` is the oriented distance from line to origin.
12
- */
13
- export declare const vector: (x: number, y: number) => readonly [number, number, number, number, number, number, number, number];
14
- export declare const equation: (a: number, b: number, c: number) => readonly [number, number, number, number, number, number, number, number];
15
- export declare const through: (from: readonly [number, number, number, number, number, number, number, number], to: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
16
- export declare const orthogonal: (line: readonly [number, number, number, number, number, number, number, number], point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
17
- export declare const orthogonalThrough: (against: readonly [number, number, number, number, number, number, number, number], intersection: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
18
- export declare const parallel: (line: readonly [number, number, number, number, number, number, number, number], distance: number) => readonly [number, number, number, number, number, number, number, number];
19
- export declare const parallelThrough: (line: readonly [number, number, number, number, number, number, number, number], point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
20
- export declare const distance: (line1: readonly [number, number, number, number, number, number, number, number], line2: readonly [number, number, number, number, number, number, number, number]) => number;
21
- export declare const angle: (line1: readonly [number, number, number, number, number, number, number, number], line2: readonly [number, number, number, number, number, number, number, number]) => number;
22
- export declare const sign: (line: readonly [number, number, number, number, number, number, number, number]) => number;
@@ -1,7 +0,0 @@
1
- export declare const from: ([x, y]: readonly [number, number]) => readonly [number, number, number, number, number, number, number, number];
2
- export declare const toTuple: (point: readonly [number, number, number, number, number, number, number, number]) => [number, number];
3
- export declare const abs: (point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
4
- export declare const intersect: (line1: readonly [number, number, number, number, number, number, number, number], line2: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
5
- export declare const project: (point: readonly [number, number, number, number, number, number, number, number], line: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
6
- export declare const distance: (point1: readonly [number, number, number, number, number, number, number, number], point2: readonly [number, number, number, number, number, number, number, number]) => number;
7
- export declare const distanceToLine: (point: readonly [number, number, number, number, number, number, number, number], line: readonly [number, number, number, number, number, number, number, number]) => number;
@@ -1,10 +0,0 @@
1
- import type { Line, Direction, Point } from "./ga";
2
- /**
3
- * TODO: docs
4
- */
5
- export declare const rotation: (pivot: readonly [number, number, number, number, number, number, number, number], angle: number) => readonly [number, number, number, number, number, number, number, number];
6
- export declare const translation: (direction: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
7
- export declare const translationOrthogonal: (direction: readonly [number, number, number, number, number, number, number, number], distance: number) => readonly [number, number, number, number, number, number, number, number];
8
- export declare const translationAlong: (line: readonly [number, number, number, number, number, number, number, number], distance: number) => readonly [number, number, number, number, number, number, number, number];
9
- export declare const compose: (motor1: readonly [number, number, number, number, number, number, number, number], motor2: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
10
- export declare const apply: (motor: readonly [number, number, number, number, number, number, number, number], nvector: Point | Direction | Line) => Point | Direction | Line;
@@ -1,79 +0,0 @@
1
- import type { NullableGridSize, Point, Zoom } from "./types";
2
- import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./element/types";
3
- import type { Bounds } from "./element/bounds";
4
- export declare const rotate: (x: number, y: number, cx: number, cy: number, angle: number) => [number, number];
5
- export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
6
- export declare const adjustXYWithRotation: (sides: {
7
- n?: boolean;
8
- e?: boolean;
9
- s?: boolean;
10
- w?: boolean;
11
- }, x: number, y: number, angle: number, deltaX1: number, deltaY1: number, deltaX2: number, deltaY2: number) => [number, number];
12
- export declare const getPointOnAPath: (point: readonly [number, number], path: Point[]) => {
13
- x: number;
14
- y: number;
15
- segment: number;
16
- } | null;
17
- export declare const distance2d: (x1: number, y1: number, x2: number, y2: number) => number;
18
- export declare const distanceSq2d: (p1: readonly [number, number], p2: readonly [number, number]) => number;
19
- export declare const centerPoint: (a: readonly [number, number], b: readonly [number, number]) => readonly [number, number];
20
- export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
21
- export declare const isPointInPolygon: (points: Point[], x: number, y: number) => boolean;
22
- export declare const isPointWithinBounds: (p: readonly [number, number], q: readonly [number, number], r: readonly [number, number]) => boolean;
23
- export declare const getGridPoint: (x: number, y: number, gridSize: NullableGridSize) => [number, number];
24
- export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
25
- export declare const getControlPointsForBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][] | null;
26
- export declare const getBezierXY: (p0: readonly [number, number], p1: readonly [number, number], p2: readonly [number, number], p3: readonly [number, number], t: number) => number[];
27
- export declare const getPointsInBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][];
28
- export declare const getBezierCurveArcLengths: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number[];
29
- export declare const getBezierCurveLength: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number;
30
- export declare const mapIntervalToBezierT: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number], interval: number) => number;
31
- export declare const arePointsEqual: (p1: readonly [number, number], p2: readonly [number, number]) => boolean;
32
- export declare const isRightAngle: (angle: number) => boolean;
33
- export declare const radianToDegree: (r: number) => number;
34
- export declare const degreeToRadian: (d: number) => number;
35
- export declare const rangesOverlap: ([a0, a1]: [number, number], [b0, b1]: [number, number]) => boolean;
36
- export declare const rangeIntersection: (rangeA: [number, number], rangeB: [number, number]) => [number, number] | null;
37
- export declare const isValueInRange: (value: number, min: number, max: number) => boolean;
38
- export declare const translatePoint: (p: readonly [number, number], v: import("../utils/geometry/shape").Point) => readonly [number, number];
39
- export declare const scaleVector: (v: import("../utils/geometry/shape").Point, scalar: number) => import("../utils/geometry/shape").Point;
40
- export declare const pointToVector: (p: readonly [number, number], origin?: readonly [number, number]) => import("../utils/geometry/shape").Point;
41
- export declare const scalePointFromOrigin: (p: readonly [number, number], mid: readonly [number, number], multiplier: number) => readonly [number, number];
42
- export declare const PointInTriangle: (pt: readonly [number, number], v1: readonly [number, number], v2: readonly [number, number], v3: readonly [number, number]) => boolean;
43
- export declare const magnitudeSq: (vector: import("../utils/geometry/shape").Point) => number;
44
- export declare const magnitude: (vector: import("../utils/geometry/shape").Point) => number;
45
- export declare const normalize: (vector: import("../utils/geometry/shape").Point) => import("../utils/geometry/shape").Point;
46
- export declare const addVectors: (vec1: readonly [number, number], vec2: readonly [number, number]) => import("../utils/geometry/shape").Point;
47
- export declare const subtractVectors: (vec1: readonly [number, number], vec2: readonly [number, number]) => import("../utils/geometry/shape").Point;
48
- export declare const pointInsideBounds: (p: readonly [number, number], bounds: Bounds) => boolean;
49
- /**
50
- * Get the axis-aligned bounding box for a given element
51
- */
52
- export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, offset?: [number, number, number, number]) => Bounds;
53
- type PolarCoords = [number, number];
54
- /**
55
- * Return the polar coordinates for the given carthesian point represented by
56
- * (x, y) for the center point 0,0 where the first number returned is the radius,
57
- * the second is the angle in radians.
58
- */
59
- export declare const carthesian2Polar: ([x, y]: readonly [number, number]) => PolarCoords;
60
- /**
61
- * Angles are in radians and centered on 0, 0. Zero radians on a 1 radius circle
62
- * corresponds to (1, 0) carthesian coordinates (point), i.e. to the "right".
63
- */
64
- type SymmetricArc = {
65
- radius: number;
66
- startAngle: number;
67
- endAngle: number;
68
- };
69
- /**
70
- * Determines if a carthesian point lies on a symmetric arc, i.e. an arc which
71
- * is part of a circle contour centered on 0, 0.
72
- */
73
- export declare const isPointOnSymmetricArc: ({ radius: arcRadius, startAngle, endAngle }: SymmetricArc, point: readonly [number, number]) => boolean;
74
- export declare const getCenterForBounds: (bounds: Bounds) => readonly [number, number];
75
- export declare const getCenterForElement: (element: ExcalidrawElement) => readonly [number, number];
76
- export declare const aabbsOverlapping: (a: Bounds, b: Bounds) => boolean;
77
- export declare const clamp: (value: number, min: number, max: number) => number;
78
- export declare const round: (value: number, precision: number) => number;
79
- export {};
@@ -1,19 +0,0 @@
1
- import type { ExcalidrawElement } from "../element/types";
2
- import type Scene from "./Scene";
3
- export declare class Fonts {
4
- private scene;
5
- constructor({ scene }: {
6
- scene: Scene;
7
- });
8
- private static loadedFontFaces;
9
- /**
10
- * if we load a (new) font, it's likely that text elements using it have
11
- * already been rendered using a fallback font. Thus, we want invalidate
12
- * their shapes and rerender. See #637.
13
- *
14
- * Invalidates text elements and rerenders scene, provided that at least one
15
- * of the supplied fontFaces has not already been processed.
16
- */
17
- onFontsLoaded: (fontFaces: readonly FontFace[]) => false | undefined;
18
- loadFontsForElements: (elements: readonly ExcalidrawElement[]) => Promise<void>;
19
- }
@@ -1,89 +0,0 @@
1
- import type { ExcalidrawBindableElement } from "../../excalidraw/element/types";
2
- import type { LineSegment } from "../bbox";
3
- import type { Point, Line, Polygon, Curve, Ellipse, Polycurve, Polyline } from "./shape";
4
- /**
5
- * utils
6
- */
7
- export declare const cross: (a: readonly [number, number], b: readonly [number, number], o: readonly [number, number]) => number;
8
- export declare const dot: (a: readonly [number, number], b: readonly [number, number], o: readonly [number, number]) => number;
9
- export declare const isClosed: (polygon: Polygon) => boolean;
10
- export declare const close: (polygon: Polygon) => Polygon;
11
- /**
12
- * angles
13
- */
14
- export declare const angleToDegrees: (angle: number) => number;
15
- export declare const angleToRadians: (angle: number) => number;
16
- export declare const angleReflect: (incidenceAngle: number, surfaceAngle: number) => number;
17
- export declare const pointRotate: (point: Point, angle: number, origin?: Point) => Point;
18
- export declare const pointTranslate: (point: Point, angle?: number, distance?: number) => Point;
19
- export declare const pointInverse: (point: Point) => Point;
20
- export declare const pointAdd: (pointA: Point, pointB: Point) => Point;
21
- export declare const distanceToPoint: (p1: Point, p2: Point) => number;
22
- /**
23
- * lines
24
- */
25
- export declare const lineAngle: (line: Line) => number;
26
- export declare const lineLength: (line: Line) => number;
27
- export declare const lineMidpoint: (line: Line) => Point;
28
- export declare const lineRotate: (line: Line, angle: number, origin?: Point) => Line;
29
- export declare const lineTranslate: (line: Line, angle: number, distance: number) => Point[];
30
- export declare const lineInterpolate: (line: Line, clamp?: boolean) => (t: number) => Point;
31
- export declare const curveToBezier: (pointsIn: readonly Point[], curveTightness?: number) => Point[];
32
- export declare const curveRotate: (curve: Curve, angle: number, origin: Point) => Point[];
33
- export declare const cubicBezierPoint: (t: number, controlPoints: Curve) => Point;
34
- export declare const cubicBezierDistance: (point: Point, controlPoints: Curve) => number;
35
- /**
36
- * polygons
37
- */
38
- export declare const polygonRotate: (polygon: Polygon, angle: number, origin: Point) => Point[];
39
- export declare const polygonBounds: (polygon: Polygon) => [Point, Point];
40
- export declare const polygonCentroid: (vertices: Point[]) => Point;
41
- export declare const polygonScale: (polygon: Polygon, scale: number, origin?: Point) => Polygon;
42
- export declare const polygonScaleX: (polygon: Polygon, scale: number, origin?: Point) => Polygon;
43
- export declare const polygonScaleY: (polygon: Polygon, scale: number, origin?: Point) => Polygon;
44
- export declare const polygonReflectX: (polygon: Polygon, reflectFactor?: number) => Point[];
45
- export declare const polygonReflectY: (polygon: Polygon, reflectFactor?: number) => Point[];
46
- export declare const polygonTranslate: (polygon: Polygon, angle: number, distance: number) => Point[];
47
- /**
48
- * ellipses
49
- */
50
- export declare const ellipseAxes: (ellipse: Ellipse) => {
51
- majorAxis: number;
52
- minorAxis: number;
53
- };
54
- export declare const ellipseFocusToCenter: (ellipse: Ellipse) => number;
55
- export declare const ellipseExtremes: (ellipse: Ellipse) => Point[];
56
- export declare const pointRelativeToCenter: (point: Point, center: Point, angle: number) => Point;
57
- export declare const pointLeftofLine: (point: Point, line: Line) => boolean;
58
- export declare const pointRightofLine: (point: Point, line: Line) => boolean;
59
- export declare const distanceToSegment: (point: Point, line: Line) => number;
60
- export declare const pointOnLine: (point: Point, line: Line, threshold?: number) => boolean;
61
- export declare const pointOnPolyline: (point: Point, polyline: Polyline, threshold?: number) => boolean;
62
- export declare const lineIntersectsLine: (lineA: Line, lineB: Line) => boolean;
63
- export declare const lineIntersectsPolygon: (line: Line, polygon: Polygon) => boolean;
64
- export declare const pointInBezierEquation: (p0: Point, p1: Point, p2: Point, p3: Point, [mx, my]: Point, lineThreshold: number) => boolean;
65
- export declare const cubicBezierEquation: (curve: Curve) => (t: number, idx: number) => number;
66
- export declare const polyLineFromCurve: (curve: Curve, segments?: number) => Polyline;
67
- export declare const pointOnCurve: (point: Point, curve: Curve, threshold?: number) => boolean;
68
- export declare const pointOnPolycurve: (point: Point, polycurve: Polycurve, threshold?: number) => boolean;
69
- export declare const pointInPolygon: (point: Point, polygon: Polygon) => boolean;
70
- export declare const pointOnPolygon: (point: Point, polygon: Polygon, threshold?: number) => boolean;
71
- export declare const polygonInPolygon: (polygonA: Polygon, polygonB: Polygon) => boolean;
72
- export declare const polygonIntersectPolygon: (polygonA: Polygon, polygonB: Polygon) => boolean;
73
- export declare const pointOnEllipse: (point: Point, ellipse: Ellipse, threshold?: number) => boolean;
74
- export declare const pointInEllipse: (point: Point, ellipse: Ellipse) => boolean;
75
- /**
76
- * Calculates the point two line segments with a definite start and end point
77
- * intersect at.
78
- */
79
- export declare const segmentsIntersectAt: (a: readonly [readonly [number, number], readonly [number, number]], b: readonly [readonly [number, number], readonly [number, number]]) => Point | null;
80
- /**
81
- * Determine intersection of a rectangular shaped element and a
82
- * line segment.
83
- *
84
- * @param element The rectangular element to test against
85
- * @param segment The segment intersecting the element
86
- * @param gap Optional value to inflate the shape before testing
87
- * @returns An array of intersections
88
- */
89
- export declare const segmentIntersectRectangleElement: (element: ExcalidrawBindableElement, segment: LineSegment, gap?: number) => Point[];