@ngstarter-ui/components 22.3.1 → 22.3.3

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.
@@ -0,0 +1,350 @@
1
+ import * as _angular_core from '@angular/core';
2
+
3
+ type WhiteboardElementType = 'pencil' | 'rectangle' | 'diamond' | 'ellipse' | 'arrow' | 'line' | 'text' | 'note';
4
+ type WhiteboardTool = WhiteboardElementType | 'select' | 'hand' | 'eraser';
5
+ type WhiteboardLineStyle = 'solid' | 'dashed' | 'dotted';
6
+ type WhiteboardLocale = 'en' | 'ru';
7
+ interface WhiteboardStyle {
8
+ stroke: string;
9
+ fill: string;
10
+ strokeWidth: number;
11
+ opacity: number;
12
+ lineStyle: WhiteboardLineStyle;
13
+ fontSize: number;
14
+ fontFamily?: string;
15
+ textAlign?: 'left' | 'center' | 'right';
16
+ }
17
+ /** A point on a block outline, in fractions of its local width and height. */
18
+ interface WhiteboardBinding {
19
+ elementId: string;
20
+ anchor: readonly [x: number, y: number];
21
+ }
22
+ /** Coordinates are in canvas space, independent of viewport size, pan and zoom. */
23
+ interface WhiteboardElement extends WhiteboardStyle {
24
+ id: string;
25
+ type: WhiteboardElementType;
26
+ x: number;
27
+ y: number;
28
+ width: number;
29
+ height: number;
30
+ rotation?: number;
31
+ scaleX?: number;
32
+ scaleY?: number;
33
+ /** Flat, element-local x/y pairs for pencil strokes, lines and arrows. */
34
+ points?: readonly number[];
35
+ /** Element-local point the curve passes through, halfway between the endpoints in curve time. */
36
+ bend?: readonly [x: number, y: number];
37
+ /** Optional connections for lines and arrows. Points retain their last resolved positions. */
38
+ startBinding?: WhiteboardBinding;
39
+ endBinding?: WhiteboardBinding;
40
+ /** Optional pen-pressure samples, one per x/y point pair. */
41
+ pressures?: readonly number[];
42
+ text?: string;
43
+ }
44
+ interface WhiteboardDocument {
45
+ version: 1;
46
+ elements: readonly WhiteboardElement[];
47
+ }
48
+ interface WhiteboardViewport {
49
+ x: number;
50
+ y: number;
51
+ zoom: number;
52
+ }
53
+ interface WhiteboardExportOptions {
54
+ pixelRatio?: number;
55
+ backgroundColor?: string;
56
+ padding?: number;
57
+ }
58
+
59
+ type WhiteboardTypography = Pick<WhiteboardStyle, 'fontFamily' | 'fontSize' | 'textAlign'>;
60
+
61
+ declare class Whiteboard {
62
+ /** Portable canvas data. Replace this value to load a document and reset undo history. */
63
+ readonly value: _angular_core.ModelSignal<WhiteboardDocument>;
64
+ readonly tool: _angular_core.ModelSignal<WhiteboardTool>;
65
+ readonly title: _angular_core.InputSignal<string>;
66
+ readonly subtitle: _angular_core.InputSignal<string>;
67
+ readonly locale: _angular_core.InputSignal<WhiteboardLocale>;
68
+ readonly toolLocked: _angular_core.ModelSignal<boolean>;
69
+ readonly pressureSensitive: _angular_core.ModelSignal<boolean>;
70
+ readonly drawingStyle: _angular_core.ModelSignal<WhiteboardStyle>;
71
+ readonly readOnly: _angular_core.InputSignalWithTransform<boolean, unknown>;
72
+ readonly showToolbar: _angular_core.InputSignalWithTransform<boolean, unknown>;
73
+ readonly showGrid: _angular_core.ModelSignal<boolean>;
74
+ readonly showProperties: _angular_core.ModelSignal<boolean>;
75
+ readonly colors: _angular_core.InputSignal<string[]>;
76
+ readonly selectionChange: _angular_core.OutputEmitterRef<readonly WhiteboardElement[]>;
77
+ readonly viewportChange: _angular_core.OutputEmitterRef<WhiteboardViewport>;
78
+ readonly exported: _angular_core.OutputEmitterRef<string>;
79
+ readonly importError: _angular_core.OutputEmitterRef<Error>;
80
+ readonly canUndo: _angular_core.WritableSignal<boolean>;
81
+ readonly canRedo: _angular_core.WritableSignal<boolean>;
82
+ readonly selectedElements: _angular_core.WritableSignal<readonly WhiteboardElement[]>;
83
+ readonly viewport: _angular_core.WritableSignal<WhiteboardViewport>;
84
+ protected readonly zoomLabel: _angular_core.Signal<string>;
85
+ protected readonly style: _angular_core.ModelSignal<WhiteboardStyle>;
86
+ protected readonly labels: _angular_core.Signal<{
87
+ tools: {
88
+ hand: string;
89
+ select: string;
90
+ rectangle: string;
91
+ diamond: string;
92
+ ellipse: string;
93
+ arrow: string;
94
+ line: string;
95
+ pencil: string;
96
+ text: string;
97
+ note: string;
98
+ eraser: string;
99
+ };
100
+ properties: string;
101
+ closeProperties: string;
102
+ color: string;
103
+ stroke: string;
104
+ customColor: string;
105
+ fill: string;
106
+ noFill: string;
107
+ width: string;
108
+ lineStyle: string;
109
+ solid: string;
110
+ dashed: string;
111
+ dotted: string;
112
+ arrowheadColor: string;
113
+ useStrokeColor: string;
114
+ opacity: string;
115
+ lockTool: string;
116
+ export: string;
117
+ more: string;
118
+ exportPng: string;
119
+ saveJson: string;
120
+ openJson: string;
121
+ clear: string;
122
+ clearTitle: string;
123
+ clearDescription: string;
124
+ duplicate: string;
125
+ delete: string;
126
+ zoomOut: string;
127
+ zoomIn: string;
128
+ resetZoom: string;
129
+ fit: string;
130
+ undo: string;
131
+ redo: string;
132
+ grid: string;
133
+ canvasHint: string;
134
+ canvasHelp: string;
135
+ text: string;
136
+ textColor: string;
137
+ noteText: string;
138
+ notePlaceholder: string;
139
+ fontFamily: string;
140
+ fontSize: string;
141
+ textAlign: string;
142
+ fonts: {
143
+ handwritten: string;
144
+ sans: string;
145
+ mono: string;
146
+ serif: string;
147
+ };
148
+ fontSizes: {
149
+ S: string;
150
+ M: string;
151
+ L: string;
152
+ XL: string;
153
+ };
154
+ alignments: {
155
+ left: string;
156
+ center: string;
157
+ right: string;
158
+ };
159
+ dismiss: string;
160
+ objects: string;
161
+ } | {
162
+ tools: {
163
+ hand: string;
164
+ select: string;
165
+ rectangle: string;
166
+ diamond: string;
167
+ ellipse: string;
168
+ arrow: string;
169
+ line: string;
170
+ pencil: string;
171
+ text: string;
172
+ note: string;
173
+ eraser: string;
174
+ };
175
+ properties: string;
176
+ closeProperties: string;
177
+ color: string;
178
+ stroke: string;
179
+ customColor: string;
180
+ fill: string;
181
+ noFill: string;
182
+ width: string;
183
+ lineStyle: string;
184
+ solid: string;
185
+ dashed: string;
186
+ dotted: string;
187
+ arrowheadColor: string;
188
+ useStrokeColor: string;
189
+ opacity: string;
190
+ lockTool: string;
191
+ export: string;
192
+ more: string;
193
+ exportPng: string;
194
+ saveJson: string;
195
+ openJson: string;
196
+ clear: string;
197
+ clearTitle: string;
198
+ clearDescription: string;
199
+ duplicate: string;
200
+ delete: string;
201
+ zoomOut: string;
202
+ zoomIn: string;
203
+ resetZoom: string;
204
+ fit: string;
205
+ undo: string;
206
+ redo: string;
207
+ grid: string;
208
+ canvasHint: string;
209
+ canvasHelp: string;
210
+ text: string;
211
+ textColor: string;
212
+ noteText: string;
213
+ notePlaceholder: string;
214
+ fontFamily: string;
215
+ fontSize: string;
216
+ textAlign: string;
217
+ fonts: {
218
+ handwritten: string;
219
+ sans: string;
220
+ mono: string;
221
+ serif: string;
222
+ };
223
+ fontSizes: {
224
+ S: string;
225
+ M: string;
226
+ L: string;
227
+ XL: string;
228
+ };
229
+ alignments: {
230
+ left: string;
231
+ center: string;
232
+ right: string;
233
+ };
234
+ dismiss: string;
235
+ objects: string;
236
+ }>;
237
+ protected readonly fills: string[];
238
+ protected readonly textDraft: _angular_core.WritableSignal<string>;
239
+ protected readonly textEdit: _angular_core.WritableSignal<WhiteboardElement | undefined>;
240
+ protected readonly textEditorLayout: _angular_core.Signal<{
241
+ width: number;
242
+ height: number;
243
+ padding: number;
244
+ paddingTop: number;
245
+ lineHeight: number;
246
+ } | undefined>;
247
+ protected readonly textEditorTransform: _angular_core.Signal<string | undefined>;
248
+ protected readonly selectedText: _angular_core.Signal<WhiteboardElement | undefined>;
249
+ protected readonly propertyControls: _angular_core.Signal<{
250
+ colorLabel: string;
251
+ fillLabel: string | undefined;
252
+ arrowhead: boolean;
253
+ strokeWidth: boolean;
254
+ lineStyle: boolean;
255
+ typography: boolean;
256
+ } | undefined>;
257
+ protected readonly typography: _angular_core.Signal<{
258
+ fontFamily: string;
259
+ fontSize: number;
260
+ textAlign: "left" | "center" | "right";
261
+ }>;
262
+ protected readonly fontOptions: readonly [{
263
+ readonly key: "handwritten";
264
+ readonly value: "Caveat, cursive";
265
+ readonly icon: "fluent:edit-24-regular";
266
+ }, {
267
+ readonly key: "sans";
268
+ readonly value: "DM Sans, sans-serif";
269
+ readonly icon: "fluent:text-font-24-regular";
270
+ }, {
271
+ readonly key: "mono";
272
+ readonly value: "monospace";
273
+ readonly icon: "fluent:code-24-regular";
274
+ }, {
275
+ readonly key: "serif";
276
+ readonly value: "Georgia, serif";
277
+ }];
278
+ protected readonly fontSizes: readonly [{
279
+ readonly label: "S";
280
+ readonly value: 16;
281
+ }, {
282
+ readonly label: "M";
283
+ readonly value: 24;
284
+ }, {
285
+ readonly label: "L";
286
+ readonly value: 32;
287
+ }, {
288
+ readonly label: "XL";
289
+ readonly value: 48;
290
+ }];
291
+ protected readonly textAlignments: readonly ["left", "center", "right"];
292
+ protected readonly errorMessage: _angular_core.WritableSignal<string>;
293
+ protected readonly toolLabel: _angular_core.Signal<string>;
294
+ protected readonly tools: {
295
+ value: WhiteboardTool;
296
+ label: string;
297
+ icon: string;
298
+ shortcut: string;
299
+ }[];
300
+ private readonly canvas;
301
+ private readonly textEditor;
302
+ private readonly document;
303
+ private readonly zone;
304
+ private readonly destroyRef;
305
+ private readonly confirm;
306
+ private engine?;
307
+ private resizeObserver?;
308
+ private lastDocument?;
309
+ private previousTool;
310
+ private focusedTextEditor?;
311
+ constructor();
312
+ undo(): void;
313
+ redo(): void;
314
+ clear(): void;
315
+ deleteSelection(): void;
316
+ duplicateSelection(): void;
317
+ zoomIn(): void;
318
+ zoomOut(): void;
319
+ resetView(): void;
320
+ fitToContent(): void;
321
+ /** Repaint after the consuming application finishes loading a custom canvas font. */
322
+ redraw(): void;
323
+ exportJson(): string;
324
+ exportPng(options?: WhiteboardExportOptions): string | null;
325
+ importJson(json: string): void;
326
+ protected updateStyle(style: Partial<WhiteboardStyle>): void;
327
+ protected updateTypography(style: Partial<WhiteboardTypography>): void;
328
+ protected keepTextFocus(event: MouseEvent): void;
329
+ protected confirmClear(): void;
330
+ protected importFile(event: Event): Promise<void>;
331
+ protected downloadPng(): void;
332
+ protected downloadJson(): void;
333
+ private download;
334
+ private editText;
335
+ protected finishTextEditing(text?: string): void;
336
+ protected onTextKeydown(event: KeyboardEvent, text: string): void;
337
+ protected focusCanvasFromPointer(event: MouseEvent): void;
338
+ protected selectTool(tool: WhiteboardTool, toggle?: boolean): void;
339
+ protected releasePan(): void;
340
+ protected onKeyup(event: KeyboardEvent): void;
341
+ protected onKeydown(event: KeyboardEvent): void;
342
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Whiteboard, never>;
343
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Whiteboard, "ngs-whiteboard", ["ngsWhiteboard"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "tool": { "alias": "tool"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "subtitle": { "alias": "subtitle"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "toolLocked": { "alias": "toolLocked"; "required": false; "isSignal": true; }; "pressureSensitive": { "alias": "pressureSensitive"; "required": false; "isSignal": true; }; "drawingStyle": { "alias": "drawingStyle"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readonly"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "showGrid": { "alias": "showGrid"; "required": false; "isSignal": true; }; "showProperties": { "alias": "showProperties"; "required": false; "isSignal": true; }; "colors": { "alias": "colors"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "tool": "toolChange"; "toolLocked": "toolLockedChange"; "pressureSensitive": "pressureSensitiveChange"; "drawingStyle": "drawingStyleChange"; "showGrid": "showGridChange"; "showProperties": "showPropertiesChange"; "selectionChange": "selectionChange"; "viewportChange": "viewportChange"; "exported": "exported"; "importError": "importError"; }, never, never, true, never>;
344
+ }
345
+
346
+ /** Parses the portable data format, never Konva's executable scene graph. */
347
+ declare function parseWhiteboardDocument(json: string): WhiteboardDocument;
348
+
349
+ export { Whiteboard, parseWhiteboardDocument };
350
+ export type { WhiteboardBinding, WhiteboardDocument, WhiteboardElement, WhiteboardElementType, WhiteboardExportOptions, WhiteboardLineStyle, WhiteboardLocale, WhiteboardStyle, WhiteboardTool, WhiteboardViewport };