@putianyi888/vue3-minesweeper-board 0.1.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/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/components/BoardBackground.vue.d.ts +24 -0
- package/dist/components/BoardForeground.vue.d.ts +18 -0
- package/dist/components/Counter.vue.d.ts +56 -0
- package/dist/components/MinesweeperBoard.vue.d.ts +61 -0
- package/dist/components/context.d.ts +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/minesweeper-board.css +2 -0
- package/dist/minesweeper-board.js +367 -0
- package/dist/minesweeper-board.umd.cjs +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tianyi Pu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @putianyi888/vue3-minesweeper-board
|
|
2
|
+
|
|
3
|
+
Vue 3 component for rendering a Minesweeper board matrix using
|
|
4
|
+
`@putianyi888/vue3-plots`.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @putianyi888/vue3-minesweeper-board @putianyi888/vue3-plots vue
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import MinesweeperBoard from '@putianyi888/vue3-minesweeper-board'
|
|
17
|
+
|
|
18
|
+
const board = [
|
|
19
|
+
[10, 10, 10],
|
|
20
|
+
[1, 2, 1],
|
|
21
|
+
[0, 0, 0],
|
|
22
|
+
]
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<MinesweeperBoard :board="board" :size="24" />
|
|
27
|
+
</template>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`board` follows `ms_toollib` game board values. Unsupported values render as
|
|
31
|
+
an unopened background cell with a blank foreground.
|
|
32
|
+
|
|
33
|
+
You can also import the lower-level layers:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { BoardBackground, BoardForeground, Counter, MinesweeperBoard } from '@putianyi888/vue3-minesweeper-board'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<Counter :value="12.34" :fixed="2" :digits="3" :size="24" />
|
|
41
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
type CellIndex = {
|
|
3
|
+
rowIndex: number;
|
|
4
|
+
columnIndex: number;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
7
|
+
/** Background matrix. true renders a down cell, false renders an up cell. */
|
|
8
|
+
board: {
|
|
9
|
+
type: PropType<boolean[][]>;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
}>, {
|
|
13
|
+
cellIndex: import('vue').ComputedRef<CellIndex | undefined>;
|
|
14
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
15
|
+
/** Background matrix. true renders a down cell, false renders an up cell. */
|
|
16
|
+
board: {
|
|
17
|
+
type: PropType<boolean[][]>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {
|
|
21
|
+
board: boolean[][];
|
|
22
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
3
|
+
/** Foreground matrix. Uses 0 for blank, 1-8 for numbers, and negative values for mine states. */
|
|
4
|
+
board: {
|
|
5
|
+
type: PropType<number[][]>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
9
|
+
/** Foreground matrix. Uses 0 for blank, 1-8 for numbers, and negative values for mine states. */
|
|
10
|
+
board: {
|
|
11
|
+
type: PropType<number[][]>;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
}>> & Readonly<{}>, {
|
|
15
|
+
board: number[][];
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
type ComponentSize = number | 'auto';
|
|
3
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
/** Number to display. */
|
|
5
|
+
value: {
|
|
6
|
+
type: NumberConstructor;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
/** Rendered size for 160 source SVG units, or auto to fit the parent container. */
|
|
10
|
+
size: {
|
|
11
|
+
type: PropType<ComponentSize>;
|
|
12
|
+
required: true;
|
|
13
|
+
validator: (size: ComponentSize) => size is number | "auto";
|
|
14
|
+
};
|
|
15
|
+
/** Number of decimal places. */
|
|
16
|
+
fixed: {
|
|
17
|
+
type: NumberConstructor;
|
|
18
|
+
default: number;
|
|
19
|
+
validator: (value: number) => boolean;
|
|
20
|
+
};
|
|
21
|
+
/** Minimum number of integer digits. Pads high places with zeroes. */
|
|
22
|
+
digits: {
|
|
23
|
+
type: NumberConstructor;
|
|
24
|
+
default: number;
|
|
25
|
+
validator: (value: number) => boolean;
|
|
26
|
+
};
|
|
27
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
28
|
+
/** Number to display. */
|
|
29
|
+
value: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
/** Rendered size for 160 source SVG units, or auto to fit the parent container. */
|
|
34
|
+
size: {
|
|
35
|
+
type: PropType<ComponentSize>;
|
|
36
|
+
required: true;
|
|
37
|
+
validator: (size: ComponentSize) => size is number | "auto";
|
|
38
|
+
};
|
|
39
|
+
/** Number of decimal places. */
|
|
40
|
+
fixed: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: number;
|
|
43
|
+
validator: (value: number) => boolean;
|
|
44
|
+
};
|
|
45
|
+
/** Minimum number of integer digits. Pads high places with zeroes. */
|
|
46
|
+
digits: {
|
|
47
|
+
type: NumberConstructor;
|
|
48
|
+
default: number;
|
|
49
|
+
validator: (value: number) => boolean;
|
|
50
|
+
};
|
|
51
|
+
}>> & Readonly<{}>, {
|
|
52
|
+
fixed: number;
|
|
53
|
+
digits: number;
|
|
54
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
55
|
+
declare const _default: typeof __VLS_export;
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
type CellIndex = {
|
|
3
|
+
rowIndex: number;
|
|
4
|
+
columnIndex: number;
|
|
5
|
+
};
|
|
6
|
+
type BoardSize = number | 'auto';
|
|
7
|
+
declare var __VLS_1: {
|
|
8
|
+
board: number[][] | undefined;
|
|
9
|
+
size: number;
|
|
10
|
+
}, __VLS_8: {
|
|
11
|
+
board: number[][] | undefined;
|
|
12
|
+
cellIndex: CellIndex | undefined;
|
|
13
|
+
size: number;
|
|
14
|
+
}, __VLS_10: {
|
|
15
|
+
board: number[][] | undefined;
|
|
16
|
+
size: number;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
background?: (props: typeof __VLS_1) => any;
|
|
20
|
+
} & {
|
|
21
|
+
default?: (props: typeof __VLS_8) => any;
|
|
22
|
+
} & {
|
|
23
|
+
foreground?: (props: typeof __VLS_10) => any;
|
|
24
|
+
};
|
|
25
|
+
declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
26
|
+
/** Game board matrix following ms_toollib's game_board values. */
|
|
27
|
+
board: {
|
|
28
|
+
type: PropType<number[][]>;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
/** Side length of each cell in canvas pixels, or auto to fit the parent container. */
|
|
32
|
+
size: {
|
|
33
|
+
type: PropType<BoardSize>;
|
|
34
|
+
required: true;
|
|
35
|
+
validator: (size: BoardSize) => size is number | "auto";
|
|
36
|
+
};
|
|
37
|
+
}>, {
|
|
38
|
+
cellIndex: import('vue').Ref<CellIndex | undefined, CellIndex | undefined>;
|
|
39
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
40
|
+
/** Game board matrix following ms_toollib's game_board values. */
|
|
41
|
+
board: {
|
|
42
|
+
type: PropType<number[][]>;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
/** Side length of each cell in canvas pixels, or auto to fit the parent container. */
|
|
46
|
+
size: {
|
|
47
|
+
type: PropType<BoardSize>;
|
|
48
|
+
required: true;
|
|
49
|
+
validator: (size: BoardSize) => size is number | "auto";
|
|
50
|
+
};
|
|
51
|
+
}>> & Readonly<{}>, {
|
|
52
|
+
board: number[][];
|
|
53
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
54
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
55
|
+
declare const _default: typeof __VLS_export;
|
|
56
|
+
export default _default;
|
|
57
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
58
|
+
new (): {
|
|
59
|
+
$slots: S;
|
|
60
|
+
};
|
|
61
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as BoardBackground } from './components/BoardBackground.vue';
|
|
2
|
+
export { default as BoardForeground } from './components/BoardForeground.vue';
|
|
3
|
+
export { default as Counter } from './components/Counter.vue';
|
|
4
|
+
export { default as MinesweeperBoard } from './components/MinesweeperBoard.vue';
|
|
5
|
+
export { default } from './components/MinesweeperBoard.vue';
|
|
6
|
+
export declare const outerBorderClass = "outer-border";
|
|
7
|
+
export declare const innerBorderClass = "inner-border";
|
|
8
|
+
export declare const minesweeperBoardClasses: {
|
|
9
|
+
readonly innerBorder: "inner-border";
|
|
10
|
+
readonly outerBorder: "outer-border";
|
|
11
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.outer-border{box-sizing:border-box;background:silver;border:.1875em solid #a0a0a0;border-color:#fff #a0a0a0 #a0a0a0 #fff;align-items:flex-start;gap:.375em;margin:0;padding:.375em;line-height:0;display:inline-flex}.inner-border{box-sizing:content-box;font-size:inherit;border:.1875em solid #fff;border-color:gray #fff #fff gray}.counter[data-v-04cf9f01]{--counter-size:16px;border-style:solid;border-color:gray #fff #fff gray;border-width:calc(var(--counter-size) * .0625);box-sizing:border-box;vertical-align:middle;background:#000;align-items:flex-end;line-height:0;display:inline-flex;overflow:hidden}.counter__digit[data-v-04cf9f01]{height:calc(var(--counter-size) * 1.5625);-webkit-user-select:none;user-select:none;width:calc(var(--counter-size) * .8125);flex:none;display:block}.counter__fraction[data-v-04cf9f01]{align-items:flex-end;display:inline-flex}.counter__digit--fraction[data-v-04cf9f01]{height:calc(var(--counter-size) * .9375);width:calc(var(--counter-size) * .4875)}.minesweeper-board-content[data-v-ad3db891]{font-size:initial;line-height:0;display:grid}.minesweeper-board-layer[data-v-ad3db891]{grid-area:1/1}.minesweeper-board-layer--foreground[data-v-ad3db891]{pointer-events:none}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, inject as s, normalizeStyle as c, onBeforeUnmount as l, onMounted as u, openBlock as d, provide as f, ref as p, renderList as m, renderSlot as h, unref as g, watch as _ } from "vue";
|
|
2
|
+
import { ImageGrid as v } from "@putianyi888/vue3-plots";
|
|
3
|
+
//#region src/assets/celldown.svg?url
|
|
4
|
+
var y = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='160'%20height='160'%20fill='%23808080'%20/%3e%3c!--%20dark%20frame%20--%3e%3crect%20x='10'%20y='10'%20width='150'%20height='150'%20fill='%23c0c0c0'%20/%3e%3c!--%20light%20background%20--%3e%3c/svg%3e", b = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='0,0%20160,0%20140,20%2020,20%2020,140%200,160'%20fill='%23ffffff'%20/%3e%3c!--%20highlight%20--%3e%3cpolygon%20points='160,160%20160,0%20140,20%20140,140%2020,140%200,160'%20fill='%23808080'%20/%3e%3c!--%20shade%20--%3e%3crect%20x='20'%20y='20'%20width='120'%20height='120'%20fill='%23c0c0c0'%20/%3e%3c!--%20background%20--%3e%3c/svg%3e", x = Symbol("minesweeper-board"), S = /* @__PURE__ */ o({
|
|
5
|
+
__name: "BoardBackground",
|
|
6
|
+
props: { board: {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: void 0
|
|
9
|
+
} },
|
|
10
|
+
setup(e, { expose: r }) {
|
|
11
|
+
let i = e, a = s(x);
|
|
12
|
+
if (a === void 0) throw Error("BoardBackground must be used inside MinesweeperBoard.");
|
|
13
|
+
let o = {
|
|
14
|
+
down: y,
|
|
15
|
+
up: b
|
|
16
|
+
}, c = /* @__PURE__ */ new Set([
|
|
17
|
+
0,
|
|
18
|
+
1,
|
|
19
|
+
2,
|
|
20
|
+
3,
|
|
21
|
+
4,
|
|
22
|
+
5,
|
|
23
|
+
6,
|
|
24
|
+
7,
|
|
25
|
+
8,
|
|
26
|
+
14,
|
|
27
|
+
15,
|
|
28
|
+
18
|
|
29
|
+
]), l = t(() => {
|
|
30
|
+
if (i.board !== void 0) return i.board;
|
|
31
|
+
let e = a.board.value;
|
|
32
|
+
if (e === void 0) throw Error("BoardBackground requires a board prop or MinesweeperBoard board context.");
|
|
33
|
+
return e.map((e) => e.map((e) => c.has(e)));
|
|
34
|
+
}), u = t(() => l.value.map((e) => e.map((e) => e ? "down" : "up"))), f = p();
|
|
35
|
+
return r({ cellIndex: t(() => g(f.value?.cellIndex)) }), (e, t) => (d(), n(g(v), {
|
|
36
|
+
ref_key: "imageGrid",
|
|
37
|
+
ref: f,
|
|
38
|
+
"cell-height": g(a).size.value,
|
|
39
|
+
"cell-width": g(a).size.value,
|
|
40
|
+
cells: u.value,
|
|
41
|
+
images: o
|
|
42
|
+
}, null, 8, [
|
|
43
|
+
"cell-height",
|
|
44
|
+
"cell-width",
|
|
45
|
+
"cells"
|
|
46
|
+
]));
|
|
47
|
+
}
|
|
48
|
+
}), C = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='160'%20height='160'%20fill='%23808080'%20/%3e%3c!--%20dark%20frame%20--%3e%3crect%20x='10'%20y='10'%20width='150'%20height='150'%20fill='%23ff0000'%20/%3e%3c!--%20background%20--%3e%3c!--%20mine.svg%20--%3e%3ccircle%20cx='85'%20cy='85'%20r='45'%20fill='%23000000'%20/%3e%3crect%20x='20'%20y='80'%20width='130'%20height='10'%20/%3e%3crect%20y='20'%20x='80'%20width='10'%20height='130'%20/%3e%3cline%20x1='40'%20y1='40'%20x2='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3cline%20x2='40'%20y1='40'%20x1='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3ccircle%20cx='70'%20cy='70'%20r='11'%20fill='%23ffffff'%20/%3e%3c/svg%3e", w = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3c!--%20mine.svg%20--%3e%3ccircle%20cx='85'%20cy='85'%20r='45'%20fill='%23000000'%20/%3e%3crect%20x='20'%20y='80'%20width='130'%20height='10'%20/%3e%3crect%20y='20'%20x='80'%20width='10'%20height='130'%20/%3e%3cline%20x1='40'%20y1='40'%20x2='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3cline%20x2='40'%20y1='40'%20x1='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3ccircle%20cx='70'%20cy='70'%20r='11'%20fill='%23ffffff'%20/%3e%3cpolygon%20points='15,30%2035,30%20155,150%20135,150'%20fill='%23ff0000'%20/%3e%3c!--%20\\cross%20--%3e%3cpolygon%20points='155,30%20135,30%2015,150%2035,150'%20fill='%23ff0000'%20/%3e%3c!--%20/cross%20--%3e%3c/svg%3e", T = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='40'%20y='110'%20width='80'%20height='20'%20fill='%23000000'%20/%3e%3c!--%20lower%20base%20--%3e%3crect%20x='60'%20y='100'%20width='40'%20height='10'%20fill='%23000000'%20/%3e%3c!--%20upper%20base%20--%3e%3crect%20x='80'%20y='40'%20width='10'%20height='60'%20fill='%23000000'%20/%3e%3c!--%20pole%20--%3e%3cpath%20d='M%2090%2030%20L%2035%2057%20L%2090%2084'%20fill='%23ff0000'%20/%3e%3c!--%20flag%20--%3e%3c/svg%3e", E = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='85'%20cy='85'%20r='45'%20fill='%23000000'%20/%3e%3c!--%20mine%20body%20--%3e%3crect%20x='20'%20y='80'%20width='130'%20height='10'%20/%3e%3c!--%20-spike%20--%3e%3crect%20y='20'%20x='80'%20width='10'%20height='130'%20/%3e%3c!--%20|spike%20--%3e%3cline%20x1='40'%20y1='40'%20x2='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3c!--%20\\spike%20--%3e%3cline%20x2='40'%20y1='40'%20x1='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3c!--%20/spike%20--%3e%3ccircle%20cx='70'%20cy='70'%20r='11'%20fill='%23ffffff'%20/%3e%3c!--%20highlight%20--%3e%3c/svg%3e", D = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3c/svg%3e", O = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='50,110%2050,130%20120,130%20120,110%20100,110%20100,30%2085,30%2050,65%2050,70%2070,70%2070,110'%20fill='%230000ff'%20/%3e%3c/svg%3e", k = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2060%20Q%2030%2030,%2065%2030%20H%2095%20Q%20130%2030,%20130%2060%20C%20130%2085,%2070%20100,%2060%20110%20H%20130%20V%20130%20H%2030%20V%20115%20C%2030%2080,%20100%2080,%20100%2060%20Q%20100%2050,%2090%2050%20H%2070%20Q%2060%2050,%2060%2060'%20fill='%23008000'/%3e%3c/svg%3e", A = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2030%20H%2095%20Q%20130%2030,%20130%2060%20Q%20130%2075,%20115%2080%20Q%20130%2085,%20130%20100%20Q%20130%20130,%2095%20130%20H%2030%20V%20110%20H%2090%20Q%20100%20110,%20100%20100%20T%2090%2090%20H%2060%20V%2070%20H%2090%20Q%20100%2070,%20100%2060%20T%2090%2050%20H%2030'%20fill='%23ff0000'/%3e%3c/svg%3e", j = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='55,30%2030,80%2030,90%2090,90%2090,130%20120,130%20120,90%20130,90%20130,70%20120,70%20120,30%2090,30%2090,70%2065,70%2085,30'%20fill='%23000080'%20/%3e%3c/svg%3e", ee = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2030%20H%20130%20V%2050%20H%2060%20V%2070%20H%2095%20Q%20130%2070,%20130%20100%20T%2095%20130%20H%2030%20V%20110%20H%2090%20Q%20100%20110,%20100%20100%20T%2090%2090%20H%2030'%20fill='%23800000'/%3e%3c/svg%3e", M = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%20120%2030%20V%2050%20H%2080%20Q%2060%2050,%2060%2060%20V%20100%20Q%2060%20110,%2080%20110%20T%20100%20100%20T%2080%2090%20H%2060%20V%2070%20H%2095%20Q%20130%2070,%20130%20100%20T%2095%20130%20H%2065%20Q%2030%20130,%2030%20100%20V%2060%20Q%2030%2030,%2065%2030'%20fill='%23008080'/%3e%3c/svg%3e", te = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2030%20H%20130%20V%2060%20L%2095%20130%20H%2065%20L%20100%2060%20V%2050%20H%2030'%20fill='%23000000'/%3e%3c/svg%3e", ne = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2065%2030%20H%2095%20Q%20130%2030,%20130%2060%20Q%20130%2075,%20115%2080%20H%20100%20V%2060%20Q%20100%2050,%2090%2050%20H%2070%20Q%2060%2050,%2060%2060%20T%2070%2070%20H%2090%20Q%20100%2070,%20100%2060%20V%20100%20Q%20100%2090,%2090%2090%20H%2070%20Q%2060%2090,%2060%20100%20T%2070%20110%20H%2090%20Q%20100%20110,%20100%20100%20V%2080%20H%20115%20Q%20130%2085,%20130%20100%20Q%20130%20130,%2095%20130%20H%2065%20Q%2030%20130,%2030%20100%20Q%2030%2085,%2045%2080%20Q%2030%2075,%2030%2060%20Q%2030%2030,%2065%2030'%20fill='%23808080'/%3e%3c/svg%3e", N = /* @__PURE__ */ o({
|
|
49
|
+
__name: "BoardForeground",
|
|
50
|
+
props: { board: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: void 0
|
|
53
|
+
} },
|
|
54
|
+
setup(e) {
|
|
55
|
+
let r = e, i = s(x);
|
|
56
|
+
if (i === void 0) throw Error("BoardForeground must be used inside MinesweeperBoard.");
|
|
57
|
+
let a = {
|
|
58
|
+
blank: D,
|
|
59
|
+
num1: O,
|
|
60
|
+
num2: k,
|
|
61
|
+
num3: A,
|
|
62
|
+
num4: j,
|
|
63
|
+
num5: ee,
|
|
64
|
+
num6: M,
|
|
65
|
+
num7: te,
|
|
66
|
+
num8: ne,
|
|
67
|
+
mine: E,
|
|
68
|
+
flag: T,
|
|
69
|
+
falsemine: w,
|
|
70
|
+
blast: C
|
|
71
|
+
}, o = {
|
|
72
|
+
0: 0,
|
|
73
|
+
1: 1,
|
|
74
|
+
2: 2,
|
|
75
|
+
3: 3,
|
|
76
|
+
4: 4,
|
|
77
|
+
5: 5,
|
|
78
|
+
6: 6,
|
|
79
|
+
7: 7,
|
|
80
|
+
8: 8,
|
|
81
|
+
10: 0,
|
|
82
|
+
11: -2,
|
|
83
|
+
12: 0,
|
|
84
|
+
14: -3,
|
|
85
|
+
15: -4,
|
|
86
|
+
16: -1,
|
|
87
|
+
18: 0
|
|
88
|
+
}, c = {
|
|
89
|
+
0: "blank",
|
|
90
|
+
1: "num1",
|
|
91
|
+
2: "num2",
|
|
92
|
+
3: "num3",
|
|
93
|
+
4: "num4",
|
|
94
|
+
5: "num5",
|
|
95
|
+
6: "num6",
|
|
96
|
+
7: "num7",
|
|
97
|
+
8: "num8",
|
|
98
|
+
[-1]: "mine",
|
|
99
|
+
[-2]: "flag",
|
|
100
|
+
[-3]: "falsemine",
|
|
101
|
+
[-4]: "blast"
|
|
102
|
+
}, l = t(() => {
|
|
103
|
+
if (r.board !== void 0) return r.board;
|
|
104
|
+
let e = i.board.value;
|
|
105
|
+
if (e === void 0) throw Error("BoardForeground requires a board prop or MinesweeperBoard board context.");
|
|
106
|
+
return e.map((e) => e.map((e) => o[e] ?? 0));
|
|
107
|
+
}), u = t(() => l.value.map((e) => e.map((e) => c[e] ?? "blank")));
|
|
108
|
+
return (e, t) => (d(), n(g(v), {
|
|
109
|
+
"cell-height": g(i).size.value,
|
|
110
|
+
"cell-width": g(i).size.value,
|
|
111
|
+
cells: u.value,
|
|
112
|
+
images: a
|
|
113
|
+
}, null, 8, [
|
|
114
|
+
"cell-height",
|
|
115
|
+
"cell-width",
|
|
116
|
+
"cells"
|
|
117
|
+
]));
|
|
118
|
+
}
|
|
119
|
+
}), re = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23400000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23400000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23400000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", P = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23400000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", F = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23400000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23400000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", I = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23400000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", L = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", R = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23400000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", z = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23400000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", B = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23400000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", V = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23400000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", H = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", U = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e", W = ["aria-label"], G = ["data-counter-digit", "src"], K = {
|
|
120
|
+
key: 0,
|
|
121
|
+
class: "counter__fraction"
|
|
122
|
+
}, q = ["data-counter-digit", "src"], J = 270, Y = /*@__PURE__*/ o({
|
|
123
|
+
name: "MinesweeperCounter",
|
|
124
|
+
__name: "Counter",
|
|
125
|
+
props: {
|
|
126
|
+
value: {
|
|
127
|
+
type: Number,
|
|
128
|
+
required: !0
|
|
129
|
+
},
|
|
130
|
+
size: {
|
|
131
|
+
type: [Number, String],
|
|
132
|
+
required: !0,
|
|
133
|
+
validator: (e) => e === "auto" || typeof e == "number"
|
|
134
|
+
},
|
|
135
|
+
fixed: {
|
|
136
|
+
type: Number,
|
|
137
|
+
default: 0,
|
|
138
|
+
validator: (e) => Number.isInteger(e) && e >= 0 && e <= 100
|
|
139
|
+
},
|
|
140
|
+
digits: {
|
|
141
|
+
type: Number,
|
|
142
|
+
default: 1,
|
|
143
|
+
validator: (e) => Number.isInteger(e) && e >= 1 && e <= 100
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
setup(n) {
|
|
147
|
+
let a = n, o = {
|
|
148
|
+
"-": re,
|
|
149
|
+
0: P,
|
|
150
|
+
1: F,
|
|
151
|
+
2: I,
|
|
152
|
+
3: L,
|
|
153
|
+
4: R,
|
|
154
|
+
5: z,
|
|
155
|
+
6: B,
|
|
156
|
+
7: V,
|
|
157
|
+
8: H,
|
|
158
|
+
9: U
|
|
159
|
+
}, s = t(() => Math.min(100, Math.max(0, Math.trunc(a.fixed)))), f = t(() => (Number.isFinite(a.value) ? a.value : 0).toFixed(s.value)), h = t(() => f.value.split(".")), g = t(() => O(h.value[0] ?? "0")), v = t(() => E(g.value)), y = t(() => E(h.value[1] ?? "")), b = t(() => {
|
|
160
|
+
let e = h.value[1];
|
|
161
|
+
return e === void 0 ? g.value : `${g.value}.${e}`;
|
|
162
|
+
}), x = p(), S = p({
|
|
163
|
+
height: 0,
|
|
164
|
+
width: 0
|
|
165
|
+
}), C = t(() => 20 + v.value.length * 130 + y.value.length * 78), w = t(() => {
|
|
166
|
+
if (typeof a.size == "number") return a.size;
|
|
167
|
+
let e = C.value > 0 && S.value.width > 0 ? S.value.width * 160 / C.value : void 0, t = S.value.height > 0 ? S.value.height * 160 / J : void 0, n = Math.min(...[e, t].filter((e) => e !== void 0));
|
|
168
|
+
return Number.isFinite(n) ? Math.max(1, n) : 16;
|
|
169
|
+
}), T = t(() => ({ "--counter-size": `${w.value}px` }));
|
|
170
|
+
function E(e) {
|
|
171
|
+
return Array.from(e, (e) => D(e) ? e : "0");
|
|
172
|
+
}
|
|
173
|
+
function D(e) {
|
|
174
|
+
return e in o;
|
|
175
|
+
}
|
|
176
|
+
function O(e) {
|
|
177
|
+
let t = Math.min(100, Math.max(1, Math.trunc(a.digits)));
|
|
178
|
+
return e.startsWith("-") ? `-${e.slice(1).padStart(t, "0")}` : e.padStart(t, "0");
|
|
179
|
+
}
|
|
180
|
+
let k;
|
|
181
|
+
function A() {
|
|
182
|
+
let e = x.value, t = e?.parentElement ?? e;
|
|
183
|
+
if (t === void 0) {
|
|
184
|
+
S.value = {
|
|
185
|
+
height: 0,
|
|
186
|
+
width: 0
|
|
187
|
+
};
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
let n = t.getBoundingClientRect();
|
|
191
|
+
S.value = {
|
|
192
|
+
height: n.height,
|
|
193
|
+
width: n.width
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function j() {
|
|
197
|
+
if (k?.disconnect(), k = void 0, a.size !== "auto") return;
|
|
198
|
+
let e = x.value, t = e?.parentElement ?? e;
|
|
199
|
+
t !== void 0 && (A(), !(typeof ResizeObserver > "u") && (k = new ResizeObserver((e) => {
|
|
200
|
+
let t = e[0];
|
|
201
|
+
if (t === void 0) {
|
|
202
|
+
A();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
S.value = {
|
|
206
|
+
height: t.contentRect.height,
|
|
207
|
+
width: t.contentRect.width
|
|
208
|
+
};
|
|
209
|
+
}), k.observe(t)));
|
|
210
|
+
}
|
|
211
|
+
return u(() => {
|
|
212
|
+
j();
|
|
213
|
+
}), l(() => {
|
|
214
|
+
k?.disconnect();
|
|
215
|
+
}), _(() => a.size, () => {
|
|
216
|
+
j();
|
|
217
|
+
}), (t, n) => (d(), i("div", {
|
|
218
|
+
ref_key: "counterElement",
|
|
219
|
+
ref: x,
|
|
220
|
+
class: "counter",
|
|
221
|
+
style: c(T.value),
|
|
222
|
+
"aria-label": b.value,
|
|
223
|
+
role: "img"
|
|
224
|
+
}, [(d(!0), i(e, null, m(v.value, (e, t) => (d(), i("img", {
|
|
225
|
+
key: `integer-${t}`,
|
|
226
|
+
class: "counter__digit",
|
|
227
|
+
"data-counter-digit": e,
|
|
228
|
+
src: o[e],
|
|
229
|
+
alt: "",
|
|
230
|
+
draggable: "false"
|
|
231
|
+
}, null, 8, G))), 128)), y.value.length > 0 ? (d(), i("span", K, [(d(!0), i(e, null, m(y.value, (e, t) => (d(), i("img", {
|
|
232
|
+
key: `fraction-${t}`,
|
|
233
|
+
class: "counter__digit counter__digit--fraction",
|
|
234
|
+
"data-counter-digit": e,
|
|
235
|
+
src: o[e],
|
|
236
|
+
alt: "",
|
|
237
|
+
draggable: "false"
|
|
238
|
+
}, null, 8, q))), 128))])) : r("", !0)], 12, W));
|
|
239
|
+
}
|
|
240
|
+
}), X = (e, t) => {
|
|
241
|
+
let n = e.__vccOpts || e;
|
|
242
|
+
for (let [e, r] of t) n[e] = r;
|
|
243
|
+
return n;
|
|
244
|
+
}, ie = /*#__PURE__*/ X(Y, [["__scopeId", "data-v-04cf9f01"]]), ae = { class: "minesweeper-board-layer" }, oe = { class: "minesweeper-board-layer" }, se = { class: "minesweeper-board-layer minesweeper-board-layer--foreground" }, Z = /*#__PURE__*/ X(/* @__PURE__ */ o({
|
|
245
|
+
__name: "MinesweeperBoard",
|
|
246
|
+
props: {
|
|
247
|
+
board: {
|
|
248
|
+
type: Array,
|
|
249
|
+
default: void 0
|
|
250
|
+
},
|
|
251
|
+
size: {
|
|
252
|
+
type: [Number, String],
|
|
253
|
+
required: !0,
|
|
254
|
+
validator: (e) => e === "auto" || typeof e == "number"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
setup(e, { expose: o }) {
|
|
258
|
+
let s = e, c = p(), m = p(), g = p({
|
|
259
|
+
height: 0,
|
|
260
|
+
width: 0
|
|
261
|
+
}), v = t(() => s.board?.length ?? 0), y = t(() => s.board?.reduce((e, t) => Math.max(e, t.length), 0) ?? 0), b = t(() => {
|
|
262
|
+
if (typeof s.size == "number") return s.size;
|
|
263
|
+
let e = y.value > 0 && g.value.width > 0 ? g.value.width / y.value : void 0, t = v.value > 0 && g.value.height > 0 ? g.value.height / v.value : void 0, n = Math.min(...[e, t].filter((e) => e !== void 0));
|
|
264
|
+
return Number.isFinite(n) ? Math.max(1, n) : 16;
|
|
265
|
+
});
|
|
266
|
+
f(x, {
|
|
267
|
+
board: t(() => s.board),
|
|
268
|
+
size: t(() => b.value)
|
|
269
|
+
});
|
|
270
|
+
let C = t(() => y.value * b.value), w = t(() => v.value * b.value);
|
|
271
|
+
function T() {
|
|
272
|
+
m.value !== void 0 && (m.value = void 0);
|
|
273
|
+
}
|
|
274
|
+
function E(e) {
|
|
275
|
+
let t = c.value;
|
|
276
|
+
if (t === void 0 || v.value === 0 || y.value === 0) {
|
|
277
|
+
T();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
let n = t.getBoundingClientRect();
|
|
281
|
+
if (n.width === 0 || n.height === 0 || C.value === 0 || w.value === 0) {
|
|
282
|
+
T();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
let r = e.clientX - n.left, i = e.clientY - n.top;
|
|
286
|
+
if (r < 0 || i < 0 || r >= C.value || i >= w.value) {
|
|
287
|
+
T();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
let a = Math.floor(i / b.value), o = Math.floor(r / b.value);
|
|
291
|
+
if (s.board?.[a]?.[o] === void 0) {
|
|
292
|
+
T();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
D({
|
|
296
|
+
rowIndex: a,
|
|
297
|
+
columnIndex: o
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
function D(e) {
|
|
301
|
+
m.value?.rowIndex === e.rowIndex && m.value.columnIndex === e.columnIndex || (m.value = e);
|
|
302
|
+
}
|
|
303
|
+
let O;
|
|
304
|
+
function k() {
|
|
305
|
+
let e = c.value, t = e?.parentElement ?? e;
|
|
306
|
+
if (t === void 0) {
|
|
307
|
+
g.value = {
|
|
308
|
+
height: 0,
|
|
309
|
+
width: 0
|
|
310
|
+
};
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
let n = t.getBoundingClientRect();
|
|
314
|
+
g.value = {
|
|
315
|
+
height: n.height,
|
|
316
|
+
width: n.width
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function A() {
|
|
320
|
+
if (O?.disconnect(), O = void 0, s.size !== "auto") return;
|
|
321
|
+
let e = c.value, t = e?.parentElement ?? e;
|
|
322
|
+
t !== void 0 && (k(), !(typeof ResizeObserver > "u") && (O = new ResizeObserver((e) => {
|
|
323
|
+
let t = e[0];
|
|
324
|
+
if (t === void 0) {
|
|
325
|
+
k();
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
g.value = {
|
|
329
|
+
height: t.contentRect.height,
|
|
330
|
+
width: t.contentRect.width
|
|
331
|
+
};
|
|
332
|
+
}), O.observe(t)));
|
|
333
|
+
}
|
|
334
|
+
return u(() => {
|
|
335
|
+
A();
|
|
336
|
+
}), l(() => {
|
|
337
|
+
O?.disconnect();
|
|
338
|
+
}), _(() => s.size, () => {
|
|
339
|
+
A();
|
|
340
|
+
}), o({ cellIndex: m }), (e, t) => (d(), i("div", {
|
|
341
|
+
ref_key: "boardElement",
|
|
342
|
+
ref: c,
|
|
343
|
+
class: "minesweeper-board-content",
|
|
344
|
+
onMouseleave: T,
|
|
345
|
+
onMousemove: E
|
|
346
|
+
}, [
|
|
347
|
+
a("div", ae, [h(e.$slots, "background", {
|
|
348
|
+
board: s.board,
|
|
349
|
+
size: b.value
|
|
350
|
+
}, () => [s.board === void 0 ? r("", !0) : (d(), n(S, { key: 0 }))], !0)]),
|
|
351
|
+
a("div", oe, [h(e.$slots, "default", {
|
|
352
|
+
board: s.board,
|
|
353
|
+
cellIndex: m.value,
|
|
354
|
+
size: b.value
|
|
355
|
+
}, void 0, !0)]),
|
|
356
|
+
a("div", se, [h(e.$slots, "foreground", {
|
|
357
|
+
board: s.board,
|
|
358
|
+
size: b.value
|
|
359
|
+
}, () => [s.board === void 0 ? r("", !0) : (d(), n(N, { key: 0 }))], !0)])
|
|
360
|
+
], 544));
|
|
361
|
+
}
|
|
362
|
+
}), [["__scopeId", "data-v-ad3db891"]]), Q = "outer-border", $ = "inner-border", ce = {
|
|
363
|
+
innerBorder: $,
|
|
364
|
+
outerBorder: Q
|
|
365
|
+
};
|
|
366
|
+
//#endregion
|
|
367
|
+
export { S as BoardBackground, N as BoardForeground, ie as Counter, Z as MinesweeperBoard, Z as default, $ as innerBorderClass, ce as minesweeperBoardClasses, Q as outerBorderClass };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue"),require("@putianyi888/vue3-plots")):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@putianyi888/vue3-plots`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MinesweeperBoard={},e.Vue,e.Vue3Plots))})(this,function(e,t,n){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var r=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='160'%20height='160'%20fill='%23808080'%20/%3e%3c!--%20dark%20frame%20--%3e%3crect%20x='10'%20y='10'%20width='150'%20height='150'%20fill='%23c0c0c0'%20/%3e%3c!--%20light%20background%20--%3e%3c/svg%3e`,i=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='0,0%20160,0%20140,20%2020,20%2020,140%200,160'%20fill='%23ffffff'%20/%3e%3c!--%20highlight%20--%3e%3cpolygon%20points='160,160%20160,0%20140,20%20140,140%2020,140%200,160'%20fill='%23808080'%20/%3e%3c!--%20shade%20--%3e%3crect%20x='20'%20y='20'%20width='120'%20height='120'%20fill='%23c0c0c0'%20/%3e%3c!--%20background%20--%3e%3c/svg%3e`,a=Symbol(`minesweeper-board`),o=(0,t.defineComponent)({__name:`BoardBackground`,props:{board:{type:Array,default:void 0}},setup(e,{expose:o}){let s=e,c=(0,t.inject)(a);if(c===void 0)throw Error(`BoardBackground must be used inside MinesweeperBoard.`);let l={down:r,up:i},u=new Set([0,1,2,3,4,5,6,7,8,14,15,18]),d=(0,t.computed)(()=>{if(s.board!==void 0)return s.board;let e=c.board.value;if(e===void 0)throw Error(`BoardBackground requires a board prop or MinesweeperBoard board context.`);return e.map(e=>e.map(e=>u.has(e)))}),f=(0,t.computed)(()=>d.value.map(e=>e.map(e=>e?`down`:`up`))),p=(0,t.ref)();return o({cellIndex:(0,t.computed)(()=>(0,t.unref)(p.value?.cellIndex))}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ImageGrid),{ref_key:`imageGrid`,ref:p,"cell-height":(0,t.unref)(c).size.value,"cell-width":(0,t.unref)(c).size.value,cells:f.value,images:l},null,8,[`cell-height`,`cell-width`,`cells`]))}}),s=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='160'%20height='160'%20fill='%23808080'%20/%3e%3c!--%20dark%20frame%20--%3e%3crect%20x='10'%20y='10'%20width='150'%20height='150'%20fill='%23ff0000'%20/%3e%3c!--%20background%20--%3e%3c!--%20mine.svg%20--%3e%3ccircle%20cx='85'%20cy='85'%20r='45'%20fill='%23000000'%20/%3e%3crect%20x='20'%20y='80'%20width='130'%20height='10'%20/%3e%3crect%20y='20'%20x='80'%20width='10'%20height='130'%20/%3e%3cline%20x1='40'%20y1='40'%20x2='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3cline%20x2='40'%20y1='40'%20x1='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3ccircle%20cx='70'%20cy='70'%20r='11'%20fill='%23ffffff'%20/%3e%3c/svg%3e`,c=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3c!--%20mine.svg%20--%3e%3ccircle%20cx='85'%20cy='85'%20r='45'%20fill='%23000000'%20/%3e%3crect%20x='20'%20y='80'%20width='130'%20height='10'%20/%3e%3crect%20y='20'%20x='80'%20width='10'%20height='130'%20/%3e%3cline%20x1='40'%20y1='40'%20x2='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3cline%20x2='40'%20y1='40'%20x1='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3ccircle%20cx='70'%20cy='70'%20r='11'%20fill='%23ffffff'%20/%3e%3cpolygon%20points='15,30%2035,30%20155,150%20135,150'%20fill='%23ff0000'%20/%3e%3c!--%20\\cross%20--%3e%3cpolygon%20points='155,30%20135,30%2015,150%2035,150'%20fill='%23ff0000'%20/%3e%3c!--%20/cross%20--%3e%3c/svg%3e`,l=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='40'%20y='110'%20width='80'%20height='20'%20fill='%23000000'%20/%3e%3c!--%20lower%20base%20--%3e%3crect%20x='60'%20y='100'%20width='40'%20height='10'%20fill='%23000000'%20/%3e%3c!--%20upper%20base%20--%3e%3crect%20x='80'%20y='40'%20width='10'%20height='60'%20fill='%23000000'%20/%3e%3c!--%20pole%20--%3e%3cpath%20d='M%2090%2030%20L%2035%2057%20L%2090%2084'%20fill='%23ff0000'%20/%3e%3c!--%20flag%20--%3e%3c/svg%3e`,u=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='85'%20cy='85'%20r='45'%20fill='%23000000'%20/%3e%3c!--%20mine%20body%20--%3e%3crect%20x='20'%20y='80'%20width='130'%20height='10'%20/%3e%3c!--%20-spike%20--%3e%3crect%20y='20'%20x='80'%20width='10'%20height='130'%20/%3e%3c!--%20|spike%20--%3e%3cline%20x1='40'%20y1='40'%20x2='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3c!--%20\\spike%20--%3e%3cline%20x2='40'%20y1='40'%20x1='130'%20y2='130'%20stroke-width='10'%20stroke='%23000000'%20/%3e%3c!--%20/spike%20--%3e%3ccircle%20cx='70'%20cy='70'%20r='11'%20fill='%23ffffff'%20/%3e%3c!--%20highlight%20--%3e%3c/svg%3e`,d=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3c/svg%3e`,f=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='50,110%2050,130%20120,130%20120,110%20100,110%20100,30%2085,30%2050,65%2050,70%2070,70%2070,110'%20fill='%230000ff'%20/%3e%3c/svg%3e`,p=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2060%20Q%2030%2030,%2065%2030%20H%2095%20Q%20130%2030,%20130%2060%20C%20130%2085,%2070%20100,%2060%20110%20H%20130%20V%20130%20H%2030%20V%20115%20C%2030%2080,%20100%2080,%20100%2060%20Q%20100%2050,%2090%2050%20H%2070%20Q%2060%2050,%2060%2060'%20fill='%23008000'/%3e%3c/svg%3e`,m=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2030%20H%2095%20Q%20130%2030,%20130%2060%20Q%20130%2075,%20115%2080%20Q%20130%2085,%20130%20100%20Q%20130%20130,%2095%20130%20H%2030%20V%20110%20H%2090%20Q%20100%20110,%20100%20100%20T%2090%2090%20H%2060%20V%2070%20H%2090%20Q%20100%2070,%20100%2060%20T%2090%2050%20H%2030'%20fill='%23ff0000'/%3e%3c/svg%3e`,h=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='55,30%2030,80%2030,90%2090,90%2090,130%20120,130%20120,90%20130,90%20130,70%20120,70%20120,30%2090,30%2090,70%2065,70%2085,30'%20fill='%23000080'%20/%3e%3c/svg%3e`,g=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2030%20H%20130%20V%2050%20H%2060%20V%2070%20H%2095%20Q%20130%2070,%20130%20100%20T%2095%20130%20H%2030%20V%20110%20H%2090%20Q%20100%20110,%20100%20100%20T%2090%2090%20H%2030'%20fill='%23800000'/%3e%3c/svg%3e`,_=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%20120%2030%20V%2050%20H%2080%20Q%2060%2050,%2060%2060%20V%20100%20Q%2060%20110,%2080%20110%20T%20100%20100%20T%2080%2090%20H%2060%20V%2070%20H%2095%20Q%20130%2070,%20130%20100%20T%2095%20130%20H%2065%20Q%2030%20130,%2030%20100%20V%2060%20Q%2030%2030,%2065%2030'%20fill='%23008080'/%3e%3c/svg%3e`,v=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2030%2030%20H%20130%20V%2060%20L%2095%20130%20H%2065%20L%20100%2060%20V%2050%20H%2030'%20fill='%23000000'/%3e%3c/svg%3e`,y=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='160'%20height='160'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M%2065%2030%20H%2095%20Q%20130%2030,%20130%2060%20Q%20130%2075,%20115%2080%20H%20100%20V%2060%20Q%20100%2050,%2090%2050%20H%2070%20Q%2060%2050,%2060%2060%20T%2070%2070%20H%2090%20Q%20100%2070,%20100%2060%20V%20100%20Q%20100%2090,%2090%2090%20H%2070%20Q%2060%2090,%2060%20100%20T%2070%20110%20H%2090%20Q%20100%20110,%20100%20100%20V%2080%20H%20115%20Q%20130%2085,%20130%20100%20Q%20130%20130,%2095%20130%20H%2065%20Q%2030%20130,%2030%20100%20Q%2030%2085,%2045%2080%20Q%2030%2075,%2030%2060%20Q%2030%2030,%2065%2030'%20fill='%23808080'/%3e%3c/svg%3e`,b=(0,t.defineComponent)({__name:`BoardForeground`,props:{board:{type:Array,default:void 0}},setup(e){let r=e,i=(0,t.inject)(a);if(i===void 0)throw Error(`BoardForeground must be used inside MinesweeperBoard.`);let o={blank:d,num1:f,num2:p,num3:m,num4:h,num5:g,num6:_,num7:v,num8:y,mine:u,flag:l,falsemine:c,blast:s},b={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,10:0,11:-2,12:0,14:-3,15:-4,16:-1,18:0},x={0:`blank`,1:`num1`,2:`num2`,3:`num3`,4:`num4`,5:`num5`,6:`num6`,7:`num7`,8:`num8`,[-1]:`mine`,[-2]:`flag`,[-3]:`falsemine`,[-4]:`blast`},S=(0,t.computed)(()=>{if(r.board!==void 0)return r.board;let e=i.board.value;if(e===void 0)throw Error(`BoardForeground requires a board prop or MinesweeperBoard board context.`);return e.map(e=>e.map(e=>b[e]??0))}),C=(0,t.computed)(()=>S.value.map(e=>e.map(e=>x[e]??`blank`)));return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ImageGrid),{"cell-height":(0,t.unref)(i).size.value,"cell-width":(0,t.unref)(i).size.value,cells:C.value,images:o},null,8,[`cell-height`,`cell-width`,`cells`]))}}),x=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23400000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23400000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23400000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,S=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23400000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,C=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23400000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23400000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,w=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23400000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,T=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,E=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23400000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,D=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23400000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,O=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23400000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,k=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23400000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23400000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23400000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,A=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23ff0000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,j=`data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='yes'?%3e%3csvg%20width='130'%20height='250'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0'%20y='0'%20width='130'%20height='230'%20fill='%23000000'%20/%3e%3c!--%20background%20--%3e%3cpolygon%20points='15,10%20115,10%2085,40%2045,40'%20fill='%23ff0000'%20/%3e%3c!--%20top%20--%3e%3cpolygon%20points='15,220%20115,220%2085,190%2045,190'%20fill='%23ff0000'%20/%3e%3c!--%20bottom%20--%3e%3cpolygon%20points='10,15%2010,115%2040,85%2040,45'%20fill='%23ff0000'%20/%3e%3c!--%20left%20top%20--%3e%3cpolygon%20points='10,115%2010,215%2040,185%2040,145'%20fill='%23400000'%20/%3e%3c!--%20left%20bottom%20--%3e%3cpolygon%20points='120,15%20120,115%2090,85%2090,45'%20fill='%23ff0000'%20/%3e%3c!--%20right%20top%20--%3e%3cpolygon%20points='120,115%20120,215%2090,185%2090,145'%20fill='%23ff0000'%20/%3e%3c!--%20right%20bottom%20--%3e%3cpolygon%20points='20,115%2035,100%2095,100%20110,115%2095,130%2035,130'%20fill='%23ff0000'%20/%3e%3c!--%20center%20--%3e%3c/svg%3e`,M=[`aria-label`],N=[`data-counter-digit`,`src`],P={key:0,class:`counter__fraction`},F=[`data-counter-digit`,`src`],I=270,L=(0,t.defineComponent)({name:`MinesweeperCounter`,__name:`Counter`,props:{value:{type:Number,required:!0},size:{type:[Number,String],required:!0,validator:e=>e===`auto`||typeof e==`number`},fixed:{type:Number,default:0,validator:e=>Number.isInteger(e)&&e>=0&&e<=100},digits:{type:Number,default:1,validator:e=>Number.isInteger(e)&&e>=1&&e<=100}},setup(e){let n=e,r={"-":x,0:S,1:C,2:w,3:T,4:E,5:D,6:O,7:k,8:A,9:j},i=(0,t.computed)(()=>Math.min(100,Math.max(0,Math.trunc(n.fixed)))),a=(0,t.computed)(()=>(Number.isFinite(n.value)?n.value:0).toFixed(i.value)),o=(0,t.computed)(()=>a.value.split(`.`)),s=(0,t.computed)(()=>v(o.value[0]??`0`)),c=(0,t.computed)(()=>g(s.value)),l=(0,t.computed)(()=>g(o.value[1]??``)),u=(0,t.computed)(()=>{let e=o.value[1];return e===void 0?s.value:`${s.value}.${e}`}),d=(0,t.ref)(),f=(0,t.ref)({height:0,width:0}),p=(0,t.computed)(()=>20+c.value.length*130+l.value.length*78),m=(0,t.computed)(()=>{if(typeof n.size==`number`)return n.size;let e=p.value>0&&f.value.width>0?f.value.width*160/p.value:void 0,t=f.value.height>0?f.value.height*160/I:void 0,r=Math.min(...[e,t].filter(e=>e!==void 0));return Number.isFinite(r)?Math.max(1,r):16}),h=(0,t.computed)(()=>({"--counter-size":`${m.value}px`}));function g(e){return Array.from(e,e=>_(e)?e:`0`)}function _(e){return e in r}function v(e){let t=Math.min(100,Math.max(1,Math.trunc(n.digits)));return e.startsWith(`-`)?`-${e.slice(1).padStart(t,`0`)}`:e.padStart(t,`0`)}let y;function b(){let e=d.value,t=e?.parentElement??e;if(t===void 0){f.value={height:0,width:0};return}let n=t.getBoundingClientRect();f.value={height:n.height,width:n.width}}function L(){if(y?.disconnect(),y=void 0,n.size!==`auto`)return;let e=d.value,t=e?.parentElement??e;t!==void 0&&(b(),!(typeof ResizeObserver>`u`)&&(y=new ResizeObserver(e=>{let t=e[0];if(t===void 0){b();return}f.value={height:t.contentRect.height,width:t.contentRect.width}}),y.observe(t)))}return(0,t.onMounted)(()=>{L()}),(0,t.onBeforeUnmount)(()=>{y?.disconnect()}),(0,t.watch)(()=>n.size,()=>{L()}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`counterElement`,ref:d,class:`counter`,style:(0,t.normalizeStyle)(h.value),"aria-label":u.value,role:`img`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:`integer-${n}`,class:`counter__digit`,"data-counter-digit":e,src:r[e],alt:``,draggable:`false`},null,8,N))),128)),l.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,P,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(l.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:`fraction-${n}`,class:`counter__digit counter__digit--fraction`,"data-counter-digit":e,src:r[e],alt:``,draggable:`false`},null,8,F))),128))])):(0,t.createCommentVNode)(``,!0)],12,M))}}),R=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},z=R(L,[[`__scopeId`,`data-v-04cf9f01`]]),B={class:`minesweeper-board-layer`},V={class:`minesweeper-board-layer`},H={class:`minesweeper-board-layer minesweeper-board-layer--foreground`},U=R((0,t.defineComponent)({__name:`MinesweeperBoard`,props:{board:{type:Array,default:void 0},size:{type:[Number,String],required:!0,validator:e=>e===`auto`||typeof e==`number`}},setup(e,{expose:n}){let r=e,i=(0,t.ref)(),s=(0,t.ref)(),c=(0,t.ref)({height:0,width:0}),l=(0,t.computed)(()=>r.board?.length??0),u=(0,t.computed)(()=>r.board?.reduce((e,t)=>Math.max(e,t.length),0)??0),d=(0,t.computed)(()=>{if(typeof r.size==`number`)return r.size;let e=u.value>0&&c.value.width>0?c.value.width/u.value:void 0,t=l.value>0&&c.value.height>0?c.value.height/l.value:void 0,n=Math.min(...[e,t].filter(e=>e!==void 0));return Number.isFinite(n)?Math.max(1,n):16});(0,t.provide)(a,{board:(0,t.computed)(()=>r.board),size:(0,t.computed)(()=>d.value)});let f=(0,t.computed)(()=>u.value*d.value),p=(0,t.computed)(()=>l.value*d.value);function m(){s.value!==void 0&&(s.value=void 0)}function h(e){let t=i.value;if(t===void 0||l.value===0||u.value===0){m();return}let n=t.getBoundingClientRect();if(n.width===0||n.height===0||f.value===0||p.value===0){m();return}let a=e.clientX-n.left,o=e.clientY-n.top;if(a<0||o<0||a>=f.value||o>=p.value){m();return}let s=Math.floor(o/d.value),c=Math.floor(a/d.value);if(r.board?.[s]?.[c]===void 0){m();return}g({rowIndex:s,columnIndex:c})}function g(e){s.value?.rowIndex===e.rowIndex&&s.value.columnIndex===e.columnIndex||(s.value=e)}let _;function v(){let e=i.value,t=e?.parentElement??e;if(t===void 0){c.value={height:0,width:0};return}let n=t.getBoundingClientRect();c.value={height:n.height,width:n.width}}function y(){if(_?.disconnect(),_=void 0,r.size!==`auto`)return;let e=i.value,t=e?.parentElement??e;t!==void 0&&(v(),!(typeof ResizeObserver>`u`)&&(_=new ResizeObserver(e=>{let t=e[0];if(t===void 0){v();return}c.value={height:t.contentRect.height,width:t.contentRect.width}}),_.observe(t)))}return(0,t.onMounted)(()=>{y()}),(0,t.onBeforeUnmount)(()=>{_?.disconnect()}),(0,t.watch)(()=>r.size,()=>{y()}),n({cellIndex:s}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`boardElement`,ref:i,class:`minesweeper-board-content`,onMouseleave:m,onMousemove:h},[(0,t.createElementVNode)(`div`,B,[(0,t.renderSlot)(e.$slots,`background`,{board:r.board,size:d.value},()=>[r.board===void 0?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)(o,{key:0}))],!0)]),(0,t.createElementVNode)(`div`,V,[(0,t.renderSlot)(e.$slots,`default`,{board:r.board,cellIndex:s.value,size:d.value},void 0,!0)]),(0,t.createElementVNode)(`div`,H,[(0,t.renderSlot)(e.$slots,`foreground`,{board:r.board,size:d.value},()=>[r.board===void 0?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)(b,{key:0}))],!0)])],544))}}),[[`__scopeId`,`data-v-ad3db891`]]),W=`outer-border`,G=`inner-border`,K={innerBorder:G,outerBorder:W};e.BoardBackground=o,e.BoardForeground=b,e.Counter=z,e.MinesweeperBoard=U,e.default=U,e.innerBorderClass=G,e.minesweeperBoardClasses=K,e.outerBorderClass=W});
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@putianyi888/vue3-minesweeper-board",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vue 3 Minesweeper board component for ms_toollib game board values.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Tianyi Pu",
|
|
8
|
+
"main": "./dist/minesweeper-board.umd.cjs",
|
|
9
|
+
"module": "./dist/minesweeper-board.js",
|
|
10
|
+
"style": "./dist/minesweeper-board.css",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/minesweeper-board.js",
|
|
16
|
+
"require": "./dist/minesweeper-board.umd.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./style.css": "./dist/minesweeper-board.css"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
27
|
+
"docs:build": "vitepress build docs",
|
|
28
|
+
"docs:dev": "vitepress dev docs",
|
|
29
|
+
"docs:preview": "vitepress preview docs",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"lint:fix": "eslint . --fix",
|
|
32
|
+
"prepack": "npm run build",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"typecheck": "vue-tsc --noEmit",
|
|
35
|
+
"pack:dry-run": "npm pack --dry-run"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@putianyi888/vue3-plots": "^0.6.0",
|
|
39
|
+
"vue": "^3.5.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@eslint/js": "^10.0.1",
|
|
43
|
+
"@putianyi888/vue3-plots": "^0.6.0",
|
|
44
|
+
"@types/node": "^26.1.1",
|
|
45
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
46
|
+
"@vue/test-utils": "^2.4.11",
|
|
47
|
+
"eslint": "^10.7.0",
|
|
48
|
+
"eslint-plugin-vue": "^10.9.2",
|
|
49
|
+
"globals": "^17.7.0",
|
|
50
|
+
"jsdom": "^29.1.1",
|
|
51
|
+
"ms-toollib": "^1.5.15",
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"typescript-eslint": "^8.64.0",
|
|
54
|
+
"vite": "^8.1.5",
|
|
55
|
+
"vite-plugin-dts": "^5.0.3",
|
|
56
|
+
"vite-plugin-top-level-await": "^1.6.0",
|
|
57
|
+
"vite-plugin-wasm": "^3.6.0",
|
|
58
|
+
"vitepress": "^1.6.4",
|
|
59
|
+
"vitest": "^4.1.10",
|
|
60
|
+
"vue": "^3.5.40",
|
|
61
|
+
"vue-eslint-parser": "^10.4.1",
|
|
62
|
+
"vue-tsc": "^3.3.7"
|
|
63
|
+
}
|
|
64
|
+
}
|