@leapfrog/interactive-canvas 2.0.16 → 2.0.17-beta-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.
Files changed (67) hide show
  1. package/dist/abstract-interactive-canvas.d.ts +372 -375
  2. package/dist/dimensions/millimeter-dimensions.d.ts +15 -15
  3. package/dist/dimensions/pixel-canvas-dimensions.d.ts +13 -13
  4. package/dist/dimensions/print-6-col-canvas-dimensions.d.ts +18 -18
  5. package/dist/dimensions/print-8-col-canvas-dimensions.d.ts +18 -18
  6. package/dist/font/font-library.d.ts +27 -27
  7. package/dist/font/font-library.interface.d.ts +24 -24
  8. package/dist/font/font.interface.d.ts +20 -20
  9. package/dist/font/unknown-font.d.ts +6 -6
  10. package/dist/headless-interactive-canvas.d.ts +10 -10
  11. package/dist/index.d.ts +54 -54
  12. package/dist/interactive-canvas.d.ts +25 -25
  13. package/dist/interactive-canvas.es.js +3910 -3925
  14. package/dist/interactive-canvas.interface.d.ts +297 -297
  15. package/dist/interactive-canvas.js +3905 -3924
  16. package/dist/layout/abstract-layout-manager.d.ts +17 -17
  17. package/dist/layout/advanced-layout-manager.d.ts +16 -16
  18. package/dist/layout/function/pin-to-bottom.layout-function.d.ts +4 -4
  19. package/dist/layout/function/redraw-all.layout-function.d.ts +4 -4
  20. package/dist/layout/function/reposition-backgrounds.layout-function.d.ts +4 -4
  21. package/dist/layout/function/reposition-borders.layout-function.d.ts +4 -4
  22. package/dist/layout/function/reposition-cutoffs.layout-function.d.ts +4 -4
  23. package/dist/layout/function/resize-canvas.layout-function.d.ts +4 -4
  24. package/dist/layout/function/stack-objects.layout-function.d.ts +11 -11
  25. package/dist/layout/function/update-object-dimensions.layout-function.d.ts +4 -4
  26. package/dist/layout/layout-manager.enum.d.ts +5 -5
  27. package/dist/layout/layout-manager.interface.d.ts +13 -13
  28. package/dist/layout/standard-layout-manager.d.ts +40 -40
  29. package/dist/mutator/mutable-background-color.interface.d.ts +15 -15
  30. package/dist/mutator/mutable-color.interface.d.ts +6 -6
  31. package/dist/mutator/mutable-image.interface.d.ts +28 -28
  32. package/dist/mutator/mutable-position.interface.d.ts +63 -63
  33. package/dist/mutator/mutable-stroke.interface.d.ts +8 -8
  34. package/dist/mutator/mutable-text-style.interface.d.ts +163 -163
  35. package/dist/mutator/mutable-text.interface.d.ts +80 -80
  36. package/dist/object/abstract-canvas-object.d.ts +207 -207
  37. package/dist/object/canvas-object-data.d.ts +24 -24
  38. package/dist/object/canvas-object.interface.d.ts +109 -109
  39. package/dist/object/impl/background-image.d.ts +38 -38
  40. package/dist/object/impl/border.d.ts +70 -70
  41. package/dist/object/impl/cutoff.d.ts +59 -59
  42. package/dist/object/impl/extended-fabric-object.interface.d.ts +7 -7
  43. package/dist/object/impl/extended-fabric-textbox.interface.d.ts +7 -7
  44. package/dist/object/impl/horizontal-rule.d.ts +83 -83
  45. package/dist/object/impl/image.d.ts +76 -76
  46. package/dist/object/impl/rectangle.d.ts +78 -78
  47. package/dist/object/impl/rich-text.d.ts +39 -39
  48. package/dist/object/impl/text.d.ts +314 -322
  49. package/dist/object/impl/vertical-rule.d.ts +83 -83
  50. package/dist/profile/canvas-profile.interface.d.ts +22 -22
  51. package/dist/profile/default-canvas-profile.d.ts +23 -23
  52. package/dist/types/canvas-dimension-restrictions.interface.d.ts +15 -15
  53. package/dist/types/canvas-dimensions.interface.d.ts +21 -21
  54. package/dist/types/canvas-state.interface.d.ts +11 -11
  55. package/dist/types/dimension-restrictions.interface.d.ts +6 -6
  56. package/dist/types/image-type.enum.d.ts +6 -6
  57. package/dist/types/margin.interface.d.ts +6 -6
  58. package/dist/types/object-dimensions.interface.d.ts +23 -23
  59. package/dist/types/object-type.enum.d.ts +12 -12
  60. package/dist/types/overflow.interface.d.ts +4 -4
  61. package/dist/types/position.interface.d.ts +9 -9
  62. package/dist/types/rect.interface.d.ts +6 -6
  63. package/dist/types/selection-data.interface.d.ts +19 -28
  64. package/dist/types/text-alignment.interface.d.ts +1 -1
  65. package/dist/undo-stack.d.ts +27 -27
  66. package/dist/undo-stack.interface.d.ts +6 -6
  67. package/package.json +1 -1
