@haklex/rich-ext-excalidraw 0.13.0 → 0.14.1
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/{ExcalidrawDisplayRenderer-B7O4vCQU.js → ExcalidrawDisplayRenderer-BWsFJSQ7.js} +25 -60
- package/dist/ExcalidrawDisplayRenderer.d.ts +8 -1
- package/dist/ExcalidrawDisplayRenderer.d.ts.map +1 -1
- package/dist/ExcalidrawExpandShell.d.ts +9 -0
- package/dist/ExcalidrawExpandShell.d.ts.map +1 -0
- package/dist/ExcalidrawNode.d.ts.map +1 -1
- package/dist/ExcalidrawSSRRenderer.d.ts +2 -0
- package/dist/ExcalidrawSSRRenderer.d.ts.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/slot.d.ts +11 -0
- package/dist/slot.d.ts.map +1 -0
- package/dist/static.d.ts +8 -3
- package/dist/static.d.ts.map +1 -1
- package/dist/static.mjs +4 -4
- package/dist/{transformer-BCGsvNcN.js → transformer-zBd4ibNw.js} +40 -9
- package/package.json +5 -5
- package/dist/{ExcalidrawEditRenderer-D_SZsItu.js → ExcalidrawEditRenderer-BlJTjnpV.js} +1 -1
package/dist/{ExcalidrawDisplayRenderer-B7O4vCQU.js → ExcalidrawDisplayRenderer-BWsFJSQ7.js}
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
-
import { D as excalidrawStaticContainer,
|
|
2
|
+
import { D as excalidrawStaticContainer, T as excalidrawLoading, c as excalidrawActionGroup, k as readonlyUIOptions, s as excalidrawActionButton, t as useExcalidrawData, x as excalidrawError } from "./useExcalidrawData-DcXa8vqV.js";
|
|
3
3
|
import { Component, useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useColorScheme } from "@haklex/rich-editor";
|
|
6
|
-
import {
|
|
7
|
-
import { usePortalTheme } from "@haklex/rich-style-token";
|
|
8
|
-
import { Maximize2, ScanSearch, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
6
|
+
import { Maximize2, ScanSearch, ZoomIn, ZoomOut } from "lucide-react";
|
|
9
7
|
//#region \0@oxc-project+runtime@0.127.0/helpers/typeof.js
|
|
10
8
|
function _typeof(o) {
|
|
11
9
|
"@babel/helpers - typeof";
|
|
@@ -46,52 +44,18 @@ function _defineProperty(e, r, t) {
|
|
|
46
44
|
//#endregion
|
|
47
45
|
//#region src/ExcalidrawDisplayRenderer.tsx
|
|
48
46
|
var ExcalidrawDisplayRenderer_exports = /* @__PURE__ */ __exportAll({ ExcalidrawDisplayRenderer: () => ExcalidrawDisplayRenderer });
|
|
49
|
-
var ExcalidrawDisplayRenderer = ({ snapshot }) => {
|
|
47
|
+
var ExcalidrawDisplayRenderer = ({ onExpand, snapshot }) => {
|
|
50
48
|
return /* @__PURE__ */ jsx(ExcalidrawStaticCanvas, {
|
|
51
49
|
snapshot,
|
|
52
|
-
theme: useColorScheme()
|
|
50
|
+
theme: useColorScheme(),
|
|
51
|
+
onExpand
|
|
53
52
|
});
|
|
54
53
|
};
|
|
55
|
-
var
|
|
56
|
-
const apiRef = useRef(null);
|
|
57
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
58
|
-
className: excalidrawDialogHeader,
|
|
59
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
60
|
-
className: excalidrawDialogHeaderTitle,
|
|
61
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
62
|
-
className: excalidrawDialogTitle,
|
|
63
|
-
children: "Whiteboard"
|
|
64
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
65
|
-
className: excalidrawDialogMeta,
|
|
66
|
-
children: "excalidraw"
|
|
67
|
-
})]
|
|
68
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
69
|
-
className: excalidrawHeaderClose,
|
|
70
|
-
type: "button",
|
|
71
|
-
onClick: dismiss,
|
|
72
|
-
children: /* @__PURE__ */ jsx(X, { size: 18 })
|
|
73
|
-
})]
|
|
74
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
75
|
-
className: excalidrawDialogCanvas,
|
|
76
|
-
children: /* @__PURE__ */ jsx(ExcalidrawComponent, {
|
|
77
|
-
viewModeEnabled: true,
|
|
78
|
-
zenModeEnabled: true,
|
|
79
|
-
UIOptions: readonlyUIOptions,
|
|
80
|
-
initialData: data,
|
|
81
|
-
theme,
|
|
82
|
-
excalidrawAPI: (api) => {
|
|
83
|
-
apiRef.current = api;
|
|
84
|
-
setTimeout(() => api.scrollToContent(), 100);
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
})] });
|
|
88
|
-
};
|
|
89
|
-
var ExcalidrawStaticCanvas = ({ snapshot, theme }) => {
|
|
54
|
+
var ExcalidrawStaticCanvas = ({ onExpand, snapshot, theme }) => {
|
|
90
55
|
const { snapshot: data, loading: dataLoading, error: dataError } = useExcalidrawData(snapshot);
|
|
91
56
|
const [ExcalidrawComponent, setExcalidrawComponent] = useState(null);
|
|
92
57
|
const [libLoading, setLibLoading] = useState(true);
|
|
93
58
|
const apiRef = useRef(null);
|
|
94
|
-
const { className: portalClassName } = usePortalTheme();
|
|
95
59
|
useEffect(() => {
|
|
96
60
|
Promise.all([import("@excalidraw/excalidraw"), import("@excalidraw/excalidraw/index.css")]).then(([mod]) => {
|
|
97
61
|
const Comp = mod.Excalidraw;
|
|
@@ -102,26 +66,27 @@ var ExcalidrawStaticCanvas = ({ snapshot, theme }) => {
|
|
|
102
66
|
setLibLoading(false);
|
|
103
67
|
});
|
|
104
68
|
}, []);
|
|
105
|
-
const handleExpand = useCallback(() => {
|
|
106
|
-
if (!ExcalidrawComponent || !data) return;
|
|
107
|
-
|
|
108
|
-
content:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
69
|
+
const handleExpand = useCallback((e) => {
|
|
70
|
+
if (!onExpand || !ExcalidrawComponent || !data) return;
|
|
71
|
+
onExpand({
|
|
72
|
+
content: /* @__PURE__ */ jsx(ExcalidrawComponent, {
|
|
73
|
+
viewModeEnabled: true,
|
|
74
|
+
zenModeEnabled: true,
|
|
75
|
+
UIOptions: readonlyUIOptions,
|
|
76
|
+
initialData: data,
|
|
77
|
+
theme,
|
|
78
|
+
excalidrawAPI: (api) => {
|
|
79
|
+
setTimeout(() => api.scrollToContent(), 100);
|
|
80
|
+
}
|
|
113
81
|
}),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
theme,
|
|
117
|
-
showCloseButton: false,
|
|
118
|
-
clickOutsideToDismiss: true
|
|
82
|
+
target: e.currentTarget,
|
|
83
|
+
theme
|
|
119
84
|
});
|
|
120
85
|
}, [
|
|
86
|
+
onExpand,
|
|
121
87
|
ExcalidrawComponent,
|
|
122
88
|
data,
|
|
123
|
-
theme
|
|
124
|
-
portalClassName
|
|
89
|
+
theme
|
|
125
90
|
]);
|
|
126
91
|
if (dataLoading || libLoading) return /* @__PURE__ */ jsx("div", {
|
|
127
92
|
className: excalidrawStaticContainer,
|
|
@@ -199,8 +164,8 @@ var ExcalidrawStaticCanvas = ({ snapshot, theme }) => {
|
|
|
199
164
|
onClick: () => apiRef.current?.scrollToContent(),
|
|
200
165
|
children: /* @__PURE__ */ jsx(ScanSearch, { size: 20 })
|
|
201
166
|
}),
|
|
202
|
-
/* @__PURE__ */ jsx("button", {
|
|
203
|
-
className:
|
|
167
|
+
Boolean(onExpand) && /* @__PURE__ */ jsx("button", {
|
|
168
|
+
className: "_1c3wdzl7",
|
|
204
169
|
title: "Expand",
|
|
205
170
|
type: "button",
|
|
206
171
|
onClick: handleExpand,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface ExcalidrawExpandPayload {
|
|
3
|
+
content: ReactNode;
|
|
4
|
+
target: HTMLElement;
|
|
5
|
+
theme: 'light' | 'dark';
|
|
6
|
+
}
|
|
7
|
+
export type OnExcalidrawExpand = (payload: ExcalidrawExpandPayload) => void;
|
|
2
8
|
export interface ExcalidrawStaticRendererProps {
|
|
9
|
+
onExpand?: OnExcalidrawExpand;
|
|
3
10
|
snapshot: string;
|
|
4
11
|
}
|
|
5
12
|
export declare const ExcalidrawDisplayRenderer: FC<ExcalidrawStaticRendererProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExcalidrawDisplayRenderer.d.ts","sourceRoot":"","sources":["../src/ExcalidrawDisplayRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExcalidrawDisplayRenderer.d.ts","sourceRoot":"","sources":["../src/ExcalidrawDisplayRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,EAAE,EACP,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAMf,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;AAE5E,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,6BAA6B,CAMvE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface ExcalidrawExpandShellProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
dismiss: () => void;
|
|
5
|
+
meta?: ReactNode;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ExcalidrawExpandShell: FC<ExcalidrawExpandShellProps>;
|
|
9
|
+
//# sourceMappingURL=ExcalidrawExpandShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExcalidrawExpandShell.d.ts","sourceRoot":"","sources":["../src/ExcalidrawExpandShell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAkBhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExcalidrawNode.d.ts","sourceRoot":"","sources":["../src/ExcalidrawNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExcalidrawNode.d.ts","sourceRoot":"","sources":["../src/ExcalidrawNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,qBAAqB,CAAC,CAAC;AAE3F,qBAAa,cAAe,SAAQ,aAAa,CAAC,YAAY,CAAC;IAC7D,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;gBAItC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO;IAK3C,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW;IAM7C,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,OAAO;IAInB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,wBAAwB,GAAG,cAAc;IAI3E,UAAU,IAAI,wBAAwB;IAStC,WAAW,IAAI,MAAM;IAIrB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKnC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAKtE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAEtE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,cAAc,CAE9F"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { OnExcalidrawExpand } from './ExcalidrawDisplayRenderer';
|
|
2
3
|
export interface ExcalidrawSSRRendererProps {
|
|
4
|
+
onExpand?: OnExcalidrawExpand;
|
|
3
5
|
snapshot: string;
|
|
4
6
|
}
|
|
5
7
|
export declare const ExcalidrawSSRRenderer: FC<ExcalidrawSSRRendererProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExcalidrawSSRRenderer.d.ts","sourceRoot":"","sources":["../src/ExcalidrawSSRRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ExcalidrawSSRRenderer.d.ts","sourceRoot":"","sources":["../src/ExcalidrawSSRRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AA6BD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAQhE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
export type { ExcalidrawConfig } from './ExcalidrawConfigContext';
|
|
2
|
-
export { ExcalidrawConfigProvider, useExcalidrawConfig
|
|
3
|
-
export type { ExcalidrawStaticRendererProps as ExcalidrawDisplayRendererProps } from './ExcalidrawDisplayRenderer';
|
|
2
|
+
export { ExcalidrawConfigProvider, useExcalidrawConfig } from './ExcalidrawConfigContext';
|
|
3
|
+
export type { ExcalidrawStaticRendererProps as ExcalidrawDisplayRendererProps, ExcalidrawExpandPayload, OnExcalidrawExpand, } from './ExcalidrawDisplayRenderer';
|
|
4
4
|
export { ExcalidrawDisplayRenderer } from './ExcalidrawDisplayRenderer';
|
|
5
5
|
export { $createExcalidrawEditNode, $isExcalidrawEditNode, ExcalidrawEditNode, } from './ExcalidrawEditNode';
|
|
6
6
|
export type { ExcalidrawEditRendererProps } from './ExcalidrawEditRenderer';
|
|
7
7
|
export { ExcalidrawEditRenderer } from './ExcalidrawEditRenderer';
|
|
8
|
+
export type { ExcalidrawExpandShellProps } from './ExcalidrawExpandShell';
|
|
9
|
+
export { ExcalidrawExpandShell } from './ExcalidrawExpandShell';
|
|
8
10
|
export type { SerializedExcalidrawNode } from './ExcalidrawNode';
|
|
9
|
-
export { $createExcalidrawNode, $isExcalidrawNode, ExcalidrawNode
|
|
11
|
+
export { $createExcalidrawNode, $isExcalidrawNode, ExcalidrawNode } from './ExcalidrawNode';
|
|
10
12
|
export { ExcalidrawPlugin, INSERT_EXCALIDRAW_COMMAND } from './ExcalidrawPlugin';
|
|
11
13
|
export type { ExcalidrawSSRRendererProps } from './ExcalidrawSSRRenderer';
|
|
12
14
|
export { ExcalidrawSSRRenderer } from './ExcalidrawSSRRenderer';
|
|
15
|
+
export type { ExcalidrawSlotProps } from './slot';
|
|
16
|
+
export { EXCALIDRAW_NODE_KEY } from './slot';
|
|
17
|
+
export { excalidrawFullscreenPopup } from './styles.css';
|
|
13
18
|
export { EXCALIDRAW_BLOCK_TRANSFORMER } from './transformer';
|
|
14
19
|
export type { ExcalidrawSnapshot } from './types';
|
|
15
20
|
export { parseSnapshot, serializeSnapshot } from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,YAAY,EACV,6BAA6B,IAAI,8BAA8B,EAC/D,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACjF,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG3D,YAAY,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AACjF,YAAY,EAAE,6BAA6B,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC5G,OAAO,EAAE,yBAAyB,IAAI,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAE,yBAAyB,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as ExcalidrawConfigProvider, j as useExcalidrawConfig, n as parseSnapshot, r as serializeSnapshot } from "./useExcalidrawData-DcXa8vqV.js";
|
|
2
|
-
import { r as _defineProperty, t as ExcalidrawDisplayRenderer } from "./ExcalidrawDisplayRenderer-
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as ExcalidrawEditRenderer } from "./ExcalidrawEditRenderer-
|
|
1
|
+
import { A as ExcalidrawConfigProvider, S as excalidrawFullscreenPopup, j as useExcalidrawConfig, n as parseSnapshot, r as serializeSnapshot } from "./useExcalidrawData-DcXa8vqV.js";
|
|
2
|
+
import { r as _defineProperty, t as ExcalidrawDisplayRenderer } from "./ExcalidrawDisplayRenderer-BWsFJSQ7.js";
|
|
3
|
+
import { a as ExcalidrawNode, i as $isExcalidrawNode, n as ExcalidrawExpandShell, o as EXCALIDRAW_NODE_KEY, r as $createExcalidrawNode, s as ExcalidrawSSRRenderer, t as EXCALIDRAW_BLOCK_TRANSFORMER } from "./transformer-zBd4ibNw.js";
|
|
4
|
+
import { t as ExcalidrawEditRenderer } from "./ExcalidrawEditRenderer-BlJTjnpV.js";
|
|
5
5
|
import { Suspense, createElement, lazy, useEffect } from "react";
|
|
6
|
-
import { ViewportGate } from "@haklex/rich-editor-ui";
|
|
7
6
|
import { PenTool } from "lucide-react";
|
|
7
|
+
import { ViewportGate } from "@haklex/rich-editor-ui";
|
|
8
8
|
import { $getNodeByKey, $insertNodes, COMMAND_PRIORITY_EDITOR, createCommand } from "lexical";
|
|
9
9
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
10
10
|
//#region src/ExcalidrawEditNode.ts
|
|
11
|
-
var LazyEditRenderer = lazy(() => import("./ExcalidrawEditRenderer-
|
|
11
|
+
var LazyEditRenderer = lazy(() => import("./ExcalidrawEditRenderer-BlJTjnpV.js").then((n) => n.n).then((m) => ({ default: m.ExcalidrawEditRenderer })));
|
|
12
12
|
var ExcalidrawEditNode = class ExcalidrawEditNode extends ExcalidrawNode {
|
|
13
13
|
static clone(node) {
|
|
14
14
|
return new ExcalidrawEditNode(node.__snapshot, node.__key);
|
|
@@ -84,4 +84,4 @@ function ExcalidrawPlugin() {
|
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
|
-
export { $createExcalidrawEditNode, $createExcalidrawNode, $isExcalidrawEditNode, $isExcalidrawNode, EXCALIDRAW_BLOCK_TRANSFORMER, ExcalidrawConfigProvider, ExcalidrawDisplayRenderer, ExcalidrawDisplayRenderer as ExcalidrawRenderer, ExcalidrawDisplayRenderer as ExcalidrawStaticRenderer, ExcalidrawEditNode, ExcalidrawEditRenderer, ExcalidrawNode, ExcalidrawPlugin, ExcalidrawSSRRenderer, INSERT_EXCALIDRAW_COMMAND, parseSnapshot, serializeSnapshot, useExcalidrawConfig };
|
|
87
|
+
export { $createExcalidrawEditNode, $createExcalidrawNode, $isExcalidrawEditNode, $isExcalidrawNode, EXCALIDRAW_BLOCK_TRANSFORMER, EXCALIDRAW_NODE_KEY, ExcalidrawConfigProvider, ExcalidrawDisplayRenderer, ExcalidrawDisplayRenderer as ExcalidrawRenderer, ExcalidrawDisplayRenderer as ExcalidrawStaticRenderer, ExcalidrawEditNode, ExcalidrawEditRenderer, ExcalidrawExpandShell, ExcalidrawNode, ExcalidrawPlugin, ExcalidrawSSRRenderer, INSERT_EXCALIDRAW_COMMAND, excalidrawFullscreenPopup, parseSnapshot, serializeSnapshot, useExcalidrawConfig };
|
package/dist/slot.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
export declare const EXCALIDRAW_NODE_KEY: "Excalidraw";
|
|
3
|
+
export interface ExcalidrawSlotProps {
|
|
4
|
+
snapshot: string;
|
|
5
|
+
}
|
|
6
|
+
declare module '@haklex/rich-editor' {
|
|
7
|
+
interface RendererConfig {
|
|
8
|
+
Excalidraw?: ComponentType<ExcalidrawSlotProps>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../src/slot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAG,YAAqB,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,cAAc;QACtB,UAAU,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;KACjD;CACF"}
|
package/dist/static.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export type { ExcalidrawConfig } from './ExcalidrawConfigContext';
|
|
2
|
-
export { ExcalidrawConfigProvider, useExcalidrawConfig
|
|
3
|
-
export type { ExcalidrawStaticRendererProps } from './ExcalidrawDisplayRenderer';
|
|
2
|
+
export { ExcalidrawConfigProvider, useExcalidrawConfig } from './ExcalidrawConfigContext';
|
|
3
|
+
export type { ExcalidrawExpandPayload, ExcalidrawStaticRendererProps, OnExcalidrawExpand, } from './ExcalidrawDisplayRenderer';
|
|
4
4
|
export { ExcalidrawDisplayRenderer } from './ExcalidrawDisplayRenderer';
|
|
5
|
+
export type { ExcalidrawExpandShellProps } from './ExcalidrawExpandShell';
|
|
6
|
+
export { ExcalidrawExpandShell } from './ExcalidrawExpandShell';
|
|
5
7
|
export type { SerializedExcalidrawNode } from './ExcalidrawNode';
|
|
6
|
-
export { $createExcalidrawNode, $isExcalidrawNode, ExcalidrawNode
|
|
8
|
+
export { $createExcalidrawNode, $isExcalidrawNode, ExcalidrawNode } from './ExcalidrawNode';
|
|
7
9
|
export type { ExcalidrawSSRRendererProps } from './ExcalidrawSSRRenderer';
|
|
8
10
|
export { ExcalidrawSSRRenderer } from './ExcalidrawSSRRenderer';
|
|
11
|
+
export type { ExcalidrawSlotProps } from './slot';
|
|
12
|
+
export { EXCALIDRAW_NODE_KEY } from './slot';
|
|
13
|
+
export { excalidrawFullscreenPopup } from './styles.css';
|
|
9
14
|
export { EXCALIDRAW_BLOCK_TRANSFORMER } from './transformer';
|
|
10
15
|
export type { ExcalidrawStaticRendererProps as ExcalidrawRendererProps } from './ExcalidrawDisplayRenderer';
|
|
11
16
|
export { ExcalidrawDisplayRenderer as ExcalidrawStaticRenderer } from './ExcalidrawDisplayRenderer';
|
package/dist/static.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,YAAY,EACV,uBAAuB,EACvB,6BAA6B,EAC7B,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5F,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAG7D,YAAY,EAAE,6BAA6B,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC5G,OAAO,EAAE,yBAAyB,IAAI,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAE,yBAAyB,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/static.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ExcalidrawConfigProvider, j as useExcalidrawConfig } from "./useExcalidrawData-DcXa8vqV.js";
|
|
2
|
-
import { t as ExcalidrawDisplayRenderer } from "./ExcalidrawDisplayRenderer-
|
|
3
|
-
import { a as
|
|
4
|
-
export { $createExcalidrawNode, $isExcalidrawNode, EXCALIDRAW_BLOCK_TRANSFORMER, ExcalidrawConfigProvider, ExcalidrawDisplayRenderer, ExcalidrawDisplayRenderer as ExcalidrawRenderer, ExcalidrawDisplayRenderer as ExcalidrawStaticRenderer, ExcalidrawNode, ExcalidrawSSRRenderer, useExcalidrawConfig };
|
|
1
|
+
import { A as ExcalidrawConfigProvider, S as excalidrawFullscreenPopup, j as useExcalidrawConfig } from "./useExcalidrawData-DcXa8vqV.js";
|
|
2
|
+
import { t as ExcalidrawDisplayRenderer } from "./ExcalidrawDisplayRenderer-BWsFJSQ7.js";
|
|
3
|
+
import { a as ExcalidrawNode, i as $isExcalidrawNode, n as ExcalidrawExpandShell, o as EXCALIDRAW_NODE_KEY, r as $createExcalidrawNode, s as ExcalidrawSSRRenderer, t as EXCALIDRAW_BLOCK_TRANSFORMER } from "./transformer-zBd4ibNw.js";
|
|
4
|
+
export { $createExcalidrawNode, $isExcalidrawNode, EXCALIDRAW_BLOCK_TRANSFORMER, EXCALIDRAW_NODE_KEY, ExcalidrawConfigProvider, ExcalidrawDisplayRenderer, ExcalidrawDisplayRenderer as ExcalidrawRenderer, ExcalidrawDisplayRenderer as ExcalidrawStaticRenderer, ExcalidrawExpandShell, ExcalidrawNode, ExcalidrawSSRRenderer, excalidrawFullscreenPopup, useExcalidrawConfig };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { E as excalidrawPlaceholder } from "./useExcalidrawData-DcXa8vqV.js";
|
|
2
|
-
import { r as _defineProperty } from "./ExcalidrawDisplayRenderer-
|
|
3
|
-
import { Suspense,
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { E as excalidrawPlaceholder, _ as excalidrawDialogTitle, h as excalidrawDialogHeaderTitle, m as excalidrawDialogHeader, p as excalidrawDialogCanvas, w as excalidrawHeaderClose } from "./useExcalidrawData-DcXa8vqV.js";
|
|
2
|
+
import { r as _defineProperty } from "./ExcalidrawDisplayRenderer-BWsFJSQ7.js";
|
|
3
|
+
import { Suspense, lazy } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { X } from "lucide-react";
|
|
5
6
|
import { ViewportGate } from "@haklex/rich-editor-ui";
|
|
6
7
|
import { DecoratorNode } from "lexical";
|
|
8
|
+
import { createRendererDecoration } from "@haklex/rich-editor/static";
|
|
7
9
|
import { EXCALIDRAW_BLOCK_TRANSFORMER } from "@haklex/rich-headless/transformers";
|
|
8
10
|
//#region src/ExcalidrawSSRRenderer.tsx
|
|
9
|
-
var LazyDisplayRenderer = lazy(() => import("./ExcalidrawDisplayRenderer-
|
|
11
|
+
var LazyDisplayRenderer = lazy(() => import("./ExcalidrawDisplayRenderer-BWsFJSQ7.js").then((n) => n.n).then((m) => ({ default: m.ExcalidrawDisplayRenderer })));
|
|
10
12
|
var ExcalidrawPlaceholder = ({ snapshot }) => {
|
|
11
13
|
let label = "Excalidraw Whiteboard";
|
|
12
14
|
try {
|
|
@@ -22,16 +24,22 @@ var ExcalidrawPlaceholder = ({ snapshot }) => {
|
|
|
22
24
|
children: /* @__PURE__ */ jsx("span", { children: label })
|
|
23
25
|
});
|
|
24
26
|
};
|
|
25
|
-
var ExcalidrawSSRRenderer = ({ snapshot }) => {
|
|
27
|
+
var ExcalidrawSSRRenderer = ({ onExpand, snapshot }) => {
|
|
26
28
|
return /* @__PURE__ */ jsx(ViewportGate, {
|
|
27
29
|
fallback: /* @__PURE__ */ jsx(ExcalidrawPlaceholder, { snapshot }),
|
|
28
30
|
children: /* @__PURE__ */ jsx(Suspense, {
|
|
29
31
|
fallback: /* @__PURE__ */ jsx(ExcalidrawPlaceholder, { snapshot }),
|
|
30
|
-
children: /* @__PURE__ */ jsx(LazyDisplayRenderer, {
|
|
32
|
+
children: /* @__PURE__ */ jsx(LazyDisplayRenderer, {
|
|
33
|
+
snapshot,
|
|
34
|
+
onExpand
|
|
35
|
+
})
|
|
31
36
|
})
|
|
32
37
|
});
|
|
33
38
|
};
|
|
34
39
|
//#endregion
|
|
40
|
+
//#region src/slot.ts
|
|
41
|
+
var EXCALIDRAW_NODE_KEY = "Excalidraw";
|
|
42
|
+
//#endregion
|
|
35
43
|
//#region src/ExcalidrawNode.ts
|
|
36
44
|
var ExcalidrawNode = class ExcalidrawNode extends DecoratorNode {
|
|
37
45
|
static getType() {
|
|
@@ -75,7 +83,7 @@ var ExcalidrawNode = class ExcalidrawNode extends DecoratorNode {
|
|
|
75
83
|
writable.__snapshot = snapshot;
|
|
76
84
|
}
|
|
77
85
|
decorate(_editor, _config) {
|
|
78
|
-
return
|
|
86
|
+
return createRendererDecoration(EXCALIDRAW_NODE_KEY, ExcalidrawSSRRenderer, { snapshot: this.__snapshot });
|
|
79
87
|
}
|
|
80
88
|
};
|
|
81
89
|
function $createExcalidrawNode(snapshot) {
|
|
@@ -85,4 +93,27 @@ function $isExcalidrawNode(node) {
|
|
|
85
93
|
return node instanceof ExcalidrawNode;
|
|
86
94
|
}
|
|
87
95
|
//#endregion
|
|
88
|
-
|
|
96
|
+
//#region src/ExcalidrawExpandShell.tsx
|
|
97
|
+
var ExcalidrawExpandShell = ({ children, dismiss, meta = "excalidraw", title = "Whiteboard" }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
98
|
+
className: excalidrawDialogHeader,
|
|
99
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: excalidrawDialogHeaderTitle,
|
|
101
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: excalidrawDialogTitle,
|
|
103
|
+
children: title
|
|
104
|
+
}), meta != null && /* @__PURE__ */ jsx("span", {
|
|
105
|
+
className: "_1c3wdzld",
|
|
106
|
+
children: meta
|
|
107
|
+
})]
|
|
108
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
109
|
+
className: excalidrawHeaderClose,
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: dismiss,
|
|
112
|
+
children: /* @__PURE__ */ jsx(X, { size: 18 })
|
|
113
|
+
})]
|
|
114
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
115
|
+
className: excalidrawDialogCanvas,
|
|
116
|
+
children
|
|
117
|
+
})] });
|
|
118
|
+
//#endregion
|
|
119
|
+
export { ExcalidrawNode as a, $isExcalidrawNode as i, ExcalidrawExpandShell as n, EXCALIDRAW_NODE_KEY as o, $createExcalidrawNode as r, ExcalidrawSSRRenderer as s, EXCALIDRAW_BLOCK_TRANSFORMER as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-excalidraw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Excalidraw whiteboard extension",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"jsondiffpatch": "^0.7.3",
|
|
29
|
-
"@haklex/rich-headless": "0.
|
|
29
|
+
"@haklex/rich-headless": "0.14.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@excalidraw/excalidraw": "^0.18.0",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"lucide-react": "^1.0.0",
|
|
51
51
|
"react": ">=19",
|
|
52
52
|
"react-dom": ">=19",
|
|
53
|
-
"@haklex/rich-editor": "0.
|
|
54
|
-
"@haklex/rich-
|
|
55
|
-
"@haklex/rich-
|
|
53
|
+
"@haklex/rich-editor": "0.14.1",
|
|
54
|
+
"@haklex/rich-style-token": "0.14.1",
|
|
55
|
+
"@haklex/rich-editor-ui": "0.14.1"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
@@ -3,9 +3,9 @@ import { C as excalidrawHeaderActions, O as excalidrawStatusDot, S as excalidraw
|
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useColorScheme } from "@haklex/rich-editor";
|
|
6
|
+
import { Clipboard, Download, Pencil, Save, X } from "lucide-react";
|
|
6
7
|
import { SegmentedControl, dismissTopDialog, presentDialog } from "@haklex/rich-editor-ui";
|
|
7
8
|
import { usePortalTheme } from "@haklex/rich-style-token";
|
|
8
|
-
import { Clipboard, Download, Pencil, Save, X } from "lucide-react";
|
|
9
9
|
//#region src/ExcalidrawEditRenderer.tsx
|
|
10
10
|
var ExcalidrawEditRenderer_exports = /* @__PURE__ */ __exportAll({ ExcalidrawEditRenderer: () => ExcalidrawEditRenderer });
|
|
11
11
|
var SAVE_DEBOUNCE_MS = 2e3;
|