@zsviczian/excalidraw 0.17.6-2 → 0.17.6-4

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 (56) hide show
  1. package/dist/excalidraw.development.js +1409 -1299
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/styles.development.css +3 -3
  4. package/package.json +1 -1
  5. package/types/excalidraw/fonts/Cascadia/index.d.ts +2 -0
  6. package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
  7. package/types/excalidraw/fonts/Emoji/index.d.ts +2 -0
  8. package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +2 -8
  9. package/types/excalidraw/fonts/Excalifont/index.d.ts +2 -0
  10. package/types/excalidraw/fonts/FontMetadata.d.ts +37 -0
  11. package/types/excalidraw/fonts/Fonts.d.ts +85 -0
  12. package/types/excalidraw/fonts/Helvetica/index.d.ts +2 -0
  13. package/types/excalidraw/fonts/Liberation/index.d.ts +2 -0
  14. package/types/excalidraw/fonts/Lilita/index.d.ts +2 -0
  15. package/types/excalidraw/fonts/Nunito/index.d.ts +2 -0
  16. package/types/excalidraw/fonts/Virgil/index.d.ts +2 -0
  17. package/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -0
  18. package/types/excalidraw/fonts/index.d.ts +1 -87
  19. package/types/excalidraw/index.d.ts +2 -1
  20. package/types/excalidraw/keys.d.ts +107 -0
  21. package/types/excalidraw/obsidianUtils.d.ts +1 -1
  22. package/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -0
  23. package/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -0
  24. package/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -0
  25. package/types/excalidraw/subset/subset-main.d.ts +12 -0
  26. package/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -0
  27. package/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -0
  28. package/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -0
  29. package/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -0
  30. package/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -0
  31. package/types/excalidraw/types.d.ts +0 -1
  32. package/types/utils/export.d.ts +1 -1
  33. package/dist/excalidraw-assets/CascadiaCode-Regular.woff2 +0 -0
  34. package/dist/excalidraw-assets/ComicShanns-Regular.woff2 +0 -0
  35. package/dist/excalidraw-assets/Excalifont-Regular.woff2 +0 -0
  36. package/dist/excalidraw-assets/LiberationSans-Regular.woff2 +0 -0
  37. package/dist/excalidraw-assets/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  38. package/dist/excalidraw-assets/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  39. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  40. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  41. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  42. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  43. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  44. package/dist/excalidraw-assets/Virgil-Regular.woff2 +0 -0
  45. package/dist/excalidraw-assets-dev/CascadiaCode-Regular.woff2 +0 -0
  46. package/dist/excalidraw-assets-dev/ComicShanns-Regular.woff2 +0 -0
  47. package/dist/excalidraw-assets-dev/Excalifont-Regular.woff2 +0 -0
  48. package/dist/excalidraw-assets-dev/LiberationSans-Regular.woff2 +0 -0
  49. package/dist/excalidraw-assets-dev/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  50. package/dist/excalidraw-assets-dev/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  51. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  52. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  53. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  54. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  55. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  56. package/dist/excalidraw-assets-dev/Virgil-Regular.woff2 +0 -0
@@ -2,9 +2,9 @@
2
2
  !*** css ../../node_modules/css-loader/dist/cjs.js!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js!./css/variables.module.scss ***!
3
3
  \******************************************************************************************************************************************************************************************************/
4
4
 
5
- /*!************************************************************************************************************************************************************************************************!*\
6
- !*** css ../../node_modules/css-loader/dist/cjs.js!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js!./fonts/css/fonts.css ***!
7
- \************************************************************************************************************************************************************************************************/
5
+ /*!********************************************************************************************************************************************************************************************!*\
6
+ !*** css ../../node_modules/css-loader/dist/cjs.js!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js!./fonts/fonts.css ***!
7
+ \********************************************************************************************************************************************************************************************/
8
8
  /* Only UI fonts here, which are needed before the editor initializes. */
9
9
  /* These cannot be dynamically prepended with `EXCALIDRAW_ASSET_PATH`. */
10
10
  /* WARN: The following content is replaced during excalidraw-app build */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.17.6-2",
3
+ "version": "0.17.6-4",
4
4
  "main": "main.js",
5
5
  "types": "types/excalidraw/index.d.ts",