@@ -1,163 +1,163 @@
1
- import { Observable } from "rxjs";
2
- import { IFont, TextAlignment } from "..";
3
- import { IMutableText } from "./mutable-text.interface";
4
- /**
5
- * Canvas object with customizable text styling
6
- */
7
- export interface IMutableTextStyle extends IMutableText {
8
- /**
9
- * Get the current text selection.
10
- */
11
- getTextSelection(): ITextSelection;
12
- /**
13
- * Get an observable for the current {@link #getTextSelection text selection}.
14
- */
15
- getTextSelection$(): Observable<ITextSelection>;
16
- /**
17
- * Set the text alignment.
18
- * @param alignment New value.
19
- */
20
- setTextAlign(alignment: TextAlignment): void;
21
- /**
22
- * Set the character spacing.
23
- * @param spacing New value.
24
- */
25
- setCharSpacing(spacing: number): void;
26
- /**
27
- * Set the line height.
28
- * @param height New value.
29
- */
30
- setLineHeight(height: number): void;
31
- /**
32
- * Set the bold state of the current selection.
33
- * @param bold Bold state.
34
- */
35
- setBold(bold?: boolean): void;
36
- /**
37
- * Set a specified region to bold.
38
- * @param start region start index.
39
- * @param end region end index.
40
- * @param bold whether to set bold or not.
41
- */
42
- setBoldRegion(start: number, end: number, bold?: boolean): void;
43
- /**
44
- * Set the italic state of the current selection.
45
- * @param italic Italic state.
46
- */
47
- setItalic(italic?: boolean): void;
48
- /**
49
- * Set a specified region to italic.
50
- * @param start region start index.
51
- * @param end region end index.
52
- * @param italic whether to set italic or not.
53
- */
54
- setItalicRegion(start: number, end: number, italic?: boolean): void;
55
- /**
56
- * Set the strikethrough state of the current selection.
57
- * @param strikethrough Strikethrough state.
58
- */
59
- setStrikethrough(strikethrough?: boolean): void;
60
- /**
61
- * Set the underline state of the current selection.
62
- * @param underline Underline state.
63
- */
64
- setUnderline(underline?: boolean): void;
65
- /**
66
- * Set the font.
67
- * @param font New value.
68
- */
69
- setFont(font: IFont): void;
70
- /**
71
- * Set the font size.
72
- * @param fontSize New value.
73
- */
74
- setFontSize(fontSize: number): void;
75
- /**
76
- * Set the text background color.
77
- * @param color New value.
78
- */
79
- setTextBackgroundColor(color: string | null): void;
80
- }
81
- export interface ITextSelection {
82
- /**
83
- * Index of selection start in characters.
84
- */
85
- readonly start: number;
86
- /**
87
- * Index of selection end in characters.
88
- */
89
- readonly end: number;
90
- /**
91
- * Selection length in characters.
92
- */
93
- readonly length: number;
94
- /**
95
- * Selection start line index.
96
- */
97
- readonly lineIndex: number;
98
- /**
99
- * Selection start character index (from start of current line).
100
- */
101
- readonly charIndex: number;
102
- /**
103
- * Current font.
104
- */
105
- readonly font: IFont;
106
- /**
107
- * Font size.
108
- */
109
- readonly fontSize: number;
110
- /**
111
- * Font weight.
112
- */
113
- readonly fontWeight: number;
114
- /**
115
- * Current text alignment.
116
- */
117
- readonly textAlign: TextAlignment;
118
- /**
119
- * Current character spacing.
120
- */
121
- readonly charSpacing: number;
122
- /**
123
- * Current line height.
124
- */
125
- readonly lineHeight: number;
126
- /**
127
- * True if the current selection is bold.
128
- */
129
- readonly bold: boolean;
130
- /**
131
- * True if the current selection is italic.
132
- */
133
- readonly italic: boolean;
134
- /**
135
- * Whether the text has an underline.
136
- */
137
- readonly underline: boolean;
138
- /**
139
- * Whether the text has a strikethrough.
140
- */
141
- readonly strikethrough: boolean;
142
- /**
143
- * Whether the text has an overline.
144
- */
145
- readonly overline: boolean;
146
- /**
147
- * Fill color.
148
- */
149
- readonly fill: string;
150
- /**
151
- * Stroke color.
152
- */
153
- readonly stroke: string;
154
- /**
155
- * Stroke width.
156
- */
157
- readonly strokeWidth: number;
158
- /**
159
- * Background color.
160
- */
161
- readonly textBackgroundColor: string;
162
- }
163
- export declare function isMutableTextStyle(object: any): object is IMutableText;
1
+ import { Observable } from "rxjs";
2
+ import { IFont, TextAlignment } from "..";
3
+ import { IMutableText } from "./mutable-text.interface";
4
+ /**
5
+ * Canvas object with customizable text styling
6
+ */
7
+ export interface IMutableTextStyle extends IMutableText {
8
+ /**
9
+ * Get the current text selection.
10
+ */
11
+ getTextSelection(): ITextSelection;
12
+ /**
13
+ * Get an observable for the current {@link #getTextSelection text selection}.
14
+ */
15
+ getTextSelection$(): Observable<ITextSelection>;
16
+ /**
17
+ * Set the text alignment.
18
+ * @param alignment New value.
19
+ */
20
+ setTextAlign(alignment: TextAlignment): void;
21
+ /**
22
+ * Set the character spacing.
23
+ * @param spacing New value.
24
+ */
25
+ setCharSpacing(spacing: number): void;
26
+ /**
27
+ * Set the line height.
28
+ * @param height New value.
29
+ */
30
+ setLineHeight(height: number): void;
31
+ /**
32
+ * Set the bold state of the current selection.
33
+ * @param bold Bold state.
34
+ */
35
+ setBold(bold?: boolean): void;
36
+ /**
37
+ * Set a specified region to bold.
38
+ * @param start region start index.
39
+ * @param end region end index.
40
+ * @param bold whether to set bold or not.
41
+ */
42
+ setBoldRegion(start: number, end: number, bold?: boolean): void;
43
+ /**
44
+ * Set the italic state of the current selection.
45
+ * @param italic Italic state.
46
+ */
47
+ setItalic(italic?: boolean): void;
48
+ /**
49
+ * Set a specified region to italic.
50
+ * @param start region start index.
51
+ * @param end region end index.
52
+ * @param italic whether to set italic or not.
53
+ */
54
+ setItalicRegion(start: number, end: number, italic?: boolean): void;
55
+ /**
56
+ * Set the strikethrough state of the current selection.
57
+ * @param strikethrough Strikethrough state.
58
+ */
59
+ setStrikethrough(strikethrough?: boolean): void;
60
+ /**
61
+ * Set the underline state of the current selection.
62
+ * @param underline Underline state.
63
+ */
64
+ setUnderline(underline?: boolean): void;
65
+ /**
66
+ * Set the font.
67
+ * @param font New value.
68
+ */
69
+ setFont(font: IFont): void;
70
+ /**
71
+ * Set the font size.
72
+ * @param fontSize New value.
73
+ */
74
+ setFontSize(fontSize: number): void;
75
+ /**
76
+ * Set the text background color.
77
+ * @param color New value.
78
+ */
79
+ setTextBackgroundColor(color: string | null): void;
80
+ }
81
+ export interface ITextSelection {
82
+ /**
83
+ * Index of selection start in characters.
84
+ */
85
+ readonly start: number;
86
+ /**
87
+ * Index of selection end in characters.
88
+ */
89
+ readonly end: number;
90
+ /**
91
+ * Selection length in characters.
92
+ */
93
+ readonly length: number;
94
+ /**
95
+ * Selection start line index.
96
+ */
97
+ readonly lineIndex: number;
98
+ /**
99
+ * Selection start character index (from start of current line).
100
+ */
101
+ readonly charIndex: number;
102
+ /**
103
+ * Current font.
104
+ */
105
+ readonly font: IFont;
106
+ /**
107
+ * Font size.
108
+ */
109
+ readonly fontSize: number;
110
+ /**
111
+ * Font weight.
112
+ */
113
+ readonly fontWeight: number;
114
+ /**
115
+ * Current text alignment.
116
+ */
117
+ readonly textAlign: TextAlignment;
118
+ /**
119
+ * Current character spacing.
120
+ */
121
+ readonly charSpacing: number;
122
+ /**
123
+ * Current line height.
124
+ */
125
+ readonly lineHeight: number;
126
+ /**
127
+ * True if the current selection is bold.
128
+ */
129
+ readonly bold: boolean;
130
+ /**
131
+ * True if the current selection is italic.
132
+ */
133
+ readonly italic: boolean;
134
+ /**
135
+ * Whether the text has an underline.
136
+ */
137
+ readonly underline: boolean;
138
+ /**
139
+ * Whether the text has a strikethrough.
140
+ */
141
+ readonly strikethrough: boolean;
142
+ /**
143
+ * Whether the text has an overline.
144
+ */
145
+ readonly overline: boolean;
146
+ /**
147
+ * Fill color.
148
+ */
149
+ readonly fill: string;
150
+ /**
151
+ * Stroke color.
152
+ */
153
+ readonly stroke: string;
154
+ /**
155
+ * Stroke width.
156
+ */
157
+ readonly strokeWidth: number;
158
+ /**
159
+ * Background color.
160
+ */
161
+ readonly textBackgroundColor: string;
162
+ }
163
+ export declare function isMutableTextStyle(object: any): object is IMutableText;
@@ -1,80 +1,80 @@
1
- import { Observable } from "rxjs";
2
- import { ICanvasObject } from "..";
3
- /**
4
- * Because of the way styles are handled in fabric, stored as a separate list of character pointers and not inline as per HTML, modifying the text directly is dangerous - it will cause the
5
- * location of the styles to become out of sync with the actual text if the length changes.
6
- * Text modification should be performed by inserting the selection cursor at a given position and modifying the selection... this lets the canvas track changes and update the styles accordingly.
7
- * It's pretty crap, honestly but text support is explicitly a second-class citizen in fabric, as the author has stated text support is out-of-scope for the library:
8
- * https://github.com/fabricjs/fabric.js/issues/3443#issuecomment-262263542
9
- */
10
- export interface IMutableText extends ICanvasObject {
11
- getText(): string;
12
- getText$(): Observable<string>;
13
- /**
14
- * Generally, don't use this. It will not modify the style locations, and if the text length changes, it will cause the
15
- * styles to slide out of place.
16
- * Use {@link IMutableText#replaceText} instead, where feasible.
17
- * @param text New text.
18
- * @see {@link IMutableText#replaceText}
19
- */
20
- setText(text: string): void;
21
- /**
22
- * Replace a text fragment in the field. Honors existing styling as much as possible.
23
- * @param target Existing text fragment.
24
- * @param replacement Replacement fragment.
25
- */
26
- replaceText(target: string, replacement: string): void;
27
- /**
28
- * Taken from the fabric JSDOC:
29
- * Insert characters at start position, before start position.
30
- * start equal 1 it means the text get inserted between actual grapheme 0 and 1
31
- * if style array is provided, it must be as the same length of text in graphemes
32
- * if end is provided and is bigger than start, old text is replaced.
33
- * start/end ar per grapheme position in _text array.
34
- *
35
- * @param text text to insert
36
- * @param style array of style objects
37
- * @param start
38
- * @param end default to start + 1
39
- */
40
- insertText(text: string, style?: any[], start?: number, end?: number): void;
41
- /**
42
- * {@link #insertText} but at the current cursor location.
43
- * @param text
44
- * @param style
45
- */
46
- insertTextAtSelection(text: string, style?: any[]): void;
47
- /**
48
- * Is the text bulleted?
49
- */
50
- isBulleted(): boolean;
51
- /**
52
- * Enable bullet points.
53
- */
54
- enableBullets(): void;
55
- /**
56
- * Disable bullet points.
57
- */
58
- disableBullets(): void;
59
- /**
60
- * Is the text an ordered list?
61
- */
62
- isOrderedList(): boolean;
63
- /**
64
- * Enable ordered list markers.
65
- */
66
- enableOrderedList(): void;
67
- /**
68
- * Disable ordered list markers.
69
- */
70
- disableOrderedList(): void;
71
- /**
72
- * @param start The start value for the ordered list.
73
- */
74
- setOrderedListStart(start: number): void;
75
- /**
76
- * Get the start value for the ordered list.
77
- */
78
- getOrderedListStart(): number;
79
- }
80
- export declare function isMutableText(object: any): object is IMutableText;
1
+ import { Observable } from "rxjs";
2
+ import { ICanvasObject } from "..";
3
+ /**
4
+ * Because of the way styles are handled in fabric, stored as a separate list of character pointers and not inline as per HTML, modifying the text directly is dangerous - it will cause the
5
+ * location of the styles to become out of sync with the actual text if the length changes.
6
+ * Text modification should be performed by inserting the selection cursor at a given position and modifying the selection... this lets the canvas track changes and update the styles accordingly.
7
+ * It's pretty crap, honestly but text support is explicitly a second-class citizen in fabric, as the author has stated text support is out-of-scope for the library:
8
+ * https://github.com/fabricjs/fabric.js/issues/3443#issuecomment-262263542
9
+ */
10
+ export interface IMutableText extends ICanvasObject {
11
+ getText(): string;
12
+ getText$(): Observable<string>;
13
+ /**
14
+ * Generally, don't use this. It will not modify the style locations, and if the text length changes, it will cause the
15
+ * styles to slide out of place.
16
+ * Use {@link IMutableText#replaceText} instead, where feasible.
17
+ * @param text New text.
18
+ * @see {@link IMutableText#replaceText}
19
+ */
20
+ setText(text: string): void;
21
+ /**
22
+ * Replace a text fragment in the field. Honors existing styling as much as possible.
23
+ * @param target Existing text fragment.
24
+ * @param replacement Replacement fragment.
25
+ */
26
+ replaceText(target: string, replacement: string): void;
27
+ /**
28
+ * Taken from the fabric JSDOC:
29
+ * Insert characters at start position, before start position.
30
+ * start equal 1 it means the text get inserted between actual grapheme 0 and 1
31
+ * if style array is provided, it must be as the same length of text in graphemes
32
+ * if end is provided and is bigger than start, old text is replaced.
33
+ * start/end ar per grapheme position in _text array.
34
+ *
35
+ * @param text text to insert
36
+ * @param style array of style objects
37
+ * @param start
38
+ * @param end default to start + 1
39
+ */
40
+ insertText(text: string, style?: any[], start?: number, end?: number): void;
41
+ /**
42
+ * {@link #insertText} but at the current cursor location.
43
+ * @param text
44
+ * @param style
45
+ */
46
+ insertTextAtSelection(text: string, style?: any[]): void;
47
+ /**
48
+ * Is the text bulleted?
49
+ */
50
+ isBulleted(): boolean;
51
+ /**
52
+ * Enable bullet points.
53
+ */
54
+ enableBullets(): void;
55
+ /**
56
+ * Disable bullet points.
57
+ */
58
+ disableBullets(): void;
59
+ /**
60
+ * Is the text an ordered list?
61
+ */
62
+ isOrderedList(): boolean;
63
+ /**
64
+ * Enable ordered list markers.
65
+ */
66
+ enableOrderedList(): void;
67
+ /**
68
+ * Disable ordered list markers.
69
+ */
70
+ disableOrderedList(): void;
71
+ /**
72
+ * @param start The start value for the ordered list.
73
+ */
74
+ setOrderedListStart(start: number): void;
75
+ /**
76
+ * Get the start value for the ordered list.
77
+ */
78
+ getOrderedListStart(): number;
79
+ }
80
+ export declare function isMutableText(object: any): object is IMutableText;