@konoui/mjimage 0.0.47 → 0.0.49
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 -26
- package/dist/index.d.ts +157 -26
- package/dist/index.js +4262 -6658
- package/package.json +8 -9
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;
|
|
@@ -178,6 +183,7 @@ export declare class BlockRun extends Block {
|
|
|
178
183
|
export declare class BlockShoKan extends Block {
|
|
179
184
|
constructor(tiles: readonly Tile[]);
|
|
180
185
|
static from(s: string): BlockShoKan;
|
|
186
|
+
static fromPon(b: BlockPon, t: Tile): BlockShoKan;
|
|
181
187
|
toString(): string;
|
|
182
188
|
}
|
|
183
189
|
|
|
@@ -288,7 +294,7 @@ export declare class Controller {
|
|
|
288
294
|
oneShotMap: { [key in Wind]: boolean; };
|
|
289
295
|
missingMap: { [key in Wind]: boolean; };
|
|
290
296
|
controller: Controller;
|
|
291
|
-
genEventID: ReturnType<
|
|
297
|
+
genEventID: ReturnType<incrementalIDGenerator_2>;
|
|
292
298
|
}, {
|
|
293
299
|
type: "";
|
|
294
300
|
} | {
|
|
@@ -856,6 +862,19 @@ export declare function forHand(options?: {
|
|
|
856
862
|
filterBy?: Type[];
|
|
857
863
|
}): Generator<readonly ["m" | "p" | "s" | "z" | "_", number], void, unknown>;
|
|
858
864
|
|
|
865
|
+
export declare class G extends Mark {
|
|
866
|
+
children: Mark[];
|
|
867
|
+
private rotateMatrix;
|
|
868
|
+
private translateMatrix;
|
|
869
|
+
constructor();
|
|
870
|
+
add(e: Mark): this;
|
|
871
|
+
rotate(angle: number, cx: number, cy: number): this;
|
|
872
|
+
translate(x: number, y: number): this;
|
|
873
|
+
protected center(): string;
|
|
874
|
+
protected left(...v: string[]): string;
|
|
875
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
876
|
+
}
|
|
877
|
+
|
|
859
878
|
export declare class Hand {
|
|
860
879
|
protected data: HandData;
|
|
861
880
|
constructor(input: string | Block[], allowBackBlock?: boolean);
|
|
@@ -915,6 +934,15 @@ declare interface History_2 {
|
|
|
915
934
|
}
|
|
916
935
|
export { History_2 as History }
|
|
917
936
|
|
|
937
|
+
declare class Image_2 extends Mark {
|
|
938
|
+
attrs: Attrs & {
|
|
939
|
+
href?: string;
|
|
940
|
+
};
|
|
941
|
+
constructor(url?: string);
|
|
942
|
+
load(url: string): this;
|
|
943
|
+
}
|
|
944
|
+
export { Image_2 as Image }
|
|
945
|
+
|
|
918
946
|
export declare class ImageHelper extends BaseHelper {
|
|
919
947
|
readonly blockMargin: number;
|
|
920
948
|
createBlockHandDiscard(block: Block): G;
|
|
@@ -923,7 +951,6 @@ export declare class ImageHelper extends BaseHelper {
|
|
|
923
951
|
|
|
924
952
|
export declare interface ImageHelperConfig {
|
|
925
953
|
scale?: number;
|
|
926
|
-
imageHostPath?: string;
|
|
927
954
|
imageHostUrl?: string;
|
|
928
955
|
imageExt?: "svg" | "webp";
|
|
929
956
|
svgSprite?: boolean;
|
|
@@ -968,6 +995,28 @@ export declare interface IWall {
|
|
|
968
995
|
};
|
|
969
996
|
}
|
|
970
997
|
|
|
998
|
+
export declare abstract class Mark {
|
|
999
|
+
type: string;
|
|
1000
|
+
attrs: Attrs;
|
|
1001
|
+
styles: Styles;
|
|
1002
|
+
private deleteMarker;
|
|
1003
|
+
constructor(type: string);
|
|
1004
|
+
dx(x: number): this;
|
|
1005
|
+
dy(y: number): this;
|
|
1006
|
+
x(x: number): this;
|
|
1007
|
+
y(y: number): this;
|
|
1008
|
+
size(width: number, height: number): this;
|
|
1009
|
+
remove(): void;
|
|
1010
|
+
protected left(...v: string[]): string;
|
|
1011
|
+
protected right(): string;
|
|
1012
|
+
protected center(): string;
|
|
1013
|
+
toString(): string;
|
|
1014
|
+
attr(attrs: Record<string, string>): this;
|
|
1015
|
+
attr(key: string): string;
|
|
1016
|
+
css(style: Record<string, string>): this;
|
|
1017
|
+
svg(): string;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
971
1020
|
export declare class MeasureText {
|
|
972
1021
|
ctx: CanvasRenderingContext2D | null;
|
|
973
1022
|
strText: string;
|
|
@@ -978,6 +1027,18 @@ export declare class MeasureText {
|
|
|
978
1027
|
measureTableFontContext: (tableScale: number) => FontContext;
|
|
979
1028
|
}
|
|
980
1029
|
|
|
1030
|
+
export declare const MyG: typeof G;
|
|
1031
|
+
|
|
1032
|
+
export declare const MyImage: typeof Image_2;
|
|
1033
|
+
|
|
1034
|
+
export declare const MyRect: typeof Rect;
|
|
1035
|
+
|
|
1036
|
+
export declare const MySVG: typeof SVG;
|
|
1037
|
+
|
|
1038
|
+
export declare const MyText: typeof Text_2;
|
|
1039
|
+
|
|
1040
|
+
export declare const MyUse: typeof Use;
|
|
1041
|
+
|
|
981
1042
|
export declare const N19: readonly number[];
|
|
982
1043
|
|
|
983
1044
|
export declare interface NewDoraEvent {
|
|
@@ -1002,7 +1063,7 @@ export declare class Observer extends BaseActor {
|
|
|
1002
1063
|
handleEvent(e: PlayerEvent): void;
|
|
1003
1064
|
}
|
|
1004
1065
|
|
|
1005
|
-
export declare const
|
|
1066
|
+
export declare const OP: {
|
|
1006
1067
|
readonly TSUMO: "t";
|
|
1007
1068
|
readonly RON: "v";
|
|
1008
1069
|
readonly DORA: "d";
|
|
@@ -1011,7 +1072,7 @@ export declare const OPERATOR: {
|
|
|
1011
1072
|
readonly COLOR_GRAYSCALE: "^";
|
|
1012
1073
|
};
|
|
1013
1074
|
|
|
1014
|
-
declare type Operator = (typeof
|
|
1075
|
+
declare type Operator = (typeof OP)[keyof typeof OP];
|
|
1015
1076
|
|
|
1016
1077
|
export declare const optimizeSVG: (draw: Svg) => void;
|
|
1017
1078
|
|
|
@@ -1033,35 +1094,35 @@ export declare class Parser {
|
|
|
1033
1094
|
}
|
|
1034
1095
|
|
|
1035
1096
|
export declare const parseTableInput: (s: string) => {
|
|
1097
|
+
board: {
|
|
1098
|
+
round: "1w1" | "1w2" | "1w3" | "1w4" | "2w1" | "2w2" | "2w3" | "2w4" | "3w1" | "3w2" | "3w3" | "3w4" | "4w1" | "4w2" | "4w3" | "4w4";
|
|
1099
|
+
sticks: {
|
|
1100
|
+
reach: number;
|
|
1101
|
+
dead: number;
|
|
1102
|
+
};
|
|
1103
|
+
doras: string;
|
|
1104
|
+
front: "1w" | "2w" | "3w" | "4w";
|
|
1105
|
+
};
|
|
1036
1106
|
"1w": {
|
|
1037
|
-
hand: string;
|
|
1038
1107
|
discard: string;
|
|
1108
|
+
hand: string;
|
|
1039
1109
|
score: number;
|
|
1040
1110
|
};
|
|
1041
1111
|
"2w": {
|
|
1042
|
-
hand: string;
|
|
1043
1112
|
discard: string;
|
|
1113
|
+
hand: string;
|
|
1044
1114
|
score: number;
|
|
1045
1115
|
};
|
|
1046
1116
|
"3w": {
|
|
1047
|
-
hand: string;
|
|
1048
1117
|
discard: string;
|
|
1118
|
+
hand: string;
|
|
1049
1119
|
score: number;
|
|
1050
1120
|
};
|
|
1051
1121
|
"4w": {
|
|
1052
|
-
hand: string;
|
|
1053
1122
|
discard: string;
|
|
1123
|
+
hand: string;
|
|
1054
1124
|
score: number;
|
|
1055
1125
|
};
|
|
1056
|
-
board: {
|
|
1057
|
-
round: Round;
|
|
1058
|
-
sticks: {
|
|
1059
|
-
reach: number;
|
|
1060
|
-
dead: number;
|
|
1061
|
-
};
|
|
1062
|
-
doras: string;
|
|
1063
|
-
front: Wind;
|
|
1064
|
-
};
|
|
1065
1126
|
};
|
|
1066
1127
|
|
|
1067
1128
|
export declare class PlaceManager {
|
|
@@ -1099,7 +1160,7 @@ export declare class Player extends BaseActor {
|
|
|
1099
1160
|
river: River;
|
|
1100
1161
|
doras: Tile[];
|
|
1101
1162
|
constructor(playerID: string, eventHandler: EventHandler);
|
|
1102
|
-
get myWind():
|
|
1163
|
+
get myWind(): Wind_2;
|
|
1103
1164
|
setHands(e: DistributeEvent): void;
|
|
1104
1165
|
handleDiscard(tiles: Tile[]): Tile;
|
|
1105
1166
|
handleEvent(e: PlayerEvent): void;
|
|
@@ -1160,6 +1221,16 @@ export declare interface ReachEvent {
|
|
|
1160
1221
|
wind: Wind;
|
|
1161
1222
|
}
|
|
1162
1223
|
|
|
1224
|
+
export declare class Rect extends Mark {
|
|
1225
|
+
attrs: Attrs & {
|
|
1226
|
+
stroke?: string;
|
|
1227
|
+
fill?: string;
|
|
1228
|
+
};
|
|
1229
|
+
constructor();
|
|
1230
|
+
fill(color: string): this;
|
|
1231
|
+
stroke(color: string): this;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1163
1234
|
export declare class Replayer {
|
|
1164
1235
|
index: number;
|
|
1165
1236
|
histories: History_2[];
|
|
@@ -1307,7 +1378,7 @@ export declare class ShantenCalculator {
|
|
|
1307
1378
|
sevenPairs(): number;
|
|
1308
1379
|
thirteenOrphans(): number;
|
|
1309
1380
|
fourSetsOnePair(): number;
|
|
1310
|
-
private
|
|
1381
|
+
private patternNumType;
|
|
1311
1382
|
private groupRemainingTiles;
|
|
1312
1383
|
private calcCommon;
|
|
1313
1384
|
}
|
|
@@ -1316,6 +1387,41 @@ export declare function shuffle<T>(array: T[]): T[];
|
|
|
1316
1387
|
|
|
1317
1388
|
export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
|
|
1318
1389
|
|
|
1390
|
+
export declare const STICK_CONTEXT: {
|
|
1391
|
+
readonly WIDTH: 125;
|
|
1392
|
+
readonly HEIGHT: 27.5;
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
export declare type Styles = {
|
|
1396
|
+
[key: string]: string;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
export declare function SVG(): Svg;
|
|
1400
|
+
|
|
1401
|
+
export declare class Svg extends Mark {
|
|
1402
|
+
children: Mark[];
|
|
1403
|
+
constructor();
|
|
1404
|
+
private viewBox;
|
|
1405
|
+
add(e: Mark): this;
|
|
1406
|
+
protected center(): string;
|
|
1407
|
+
protected left(...v: string[]): string;
|
|
1408
|
+
viewbox(x: number, y: number, width: number, height: number): this;
|
|
1409
|
+
importSymbol(input: string): this;
|
|
1410
|
+
x(x: number): this;
|
|
1411
|
+
y(y: number): this;
|
|
1412
|
+
dx(x: number): this;
|
|
1413
|
+
dy(y: number): this;
|
|
1414
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
declare class Symbol_2 extends Mark {
|
|
1418
|
+
private raw;
|
|
1419
|
+
constructor(value: string);
|
|
1420
|
+
id(): string;
|
|
1421
|
+
protected center(): string;
|
|
1422
|
+
}
|
|
1423
|
+
export { Symbol_2 as Symbol }
|
|
1424
|
+
|
|
1319
1425
|
export declare const TABLE_CONTEXT: {
|
|
1320
1426
|
readonly BASE: 40;
|
|
1321
1427
|
};
|
|
@@ -1326,8 +1432,8 @@ declare const tableInputSchema: StrictObjectSchema< {
|
|
|
1326
1432
|
readonly board: OptionalSchema<StrictObjectSchema< {
|
|
1327
1433
|
readonly round: OptionalSchema<PicklistSchema<Round[], undefined>, "1w1">;
|
|
1328
1434
|
readonly sticks: OptionalSchema<StrictObjectSchema< {
|
|
1329
|
-
readonly reach: OptionalSchema<SchemaWithPipe<[NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1330
|
-
readonly dead: OptionalSchema<SchemaWithPipe<[NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1435
|
+
readonly reach: OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1436
|
+
readonly dead: OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1331
1437
|
}, undefined>, {
|
|
1332
1438
|
reach: number;
|
|
1333
1439
|
dead: number;
|
|
@@ -1381,6 +1487,22 @@ readonly score: 25000;
|
|
|
1381
1487
|
}>;
|
|
1382
1488
|
}, undefined>;
|
|
1383
1489
|
|
|
1490
|
+
declare class Text_2 extends Mark {
|
|
1491
|
+
attrs: Attrs & {
|
|
1492
|
+
fontFamily?: string;
|
|
1493
|
+
fontSize?: number;
|
|
1494
|
+
};
|
|
1495
|
+
private _text;
|
|
1496
|
+
constructor(text?: string);
|
|
1497
|
+
plain(text: string): this;
|
|
1498
|
+
font(font: {
|
|
1499
|
+
family: string;
|
|
1500
|
+
size: number;
|
|
1501
|
+
}): this;
|
|
1502
|
+
protected center(): string;
|
|
1503
|
+
}
|
|
1504
|
+
export { Text_2 as Text }
|
|
1505
|
+
|
|
1384
1506
|
export declare class Tile {
|
|
1385
1507
|
readonly t: Type;
|
|
1386
1508
|
readonly n: number;
|
|
@@ -1431,6 +1553,15 @@ export declare const TYPE: {
|
|
|
1431
1553
|
|
|
1432
1554
|
export declare type Type = (typeof TYPE)[keyof typeof TYPE];
|
|
1433
1555
|
|
|
1556
|
+
export declare class Use extends Mark {
|
|
1557
|
+
attrs: Attrs & {
|
|
1558
|
+
href?: string;
|
|
1559
|
+
};
|
|
1560
|
+
constructor(id?: string);
|
|
1561
|
+
use(id: string): this;
|
|
1562
|
+
private make;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1434
1565
|
export declare class Wall {
|
|
1435
1566
|
private walls;
|
|
1436
1567
|
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;
|
|
@@ -178,6 +183,7 @@ export declare class BlockRun extends Block {
|
|
|
178
183
|
export declare class BlockShoKan extends Block {
|
|
179
184
|
constructor(tiles: readonly Tile[]);
|
|
180
185
|
static from(s: string): BlockShoKan;
|
|
186
|
+
static fromPon(b: BlockPon, t: Tile): BlockShoKan;
|
|
181
187
|
toString(): string;
|
|
182
188
|
}
|
|
183
189
|
|
|
@@ -288,7 +294,7 @@ export declare class Controller {
|
|
|
288
294
|
oneShotMap: { [key in Wind]: boolean; };
|
|
289
295
|
missingMap: { [key in Wind]: boolean; };
|
|
290
296
|
controller: Controller;
|
|
291
|
-
genEventID: ReturnType<
|
|
297
|
+
genEventID: ReturnType<incrementalIDGenerator_2>;
|
|
292
298
|
}, {
|
|
293
299
|
type: "";
|
|
294
300
|
} | {
|
|
@@ -856,6 +862,19 @@ export declare function forHand(options?: {
|
|
|
856
862
|
filterBy?: Type[];
|
|
857
863
|
}): Generator<readonly ["m" | "p" | "s" | "z" | "_", number], void, unknown>;
|
|
858
864
|
|
|
865
|
+
export declare class G extends Mark {
|
|
866
|
+
children: Mark[];
|
|
867
|
+
private rotateMatrix;
|
|
868
|
+
private translateMatrix;
|
|
869
|
+
constructor();
|
|
870
|
+
add(e: Mark): this;
|
|
871
|
+
rotate(angle: number, cx: number, cy: number): this;
|
|
872
|
+
translate(x: number, y: number): this;
|
|
873
|
+
protected center(): string;
|
|
874
|
+
protected left(...v: string[]): string;
|
|
875
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
876
|
+
}
|
|
877
|
+
|
|
859
878
|
export declare class Hand {
|
|
860
879
|
protected data: HandData;
|
|
861
880
|
constructor(input: string | Block[], allowBackBlock?: boolean);
|
|
@@ -915,6 +934,15 @@ declare interface History_2 {
|
|
|
915
934
|
}
|
|
916
935
|
export { History_2 as History }
|
|
917
936
|
|
|
937
|
+
declare class Image_2 extends Mark {
|
|
938
|
+
attrs: Attrs & {
|
|
939
|
+
href?: string;
|
|
940
|
+
};
|
|
941
|
+
constructor(url?: string);
|
|
942
|
+
load(url: string): this;
|
|
943
|
+
}
|
|
944
|
+
export { Image_2 as Image }
|
|
945
|
+
|
|
918
946
|
export declare class ImageHelper extends BaseHelper {
|
|
919
947
|
readonly blockMargin: number;
|
|
920
948
|
createBlockHandDiscard(block: Block): G;
|
|
@@ -923,7 +951,6 @@ export declare class ImageHelper extends BaseHelper {
|
|
|
923
951
|
|
|
924
952
|
export declare interface ImageHelperConfig {
|
|
925
953
|
scale?: number;
|
|
926
|
-
imageHostPath?: string;
|
|
927
954
|
imageHostUrl?: string;
|
|
928
955
|
imageExt?: "svg" | "webp";
|
|
929
956
|
svgSprite?: boolean;
|
|
@@ -968,6 +995,28 @@ export declare interface IWall {
|
|
|
968
995
|
};
|
|
969
996
|
}
|
|
970
997
|
|
|
998
|
+
export declare abstract class Mark {
|
|
999
|
+
type: string;
|
|
1000
|
+
attrs: Attrs;
|
|
1001
|
+
styles: Styles;
|
|
1002
|
+
private deleteMarker;
|
|
1003
|
+
constructor(type: string);
|
|
1004
|
+
dx(x: number): this;
|
|
1005
|
+
dy(y: number): this;
|
|
1006
|
+
x(x: number): this;
|
|
1007
|
+
y(y: number): this;
|
|
1008
|
+
size(width: number, height: number): this;
|
|
1009
|
+
remove(): void;
|
|
1010
|
+
protected left(...v: string[]): string;
|
|
1011
|
+
protected right(): string;
|
|
1012
|
+
protected center(): string;
|
|
1013
|
+
toString(): string;
|
|
1014
|
+
attr(attrs: Record<string, string>): this;
|
|
1015
|
+
attr(key: string): string;
|
|
1016
|
+
css(style: Record<string, string>): this;
|
|
1017
|
+
svg(): string;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
971
1020
|
export declare class MeasureText {
|
|
972
1021
|
ctx: CanvasRenderingContext2D | null;
|
|
973
1022
|
strText: string;
|
|
@@ -978,6 +1027,18 @@ export declare class MeasureText {
|
|
|
978
1027
|
measureTableFontContext: (tableScale: number) => FontContext;
|
|
979
1028
|
}
|
|
980
1029
|
|
|
1030
|
+
export declare const MyG: typeof G;
|
|
1031
|
+
|
|
1032
|
+
export declare const MyImage: typeof Image_2;
|
|
1033
|
+
|
|
1034
|
+
export declare const MyRect: typeof Rect;
|
|
1035
|
+
|
|
1036
|
+
export declare const MySVG: typeof SVG;
|
|
1037
|
+
|
|
1038
|
+
export declare const MyText: typeof Text_2;
|
|
1039
|
+
|
|
1040
|
+
export declare const MyUse: typeof Use;
|
|
1041
|
+
|
|
981
1042
|
export declare const N19: readonly number[];
|
|
982
1043
|
|
|
983
1044
|
export declare interface NewDoraEvent {
|
|
@@ -1002,7 +1063,7 @@ export declare class Observer extends BaseActor {
|
|
|
1002
1063
|
handleEvent(e: PlayerEvent): void;
|
|
1003
1064
|
}
|
|
1004
1065
|
|
|
1005
|
-
export declare const
|
|
1066
|
+
export declare const OP: {
|
|
1006
1067
|
readonly TSUMO: "t";
|
|
1007
1068
|
readonly RON: "v";
|
|
1008
1069
|
readonly DORA: "d";
|
|
@@ -1011,7 +1072,7 @@ export declare const OPERATOR: {
|
|
|
1011
1072
|
readonly COLOR_GRAYSCALE: "^";
|
|
1012
1073
|
};
|
|
1013
1074
|
|
|
1014
|
-
declare type Operator = (typeof
|
|
1075
|
+
declare type Operator = (typeof OP)[keyof typeof OP];
|
|
1015
1076
|
|
|
1016
1077
|
export declare const optimizeSVG: (draw: Svg) => void;
|
|
1017
1078
|
|
|
@@ -1033,35 +1094,35 @@ export declare class Parser {
|
|
|
1033
1094
|
}
|
|
1034
1095
|
|
|
1035
1096
|
export declare const parseTableInput: (s: string) => {
|
|
1097
|
+
board: {
|
|
1098
|
+
round: "1w1" | "1w2" | "1w3" | "1w4" | "2w1" | "2w2" | "2w3" | "2w4" | "3w1" | "3w2" | "3w3" | "3w4" | "4w1" | "4w2" | "4w3" | "4w4";
|
|
1099
|
+
sticks: {
|
|
1100
|
+
reach: number;
|
|
1101
|
+
dead: number;
|
|
1102
|
+
};
|
|
1103
|
+
doras: string;
|
|
1104
|
+
front: "1w" | "2w" | "3w" | "4w";
|
|
1105
|
+
};
|
|
1036
1106
|
"1w": {
|
|
1037
|
-
hand: string;
|
|
1038
1107
|
discard: string;
|
|
1108
|
+
hand: string;
|
|
1039
1109
|
score: number;
|
|
1040
1110
|
};
|
|
1041
1111
|
"2w": {
|
|
1042
|
-
hand: string;
|
|
1043
1112
|
discard: string;
|
|
1113
|
+
hand: string;
|
|
1044
1114
|
score: number;
|
|
1045
1115
|
};
|
|
1046
1116
|
"3w": {
|
|
1047
|
-
hand: string;
|
|
1048
1117
|
discard: string;
|
|
1118
|
+
hand: string;
|
|
1049
1119
|
score: number;
|
|
1050
1120
|
};
|
|
1051
1121
|
"4w": {
|
|
1052
|
-
hand: string;
|
|
1053
1122
|
discard: string;
|
|
1123
|
+
hand: string;
|
|
1054
1124
|
score: number;
|
|
1055
1125
|
};
|
|
1056
|
-
board: {
|
|
1057
|
-
round: Round;
|
|
1058
|
-
sticks: {
|
|
1059
|
-
reach: number;
|
|
1060
|
-
dead: number;
|
|
1061
|
-
};
|
|
1062
|
-
doras: string;
|
|
1063
|
-
front: Wind;
|
|
1064
|
-
};
|
|
1065
1126
|
};
|
|
1066
1127
|
|
|
1067
1128
|
export declare class PlaceManager {
|
|
@@ -1099,7 +1160,7 @@ export declare class Player extends BaseActor {
|
|
|
1099
1160
|
river: River;
|
|
1100
1161
|
doras: Tile[];
|
|
1101
1162
|
constructor(playerID: string, eventHandler: EventHandler);
|
|
1102
|
-
get myWind():
|
|
1163
|
+
get myWind(): Wind_2;
|
|
1103
1164
|
setHands(e: DistributeEvent): void;
|
|
1104
1165
|
handleDiscard(tiles: Tile[]): Tile;
|
|
1105
1166
|
handleEvent(e: PlayerEvent): void;
|
|
@@ -1160,6 +1221,16 @@ export declare interface ReachEvent {
|
|
|
1160
1221
|
wind: Wind;
|
|
1161
1222
|
}
|
|
1162
1223
|
|
|
1224
|
+
export declare class Rect extends Mark {
|
|
1225
|
+
attrs: Attrs & {
|
|
1226
|
+
stroke?: string;
|
|
1227
|
+
fill?: string;
|
|
1228
|
+
};
|
|
1229
|
+
constructor();
|
|
1230
|
+
fill(color: string): this;
|
|
1231
|
+
stroke(color: string): this;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1163
1234
|
export declare class Replayer {
|
|
1164
1235
|
index: number;
|
|
1165
1236
|
histories: History_2[];
|
|
@@ -1307,7 +1378,7 @@ export declare class ShantenCalculator {
|
|
|
1307
1378
|
sevenPairs(): number;
|
|
1308
1379
|
thirteenOrphans(): number;
|
|
1309
1380
|
fourSetsOnePair(): number;
|
|
1310
|
-
private
|
|
1381
|
+
private patternNumType;
|
|
1311
1382
|
private groupRemainingTiles;
|
|
1312
1383
|
private calcCommon;
|
|
1313
1384
|
}
|
|
@@ -1316,6 +1387,41 @@ export declare function shuffle<T>(array: T[]): T[];
|
|
|
1316
1387
|
|
|
1317
1388
|
export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
|
|
1318
1389
|
|
|
1390
|
+
export declare const STICK_CONTEXT: {
|
|
1391
|
+
readonly WIDTH: 125;
|
|
1392
|
+
readonly HEIGHT: 27.5;
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
export declare type Styles = {
|
|
1396
|
+
[key: string]: string;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
export declare function SVG(): Svg;
|
|
1400
|
+
|
|
1401
|
+
export declare class Svg extends Mark {
|
|
1402
|
+
children: Mark[];
|
|
1403
|
+
constructor();
|
|
1404
|
+
private viewBox;
|
|
1405
|
+
add(e: Mark): this;
|
|
1406
|
+
protected center(): string;
|
|
1407
|
+
protected left(...v: string[]): string;
|
|
1408
|
+
viewbox(x: number, y: number, width: number, height: number): this;
|
|
1409
|
+
importSymbol(input: string): this;
|
|
1410
|
+
x(x: number): this;
|
|
1411
|
+
y(y: number): this;
|
|
1412
|
+
dx(x: number): this;
|
|
1413
|
+
dy(y: number): this;
|
|
1414
|
+
each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
declare class Symbol_2 extends Mark {
|
|
1418
|
+
private raw;
|
|
1419
|
+
constructor(value: string);
|
|
1420
|
+
id(): string;
|
|
1421
|
+
protected center(): string;
|
|
1422
|
+
}
|
|
1423
|
+
export { Symbol_2 as Symbol }
|
|
1424
|
+
|
|
1319
1425
|
export declare const TABLE_CONTEXT: {
|
|
1320
1426
|
readonly BASE: 40;
|
|
1321
1427
|
};
|
|
@@ -1326,8 +1432,8 @@ declare const tableInputSchema: StrictObjectSchema< {
|
|
|
1326
1432
|
readonly board: OptionalSchema<StrictObjectSchema< {
|
|
1327
1433
|
readonly round: OptionalSchema<PicklistSchema<Round[], undefined>, "1w1">;
|
|
1328
1434
|
readonly sticks: OptionalSchema<StrictObjectSchema< {
|
|
1329
|
-
readonly reach: OptionalSchema<SchemaWithPipe<[NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1330
|
-
readonly dead: OptionalSchema<SchemaWithPipe<[NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1435
|
+
readonly reach: OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1436
|
+
readonly dead: OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>, MinValueAction<number, 0, "">, MaxValueAction<number, 9, "">]>, number>;
|
|
1331
1437
|
}, undefined>, {
|
|
1332
1438
|
reach: number;
|
|
1333
1439
|
dead: number;
|
|
@@ -1381,6 +1487,22 @@ readonly score: 25000;
|
|
|
1381
1487
|
}>;
|
|
1382
1488
|
}, undefined>;
|
|
1383
1489
|
|
|
1490
|
+
declare class Text_2 extends Mark {
|
|
1491
|
+
attrs: Attrs & {
|
|
1492
|
+
fontFamily?: string;
|
|
1493
|
+
fontSize?: number;
|
|
1494
|
+
};
|
|
1495
|
+
private _text;
|
|
1496
|
+
constructor(text?: string);
|
|
1497
|
+
plain(text: string): this;
|
|
1498
|
+
font(font: {
|
|
1499
|
+
family: string;
|
|
1500
|
+
size: number;
|
|
1501
|
+
}): this;
|
|
1502
|
+
protected center(): string;
|
|
1503
|
+
}
|
|
1504
|
+
export { Text_2 as Text }
|
|
1505
|
+
|
|
1384
1506
|
export declare class Tile {
|
|
1385
1507
|
readonly t: Type;
|
|
1386
1508
|
readonly n: number;
|
|
@@ -1431,6 +1553,15 @@ export declare const TYPE: {
|
|
|
1431
1553
|
|
|
1432
1554
|
export declare type Type = (typeof TYPE)[keyof typeof TYPE];
|
|
1433
1555
|
|
|
1556
|
+
export declare class Use extends Mark {
|
|
1557
|
+
attrs: Attrs & {
|
|
1558
|
+
href?: string;
|
|
1559
|
+
};
|
|
1560
|
+
constructor(id?: string);
|
|
1561
|
+
use(id: string): this;
|
|
1562
|
+
private make;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1434
1565
|
export declare class Wall {
|
|
1435
1566
|
private walls;
|
|
1436
1567
|
private backup;
|