@konoui/mjimage 0.7.0 → 0.8.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.
- package/README.md +35 -22
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +33 -21
- package/dist/index.d.ts +33 -21
- package/dist/index.js +1718 -1639
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -425,7 +425,7 @@ export declare const convertInput: (i: TableInput) => {
|
|
|
425
425
|
};
|
|
426
426
|
|
|
427
427
|
export declare class Counter {
|
|
428
|
-
|
|
428
|
+
disabled: boolean;
|
|
429
429
|
private c;
|
|
430
430
|
safeTileMap: {
|
|
431
431
|
"1z": {
|
|
@@ -441,7 +441,7 @@ export declare class Counter {
|
|
|
441
441
|
[name: string]: boolean;
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
|
-
constructor(
|
|
444
|
+
constructor(disabled?: boolean);
|
|
445
445
|
get(t: Tile): number;
|
|
446
446
|
dec(...tiles: Tile[]): void;
|
|
447
447
|
addTileToSafeMap(t: Tile, targetUser: Wind): void;
|
|
@@ -451,6 +451,8 @@ export declare class Counter {
|
|
|
451
451
|
private initial;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
+
export declare const createBlockHand: (helper: ImageHelper, blocks: Block[], options?: DrawOptions) => MySVGElement;
|
|
455
|
+
|
|
454
456
|
export declare const createControllerMachine: (c: Controller) => StateMachine<ControllerContext, {
|
|
455
457
|
type: "";
|
|
456
458
|
} | {
|
|
@@ -515,12 +517,6 @@ export declare const createEventEmitter: () => {
|
|
|
515
517
|
|
|
516
518
|
export declare const createEventPipe: () => [EventHandler, EventHandler];
|
|
517
519
|
|
|
518
|
-
export declare const createHand: (helper: ImageHelper, blocks: Block[], options?: DrawOptions) => {
|
|
519
|
-
e: G;
|
|
520
|
-
width: number;
|
|
521
|
-
height: number;
|
|
522
|
-
};
|
|
523
|
-
|
|
524
520
|
export declare const createLocalGame: (params?: {
|
|
525
521
|
debug?: boolean;
|
|
526
522
|
shuffle?: boolean;
|
|
@@ -538,11 +534,7 @@ export declare const createLocalGame: (params?: {
|
|
|
538
534
|
p4: Player;
|
|
539
535
|
};
|
|
540
536
|
|
|
541
|
-
export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) =>
|
|
542
|
-
e: G;
|
|
543
|
-
width: number;
|
|
544
|
-
height: number;
|
|
545
|
-
};
|
|
537
|
+
export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) => MySVGElement;
|
|
546
538
|
|
|
547
539
|
export declare function createWindMap<T>(initial: T, clone?: boolean): {
|
|
548
540
|
"1z": T;
|
|
@@ -620,8 +612,8 @@ declare interface DrawnChoice {
|
|
|
620
612
|
}
|
|
621
613
|
|
|
622
614
|
export declare interface DrawOptions {
|
|
623
|
-
|
|
624
|
-
|
|
615
|
+
enableDoraText?: boolean;
|
|
616
|
+
enableTsumoText?: boolean;
|
|
625
617
|
}
|
|
626
618
|
|
|
627
619
|
export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelperConfig | undefined, fontCtx: FontContext, params?: {
|
|
@@ -784,8 +776,18 @@ export { Image_2 as Image }
|
|
|
784
776
|
|
|
785
777
|
export declare class ImageHelper extends BaseHelper {
|
|
786
778
|
readonly blockMargin: number;
|
|
787
|
-
|
|
788
|
-
|
|
779
|
+
createBlockDiscard(block: BlockOther): G;
|
|
780
|
+
createBlockHand(block: BlockHand): G;
|
|
781
|
+
createBlockChi(block: BlockChi): G;
|
|
782
|
+
createBlockPon(block: BlockChi): G;
|
|
783
|
+
createBlockShoKan(block: BlockShoKan): G;
|
|
784
|
+
createBlockDaiKan(block: BlockDaiKan): G;
|
|
785
|
+
createBlockAnKan(block: BlockAnKan): G;
|
|
786
|
+
createBlockDora(block: BlockOther, enableText?: boolean): G;
|
|
787
|
+
createBlockTsumo(block: BlockOther, enableText?: boolean): G;
|
|
788
|
+
protected createBlockSingleText(block: Block, text: string, enableText?: boolean): G;
|
|
789
|
+
protected createHorizontalBlock(tiles: readonly Tile[]): G;
|
|
790
|
+
protected findHorizontalIndex(block: Block): number;
|
|
789
791
|
}
|
|
790
792
|
|
|
791
793
|
export declare interface ImageHelperConfig {
|
|
@@ -874,6 +876,12 @@ export declare const MyRect: typeof Rect;
|
|
|
874
876
|
|
|
875
877
|
export declare const MySVG: typeof SVG;
|
|
876
878
|
|
|
879
|
+
export declare interface MySVGElement {
|
|
880
|
+
e: G;
|
|
881
|
+
width: number;
|
|
882
|
+
height: number;
|
|
883
|
+
}
|
|
884
|
+
|
|
877
885
|
export declare const MyText: typeof Text_2;
|
|
878
886
|
|
|
879
887
|
export declare const MyUse: typeof Use;
|
|
@@ -905,7 +913,7 @@ export declare class Observer extends BaseActor {
|
|
|
905
913
|
export declare const OP: {
|
|
906
914
|
readonly TSUMO: "t";
|
|
907
915
|
readonly RON: "v";
|
|
908
|
-
readonly
|
|
916
|
+
readonly IMAGE_DORA: "d";
|
|
909
917
|
readonly HORIZONTAL: "-";
|
|
910
918
|
readonly RED: "r";
|
|
911
919
|
readonly COLOR_GRAYSCALE: "^";
|
|
@@ -923,11 +931,13 @@ export declare const parse: (s: string) => {
|
|
|
923
931
|
|
|
924
932
|
export declare class Parser {
|
|
925
933
|
readonly input: string;
|
|
934
|
+
readonly enableImplicitTsumoBlock: boolean;
|
|
926
935
|
readonly maxInputLength = 600;
|
|
927
|
-
constructor(input: string);
|
|
936
|
+
constructor(input: string, enableImplicitTsumoBlock?: boolean);
|
|
928
937
|
parse(): (BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair)[];
|
|
929
938
|
tiles(): readonly Tile[];
|
|
930
939
|
tileSeparators(): readonly (Tile | Separator)[];
|
|
940
|
+
private reconstruct;
|
|
931
941
|
private makeBlocks;
|
|
932
942
|
private validate;
|
|
933
943
|
}
|
|
@@ -1063,7 +1073,7 @@ export declare class PointCalculator {
|
|
|
1063
1073
|
private calculateTsumoDeltas;
|
|
1064
1074
|
private addStickPoints;
|
|
1065
1075
|
private getBasePoints;
|
|
1066
|
-
private
|
|
1076
|
+
private getCalledPenalty;
|
|
1067
1077
|
dA1(h: readonly Block[]): Yaku[];
|
|
1068
1078
|
dB1(h: readonly Block[]): Yaku[];
|
|
1069
1079
|
dC1(h: readonly Block[]): Yaku[];
|
|
@@ -1233,6 +1243,8 @@ export declare const ROUND_MAP: {
|
|
|
1233
1243
|
readonly "4z4": "北4局";
|
|
1234
1244
|
};
|
|
1235
1245
|
|
|
1246
|
+
export declare const roundWind: (r: Round) => Wind;
|
|
1247
|
+
|
|
1236
1248
|
export declare interface ScoreBoardInput {
|
|
1237
1249
|
doras: readonly Tile[];
|
|
1238
1250
|
round: BoardRound;
|
|
@@ -1262,7 +1274,7 @@ export declare class ScoreManager {
|
|
|
1262
1274
|
update(result: {
|
|
1263
1275
|
[w in Wind]: number;
|
|
1264
1276
|
}, windMap: {
|
|
1265
|
-
[
|
|
1277
|
+
[id: string]: Wind;
|
|
1266
1278
|
}): void;
|
|
1267
1279
|
}
|
|
1268
1280
|
|
package/dist/index.d.ts
CHANGED
|
@@ -425,7 +425,7 @@ export declare const convertInput: (i: TableInput) => {
|
|
|
425
425
|
};
|
|
426
426
|
|
|
427
427
|
export declare class Counter {
|
|
428
|
-
|
|
428
|
+
disabled: boolean;
|
|
429
429
|
private c;
|
|
430
430
|
safeTileMap: {
|
|
431
431
|
"1z": {
|
|
@@ -441,7 +441,7 @@ export declare class Counter {
|
|
|
441
441
|
[name: string]: boolean;
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
|
-
constructor(
|
|
444
|
+
constructor(disabled?: boolean);
|
|
445
445
|
get(t: Tile): number;
|
|
446
446
|
dec(...tiles: Tile[]): void;
|
|
447
447
|
addTileToSafeMap(t: Tile, targetUser: Wind): void;
|
|
@@ -451,6 +451,8 @@ export declare class Counter {
|
|
|
451
451
|
private initial;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
+
export declare const createBlockHand: (helper: ImageHelper, blocks: Block[], options?: DrawOptions) => MySVGElement;
|
|
455
|
+
|
|
454
456
|
export declare const createControllerMachine: (c: Controller) => StateMachine<ControllerContext, {
|
|
455
457
|
type: "";
|
|
456
458
|
} | {
|
|
@@ -515,12 +517,6 @@ export declare const createEventEmitter: () => {
|
|
|
515
517
|
|
|
516
518
|
export declare const createEventPipe: () => [EventHandler, EventHandler];
|
|
517
519
|
|
|
518
|
-
export declare const createHand: (helper: ImageHelper, blocks: Block[], options?: DrawOptions) => {
|
|
519
|
-
e: G;
|
|
520
|
-
width: number;
|
|
521
|
-
height: number;
|
|
522
|
-
};
|
|
523
|
-
|
|
524
520
|
export declare const createLocalGame: (params?: {
|
|
525
521
|
debug?: boolean;
|
|
526
522
|
shuffle?: boolean;
|
|
@@ -538,11 +534,7 @@ export declare const createLocalGame: (params?: {
|
|
|
538
534
|
p4: Player;
|
|
539
535
|
};
|
|
540
536
|
|
|
541
|
-
export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) =>
|
|
542
|
-
e: G;
|
|
543
|
-
width: number;
|
|
544
|
-
height: number;
|
|
545
|
-
};
|
|
537
|
+
export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) => MySVGElement;
|
|
546
538
|
|
|
547
539
|
export declare function createWindMap<T>(initial: T, clone?: boolean): {
|
|
548
540
|
"1z": T;
|
|
@@ -620,8 +612,8 @@ declare interface DrawnChoice {
|
|
|
620
612
|
}
|
|
621
613
|
|
|
622
614
|
export declare interface DrawOptions {
|
|
623
|
-
|
|
624
|
-
|
|
615
|
+
enableDoraText?: boolean;
|
|
616
|
+
enableTsumoText?: boolean;
|
|
625
617
|
}
|
|
626
618
|
|
|
627
619
|
export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelperConfig | undefined, fontCtx: FontContext, params?: {
|
|
@@ -784,8 +776,18 @@ export { Image_2 as Image }
|
|
|
784
776
|
|
|
785
777
|
export declare class ImageHelper extends BaseHelper {
|
|
786
778
|
readonly blockMargin: number;
|
|
787
|
-
|
|
788
|
-
|
|
779
|
+
createBlockDiscard(block: BlockOther): G;
|
|
780
|
+
createBlockHand(block: BlockHand): G;
|
|
781
|
+
createBlockChi(block: BlockChi): G;
|
|
782
|
+
createBlockPon(block: BlockChi): G;
|
|
783
|
+
createBlockShoKan(block: BlockShoKan): G;
|
|
784
|
+
createBlockDaiKan(block: BlockDaiKan): G;
|
|
785
|
+
createBlockAnKan(block: BlockAnKan): G;
|
|
786
|
+
createBlockDora(block: BlockOther, enableText?: boolean): G;
|
|
787
|
+
createBlockTsumo(block: BlockOther, enableText?: boolean): G;
|
|
788
|
+
protected createBlockSingleText(block: Block, text: string, enableText?: boolean): G;
|
|
789
|
+
protected createHorizontalBlock(tiles: readonly Tile[]): G;
|
|
790
|
+
protected findHorizontalIndex(block: Block): number;
|
|
789
791
|
}
|
|
790
792
|
|
|
791
793
|
export declare interface ImageHelperConfig {
|
|
@@ -874,6 +876,12 @@ export declare const MyRect: typeof Rect;
|
|
|
874
876
|
|
|
875
877
|
export declare const MySVG: typeof SVG;
|
|
876
878
|
|
|
879
|
+
export declare interface MySVGElement {
|
|
880
|
+
e: G;
|
|
881
|
+
width: number;
|
|
882
|
+
height: number;
|
|
883
|
+
}
|
|
884
|
+
|
|
877
885
|
export declare const MyText: typeof Text_2;
|
|
878
886
|
|
|
879
887
|
export declare const MyUse: typeof Use;
|
|
@@ -905,7 +913,7 @@ export declare class Observer extends BaseActor {
|
|
|
905
913
|
export declare const OP: {
|
|
906
914
|
readonly TSUMO: "t";
|
|
907
915
|
readonly RON: "v";
|
|
908
|
-
readonly
|
|
916
|
+
readonly IMAGE_DORA: "d";
|
|
909
917
|
readonly HORIZONTAL: "-";
|
|
910
918
|
readonly RED: "r";
|
|
911
919
|
readonly COLOR_GRAYSCALE: "^";
|
|
@@ -923,11 +931,13 @@ export declare const parse: (s: string) => {
|
|
|
923
931
|
|
|
924
932
|
export declare class Parser {
|
|
925
933
|
readonly input: string;
|
|
934
|
+
readonly enableImplicitTsumoBlock: boolean;
|
|
926
935
|
readonly maxInputLength = 600;
|
|
927
|
-
constructor(input: string);
|
|
936
|
+
constructor(input: string, enableImplicitTsumoBlock?: boolean);
|
|
928
937
|
parse(): (BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair)[];
|
|
929
938
|
tiles(): readonly Tile[];
|
|
930
939
|
tileSeparators(): readonly (Tile | Separator)[];
|
|
940
|
+
private reconstruct;
|
|
931
941
|
private makeBlocks;
|
|
932
942
|
private validate;
|
|
933
943
|
}
|
|
@@ -1063,7 +1073,7 @@ export declare class PointCalculator {
|
|
|
1063
1073
|
private calculateTsumoDeltas;
|
|
1064
1074
|
private addStickPoints;
|
|
1065
1075
|
private getBasePoints;
|
|
1066
|
-
private
|
|
1076
|
+
private getCalledPenalty;
|
|
1067
1077
|
dA1(h: readonly Block[]): Yaku[];
|
|
1068
1078
|
dB1(h: readonly Block[]): Yaku[];
|
|
1069
1079
|
dC1(h: readonly Block[]): Yaku[];
|
|
@@ -1233,6 +1243,8 @@ export declare const ROUND_MAP: {
|
|
|
1233
1243
|
readonly "4z4": "北4局";
|
|
1234
1244
|
};
|
|
1235
1245
|
|
|
1246
|
+
export declare const roundWind: (r: Round) => Wind;
|
|
1247
|
+
|
|
1236
1248
|
export declare interface ScoreBoardInput {
|
|
1237
1249
|
doras: readonly Tile[];
|
|
1238
1250
|
round: BoardRound;
|
|
@@ -1262,7 +1274,7 @@ export declare class ScoreManager {
|
|
|
1262
1274
|
update(result: {
|
|
1263
1275
|
[w in Wind]: number;
|
|
1264
1276
|
}, windMap: {
|
|
1265
|
-
[
|
|
1277
|
+
[id: string]: Wind;
|
|
1266
1278
|
}): void;
|
|
1267
1279
|
}
|
|
1268
1280
|
|