@konoui/mjimage 0.0.46 → 0.0.48
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 +4 -2
- package/dist/index.cjs +16 -10
- package/dist/index.d.cts +157 -22
- package/dist/index.d.ts +157 -22
- package/dist/index.js +4041 -6462
- package/package.json +7 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Actor } from 'xstate';
|
|
2
2
|
import { AnyActorRef } from 'xstate';
|
|
3
3
|
import { EventObject } from 'xstate';
|
|
4
|
-
import {
|
|
5
|
-
import { Image as Image_2 } from '@svgdotjs/svg.js';
|
|
4
|
+
import { incrementalIDGenerator as incrementalIDGenerator_2 } from './state-machine';
|
|
6
5
|
import { InferOutput } from 'valibot';
|
|
7
6
|
import { MaxValueAction } from 'valibot';
|
|
8
7
|
import { MetaObject } from 'xstate';
|
|
@@ -18,8 +17,7 @@ import { StateMachine } from 'xstate';
|
|
|
18
17
|
import { StateValue } from 'xstate';
|
|
19
18
|
import { StrictObjectSchema } from 'valibot';
|
|
20
19
|
import { StringSchema } from 'valibot';
|
|
21
|
-
import {
|
|
22
|
-
import { Use } from '@svgdotjs/svg.js';
|
|
20
|
+
import { Wind as Wind_2 } from '../..';
|
|
23
21
|
|
|
24
22
|
export declare class ActorHand extends Hand {
|
|
25
23
|
isBackHand(): boolean;
|
|
@@ -27,6 +25,14 @@ export declare class ActorHand extends Hand {
|
|
|
27
25
|
dec(tiles: readonly Tile[]): readonly Tile[];
|
|
28
26
|
}
|
|
29
27
|
|
|
28
|
+
export declare type Attrs = {
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
|
|
30
36
|
export declare abstract class BaseActor {
|
|
31
37
|
id: string;
|
|
32
38
|
river: IRiver;
|
|
@@ -50,7 +56,6 @@ export declare abstract class BaseActor {
|
|
|
50
56
|
declare class BaseHelper {
|
|
51
57
|
readonly tileWidth: number;
|
|
52
58
|
readonly tileHeight: number;
|
|
53
|
-
readonly imageHostPath: string;
|
|
54
59
|
readonly imageHostUrl: string;
|
|
55
60
|
readonly imageExt: "svg" | "webp";
|
|
56
61
|
readonly scale: number;
|
|
@@ -86,20 +91,20 @@ export declare const BLOCK: {
|
|
|
86
91
|
export declare abstract class Block {
|
|
87
92
|
private readonly _tiles;
|
|
88
93
|
private readonly _type;
|
|
89
|
-
constructor(tiles: readonly Tile[], type:
|
|
94
|
+
constructor(tiles: readonly Tile[], type: BlockType);
|
|
90
95
|
static deserialize(v: SerializedBlock): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
|
|
91
96
|
serialize(): {
|
|
92
97
|
tiles: string;
|
|
93
|
-
type:
|
|
98
|
+
type: BlockType;
|
|
94
99
|
};
|
|
95
100
|
toJSON(): {
|
|
96
101
|
tiles: string;
|
|
97
|
-
type:
|
|
102
|
+
type: BlockType;
|
|
98
103
|
};
|
|
99
|
-
get type():
|
|
104
|
+
get type(): BlockType;
|
|
100
105
|
get tiles(): readonly Tile[];
|
|
101
106
|
abstract toString(): string;
|
|
102
|
-
is(type:
|
|
107
|
+
is(type: BlockType): boolean;
|
|
103
108
|
isCalled(): boolean;
|
|
104
109
|
clone(override?: {
|
|
105
110
|
replace?: {
|
|
@@ -125,8 +130,10 @@ export declare class BlockCalculator {
|
|
|
125
130
|
thirteenOrphans(): readonly Block[][];
|
|
126
131
|
nineGates(): readonly Block[][];
|
|
127
132
|
fourSetsOnePair(): readonly Block[][];
|
|
128
|
-
private
|
|
129
|
-
private
|
|
133
|
+
private patternAll;
|
|
134
|
+
private handleBack;
|
|
135
|
+
private handleZ;
|
|
136
|
+
private handleNumType;
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
export declare class BlockChi extends Block {
|
|
@@ -152,7 +159,7 @@ export declare class BlockIsolated extends Block {
|
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
export declare class BlockOther extends Block {
|
|
155
|
-
constructor(tiles: readonly Tile[], type:
|
|
162
|
+
constructor(tiles: readonly Tile[], type: BlockType);
|
|
156
163
|
toString(): string;
|
|
157
164
|
}
|
|
158
165
|
|
|
@@ -185,6 +192,8 @@ export declare class BlockThree extends Block {
|
|
|
185
192
|
toString(): string;
|
|
186
193
|
}
|
|
187
194
|
|
|
195
|
+
declare type BlockType = (typeof BLOCK)[keyof typeof BLOCK];
|
|
196
|
+
|
|
188
197
|
export declare interface BoardContext {
|
|
189
198
|
doraMarkers: readonly Tile[];
|
|
190
199
|
blindDoraMarkers?: readonly Tile[];
|
|
@@ -284,7 +293,7 @@ export declare class Controller {
|
|
|
284
293
|
oneShotMap: { [key in Wind]: boolean; };
|
|
285
294
|
missingMap: { [key in Wind]: boolean; };
|
|
286
295
|
controller: Controller;
|
|
287
|
-
genEventID: ReturnType<
|
|
296
|
+
genEventID: ReturnType<incrementalIDGenerator_2>;
|
|
288
297
|
}, {
|
|
289
298
|
type: "";
|
|
290
299
|
} | {
|
|
@@ -604,7 +613,7 @@ export declare class DoubleCalculator {
|
|
|
604
613
|
orig: BoardContext;
|
|
605
614
|
};
|
|
606
615
|
constructor(hand: Hand, params: BoardContext);
|
|
607
|
-
calc(hands: readonly Block[][]): WinResult | false;
|
|
616
|
+
calc(...hands: readonly Block[][]): WinResult | false;
|
|
608
617
|
calcPatterns(hands: readonly Block[][]): {
|
|
609
618
|
points: {
|
|
610
619
|
name: string;
|
|
@@ -797,6 +806,7 @@ export declare class Efficiency {
|
|
|
797
806
|
}): Candidate[];
|
|
798
807
|
static candidateTiles(hand: Hand, options?: {
|
|
799
808
|
fourSetsOnePair?: boolean;
|
|
809
|
+
typeFilter?: Type[];
|
|
800
810
|
}): {
|
|
801
811
|
shanten: number;
|
|
802
812
|
candidates: Tile[];
|
|
@@ -851,6 +861,19 @@ export declare function forHand(options?: {
|
|
|
851
861
|
filterBy?: Type[];
|
|
852
862
|
}): Generator<readonly ["m" | "p" | "s" | "z" | "_", number], void, unknown>;
|
|
853
863
|
|
|
864
|
+
export declare class G extends Mark {
|
|
865
|
+
children: Mark[];
|
|
866
|
+
private rotateMatrix;
|
|
867
|
+
private translateMatrix;
|
|
868
|
+
constructor();
|
|
869
|
+
add(e: Mark): this;
|
|
870
|
+
rotate(angle: number, cx: number, cy: number): this;
|
|
871
|
+
translate(x: number, y: number): this;
|
|
872
|
+
protected center(): string;
|
|
873
|
+
protected left(...v: string[]): string;
|
|
874
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
875
|
+
}
|
|
876
|
+
|
|
854
877
|
export declare class Hand {
|
|
855
878
|
protected data: HandData;
|
|
856
879
|
constructor(input: string | Block[], allowBackBlock?: boolean);
|
|
@@ -910,6 +933,15 @@ declare interface History_2 {
|
|
|
910
933
|
}
|
|
911
934
|
export { History_2 as History }
|
|
912
935
|
|
|
936
|
+
declare class Image_2 extends Mark {
|
|
937
|
+
attrs: Attrs & {
|
|
938
|
+
href?: string;
|
|
939
|
+
};
|
|
940
|
+
constructor(url?: string);
|
|
941
|
+
load(url: string): this;
|
|
942
|
+
}
|
|
943
|
+
export { Image_2 as Image }
|
|
944
|
+
|
|
913
945
|
export declare class ImageHelper extends BaseHelper {
|
|
914
946
|
readonly blockMargin: number;
|
|
915
947
|
createBlockHandDiscard(block: Block): G;
|
|
@@ -918,7 +950,6 @@ export declare class ImageHelper extends BaseHelper {
|
|
|
918
950
|
|
|
919
951
|
export declare interface ImageHelperConfig {
|
|
920
952
|
scale?: number;
|
|
921
|
-
imageHostPath?: string;
|
|
922
953
|
imageHostUrl?: string;
|
|
923
954
|
imageExt?: "svg" | "webp";
|
|
924
955
|
svgSprite?: boolean;
|
|
@@ -963,6 +994,28 @@ export declare interface IWall {
|
|
|
963
994
|
};
|
|
964
995
|
}
|
|
965
996
|
|
|
997
|
+
export declare abstract class Mark {
|
|
998
|
+
type: string;
|
|
999
|
+
attrs: Attrs;
|
|
1000
|
+
styles: Styles;
|
|
1001
|
+
private deleteMarker;
|
|
1002
|
+
constructor(type: string);
|
|
1003
|
+
dx(x: number): this;
|
|
1004
|
+
dy(y: number): this;
|
|
1005
|
+
x(x: number): this;
|
|
1006
|
+
y(y: number): this;
|
|
1007
|
+
size(width: number, height: number): this;
|
|
1008
|
+
remove(): void;
|
|
1009
|
+
protected left(...v: string[]): string;
|
|
1010
|
+
protected right(): string;
|
|
1011
|
+
protected center(): string;
|
|
1012
|
+
toString(): string;
|
|
1013
|
+
attr(attrs: Record<string, string>): this;
|
|
1014
|
+
attr(key: string): string;
|
|
1015
|
+
css(style: Record<string, string>): this;
|
|
1016
|
+
svg(): string;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
966
1019
|
export declare class MeasureText {
|
|
967
1020
|
ctx: CanvasRenderingContext2D | null;
|
|
968
1021
|
strText: string;
|
|
@@ -973,6 +1026,18 @@ export declare class MeasureText {
|
|
|
973
1026
|
measureTableFontContext: (tableScale: number) => FontContext;
|
|
974
1027
|
}
|
|
975
1028
|
|
|
1029
|
+
export declare const MyG: typeof G;
|
|
1030
|
+
|
|
1031
|
+
export declare const MyImage: typeof Image_2;
|
|
1032
|
+
|
|
1033
|
+
export declare const MyRect: typeof Rect;
|
|
1034
|
+
|
|
1035
|
+
export declare const MySVG: typeof SVG;
|
|
1036
|
+
|
|
1037
|
+
export declare const MyText: typeof Text_2;
|
|
1038
|
+
|
|
1039
|
+
export declare const MyUse: typeof Use;
|
|
1040
|
+
|
|
976
1041
|
export declare const N19: readonly number[];
|
|
977
1042
|
|
|
978
1043
|
export declare interface NewDoraEvent {
|
|
@@ -997,7 +1062,7 @@ export declare class Observer extends BaseActor {
|
|
|
997
1062
|
handleEvent(e: PlayerEvent): void;
|
|
998
1063
|
}
|
|
999
1064
|
|
|
1000
|
-
export declare const
|
|
1065
|
+
export declare const OP: {
|
|
1001
1066
|
readonly TSUMO: "t";
|
|
1002
1067
|
readonly RON: "v";
|
|
1003
1068
|
readonly DORA: "d";
|
|
@@ -1006,7 +1071,7 @@ export declare const OPERATOR: {
|
|
|
1006
1071
|
readonly COLOR_GRAYSCALE: "^";
|
|
1007
1072
|
};
|
|
1008
1073
|
|
|
1009
|
-
declare type Operator = (typeof
|
|
1074
|
+
declare type Operator = (typeof OP)[keyof typeof OP];
|
|
1010
1075
|
|
|
1011
1076
|
export declare const optimizeSVG: (draw: Svg) => void;
|
|
1012
1077
|
|
|
@@ -1094,7 +1159,7 @@ export declare class Player extends BaseActor {
|
|
|
1094
1159
|
river: River;
|
|
1095
1160
|
doras: Tile[];
|
|
1096
1161
|
constructor(playerID: string, eventHandler: EventHandler);
|
|
1097
|
-
get myWind():
|
|
1162
|
+
get myWind(): Wind_2;
|
|
1098
1163
|
setHands(e: DistributeEvent): void;
|
|
1099
1164
|
handleDiscard(tiles: Tile[]): Tile;
|
|
1100
1165
|
handleEvent(e: PlayerEvent): void;
|
|
@@ -1155,6 +1220,16 @@ export declare interface ReachEvent {
|
|
|
1155
1220
|
wind: Wind;
|
|
1156
1221
|
}
|
|
1157
1222
|
|
|
1223
|
+
export declare class Rect extends Mark {
|
|
1224
|
+
attrs: Attrs & {
|
|
1225
|
+
stroke?: string;
|
|
1226
|
+
fill?: string;
|
|
1227
|
+
};
|
|
1228
|
+
constructor();
|
|
1229
|
+
fill(color: string): this;
|
|
1230
|
+
stroke(color: string): this;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1158
1233
|
export declare class Replayer {
|
|
1159
1234
|
index: number;
|
|
1160
1235
|
histories: History_2[];
|
|
@@ -1302,7 +1377,7 @@ export declare class ShantenCalculator {
|
|
|
1302
1377
|
sevenPairs(): number;
|
|
1303
1378
|
thirteenOrphans(): number;
|
|
1304
1379
|
fourSetsOnePair(): number;
|
|
1305
|
-
private
|
|
1380
|
+
private patternNumType;
|
|
1306
1381
|
private groupRemainingTiles;
|
|
1307
1382
|
private calcCommon;
|
|
1308
1383
|
}
|
|
@@ -1311,6 +1386,41 @@ export declare function shuffle<T>(array: T[]): T[];
|
|
|
1311
1386
|
|
|
1312
1387
|
export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
|
|
1313
1388
|
|
|
1389
|
+
export declare const STICK_CONTEXT: {
|
|
1390
|
+
readonly WIDTH: 125;
|
|
1391
|
+
readonly HEIGHT: 27.5;
|
|
1392
|
+
};
|
|
1393
|
+
|
|
1394
|
+
export declare type Styles = {
|
|
1395
|
+
[key: string]: string;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
export declare function SVG(): Svg;
|
|
1399
|
+
|
|
1400
|
+
export declare class Svg extends Mark {
|
|
1401
|
+
children: Mark[];
|
|
1402
|
+
constructor();
|
|
1403
|
+
private viewBox;
|
|
1404
|
+
add(e: Mark): this;
|
|
1405
|
+
protected center(): string;
|
|
1406
|
+
protected left(...v: string[]): string;
|
|
1407
|
+
viewbox(x: number, y: number, width: number, height: number): this;
|
|
1408
|
+
importSymbol(input: string): this;
|
|
1409
|
+
x(x: number): this;
|
|
1410
|
+
y(y: number): this;
|
|
1411
|
+
dx(x: number): this;
|
|
1412
|
+
dy(y: number): this;
|
|
1413
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
declare class Symbol_2 extends Mark {
|
|
1417
|
+
private raw;
|
|
1418
|
+
constructor(value: string);
|
|
1419
|
+
id(): string;
|
|
1420
|
+
protected center(): string;
|
|
1421
|
+
}
|
|
1422
|
+
export { Symbol_2 as Symbol }
|
|
1423
|
+
|
|
1314
1424
|
export declare const TABLE_CONTEXT: {
|
|
1315
1425
|
readonly BASE: 40;
|
|
1316
1426
|
};
|
|
@@ -1376,11 +1486,27 @@ readonly score: 25000;
|
|
|
1376
1486
|
}>;
|
|
1377
1487
|
}, undefined>;
|
|
1378
1488
|
|
|
1489
|
+
declare class Text_2 extends Mark {
|
|
1490
|
+
attrs: Attrs & {
|
|
1491
|
+
fontFamily?: string;
|
|
1492
|
+
fontSize?: number;
|
|
1493
|
+
};
|
|
1494
|
+
private _text;
|
|
1495
|
+
constructor(text?: string);
|
|
1496
|
+
plain(text: string): this;
|
|
1497
|
+
font(font: {
|
|
1498
|
+
family: string;
|
|
1499
|
+
size: number;
|
|
1500
|
+
}): this;
|
|
1501
|
+
protected center(): string;
|
|
1502
|
+
}
|
|
1503
|
+
export { Text_2 as Text }
|
|
1504
|
+
|
|
1379
1505
|
export declare class Tile {
|
|
1380
1506
|
readonly t: Type;
|
|
1381
1507
|
readonly n: number;
|
|
1382
|
-
readonly ops: Operator[];
|
|
1383
|
-
constructor(t: Type, n: number, ops?: Operator[]);
|
|
1508
|
+
readonly ops: readonly Operator[];
|
|
1509
|
+
constructor(t: Type, n: number, ops?: readonly Operator[]);
|
|
1384
1510
|
static from(s: string): Tile;
|
|
1385
1511
|
toString(): string;
|
|
1386
1512
|
toJSON(): string;
|
|
@@ -1426,6 +1552,15 @@ export declare const TYPE: {
|
|
|
1426
1552
|
|
|
1427
1553
|
export declare type Type = (typeof TYPE)[keyof typeof TYPE];
|
|
1428
1554
|
|
|
1555
|
+
export declare class Use extends Mark {
|
|
1556
|
+
attrs: Attrs & {
|
|
1557
|
+
href?: string;
|
|
1558
|
+
};
|
|
1559
|
+
constructor(id?: string);
|
|
1560
|
+
use(id: string): this;
|
|
1561
|
+
private make;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1429
1564
|
export declare class Wall {
|
|
1430
1565
|
private walls;
|
|
1431
1566
|
private backup;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Actor } from 'xstate';
|
|
2
2
|
import { AnyActorRef } from 'xstate';
|
|
3
3
|
import { EventObject } from 'xstate';
|
|
4
|
-
import {
|
|
5
|
-
import { Image as Image_2 } from '@svgdotjs/svg.js';
|
|
4
|
+
import { incrementalIDGenerator as incrementalIDGenerator_2 } from './state-machine';
|
|
6
5
|
import { InferOutput } from 'valibot';
|
|
7
6
|
import { MaxValueAction } from 'valibot';
|
|
8
7
|
import { MetaObject } from 'xstate';
|
|
@@ -18,8 +17,7 @@ import { StateMachine } from 'xstate';
|
|
|
18
17
|
import { StateValue } from 'xstate';
|
|
19
18
|
import { StrictObjectSchema } from 'valibot';
|
|
20
19
|
import { StringSchema } from 'valibot';
|
|
21
|
-
import {
|
|
22
|
-
import { Use } from '@svgdotjs/svg.js';
|
|
20
|
+
import { Wind as Wind_2 } from '../..';
|
|
23
21
|
|
|
24
22
|
export declare class ActorHand extends Hand {
|
|
25
23
|
isBackHand(): boolean;
|
|
@@ -27,6 +25,14 @@ export declare class ActorHand extends Hand {
|
|
|
27
25
|
dec(tiles: readonly Tile[]): readonly Tile[];
|
|
28
26
|
}
|
|
29
27
|
|
|
28
|
+
export declare type Attrs = {
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
|
|
30
36
|
export declare abstract class BaseActor {
|
|
31
37
|
id: string;
|
|
32
38
|
river: IRiver;
|
|
@@ -50,7 +56,6 @@ export declare abstract class BaseActor {
|
|
|
50
56
|
declare class BaseHelper {
|
|
51
57
|
readonly tileWidth: number;
|
|
52
58
|
readonly tileHeight: number;
|
|
53
|
-
readonly imageHostPath: string;
|
|
54
59
|
readonly imageHostUrl: string;
|
|
55
60
|
readonly imageExt: "svg" | "webp";
|
|
56
61
|
readonly scale: number;
|
|
@@ -86,20 +91,20 @@ export declare const BLOCK: {
|
|
|
86
91
|
export declare abstract class Block {
|
|
87
92
|
private readonly _tiles;
|
|
88
93
|
private readonly _type;
|
|
89
|
-
constructor(tiles: readonly Tile[], type:
|
|
94
|
+
constructor(tiles: readonly Tile[], type: BlockType);
|
|
90
95
|
static deserialize(v: SerializedBlock): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
|
|
91
96
|
serialize(): {
|
|
92
97
|
tiles: string;
|
|
93
|
-
type:
|
|
98
|
+
type: BlockType;
|
|
94
99
|
};
|
|
95
100
|
toJSON(): {
|
|
96
101
|
tiles: string;
|
|
97
|
-
type:
|
|
102
|
+
type: BlockType;
|
|
98
103
|
};
|
|
99
|
-
get type():
|
|
104
|
+
get type(): BlockType;
|
|
100
105
|
get tiles(): readonly Tile[];
|
|
101
106
|
abstract toString(): string;
|
|
102
|
-
is(type:
|
|
107
|
+
is(type: BlockType): boolean;
|
|
103
108
|
isCalled(): boolean;
|
|
104
109
|
clone(override?: {
|
|
105
110
|
replace?: {
|
|
@@ -125,8 +130,10 @@ export declare class BlockCalculator {
|
|
|
125
130
|
thirteenOrphans(): readonly Block[][];
|
|
126
131
|
nineGates(): readonly Block[][];
|
|
127
132
|
fourSetsOnePair(): readonly Block[][];
|
|
128
|
-
private
|
|
129
|
-
private
|
|
133
|
+
private patternAll;
|
|
134
|
+
private handleBack;
|
|
135
|
+
private handleZ;
|
|
136
|
+
private handleNumType;
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
export declare class BlockChi extends Block {
|
|
@@ -152,7 +159,7 @@ export declare class BlockIsolated extends Block {
|
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
export declare class BlockOther extends Block {
|
|
155
|
-
constructor(tiles: readonly Tile[], type:
|
|
162
|
+
constructor(tiles: readonly Tile[], type: BlockType);
|
|
156
163
|
toString(): string;
|
|
157
164
|
}
|
|
158
165
|
|
|
@@ -185,6 +192,8 @@ export declare class BlockThree extends Block {
|
|
|
185
192
|
toString(): string;
|
|
186
193
|
}
|
|
187
194
|
|
|
195
|
+
declare type BlockType = (typeof BLOCK)[keyof typeof BLOCK];
|
|
196
|
+
|
|
188
197
|
export declare interface BoardContext {
|
|
189
198
|
doraMarkers: readonly Tile[];
|
|
190
199
|
blindDoraMarkers?: readonly Tile[];
|
|
@@ -284,7 +293,7 @@ export declare class Controller {
|
|
|
284
293
|
oneShotMap: { [key in Wind]: boolean; };
|
|
285
294
|
missingMap: { [key in Wind]: boolean; };
|
|
286
295
|
controller: Controller;
|
|
287
|
-
genEventID: ReturnType<
|
|
296
|
+
genEventID: ReturnType<incrementalIDGenerator_2>;
|
|
288
297
|
}, {
|
|
289
298
|
type: "";
|
|
290
299
|
} | {
|
|
@@ -604,7 +613,7 @@ export declare class DoubleCalculator {
|
|
|
604
613
|
orig: BoardContext;
|
|
605
614
|
};
|
|
606
615
|
constructor(hand: Hand, params: BoardContext);
|
|
607
|
-
calc(hands: readonly Block[][]): WinResult | false;
|
|
616
|
+
calc(...hands: readonly Block[][]): WinResult | false;
|
|
608
617
|
calcPatterns(hands: readonly Block[][]): {
|
|
609
618
|
points: {
|
|
610
619
|
name: string;
|
|
@@ -797,6 +806,7 @@ export declare class Efficiency {
|
|
|
797
806
|
}): Candidate[];
|
|
798
807
|
static candidateTiles(hand: Hand, options?: {
|
|
799
808
|
fourSetsOnePair?: boolean;
|
|
809
|
+
typeFilter?: Type[];
|
|
800
810
|
}): {
|
|
801
811
|
shanten: number;
|
|
802
812
|
candidates: Tile[];
|
|
@@ -851,6 +861,19 @@ export declare function forHand(options?: {
|
|
|
851
861
|
filterBy?: Type[];
|
|
852
862
|
}): Generator<readonly ["m" | "p" | "s" | "z" | "_", number], void, unknown>;
|
|
853
863
|
|
|
864
|
+
export declare class G extends Mark {
|
|
865
|
+
children: Mark[];
|
|
866
|
+
private rotateMatrix;
|
|
867
|
+
private translateMatrix;
|
|
868
|
+
constructor();
|
|
869
|
+
add(e: Mark): this;
|
|
870
|
+
rotate(angle: number, cx: number, cy: number): this;
|
|
871
|
+
translate(x: number, y: number): this;
|
|
872
|
+
protected center(): string;
|
|
873
|
+
protected left(...v: string[]): string;
|
|
874
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
875
|
+
}
|
|
876
|
+
|
|
854
877
|
export declare class Hand {
|
|
855
878
|
protected data: HandData;
|
|
856
879
|
constructor(input: string | Block[], allowBackBlock?: boolean);
|
|
@@ -910,6 +933,15 @@ declare interface History_2 {
|
|
|
910
933
|
}
|
|
911
934
|
export { History_2 as History }
|
|
912
935
|
|
|
936
|
+
declare class Image_2 extends Mark {
|
|
937
|
+
attrs: Attrs & {
|
|
938
|
+
href?: string;
|
|
939
|
+
};
|
|
940
|
+
constructor(url?: string);
|
|
941
|
+
load(url: string): this;
|
|
942
|
+
}
|
|
943
|
+
export { Image_2 as Image }
|
|
944
|
+
|
|
913
945
|
export declare class ImageHelper extends BaseHelper {
|
|
914
946
|
readonly blockMargin: number;
|
|
915
947
|
createBlockHandDiscard(block: Block): G;
|
|
@@ -918,7 +950,6 @@ export declare class ImageHelper extends BaseHelper {
|
|
|
918
950
|
|
|
919
951
|
export declare interface ImageHelperConfig {
|
|
920
952
|
scale?: number;
|
|
921
|
-
imageHostPath?: string;
|
|
922
953
|
imageHostUrl?: string;
|
|
923
954
|
imageExt?: "svg" | "webp";
|
|
924
955
|
svgSprite?: boolean;
|
|
@@ -963,6 +994,28 @@ export declare interface IWall {
|
|
|
963
994
|
};
|
|
964
995
|
}
|
|
965
996
|
|
|
997
|
+
export declare abstract class Mark {
|
|
998
|
+
type: string;
|
|
999
|
+
attrs: Attrs;
|
|
1000
|
+
styles: Styles;
|
|
1001
|
+
private deleteMarker;
|
|
1002
|
+
constructor(type: string);
|
|
1003
|
+
dx(x: number): this;
|
|
1004
|
+
dy(y: number): this;
|
|
1005
|
+
x(x: number): this;
|
|
1006
|
+
y(y: number): this;
|
|
1007
|
+
size(width: number, height: number): this;
|
|
1008
|
+
remove(): void;
|
|
1009
|
+
protected left(...v: string[]): string;
|
|
1010
|
+
protected right(): string;
|
|
1011
|
+
protected center(): string;
|
|
1012
|
+
toString(): string;
|
|
1013
|
+
attr(attrs: Record<string, string>): this;
|
|
1014
|
+
attr(key: string): string;
|
|
1015
|
+
css(style: Record<string, string>): this;
|
|
1016
|
+
svg(): string;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
966
1019
|
export declare class MeasureText {
|
|
967
1020
|
ctx: CanvasRenderingContext2D | null;
|
|
968
1021
|
strText: string;
|
|
@@ -973,6 +1026,18 @@ export declare class MeasureText {
|
|
|
973
1026
|
measureTableFontContext: (tableScale: number) => FontContext;
|
|
974
1027
|
}
|
|
975
1028
|
|
|
1029
|
+
export declare const MyG: typeof G;
|
|
1030
|
+
|
|
1031
|
+
export declare const MyImage: typeof Image_2;
|
|
1032
|
+
|
|
1033
|
+
export declare const MyRect: typeof Rect;
|
|
1034
|
+
|
|
1035
|
+
export declare const MySVG: typeof SVG;
|
|
1036
|
+
|
|
1037
|
+
export declare const MyText: typeof Text_2;
|
|
1038
|
+
|
|
1039
|
+
export declare const MyUse: typeof Use;
|
|
1040
|
+
|
|
976
1041
|
export declare const N19: readonly number[];
|
|
977
1042
|
|
|
978
1043
|
export declare interface NewDoraEvent {
|
|
@@ -997,7 +1062,7 @@ export declare class Observer extends BaseActor {
|
|
|
997
1062
|
handleEvent(e: PlayerEvent): void;
|
|
998
1063
|
}
|
|
999
1064
|
|
|
1000
|
-
export declare const
|
|
1065
|
+
export declare const OP: {
|
|
1001
1066
|
readonly TSUMO: "t";
|
|
1002
1067
|
readonly RON: "v";
|
|
1003
1068
|
readonly DORA: "d";
|
|
@@ -1006,7 +1071,7 @@ export declare const OPERATOR: {
|
|
|
1006
1071
|
readonly COLOR_GRAYSCALE: "^";
|
|
1007
1072
|
};
|
|
1008
1073
|
|
|
1009
|
-
declare type Operator = (typeof
|
|
1074
|
+
declare type Operator = (typeof OP)[keyof typeof OP];
|
|
1010
1075
|
|
|
1011
1076
|
export declare const optimizeSVG: (draw: Svg) => void;
|
|
1012
1077
|
|
|
@@ -1094,7 +1159,7 @@ export declare class Player extends BaseActor {
|
|
|
1094
1159
|
river: River;
|
|
1095
1160
|
doras: Tile[];
|
|
1096
1161
|
constructor(playerID: string, eventHandler: EventHandler);
|
|
1097
|
-
get myWind():
|
|
1162
|
+
get myWind(): Wind_2;
|
|
1098
1163
|
setHands(e: DistributeEvent): void;
|
|
1099
1164
|
handleDiscard(tiles: Tile[]): Tile;
|
|
1100
1165
|
handleEvent(e: PlayerEvent): void;
|
|
@@ -1155,6 +1220,16 @@ export declare interface ReachEvent {
|
|
|
1155
1220
|
wind: Wind;
|
|
1156
1221
|
}
|
|
1157
1222
|
|
|
1223
|
+
export declare class Rect extends Mark {
|
|
1224
|
+
attrs: Attrs & {
|
|
1225
|
+
stroke?: string;
|
|
1226
|
+
fill?: string;
|
|
1227
|
+
};
|
|
1228
|
+
constructor();
|
|
1229
|
+
fill(color: string): this;
|
|
1230
|
+
stroke(color: string): this;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1158
1233
|
export declare class Replayer {
|
|
1159
1234
|
index: number;
|
|
1160
1235
|
histories: History_2[];
|
|
@@ -1302,7 +1377,7 @@ export declare class ShantenCalculator {
|
|
|
1302
1377
|
sevenPairs(): number;
|
|
1303
1378
|
thirteenOrphans(): number;
|
|
1304
1379
|
fourSetsOnePair(): number;
|
|
1305
|
-
private
|
|
1380
|
+
private patternNumType;
|
|
1306
1381
|
private groupRemainingTiles;
|
|
1307
1382
|
private calcCommon;
|
|
1308
1383
|
}
|
|
@@ -1311,6 +1386,41 @@ export declare function shuffle<T>(array: T[]): T[];
|
|
|
1311
1386
|
|
|
1312
1387
|
export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
|
|
1313
1388
|
|
|
1389
|
+
export declare const STICK_CONTEXT: {
|
|
1390
|
+
readonly WIDTH: 125;
|
|
1391
|
+
readonly HEIGHT: 27.5;
|
|
1392
|
+
};
|
|
1393
|
+
|
|
1394
|
+
export declare type Styles = {
|
|
1395
|
+
[key: string]: string;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
export declare function SVG(): Svg;
|
|
1399
|
+
|
|
1400
|
+
export declare class Svg extends Mark {
|
|
1401
|
+
children: Mark[];
|
|
1402
|
+
constructor();
|
|
1403
|
+
private viewBox;
|
|
1404
|
+
add(e: Mark): this;
|
|
1405
|
+
protected center(): string;
|
|
1406
|
+
protected left(...v: string[]): string;
|
|
1407
|
+
viewbox(x: number, y: number, width: number, height: number): this;
|
|
1408
|
+
importSymbol(input: string): this;
|
|
1409
|
+
x(x: number): this;
|
|
1410
|
+
y(y: number): this;
|
|
1411
|
+
dx(x: number): this;
|
|
1412
|
+
dy(y: number): this;
|
|
1413
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
declare class Symbol_2 extends Mark {
|
|
1417
|
+
private raw;
|
|
1418
|
+
constructor(value: string);
|
|
1419
|
+
id(): string;
|
|
1420
|
+
protected center(): string;
|
|
1421
|
+
}
|
|
1422
|
+
export { Symbol_2 as Symbol }
|
|
1423
|
+
|
|
1314
1424
|
export declare const TABLE_CONTEXT: {
|
|
1315
1425
|
readonly BASE: 40;
|
|
1316
1426
|
};
|
|
@@ -1376,11 +1486,27 @@ readonly score: 25000;
|
|
|
1376
1486
|
}>;
|
|
1377
1487
|
}, undefined>;
|
|
1378
1488
|
|
|
1489
|
+
declare class Text_2 extends Mark {
|
|
1490
|
+
attrs: Attrs & {
|
|
1491
|
+
fontFamily?: string;
|
|
1492
|
+
fontSize?: number;
|
|
1493
|
+
};
|
|
1494
|
+
private _text;
|
|
1495
|
+
constructor(text?: string);
|
|
1496
|
+
plain(text: string): this;
|
|
1497
|
+
font(font: {
|
|
1498
|
+
family: string;
|
|
1499
|
+
size: number;
|
|
1500
|
+
}): this;
|
|
1501
|
+
protected center(): string;
|
|
1502
|
+
}
|
|
1503
|
+
export { Text_2 as Text }
|
|
1504
|
+
|
|
1379
1505
|
export declare class Tile {
|
|
1380
1506
|
readonly t: Type;
|
|
1381
1507
|
readonly n: number;
|
|
1382
|
-
readonly ops: Operator[];
|
|
1383
|
-
constructor(t: Type, n: number, ops?: Operator[]);
|
|
1508
|
+
readonly ops: readonly Operator[];
|
|
1509
|
+
constructor(t: Type, n: number, ops?: readonly Operator[]);
|
|
1384
1510
|
static from(s: string): Tile;
|
|
1385
1511
|
toString(): string;
|
|
1386
1512
|
toJSON(): string;
|
|
@@ -1426,6 +1552,15 @@ export declare const TYPE: {
|
|
|
1426
1552
|
|
|
1427
1553
|
export declare type Type = (typeof TYPE)[keyof typeof TYPE];
|
|
1428
1554
|
|
|
1555
|
+
export declare class Use extends Mark {
|
|
1556
|
+
attrs: Attrs & {
|
|
1557
|
+
href?: string;
|
|
1558
|
+
};
|
|
1559
|
+
constructor(id?: string);
|
|
1560
|
+
use(id: string): this;
|
|
1561
|
+
private make;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1429
1564
|
export declare class Wall {
|
|
1430
1565
|
private walls;
|
|
1431
1566
|
private backup;
|