6
6
  "files": [
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const CascadiaFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const ComicShannsFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const EmojiFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -1,11 +1,5 @@
1
1
  type DataURL = string;
2
- export interface IExcalidrawFontFace {
3
- urls: URL[] | DataURL[];
4
- fontFace: FontFace;
5
- toCSS(characters: string, codePoints: Array<number>): Promise<string> | undefined;
6
- getContentLegacy(): Promise<string>;
7
- }
8
- export declare class ExcalidrawFontFace implements IExcalidrawFontFace {
2
+ export declare class ExcalidrawFontFace {
9
3
  readonly urls: URL[] | DataURL[];
10
4
  readonly fontFace: FontFace;
11
5
  private static readonly UNPKG_FALLBACK_URL;
@@ -15,7 +9,7 @@ export declare class ExcalidrawFontFace implements IExcalidrawFontFace {
15
9
  *
16
10
  * Retrieves `undefined` otherwise.
17
11
  */
18
- toCSS(characters: string, codePoints: Array<number>): Promise<string> | undefined;
12
+ toCSS(characters: string): Promise<string> | undefined;
19
13
  /**
20
14
  * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).
21
15
  *
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const ExcalifontFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Encapsulates font metrics with additional font metadata.
3
+ * */
4
+ export interface FontMetadata {
5
+ /** for head & hhea metrics read the woff2 with https://fontdrop.info/ */
6
+ metrics: {
7
+ /** head.unitsPerEm metric */
8
+ unitsPerEm: 1000 | 1024 | 2048;
9
+ /** hhea.ascender metric */
10
+ ascender: number;
11
+ /** hhea.descender metric */
12
+ descender: number;
13
+ /** harcoded unitless line-height, https://github.com/excalidraw/excalidraw/pull/6360#issuecomment-1477635971 */
14
+ lineHeight: number;
15
+ };
16
+ /** element to be displayed as an icon */
17
+ icon?: JSX.Element;
18
+ /** flag to indicate a deprecated font */
19
+ deprecated?: true;
20
+ /** flag to indicate a server-side only font */
21
+ serverSide?: true;
22
+ /** flag to indiccate a local-only font */
23
+ local?: true;
24
+ /** flag to indicate a fallback font */
25
+ fallback?: true;
26
+ }
27
+ export declare const FONT_METADATA: Record<number, FontMetadata>;
28
+ /** Unicode ranges defined by google fonts */
29
+ export declare const GOOGLE_FONTS_RANGES: {
30
+ LATIN: string;
31
+ LATIN_EXT: string;
32
+ CYRILIC_EXT: string;
33
+ CYRILIC: string;
34
+ VIETNAMESE: string;
35
+ };
36
+ /** local protocol to skip the local font from registering or inlining */
37
+ export declare const LOCAL_FONT_PROTOCOL = "local:";
@@ -0,0 +1,85 @@
1
+ import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
2
+ import { type FontMetadata } from "./FontMetadata";
3
+ import type { ExcalidrawElement, ExcalidrawTextElement, FontFamilyValues } from "../element/types";
4
+ import type Scene from "../scene/Scene";
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: ExcalidrawFontFace[];
12
+ }>;
13
+ get registered(): Map<number, {
14
+ metadata: FontMetadata;
15
+ fontFaces: ExcalidrawFontFace[];
16
+ }>;
17
+ private readonly scene;
18
+ constructor(scene: Scene);
19
+ /**
20
+ * if we load a (new) font, it's likely that text elements using it have
21
+ * already been rendered using a fallback font. Thus, we want invalidate
22
+ * their shapes and rerender. See #637.
23
+ *
24
+ * Invalidates text elements and rerenders scene, provided that at least one
25
+ * of the supplied fontFaces has not already been processed.
26
+ */
27
+ onLoaded: (fontFaces: readonly FontFace[]) => void;
28
+ /**
29
+ * Load font faces for a given scene and trigger scene update.
30
+ */
31
+ loadSceneFonts: () => Promise<FontFace[]>;
32
+ /**
33
+ * Load all registered font faces.
34
+ */
35
+ static loadAllFonts: () => Promise<FontFace[]>;
36
+ /**
37
+ * Load font faces for passed elements - use when the scene is unavailable (i.e. export).
38
+ */
39
+ static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
40
+ static loadFontFaces(fontFamilies: Array<ExcalidrawTextElement["fontFamily"]>): Promise<FontFace[]>;
41
+ /**
42
+ * WARN: should be called just once on init, even across multiple instances.
43
+ */
44
+ private static init;
45
+ /**
46
+ * Register a new font.
47
+ *
48
+ * @param family font family
49
+ * @param metadata font metadata
50
+ * @param fontFacesDecriptors font faces descriptors
51
+ */
52
+ static register(//zsviczian made public
53
+ this: Fonts | {
54
+ registered: Map<number, {
55
+ metadata: FontMetadata;
56
+ fontFaces: ExcalidrawFontFace[];
57
+ }>;
58
+ }, family: string, metadata: FontMetadata, ...fontFacesDecriptors: ExcalidrawFontFaceDescriptor[]): Map<number, {
59
+ metadata: FontMetadata;
60
+ fontFaces: ExcalidrawFontFace[];
61
+ }> | Map<number, {
62
+ metadata: FontMetadata;
63
+ fontFaces: ExcalidrawFontFace[];
64
+ }>;
65
+ /**
66
+ * Gets all the font families for the given scene.
67
+ */
68
+ getSceneFamilies: () => number[];
69
+ private static getAllFamilies;
70
+ static getElementsFamilies(elements: ReadonlyArray<ExcalidrawElement>): Array<ExcalidrawTextElement["fontFamily"]>;
71
+ }
72
+ /**
73
+ * Calculates vertical offset for a text with alphabetic baseline.
74
+ */
75
+ export declare const getVerticalOffset: (fontFamily: ExcalidrawTextElement["fontFamily"], fontSize: ExcalidrawTextElement["fontSize"], lineHeightPx: number) => number;
76
+ /**
77
+ * Gets line height forr a selected family.
78
+ */
79
+ export declare const getLineHeight: (fontFamily: FontFamilyValues) => number & {
80
+ _brand: "unitlessLineHeight";
81
+ };
82
+ export interface ExcalidrawFontFaceDescriptor {
83
+ uri: string;
84
+ descriptors?: FontFaceDescriptors;
85
+ }
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const HelveticaFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const LiberationFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const LilitaFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const NunitoFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const VirgilFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,8 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ /**
3
+ * The original font was modified with the following changes:
4
+ * - removed non-CJK codepoints
5
+ * - reduced any Hangul side-bearings to 40%
6
+ * - centered in width of inproperly centered CJK codepoints
7
+ */
8
+ export declare const XiaolaiFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -1,87 +1 @@
1
- import type Scene from "../scene/Scene";
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/css/fonts.css";
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";
@@ -23,6 +23,7 @@ getFontString, //zsviczian
23
23
  getBoundTextMaxWidth, //zsviczian
24
24
  mermaidToExcalidraw, //zsviczian
25
25
  destroyObsidianUtils, //zsviczian
26
+ initializeObsidianUtils, //zsviczian
26
27
  registerLocalFont, //zsviczian
27
28
  getFontFamilies, //zsviczian
28
29
  getFontFamilyString, //zsviczian
@@ -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/metadata";
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;
@@ -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,2 @@
1
+ declare const _default: Uint8Array;
2
+ 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;
@@ -0,0 +1,2 @@
1
+ declare const _default: Uint8Array;
2
+ export default _default;
@@ -475,7 +475,6 @@ export interface ExcalidrawProps {
475
475
  renderMermaid?: boolean;
476
476
  onContextMenu?: (element: readonly NonDeletedExcalidrawElement[], appState: AppState, onClose: (callback?: () => void) => void) => JSX.Element | null;
477
477
  aiEnabled?: boolean;
478
- obsidianHostPlugin: WeakRef<any>;
479
478
  showDeprecatedFonts?: boolean;
480
479
  }
481
480
  export type SceneData = {
@@ -41,4 +41,4 @@ export { getLineHeight } from "../excalidraw/fonts/index";
41
41
  export { getFontString, getFontFamilyString } from "../excalidraw/utils";
42
42
  export { getBoundTextMaxWidth } from "../excalidraw/element/textElement";
43
43
  export { mermaidToExcalidraw } from "../excalidraw/components/TTDDialog/MermaidToExcalidraw";
44
- export { destroyObsidianUtils, registerLocalFont, getFontFamilies, registerFontsInCSS, getCSSFontDefinition, loadSceneFonts, } from "../excalidraw/obsidianUtils";
44
+ export { destroyObsidianUtils, initializeObsidianUtils, registerLocalFont, getFontFamilies, registerFontsInCSS, getCSSFontDefinition, loadSceneFonts, } from "../excalidraw/obsidianUtils";