@m2c2kit/addons 0.3.15 → 0.3.17

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import * as _m2c2kit_core from '@m2c2kit/core';
2
+ import { CompositeOptions, Size, RgbaColor, M2Node, Composite, TextOptions, IText, StringInterpolationMap, M2NodeEvent, CallbackOptions, Point, ShapeOptions, CompositeEvent, LabelHorizontalAlignmentMode, Transition, StoryOptions, Story, Scene, SceneOptions } from '@m2c2kit/core';
1
3
  import { Canvas } from 'canvaskit-wasm';
2
- import { CompositeOptions, Size, RgbaColor, Composite, M2Node, GlobalVariables, TextOptions, IText, StringInterpolationMap, M2NodeEvent, CallbackOptions, Point, ShapeOptions, LabelHorizontalAlignmentMode, Transition, StoryOptions, Story, Scene, SceneOptions } from '@m2c2kit/core';
3
4
 
4
5
  interface GridOptions extends CompositeOptions {
5
6
  /** Number of rows in the grid. Must be 1 or greater */
@@ -8,7 +9,7 @@ interface GridOptions extends CompositeOptions {
8
9
  columns: number;
9
10
  /** Size of the grid in pixels */
10
11
  size: Size;
11
- /** Background color of the grid. Default is a transparent gray */
12
+ /** Background color of the grid. Default is a transparent blue */
12
13
  backgroundColor?: RgbaColor;
13
14
  /** Width of the grid lines. Default is 1 */
14
15
  gridLineWidth?: number;
@@ -20,16 +21,17 @@ interface GridChild {
20
21
  row: number;
21
22
  column: number;
22
23
  }
23
- declare class Grid extends Composite {
24
+ declare class Grid extends Composite implements GridOptions {
24
25
  compositeType: string;
25
- rows: number;
26
- columns: number;
27
- gridBackgroundColor: RgbaColor;
28
- gridLineColor: RgbaColor;
29
- gridLineWidth: number;
26
+ private _rows;
27
+ private _columns;
28
+ private _gridBackgroundColor;
29
+ private _gridLineColor;
30
+ private _gridLineWidth;
30
31
  cellWidth: number;
31
32
  cellHeight: number;
32
- gridChildren: GridChild[];
33
+ private _gridChildren;
34
+ private cellContainers;
33
35
  private _gridBackground?;
34
36
  /**
35
37
  * A rectangular grid that supports placement of nodes within the grid's
@@ -42,9 +44,44 @@ declare class Grid extends Composite {
42
44
  * @param options - {@link GridOptions}
43
45
  */
44
46
  constructor(options: GridOptions);
47
+ get completeNodeOptions(): {
48
+ rows: number;
49
+ columns: number;
50
+ size: Size;
51
+ backgroundColor: RgbaColor;
52
+ gridLineWidth: number;
53
+ gridLineColor: RgbaColor;
54
+ anchorPoint?: _m2c2kit_core.Point;
55
+ zPosition?: number;
56
+ name?: string;
57
+ position?: _m2c2kit_core.Point;
58
+ scale?: number;
59
+ alpha?: number;
60
+ zRotation?: number;
61
+ isUserInteractionEnabled?: boolean;
62
+ draggable?: boolean;
63
+ hidden?: boolean;
64
+ layout?: _m2c2kit_core.Layout;
65
+ uuid?: string;
66
+ suppressEvents?: boolean;
67
+ };
45
68
  initialize(): void;
46
69
  private get gridBackground();
47
70
  private set gridBackground(value);
71
+ /**
72
+ * note: below we do not have getter and setter for size because the getter
73
+ * and setter in M2Node will handle it.
74
+ */
75
+ get rows(): number;
76
+ set rows(rows: number);
77
+ get columns(): number;
78
+ set columns(columns: number);
79
+ get gridBackgroundColor(): RgbaColor;
80
+ set gridBackgroundColor(backgroundColor: RgbaColor);
81
+ get gridLineWidth(): number;
82
+ set gridLineWidth(gridLineWidth: number);
83
+ get gridLineColor(): RgbaColor;
84
+ set gridLineColor(gridLineColor: RgbaColor);
48
85
  dispose(): void;
49
86
  /**
50
87
  * Duplicates a node using deep copy.
@@ -61,11 +98,23 @@ declare class Grid extends Composite {
61
98
  draw(canvas: Canvas): void;
62
99
  warmup(canvas: Canvas): void;
63
100
  /**
64
- * Removes all children from the grid, but retains grid lines.
101
+ * The child nodes that have been added to the grid.
102
+ *
103
+ * @remarks Do not set this property directly. Use the methods for adding
104
+ * and removing grid children, such as `addAtCell()`, `removeAllAtCell()`,
105
+ * `removeGridChild()`, and `removeAllGridChildren()`.
65
106
  */
66
- removeAllChildren(): void;
107
+ get gridChildren(): Array<GridChild>;
108
+ set gridChildren(gridChildren: Array<GridChild>);
67
109
  /**
68
- * Adds a node to the grid at the specified row and column position.
110
+ * Removes all grid children from the grid.
111
+ *
112
+ * @remarks This retains grid lines and grid appearance.
113
+ */
114
+ removeAllGridChildren(): void;
115
+ /**
116
+ * Adds a node as a grid child to the grid at the specified row and column
117
+ * position.
69
118
  *
70
119
  * @param node - node to add to the grid
71
120
  * @param row - row position within grid to add node; zero-based indexing
@@ -73,46 +122,44 @@ declare class Grid extends Composite {
73
122
  */
74
123
  addAtCell(node: M2Node, row: number, column: number): void;
75
124
  /**
76
- * Removes all child nodes at the specified row and column position.
125
+ * Removes all grid child nodes at the specified row and column position.
77
126
  *
78
- * @param row - row position within grid at which to remove children; zero-based indexing
79
- * @param column - column position within grid at which to remove children; zero-based indexing
127
+ * @param row - row position within grid at which to remove grid children; zero-based indexing
128
+ * @param column - column position within grid at which to remove grid children; zero-based indexing
80
129
  */
81
130
  removeAllAtCell(row: number, column: number): void;
82
131
  /**
83
- * Removes the child node from the grid.
132
+ * Removes the grid child node from the grid.
84
133
  *
85
134
  * @param node - node to remove
86
135
  */
87
- removeChild(node: M2Node): void;
88
- }
89
-
90
- declare global {
91
- var Globals: GlobalVariables;
136
+ removeGridChild(node: M2Node): void;
137
+ addChild(child: M2Node): void;
138
+ removeAllChildren(): void;
139
+ removeChild(child: M2Node): void;
140
+ removeChildren(children: M2Node[]): void;
92
141
  }
93
- //# sourceMappingURL=Globals.d.ts.map
94
142
 
95
143
  interface ButtonOptions extends CompositeOptions, TextOptions {
96
- /** Size of button */
144
+ /** Size of button. Default is 200 wide by 50 high. */
97
145
  size?: Size;
98
- /** Corner radius of button; can be used to make rounded corners */
146
+ /** Corner radius of button; can be used to make rounded corners. Default is 9 */
99
147
  cornerRadius?: number;
100
- /** Background color of button. Default is WebColors.RoyalBlue */
148
+ /** Background color of button. Default is WebColors.Black */
101
149
  backgroundColor?: RgbaColor;
102
150
  /** Color of button text. Default is WebColors.White */
103
151
  fontColor?: RgbaColor;
104
152
  /** Names of multiple fonts to use for text. For example, if a text font and an emoji font are to be used together. Must have been previously loaded */
105
153
  fontNames?: Array<string>;
154
+ /** Size of button text. Default is 20. */
155
+ fontSize?: number;
106
156
  }
107
- declare class Button extends Composite implements IText {
157
+ declare class Button extends Composite implements IText, ButtonOptions {
108
158
  compositeType: string;
159
+ isText: boolean;
109
160
  private _backgroundColor;
110
- size: {
111
- width: number;
112
- height: number;
113
- };
114
- cornerRadius: number;
115
- fontSize: number;
161
+ private _cornerRadius;
162
+ private _fontSize;
116
163
  private _text;
117
164
  private _fontColor;
118
165
  private _fontName;
@@ -130,6 +177,31 @@ declare class Button extends Composite implements IText {
130
177
  * @param options - {@link ButtonOptions}
131
178
  */
132
179
  constructor(options: ButtonOptions);
180
+ get completeNodeOptions(): {
181
+ size: Size;
182
+ cornerRadius: number;
183
+ backgroundColor: RgbaColor;
184
+ fontNames: string[] | undefined;
185
+ text?: string;
186
+ fontName?: string;
187
+ fontColor?: RgbaColor;
188
+ fontSize?: number;
189
+ interpolation?: StringInterpolationMap;
190
+ localize?: boolean;
191
+ anchorPoint?: _m2c2kit_core.Point;
192
+ zPosition?: number;
193
+ name?: string;
194
+ position?: _m2c2kit_core.Point;
195
+ scale?: number;
196
+ alpha?: number;
197
+ zRotation?: number;
198
+ isUserInteractionEnabled?: boolean;
199
+ draggable?: boolean;
200
+ hidden?: boolean;
201
+ layout?: _m2c2kit_core.Layout;
202
+ uuid?: string;
203
+ suppressEvents?: boolean;
204
+ };
133
205
  initialize(): void;
134
206
  dispose(): void;
135
207
  get text(): string;
@@ -142,6 +214,10 @@ declare class Button extends Composite implements IText {
142
214
  set fontName(fontName: string | undefined);
143
215
  get fontNames(): Array<string> | undefined;
144
216
  set fontNames(fontNames: Array<string> | undefined);
217
+ get cornerRadius(): number;
218
+ set cornerRadius(cornerRadius: number);
219
+ get fontSize(): number;
220
+ set fontSize(fontSize: number);
145
221
  get interpolation(): StringInterpolationMap;
146
222
  set interpolation(interpolation: StringInterpolationMap);
147
223
  get localize(): boolean;
@@ -194,8 +270,6 @@ declare class Dialog extends Composite {
194
270
  contentText: string;
195
271
  positiveButtonText: string;
196
272
  negativeButtonText: string;
197
- zPosition: number;
198
- hidden: boolean;
199
273
  private _fontColor;
200
274
  private backgroundPaint?;
201
275
  constructor(options?: DialogOptions);
@@ -206,6 +280,8 @@ declare class Dialog extends Composite {
206
280
  set backgroundColor(backgroundColor: RgbaColor);
207
281
  get fontColor(): RgbaColor;
208
282
  set fontColor(fontColor: RgbaColor);
283
+ get hidden(): boolean;
284
+ set hidden(hidden: boolean);
209
285
  /**
210
286
  * Duplicates a node using deep copy.
211
287
  *
@@ -310,6 +386,7 @@ declare class DrawPad extends Composite {
310
386
  private isDrawingPointerDown;
311
387
  private pointerIsDownAndPointerLeftDrawAreaWhenDown;
312
388
  private currentStrokesNotAllowed;
389
+ private originalOptions;
313
390
  /** Array of strokes created on the DrawPad, with position and timestamps
314
391
  * of all interactions with each DrawPadStroke.
315
392
  */
@@ -323,6 +400,39 @@ declare class DrawPad extends Composite {
323
400
  * @param options - {@link DrawPadOptions}
324
401
  */
325
402
  constructor(options: DrawPadOptions);
403
+ get completeNodeOptions(): {
404
+ /** Size of the DrawPad */
405
+ size: Size;
406
+ /** Color of drawn lines. Default is red. */
407
+ lineColor?: RgbaColor;
408
+ /** Width of drawn lines. Default is 1 */
409
+ lineWidth?: number;
410
+ /** Background color of the DrawPad. Default is transparent. */
411
+ backgroundColor?: RgbaColor;
412
+ /** Width of the border. Default is 1 */
413
+ borderWidth?: number;
414
+ /** Color of the border. Default is black */
415
+ borderColor?: RgbaColor;
416
+ isUserInteractionEnabled?: boolean;
417
+ /** Should drawing resume when the pointer, in a down state, returns to the DrawPad area after exiting it while drawing? Default is false. */
418
+ resumeDrawingOnReturn?: boolean;
419
+ /** Should the user be permitted to draw only one continuous line? If so, no more drawing is allowed after the first stroke ends. */
420
+ continuousDrawingOnly?: boolean;
421
+ /** If `continuousDrawingOnly`, this is the maximum pixel distance from the last stroke's end point that the user is allowed to continue drawing with a new stroke. */
422
+ continuousDrawingOnlyExceptionDistance?: number;
423
+ name?: string;
424
+ position?: Point;
425
+ scale?: number;
426
+ alpha?: number;
427
+ zRotation?: number;
428
+ draggable?: boolean;
429
+ hidden?: boolean;
430
+ layout?: _m2c2kit_core.Layout;
431
+ uuid?: string;
432
+ suppressEvents?: boolean;
433
+ anchorPoint?: Point;
434
+ zPosition?: number;
435
+ };
326
436
  initialize(): void;
327
437
  private initializeDrawShape;
328
438
  private initializeDrawArea;
@@ -416,6 +526,12 @@ declare class DrawPad extends Composite {
416
526
  duplicate(newName?: string): DrawPad;
417
527
  }
418
528
 
529
+ /**
530
+ * Additional, optional properties for a key in the `VirtualKeyboard`.
531
+ *
532
+ * @remarks This is used to define special keys (e.g., Shift, Backspace),
533
+ * keys with icons, and keys of custom size.
534
+ */
419
535
  interface KeyConfiguration {
420
536
  /** Width of the key in units of a regular key width. Default is 1. */
421
537
  widthRatio?: number;
@@ -434,7 +550,21 @@ interface KeyConfiguration {
434
550
  /** ShapeOptions of the optional icon to show on the key. */
435
551
  keyIconShapeOptions?: ShapeOptions;
436
552
  }
437
- type VirtualKeyboardRow = Array<KeyConfiguration | string | Array<string>>;
553
+ /**
554
+ * A row in the `VirtualKeyboard`.
555
+ *
556
+ * @remarks Each row is an array of objects that defines a key, where each
557
+ * object can be one of the following:
558
+ * - a string, e.g., `a`. The string is the key in the keyboard's unshifted
559
+ * state (`a`), and the string's value after applying `toUpperCase()` is the key
560
+ * in the keyboard's shifted state (`A`).
561
+ * - an array of two strings, e.g., `["1", "!"]`. The first string is the key
562
+ * in the keyboard's unshifted state (`1`), and the second string is the key
563
+ * in the keyboard's shifted state (`!`).
564
+ * - A `KeyConfiguration` object, which can be used to further customize the
565
+ * key's appearance and behavior.
566
+ */
567
+ type VirtualKeyboardRow = Array<string | Array<string> | KeyConfiguration>;
438
568
  interface VirtualKeyboardOptions extends CompositeOptions {
439
569
  size: Size;
440
570
  /** Percent of the keyboard width that should be used for padding on the left and right sides. Default is .02 */
@@ -468,7 +598,11 @@ interface VirtualKeyboardOptions extends CompositeOptions {
468
598
  /** If true, a preview of the key that will be pressed will be shown. */
469
599
  showKeyDownPreview?: boolean;
470
600
  }
471
- interface VirtualKeyboardEvent extends M2NodeEvent {
601
+ interface VirtualKeyboardEvent extends CompositeEvent {
602
+ type: "Composite";
603
+ compositeType: "VirtualKeyboard";
604
+ compositeEventType: "VirtualKeyboardKeyUp" | "VirtualKeyboardKeyDown" | "VirtualKeyboardKeyLeave";
605
+ target: VirtualKeyboard | string;
472
606
  /** String that is generated when key is pressed, with any modifiers (e.g., Shift) applied. */
473
607
  key: string;
474
608
  /** Code for the key, not taking into account any modifiers. */
@@ -487,12 +621,12 @@ interface KeyTapMetadata {
487
621
  buttons: number;
488
622
  }
489
623
  declare class VirtualKeyboard extends Composite {
490
- compositeType: string;
624
+ readonly compositeType = "VirtualKeyboard";
491
625
  private keyboardHorizontalPaddingPercent;
492
626
  private keyboardVerticalPaddingPercent;
493
627
  private keyHorizontalPaddingPercent;
494
628
  private keyVerticalPaddingPercent;
495
- private rowsConfiguration;
629
+ private keyboardRows;
496
630
  private keysPerRow;
497
631
  private fontSize;
498
632
  private fontNames;
@@ -503,16 +637,64 @@ declare class VirtualKeyboard extends Composite {
503
637
  private specialKeyDownColor;
504
638
  private backgroundColor;
505
639
  private showKeyDownPreview;
640
+ private originalOptions;
506
641
  private shiftActivated;
507
- private shiftKeyShape;
508
642
  private keyShapes;
509
- _isUserInteractionEnabled: boolean;
643
+ private keyLabels;
644
+ private letterCircle?;
645
+ private letterCircleLabel?;
510
646
  /**
511
647
  * An on-screen keyboard that can be used to enter text.
512
648
  *
513
649
  * @param options - {@link VirtualKeyboardOptions}
514
650
  */
515
651
  constructor(options: VirtualKeyboardOptions);
652
+ get completeNodeOptions(): {
653
+ size: Size;
654
+ /** Percent of the keyboard width that should be used for padding on the left and right sides. Default is .02 */
655
+ keyboardHorizontalPaddingPercent?: number;
656
+ /** Percent of the keyboard height that should be used for padding on the top and bottom sides. Default is .025 */
657
+ keyboardVerticalPaddingPercent?: number;
658
+ /** Percent of each key's width that should be used for padding on the left and right sides. Default is .10 */
659
+ keyHorizontalPaddingPercent?: number;
660
+ /** Percent of each key's height that should be used for padding on the top and bottom sides. Default is .10 */
661
+ keyVerticalPaddingPercent?: number;
662
+ /** Configuration of keyboard rows. Order is from top to bottom rows. */
663
+ rows?: Array<VirtualKeyboardRow>;
664
+ /** How many regular-sized keys should fit in a row? This is used for scaling purposes. If not provided, it will be inferred from the row configuration. */
665
+ keysPerRow?: number;
666
+ /** Size of font for keys. */
667
+ fontSize?: number;
668
+ /** The fonts for the key labels, if not the default font. */
669
+ fontNames?: Array<string> | undefined;
670
+ /** Comma-separated list of keys to hide. */
671
+ hiddenKeys?: string;
672
+ /** If true, only capital letters will be shown. */
673
+ capitalLettersOnly?: boolean;
674
+ /** Color of keys. */
675
+ keyColor?: RgbaColor;
676
+ /** Color of keys when pressed. */
677
+ keyDownColor?: RgbaColor;
678
+ /** Color of special keys when pressed. */
679
+ specialKeyDownColor?: RgbaColor;
680
+ /** Background color of keyboard. */
681
+ backgroundColor?: RgbaColor;
682
+ /** If true, a preview of the key that will be pressed will be shown. */
683
+ showKeyDownPreview?: boolean;
684
+ name?: string;
685
+ position?: Point;
686
+ scale?: number;
687
+ alpha?: number;
688
+ zRotation?: number;
689
+ isUserInteractionEnabled?: boolean;
690
+ draggable?: boolean;
691
+ hidden?: boolean;
692
+ layout?: _m2c2kit_core.Layout;
693
+ uuid?: string;
694
+ suppressEvents?: boolean;
695
+ anchorPoint?: Point;
696
+ zPosition?: number;
697
+ };
516
698
  initialize(): void;
517
699
  /**
518
700
  * Executes a callback when the user presses down on a key.
@@ -528,6 +710,45 @@ declare class VirtualKeyboard extends Composite {
528
710
  * @param options
529
711
  */
530
712
  onKeyUp(callback: (virtualKeyboardEvent: VirtualKeyboardEvent) => void, options?: CallbackOptions): void;
713
+ /**
714
+ * Executes a callback when the user has pressed a key with the pointer, but
715
+ * moves the pointer outside the key bounds before releasing the pointer.
716
+ *
717
+ * @remarks Typically, this event will not be used, since it is a user's
718
+ * inaccurate interaction with the keyboard. However, it can be used to
719
+ * provide feedback to the user that they have moved the pointer outside the
720
+ * key bounds, and thus the key stroke will not be registered.
721
+ *
722
+ * @param callback - function to execute
723
+ * @param options
724
+ */
725
+ onKeyLeave(callback: (virtualKeyboardEvent: VirtualKeyboardEvent) => void, options?: CallbackOptions): void;
726
+ update(): void;
727
+ draw(canvas: Canvas): void;
728
+ warmup(canvas: Canvas): void;
729
+ duplicate(newName?: string | undefined): M2Node;
730
+ private handleKeyShapeTapDown;
731
+ private handleKeyShapeTapUp;
732
+ private handleKeyShapeTapLeave;
733
+ private getKeyAsString;
734
+ /**
735
+ * Converts the keyboard rows to the internal keyboard configuration.
736
+ *
737
+ * @remarks This normalizes the keyboard rows so that each key is a
738
+ * full `KeyConfigurationWithShape` object, instead of a string or array of
739
+ * strings.
740
+ *
741
+ * @param keyboardRows
742
+ * @returns the keyboard for internal use
743
+ */
744
+ private internalKeyboardRowsToInternalKeyboardConfiguration;
745
+ handleCompositeEvent(event: VirtualKeyboardEvent): void;
746
+ private handleKeyDownEvent;
747
+ private handleKeyUpEvent;
748
+ private handleKeyLeaveEvent;
749
+ private showKeyboardShifted;
750
+ private showKeyboardNotShifted;
751
+ private createDefaultKeyboardRows;
531
752
  private addVirtualKeyboardEventListener;
532
753
  /**
533
754
  * Does the `VirtualKeyboard` respond to user events? Default is true.
@@ -537,10 +758,6 @@ declare class VirtualKeyboard extends Composite {
537
758
  * Does the `VirtualKeyboard` respond to user events? Default is true.
538
759
  */
539
760
  set isUserInteractionEnabled(isUserInteractionEnabled: boolean);
540
- update(): void;
541
- draw(canvas: Canvas): void;
542
- warmup(canvas: Canvas): void;
543
- duplicate(newName?: string | undefined): M2Node;
544
761
  }
545
762
 
546
763
  interface InstructionScene {
@@ -652,6 +869,172 @@ declare class Instructions extends Story {
652
869
  static Create(options: InstructionsOptions): Array<Scene>;
653
870
  }
654
871
 
872
+ interface CountdownTimerOptions extends CompositeOptions {
873
+ /** Duration of the countdown, in milliseconds. Must be multiple of 1000. Default is 3000. */
874
+ milliseconds?: number;
875
+ /** Duration of each tick interval, in milliseconds. Default is 1000. */
876
+ tickIntervalMilliseconds?: number;
877
+ /** Font name for timer text (numbers). */
878
+ fontName?: string;
879
+ /** Font size for timer text (numbers). Default is 50. */
880
+ fontSize?: number;
881
+ /** Font size for timer text (numbers). Default is white. */
882
+ fontColor?: RgbaColor;
883
+ /** String to show when the timer reaches zero. Default is "0". This could be changed to another value, such as "GO!" */
884
+ zeroString?: string;
885
+ /** Shape of the timer. Default is a Royal Blue circle with a radius of 100. */
886
+ timerShape?: TimerShape;
887
+ /** Default is to center the timer text (numbers) vertically within the timer shape (verticalBias = .5). Setting verticalBias less than .5 will pull the text towards the top of the timer shape. Setting verticalBias greater than .5 will pull the text towards the bottom of the timer shape. */
888
+ textVerticalBias?: number;
889
+ }
890
+ interface TimerShape {
891
+ circle?: {
892
+ /** Radius of the circle timer shape. */
893
+ radius: number;
894
+ };
895
+ rectangle?: {
896
+ /** Width of the rectangle timer shape. */
897
+ width: number;
898
+ /** Height of the rectangle timer shape. */
899
+ height: number;
900
+ /** Corner radius of the rectangle timer shape. Default is 0. */
901
+ cornerRadius?: number;
902
+ };
903
+ /** Color of the timer shape. Default is Royal Blue. */
904
+ fillColor?: RgbaColor;
905
+ }
906
+ interface CountdownTimerEvent extends CompositeEvent {
907
+ type: "Composite";
908
+ compositeType: "CountdownTimer";
909
+ compositeEventType: "CountdownTimerTick" | "CountdownTimerComplete";
910
+ millisecondsRemaining: number;
911
+ target: CountdownTimer | string;
912
+ }
913
+ declare class CountdownTimer extends Composite implements CountdownTimerOptions {
914
+ readonly compositeType = "CountdownTimer";
915
+ private originalOptions;
916
+ private _milliseconds;
917
+ private _tickIntervalMilliseconds;
918
+ private _fontName;
919
+ private _fontSize;
920
+ private _fontColor;
921
+ private _zeroString;
922
+ private _timerShape;
923
+ private _textVerticalBias;
924
+ private countdownSequence;
925
+ private timerShapeNode?;
926
+ private timerNumberLabel?;
927
+ private _isRunning;
928
+ private hasStopped;
929
+ /**
930
+ * A countdown timer displays a number that counts down to zero.
931
+ *
932
+ * @param options
933
+ */
934
+ constructor(options: CountdownTimerOptions);
935
+ get completeNodeOptions(): {
936
+ /** Duration of the countdown, in milliseconds. Must be multiple of 1000. Default is 3000. */
937
+ milliseconds?: number;
938
+ /** Duration of each tick interval, in milliseconds. Default is 1000. */
939
+ tickIntervalMilliseconds?: number;
940
+ /** Font name for timer text (numbers). */
941
+ fontName?: string;
942
+ /** Font size for timer text (numbers). Default is 50. */
943
+ fontSize?: number;
944
+ /** Font size for timer text (numbers). Default is white. */
945
+ fontColor?: RgbaColor;
946
+ /** String to show when the timer reaches zero. Default is "0". This could be changed to another value, such as "GO!" */
947
+ zeroString?: string;
948
+ /** Shape of the timer. Default is a Royal Blue circle with a radius of 100. */
949
+ timerShape?: TimerShape;
950
+ /** Default is to center the timer text (numbers) vertically within the timer shape (verticalBias = .5). Setting verticalBias less than .5 will pull the text towards the top of the timer shape. Setting verticalBias greater than .5 will pull the text towards the bottom of the timer shape. */
951
+ textVerticalBias?: number;
952
+ name?: string;
953
+ position?: _m2c2kit_core.Point;
954
+ scale?: number;
955
+ alpha?: number;
956
+ zRotation?: number;
957
+ isUserInteractionEnabled?: boolean;
958
+ draggable?: boolean;
959
+ hidden?: boolean;
960
+ layout?: _m2c2kit_core.Layout;
961
+ uuid?: string;
962
+ suppressEvents?: boolean;
963
+ anchorPoint?: _m2c2kit_core.Point;
964
+ zPosition?: number;
965
+ };
966
+ initialize(): void;
967
+ private tick;
968
+ /**
969
+ * Starts the countdown timer.
970
+ *
971
+ * @remarks Calling start on a running timer or a stopped timer will raise
972
+ * an error.
973
+ */
974
+ start(): void;
975
+ /**
976
+ * Stops the countdown timer.
977
+ *
978
+ * @remarks This method is idempotent. Calling stop() on a stopped timer has
979
+ * no effect and will not raise an error.
980
+ */
981
+ stop(): void;
982
+ /**
983
+ * Returns true if the countdown timer is running.
984
+ */
985
+ get isRunning(): boolean;
986
+ handleCompositeEvent(event: CountdownTimerEvent): void;
987
+ /**
988
+ * Executes a callback when the timer ticks.
989
+ *
990
+ * @remarks The callback is also executed when the timer completes.
991
+ *
992
+ * @param callback - function to execute
993
+ * @param options
994
+ */
995
+ onTick(callback: (countdownTimerEvent: CountdownTimerEvent) => void, options?: CallbackOptions): void;
996
+ /**
997
+ * Executes a callback when the timer completes.
998
+ *
999
+ * @remarks This is the last tick of the timer.
1000
+ *
1001
+ * @param callback - function to execute.
1002
+ * @param options
1003
+ */
1004
+ onComplete(callback: (countdownTimerEvent: CountdownTimerEvent) => void, options?: CallbackOptions): void;
1005
+ private addCountdownTimerEventListener;
1006
+ get milliseconds(): number;
1007
+ set milliseconds(milliseconds: number);
1008
+ get tickIntervalMilliseconds(): number;
1009
+ set tickIntervalMilliseconds(tickIntervalMilliseconds: number);
1010
+ get fontColor(): RgbaColor;
1011
+ set fontColor(fontColor: RgbaColor);
1012
+ get fontName(): string | undefined;
1013
+ set fontName(fontName: string | undefined);
1014
+ get fontSize(): number;
1015
+ set fontSize(fontSize: number);
1016
+ get zeroString(): string;
1017
+ set zeroString(zeroString: string);
1018
+ get timerShape(): TimerShape;
1019
+ set timerShape(shape: TimerShape);
1020
+ get textVerticalBias(): number;
1021
+ set textVerticalBias(textVerticalBias: number);
1022
+ /**
1023
+ * Duplicates a node using deep copy.
1024
+ *
1025
+ * @remarks This is a deep recursive clone (node and children).
1026
+ * The uuid property of all duplicated nodes will be newly created,
1027
+ * because uuid must be unique.
1028
+ *
1029
+ * @param newName - optional name of the new, duplicated node. If not
1030
+ * provided, name will be the new uuid
1031
+ */
1032
+ duplicate(newName?: string | undefined): CountdownTimer;
1033
+ update(): void;
1034
+ draw(canvas: Canvas): void;
1035
+ warmup(canvas: Canvas): void;
1036
+ }
1037
+
655
1038
  interface CountdownSceneOptions extends SceneOptions {
656
1039
  /** Duration of the countdown, in milliseconds. */
657
1040
  milliseconds: number;
@@ -678,27 +1061,11 @@ interface CountdownSceneOptions extends SceneOptions {
678
1061
  /** Font size for timer numbers. Default is white. */
679
1062
  timerNumbersFontColor?: RgbaColor;
680
1063
  /** String to show when the timer reaches zero. Default is "0". This could be changed to another value, such as "GO!" */
681
- timerZeroString?: string;
1064
+ zeroString?: string;
682
1065
  /** Shape of the timer. Default is a Royal Blue circle with a radius of 100 centered vertically. */
683
1066
  timerShape?: TimerShape;
684
- }
685
- interface TimerShape {
686
- circle?: {
687
- /** Radius of the circle timer shape. */
688
- radius: number;
689
- };
690
- rectangle?: {
691
- /** Width of the rectangle timer shape. */
692
- width: number;
693
- /** Height of the rectangle timer shape. */
694
- height: number;
695
- /** Corner radius of the rectangle timer shape. Default is 0. */
696
- cornerRadius?: number;
697
- };
698
- /** Color of the timer shape. Default is Royal Blue. */
699
- fillColor?: RgbaColor;
700
1067
  /** Default is to center the timer shape vertically within the scene (verticalBias = .5). Setting verticalBias less than .5 will pull the shape towards the top. Setting verticalBias greater than .5 will pull the shape towards the bottom. */
701
- verticalBias?: number;
1068
+ shapeVerticalBias?: number;
702
1069
  }
703
1070
  declare class CountdownScene extends Scene {
704
1071
  /**
@@ -756,7 +1123,10 @@ interface LocalePickerResult {
756
1123
  /** Locale that was selected. Is undefined if dialog was dismissed. */
757
1124
  locale?: string;
758
1125
  }
759
- interface LocalePickerEvent extends M2NodeEvent {
1126
+ interface LocalePickerEvent extends CompositeEvent {
1127
+ type: "Composite";
1128
+ compositeType: "LocalePicker";
1129
+ compositeEventType: "LocalePickerResult";
760
1130
  result: LocalePickerResult;
761
1131
  }
762
1132
  interface LocaleSvg {
@@ -769,8 +1139,7 @@ interface LocaleSvg {
769
1139
  width: number;
770
1140
  }
771
1141
  declare class LocalePicker extends Composite {
772
- compositeType: string;
773
- zPosition: number;
1142
+ readonly compositeType = "LocalePicker";
774
1143
  private readonly DEFAULT_FONT_SIZE;
775
1144
  automaticallyChangeLocale: boolean;
776
1145
  private _localeOptions;
@@ -862,4 +1231,4 @@ declare class LocalePicker extends Composite {
862
1231
  duplicate(newName?: string): LocalePicker;
863
1232
  }
864
1233
 
865
- export { Button, type ButtonOptions, CountdownScene, type CountdownSceneOptions, Dialog, type DialogEvent, type DialogOptions, DialogResult, DrawPad, type DrawPadEvent, DrawPadEventType, type DrawPadItem, type DrawPadItemEvent, DrawPadItemEventType, type DrawPadOptions, type DrawPadStroke, Grid, type GridOptions, type InstructionScene, Instructions, type InstructionsOptions, type KeyConfiguration, type KeyTapMetadata, type LocaleOption, LocalePicker, type LocalePickerEvent, type LocalePickerIcon, type LocalePickerOptions, type LocalePickerResult, type StrokeInteraction, type TimerShape, VirtualKeyboard, type VirtualKeyboardEvent, type VirtualKeyboardOptions, type VirtualKeyboardRow };
1234
+ export { Button, type ButtonOptions, CountdownScene, type CountdownSceneOptions, CountdownTimer, type CountdownTimerEvent, type CountdownTimerOptions, Dialog, type DialogEvent, type DialogOptions, DialogResult, DrawPad, type DrawPadEvent, DrawPadEventType, type DrawPadItem, type DrawPadItemEvent, DrawPadItemEventType, type DrawPadOptions, type DrawPadStroke, Grid, type GridChild, type GridOptions, type InstructionScene, Instructions, type InstructionsOptions, type KeyConfiguration, type KeyTapMetadata, type LocaleOption, LocalePicker, type LocalePickerEvent, type LocalePickerIcon, type LocalePickerOptions, type LocalePickerResult, type StrokeInteraction, type TimerShape, VirtualKeyboard, type VirtualKeyboardEvent, type VirtualKeyboardOptions, type VirtualKeyboardRow };