@leapfrog/interactive-canvas 0.1.0 → 1.0.0

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 (61) hide show
  1. package/dist/{interactive-canvas.impl.d.ts → abstract-interactive-canvas.d.ts} +340 -305
  2. package/dist/dimensions/pixel-canvas-dimensions.d.ts +13 -13
  3. package/dist/dimensions/print-6-col-canvas-dimensions.d.ts +18 -18
  4. package/dist/dimensions/print-8-col-canvas-dimensions.d.ts +18 -18
  5. package/dist/font/font-library.d.ts +27 -22
  6. package/dist/font/font-library.interface.d.ts +24 -20
  7. package/dist/font/font.interface.d.ts +20 -20
  8. package/dist/font/unknown-font.d.ts +6 -6
  9. package/dist/headless-interactive-canvas.d.ts +9 -0
  10. package/dist/index.d.ts +49 -47
  11. package/dist/interactive-canvas.d.ts +8 -0
  12. package/dist/interactive-canvas.es.js +3193 -0
  13. package/dist/interactive-canvas.interface.d.ts +267 -221
  14. package/dist/interactive-canvas.js +3222 -34
  15. package/dist/layout/abstract-layout-manager.d.ts +17 -18
  16. package/dist/layout/advanced-layout-manager.d.ts +15 -15
  17. package/dist/layout/function/pin-to-bottom.layout-function.d.ts +4 -4
  18. package/dist/layout/function/redraw-all.layout-function.d.ts +4 -4
  19. package/dist/layout/function/reposition-borders.layout-function.d.ts +4 -4
  20. package/dist/layout/function/reposition-cutoffs.layout-function.d.ts +4 -4
  21. package/dist/layout/function/resize-canvas.layout-function.d.ts +4 -4
  22. package/dist/layout/function/stack-objects.layout-function.d.ts +11 -11
  23. package/dist/layout/function/update-object-dimensions.layout-function.d.ts +4 -4
  24. package/dist/layout/layout-manager.enum.d.ts +5 -5
  25. package/dist/layout/layout-manager.interface.d.ts +13 -13
  26. package/dist/layout/standard-layout-manager.d.ts +35 -36
  27. package/dist/mutator/mutable-background-color.interface.d.ts +15 -15
  28. package/dist/mutator/mutable-color.interface.d.ts +6 -6
  29. package/dist/mutator/mutable-image.interface.d.ts +28 -28
  30. package/dist/mutator/mutable-position.interface.d.ts +33 -33
  31. package/dist/mutator/mutable-text-style.interface.d.ts +163 -149
  32. package/dist/mutator/mutable-text.interface.d.ts +40 -40
  33. package/dist/object/abstract-canvas-object.d.ts +155 -155
  34. package/dist/object/canvas-object-data.d.ts +23 -23
  35. package/dist/object/canvas-object.interface.d.ts +96 -96
  36. package/dist/object/impl/border.d.ts +59 -60
  37. package/dist/object/impl/cutoff.d.ts +59 -60
  38. package/dist/object/impl/horizontal-rule.d.ts +88 -89
  39. package/dist/object/impl/image.d.ts +81 -82
  40. package/dist/object/impl/rectangle.d.ts +58 -59
  41. package/dist/object/impl/text.d.ts +264 -255
  42. package/dist/object/impl/vertical-rule.d.ts +88 -89
  43. package/dist/profile/canvas-profile.interface.d.ts +22 -22
  44. package/dist/profile/default-canvas-profile.d.ts +23 -23
  45. package/dist/types/canvas-dimension-restrictions.interface.d.ts +14 -14
  46. package/dist/types/canvas-dimensions.interface.d.ts +21 -21
  47. package/dist/types/canvas-state.interface.d.ts +11 -11
  48. package/dist/types/dimension-restrictions.interface.d.ts +6 -6
  49. package/dist/types/image-type.enum.d.ts +6 -6
  50. package/dist/types/margin.interface.d.ts +6 -6
  51. package/dist/types/object-dimensions.interface.d.ts +23 -23
  52. package/dist/types/object-type.enum.d.ts +10 -10
  53. package/dist/types/overflow.interface.d.ts +4 -4
  54. package/dist/types/position.interface.d.ts +6 -6
  55. package/dist/types/rect.interface.d.ts +6 -6
  56. package/dist/types/selection-data.interface.d.ts +19 -19
  57. package/dist/types/text-alignment.interface.d.ts +1 -1
  58. package/package.json +7 -9
  59. package/readme.md +12 -1
  60. package/dist/interactive-canvas.js.map +0 -1
  61. package/dist/interactive-canvas.nomin.js +0 -57456
