packing-bingo 0.5.0 → 0.6.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 +111 -25
- package/dist/{chunk-ZPZZDZUH.js → chunk-A5JVNVWS.js} +654 -115
- package/dist/core.cjs +658 -117
- package/dist/core.d.cts +134 -6
- package/dist/core.d.ts +134 -6
- package/dist/core.js +7 -3
- package/dist/index.cjs +675 -123
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +24 -9
- package/dist/packing-bingo.global.js +119 -41
- package/package.json +1 -1
package/dist/core.d.cts
CHANGED
|
@@ -35,13 +35,55 @@ interface Messages {
|
|
|
35
35
|
shuffle: string;
|
|
36
36
|
soundOn: string;
|
|
37
37
|
soundOff: string;
|
|
38
|
-
/**
|
|
38
|
+
/** The big line on the gray start screen over the card (with the `ready` option). */
|
|
39
|
+
readyTitle?: string;
|
|
40
|
+
/** A line under it; empty (not shown) by default. */
|
|
41
|
+
readyPrompt?: string;
|
|
42
|
+
/** Volume reminder on the start screen; an empty string hides it. */
|
|
39
43
|
soundHint?: string;
|
|
40
44
|
/** Android Do Not Disturb reminder; hidden when vibration is disabled or this is empty. */
|
|
41
45
|
vibrationHint?: string;
|
|
42
|
-
/**
|
|
46
|
+
/** The "tap to start" cue on the start screen. */
|
|
47
|
+
readyTap?: string;
|
|
48
|
+
/** Shown after the 3, 2, 1 countdown, as the stopwatch starts. */
|
|
49
|
+
readyGo?: string;
|
|
50
|
+
/** Label of the stopwatch, read out by screen readers. */
|
|
51
|
+
time?: string;
|
|
52
|
+
/** Before the finishing time on the perfect card. */
|
|
53
|
+
statTime?: string;
|
|
54
|
+
/** Floats up with the points for the clear time (`speedBonus`). */
|
|
55
|
+
speedBonus?: (points: number) => string;
|
|
56
|
+
/** Label of the mode switch, read out by screen readers. */
|
|
57
|
+
modeLabel?: string;
|
|
58
|
+
/** The mode switch's choice for the normal card. */
|
|
59
|
+
modeNormal?: string;
|
|
60
|
+
/** The mode switch's choice for the infinite mode. */
|
|
61
|
+
modeInfinite?: string;
|
|
62
|
+
/** The big word that sweeps over the card when the normal mode is chosen. */
|
|
63
|
+
normalTitle?: string;
|
|
64
|
+
/** The line under it. */
|
|
65
|
+
normalSub?: string;
|
|
66
|
+
/** The big word that sweeps over the card when the infinite mode is chosen. */
|
|
67
|
+
infiniteTitle?: string;
|
|
68
|
+
/** The line under it, also shown in the start screen's badge in the infinite mode. */
|
|
69
|
+
infiniteSub?: string;
|
|
70
|
+
/** The rule, shown on the start screen in the infinite mode; an empty string hides it. */
|
|
71
|
+
infiniteRule?: string;
|
|
72
|
+
/** The button that ends an infinite game and shows its results. */
|
|
73
|
+
finish?: string;
|
|
74
|
+
/** Title of the infinite game's results. */
|
|
75
|
+
finishTitle?: string;
|
|
76
|
+
/** Text inside the round medal on those results; `\n` starts a new line. */
|
|
77
|
+
finishStamp?: string;
|
|
78
|
+
/** Before the time played on those results. */
|
|
79
|
+
finishTime?: string;
|
|
80
|
+
/** The results' button that starts a new infinite game. */
|
|
81
|
+
again?: string;
|
|
82
|
+
/** @deprecated Ignored since 0.6.0: the pre-play popup became the start screen (see `readyTitle`). */
|
|
43
83
|
playTitle?: string;
|
|
84
|
+
/** @deprecated Ignored since 0.6.0. */
|
|
44
85
|
playStart?: string;
|
|
86
|
+
/** @deprecated Ignored since 0.6.0. */
|
|
45
87
|
playSkip?: string;
|
|
46
88
|
stamp: string;
|
|
47
89
|
/** Text on the FREE square in the center (with `free`). */
|
|
@@ -85,14 +127,37 @@ declare const en: Messages;
|
|
|
85
127
|
* For other sizes, use `bingoLines(size, free)`.
|
|
86
128
|
*/
|
|
87
129
|
declare const LINES: readonly (readonly number[])[];
|
|
130
|
+
/**
|
|
131
|
+
* "normal": the packing card. "infinite": an endless game on the same squares; completed lines
|
|
132
|
+
* clear so they can be filled again. It never touches the packing checks.
|
|
133
|
+
*/
|
|
134
|
+
type BingoMode = "normal" | "infinite";
|
|
88
135
|
interface PackingBingoState {
|
|
89
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* One boolean per item, row by row (the FREE square is not included). In the infinite mode,
|
|
138
|
+
* the squares of that game, not the packing checks.
|
|
139
|
+
*/
|
|
90
140
|
checked: boolean[];
|
|
91
141
|
/** The completed lines, as indices into `bingoLines(size, free)`. */
|
|
92
142
|
lines: number[];
|
|
93
143
|
score: number;
|
|
94
144
|
maxCombo: number;
|
|
145
|
+
/** Every item is checked (always false in the infinite mode). */
|
|
95
146
|
complete: boolean;
|
|
147
|
+
/** The mode on the card. */
|
|
148
|
+
mode: BingoMode;
|
|
149
|
+
/** Lines completed in this infinite game (each one clears); 0 in the normal mode. */
|
|
150
|
+
cleared: number;
|
|
151
|
+
/** The infinite game was ended with FINISH (its squares are locked until a new game). */
|
|
152
|
+
finished: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* In the infinite mode, the packing card waiting behind the game: its checks and arrangement,
|
|
155
|
+
* as they will be when the card switches back. Null in the normal mode.
|
|
156
|
+
*/
|
|
157
|
+
packing: {
|
|
158
|
+
checked: boolean[];
|
|
159
|
+
order: number[];
|
|
160
|
+
} | null;
|
|
96
161
|
/** Squares per side. */
|
|
97
162
|
size: number;
|
|
98
163
|
/** Whether the center is a FREE square. */
|
|
@@ -102,16 +167,34 @@ interface PackingBingoState {
|
|
|
102
167
|
* is shuffled. Line `k` holds the items `bingoLines(size, free)[k].map((s) => order[s])`.
|
|
103
168
|
*/
|
|
104
169
|
order: number[];
|
|
170
|
+
/** The stopwatch in milliseconds: running since the countdown (or the first tap), frozen once the card is complete. */
|
|
171
|
+
time: number;
|
|
105
172
|
}
|
|
106
173
|
interface BingoEvent {
|
|
107
174
|
/** Lines (indices into `bingoLines(size, free)`, which is LINES for 4×4) completed by this change. */
|
|
108
175
|
newLines: number[];
|
|
176
|
+
/** Lines complete on the card; in the infinite mode, lines completed in this game. */
|
|
109
177
|
totalLines: number;
|
|
110
178
|
score: number;
|
|
179
|
+
/** The mode it happened in. */
|
|
180
|
+
mode: BingoMode;
|
|
111
181
|
}
|
|
112
182
|
interface PerfectEvent {
|
|
113
183
|
score: number;
|
|
114
184
|
maxCombo: number;
|
|
185
|
+
/** The stopwatch when the card was completed, in milliseconds; null if this game was not timed. */
|
|
186
|
+
time: number | null;
|
|
187
|
+
/** Points `score` got for the clear time (see `speedBonus`); 0 if none were given. */
|
|
188
|
+
speedBonus: number;
|
|
189
|
+
}
|
|
190
|
+
/** An infinite game ended with FINISH. */
|
|
191
|
+
interface FinishEvent {
|
|
192
|
+
score: number;
|
|
193
|
+
maxCombo: number;
|
|
194
|
+
/** Lines completed in the game. */
|
|
195
|
+
lines: number;
|
|
196
|
+
/** The stopwatch when it ended, in milliseconds. */
|
|
197
|
+
time: number;
|
|
115
198
|
}
|
|
116
199
|
interface PackingBingoOptions {
|
|
117
200
|
/**
|
|
@@ -171,11 +254,36 @@ interface PackingBingoOptions {
|
|
|
171
254
|
* M PLUS Rounded 1c, load them on the page (see the README's フォント section).
|
|
172
255
|
*/
|
|
173
256
|
fonts?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Start each game on a see-through dark screen over the whole card ("Are you ready?" with the
|
|
259
|
+
* volume and Do Not Disturb reminders); a tap counts down 3, 2, 1 and starts the stopwatch
|
|
260
|
+
* (default true). With false, the stopwatch starts on the first tap.
|
|
261
|
+
*/
|
|
262
|
+
ready?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Let a tap on a stamped square take the stamp off again (default false). By default a
|
|
265
|
+
* stamped square stays stamped when tapped; `reset()`, `setChecked` and controlled `checked`
|
|
266
|
+
* can still clear it.
|
|
267
|
+
*/
|
|
268
|
+
uncheck?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* The mode to start in (default "normal"). "infinite" is an endless game on the same squares:
|
|
271
|
+
* every completed line clears after its celebration, so it can be filled again, and the
|
|
272
|
+
* score keeps growing. It neither changes nor saves the packing checks, and calls no
|
|
273
|
+
* `onChange`; switching back to "normal" brings the packing card back as it was.
|
|
274
|
+
*/
|
|
275
|
+
mode?: BingoMode;
|
|
276
|
+
/** Show the NORMAL / ∞ INFINITE switch in the header (default true). */
|
|
277
|
+
modeSwitch?: boolean;
|
|
174
278
|
/** Pre-fill a few items and show demo buttons. */
|
|
175
279
|
demo?: boolean;
|
|
176
280
|
onChange?: (checked: boolean[]) => void;
|
|
177
281
|
onBingo?: (event: BingoEvent) => void;
|
|
178
282
|
onPerfect?: (event: PerfectEvent) => void;
|
|
283
|
+
/** The mode was changed, with the switch or `setMode`. */
|
|
284
|
+
onModeChange?: (mode: BingoMode) => void;
|
|
285
|
+
/** An infinite game was ended with the 🏁 FINISH button or `finish()`. */
|
|
286
|
+
onFinish?: (event: FinishEvent) => void;
|
|
179
287
|
}
|
|
180
288
|
interface PackingBingoInstance {
|
|
181
289
|
/**
|
|
@@ -185,21 +293,41 @@ interface PackingBingoInstance {
|
|
|
185
293
|
setChecked(next: readonly boolean[], options?: {
|
|
186
294
|
animate?: boolean;
|
|
187
295
|
}): void;
|
|
188
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* Clear the card and score (calls onChange), and put the items back in their own squares.
|
|
298
|
+
* In the infinite mode, like the reset button, it starts a new infinite game instead.
|
|
299
|
+
*/
|
|
189
300
|
reset(): void;
|
|
190
301
|
/**
|
|
191
302
|
* Move the items to random squares, as the 🔀 button does. Checks stay with their items; lines
|
|
192
303
|
* the new arrangement happens to complete count as done but earn no points.
|
|
193
304
|
*/
|
|
194
305
|
shuffle(): void;
|
|
306
|
+
/**
|
|
307
|
+
* Switch modes, as the switch does (with its animation). Each switch starts a new game: the
|
|
308
|
+
* stopwatch and score start over, and the packing checks and arrangement are kept.
|
|
309
|
+
*/
|
|
310
|
+
setMode(mode: BingoMode): void;
|
|
311
|
+
/**
|
|
312
|
+
* End a running infinite game, as the 🏁 FINISH button does: stop the stopwatch, lock the
|
|
313
|
+
* squares and show the results. Does nothing in the normal mode or before the game starts.
|
|
314
|
+
*/
|
|
315
|
+
finish(): void;
|
|
195
316
|
getState(): PackingBingoState;
|
|
196
317
|
/** Redraw the status text, e.g. after functions in `messages` start returning something else. */
|
|
197
318
|
refresh(): void;
|
|
198
319
|
/** Stop everything and remove the card from the container. */
|
|
199
320
|
destroy(): void;
|
|
200
321
|
}
|
|
322
|
+
/** Stopwatch text: 0:12.3 (or 1:02:03.4 past an hour); `digits` decimals of a second. */
|
|
323
|
+
declare function formatTime(ms: number, digits?: number): string;
|
|
324
|
+
/**
|
|
325
|
+
* Points for clearing a card of `items` items in `ms` milliseconds: 1000 per item per second,
|
|
326
|
+
* so it has no ceiling. Halving the time doubles it.
|
|
327
|
+
*/
|
|
328
|
+
declare function speedBonus(items: number, ms: number): number;
|
|
201
329
|
/** Render a packing bingo card into `container`. Call only in the browser. */
|
|
202
330
|
declare function createPackingBingo(container: HTMLElement, options?: PackingBingoOptions): PackingBingoInstance;
|
|
203
331
|
|
|
204
|
-
export { DEFAULT_ITEMS, LINES, bingoLines, createPackingBingo, en, ja };
|
|
205
|
-
export type { BingoEvent, BingoItem, Messages, PackingBingoInstance, PackingBingoOptions, PackingBingoState, PerfectEvent };
|
|
332
|
+
export { DEFAULT_ITEMS, LINES, bingoLines, createPackingBingo, en, formatTime, ja, speedBonus };
|
|
333
|
+
export type { BingoEvent, BingoItem, BingoMode, FinishEvent, Messages, PackingBingoInstance, PackingBingoOptions, PackingBingoState, PerfectEvent };
|
package/dist/core.d.ts
CHANGED
|
@@ -35,13 +35,55 @@ interface Messages {
|
|
|
35
35
|
shuffle: string;
|
|
36
36
|
soundOn: string;
|
|
37
37
|
soundOff: string;
|
|
38
|
-
/**
|
|
38
|
+
/** The big line on the gray start screen over the card (with the `ready` option). */
|
|
39
|
+
readyTitle?: string;
|
|
40
|
+
/** A line under it; empty (not shown) by default. */
|
|
41
|
+
readyPrompt?: string;
|
|
42
|
+
/** Volume reminder on the start screen; an empty string hides it. */
|
|
39
43
|
soundHint?: string;
|
|
40
44
|
/** Android Do Not Disturb reminder; hidden when vibration is disabled or this is empty. */
|
|
41
45
|
vibrationHint?: string;
|
|
42
|
-
/**
|
|
46
|
+
/** The "tap to start" cue on the start screen. */
|
|
47
|
+
readyTap?: string;
|
|
48
|
+
/** Shown after the 3, 2, 1 countdown, as the stopwatch starts. */
|
|
49
|
+
readyGo?: string;
|
|
50
|
+
/** Label of the stopwatch, read out by screen readers. */
|
|
51
|
+
time?: string;
|
|
52
|
+
/** Before the finishing time on the perfect card. */
|
|
53
|
+
statTime?: string;
|
|
54
|
+
/** Floats up with the points for the clear time (`speedBonus`). */
|
|
55
|
+
speedBonus?: (points: number) => string;
|
|
56
|
+
/** Label of the mode switch, read out by screen readers. */
|
|
57
|
+
modeLabel?: string;
|
|
58
|
+
/** The mode switch's choice for the normal card. */
|
|
59
|
+
modeNormal?: string;
|
|
60
|
+
/** The mode switch's choice for the infinite mode. */
|
|
61
|
+
modeInfinite?: string;
|
|
62
|
+
/** The big word that sweeps over the card when the normal mode is chosen. */
|
|
63
|
+
normalTitle?: string;
|
|
64
|
+
/** The line under it. */
|
|
65
|
+
normalSub?: string;
|
|
66
|
+
/** The big word that sweeps over the card when the infinite mode is chosen. */
|
|
67
|
+
infiniteTitle?: string;
|
|
68
|
+
/** The line under it, also shown in the start screen's badge in the infinite mode. */
|
|
69
|
+
infiniteSub?: string;
|
|
70
|
+
/** The rule, shown on the start screen in the infinite mode; an empty string hides it. */
|
|
71
|
+
infiniteRule?: string;
|
|
72
|
+
/** The button that ends an infinite game and shows its results. */
|
|
73
|
+
finish?: string;
|
|
74
|
+
/** Title of the infinite game's results. */
|
|
75
|
+
finishTitle?: string;
|
|
76
|
+
/** Text inside the round medal on those results; `\n` starts a new line. */
|
|
77
|
+
finishStamp?: string;
|
|
78
|
+
/** Before the time played on those results. */
|
|
79
|
+
finishTime?: string;
|
|
80
|
+
/** The results' button that starts a new infinite game. */
|
|
81
|
+
again?: string;
|
|
82
|
+
/** @deprecated Ignored since 0.6.0: the pre-play popup became the start screen (see `readyTitle`). */
|
|
43
83
|
playTitle?: string;
|
|
84
|
+
/** @deprecated Ignored since 0.6.0. */
|
|
44
85
|
playStart?: string;
|
|
86
|
+
/** @deprecated Ignored since 0.6.0. */
|
|
45
87
|
playSkip?: string;
|
|
46
88
|
stamp: string;
|
|
47
89
|
/** Text on the FREE square in the center (with `free`). */
|
|
@@ -85,14 +127,37 @@ declare const en: Messages;
|
|
|
85
127
|
* For other sizes, use `bingoLines(size, free)`.
|
|
86
128
|
*/
|
|
87
129
|
declare const LINES: readonly (readonly number[])[];
|
|
130
|
+
/**
|
|
131
|
+
* "normal": the packing card. "infinite": an endless game on the same squares; completed lines
|
|
132
|
+
* clear so they can be filled again. It never touches the packing checks.
|
|
133
|
+
*/
|
|
134
|
+
type BingoMode = "normal" | "infinite";
|
|
88
135
|
interface PackingBingoState {
|
|
89
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* One boolean per item, row by row (the FREE square is not included). In the infinite mode,
|
|
138
|
+
* the squares of that game, not the packing checks.
|
|
139
|
+
*/
|
|
90
140
|
checked: boolean[];
|
|
91
141
|
/** The completed lines, as indices into `bingoLines(size, free)`. */
|
|
92
142
|
lines: number[];
|
|
93
143
|
score: number;
|
|
94
144
|
maxCombo: number;
|
|
145
|
+
/** Every item is checked (always false in the infinite mode). */
|
|
95
146
|
complete: boolean;
|
|
147
|
+
/** The mode on the card. */
|
|
148
|
+
mode: BingoMode;
|
|
149
|
+
/** Lines completed in this infinite game (each one clears); 0 in the normal mode. */
|
|
150
|
+
cleared: number;
|
|
151
|
+
/** The infinite game was ended with FINISH (its squares are locked until a new game). */
|
|
152
|
+
finished: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* In the infinite mode, the packing card waiting behind the game: its checks and arrangement,
|
|
155
|
+
* as they will be when the card switches back. Null in the normal mode.
|
|
156
|
+
*/
|
|
157
|
+
packing: {
|
|
158
|
+
checked: boolean[];
|
|
159
|
+
order: number[];
|
|
160
|
+
} | null;
|
|
96
161
|
/** Squares per side. */
|
|
97
162
|
size: number;
|
|
98
163
|
/** Whether the center is a FREE square. */
|
|
@@ -102,16 +167,34 @@ interface PackingBingoState {
|
|
|
102
167
|
* is shuffled. Line `k` holds the items `bingoLines(size, free)[k].map((s) => order[s])`.
|
|
103
168
|
*/
|
|
104
169
|
order: number[];
|
|
170
|
+
/** The stopwatch in milliseconds: running since the countdown (or the first tap), frozen once the card is complete. */
|
|
171
|
+
time: number;
|
|
105
172
|
}
|
|
106
173
|
interface BingoEvent {
|
|
107
174
|
/** Lines (indices into `bingoLines(size, free)`, which is LINES for 4×4) completed by this change. */
|
|
108
175
|
newLines: number[];
|
|
176
|
+
/** Lines complete on the card; in the infinite mode, lines completed in this game. */
|
|
109
177
|
totalLines: number;
|
|
110
178
|
score: number;
|
|
179
|
+
/** The mode it happened in. */
|
|
180
|
+
mode: BingoMode;
|
|
111
181
|
}
|
|
112
182
|
interface PerfectEvent {
|
|
113
183
|
score: number;
|
|
114
184
|
maxCombo: number;
|
|
185
|
+
/** The stopwatch when the card was completed, in milliseconds; null if this game was not timed. */
|
|
186
|
+
time: number | null;
|
|
187
|
+
/** Points `score` got for the clear time (see `speedBonus`); 0 if none were given. */
|
|
188
|
+
speedBonus: number;
|
|
189
|
+
}
|
|
190
|
+
/** An infinite game ended with FINISH. */
|
|
191
|
+
interface FinishEvent {
|
|
192
|
+
score: number;
|
|
193
|
+
maxCombo: number;
|
|
194
|
+
/** Lines completed in the game. */
|
|
195
|
+
lines: number;
|
|
196
|
+
/** The stopwatch when it ended, in milliseconds. */
|
|
197
|
+
time: number;
|
|
115
198
|
}
|
|
116
199
|
interface PackingBingoOptions {
|
|
117
200
|
/**
|
|
@@ -171,11 +254,36 @@ interface PackingBingoOptions {
|
|
|
171
254
|
* M PLUS Rounded 1c, load them on the page (see the README's フォント section).
|
|
172
255
|
*/
|
|
173
256
|
fonts?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Start each game on a see-through dark screen over the whole card ("Are you ready?" with the
|
|
259
|
+
* volume and Do Not Disturb reminders); a tap counts down 3, 2, 1 and starts the stopwatch
|
|
260
|
+
* (default true). With false, the stopwatch starts on the first tap.
|
|
261
|
+
*/
|
|
262
|
+
ready?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Let a tap on a stamped square take the stamp off again (default false). By default a
|
|
265
|
+
* stamped square stays stamped when tapped; `reset()`, `setChecked` and controlled `checked`
|
|
266
|
+
* can still clear it.
|
|
267
|
+
*/
|
|
268
|
+
uncheck?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* The mode to start in (default "normal"). "infinite" is an endless game on the same squares:
|
|
271
|
+
* every completed line clears after its celebration, so it can be filled again, and the
|
|
272
|
+
* score keeps growing. It neither changes nor saves the packing checks, and calls no
|
|
273
|
+
* `onChange`; switching back to "normal" brings the packing card back as it was.
|
|
274
|
+
*/
|
|
275
|
+
mode?: BingoMode;
|
|
276
|
+
/** Show the NORMAL / ∞ INFINITE switch in the header (default true). */
|
|
277
|
+
modeSwitch?: boolean;
|
|
174
278
|
/** Pre-fill a few items and show demo buttons. */
|
|
175
279
|
demo?: boolean;
|
|
176
280
|
onChange?: (checked: boolean[]) => void;
|
|
177
281
|
onBingo?: (event: BingoEvent) => void;
|
|
178
282
|
onPerfect?: (event: PerfectEvent) => void;
|
|
283
|
+
/** The mode was changed, with the switch or `setMode`. */
|
|
284
|
+
onModeChange?: (mode: BingoMode) => void;
|
|
285
|
+
/** An infinite game was ended with the 🏁 FINISH button or `finish()`. */
|
|
286
|
+
onFinish?: (event: FinishEvent) => void;
|
|
179
287
|
}
|
|
180
288
|
interface PackingBingoInstance {
|
|
181
289
|
/**
|
|
@@ -185,21 +293,41 @@ interface PackingBingoInstance {
|
|
|
185
293
|
setChecked(next: readonly boolean[], options?: {
|
|
186
294
|
animate?: boolean;
|
|
187
295
|
}): void;
|
|
188
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* Clear the card and score (calls onChange), and put the items back in their own squares.
|
|
298
|
+
* In the infinite mode, like the reset button, it starts a new infinite game instead.
|
|
299
|
+
*/
|
|
189
300
|
reset(): void;
|
|
190
301
|
/**
|
|
191
302
|
* Move the items to random squares, as the 🔀 button does. Checks stay with their items; lines
|
|
192
303
|
* the new arrangement happens to complete count as done but earn no points.
|
|
193
304
|
*/
|
|
194
305
|
shuffle(): void;
|
|
306
|
+
/**
|
|
307
|
+
* Switch modes, as the switch does (with its animation). Each switch starts a new game: the
|
|
308
|
+
* stopwatch and score start over, and the packing checks and arrangement are kept.
|
|
309
|
+
*/
|
|
310
|
+
setMode(mode: BingoMode): void;
|
|
311
|
+
/**
|
|
312
|
+
* End a running infinite game, as the 🏁 FINISH button does: stop the stopwatch, lock the
|
|
313
|
+
* squares and show the results. Does nothing in the normal mode or before the game starts.
|
|
314
|
+
*/
|
|
315
|
+
finish(): void;
|
|
195
316
|
getState(): PackingBingoState;
|
|
196
317
|
/** Redraw the status text, e.g. after functions in `messages` start returning something else. */
|
|
197
318
|
refresh(): void;
|
|
198
319
|
/** Stop everything and remove the card from the container. */
|
|
199
320
|
destroy(): void;
|
|
200
321
|
}
|
|
322
|
+
/** Stopwatch text: 0:12.3 (or 1:02:03.4 past an hour); `digits` decimals of a second. */
|
|
323
|
+
declare function formatTime(ms: number, digits?: number): string;
|
|
324
|
+
/**
|
|
325
|
+
* Points for clearing a card of `items` items in `ms` milliseconds: 1000 per item per second,
|
|
326
|
+
* so it has no ceiling. Halving the time doubles it.
|
|
327
|
+
*/
|
|
328
|
+
declare function speedBonus(items: number, ms: number): number;
|
|
201
329
|
/** Render a packing bingo card into `container`. Call only in the browser. */
|
|
202
330
|
declare function createPackingBingo(container: HTMLElement, options?: PackingBingoOptions): PackingBingoInstance;
|
|
203
331
|
|
|
204
|
-
export { DEFAULT_ITEMS, LINES, bingoLines, createPackingBingo, en, ja };
|
|
205
|
-
export type { BingoEvent, BingoItem, Messages, PackingBingoInstance, PackingBingoOptions, PackingBingoState, PerfectEvent };
|
|
332
|
+
export { DEFAULT_ITEMS, LINES, bingoLines, createPackingBingo, en, formatTime, ja, speedBonus };
|
|
333
|
+
export type { BingoEvent, BingoItem, BingoMode, FinishEvent, Messages, PackingBingoInstance, PackingBingoOptions, PackingBingoState, PerfectEvent };
|
package/dist/core.js
CHANGED
|
@@ -5,13 +5,17 @@ import {
|
|
|
5
5
|
bingoLines,
|
|
6
6
|
createPackingBingo,
|
|
7
7
|
en,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
formatTime,
|
|
9
|
+
ja,
|
|
10
|
+
speedBonus
|
|
11
|
+
} from "./chunk-A5JVNVWS.js";
|
|
10
12
|
export {
|
|
11
13
|
DEFAULT_ITEMS,
|
|
12
14
|
LINES,
|
|
13
15
|
bingoLines,
|
|
14
16
|
createPackingBingo,
|
|
15
17
|
en,
|
|
16
|
-
|
|
18
|
+
formatTime,
|
|
19
|
+
ja,
|
|
20
|
+
speedBonus
|
|
17
21
|
};
|