@excalidraw/excalidraw 0.16.1-7251-fc9c8cd → 0.16.1-7255-b963098

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/main.js CHANGED
@@ -1,4 +1,7 @@
1
- if (process.env.NODE_ENV === "production") {
1
+ console.log(window.IS_PREACT, "PREACT");
2
+ if (window.IS_PREACT) {
3
+ module.exports = require("./dist/excalidraw-with-preact.production.min.js");
4
+ } else if (process.env.NODE_ENV === "production") {
2
5
  module.exports = require("./dist/excalidraw.production.min.js");
3
6
  } else {
4
7
  module.exports = require("./dist/excalidraw.development.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.16.1-7251-fc9c8cd",
3
+ "version": "0.16.1-7255-b963098",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -78,7 +78,7 @@
78
78
  "homepage": "https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw",
79
79
  "scripts": {
80
80
  "gen:types": "tsc --project ../../../tsconfig-types.json",
81
- "build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && yarn gen:types",
81
+ "build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && NODE_ENV=production webpack --config webpack.preact.prod.config.js && yarn gen:types",
82
82
  "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
83
83
  "pack": "yarn build:umd && yarn pack",
84
84
  "start": "webpack serve --config webpack.dev-server.config.js",
@@ -0,0 +1 @@
1
+ export const ExcalidrawLib: {};
@@ -1,12 +1,13 @@
1
1
  import React from "react";
2
2
  import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
- import { ExcalidrawProps } from "../../types";
4
+ import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
5
5
  import Footer from "../../components/footer/FooterCenter";
6
6
  import MainMenu from "../../components/main-menu/MainMenu";
7
7
  import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
8
  import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
9
- export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => JSX.Element>;
9
+ type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
10
+ export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
10
11
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
11
12
  export { defaultLang, useI18n, languages } from "../../i18n";
12
13
  export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
@@ -0,0 +1,118 @@
1
+ import autoprefixer = require("autoprefixer");
2
+ import TerserPlugin = require("terser-webpack-plugin");
3
+ export const mode: string;
4
+ export const entry: {
5
+ "excalidraw-with-preact.production.min": string;
6
+ };
7
+ export namespace output {
8
+ const path: string;
9
+ const library: string;
10
+ const libraryTarget: string;
11
+ const filename: string;
12
+ const chunkFilename: string;
13
+ const assetModuleFilename: string;
14
+ const publicPath: string;
15
+ }
16
+ export namespace resolve {
17
+ const extensions: string[];
18
+ }
19
+ export namespace module {
20
+ const rules: ({
21
+ test: RegExp;
22
+ exclude: RegExp;
23
+ use: (string | {
24
+ loader: string;
25
+ options?: undefined;
26
+ } | {
27
+ loader: string;
28
+ options: {
29
+ postcssOptions: {
30
+ plugins: (import("postcss").Plugin & autoprefixer.ExportedAPI)[];
31
+ };
32
+ };
33
+ })[];
34
+ resolve?: undefined;
35
+ type?: undefined;
36
+ } | {
37
+ test: RegExp;
38
+ resolve: {
39
+ fullySpecified: boolean;
40
+ };
41
+ exclude?: undefined;
42
+ use?: undefined;
43
+ type?: undefined;
44
+ } | {
45
+ test: RegExp;
46
+ exclude: RegExp;
47
+ use: ({
48
+ loader: string;
49
+ options?: undefined;
50
+ } | {
51
+ loader: string;
52
+ options: {
53
+ transpileOnly: boolean;
54
+ configFile: string;
55
+ presets?: undefined;
56
+ plugins?: undefined;
57
+ };
58
+ } | {
59
+ loader: string;
60
+ options: {
61
+ presets: (string | (string | {
62
+ runtime: string;
63
+ })[])[];
64
+ plugins: string[];
65
+ transpileOnly?: undefined;
66
+ configFile?: undefined;
67
+ };
68
+ })[];
69
+ resolve?: undefined;
70
+ type?: undefined;
71
+ } | {
72
+ test: RegExp;
73
+ type: string;
74
+ exclude?: undefined;
75
+ use?: undefined;
76
+ resolve?: undefined;
77
+ })[];
78
+ }
79
+ export namespace optimization {
80
+ const minimize: boolean;
81
+ const minimizer: TerserPlugin<import("terser").MinifyOptions>[];
82
+ namespace splitChunks {
83
+ const chunks: string;
84
+ namespace cacheGroups {
85
+ namespace vendors {
86
+ const test: RegExp;
87
+ const name: string;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ export const plugins: any[];
93
+ export const externals: {
94
+ react: {
95
+ root: string;
96
+ commonjs2: string;
97
+ commonjs: string;
98
+ amd: string;
99
+ };
100
+ "react-dom": {
101
+ root: string;
102
+ commonjs2: string;
103
+ commonjs: string;
104
+ amd: string;
105
+ };
106
+ "react-dom/client": {
107
+ root: string;
108
+ commonjs2: string;
109
+ commonjs: string;
110
+ amd: string;
111
+ };
112
+ "react/jsx-runtime": {
113
+ root: string;
114
+ commonjs2: string;
115
+ commonjs: string;
116
+ amd: string;
117
+ };
118
+ };
package/types/types.d.ts CHANGED
@@ -5,7 +5,7 @@ import { LinearElementEditor } from "./element/linearElementEditor";
5
5
  import { SuggestedBinding } from "./element/binding";
6
6
  import { ImportedDataState } from "./data/types";
7
7
  import type App from "./components/App";
8
- import type { throttleRAF } from "./utils";
8
+ import type { ResolvablePromise, throttleRAF } from "./utils";
9
9
  import { Spreadsheet } from "./charts";
10
10
  import { Language } from "./i18n";
11
11
  import { ClipboardData } from "./clipboard";
@@ -16,7 +16,7 @@ import type { FileSystemHandle } from "./data/filesystem";
16
16
  import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
17
17
  import { ContextMenuItems } from "./components/ContextMenu";
18
18
  import { SnapLine } from "./snapping";
19
- import { Merge, ValueOf } from "./utility-types";
19
+ import { Merge, ForwardRef, ValueOf } from "./utility-types";
20
20
  export type Point = Readonly<RoughPoint>;
21
21
  export type Collaborator = {
22
22
  pointer?: CollaboratorPointer;
@@ -283,13 +283,17 @@ export type LibraryItem = {
283
283
  export type LibraryItems = readonly LibraryItem[];
284
284
  export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
285
285
  export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
286
+ export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
287
+ readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
288
+ ready?: false;
289
+ };
286
290
  export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
287
291
  libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
288
292
  }>;
289
293
  export interface ExcalidrawProps {
290
294
  onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
291
295
  initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
292
- excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
296
+ excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
293
297
  isCollaborating?: boolean;
294
298
  onPointerUpdate?: (payload: {
295
299
  pointer: {
@@ -471,6 +475,8 @@ export type ExcalidrawImperativeAPI = {
471
475
  refresh: InstanceType<typeof App>["refresh"];
472
476
  setToast: InstanceType<typeof App>["setToast"];
473
477
  addFiles: (data: BinaryFileData[]) => void;
478
+ readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
479
+ ready: true;
474
480
  id: string;
475
481
  setActiveTool: InstanceType<typeof App>["setActiveTool"];
476
482
  setCursor: InstanceType<typeof App>["setCursor"];