@tachybase/plugin-demos-game-runesweeper 0.23.8
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/.turbo/turbo-build.log +14 -0
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/RunesweeperBlockInitializer.d.ts +2 -0
- package/dist/client/RunesweeperSchemaToolbar.d.ts +5 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +3 -0
- package/dist/client/runesweeper/Runesweeper.d.ts +2 -0
- package/dist/client/runesweeper/components/aboutModal/AboutModal.d.ts +5 -0
- package/dist/client/runesweeper/components/header/Header.d.ts +2 -0
- package/dist/client/runesweeper/components/instaloseToast/InstaloseToast.d.ts +4 -0
- package/dist/client/runesweeper/components/mineCounter/MineCounter.d.ts +2 -0
- package/dist/client/runesweeper/components/recordModal/RecordModal.d.ts +7 -0
- package/dist/client/runesweeper/components/settingsModal/SettingsModal.d.ts +5 -0
- package/dist/client/runesweeper/components/tile/PregameTile.d.ts +4 -0
- package/dist/client/runesweeper/components/tile/Tile.d.ts +16 -0
- package/dist/client/runesweeper/components/timer/Timer.d.ts +2 -0
- package/dist/client/runesweeper/hooks/useGameStateContext.d.ts +17 -0
- package/dist/client/runesweeper/hooks/useSettingsContext.d.ts +22 -0
- package/dist/client/runesweeper/utils/chord.d.ts +6 -0
- package/dist/client/runesweeper/utils/floodFill.d.ts +6 -0
- package/dist/client/runesweeper/utils/generateTiles.d.ts +2 -0
- package/dist/client/runesweeper/utils/settings.d.ts +13 -0
- package/dist/externalVersion.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +45 -0
- package/package.json +18 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type FlagStatus = 'flagged' | 'maybe' | 'unflagged';
|
|
3
|
+
export interface TileType {
|
|
4
|
+
isMine: boolean;
|
|
5
|
+
minesAround: number;
|
|
6
|
+
swept: boolean;
|
|
7
|
+
id: number;
|
|
8
|
+
c: number;
|
|
9
|
+
r: number;
|
|
10
|
+
flagStatus: FlagStatus;
|
|
11
|
+
}
|
|
12
|
+
interface TileProps {
|
|
13
|
+
tile: TileType;
|
|
14
|
+
}
|
|
15
|
+
export default function Tile({ tile }: TileProps): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
import { TileType } from '../components/tile/Tile';
|
|
3
|
+
export type Status = 'pre' | 'during' | 'won' | 'lost';
|
|
4
|
+
export interface GameState {
|
|
5
|
+
tiles: TileType[];
|
|
6
|
+
status: Status;
|
|
7
|
+
}
|
|
8
|
+
interface GameStateContextType {
|
|
9
|
+
gameState: GameState;
|
|
10
|
+
setGameState: Dispatch<SetStateAction<GameState>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const GameStateContext: import("react").Context<GameStateContextType>;
|
|
13
|
+
export declare function useGameStateContext(): {
|
|
14
|
+
gameState: GameState;
|
|
15
|
+
setGameState: Dispatch<SetStateAction<GameState>>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
export interface Settings {
|
|
3
|
+
mineRatio: number;
|
|
4
|
+
numOfRows: number;
|
|
5
|
+
numOfColumns: number;
|
|
6
|
+
swipeToFlag: boolean;
|
|
7
|
+
swipeToChord: boolean;
|
|
8
|
+
allowMaybe: boolean;
|
|
9
|
+
instalose: boolean;
|
|
10
|
+
isLandscape: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface SettingsContextType {
|
|
13
|
+
settings: Settings;
|
|
14
|
+
setSettings: Dispatch<SetStateAction<Settings>>;
|
|
15
|
+
}
|
|
16
|
+
export declare const defaultSettings: Settings;
|
|
17
|
+
export declare const SettingsContext: import("react").Context<SettingsContextType>;
|
|
18
|
+
export declare function useSettingsContext(): {
|
|
19
|
+
settings: Settings;
|
|
20
|
+
setSettings: Dispatch<SetStateAction<Settings>>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TileType } from '../components/tile/Tile';
|
|
2
|
+
import type { GameState } from '../hooks/useGameStateContext';
|
|
3
|
+
/**
|
|
4
|
+
* {@link https://en.wikipedia.org/wiki/Chording#Minesweeper_tactic | Chording} is the feature of sweeping all neighbouring tiles when the appropriate number of neighbouring tiles have been flagged.
|
|
5
|
+
*/
|
|
6
|
+
export default function chord(triggerTile: TileType, gameState: GameState): GameState;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Settings } from '../hooks/useSettingsContext';
|
|
2
|
+
export declare const sizesDict: Record<string, {
|
|
3
|
+
label: string;
|
|
4
|
+
w: number;
|
|
5
|
+
h: number;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const difficultiesDict: Record<string, {
|
|
8
|
+
label: string;
|
|
9
|
+
mineRatio: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const controlsDict: Partial<Record<keyof Settings, {
|
|
12
|
+
label: string;
|
|
13
|
+
}>>;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./server")
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => import_plugin.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(server_exports);
|
|
33
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from '@tachybase/server';
|
|
2
|
+
export declare class PluginDemosGameRunesweeperServer extends Plugin {
|
|
3
|
+
afterAdd(): Promise<void>;
|
|
4
|
+
beforeLoad(): Promise<void>;
|
|
5
|
+
load(): Promise<void>;
|
|
6
|
+
install(): Promise<void>;
|
|
7
|
+
afterEnable(): Promise<void>;
|
|
8
|
+
afterDisable(): Promise<void>;
|
|
9
|
+
remove(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export default PluginDemosGameRunesweeperServer;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var plugin_exports = {};
|
|
19
|
+
__export(plugin_exports, {
|
|
20
|
+
PluginDemosGameRunesweeperServer: () => PluginDemosGameRunesweeperServer,
|
|
21
|
+
default: () => plugin_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
+
var import_server = require("@tachybase/server");
|
|
25
|
+
class PluginDemosGameRunesweeperServer extends import_server.Plugin {
|
|
26
|
+
async afterAdd() {
|
|
27
|
+
}
|
|
28
|
+
async beforeLoad() {
|
|
29
|
+
}
|
|
30
|
+
async load() {
|
|
31
|
+
}
|
|
32
|
+
async install() {
|
|
33
|
+
}
|
|
34
|
+
async afterEnable() {
|
|
35
|
+
}
|
|
36
|
+
async afterDisable() {
|
|
37
|
+
}
|
|
38
|
+
async remove() {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var plugin_default = PluginDemosGameRunesweeperServer;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
PluginDemosGameRunesweeperServer
|
|
45
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/plugin-demos-game-runesweeper",
|
|
3
|
+
"version": "0.23.8",
|
|
4
|
+
"main": "dist/server/index.js",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"canvas-confetti": "^1.9.3",
|
|
7
|
+
"react": "18.3.1",
|
|
8
|
+
"react-swipeable": "^7.0.2"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"@tachybase/client": "0.23.8",
|
|
12
|
+
"@tachybase/server": "0.23.8",
|
|
13
|
+
"@tachybase/test": "0.23.8"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tachybase-build --no-dts @tachybase/plugin-demos-game-runesweeper"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|