@@ -1,255 +1,264 @@
1
- import { Observable } from "rxjs";
2
- import { IFont, IMutableBackgroundColor, IMutableColor, IMutablePosition, IMutableText, IMutableTextStyle, ITextSelection, TextAlignment } from "../..";
3
- import { ICanvasObject } from "../canvas-object.interface";
4
- import { AbstractCanvasObject } from "../abstract-canvas-object";
5
- import { InteractiveCanvas } from "../../interactive-canvas.impl";
6
- import { CanvasObjectData } from "../canvas-object-data";
7
- import { fabric } from "fabric";
8
- /**
9
- * Text field. Displays customizable text.
10
- */
11
- export interface IText extends ICanvasObject, IMutableColor, IMutableText, IMutableTextStyle, IMutablePosition, IMutableBackgroundColor {
12
- /**
13
- * @return Whether this text object should resize the canvas.
14
- */
15
- isResizeCanvas(): boolean;
16
- /**
17
- * Set whether this text object should resize the canvas.
18
- */
19
- setResizeCanvas(value: boolean): void;
20
- /**
21
- * Focus input on the text object.
22
- */
23
- focus(): void;
24
- /**
25
- * @return Is the text box currently being edited.
26
- */
27
- isEditing(): boolean;
28
- /**
29
- * Start editing the text.
30
- */
31
- enterEditing(): void;
32
- /**
33
- * Select all text.
34
- */
35
- selectAllText(): void;
36
- /**
37
- * Set the prefill type used for this text field.
38
- */
39
- setPrefillType(prefillType: string): void;
40
- /**
41
- * Get the prefill type used for this text field.
42
- */
43
- getPrefillType(): string;
44
- }
45
- export declare class Text extends AbstractCanvasObject<fabric.Textbox> implements IText {
46
- private readonly fontLibrary;
47
- private baseComponentHeight;
48
- private readonly text$;
49
- private readonly textSelection$;
50
- constructor(canvas: InteractiveCanvas, fabricObject: fabric.Textbox, persistedField?: CanvasObjectData);
51
- /**
52
- * @override
53
- * @inheritDoc
54
- */
55
- getText(): string;
56
- /**
57
- * @override
58
- * @inheritDoc
59
- */
60
- getText$(): Observable<string>;
61
- /**
62
- * @override
63
- * @inheritDoc
64
- */
65
- setText(text: string): void;
66
- /**
67
- * @override
68
- * @inheritDoc
69
- */
70
- replaceText(target: string, replacement: string): void;
71
- /**
72
- * @override
73
- * @inheritDoc
74
- */
75
- getColor(): string;
76
- /**
77
- * @override
78
- * @inheritDoc
79
- */
80
- setColor(color: string): void;
81
- /**
82
- * @override
83
- * @inheritDoc
84
- */
85
- getTextSelection(): ITextSelection;
86
- /**
87
- * @override
88
- * @inheritDoc
89
- */
90
- getTextSelection$(): Observable<ITextSelection>;
91
- /**
92
- * @override
93
- * @inheritDoc
94
- */
95
- setTextAlign(alignment: TextAlignment): void;
96
- /**
97
- * @override
98
- * @inheritDoc
99
- */
100
- setCharSpacing(spacing: number): void;
101
- /**
102
- * @override
103
- * @inheritDoc
104
- */
105
- setLineHeight(height: number): void;
106
- /**
107
- * @override
108
- * @inheritDoc
109
- */
110
- setBold(bold?: boolean): void;
111
- /**
112
- * @override
113
- * @inheritDoc
114
- */
115
- setItalic(italic?: boolean): void;
116
- /**
117
- * @override
118
- * @inheritDoc
119
- */
120
- setStrikethrough(strikethrough?: boolean): void;
121
- /**
122
- * @override
123
- * @inheritDoc
124
- */
125
- setUnderline(underline?: boolean): void;
126
- /**
127
- * @override
128
- * @inheritDoc
129
- */
130
- setFont(font: IFont): void;
131
- /**
132
- * @override
133
- * @inheritDoc
134
- */
135
- setFontSize(fontSize: number): void;
136
- /**
137
- * @override
138
- * @inheritDoc
139
- */
140
- setTextBackgroundColor(color: string): void;
141
- /**
142
- * @override
143
- * @inheritDoc
144
- */
145
- centerHorizontally(): void;
146
- /**
147
- * @override
148
- * @inheritDoc
149
- */
150
- centerVertically(): void;
151
- /**
152
- * @override
153
- * @inheritDoc
154
- */
155
- setHeight(height: number): void;
156
- /**
157
- * @override
158
- * @inheritDoc
159
- */
160
- nudgeUp(): void;
161
- /**
162
- * @override
163
- * @inheritDoc
164
- */
165
- nudgeDown(): void;
166
- /**
167
- * @override
168
- * @inheritDoc
169
- */
170
- nudgeLeft(): void;
171
- /**
172
- * @override
173
- * @inheritDoc
174
- */
175
- nudgeRight(): void;
176
- /**
177
- * @override
178
- * @inheritDoc
179
- */
180
- getBackgroundColor(): string;
181
- /**
182
- * @override
183
- * @inheritDoc
184
- */
185
- setBackgroundColor(color: string): void;
186
- /**
187
- * @override
188
- * @inheritDoc
189
- */
190
- setPrefillType(prefillType: string): void;
191
- /**
192
- * @override
193
- * @inheritDoc
194
- */
195
- getPrefillType(): string;
196
- /**
197
- * @override
198
- * @inheritDoc
199
- */
200
- isResizeCanvas(): boolean;
201
- /**
202
- * @override
203
- * @inheritDoc
204
- */
205
- setResizeCanvas(value: boolean): void;
206
- /**
207
- * @override
208
- * @inheritDoc
209
- */
210
- focus(): void;
211
- /**
212
- * @override
213
- * @inheritDoc
214
- */
215
- isEditing(): boolean;
216
- /**
217
- * @override
218
- * @inheritDoc
219
- */
220
- enterEditing(): void;
221
- /**
222
- * @override
223
- * @inheritDoc
224
- */
225
- selectAllText(): void;
226
- /**
227
- * @override
228
- * @inheritDoc
229
- */
230
- isBulleted(): boolean;
231
- /**
232
- * @override
233
- * @inheritDoc
234
- */
235
- enableBullets(): void;
236
- /**
237
- * @override
238
- * @inheritDoc
239
- */
240
- disableBullets(): void;
241
- getSizeIncreaseSinceCreation(): number;
242
- private removeBullets;
243
- private applyBulletListMonkeyPatches;
244
- /**
245
- * @override
246
- * @inheritDoc
247
- */
248
- protected updateFabricObjectBehavior(): void;
249
- protected onTextChange(): void;
250
- protected onDelete(): void;
251
- protected onSelectionChange(): void;
252
- private hasTextSelection;
253
- private updateTextSelection;
254
- private notifyCanvasOfTextChanges;
255
- }
1
+ import { Observable } from "rxjs";
2
+ import { IFont, IInteractiveCanvas, IMutableBackgroundColor, IMutableColor, IMutablePosition, IMutableText, IMutableTextStyle, ITextSelection, TextAlignment } from "../..";
3
+ import { ICanvasObject } from "../canvas-object.interface";
4
+ import { AbstractCanvasObject } from "../abstract-canvas-object";
5
+ import { CanvasObjectData } from "../canvas-object-data";
6
+ import { fabric } from "fabric";
7
+ /**
8
+ * Text field. Displays customizable text.
9
+ */
10
+ export interface IText extends ICanvasObject, IMutableColor, IMutableText, IMutableTextStyle, IMutablePosition, IMutableBackgroundColor {
11
+ /**
12
+ * @return Whether this text object should resize the canvas.
13
+ */
14
+ isResizeCanvas(): boolean;
15
+ /**
16
+ * Set whether this text object should resize the canvas.
17
+ */
18
+ setResizeCanvas(value: boolean): void;
19
+ /**
20
+ * Focus input on the text object.
21
+ */
22
+ focus(): void;
23
+ /**
24
+ * @return Is the text box currently being edited.
25
+ */
26
+ isEditing(): boolean;
27
+ /**
28
+ * Start editing the text.
29
+ */
30
+ enterEditing(): void;
31
+ /**
32
+ * Select all text.
33
+ */
34
+ selectAllText(): void;
35
+ /**
36
+ * Set the prefill type used for this text field.
37
+ */
38
+ setPrefillType(prefillType: string): void;
39
+ /**
40
+ * Get the prefill type used for this text field.
41
+ */
42
+ getPrefillType(): string;
43
+ }
44
+ export declare class Text extends AbstractCanvasObject<fabric.Textbox> implements IText {
45
+ private readonly fontLibrary;
46
+ private baseComponentHeight;
47
+ private readonly text$;
48
+ private readonly textSelection$;
49
+ constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Textbox, persistedField?: CanvasObjectData);
50
+ /**
51
+ * @override
52
+ * @inheritDoc
53
+ */
54
+ getText(): string;
55
+ /**
56
+ * @override
57
+ * @inheritDoc
58
+ */
59
+ getText$(): Observable<string>;
60
+ /**
61
+ * @override
62
+ * @inheritDoc
63
+ */
64
+ setText(text: string): void;
65
+ /**
66
+ * @override
67
+ * @inheritDoc
68
+ */
69
+ replaceText(target: string, replacement: string): void;
70
+ /**
71
+ * @override
72
+ * @inheritDoc
73
+ */
74
+ getColor(): string;
75
+ /**
76
+ * @override
77
+ * @inheritDoc
78
+ */
79
+ setColor(color: string): void;
80
+ /**
81
+ * @override
82
+ * @inheritDoc
83
+ */
84
+ getTextSelection(): ITextSelection;
85
+ /**
86
+ * @override
87
+ * @inheritDoc
88
+ */
89
+ getTextSelection$(): Observable<ITextSelection>;
90
+ /**
91
+ * @override
92
+ * @inheritDoc
93
+ */
94
+ setTextAlign(alignment: TextAlignment): void;
95
+ /**
96
+ * @override
97
+ * @inheritDoc
98
+ */
99
+ setCharSpacing(spacing: number): void;
100
+ /**
101
+ * @override
102
+ * @inheritDoc
103
+ */
104
+ setLineHeight(height: number): void;
105
+ /**
106
+ * @override
107
+ * @inheritDoc
108
+ */
109
+ setBold(bold?: boolean): void;
110
+ /**
111
+ * @override
112
+ * @inheritDoc
113
+ */
114
+ setBoldRegion(start: number, end: number, bold?: boolean): void;
115
+ /**
116
+ * @override
117
+ * @inheritDoc
118
+ */
119
+ setItalic(italic?: boolean): void;
120
+ /**
121
+ * @override
122
+ * @inheritDoc
123
+ */
124
+ setItalicRegion(start: number, end: number, italic?: boolean): void;
125
+ /**
126
+ * @override
127
+ * @inheritDoc
128
+ */
129
+ setStrikethrough(strikethrough?: boolean): void;
130
+ /**
131
+ * @override
132
+ * @inheritDoc
133
+ */
134
+ setUnderline(underline?: boolean): void;
135
+ /**
136
+ * @override
137
+ * @inheritDoc
138
+ */
139
+ setFont(font: IFont): void;
140
+ /**
141
+ * @override
142
+ * @inheritDoc
143
+ */
144
+ setFontSize(fontSize: number): void;
145
+ /**
146
+ * @override
147
+ * @inheritDoc
148
+ */
149
+ setTextBackgroundColor(color: string): void;
150
+ /**
151
+ * @override
152
+ * @inheritDoc
153
+ */
154
+ centerHorizontally(): void;
155
+ /**
156
+ * @override
157
+ * @inheritDoc
158
+ */
159
+ centerVertically(): void;
160
+ /**
161
+ * @override
162
+ * @inheritDoc
163
+ */
164
+ setHeight(height: number): void;
165
+ /**
166
+ * @override
167
+ * @inheritDoc
168
+ */
169
+ nudgeUp(): void;
170
+ /**
171
+ * @override
172
+ * @inheritDoc
173
+ */
174
+ nudgeDown(): void;
175
+ /**
176
+ * @override
177
+ * @inheritDoc
178
+ */
179
+ nudgeLeft(): void;
180
+ /**
181
+ * @override
182
+ * @inheritDoc
183
+ */
184
+ nudgeRight(): void;
185
+ /**
186
+ * @override
187
+ * @inheritDoc
188
+ */
189
+ getBackgroundColor(): string;
190
+ /**
191
+ * @override
192
+ * @inheritDoc
193
+ */
194
+ setBackgroundColor(color: string): void;
195
+ /**
196
+ * @override
197
+ * @inheritDoc
198
+ */
199
+ setPrefillType(prefillType: string): void;
200
+ /**
201
+ * @override
202
+ * @inheritDoc
203
+ */
204
+ getPrefillType(): string;
205
+ /**
206
+ * @override
207
+ * @inheritDoc
208
+ */
209
+ isResizeCanvas(): boolean;
210
+ /**
211
+ * @override
212
+ * @inheritDoc
213
+ */
214
+ setResizeCanvas(value: boolean): void;
215
+ /**
216
+ * @override
217
+ * @inheritDoc
218
+ */
219
+ focus(): void;
220
+ /**
221
+ * @override
222
+ * @inheritDoc
223
+ */
224
+ isEditing(): boolean;
225
+ /**
226
+ * @override
227
+ * @inheritDoc
228
+ */
229
+ enterEditing(): void;
230
+ /**
231
+ * @override
232
+ * @inheritDoc
233
+ */
234
+ selectAllText(): void;
235
+ /**
236
+ * @override
237
+ * @inheritDoc
238
+ */
239
+ isBulleted(): boolean;
240
+ /**
241
+ * @override
242
+ * @inheritDoc
243
+ */
244
+ enableBullets(): void;
245
+ /**
246
+ * @override
247
+ * @inheritDoc
248
+ */
249
+ disableBullets(): void;
250
+ getSizeIncreaseSinceCreation(): number;
251
+ private removeBullets;
252
+ private applyBulletListMonkeyPatches;
253
+ /**
254
+ * @override
255
+ * @inheritDoc
256
+ */
257
+ protected updateFabricObjectBehavior(): void;
258
+ protected onTextChange(): void;
259
+ protected onDelete(): void;
260
+ protected onSelectionChange(): void;
261
+ private hasTextSelection;
262
+ private updateTextSelection;
263
+ private notifyCanvasOfTextChanges;
264
+ }