superdoc 2.29.0-next.2 → 2.29.0-next.9
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/chunks/{FindReplaceSurface-Dm043CZP.es.js → FindReplaceSurface-BKVHzhQ4.es.js} +34 -26
- package/dist/chunks/{FindReplaceSurface-BRs3JrCq.cjs → FindReplaceSurface-BNDrJ6VS.cjs} +34 -26
- package/dist/chunks/{PasswordPromptSurface-DGjmN7A-.es.js → PasswordPromptSurface-6mF6Azda.es.js} +6 -4
- package/dist/chunks/{PasswordPromptSurface-BpqP4pUa.cjs → PasswordPromptSurface-BNkaztaP.cjs} +6 -4
- package/dist/chunks/{PdfViewer-boENOZdF.cjs → PdfViewer-DmSkZehl.cjs} +70 -99
- package/dist/chunks/{PdfViewer-D4lVeOJu.es.js → PdfViewer-aOWhUVI7.es.js} +67 -96
- package/dist/chunks/{constants-DpXuDx_g.cjs → constants-BeeNZoQp.cjs} +1 -1
- package/dist/chunks/{constants-B6VBlmKp.es.js → constants-BvNs_ybI.es.js} +1 -1
- package/dist/chunks/{create-super-doc-ui-BFt8agAI.es.js → create-super-doc-ui-Bm5kmx0W.es.js} +12 -29
- package/dist/chunks/{create-super-doc-ui-BAGOnYGM.cjs → create-super-doc-ui-DN70aatf.cjs} +17 -28
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/capabilities/html-markdown-support.d.ts +4 -6
- package/dist/document-api/src/comments/comments.d.ts +2 -0
- package/dist/document-api/src/contract/operation-definitions.d.ts +2 -2
- package/dist/document-api/src/contract/operation-registry.d.ts +10 -9
- package/dist/document-api/src/index.d.ts +8 -7
- package/dist/document-api/src/insert/insert.d.ts +2 -2
- package/dist/document-api/src/replace/replace.d.ts +3 -2
- package/dist/document-api/src/types/address.d.ts +3 -0
- package/dist/document-api/src/types/temporary-mutation.d.ts +5 -1
- package/dist/document-api/src/write/write.d.ts +12 -6
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layered.css +1 -1
- package/dist/superdoc/src/SuperDoc.vue.d.ts +132 -58
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +35 -1867
- package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +3 -4
- package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +3 -618
- package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +24 -23
- package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +0 -1
- package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +28 -13
- package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +132 -45
- package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +62 -16
- package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +77 -17
- package/dist/superdoc/src/components/PdfViewer/pdf-viewer-types.d.ts +45 -0
- package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +81 -16
- package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +49 -13
- package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +30 -15
- package/dist/superdoc/src/components/Whiteboard/whiteboard-types.d.ts +11 -0
- package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +58 -15
- package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +58 -15
- package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +14 -6
- package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +25 -15
- package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +1 -5
- package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +16 -9
- package/dist/superdoc/src/composables/replace-continuation.d.ts +11 -15
- package/dist/superdoc/src/composables/use-document.d.ts +1210 -30
- package/dist/superdoc/src/composables/use-field.d.ts +88 -25
- package/dist/superdoc/src/composables/use-password-prompt.d.ts +23 -24
- package/dist/superdoc/src/composables/useUiFontFamily.d.ts +3 -11
- package/dist/superdoc/src/core/SuperDoc.d.ts +2 -7
- package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +9 -4
- package/dist/superdoc/src/core/collaboration/helpers.d.ts +20 -3
- package/dist/superdoc/src/core/collaboration/permissions.d.ts +15 -10
- package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +4 -3
- package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +2 -1
- package/dist/superdoc/src/core/config/merge-comments-config.d.ts +1 -5
- package/dist/superdoc/src/core/config/merge-defined.d.ts +3 -8
- package/dist/superdoc/src/core/config/normalize-hyperlinks-config.d.ts +7 -12
- package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +9 -12
- package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +1 -12
- package/dist/superdoc/src/core/create-app.d.ts +13 -24
- package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +2 -1
- package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +2 -1
- package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -1
- package/dist/superdoc/src/core/editor-runtime/types.d.ts +9 -1
- package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +2 -1
- package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +1 -1
- package/dist/superdoc/src/core/helpers/export.d.ts +3 -2
- package/dist/superdoc/src/core/helpers/file.d.ts +8 -45
- package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +6 -60
- package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -2
- package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -1
- package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -1
- package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -1
- package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +24 -61
- package/dist/superdoc/src/core/superdoc-ui-owner.d.ts +1 -1
- package/dist/superdoc/src/core/surface-manager.d.ts +21 -83
- package/dist/superdoc/src/core/types/index.d.ts +4 -19
- package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +10 -10
- package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +22 -208
- package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +163 -189
- package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +14 -1
- package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -1
- package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -1
- package/dist/superdoc/src/helpers/comment-focus.d.ts +21 -4
- package/dist/superdoc/src/helpers/deprecation.d.ts +5 -11
- package/dist/superdoc/src/helpers/interaction-trace.d.ts +7 -24
- package/dist/superdoc/src/helpers/mark-raw-component.d.ts +1 -0
- package/dist/superdoc/src/helpers/object-guards.d.ts +1 -5
- package/dist/superdoc/src/helpers/selection-source.d.ts +1 -1
- package/dist/superdoc/src/helpers/use-selection.d.ts +35 -15
- package/dist/superdoc/src/icons.d.ts +8 -0
- package/dist/superdoc/src/internal/diagnostics/diagnostic-dedupe.d.ts +6 -15
- package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +77 -16
- package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +5 -3
- package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +85 -5
- package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +20 -6
- package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +32 -8
- package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +32 -8
- package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +44 -12
- package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +32 -9
- package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +1 -1
- package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +39 -10
- package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +24 -6
- package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +7 -3
- package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +9 -3
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +13 -15
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +1 -10
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +16 -6
- package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +10 -20
- package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +12 -45
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +34 -17
- package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
- package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +10 -2
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +67 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +61 -61
- package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +110 -48
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +7 -27
- package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +4 -3
- package/dist/superdoc/src/internal/toolbar/toolbar-item-aliases.d.ts +1 -1
- package/dist/superdoc/src/public/browser-document-api.d.ts +5 -4
- package/dist/superdoc/src/public/index.d.cts +26 -0
- package/dist/superdoc/src/public/index.d.ts +13 -0
- package/dist/superdoc/src/public/ui/commands.d.ts +14 -13
- package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +1 -1
- package/dist/superdoc/src/public/ui/entity-at.d.ts +2 -1
- package/dist/superdoc/src/public/ui/style-match-patch.d.ts +2 -2
- package/dist/superdoc/src/public/ui/types.d.ts +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +225 -99
- package/dist/superdoc/src/stores/helpers/comment-draft-text.d.ts +1 -0
- package/dist/superdoc/src/stores/helpers/comment-grouping.d.ts +30 -0
- package/dist/superdoc/src/stores/helpers/comment-identity.d.ts +40 -0
- package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +48 -13
- package/dist/superdoc/src/stores/helpers/tracked-change-identity.d.ts +19 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-row-values.d.ts +21 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +21 -24
- package/dist/superdoc/src/stores/superdoc-store.d.ts +676 -298
- package/dist/superdoc.cjs +1623 -2477
- package/dist/superdoc.es.js +1604 -2461
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +42 -42
- package/package.json +2 -2
- package/dist/superdoc/src/internal/toolbar/index.d.ts +0 -10
|
@@ -1,230 +1,26 @@
|
|
|
1
1
|
import { EventEmitter } from '../EventEmitter.js';
|
|
2
|
-
import { WhiteboardPage } from './WhiteboardPage.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* The page-level serialized shape is the normalized one (matches what
|
|
7
|
-
* `WhiteboardPage.toJSON()` actually returns). SD-3213 follow-up:
|
|
8
|
-
* the previous `any[]` typing meant consumers reading
|
|
9
|
-
* `whiteboard.getWhiteboardData().pages[0].strokes` had no
|
|
10
|
-
* IntelliSense — and a wrong assumption that fields like `.points`
|
|
11
|
-
* or `.x` would be present (runtime gives `pointsN` / `xN`).
|
|
12
|
-
*
|
|
13
|
-
* @typedef {import('./WhiteboardPage.js').WhiteboardStoredPageData} WhiteboardPageData
|
|
14
|
-
*
|
|
15
|
-
* Per-page size snapshot recorded in `WhiteboardDataMeta.pageSizes`.
|
|
16
|
-
* `originalWidth` / `originalHeight` are `number | null` because
|
|
17
|
-
* `getWhiteboardData()` writes `page.originalSize?.width ?? null` when
|
|
18
|
-
* the original size is unknown.
|
|
19
|
-
*
|
|
20
|
-
* @typedef {{ width: number, height: number, originalWidth: number | null, originalHeight: number | null }} WhiteboardPageSizeSnapshot
|
|
21
|
-
*
|
|
22
|
-
* @typedef {{ pageSizes: Record<string, WhiteboardPageSizeSnapshot> }} WhiteboardDataMeta
|
|
23
|
-
*
|
|
24
|
-
* `WhiteboardData` is the **output** shape: what `getWhiteboardData()`
|
|
25
|
-
* returns and what the `change` event payload carries. All three
|
|
26
|
-
* fields are required because the runtime always populates them.
|
|
27
|
-
* Consumers reading the change payload can write
|
|
28
|
-
* `data.meta.pageSizes` without optional chaining.
|
|
29
|
-
*
|
|
30
|
-
* @typedef {{ pages: Record<string, WhiteboardPageData>, meta: WhiteboardDataMeta, version: 1 }} WhiteboardData
|
|
31
|
-
*
|
|
32
|
-
* `WhiteboardDataInput` is the **input** shape accepted by
|
|
33
|
-
* `setWhiteboardData(json)`. All fields are optional because the
|
|
34
|
-
* runtime only reads `json?.pages`; callers can pass
|
|
35
|
-
* `{ pages: {...} }` without supplying `meta` or `version`. A round
|
|
36
|
-
* trip works (`setWhiteboardData(getWhiteboardData())`) because
|
|
37
|
-
* `WhiteboardData` is structurally assignable to `WhiteboardDataInput`.
|
|
38
|
-
*
|
|
39
|
-
* @typedef {{ pages?: Record<string, WhiteboardPageData>, meta?: WhiteboardDataMeta, version?: number }} WhiteboardDataInput
|
|
40
|
-
*
|
|
41
|
-
* Registry items the host can attach for UI palettes (stickers,
|
|
42
|
-
* comments, etc.). The shape is intentionally extensible: `id` is the
|
|
43
|
-
* one field the runtime actually relies on (filter, dedup); everything
|
|
44
|
-
* else is consumer-typed via `unknown` so palettes for new domains
|
|
45
|
-
* don't need a contract change.
|
|
46
|
-
*
|
|
47
|
-
* @typedef {{ id?: string | number, [key: string]: unknown }} WhiteboardRegistryItem
|
|
48
|
-
*
|
|
49
|
-
* Event map for `whiteboard.on(name, fn)` / `whiteboard.emit(name, ...)`.
|
|
50
|
-
* Closed map (no DefaultEventMap fallback) because every event the
|
|
51
|
-
* runtime emits is enumerated here; an unknown event name should be a
|
|
52
|
-
* type error, not an `unknown[]` payload. SD-3213 follow-up to the
|
|
53
|
-
* EventEmitter `unknown[]` drain: that change only fixed the
|
|
54
|
-
* untyped-event fallback; without this map, listeners on Whiteboard
|
|
55
|
-
* still received `unknown[]` because no event was named.
|
|
56
|
-
*
|
|
57
|
-
* @typedef {{
|
|
58
|
-
* tool: [string],
|
|
59
|
-
* enabled: [boolean],
|
|
60
|
-
* opacity: [number],
|
|
61
|
-
* setData: [WhiteboardPage[]],
|
|
62
|
-
* change: [WhiteboardData],
|
|
63
|
-
* }} WhiteboardEventMap
|
|
64
|
-
*
|
|
65
|
-
* @typedef {{
|
|
66
|
-
* Renderer?: any,
|
|
67
|
-
* enabled?: boolean,
|
|
68
|
-
* onChange?: (data: WhiteboardData) => void,
|
|
69
|
-
* onSetData?: (pages: WhiteboardPage[]) => void,
|
|
70
|
-
* onEnabledChange?: (enabled: boolean) => void,
|
|
71
|
-
* }} WhiteboardInit
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* Whiteboard manager for multi-page annotations.
|
|
75
|
-
*
|
|
76
|
-
* @extends {EventEmitter<WhiteboardEventMap>}
|
|
77
|
-
*/
|
|
78
|
-
export class Whiteboard extends EventEmitter<WhiteboardEventMap> {
|
|
79
|
-
/**
|
|
80
|
-
* Initialize the whiteboard instance.
|
|
81
|
-
* @param {WhiteboardInit} [props]
|
|
82
|
-
*/
|
|
83
|
-
constructor(props?: WhiteboardInit);
|
|
84
|
-
/**
|
|
85
|
-
* Register items for a UI palette type (e.g. stickers, comments).
|
|
86
|
-
* @param {string} type
|
|
87
|
-
* @param {WhiteboardRegistryItem[]} items
|
|
88
|
-
*/
|
|
89
|
-
register(type: string, items: WhiteboardRegistryItem[]): void;
|
|
90
|
-
/**
|
|
91
|
-
* Get registered items by type.
|
|
92
|
-
* @param {string} type
|
|
93
|
-
* @returns {WhiteboardRegistryItem[] | undefined}
|
|
94
|
-
*/
|
|
95
|
-
getType(type: string): WhiteboardRegistryItem[] | undefined;
|
|
96
|
-
/**
|
|
97
|
-
* Set current tool for all pages.
|
|
98
|
-
* @param {string} tool
|
|
99
|
-
*/
|
|
100
|
-
setTool(tool: string): void;
|
|
101
|
-
/**
|
|
102
|
-
* Get current tool.
|
|
103
|
-
* @returns {string}
|
|
104
|
-
*/
|
|
105
|
-
getTool(): string;
|
|
106
|
-
/**
|
|
107
|
-
* Enable/disable interactivity for all pages.
|
|
108
|
-
* @param {boolean} enabled
|
|
109
|
-
*/
|
|
110
|
-
setEnabled(enabled: boolean): void;
|
|
111
|
-
/**
|
|
112
|
-
* @returns {boolean}
|
|
113
|
-
*/
|
|
114
|
-
isEnabled(): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Set overlay opacity.
|
|
117
|
-
* @param {number} opacity
|
|
118
|
-
*/
|
|
119
|
-
setOpacity(opacity: number): void;
|
|
120
|
-
/**
|
|
121
|
-
* @returns {number}
|
|
122
|
-
*/
|
|
123
|
-
getOpacity(): number;
|
|
124
|
-
/**
|
|
125
|
-
* Return all page instances.
|
|
126
|
-
* @returns {WhiteboardPage[]}
|
|
127
|
-
*/
|
|
128
|
-
getPages(): WhiteboardPage[];
|
|
129
|
-
/**
|
|
130
|
-
* Re-render all pages.
|
|
131
|
-
*/
|
|
132
|
-
rerender(): void;
|
|
133
|
-
/**
|
|
134
|
-
* Set size for a page (creates page if missing).
|
|
135
|
-
* @param {number} pageIndex
|
|
136
|
-
* @param {WhiteboardPageSize} size
|
|
137
|
-
*/
|
|
138
|
-
setPageSize(pageIndex: number, size: WhiteboardPageSize): void;
|
|
139
|
-
/**
|
|
140
|
-
* Get a page by index.
|
|
141
|
-
* @param {number} pageIndex
|
|
142
|
-
* @returns {WhiteboardPage}
|
|
143
|
-
*/
|
|
144
|
-
getPage(pageIndex: number): WhiteboardPage;
|
|
145
|
-
/**
|
|
146
|
-
* Serialize whiteboard data.
|
|
147
|
-
* @returns {WhiteboardData}
|
|
148
|
-
*/
|
|
149
|
-
getWhiteboardData(): WhiteboardData;
|
|
150
|
-
/**
|
|
151
|
-
* Load whiteboard data from JSON.
|
|
152
|
-
* @param {WhiteboardDataInput} json
|
|
153
|
-
*/
|
|
154
|
-
setWhiteboardData(json: WhiteboardDataInput): void;
|
|
155
|
-
#private;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* The page-level serialized shape is the normalized one (matches what
|
|
159
|
-
* `WhiteboardPage.toJSON()` actually returns). SD-3213 follow-up:
|
|
160
|
-
* the previous `any[]` typing meant consumers reading
|
|
161
|
-
* `whiteboard.getWhiteboardData().pages[0].strokes` had no
|
|
162
|
-
* IntelliSense — and a wrong assumption that fields like `.points`
|
|
163
|
-
* or `.x` would be present (runtime gives `pointsN` / `xN`).
|
|
164
|
-
*/
|
|
165
|
-
export type WhiteboardPageSize = {
|
|
166
|
-
width: number;
|
|
167
|
-
height: number;
|
|
168
|
-
originalWidth?: number;
|
|
169
|
-
originalHeight?: number;
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* Per-page size snapshot recorded in `WhiteboardDataMeta.pageSizes`.
|
|
173
|
-
* `originalWidth` / `originalHeight` are `number | null` because
|
|
174
|
-
* `getWhiteboardData()` writes `page.originalSize?.width ?? null` when
|
|
175
|
-
* the original size is unknown.
|
|
176
|
-
*/
|
|
177
|
-
export type WhiteboardPageData = import('./WhiteboardPage.js').WhiteboardStoredPageData;
|
|
2
|
+
import { WhiteboardPage, WhiteboardPageRenderer, WhiteboardPageSize, WhiteboardStoredPageData } from './WhiteboardPage.js';
|
|
3
|
+
export type { WhiteboardPageSize };
|
|
4
|
+
export type WhiteboardPageData = WhiteboardStoredPageData;
|
|
178
5
|
export type WhiteboardPageSizeSnapshot = {
|
|
179
6
|
width: number;
|
|
180
7
|
height: number;
|
|
181
8
|
originalWidth: number | null;
|
|
182
9
|
originalHeight: number | null;
|
|
183
10
|
};
|
|
184
|
-
/**
|
|
185
|
-
* `WhiteboardData` is the **output** shape: what `getWhiteboardData()`
|
|
186
|
-
* returns and what the `change` event payload carries. All three
|
|
187
|
-
* fields are required because the runtime always populates them.
|
|
188
|
-
* Consumers reading the change payload can write
|
|
189
|
-
* `data.meta.pageSizes` without optional chaining.
|
|
190
|
-
*/
|
|
191
11
|
export type WhiteboardDataMeta = {
|
|
192
12
|
pageSizes: Record<string, WhiteboardPageSizeSnapshot>;
|
|
193
13
|
};
|
|
194
|
-
/**
|
|
195
|
-
* `WhiteboardDataInput` is the **input** shape accepted by
|
|
196
|
-
* `setWhiteboardData(json)`. All fields are optional because the
|
|
197
|
-
* runtime only reads `json?.pages`; callers can pass
|
|
198
|
-
* `{ pages: {...} }` without supplying `meta` or `version`. A round
|
|
199
|
-
* trip works (`setWhiteboardData(getWhiteboardData())`) because
|
|
200
|
-
* `WhiteboardData` is structurally assignable to `WhiteboardDataInput`.
|
|
201
|
-
*/
|
|
202
14
|
export type WhiteboardData = {
|
|
203
15
|
pages: Record<string, WhiteboardPageData>;
|
|
204
16
|
meta: WhiteboardDataMeta;
|
|
205
17
|
version: 1;
|
|
206
18
|
};
|
|
207
|
-
/**
|
|
208
|
-
* Registry items the host can attach for UI palettes (stickers,
|
|
209
|
-
* comments, etc.). The shape is intentionally extensible: `id` is the
|
|
210
|
-
* one field the runtime actually relies on (filter, dedup); everything
|
|
211
|
-
* else is consumer-typed via `unknown` so palettes for new domains
|
|
212
|
-
* don't need a contract change.
|
|
213
|
-
*/
|
|
214
19
|
export type WhiteboardDataInput = {
|
|
215
20
|
pages?: Record<string, WhiteboardPageData>;
|
|
216
21
|
meta?: WhiteboardDataMeta;
|
|
217
22
|
version?: number;
|
|
218
23
|
};
|
|
219
|
-
/**
|
|
220
|
-
* Event map for `whiteboard.on(name, fn)` / `whiteboard.emit(name, ...)`.
|
|
221
|
-
* Closed map (no DefaultEventMap fallback) because every event the
|
|
222
|
-
* runtime emits is enumerated here; an unknown event name should be a
|
|
223
|
-
* type error, not an `unknown[]` payload. SD-3213 follow-up to the
|
|
224
|
-
* EventEmitter `unknown[]` drain: that change only fixed the
|
|
225
|
-
* untyped-event fallback; without this map, listeners on Whiteboard
|
|
226
|
-
* still received `unknown[]` because no event was named.
|
|
227
|
-
*/
|
|
228
24
|
export type WhiteboardRegistryItem = {
|
|
229
25
|
id?: string | number;
|
|
230
26
|
[key: string]: unknown;
|
|
@@ -237,9 +33,27 @@ export type WhiteboardEventMap = {
|
|
|
237
33
|
change: [WhiteboardData];
|
|
238
34
|
};
|
|
239
35
|
export type WhiteboardInit = {
|
|
240
|
-
Renderer?:
|
|
36
|
+
Renderer?: WhiteboardPageRenderer;
|
|
241
37
|
enabled?: boolean;
|
|
242
38
|
onChange?: (data: WhiteboardData) => void;
|
|
243
39
|
onSetData?: (pages: WhiteboardPage[]) => void;
|
|
244
40
|
onEnabledChange?: (enabled: boolean) => void;
|
|
245
41
|
};
|
|
42
|
+
export declare class Whiteboard extends EventEmitter<WhiteboardEventMap> {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(props?: WhiteboardInit);
|
|
45
|
+
register(type: string, items: WhiteboardRegistryItem[]): void;
|
|
46
|
+
getType(type: string): WhiteboardRegistryItem[] | undefined;
|
|
47
|
+
setTool(tool: string): void;
|
|
48
|
+
getTool(): string;
|
|
49
|
+
setEnabled(enabled: boolean): void;
|
|
50
|
+
isEnabled(): boolean;
|
|
51
|
+
setOpacity(opacity: number): void;
|
|
52
|
+
getOpacity(): number;
|
|
53
|
+
getPages(): WhiteboardPage[];
|
|
54
|
+
rerender(): void;
|
|
55
|
+
setPageSize(pageIndex: number, size: WhiteboardPageSize): void;
|
|
56
|
+
getPage(pageIndex: number): WhiteboardPage | undefined;
|
|
57
|
+
getWhiteboardData(): WhiteboardData;
|
|
58
|
+
setWhiteboardData(json: WhiteboardDataInput): void;
|
|
59
|
+
}
|
|
@@ -1,210 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {{ width: number, height: number, originalWidth?: number, originalHeight?: number }} WhiteboardPageSize
|
|
3
|
-
* @typedef {{ x: number, y: number }} Point
|
|
4
|
-
*
|
|
5
|
-
* Authored input shapes — what `addStroke`/`addText`/`addImage` accept
|
|
6
|
-
* from a consumer (pixel-space coordinates, optional ids). The
|
|
7
|
-
* add* methods normalize these into the stored shapes below.
|
|
8
|
-
*
|
|
9
|
-
* @typedef {{ points: number[][], color?: string, width?: number, type?: 'draw'|'erase' }} WhiteboardStroke
|
|
10
|
-
* @typedef {{ id?: string|number, x: number, y: number, content: string, fontSize?: number, width?: number }} WhiteboardTextItem
|
|
11
|
-
* @typedef {{ id?: string|number, stickerId?: string, x: number, y: number, src: string, width?: number, height?: number, type?: string }} WhiteboardImageItem
|
|
12
|
-
*
|
|
13
|
-
* Stored / normalized shapes — what the page actually holds in
|
|
14
|
-
* `this.strokes` / `this.text` / `this.images` and what gets
|
|
15
|
-
* serialized via `toJSON()` and re-applied via `applyData()`. Fields
|
|
16
|
-
* suffixed with `N` (pointsN, xN, yN, widthN, heightN, fontSizeN) are
|
|
17
|
-
* normalized to the page's 0..1 coordinate space; raw `width`/`height`
|
|
18
|
-
* pairs are kept where consumers expect pixel sizes.
|
|
19
|
-
*
|
|
20
|
-
* SD-3213 follow-up: the public types were previously `any[]` for the
|
|
21
|
-
* fields and the toJSON / applyData signatures; consumers reading
|
|
22
|
-
* `page.strokes[0].points` would have hit pointsN at runtime with no
|
|
23
|
-
* IntelliSense. The named shapes below restore typing without
|
|
24
|
-
* over-committing the authored shapes (which the add* methods
|
|
25
|
-
* normalize away).
|
|
26
|
-
*
|
|
27
|
-
* @typedef {{ pointsN: number[][], widthN?: number, color?: string, type?: 'draw'|'erase' }} WhiteboardStoredStroke
|
|
28
|
-
* @typedef {{ id: string|number, xN: number, yN: number, content: string, fontSizeN?: number, widthN?: number | null }} WhiteboardStoredTextItem
|
|
29
|
-
* @typedef {{ id: string|number, stickerId?: string | number | null, xN: number, yN: number, src: string, widthN?: number | null, heightN?: number | null, type?: string }} WhiteboardStoredImageItem
|
|
30
|
-
*
|
|
31
|
-
* @typedef {{
|
|
32
|
-
* strokes?: WhiteboardStoredStroke[],
|
|
33
|
-
* text?: WhiteboardStoredTextItem[],
|
|
34
|
-
* images?: WhiteboardStoredImageItem[],
|
|
35
|
-
* }} WhiteboardStoredPageData
|
|
36
|
-
*
|
|
37
|
-
* @typedef {{
|
|
38
|
-
* pageIndex: number,
|
|
39
|
-
* enabled: boolean,
|
|
40
|
-
* Renderer: any,
|
|
41
|
-
* onChange?: () => void,
|
|
42
|
-
* onToolChange?: (tool: string) => void,
|
|
43
|
-
* }} WhiteboardPageInit
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* Per-page whiteboard renderer/controller.
|
|
47
|
-
*/
|
|
48
|
-
export class WhiteboardPage {
|
|
49
|
-
/**
|
|
50
|
-
* Create a page controller.
|
|
51
|
-
* @param {WhiteboardPageInit} props
|
|
52
|
-
*/
|
|
53
|
-
constructor(props: WhiteboardPageInit);
|
|
54
|
-
/** @type {number|null} */
|
|
55
|
-
pageIndex: number | null;
|
|
56
|
-
/** @type {WhiteboardStoredStroke[]} */
|
|
57
|
-
strokes: WhiteboardStoredStroke[];
|
|
58
|
-
/** @type {WhiteboardStoredTextItem[]} */
|
|
59
|
-
text: WhiteboardStoredTextItem[];
|
|
60
|
-
/** @type {WhiteboardStoredImageItem[]} */
|
|
61
|
-
images: WhiteboardStoredImageItem[];
|
|
62
|
-
/** @type {WhiteboardPageSize|null} */
|
|
63
|
-
size: WhiteboardPageSize | null;
|
|
64
|
-
/** @type {{ width: number|null, height: number|null }|null} */
|
|
65
|
-
originalSize: {
|
|
66
|
-
width: number | null;
|
|
67
|
-
height: number | null;
|
|
68
|
-
} | null;
|
|
69
|
-
/**
|
|
70
|
-
* Set tool for this page.
|
|
71
|
-
* @param {string} tool
|
|
72
|
-
*/
|
|
73
|
-
setTool(tool: string): void;
|
|
74
|
-
/**
|
|
75
|
-
* Get current tool for this page.
|
|
76
|
-
* @returns {string}
|
|
77
|
-
*/
|
|
78
|
-
getTool(): string;
|
|
79
|
-
/**
|
|
80
|
-
* Enable/disable interactivity for this page.
|
|
81
|
-
* @param {boolean} enabled
|
|
82
|
-
*/
|
|
83
|
-
setEnabled(enabled: boolean): void;
|
|
84
|
-
/**
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
*/
|
|
87
|
-
isEnabled(): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Store page size (does not resize canvas).
|
|
90
|
-
* @param {WhiteboardPageSize} size
|
|
91
|
-
*/
|
|
92
|
-
setSize(size: WhiteboardPageSize): void;
|
|
93
|
-
/**
|
|
94
|
-
* Resize the Konva stage.
|
|
95
|
-
* @param {number} width
|
|
96
|
-
* @param {number} height
|
|
97
|
-
*/
|
|
98
|
-
resize(width: number, height: number): void;
|
|
99
|
-
/**
|
|
100
|
-
* Mount Konva stage into a container.
|
|
101
|
-
* @param {HTMLElement} container
|
|
102
|
-
*/
|
|
103
|
-
mount(container: HTMLElement): void;
|
|
104
|
-
/**
|
|
105
|
-
* Re-render all content for this page.
|
|
106
|
-
*/
|
|
107
|
-
render(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Render stroke paths.
|
|
110
|
-
*/
|
|
111
|
-
renderStrokes(): void;
|
|
112
|
-
/**
|
|
113
|
-
* Render text nodes.
|
|
114
|
-
*/
|
|
115
|
-
renderText(): void;
|
|
116
|
-
/**
|
|
117
|
-
* Render image/sticker nodes.
|
|
118
|
-
* NOTE: Images are reconciled by id to avoid re-creating nodes (prevents flicker).
|
|
119
|
-
* If src changes for an existing id, this path does not reload the image.
|
|
120
|
-
*/
|
|
121
|
-
renderImages(): void;
|
|
122
|
-
/**
|
|
123
|
-
* Destroy Konva stage and clean up listeners.
|
|
124
|
-
*/
|
|
125
|
-
destroy(): void;
|
|
126
|
-
/**
|
|
127
|
-
* Serialize page data.
|
|
128
|
-
* Returns the page's serializable shape. SD-3213 follow-up: fixed
|
|
129
|
-
* stale JSDoc that said `stickers` (which never existed on the
|
|
130
|
-
* runtime return) and typed the values as the stored normalized
|
|
131
|
-
* shapes instead of `any[]`.
|
|
132
|
-
*
|
|
133
|
-
* @returns {{ strokes: WhiteboardStoredStroke[], text: WhiteboardStoredTextItem[], images: WhiteboardStoredImageItem[] }}
|
|
134
|
-
*/
|
|
135
|
-
toJSON(): {
|
|
136
|
-
strokes: WhiteboardStoredStroke[];
|
|
137
|
-
text: WhiteboardStoredTextItem[];
|
|
138
|
-
images: WhiteboardStoredImageItem[];
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Apply data to this page and re-render.
|
|
142
|
-
* @param {WhiteboardStoredPageData} data
|
|
143
|
-
*/
|
|
144
|
-
applyData(data?: WhiteboardStoredPageData): void;
|
|
145
|
-
/**
|
|
146
|
-
* Add a stroke to the model.
|
|
147
|
-
* @param {WhiteboardStroke} stroke
|
|
148
|
-
*/
|
|
149
|
-
addStroke(stroke: WhiteboardStroke): void;
|
|
150
|
-
/**
|
|
151
|
-
* Add a text item to the model.
|
|
152
|
-
* @param {WhiteboardTextItem} item
|
|
153
|
-
*/
|
|
154
|
-
addText(item: WhiteboardTextItem): void;
|
|
155
|
-
/**
|
|
156
|
-
* Add an image/sticker to the model.
|
|
157
|
-
* @param {WhiteboardImageItem} item
|
|
158
|
-
*/
|
|
159
|
-
addImage(item: WhiteboardImageItem): void;
|
|
160
|
-
#private;
|
|
161
|
-
}
|
|
162
1
|
export type WhiteboardPageSize = {
|
|
163
2
|
width: number;
|
|
164
3
|
height: number;
|
|
165
4
|
originalWidth?: number;
|
|
166
5
|
originalHeight?: number;
|
|
167
6
|
};
|
|
168
|
-
/**
|
|
169
|
-
* Authored input shapes — what `addStroke`/`addText`/`addImage` accept
|
|
170
|
-
* from a consumer (pixel-space coordinates, optional ids). The
|
|
171
|
-
* add* methods normalize these into the stored shapes below.
|
|
172
|
-
*/
|
|
173
7
|
export type Point = {
|
|
174
8
|
x: number;
|
|
175
9
|
y: number;
|
|
176
10
|
};
|
|
11
|
+
export type WhiteboardItemId = string | number;
|
|
12
|
+
export type WhiteboardStrokeType = 'draw' | 'erase';
|
|
177
13
|
export type WhiteboardStroke = {
|
|
178
14
|
points: number[][];
|
|
179
15
|
color?: string;
|
|
180
16
|
width?: number;
|
|
181
|
-
type?:
|
|
17
|
+
type?: WhiteboardStrokeType;
|
|
182
18
|
};
|
|
183
19
|
export type WhiteboardTextItem = {
|
|
184
|
-
id?:
|
|
20
|
+
id?: WhiteboardItemId;
|
|
185
21
|
x: number;
|
|
186
22
|
y: number;
|
|
187
23
|
content: string;
|
|
188
24
|
fontSize?: number;
|
|
189
25
|
width?: number;
|
|
190
26
|
};
|
|
191
|
-
/**
|
|
192
|
-
* Stored / normalized shapes — what the page actually holds in
|
|
193
|
-
* `this.strokes` / `this.text` / `this.images` and what gets
|
|
194
|
-
* serialized via `toJSON()` and re-applied via `applyData()`. Fields
|
|
195
|
-
* suffixed with `N` (pointsN, xN, yN, widthN, heightN, fontSizeN) are
|
|
196
|
-
* normalized to the page's 0..1 coordinate space; raw `width`/`height`
|
|
197
|
-
* pairs are kept where consumers expect pixel sizes.
|
|
198
|
-
*
|
|
199
|
-
* SD-3213 follow-up: the public types were previously `any[]` for the
|
|
200
|
-
* fields and the toJSON / applyData signatures; consumers reading
|
|
201
|
-
* `page.strokes[0].points` would have hit pointsN at runtime with no
|
|
202
|
-
* IntelliSense. The named shapes below restore typing without
|
|
203
|
-
* over-committing the authored shapes (which the add* methods
|
|
204
|
-
* normalize away).
|
|
205
|
-
*/
|
|
206
27
|
export type WhiteboardImageItem = {
|
|
207
|
-
id?:
|
|
28
|
+
id?: WhiteboardItemId;
|
|
208
29
|
stickerId?: string;
|
|
209
30
|
x: number;
|
|
210
31
|
y: number;
|
|
@@ -217,10 +38,10 @@ export type WhiteboardStoredStroke = {
|
|
|
217
38
|
pointsN: number[][];
|
|
218
39
|
widthN?: number;
|
|
219
40
|
color?: string;
|
|
220
|
-
type?:
|
|
41
|
+
type?: WhiteboardStrokeType;
|
|
221
42
|
};
|
|
222
43
|
export type WhiteboardStoredTextItem = {
|
|
223
|
-
id:
|
|
44
|
+
id: WhiteboardItemId;
|
|
224
45
|
xN: number;
|
|
225
46
|
yN: number;
|
|
226
47
|
content: string;
|
|
@@ -228,8 +49,8 @@ export type WhiteboardStoredTextItem = {
|
|
|
228
49
|
widthN?: number | null;
|
|
229
50
|
};
|
|
230
51
|
export type WhiteboardStoredImageItem = {
|
|
231
|
-
id:
|
|
232
|
-
stickerId?:
|
|
52
|
+
id: WhiteboardItemId;
|
|
53
|
+
stickerId?: WhiteboardItemId | null;
|
|
233
54
|
xN: number;
|
|
234
55
|
yN: number;
|
|
235
56
|
src: string;
|
|
@@ -242,10 +63,163 @@ export type WhiteboardStoredPageData = {
|
|
|
242
63
|
text?: WhiteboardStoredTextItem[];
|
|
243
64
|
images?: WhiteboardStoredImageItem[];
|
|
244
65
|
};
|
|
66
|
+
export type WhiteboardSerializedPage = {
|
|
67
|
+
strokes: WhiteboardStoredStroke[];
|
|
68
|
+
text: WhiteboardStoredTextItem[];
|
|
69
|
+
images: WhiteboardStoredImageItem[];
|
|
70
|
+
};
|
|
71
|
+
export type WhiteboardRendererEvent = {
|
|
72
|
+
target?: unknown;
|
|
73
|
+
cancelBubble?: boolean;
|
|
74
|
+
};
|
|
75
|
+
export interface WhiteboardRendererNode {
|
|
76
|
+
_whiteboardId?: WhiteboardItemId;
|
|
77
|
+
on(events: string, handler: (event: WhiteboardRendererEvent) => void): unknown;
|
|
78
|
+
destroy(): unknown;
|
|
79
|
+
name(): string;
|
|
80
|
+
name(name: string): unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface WhiteboardShapeNode extends WhiteboardRendererNode {
|
|
83
|
+
x(): number;
|
|
84
|
+
x(value: number): unknown;
|
|
85
|
+
y(): number;
|
|
86
|
+
y(value: number): unknown;
|
|
87
|
+
width(): number;
|
|
88
|
+
width(value: number): unknown;
|
|
89
|
+
height(): number;
|
|
90
|
+
height(value: number): unknown;
|
|
91
|
+
scaleX(): number;
|
|
92
|
+
scaleY(): number;
|
|
93
|
+
scale(scale: Point): unknown;
|
|
94
|
+
draggable(value: boolean): unknown;
|
|
95
|
+
position(): Point;
|
|
96
|
+
}
|
|
97
|
+
export interface WhiteboardTextNode extends WhiteboardShapeNode {
|
|
98
|
+
scaleY(): number;
|
|
99
|
+
scaleY(value: number): unknown;
|
|
100
|
+
setAttrs(attrs: {
|
|
101
|
+
width: number;
|
|
102
|
+
scaleX: number;
|
|
103
|
+
scaleY?: number;
|
|
104
|
+
}): unknown;
|
|
105
|
+
text(): string;
|
|
106
|
+
text(value: string): unknown;
|
|
107
|
+
fontSize(): number;
|
|
108
|
+
fontFamily(): string;
|
|
109
|
+
fill(): string | CanvasGradient;
|
|
110
|
+
}
|
|
111
|
+
export interface WhiteboardLineNode extends WhiteboardRendererNode {
|
|
112
|
+
points(points: number[]): unknown;
|
|
113
|
+
}
|
|
114
|
+
export type WhiteboardBox = {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
width: number;
|
|
118
|
+
height: number;
|
|
119
|
+
rotation: number;
|
|
120
|
+
};
|
|
121
|
+
export type WhiteboardBoundBoxFunc = (oldBox: WhiteboardBox, newBox: WhiteboardBox) => WhiteboardBox;
|
|
122
|
+
export interface WhiteboardTransformerNode {
|
|
123
|
+
destroy(): unknown;
|
|
124
|
+
nodes(nodes: WhiteboardShapeNode[]): unknown;
|
|
125
|
+
enabledAnchors(anchors: string[]): unknown;
|
|
126
|
+
boundBoxFunc(fn: WhiteboardBoundBoxFunc): unknown;
|
|
127
|
+
}
|
|
128
|
+
export interface WhiteboardLayerNode {
|
|
129
|
+
add(child: WhiteboardRendererNode | WhiteboardTransformerNode): unknown;
|
|
130
|
+
find(selector: string): WhiteboardShapeNode[];
|
|
131
|
+
destroyChildren(): unknown;
|
|
132
|
+
batchDraw(): unknown;
|
|
133
|
+
listening(listening: boolean): unknown;
|
|
134
|
+
getCanvas(): {
|
|
135
|
+
setPixelRatio(ratio: number): unknown;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export interface WhiteboardStageNode {
|
|
139
|
+
on(events: string, handler: (event: WhiteboardRendererEvent) => void): unknown;
|
|
140
|
+
add(layer: WhiteboardLayerNode): unknown;
|
|
141
|
+
size(size: {
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
}): unknown;
|
|
145
|
+
getPointerPosition(): Point | null;
|
|
146
|
+
destroy(): unknown;
|
|
147
|
+
}
|
|
148
|
+
export type WhiteboardLineConfig = {
|
|
149
|
+
points: number[];
|
|
150
|
+
stroke: string;
|
|
151
|
+
strokeWidth: number;
|
|
152
|
+
lineCap: 'round';
|
|
153
|
+
lineJoin: 'round';
|
|
154
|
+
globalCompositeOperation: 'destination-out' | 'source-over';
|
|
155
|
+
};
|
|
156
|
+
export interface WhiteboardPageRenderer {
|
|
157
|
+
Stage: new (config: {
|
|
158
|
+
container: HTMLDivElement;
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
}) => WhiteboardStageNode;
|
|
162
|
+
Layer: new () => WhiteboardLayerNode;
|
|
163
|
+
Line: new (config: WhiteboardLineConfig) => WhiteboardLineNode;
|
|
164
|
+
Text: new (config: {
|
|
165
|
+
x: number;
|
|
166
|
+
y: number;
|
|
167
|
+
text: string;
|
|
168
|
+
fontSize: number;
|
|
169
|
+
fontFamily: string;
|
|
170
|
+
fill: string;
|
|
171
|
+
draggable: boolean;
|
|
172
|
+
width: number | undefined;
|
|
173
|
+
}) => WhiteboardTextNode;
|
|
174
|
+
Image: new (config: {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
image: HTMLImageElement;
|
|
178
|
+
width: number;
|
|
179
|
+
height: number;
|
|
180
|
+
draggable: boolean;
|
|
181
|
+
}) => WhiteboardShapeNode;
|
|
182
|
+
Transformer: new (config: {
|
|
183
|
+
enabledAnchors: string[];
|
|
184
|
+
rotateEnabled: boolean;
|
|
185
|
+
keepRatio: boolean;
|
|
186
|
+
boundBoxFunc: WhiteboardBoundBoxFunc;
|
|
187
|
+
}) => WhiteboardTransformerNode;
|
|
188
|
+
}
|
|
245
189
|
export type WhiteboardPageInit = {
|
|
246
190
|
pageIndex: number;
|
|
247
191
|
enabled: boolean;
|
|
248
|
-
Renderer
|
|
192
|
+
Renderer?: WhiteboardPageRenderer;
|
|
249
193
|
onChange?: () => void;
|
|
250
194
|
onToolChange?: (tool: string) => void;
|
|
251
195
|
};
|
|
196
|
+
export declare class WhiteboardPage {
|
|
197
|
+
#private;
|
|
198
|
+
pageIndex: number;
|
|
199
|
+
strokes: WhiteboardStoredStroke[];
|
|
200
|
+
text: WhiteboardStoredTextItem[];
|
|
201
|
+
images: WhiteboardStoredImageItem[];
|
|
202
|
+
size: WhiteboardPageSize | null;
|
|
203
|
+
originalSize: {
|
|
204
|
+
width: number | null;
|
|
205
|
+
height: number | null;
|
|
206
|
+
} | null;
|
|
207
|
+
constructor(props: WhiteboardPageInit);
|
|
208
|
+
setTool(tool: string): void;
|
|
209
|
+
getTool(): string;
|
|
210
|
+
setEnabled(enabled: boolean): void;
|
|
211
|
+
isEnabled(): boolean;
|
|
212
|
+
setSize(size: WhiteboardPageSize): void;
|
|
213
|
+
resize(width: number, height: number): void;
|
|
214
|
+
mount(container: HTMLDivElement): void;
|
|
215
|
+
render(): void;
|
|
216
|
+
renderStrokes(): void;
|
|
217
|
+
renderText(): void;
|
|
218
|
+
renderImages(): void;
|
|
219
|
+
destroy(): void;
|
|
220
|
+
toJSON(): WhiteboardSerializedPage;
|
|
221
|
+
applyData(data?: WhiteboardStoredPageData): void;
|
|
222
|
+
addStroke(stroke: WhiteboardStroke): void;
|
|
223
|
+
addText(item: WhiteboardTextItem): void;
|
|
224
|
+
addImage(item: WhiteboardImageItem): void;
|
|
225
|
+
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TextareaSize = number | string;
|
|
2
|
+
export interface TextareaOptions {
|
|
3
|
+
value?: string;
|
|
4
|
+
left?: number;
|
|
5
|
+
top?: number;
|
|
6
|
+
width?: TextareaSize;
|
|
7
|
+
height?: TextareaSize;
|
|
8
|
+
fontSize?: TextareaSize;
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
background?: string;
|
|
12
|
+
resize?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createTextarea(options?: TextareaOptions): HTMLTextAreaElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function flattenPoints(points:
|
|
1
|
+
export declare function flattenPoints(points: readonly (readonly number[])[]): number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getRandomId(prefix?: string): string;
|
|
1
|
+
export declare function getRandomId(prefix?: string): string;
|