@m2c2kit/addons 0.3.2 → 0.3.4
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 +16 -16
- package/dist/index.js +13 -13
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -183,7 +183,7 @@ declare class Dialog extends Composite {
|
|
|
183
183
|
private backgroundPaint?;
|
|
184
184
|
constructor(options?: DialogOptions);
|
|
185
185
|
show(): void;
|
|
186
|
-
|
|
186
|
+
onDialogResult(callback: (dialogResultEvent: DialogEvent) => void, replaceExistingCallback?: boolean): void;
|
|
187
187
|
initialize(): void;
|
|
188
188
|
get backgroundColor(): RgbaColor;
|
|
189
189
|
set backgroundColor(backgroundColor: RgbaColor);
|
|
@@ -243,7 +243,7 @@ interface VirtualKeyboardOptions extends CompositeOptions {
|
|
|
243
243
|
/** Comma-separated list of keys to hide. */
|
|
244
244
|
hiddenKeys?: string;
|
|
245
245
|
/** If true, only capital letters will be shown. */
|
|
246
|
-
|
|
246
|
+
capitalLettersOnly?: boolean;
|
|
247
247
|
/** Color of keys. */
|
|
248
248
|
keyColor?: RgbaColor;
|
|
249
249
|
/** Color of keys when pressed. */
|
|
@@ -272,7 +272,7 @@ declare class VirtualKeyboard extends Composite {
|
|
|
272
272
|
private keysPerRow;
|
|
273
273
|
private fontSize;
|
|
274
274
|
private hiddenKeys;
|
|
275
|
-
private
|
|
275
|
+
private capitalLettersOnly;
|
|
276
276
|
private keyColor;
|
|
277
277
|
private keyDownColor;
|
|
278
278
|
private specialKeyDownColor;
|
|
@@ -379,31 +379,31 @@ interface InstructionsOptions extends StoryOptions {
|
|
|
379
379
|
postInstructionsScene?: string;
|
|
380
380
|
/** Array of instruction scenes that form the instructions */
|
|
381
381
|
instructionScenes: Array<InstructionScene>;
|
|
382
|
-
/** Background color for instruction scenes. Can be
|
|
382
|
+
/** Background color for instruction scenes. Can be overridden within a single instruction scene */
|
|
383
383
|
backgroundColor?: RgbaColor;
|
|
384
|
-
/** Scene transition when advancing to the next instruction scene. Default is push transition, to the left, 500 milliseconds duration. Can be
|
|
384
|
+
/** Scene transition when advancing to the next instruction scene. Default is push transition, to the left, 500 milliseconds duration. Can be overridden within a single instruction scene */
|
|
385
385
|
nextSceneTransition?: Transition;
|
|
386
|
-
/** Scene transition when returning to the previous instruction scene. Default is push transition, to the right, 500 milliseconds duration. Can be
|
|
386
|
+
/** Scene transition when returning to the previous instruction scene. Default is push transition, to the right, 500 milliseconds duration. Can be overridden within a single instruction scene */
|
|
387
387
|
backSceneTransition?: Transition;
|
|
388
|
-
/** Button text for the back button. Default is "Back". Can be
|
|
388
|
+
/** Button text for the back button. Default is "Back". Can be overridden within a single instruction scene */
|
|
389
389
|
backButtonText?: string;
|
|
390
|
-
/** Button text for the next button. Default is "Next". Can be
|
|
390
|
+
/** Button text for the next button. Default is "Next". Can be overridden within a single instruction scene */
|
|
391
391
|
nextButtonText?: string;
|
|
392
|
-
/** Width of back button. Default is 125. Can be
|
|
392
|
+
/** Width of back button. Default is 125. Can be overridden within a single instruction scene */
|
|
393
393
|
backButtonWidth?: number;
|
|
394
|
-
/** Width of next button. Default is 125. Can be
|
|
394
|
+
/** Width of next button. Default is 125. Can be overridden within a single instruction scene */
|
|
395
395
|
nextButtonWidth?: number;
|
|
396
|
-
/** Height of back button. Default is 50. Can be
|
|
396
|
+
/** Height of back button. Default is 50. Can be overridden within a single instruction scene */
|
|
397
397
|
backButtonHeight?: number;
|
|
398
|
-
/** Height of next button. Default is 50. Can be
|
|
398
|
+
/** Height of next button. Default is 50. Can be overridden within a single instruction scene */
|
|
399
399
|
nextButtonHeight?: number;
|
|
400
|
-
/** Color of back button. Default is WebColors.Black. Can be
|
|
400
|
+
/** Color of back button. Default is WebColors.Black. Can be overridden within a single instruction scene */
|
|
401
401
|
backButtonBackgroundColor?: RgbaColor;
|
|
402
|
-
/** Color of back button text. Default is WebColors.White. Can be
|
|
402
|
+
/** Color of back button text. Default is WebColors.White. Can be overridden within a single instruction scene */
|
|
403
403
|
backButtonFontColor?: RgbaColor;
|
|
404
|
-
/** Color of next button. Default is WebColors.Black. Can be
|
|
404
|
+
/** Color of next button. Default is WebColors.Black. Can be overridden within a single instruction scene */
|
|
405
405
|
nextButtonBackgroundColor?: RgbaColor;
|
|
406
|
-
/** Color of next button text. Default is WebColors.White. Can be
|
|
406
|
+
/** Color of next button text. Default is WebColors.White. Can be overridden within a single instruction scene */
|
|
407
407
|
nextButtonFontColor?: RgbaColor;
|
|
408
408
|
}
|
|
409
409
|
declare class Instructions extends Story {
|
package/dist/index.js
CHANGED
|
@@ -432,7 +432,7 @@ class Dialog extends Composite {
|
|
|
432
432
|
show() {
|
|
433
433
|
this.hidden = false;
|
|
434
434
|
}
|
|
435
|
-
|
|
435
|
+
onDialogResult(callback, replaceExistingCallback = true) {
|
|
436
436
|
const eventListener = {
|
|
437
437
|
type: EventType.CompositeCustom,
|
|
438
438
|
entityUuid: this.uuid,
|
|
@@ -611,7 +611,7 @@ class VirtualKeyboard extends Composite {
|
|
|
611
611
|
this.keysPerRow = (_f = options.keysPerRow) != null ? _f : NaN;
|
|
612
612
|
this.fontSize = (_g = options.fontSize) != null ? _g : NaN;
|
|
613
613
|
this.hiddenKeys = (_h = options.hiddenKeys) != null ? _h : "";
|
|
614
|
-
this.
|
|
614
|
+
this.capitalLettersOnly = (_i = options.capitalLettersOnly) != null ? _i : false;
|
|
615
615
|
this.keyColor = (_j = options.keyColor) != null ? _j : WebColors.White;
|
|
616
616
|
this.keyDownColor = (_k = options.keyDownColor) != null ? _k : WebColors.Transparent;
|
|
617
617
|
this.specialKeyDownColor = (_l = options.specialKeyDownColor) != null ? _l : WebColors.LightSteelBlue;
|
|
@@ -726,7 +726,7 @@ class VirtualKeyboard extends Composite {
|
|
|
726
726
|
let isShift = false;
|
|
727
727
|
if (typeof key === "string") {
|
|
728
728
|
code = key;
|
|
729
|
-
if (this.
|
|
729
|
+
if (this.capitalLettersOnly) {
|
|
730
730
|
label = code.toUpperCase();
|
|
731
731
|
} else {
|
|
732
732
|
label = code;
|
|
@@ -761,8 +761,8 @@ class VirtualKeyboard extends Composite {
|
|
|
761
761
|
};
|
|
762
762
|
const keyboardVerticalPadding = ((_a = this.keyboardVerticalPaddingPercent) != null ? _a : 0.025) * this.size.height;
|
|
763
763
|
const keyboardHorizontalPadding = ((_b = this.keyboardHorizontalPaddingPercent) != null ? _b : 0.02) * this.size.width;
|
|
764
|
-
const
|
|
765
|
-
const
|
|
764
|
+
const keyBoxHeight = (this.size.height - 2 * keyboardVerticalPadding) / rows.length;
|
|
765
|
+
const keyBoxWidth = (this.size.width - 2 * keyboardHorizontalPadding) / this.keysPerRow;
|
|
766
766
|
for (let r = 0; r < rows.length; r++) {
|
|
767
767
|
const row = rows[r];
|
|
768
768
|
const rowSumKeyWidths = row.reduce(
|
|
@@ -774,7 +774,7 @@ class VirtualKeyboard extends Composite {
|
|
|
774
774
|
);
|
|
775
775
|
let extraPadding = 0;
|
|
776
776
|
if (rowSumKeyWidths < this.keysPerRow) {
|
|
777
|
-
extraPadding = (this.size.width - 2 * keyboardHorizontalPadding -
|
|
777
|
+
extraPadding = (this.size.width - 2 * keyboardHorizontalPadding - keyBoxWidth * rowSumKeyWidths) / 2;
|
|
778
778
|
}
|
|
779
779
|
for (let k = 0; k < row.length; k++) {
|
|
780
780
|
const key = row[k];
|
|
@@ -784,25 +784,25 @@ class VirtualKeyboard extends Composite {
|
|
|
784
784
|
const keyBoxWidthsSoFar = row.slice(0, k).reduce((sum, key2) => {
|
|
785
785
|
var _a2;
|
|
786
786
|
return sum + ((_a2 = key2.widthRatio) != null ? _a2 : 1);
|
|
787
|
-
}, 0) *
|
|
787
|
+
}, 0) * keyBoxWidth;
|
|
788
788
|
const keyBox = new Shape({
|
|
789
789
|
rect: {
|
|
790
790
|
size: {
|
|
791
|
-
width:
|
|
792
|
-
height:
|
|
791
|
+
width: keyBoxWidth * ((_d = key.widthRatio) != null ? _d : 1),
|
|
792
|
+
height: keyBoxHeight
|
|
793
793
|
}
|
|
794
794
|
},
|
|
795
795
|
fillColor: WebColors.Transparent,
|
|
796
796
|
strokeColor: WebColors.Transparent,
|
|
797
797
|
lineWidth: 1,
|
|
798
798
|
position: {
|
|
799
|
-
x: extraPadding + keyboardOrigin.x + keyboardHorizontalPadding + keyBoxWidthsSoFar + ((_e = key.widthRatio) != null ? _e : 1) *
|
|
800
|
-
y: keyboardOrigin.y + keyboardVerticalPadding + r *
|
|
799
|
+
x: extraPadding + keyboardOrigin.x + keyboardHorizontalPadding + keyBoxWidthsSoFar + ((_e = key.widthRatio) != null ? _e : 1) * keyBoxWidth / 2,
|
|
800
|
+
y: keyboardOrigin.y + keyboardVerticalPadding + r * keyBoxHeight + keyBoxHeight / 2
|
|
801
801
|
},
|
|
802
802
|
isUserInteractionEnabled: true
|
|
803
803
|
});
|
|
804
|
-
const keyWidth =
|
|
805
|
-
const keyHeight =
|
|
804
|
+
const keyWidth = keyBoxWidth * ((_f = key.widthRatio) != null ? _f : 1) - 2 * this.keyHorizontalPaddingPercent * keyBoxWidth;
|
|
805
|
+
const keyHeight = keyBoxHeight - ((_g = key.heightRatio) != null ? _g : 1) - 2 * this.keyVerticalPaddingPercent * keyBoxHeight;
|
|
806
806
|
const keyShape = new Shape({
|
|
807
807
|
rect: { size: { width: keyWidth, height: keyHeight } },
|
|
808
808
|
cornerRadius: 4,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/addons",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Additions to m2c2kit core functionalty, such as button, grid, and instructions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,13 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@m2c2kit/core": "0.3.
|
|
23
|
+
"@m2c2kit/core": "^0.3.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rollup/plugin-babel": "6.0.3",
|
|
27
|
-
"esbuild": "0.17.17",
|
|
28
27
|
"rimraf": "5.0.0",
|
|
29
|
-
"rollup": "3.
|
|
28
|
+
"rollup": "3.22.0",
|
|
30
29
|
"rollup-plugin-copy": "3.4.0",
|
|
31
30
|
"rollup-plugin-dts": "5.3.0",
|
|
32
31
|
"rollup-plugin-esbuild": "5.0.0",
|