@zsviczian/excalidraw 0.17.6-3 → 0.17.6-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +1439 -1307
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +3 -3
- package/package.json +1 -1
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +6 -0
- package/types/excalidraw/actions/actionBoundText.d.ts +4 -0
- package/types/excalidraw/actions/actionCanvas.d.ts +28 -0
- package/types/excalidraw/actions/actionClipboard.d.ts +12 -0
- package/types/excalidraw/actions/actionCropEditor.d.ts +216 -0
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +6 -0
- package/types/excalidraw/actions/actionElementLock.d.ts +4 -0
- package/types/excalidraw/actions/actionExport.d.ts +18 -0
- package/types/excalidraw/actions/actionFinalize.d.ts +4 -0
- package/types/excalidraw/actions/actionFrame.d.ts +8 -0
- package/types/excalidraw/actions/actionGroup.d.ts +4 -0
- package/types/excalidraw/actions/actionLinearEditor.d.ts +2 -0
- package/types/excalidraw/actions/actionLink.d.ts +2 -0
- package/types/excalidraw/actions/actionMenu.d.ts +6 -0
- package/types/excalidraw/actions/actionNavigate.d.ts +4 -0
- package/types/excalidraw/actions/actionProperties.d.ts +30 -0
- package/types/excalidraw/actions/actionSelectAll.d.ts +2 -0
- package/types/excalidraw/actions/actionStyles.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +4 -0
- package/types/excalidraw/actions/actionToggleStats.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -0
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -0
- package/types/excalidraw/actions/index.d.ts +1 -0
- package/types/excalidraw/actions/types.d.ts +1 -1
- package/types/excalidraw/change.d.ts +2 -2
- package/types/excalidraw/components/App.d.ts +10 -3
- package/types/excalidraw/components/icons.d.ts +1 -0
- package/types/excalidraw/element/cropElement.d.ts +14 -0
- package/types/excalidraw/element/embeddable.d.ts +2 -0
- package/types/excalidraw/element/newElement.d.ts +1 -0
- package/types/excalidraw/element/transformHandles.d.ts +1 -1
- package/types/excalidraw/element/types.d.ts +10 -0
- package/types/excalidraw/fonts/Cascadia/index.d.ts +2 -0
- package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
- package/types/excalidraw/fonts/Emoji/index.d.ts +2 -0
- package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +2 -8
- package/types/excalidraw/fonts/Excalifont/index.d.ts +2 -0
- package/types/excalidraw/fonts/FontMetadata.d.ts +37 -0
- package/types/excalidraw/fonts/Fonts.d.ts +85 -0
- package/types/excalidraw/fonts/Helvetica/index.d.ts +2 -0
- package/types/excalidraw/fonts/Liberation/index.d.ts +2 -0
- package/types/excalidraw/fonts/Lilita/index.d.ts +2 -0
- package/types/excalidraw/fonts/Nunito/index.d.ts +2 -0
- package/types/excalidraw/fonts/Virgil/index.d.ts +2 -0
- package/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -0
- package/types/excalidraw/fonts/index.d.ts +1 -87
- package/types/excalidraw/index.d.ts +1 -1
- package/types/excalidraw/keys.d.ts +107 -0
- package/types/excalidraw/obsidianUtils.d.ts +1 -1
- package/types/excalidraw/scene/comparisons.d.ts +1 -0
- package/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -0
- package/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -0
- package/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -0
- package/types/excalidraw/subset/subset-main.d.ts +12 -0
- package/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -0
- package/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -0
- package/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -0
- package/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -0
- package/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -0
- package/types/excalidraw/types.d.ts +7 -0
- package/types/math/utils.d.ts +1 -0
- package/types/math/vector.d.ts +4 -0
|
@@ -1,87 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ExcalidrawElement, ExcalidrawTextElement, FontFamilyValues } from "../element/types";
|
|
3
|
-
import { type FontMetadata } from "./metadata";
|
|
4
|
-
import { type IExcalidrawFontFace } from "./ExcalidrawFontFace";
|
|
5
|
-
export declare class Fonts {
|
|
6
|
-
static readonly loadedFontsCache: Set<string>;
|
|
7
|
-
private static _registered;
|
|
8
|
-
private static _initialized;
|
|
9
|
-
static get registered(): Map<number, {
|
|
10
|
-
metadata: FontMetadata;
|
|
11
|
-
fontFaces: IExcalidrawFontFace[];
|
|
12
|
-
}>;
|
|
13
|
-
get registered(): Map<number, {
|
|
14
|
-
metadata: FontMetadata;
|
|
15
|
-
fontFaces: IExcalidrawFontFace[];
|
|
16
|
-
}>;
|
|
17
|
-
private readonly scene;
|
|
18
|
-
constructor({ scene }: {
|
|
19
|
-
scene: Scene;
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* if we load a (new) font, it's likely that text elements using it have
|
|
23
|
-
* already been rendered using a fallback font. Thus, we want invalidate
|
|
24
|
-
* their shapes and rerender. See #637.
|
|
25
|
-
*
|
|
26
|
-
* Invalidates text elements and rerenders scene, provided that at least one
|
|
27
|
-
* of the supplied fontFaces has not already been processed.
|
|
28
|
-
*/
|
|
29
|
-
onLoaded: (fontFaces: readonly FontFace[]) => void;
|
|
30
|
-
/**
|
|
31
|
-
* Load font faces for a given scene and trigger scene update.
|
|
32
|
-
*/
|
|
33
|
-
loadSceneFonts: () => Promise<FontFace[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Load all registered font faces.
|
|
36
|
-
*/
|
|
37
|
-
static loadAllFonts: () => Promise<FontFace[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
40
|
-
*/
|
|
41
|
-
static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
|
|
42
|
-
static loadFontFaces(fontFamilies: Array<ExcalidrawTextElement["fontFamily"]>): Promise<FontFace[]>;
|
|
43
|
-
/**
|
|
44
|
-
* WARN: should be called just once on init, even across multiple instances.
|
|
45
|
-
*/
|
|
46
|
-
private static init;
|
|
47
|
-
/**
|
|
48
|
-
* Gets all the font families for the given scene.
|
|
49
|
-
*/
|
|
50
|
-
getSceneFamilies: () => number[];
|
|
51
|
-
private static getAllFamilies;
|
|
52
|
-
static getElementsFamilies(elements: ReadonlyArray<ExcalidrawElement>): Array<ExcalidrawTextElement["fontFamily"]>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Register a new font.
|
|
56
|
-
*
|
|
57
|
-
* @param family font family
|
|
58
|
-
* @param metadata font metadata
|
|
59
|
-
* @param fontFacesDecriptors font faces descriptors
|
|
60
|
-
*/
|
|
61
|
-
export declare function register(//zsviczian (changed from private to export)
|
|
62
|
-
this: Fonts | {
|
|
63
|
-
registered: Map<number, {
|
|
64
|
-
metadata: FontMetadata;
|
|
65
|
-
fontFaces: IExcalidrawFontFace[];
|
|
66
|
-
}>;
|
|
67
|
-
}, family: string, metadata: FontMetadata, ...fontFacesDecriptors: ExcalidrawFontFaceDescriptor[]): Map<number, {
|
|
68
|
-
metadata: FontMetadata;
|
|
69
|
-
fontFaces: IExcalidrawFontFace[];
|
|
70
|
-
}> | Map<number, {
|
|
71
|
-
metadata: FontMetadata;
|
|
72
|
-
fontFaces: IExcalidrawFontFace[];
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Calculates vertical offset for a text with alphabetic baseline.
|
|
76
|
-
*/
|
|
77
|
-
export declare const getVerticalOffset: (fontFamily: ExcalidrawTextElement["fontFamily"], fontSize: ExcalidrawTextElement["fontSize"], lineHeightPx: number) => number;
|
|
78
|
-
/**
|
|
79
|
-
* Gets line height forr a selected family.
|
|
80
|
-
*/
|
|
81
|
-
export declare const getLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
82
|
-
_brand: "unitlessLineHeight";
|
|
83
|
-
};
|
|
84
|
-
export interface ExcalidrawFontFaceDescriptor {
|
|
85
|
-
uri: string;
|
|
86
|
-
descriptors?: FontFaceDescriptors;
|
|
87
|
-
}
|
|
1
|
+
export * from "./Fonts";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./css/app.scss";
|
|
3
3
|
import "./css/styles.scss";
|
|
4
|
-
import "./fonts/
|
|
4
|
+
import "./fonts/fonts.css";
|
|
5
5
|
import type { ExcalidrawProps } from "./types";
|
|
6
6
|
import Footer from "./components/footer/FooterCenter";
|
|
7
7
|
import MainMenu from "./components/main-menu/MainMenu";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ValueOf } from "./utility-types";
|
|
1
2
|
export declare const CODES: {
|
|
2
3
|
readonly EQUAL: "Equal";
|
|
3
4
|
readonly MINUS: "Minus";
|
|
@@ -18,6 +19,7 @@ export declare const CODES: {
|
|
|
18
19
|
readonly H: "KeyH";
|
|
19
20
|
readonly V: "KeyV";
|
|
20
21
|
readonly Z: "KeyZ";
|
|
22
|
+
readonly Y: "KeyY";
|
|
21
23
|
readonly R: "KeyR";
|
|
22
24
|
readonly S: "KeyS";
|
|
23
25
|
};
|
|
@@ -76,6 +78,111 @@ export declare const KEYS: {
|
|
|
76
78
|
readonly 9: "9";
|
|
77
79
|
};
|
|
78
80
|
export type Key = keyof typeof KEYS;
|
|
81
|
+
export declare const KeyCodeMap: Map<ValueOf<{
|
|
82
|
+
readonly ARROW_DOWN: "ArrowDown";
|
|
83
|
+
readonly ARROW_LEFT: "ArrowLeft";
|
|
84
|
+
readonly ARROW_RIGHT: "ArrowRight";
|
|
85
|
+
readonly ARROW_UP: "ArrowUp";
|
|
86
|
+
readonly PAGE_UP: "PageUp";
|
|
87
|
+
readonly PAGE_DOWN: "PageDown";
|
|
88
|
+
readonly BACKSPACE: "Backspace";
|
|
89
|
+
readonly ALT: "Alt";
|
|
90
|
+
readonly CTRL_OR_CMD: "metaKey" | "ctrlKey";
|
|
91
|
+
readonly DELETE: "Delete";
|
|
92
|
+
readonly ENTER: "Enter";
|
|
93
|
+
readonly ESCAPE: "Escape";
|
|
94
|
+
readonly QUESTION_MARK: "?";
|
|
95
|
+
readonly SPACE: " ";
|
|
96
|
+
readonly TAB: "Tab";
|
|
97
|
+
readonly CHEVRON_LEFT: "<";
|
|
98
|
+
readonly CHEVRON_RIGHT: ">";
|
|
99
|
+
readonly PERIOD: ".";
|
|
100
|
+
readonly COMMA: ",";
|
|
101
|
+
readonly SUBTRACT: "-";
|
|
102
|
+
readonly SLASH: "/";
|
|
103
|
+
readonly A: "a";
|
|
104
|
+
readonly C: "c";
|
|
105
|
+
readonly D: "d";
|
|
106
|
+
readonly E: "e";
|
|
107
|
+
readonly F: "f";
|
|
108
|
+
readonly G: "g";
|
|
109
|
+
readonly H: "h";
|
|
110
|
+
readonly I: "i";
|
|
111
|
+
readonly L: "l";
|
|
112
|
+
readonly O: "o";
|
|
113
|
+
readonly P: "p";
|
|
114
|
+
readonly Q: "q";
|
|
115
|
+
readonly R: "r";
|
|
116
|
+
readonly S: "s";
|
|
117
|
+
readonly T: "t";
|
|
118
|
+
readonly V: "v";
|
|
119
|
+
readonly X: "x";
|
|
120
|
+
readonly Y: "y";
|
|
121
|
+
readonly Z: "z";
|
|
122
|
+
readonly K: "k";
|
|
123
|
+
readonly W: "w";
|
|
124
|
+
readonly 0: "0";
|
|
125
|
+
readonly 1: "1";
|
|
126
|
+
readonly 2: "2";
|
|
127
|
+
readonly 3: "3";
|
|
128
|
+
readonly 4: "4";
|
|
129
|
+
readonly 5: "5";
|
|
130
|
+
readonly 6: "6";
|
|
131
|
+
readonly 7: "7";
|
|
132
|
+
readonly 8: "8";
|
|
133
|
+
readonly 9: "9";
|
|
134
|
+
}>, ValueOf<{
|
|
135
|
+
readonly EQUAL: "Equal";
|
|
136
|
+
readonly MINUS: "Minus";
|
|
137
|
+
readonly NUM_ADD: "NumpadAdd";
|
|
138
|
+
readonly NUM_SUBTRACT: "NumpadSubtract";
|
|
139
|
+
readonly NUM_ZERO: "Numpad0";
|
|
140
|
+
readonly BRACKET_RIGHT: "BracketRight";
|
|
141
|
+
readonly BRACKET_LEFT: "BracketLeft";
|
|
142
|
+
readonly ONE: "Digit1";
|
|
143
|
+
readonly TWO: "Digit2";
|
|
144
|
+
readonly THREE: "Digit3";
|
|
145
|
+
readonly NINE: "Digit9";
|
|
146
|
+
readonly QUOTE: "Quote";
|
|
147
|
+
readonly ZERO: "Digit0";
|
|
148
|
+
readonly SLASH: "Slash";
|
|
149
|
+
readonly C: "KeyC";
|
|
150
|
+
readonly D: "KeyD";
|
|
151
|
+
readonly H: "KeyH";
|
|
152
|
+
readonly V: "KeyV";
|
|
153
|
+
readonly Z: "KeyZ";
|
|
154
|
+
readonly Y: "KeyY";
|
|
155
|
+
readonly R: "KeyR";
|
|
156
|
+
readonly S: "KeyS";
|
|
157
|
+
}>>;
|
|
158
|
+
export declare const isLatinChar: (key: string) => boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Used to match key events for any keyboard layout, especially on Windows and Linux,
|
|
161
|
+
* where non-latin character with modified (CMD) is not substituted with latin-based alternative.
|
|
162
|
+
*
|
|
163
|
+
* Uses `event.key` when it's latin, otherwise fallbacks to `event.code` (if mapping exists).
|
|
164
|
+
*
|
|
165
|
+
* Example of pressing "z" on different layouts, with the chosen key or code highlighted in []:
|
|
166
|
+
*
|
|
167
|
+
* Layout | Code | Key | Comment
|
|
168
|
+
* --------------------- | ----- | --- | -------
|
|
169
|
+
* U.S. | KeyZ | [z] |
|
|
170
|
+
* Czech | KeyY | [z] |
|
|
171
|
+
* Turkish | KeyN | [z] |
|
|
172
|
+
* French | KeyW | [z] |
|
|
173
|
+
* Macedonian | [KeyZ] | з | z with cmd; з is Cyrillic equivalent of z
|
|
174
|
+
* Russian | [KeyZ] | я | z with cmd
|
|
175
|
+
* Serbian | [KeyZ] | ѕ | z with cmd
|
|
176
|
+
* Greek | [KeyZ] | ζ | z with cmd; also ζ is Greek equivalent of z
|
|
177
|
+
* Hebrew | [KeyZ] | ז | z with cmd; also ז is Hebrew equivalent of z
|
|
178
|
+
* Pinyin - Simplified | KeyZ | [z] | due to IME
|
|
179
|
+
* Cangije - Traditional | [KeyZ] | 重 | z with cmd
|
|
180
|
+
* Japanese | [KeyZ] | つ | z with cmd
|
|
181
|
+
* 2-Set Korean | [KeyZ] | ㅋ | z with cmd
|
|
182
|
+
*
|
|
183
|
+
* More details in https://github.com/excalidraw/excalidraw/pull/5944
|
|
184
|
+
*/
|
|
185
|
+
export declare const matchKey: (event: KeyboardEvent | React.KeyboardEvent<Element>, key: ValueOf<typeof KEYS>) => boolean;
|
|
79
186
|
export declare const isArrowKey: (key: string) => boolean;
|
|
80
187
|
export declare const shouldResizeFromCenter: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
81
188
|
export declare const shouldMaintainAspectRatio: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import type { FontMetadata } from "./fonts/
|
|
2
|
+
import type { FontMetadata } from "./fonts/FontMetadata";
|
|
3
3
|
export declare let hostPlugin: any;
|
|
4
4
|
export declare function destroyObsidianUtils(): void;
|
|
5
5
|
export declare function initializeObsidianUtils(obsidianPlugin: any): void;
|
|
@@ -289,6 +289,7 @@ export declare const getElementAtPosition: (elements: readonly NonDeletedExcalid
|
|
|
289
289
|
fileId: import("../element/types").FileId | null;
|
|
290
290
|
status: "pending" | "saved" | "error";
|
|
291
291
|
scale: [number, number];
|
|
292
|
+
crop: import("../element/types").ImageCrop | null;
|
|
292
293
|
}> & {
|
|
293
294
|
isDeleted: boolean;
|
|
294
295
|
}) | (Readonly<{
|
|
@@ -0,0 +1,45 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.
|
|
3
|
+
*
|
|
4
|
+
* Including anything from the main chunk would include the whole chunk by default.
|
|
5
|
+
* Even it it would be tree-shaken during build, it won't be tree-shaken in dev.
|
|
6
|
+
*
|
|
7
|
+
* In the future consider separating common utils into a separate shared chunk.
|
|
8
|
+
*/
|
|
9
|
+
declare const load: () => Promise<{
|
|
10
|
+
subset: (fontBuffer: ArrayBuffer, codePoints: ReadonlySet<number>) => Uint8Array;
|
|
11
|
+
}>;
|
|
12
|
+
declare const _default: () => ReturnType<typeof load>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tries to subset glyphs in a font based on the used codepoints, returning the font as dataurl.
|
|
3
|
+
* Under the hood utilizes worker threads (Web Workers, if available), otherwise fallbacks to the main thread.
|
|
4
|
+
*
|
|
5
|
+
* Check the following diagram for details: link.excalidraw.com/readonly/MbbnWPSWXgadXdtmzgeO
|
|
6
|
+
*
|
|
7
|
+
* @param arrayBuffer font data buffer in the woff2 format
|
|
8
|
+
* @param codePoints codepoints used to subset the glyphs
|
|
9
|
+
*
|
|
10
|
+
* @returns font with subsetted glyphs (all glyphs in case of errors) converted into a dataurl
|
|
11
|
+
*/
|
|
12
|
+
export declare const subsetWoff2GlyphsByCodepoints: (arrayBuffer: ArrayBuffer, codePoints: Array<number>) => Promise<string>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.
|
|
3
|
+
*
|
|
4
|
+
* Including anything from the main chunk would include the whole chunk by default.
|
|
5
|
+
* Even it it would be tree-shaken during build, it won't be tree-shaken in dev.
|
|
6
|
+
*
|
|
7
|
+
* In the future consider separating common utils into a separate shared chunk.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Shared commands between the main thread and worker threads.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Commands: {
|
|
13
|
+
readonly Subset: "SUBSET";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Used by browser (main thread), node and jsdom, to subset the font based on the passed codepoints.
|
|
17
|
+
*
|
|
18
|
+
* @returns woff2 font as a base64 encoded string
|
|
19
|
+
*/
|
|
20
|
+
export declare const subsetToBase64: (arrayBuffer: ArrayBuffer, codePoints: Array<number>) => Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Used by browser (worker thread) and as part of `subsetToBase64`, to subset the font based on the passed codepoints.
|
|
23
|
+
*
|
|
24
|
+
* @eturns woff2 font as an ArrayBuffer, to avoid copying large strings between worker threads and the main thread.
|
|
25
|
+
*/
|
|
26
|
+
export declare const subsetToBinary: (arrayBuffer: ArrayBuffer, codePoints: Array<number>) => Promise<ArrayBuffer>;
|
|
27
|
+
/**
|
|
28
|
+
* Util for isomoprhic browser (main thread), node and jsdom usage.
|
|
29
|
+
*
|
|
30
|
+
* Isn't used inside the worker to avoid copying large binary strings (as dataurl) between worker threads and the main thread.
|
|
31
|
+
*/
|
|
32
|
+
export declare const toBase64: (arrayBuffer: ArrayBuffer) => Promise<string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.
|
|
3
|
+
*
|
|
4
|
+
* Including anything from the main chunk would include the whole chunk by default.
|
|
5
|
+
* Even it it would be tree-shaken during build, it won't be tree-shaken in dev.
|
|
6
|
+
*
|
|
7
|
+
* In the future consider separating common utils into a separate shared chunk.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Due to this export (and related dynamic import), this worker code will be included in the bundle automatically (as a separate chunk),
|
|
11
|
+
* without the need for esbuild / vite /rollup plugins and special browser / server treatment.
|
|
12
|
+
*
|
|
13
|
+
* `import.meta.url` is undefined in nodejs
|
|
14
|
+
*/
|
|
15
|
+
export declare const WorkerUrl: URL | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.
|
|
3
|
+
*
|
|
4
|
+
* Including anything from the main chunk would include the whole chunk by default.
|
|
5
|
+
* Even it it would be tree-shaken during build, it won't be tree-shaken in dev.
|
|
6
|
+
*
|
|
7
|
+
* In the future consider separating common utils into a separate shared chunk.
|
|
8
|
+
*/
|
|
9
|
+
declare const load: () => Promise<{
|
|
10
|
+
compress: (buffer: ArrayBuffer) => Uint8Array;
|
|
11
|
+
decompress: (buffer: ArrayBuffer) => Uint8Array;
|
|
12
|
+
}>;
|
|
13
|
+
declare const _default: () => ReturnType<typeof load>;
|
|
14
|
+
export default _default;
|
|
@@ -123,6 +123,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
123
123
|
gridColor: AppState["gridColor"];
|
|
124
124
|
frameColor: AppState["frameColor"];
|
|
125
125
|
currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
|
|
126
|
+
croppingElementId: AppState["croppingElementId"];
|
|
126
127
|
}>;
|
|
127
128
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
128
129
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
@@ -141,6 +142,8 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
141
142
|
editingTextElement: AppState["editingTextElement"];
|
|
142
143
|
gridColor: AppState["gridColor"];
|
|
143
144
|
highlightSearchResult: AppState["highlightSearchResult"];
|
|
145
|
+
isCropping: AppState["isCropping"];
|
|
146
|
+
croppingElementId: AppState["croppingElementId"];
|
|
144
147
|
searchMatches: AppState["searchMatches"];
|
|
145
148
|
}>;
|
|
146
149
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
@@ -154,6 +157,7 @@ export type ObservedElementsAppState = {
|
|
|
154
157
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
155
158
|
editingLinearElementId: LinearElementEditor["elementId"] | null;
|
|
156
159
|
selectedLinearElementId: LinearElementEditor["elementId"] | null;
|
|
160
|
+
croppingElementId: AppState["croppingElementId"];
|
|
157
161
|
};
|
|
158
162
|
export interface AppState {
|
|
159
163
|
contextMenu: {
|
|
@@ -358,6 +362,9 @@ export interface AppState {
|
|
|
358
362
|
userToFollow: UserToFollow | null;
|
|
359
363
|
/** the socket ids of the users following the current user */
|
|
360
364
|
followedBy: Set<SocketId>;
|
|
365
|
+
/** image cropping */
|
|
366
|
+
isCropping: boolean;
|
|
367
|
+
croppingElementId: ExcalidrawElement["id"] | null;
|
|
361
368
|
searchMatches: readonly SearchMatch[];
|
|
362
369
|
}
|
|
363
370
|
type SearchMatch = {
|
package/types/math/utils.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare const round: (value: number, precision: number, func?: "round" |
|
|
|
4
4
|
export declare const roundToStep: (value: number, step: number, func?: "round" | "floor" | "ceil") => number;
|
|
5
5
|
export declare const average: (a: number, b: number) => number;
|
|
6
6
|
export declare const isFiniteNumber: (value: any) => value is number;
|
|
7
|
+
export declare const isCloseTo: (a: number, b: number, precision?: number) => boolean;
|
package/types/math/vector.d.ts
CHANGED
|
@@ -86,3 +86,7 @@ export declare function vectorMagnitude(v: Vector): number;
|
|
|
86
86
|
* @returns The new normalized vector
|
|
87
87
|
*/
|
|
88
88
|
export declare const vectorNormalize: (v: Vector) => Vector;
|
|
89
|
+
/**
|
|
90
|
+
* Project the first vector onto the second vector
|
|
91
|
+
*/
|
|
92
|
+
export declare const vectorProjection: (a: Vector, b: Vector) => Vector;
|