@bedard/hexboard 0.0.8 → 0.0.10
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/CHANGELOG.md +9 -0
- package/dist/index.js +387 -388
- package/package.json +1 -1
- package/src/lib/components/hexboard/Hexboard.vue +118 -97
- package/src/tests/hexboard.test.tsx +78 -39
- package/src/tests/utils.ts +28 -2
- package/vite.config.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Hexchess as
|
|
3
|
-
function r(
|
|
4
|
-
return [
|
|
1
|
+
import { defineComponent as fo, createElementBlock as C, openBlock as x, createElementVNode as vo, toDisplayString as ho, mergeModels as uo, useModel as Zt, shallowRef as et, useTemplateRef as Co, computed as W, onBeforeMount as Eo, onMounted as Lo, onUnmounted as Bo, watch as jt, createCommentVNode as tt, unref as a, normalizeStyle as ct, Fragment as ot, renderList as nt, mergeProps as Mo, createBlock as io, resolveDynamicComponent as co, withModifiers as $o, renderSlot as To, h as Fo } from "vue";
|
|
2
|
+
import { Hexchess as ao, position as ae, San as at, isPromotionPosition as Ro } from "@bedard/hexchess";
|
|
3
|
+
function r(i, B, v) {
|
|
4
|
+
return [i[0] + v * (B[0] - i[0]), i[1] + v * (B[1] - i[1])];
|
|
5
5
|
}
|
|
6
|
-
function n(
|
|
7
|
-
return
|
|
6
|
+
function n(i) {
|
|
7
|
+
return i.map(t);
|
|
8
8
|
}
|
|
9
|
-
function e(
|
|
9
|
+
function e(i) {
|
|
10
10
|
return [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
k(i, -300, ue),
|
|
12
|
+
k(i, 0, ue),
|
|
13
|
+
k(i, -60, ue),
|
|
14
|
+
k(i, -120, ue),
|
|
15
|
+
k(i, -180, ue),
|
|
16
|
+
k(i, -240, ue)
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
19
|
+
function k(i, B, v) {
|
|
20
|
+
const Q = So(B);
|
|
21
21
|
return [
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
v * Math.cos(Q) + i[0],
|
|
23
|
+
v * Math.sin(Q) + i[1]
|
|
24
24
|
];
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function So(i) {
|
|
27
|
+
return i * (Math.PI / 180);
|
|
28
28
|
}
|
|
29
|
-
function t(
|
|
30
|
-
return [-
|
|
29
|
+
function t(i) {
|
|
30
|
+
return [-i[0], -i[1]];
|
|
31
31
|
}
|
|
32
|
-
function l(
|
|
33
|
-
return [
|
|
32
|
+
function l(i, B) {
|
|
33
|
+
return [i[0] + B[0], i[1] + B[1]];
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
35
|
+
function fe(i) {
|
|
36
|
+
return de / 2 + i;
|
|
37
37
|
}
|
|
38
|
-
function ve(
|
|
39
|
-
return
|
|
38
|
+
function ve(i) {
|
|
39
|
+
return de / 2 - i;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const de = 23.6, qo = {
|
|
42
42
|
colors: [
|
|
43
43
|
"oklch(0.9015 0.0729 70.7)",
|
|
44
44
|
"oklch(0.8366 0.1165 66.29)",
|
|
@@ -57,133 +57,133 @@ const he = 23.6, So = {
|
|
|
57
57
|
// red-500
|
|
58
58
|
targetColor: "oklch(63.7% 0.237 25.331)"
|
|
59
59
|
// red-500
|
|
60
|
-
},
|
|
61
|
-
[2,
|
|
62
|
-
[1,
|
|
63
|
-
[0,
|
|
64
|
-
[1,
|
|
65
|
-
[0,
|
|
60
|
+
}, No = "b/qbk/n1b1n/r5r/ppppppppp/11/5P5/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 w - 0 1", u = 1.7, V = 1.7, ue = 2 / Math.sqrt(3), p = ue * (Math.sqrt(3) / 2) * 2, y = p * 2, w = p * 3, P = p * 4, L = p * 5, m = [0, 0], A = k(m, 150, L), S = k(m, 150, P), D = k(m, 150, w), q = k(m, 150, y), $ = k(m, 150, p), T = k(m, 30, p), N = k(m, 30, y), H = k(m, 30, w), z = k(m, 30, P), O = k(m, 30, L), U = l(A, [0, -L]), Z = l(S, [0, -L]), he = l(D, [0, -L]), pe = l(q, [0, -L]), me = l($, [0, -L]), ge = l(m, [0, -L]), ye = l(T, [0, -L]), we = l(N, [0, -L]), be = l(H, [0, -L]), j = l(z, [0, -L]), G = l(O, [0, -L]), I = l(A, [0, -P]), J = l(S, [0, -P]), xe = l(D, [0, -P]), ke = l(q, [0, -P]), Pe = l($, [0, -P]), Ce = l(m, [0, -P]), Ee = l(T, [0, -P]), Le = l(N, [0, -P]), Be = l(H, [0, -P]), _ = l(z, [0, -P]), ee = l(O, [0, -P]), Me = l(A, [0, -w]), $e = l(S, [0, -w]), ft = l(D, [0, -w]), vt = l(q, [0, -w]), dt = l($, [0, -w]), ht = l(m, [0, -w]), pt = l(T, [0, -w]), mt = l(N, [0, -w]), gt = l(H, [0, -w]), Te = l(z, [0, -w]), Fe = l(O, [0, -w]), Re = l(A, [0, -y]), Se = l(S, [0, -y]), yt = l(D, [0, -y]), wt = l(q, [0, -y]), bt = l($, [0, -y]), xt = l(m, [0, -y]), kt = l(T, [0, -y]), Pt = l(N, [0, -y]), Ct = l(H, [0, -y]), qe = l(z, [0, -y]), Ne = l(O, [0, -y]), ze = l(A, [0, -p]), We = l(S, [0, -p]), Et = l(D, [0, -p]), Lt = l(q, [0, -p]), Bt = l($, [0, -p]), Mt = l(m, [0, -p]), $t = l(T, [0, -p]), Tt = l(N, [0, -p]), Ft = l(H, [0, -p]), Ae = l(z, [0, -p]), De = l(O, [0, -p]), He = l(S, [0, p]), Oe = l(D, [0, p]), Rt = l(q, [0, p]), St = l($, [0, p]), qt = l(m, [0, p]), Nt = l(T, [0, p]), zt = l(N, [0, p]), Xe = l(H, [0, p]), Ye = l(z, [0, p]), Ke = l(D, [0, y]), Qe = l(q, [0, y]), Wt = l($, [0, y]), At = l(m, [0, y]), Dt = l(T, [0, y]), Ve = l(N, [0, y]), Ue = l(H, [0, y]), Ze = l(q, [0, w]), je = l($, [0, w]), Ht = l(m, [0, w]), Ge = l(T, [0, w]), Ie = l(N, [0, w]), te = l($, [0, P]), oe = l(m, [0, P]), ne = l(T, [0, P]), le = l(m, [0, L]), o = [
|
|
61
|
+
[2, le, t(le), e(le), n(e(le))],
|
|
62
|
+
[1, te, t(te), e(te), n(e(te))],
|
|
63
|
+
[0, oe, t(oe), e(oe), n(e(oe))],
|
|
64
|
+
[1, ne, t(ne), e(ne), n(e(ne))],
|
|
65
|
+
[0, Ze, t(Ze), e(Ze), n(e(Ze))],
|
|
66
|
+
[2, je, t(je), e(je), n(e(je))],
|
|
67
|
+
[1, Ht, t(Ht), e(Ht), n(e(Ht))],
|
|
66
68
|
[2, Ge, t(Ge), e(Ge), n(e(Ge))],
|
|
67
|
-
[1, Xt, t(Xt), e(Xt), n(e(Xt))],
|
|
68
|
-
[2, Je, t(Je), e(Je), n(e(Je))],
|
|
69
69
|
[0, Ie, t(Ie), e(Ie), n(e(Ie))],
|
|
70
|
-
[2,
|
|
71
|
-
[1,
|
|
70
|
+
[2, Ke, t(Ke), e(Ke), n(e(Ke))],
|
|
71
|
+
[1, Qe, t(Qe), e(Qe), n(e(Qe))],
|
|
72
|
+
[0, Wt, t(Wt), e(Wt), n(e(Wt))],
|
|
73
|
+
[2, At, t(At), e(At), n(e(At))],
|
|
72
74
|
[0, Dt, t(Dt), e(Dt), n(e(Dt))],
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[1,
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
75
|
+
[1, Ve, t(Ve), e(Ve), n(e(Ve))],
|
|
76
|
+
[2, Ue, t(Ue), e(Ue), n(e(Ue))],
|
|
77
|
+
[1, He, t(He), e(He), n(e(He))],
|
|
78
|
+
[0, Oe, t(Oe), e(Oe), n(e(Oe))],
|
|
79
|
+
[2, Rt, t(Rt), e(Rt), n(e(Rt))],
|
|
80
|
+
[1, St, t(St), e(St), n(e(St))],
|
|
81
|
+
[0, qt, t(qt), e(qt), n(e(qt))],
|
|
80
82
|
[1, Nt, t(Nt), e(Nt), n(e(Nt))],
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[0,
|
|
85
|
-
[1, Ke, t(Ke), e(Ke), n(e(Ke))],
|
|
86
|
-
[0, D, t(D), e(D), n(e(D))],
|
|
83
|
+
[2, zt, t(zt), e(zt), n(e(zt))],
|
|
84
|
+
[0, Xe, t(Xe), e(Xe), n(e(Xe))],
|
|
85
|
+
[1, Ye, t(Ye), e(Ye), n(e(Ye))],
|
|
86
|
+
[0, A, t(A), e(A), n(e(A))],
|
|
87
87
|
[2, S, t(S), e(S), n(e(S))],
|
|
88
|
-
[1,
|
|
88
|
+
[1, D, t(D), e(D), n(e(D))],
|
|
89
89
|
[0, q, t(q), e(q), n(e(q))],
|
|
90
|
-
[2,
|
|
90
|
+
[2, $, t($), e($), n(e($))],
|
|
91
91
|
[1, m, t(m), e(m), n(e(m))],
|
|
92
92
|
[2, T, t(T), e(T), n(e(T))],
|
|
93
93
|
[0, N, t(N), e(N), n(e(N))],
|
|
94
|
-
[1,
|
|
94
|
+
[1, H, t(H), e(H), n(e(H))],
|
|
95
95
|
[2, z, t(z), e(z), n(e(z))],
|
|
96
|
-
[0,
|
|
97
|
-
[1,
|
|
98
|
-
[0,
|
|
99
|
-
[2, Lt, t(Lt), e(Lt), n(e(Lt))],
|
|
100
|
-
[1, Bt, t(Bt), e(Bt), n(e(Bt))],
|
|
101
|
-
[0, Mt, t(Mt), e(Mt), n(e(Mt))],
|
|
102
|
-
[2, Tt, t(Tt), e(Tt), n(e(Tt))],
|
|
103
|
-
[0, Ft, t(Ft), e(Ft), n(e(Ft))],
|
|
104
|
-
[1, Rt, t(Rt), e(Rt), n(e(Rt))],
|
|
105
|
-
[2, St, t(St), e(St), n(e(St))],
|
|
106
|
-
[0, De, t(De), e(De), n(e(De))],
|
|
107
|
-
[1, He, t(He), e(He), n(e(He))],
|
|
108
|
-
[2, Se, t(Se), e(Se), n(e(Se))],
|
|
109
|
-
[1, qe, t(qe), e(qe), n(e(qe))],
|
|
110
|
-
[0, bt, t(bt), e(bt), n(e(bt))],
|
|
111
|
-
[2, xt, t(xt), e(xt), n(e(xt))],
|
|
112
|
-
[1, kt, t(kt), e(kt), n(e(kt))],
|
|
113
|
-
[0, Pt, t(Pt), e(Pt), n(e(Pt))],
|
|
114
|
-
[1, Ct, t(Ct), e(Ct), n(e(Ct))],
|
|
96
|
+
[0, O, t(O), e(O), n(e(O))],
|
|
97
|
+
[1, ze, t(ze), e(ze), n(e(ze))],
|
|
98
|
+
[0, We, t(We), e(We), n(e(We))],
|
|
115
99
|
[2, Et, t(Et), e(Et), n(e(Et))],
|
|
100
|
+
[1, Lt, t(Lt), e(Lt), n(e(Lt))],
|
|
101
|
+
[0, Bt, t(Bt), e(Bt), n(e(Bt))],
|
|
102
|
+
[2, Mt, t(Mt), e(Mt), n(e(Mt))],
|
|
116
103
|
[0, $t, t($t), e($t), n(e($t))],
|
|
117
|
-
[1,
|
|
118
|
-
[2,
|
|
104
|
+
[1, Tt, t(Tt), e(Tt), n(e(Tt))],
|
|
105
|
+
[2, Ft, t(Ft), e(Ft), n(e(Ft))],
|
|
106
|
+
[0, Ae, t(Ae), e(Ae), n(e(Ae))],
|
|
107
|
+
[1, De, t(De), e(De), n(e(De))],
|
|
108
|
+
[2, Re, t(Re), e(Re), n(e(Re))],
|
|
109
|
+
[1, Se, t(Se), e(Se), n(e(Se))],
|
|
110
|
+
[0, yt, t(yt), e(yt), n(e(yt))],
|
|
111
|
+
[2, wt, t(wt), e(wt), n(e(wt))],
|
|
112
|
+
[1, bt, t(bt), e(bt), n(e(bt))],
|
|
113
|
+
[0, xt, t(xt), e(xt), n(e(xt))],
|
|
114
|
+
[1, kt, t(kt), e(kt), n(e(kt))],
|
|
115
|
+
[2, Pt, t(Pt), e(Pt), n(e(Pt))],
|
|
116
|
+
[0, Ct, t(Ct), e(Ct), n(e(Ct))],
|
|
117
|
+
[1, qe, t(qe), e(qe), n(e(qe))],
|
|
118
|
+
[2, Ne, t(Ne), e(Ne), n(e(Ne))],
|
|
119
119
|
[0, Me, t(Me), e(Me), n(e(Me))],
|
|
120
|
-
[2,
|
|
121
|
-
[1,
|
|
122
|
-
[0,
|
|
120
|
+
[2, $e, t($e), e($e), n(e($e))],
|
|
121
|
+
[1, ft, t(ft), e(ft), n(e(ft))],
|
|
122
|
+
[0, vt, t(vt), e(vt), n(e(vt))],
|
|
123
|
+
[2, dt, t(dt), e(dt), n(e(dt))],
|
|
124
|
+
[1, ht, t(ht), e(ht), n(e(ht))],
|
|
123
125
|
[2, pt, t(pt), e(pt), n(e(pt))],
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
[
|
|
127
|
-
[
|
|
128
|
-
[2, Fe, t(Fe), e(Fe), n(e(Fe))],
|
|
129
|
-
[0, Re, t(Re), e(Re), n(e(Re))],
|
|
126
|
+
[0, mt, t(mt), e(mt), n(e(mt))],
|
|
127
|
+
[1, gt, t(gt), e(gt), n(e(gt))],
|
|
128
|
+
[2, Te, t(Te), e(Te), n(e(Te))],
|
|
129
|
+
[0, Fe, t(Fe), e(Fe), n(e(Fe))],
|
|
130
130
|
[1, I, t(I), e(I), n(e(I))],
|
|
131
|
-
[0,
|
|
132
|
-
[2,
|
|
133
|
-
[1,
|
|
134
|
-
[0,
|
|
135
|
-
[2,
|
|
136
|
-
[0,
|
|
131
|
+
[0, J, t(J), e(J), n(e(J))],
|
|
132
|
+
[2, xe, t(xe), e(xe), n(e(xe))],
|
|
133
|
+
[1, ke, t(ke), e(ke), n(e(ke))],
|
|
134
|
+
[0, Pe, t(Pe), e(Pe), n(e(Pe))],
|
|
135
|
+
[2, Ce, t(Ce), e(Ce), n(e(Ce))],
|
|
136
|
+
[0, Ee, t(Ee), e(Ee), n(e(Ee))],
|
|
137
137
|
[1, Le, t(Le), e(Le), n(e(Le))],
|
|
138
138
|
[2, Be, t(Be), e(Be), n(e(Be))],
|
|
139
|
-
[0,
|
|
140
|
-
[1,
|
|
141
|
-
[2,
|
|
142
|
-
[1,
|
|
143
|
-
[0,
|
|
144
|
-
[2,
|
|
145
|
-
[1,
|
|
146
|
-
[0,
|
|
139
|
+
[0, _, t(_), e(_), n(e(_))],
|
|
140
|
+
[1, ee, t(ee), e(ee), n(e(ee))],
|
|
141
|
+
[2, U, t(U), e(U), n(e(U))],
|
|
142
|
+
[1, Z, t(Z), e(Z), n(e(Z))],
|
|
143
|
+
[0, he, t(he), e(he), n(e(he))],
|
|
144
|
+
[2, pe, t(pe), e(pe), n(e(pe))],
|
|
145
|
+
[1, me, t(me), e(me), n(e(me))],
|
|
146
|
+
[0, ge, t(ge), e(ge), n(e(ge))],
|
|
147
147
|
[1, ye, t(ye), e(ye), n(e(ye))],
|
|
148
|
-
[2,
|
|
149
|
-
[0,
|
|
150
|
-
[1,
|
|
151
|
-
[2,
|
|
152
|
-
], No = [
|
|
153
|
-
["11", r(le, se, i), t(r(le, se, i))],
|
|
154
|
-
["10", r(ne, oe, i), t(r(ne, oe, i))],
|
|
155
|
-
["9", r(Ge, je, i), t(r(Ge, je, i))],
|
|
156
|
-
["8", r(Ve, Qe, i), t(r(Ve, Qe, i))],
|
|
157
|
-
["7", r(Xe, Oe, i), t(r(Xe, Oe, i))],
|
|
158
|
-
["6", r(S, D, i), t(r(S, D, i))],
|
|
159
|
-
["5", r(Ae, We, i), t(r(Ae, We, i))],
|
|
160
|
-
["4", r(qe, Se, i), t(r(qe, Se, i))],
|
|
161
|
-
["3", r(Te, Me, i), t(r(Te, Me, i))],
|
|
162
|
-
["2", r(_, I, i), t(r(_, I, i))],
|
|
163
|
-
["1", r(j, Z, i), t(r(j, Z, i))],
|
|
164
|
-
["a", r(I, Z, i), t(r(I, Z, i))],
|
|
165
|
-
["b", r(_, j, i), t(r(_, j, i))],
|
|
166
|
-
["c", r(ke, pe, i), t(r(ke, pe, i))],
|
|
167
|
-
["d", r(Pe, me, i), t(r(Pe, me, i))],
|
|
168
|
-
["e", r(Ce, ge, i), t(r(Ce, ge, i))],
|
|
169
|
-
["f", r(Ee, we, i), t(r(Ee, we, i))],
|
|
170
|
-
["g", r($e, ye, i), t(r($e, ye, i))],
|
|
171
|
-
["h", r(Le, be, i), t(r(Le, be, i))],
|
|
172
|
-
["i", r(Be, xe, i), t(r(Be, xe, i))],
|
|
173
|
-
["k", r(ee, G, i), t(r(ee, G, i))],
|
|
174
|
-
["l", r(te, J, i), t(r(te, J, i))],
|
|
175
|
-
["1", r(G, J, i), t(r(G, J, i))],
|
|
176
|
-
["2", r(ee, te, i), t(r(ee, te, i))],
|
|
177
|
-
["3", r(Fe, Re, i), t(r(Fe, Re, i))],
|
|
178
|
-
["4", r(Ne, ze, i), t(r(Ne, ze, i))],
|
|
179
|
-
["5", r(De, He, i), t(r(De, He, i))],
|
|
180
|
-
["6", r(z, X, i), t(r(z, X, i))],
|
|
181
|
-
["7", r(Ye, Ke, i), t(r(Ye, Ke, i))],
|
|
182
|
-
["8", r(Ue, Ze, i), t(r(Ue, Ze, i))],
|
|
183
|
-
["9", r(Je, Ie, i), t(r(Je, Ie, i))],
|
|
184
|
-
["10", r(ne, le, i), t(r(ne, le, i))],
|
|
185
|
-
["11", r(oe, se, i), t(r(oe, se, i))]
|
|
148
|
+
[2, we, t(we), e(we), n(e(we))],
|
|
149
|
+
[0, be, t(be), e(be), n(e(be))],
|
|
150
|
+
[1, j, t(j), e(j), n(e(j))],
|
|
151
|
+
[2, G, t(G), e(G), n(e(G))]
|
|
186
152
|
], zo = [
|
|
153
|
+
["11", r(ne, le, u), t(r(ne, le, u))],
|
|
154
|
+
["10", r(oe, te, u), t(r(oe, te, u))],
|
|
155
|
+
["9", r(je, Ze, u), t(r(je, Ze, u))],
|
|
156
|
+
["8", r(Qe, Ke, u), t(r(Qe, Ke, u))],
|
|
157
|
+
["7", r(Oe, He, u), t(r(Oe, He, u))],
|
|
158
|
+
["6", r(S, A, u), t(r(S, A, u))],
|
|
159
|
+
["5", r(We, ze, u), t(r(We, ze, u))],
|
|
160
|
+
["4", r(Se, Re, u), t(r(Se, Re, u))],
|
|
161
|
+
["3", r($e, Me, u), t(r($e, Me, u))],
|
|
162
|
+
["2", r(J, I, u), t(r(J, I, u))],
|
|
163
|
+
["1", r(Z, U, u), t(r(Z, U, u))],
|
|
164
|
+
["a", r(I, U, u), t(r(I, U, u))],
|
|
165
|
+
["b", r(J, Z, u), t(r(J, Z, u))],
|
|
166
|
+
["c", r(xe, he, u), t(r(xe, he, u))],
|
|
167
|
+
["d", r(ke, pe, u), t(r(ke, pe, u))],
|
|
168
|
+
["e", r(Pe, me, u), t(r(Pe, me, u))],
|
|
169
|
+
["f", r(Ce, ge, u), t(r(Ce, ge, u))],
|
|
170
|
+
["g", r(Ee, ye, u), t(r(Ee, ye, u))],
|
|
171
|
+
["h", r(Le, we, u), t(r(Le, we, u))],
|
|
172
|
+
["i", r(Be, be, u), t(r(Be, be, u))],
|
|
173
|
+
["k", r(_, j, u), t(r(_, j, u))],
|
|
174
|
+
["l", r(ee, G, u), t(r(ee, G, u))],
|
|
175
|
+
["1", r(j, G, u), t(r(j, G, u))],
|
|
176
|
+
["2", r(_, ee, u), t(r(_, ee, u))],
|
|
177
|
+
["3", r(Te, Fe, u), t(r(Te, Fe, u))],
|
|
178
|
+
["4", r(qe, Ne, u), t(r(qe, Ne, u))],
|
|
179
|
+
["5", r(Ae, De, u), t(r(Ae, De, u))],
|
|
180
|
+
["6", r(z, O, u), t(r(z, O, u))],
|
|
181
|
+
["7", r(Xe, Ye, u), t(r(Xe, Ye, u))],
|
|
182
|
+
["8", r(Ve, Ue, u), t(r(Ve, Ue, u))],
|
|
183
|
+
["9", r(Ge, Ie, u), t(r(Ge, Ie, u))],
|
|
184
|
+
["10", r(oe, ne, u), t(r(oe, ne, u))],
|
|
185
|
+
["11", r(te, le, u), t(r(te, le, u))]
|
|
186
|
+
], Wo = [
|
|
187
187
|
o[
|
|
188
188
|
0
|
|
189
189
|
/* f11 */
|
|
@@ -557,30 +557,30 @@ const he = 23.6, So = {
|
|
|
557
557
|
/* e10 */
|
|
558
558
|
][3][0]
|
|
559
559
|
];
|
|
560
|
-
function
|
|
561
|
-
if (
|
|
560
|
+
function Ot(i) {
|
|
561
|
+
if (i.length === 0)
|
|
562
562
|
return "";
|
|
563
|
-
const [
|
|
564
|
-
let
|
|
565
|
-
for (const F of
|
|
566
|
-
|
|
567
|
-
return `${
|
|
563
|
+
const [B, ...v] = i;
|
|
564
|
+
let Q = `M ${R(fe(B[0]))} ${R(ve(B[1]))} L `;
|
|
565
|
+
for (const F of v)
|
|
566
|
+
Q += `${R(fe(F[0]))} ${R(ve(F[1]))} `;
|
|
567
|
+
return `${Q} Z`;
|
|
568
568
|
}
|
|
569
|
-
function R(
|
|
570
|
-
return
|
|
569
|
+
function R(i) {
|
|
570
|
+
return i.toFixed(8);
|
|
571
571
|
}
|
|
572
|
-
const
|
|
572
|
+
const Ao = {
|
|
573
573
|
viewBox: "0 0 50 50",
|
|
574
574
|
xmlns: "http://www.w3.org/2000/svg"
|
|
575
|
-
},
|
|
575
|
+
}, Do = ["textContent", "fill"], Ho = /* @__PURE__ */ fo({
|
|
576
576
|
__name: "Letter",
|
|
577
577
|
props: {
|
|
578
578
|
type: {}
|
|
579
579
|
},
|
|
580
|
-
setup(
|
|
581
|
-
return (
|
|
582
|
-
|
|
583
|
-
textContent:
|
|
580
|
+
setup(i) {
|
|
581
|
+
return (B, v) => (x(), C("svg", Ao, [
|
|
582
|
+
vo("text", {
|
|
583
|
+
textContent: ho(i.type),
|
|
584
584
|
"dominant-baseline": "middle",
|
|
585
585
|
"font-family": "sans-serif",
|
|
586
586
|
"font-size": "30",
|
|
@@ -590,23 +590,23 @@ const Wo = {
|
|
|
590
590
|
y: "27",
|
|
591
591
|
stroke: "oklch(37.3% 0.034 259.733)",
|
|
592
592
|
"stroke-width": "2",
|
|
593
|
-
fill:
|
|
594
|
-
}, null, 8,
|
|
593
|
+
fill: i.type === i.type.toLowerCase() ? "oklch(13% 0.028 261.692)" : "oklch(98.5% 0.002 247.839)"
|
|
594
|
+
}, null, 8, Do)
|
|
595
595
|
]));
|
|
596
596
|
}
|
|
597
|
-
}),
|
|
597
|
+
}), Oo = ["viewBox"], Xo = ["d", "fill"], Yo = ["d", "data-hexboard-position", "fill"], Ko = ["d", "fill"], Qo = ["d", "fill"], Vo = ["textContent", "x", "y"], Uo = ["cx", "cy", "fill"], Zo = ["viewBox"], Io = /* @__PURE__ */ fo({
|
|
598
598
|
__name: "Hexboard",
|
|
599
|
-
props: /* @__PURE__ */
|
|
599
|
+
props: /* @__PURE__ */ uo({
|
|
600
600
|
active: { type: Boolean, default: !1 },
|
|
601
601
|
autoselect: { type: Boolean, default: !1 },
|
|
602
602
|
flipped: { type: Boolean, default: !1 },
|
|
603
|
-
hexchess: { default: () =>
|
|
603
|
+
hexchess: { default: () => ao.init() },
|
|
604
604
|
highlight: { default: () => [] },
|
|
605
605
|
ignoreTurn: { type: Boolean, default: !1 },
|
|
606
606
|
options: { default: () => ({}) },
|
|
607
|
-
pieces: { default: () =>
|
|
607
|
+
pieces: { default: () => Ho },
|
|
608
608
|
playing: { type: [String, Boolean], default: !1 },
|
|
609
|
-
position: { default:
|
|
609
|
+
position: { default: No }
|
|
610
610
|
}, {
|
|
611
611
|
"mouseover-position": {
|
|
612
612
|
default: null,
|
|
@@ -624,215 +624,217 @@ const Wo = {
|
|
|
624
624
|
},
|
|
625
625
|
targetsModifiers: {}
|
|
626
626
|
}),
|
|
627
|
-
emits: /* @__PURE__ */
|
|
628
|
-
setup(
|
|
629
|
-
const
|
|
627
|
+
emits: /* @__PURE__ */ uo(["clickPosition", "move"], ["update:mouseover-position", "update:selected", "update:targets"]),
|
|
628
|
+
setup(i, { emit: B }) {
|
|
629
|
+
const v = i, Q = B, F = Zt(i, "mouseover-position"), b = Zt(i, "selected"), X = Zt(i, "targets"), Je = et({ x: 0, y: 0 }), M = et(null), ie = et(se()), h = et({
|
|
630
630
|
hexchess: null,
|
|
631
631
|
promotionEl: null,
|
|
632
632
|
promotionFrom: null,
|
|
633
633
|
promotionTo: null,
|
|
634
634
|
selected: null
|
|
635
|
-
}),
|
|
636
|
-
let
|
|
637
|
-
const
|
|
638
|
-
(s, f,
|
|
635
|
+
}), Xt = Co("svgEl"), Y = et(se());
|
|
636
|
+
let Yt = !1;
|
|
637
|
+
const po = W(() => h.value.hexchess ? [] : X.value), ce = W(() => h.value.hexchess ? h.value.hexchess : v.hexchess ? v.hexchess : ao.init()), mo = W(() => ce.value.board.reduce(
|
|
638
|
+
(s, f, c) => (f && c !== M.value && s.push({ piece: f, index: c }), s),
|
|
639
639
|
[]
|
|
640
|
-
)),
|
|
641
|
-
var s, f,
|
|
642
|
-
if (
|
|
640
|
+
)), Kt = W(() => typeof h.value.selected == "number" ? null : b.value), Gt = W(() => {
|
|
641
|
+
var s, f, c;
|
|
642
|
+
if (Qt.value)
|
|
643
643
|
return "grabbing";
|
|
644
|
-
if (!(!
|
|
645
|
-
if (
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
648
|
-
const g =
|
|
649
|
-
if ((
|
|
644
|
+
if (!(!v.active || F.value === null || h.value.hexchess)) {
|
|
645
|
+
if (b.value !== null && X.value.includes(F.value)) {
|
|
646
|
+
const d = (s = ce.value) == null ? void 0 : s.board[b.value];
|
|
647
|
+
if (d) {
|
|
648
|
+
const g = d === d.toLowerCase() ? "b" : "w", E = ((f = ce.value) == null ? void 0 : f.turn) === g;
|
|
649
|
+
if ((v.playing === !0 || E) && rt(b.value))
|
|
650
650
|
return "pointer";
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
if (
|
|
654
|
-
return
|
|
653
|
+
if (lt.value)
|
|
654
|
+
return v.playing === !0 || v.playing && Jt.value === ((c = ce.value) == null ? void 0 : c.turn) && v.playing === Jt.value ? "grab" : "pointer";
|
|
655
655
|
}
|
|
656
|
-
}),
|
|
657
|
-
x:
|
|
658
|
-
y:
|
|
659
|
-
})),
|
|
656
|
+
}), It = W(() => ({
|
|
657
|
+
x: Je.value.x - Y.value.width / 2,
|
|
658
|
+
y: Je.value.y - Y.value.height / 2
|
|
659
|
+
})), Qt = W(() => !v.hexchess || h.value.hexchess || M.value === null ? null : v.hexchess.board[M.value]), K = W(() => ({ ...qo, ...v.options })), Jt = W(() => lt.value ? lt.value === lt.value.toLowerCase() ? "b" : "w" : null), lt = W(() => {
|
|
660
660
|
var s;
|
|
661
|
-
return F.value === null ? null : ((s =
|
|
662
|
-
}),
|
|
663
|
-
var
|
|
664
|
-
const s = (
|
|
661
|
+
return F.value === null ? null : ((s = ce.value) == null ? void 0 : s.board[F.value]) ?? null;
|
|
662
|
+
}), st = W(() => {
|
|
663
|
+
var d;
|
|
664
|
+
const s = (d = h.value.hexchess) == null ? void 0 : d.board[h.value.selected ?? -1], f = s === (s == null ? void 0 : s.toUpperCase()), c = (g) => (E) => Fo(v.pieces, { ...E, type: g });
|
|
665
665
|
return {
|
|
666
|
-
n:
|
|
667
|
-
b:
|
|
668
|
-
r:
|
|
669
|
-
q:
|
|
666
|
+
n: c(f ? "N" : "n"),
|
|
667
|
+
b: c(f ? "B" : "b"),
|
|
668
|
+
r: c(f ? "R" : "r"),
|
|
669
|
+
q: c(f ? "Q" : "q")
|
|
670
670
|
};
|
|
671
671
|
});
|
|
672
672
|
Eo(() => {
|
|
673
|
-
|
|
674
|
-
}),
|
|
673
|
+
v.autoselect && so();
|
|
674
|
+
}), Lo(() => {
|
|
675
|
+
v.active && _t();
|
|
676
|
+
}), Bo(ro), jt(Gt, (s) => {
|
|
675
677
|
document.body.style.setProperty(
|
|
676
678
|
"cursor",
|
|
677
679
|
s === "grabbing" ? "grabbing" : null
|
|
678
680
|
);
|
|
679
|
-
}),
|
|
680
|
-
() =>
|
|
681
|
-
(s) => s ?
|
|
682
|
-
);
|
|
683
|
-
function
|
|
684
|
-
var
|
|
685
|
-
if (!
|
|
681
|
+
}), jt(
|
|
682
|
+
() => v.active,
|
|
683
|
+
(s) => s ? _t() : ro()
|
|
684
|
+
), jt(b, so);
|
|
685
|
+
function Vt(s, f) {
|
|
686
|
+
var E, re;
|
|
687
|
+
if (!X.value.includes(s.to))
|
|
686
688
|
return;
|
|
687
|
-
const
|
|
688
|
-
if (!
|
|
689
|
+
const c = (E = v.hexchess) == null ? void 0 : E.board[s.from];
|
|
690
|
+
if (!c)
|
|
689
691
|
return;
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
hexchess:
|
|
692
|
+
const d = c === c.toLowerCase() ? "b" : "w", g = ((re = v.hexchess) == null ? void 0 : re.turn) === d;
|
|
693
|
+
if (v.hexchess && (c === "p" || c === "P") && Ro(s.to, d)) {
|
|
694
|
+
const Ut = v.hexchess.clone();
|
|
695
|
+
Ut.board[s.from] = null, Ut.board[s.to] = c, h.value = {
|
|
696
|
+
hexchess: Ut,
|
|
695
697
|
promotionEl: (f == null ? void 0 : f.target) instanceof Element ? f.target : null,
|
|
696
698
|
promotionFrom: s.from,
|
|
697
699
|
promotionTo: s.to,
|
|
698
700
|
selected: s.to
|
|
699
|
-
}, (f == null ? void 0 : f.target) instanceof Element && (
|
|
701
|
+
}, (f == null ? void 0 : f.target) instanceof Element && (ie.value = f.target.getBoundingClientRect());
|
|
700
702
|
return;
|
|
701
703
|
}
|
|
702
|
-
|
|
704
|
+
rt(s.from) && (v.ignoreTurn || g) && to(s);
|
|
703
705
|
}
|
|
704
|
-
function
|
|
705
|
-
|
|
706
|
-
|
|
706
|
+
function _e() {
|
|
707
|
+
const s = h.value.promotionFrom;
|
|
708
|
+
h.value = {
|
|
709
|
+
hexchess: null,
|
|
710
|
+
promotionEl: null,
|
|
711
|
+
promotionFrom: null,
|
|
712
|
+
promotionTo: null,
|
|
713
|
+
selected: null
|
|
714
|
+
}, typeof s == "number" && (b.value = s), M.value = null, Yt = !0;
|
|
715
|
+
}
|
|
716
|
+
function go(s) {
|
|
717
|
+
var f, c;
|
|
718
|
+
return F.value === null ? K.value.labelColor : (f = ae(F.value)) != null && f.startsWith(s) || (c = ae(F.value)) != null && c.endsWith(s) ? K.value.labelActiveColor : K.value.labelInactiveColor;
|
|
719
|
+
}
|
|
720
|
+
function rt(s) {
|
|
721
|
+
var d;
|
|
722
|
+
const f = (d = v.hexchess) == null ? void 0 : d.board[s];
|
|
707
723
|
if (!f)
|
|
708
724
|
return !1;
|
|
709
|
-
const
|
|
710
|
-
return
|
|
725
|
+
const c = f === f.toLowerCase() ? "b" : "w";
|
|
726
|
+
return v.playing === !0 || v.playing === c;
|
|
711
727
|
}
|
|
712
|
-
function
|
|
713
|
-
|
|
714
|
-
return F.value === null ? Q.value.labelColor : (f = A(F.value)) != null && f.startsWith(s) || (a = A(F.value)) != null && a.endsWith(s) ? Q.value.labelActiveColor : Q.value.labelInactiveColor;
|
|
728
|
+
function _t() {
|
|
729
|
+
Je.value = { x: 0, y: 0 }, window.addEventListener("keyup", eo), window.addEventListener("pointermove", oo), window.addEventListener("pointerup", no), window.addEventListener("resize", ut), window.addEventListener("scroll", ut), window.addEventListener("touchmove", lo, { passive: !1 });
|
|
715
730
|
}
|
|
716
|
-
function
|
|
717
|
-
_e.value = { x: 0, y: 0 }, window.addEventListener("keyup", _t), window.addEventListener("pointermove", to), window.addEventListener("pointerup", no), window.addEventListener("resize", ct), window.addEventListener("scroll", ct), window.addEventListener("touchmove", oo, { passive: !1 });
|
|
718
|
-
}
|
|
719
|
-
function ct() {
|
|
731
|
+
function ut() {
|
|
720
732
|
var s;
|
|
721
|
-
|
|
733
|
+
ie.value = ((s = h.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? se();
|
|
722
734
|
}
|
|
723
|
-
function
|
|
724
|
-
if (
|
|
725
|
-
if (
|
|
726
|
-
|
|
735
|
+
function yo(s, f) {
|
|
736
|
+
if (v.active) {
|
|
737
|
+
if (Yt) {
|
|
738
|
+
Yt = !1;
|
|
727
739
|
return;
|
|
728
740
|
}
|
|
729
741
|
if (h.value.hexchess) {
|
|
730
|
-
h.value.selected !== s &&
|
|
742
|
+
h.value.selected !== s && _e();
|
|
731
743
|
return;
|
|
732
744
|
}
|
|
733
|
-
if (
|
|
734
|
-
const
|
|
735
|
-
|
|
745
|
+
if (b.value !== null && X.value.includes(s)) {
|
|
746
|
+
const c = new at({ from: b.value, to: s });
|
|
747
|
+
Vt(c, f);
|
|
736
748
|
return;
|
|
737
749
|
}
|
|
738
|
-
|
|
750
|
+
v.autoselect && !v.hexchess.board[s] && (b.value = null), Q("clickPosition", s);
|
|
739
751
|
}
|
|
740
752
|
}
|
|
741
|
-
function
|
|
753
|
+
function eo(s) {
|
|
742
754
|
if (s.key === "Escape") {
|
|
743
755
|
if (h.value.hexchess) {
|
|
744
|
-
|
|
756
|
+
_e();
|
|
745
757
|
return;
|
|
746
758
|
}
|
|
747
|
-
|
|
759
|
+
v.autoselect && (b.value = null);
|
|
748
760
|
}
|
|
749
761
|
}
|
|
750
|
-
function
|
|
751
|
-
|
|
762
|
+
function wo(s) {
|
|
763
|
+
F.value = s;
|
|
764
|
+
}
|
|
765
|
+
function bo() {
|
|
766
|
+
F.value = null;
|
|
767
|
+
}
|
|
768
|
+
function to(s) {
|
|
769
|
+
Q("move", s), it();
|
|
770
|
+
}
|
|
771
|
+
function xo(s, f) {
|
|
772
|
+
var E, re;
|
|
773
|
+
if (f.preventDefault(), h.value.hexchess || b.value !== null && X.value.includes(s))
|
|
774
|
+
return;
|
|
775
|
+
const c = (E = v.hexchess) == null ? void 0 : E.board[s];
|
|
776
|
+
if (!c || (v.autoselect && (b.value = s), !rt(s)))
|
|
777
|
+
return;
|
|
778
|
+
const d = c === c.toLowerCase() ? "b" : "w", g = ((re = v.hexchess) == null ? void 0 : re.turn) === d;
|
|
779
|
+
!v.ignoreTurn && !g || (M.value = s, Je.value = { x: f.clientX, y: f.clientY }, Xt.value instanceof Element && (Y.value = Xt.value.getBoundingClientRect()));
|
|
780
|
+
}
|
|
781
|
+
function oo(s) {
|
|
782
|
+
v.active && (Je.value = { x: s.clientX, y: s.clientY });
|
|
752
783
|
}
|
|
753
|
-
function
|
|
754
|
-
var
|
|
755
|
-
if (f.stopPropagation(),
|
|
756
|
-
let
|
|
784
|
+
function ko(s, f) {
|
|
785
|
+
var c;
|
|
786
|
+
if (f.stopPropagation(), M.value !== null) {
|
|
787
|
+
let d = s;
|
|
757
788
|
const g = document.elementFromPoint(
|
|
758
789
|
f.clientX,
|
|
759
790
|
f.clientY
|
|
760
|
-
),
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
if (
|
|
791
|
+
), E = g == null ? void 0 : g.getAttribute("data-hexboard-position");
|
|
792
|
+
E !== null && (d = Number(E));
|
|
793
|
+
const re = new at({ from: M.value, to: d });
|
|
794
|
+
if (Vt(re, f), h.value.hexchess)
|
|
764
795
|
return;
|
|
765
|
-
|
|
796
|
+
M.value = null, Y.value = se();
|
|
766
797
|
return;
|
|
767
798
|
}
|
|
768
|
-
if (
|
|
769
|
-
const
|
|
770
|
-
return
|
|
799
|
+
if (b.value !== null && X.value.includes(s)) {
|
|
800
|
+
const d = new at({ from: b.value, to: s });
|
|
801
|
+
return Vt(d, f), h.value.hexchess, void 0;
|
|
771
802
|
}
|
|
772
803
|
if (h.value.hexchess) {
|
|
773
|
-
|
|
804
|
+
_e();
|
|
774
805
|
return;
|
|
775
806
|
}
|
|
776
|
-
if ((
|
|
777
|
-
|
|
807
|
+
if ((c = v.hexchess) != null && c.board[s]) {
|
|
808
|
+
M.value = null, Y.value = se();
|
|
778
809
|
return;
|
|
779
810
|
}
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
function et() {
|
|
783
|
-
const s = h.value.promotionFrom;
|
|
784
|
-
h.value = {
|
|
785
|
-
hexchess: null,
|
|
786
|
-
promotionEl: null,
|
|
787
|
-
promotionFrom: null,
|
|
788
|
-
promotionTo: null,
|
|
789
|
-
selected: null
|
|
790
|
-
}, typeof s == "number" && (L.value = s, Y.value = d.hexchess.movesFrom(s).map((f) => f.to) ?? []), B.value = null, Qt = !0;
|
|
791
|
-
}
|
|
792
|
-
function yo(s, f) {
|
|
793
|
-
var C, ie, fe;
|
|
794
|
-
if (f.preventDefault(), h.value.hexchess)
|
|
795
|
-
return;
|
|
796
|
-
const a = (C = d.hexchess) == null ? void 0 : C.board[s];
|
|
797
|
-
if (!a || (d.autoselect && (L.value = s, Y.value = ((ie = d.hexchess) == null ? void 0 : ie.movesFrom(s).map((Po) => Po.to)) ?? []), !ut(s)))
|
|
798
|
-
return;
|
|
799
|
-
const v = a === a.toLowerCase() ? "b" : "w", g = ((fe = d.hexchess) == null ? void 0 : fe.turn) === v;
|
|
800
|
-
!d.ignoreTurn && !g || (B.value = s, _e.value = { x: f.clientX, y: f.clientY }, Kt.value instanceof Element && (K.value = Kt.value.getBoundingClientRect()));
|
|
801
|
-
}
|
|
802
|
-
function bo(s) {
|
|
803
|
-
F.value = s;
|
|
804
|
-
}
|
|
805
|
-
function xo() {
|
|
806
|
-
F.value = null;
|
|
807
|
-
}
|
|
808
|
-
function to(s) {
|
|
809
|
-
d.active && (_e.value = { x: s.clientX, y: s.clientY });
|
|
810
|
-
}
|
|
811
|
-
function oo(s) {
|
|
812
|
-
B.value !== null && s.preventDefault();
|
|
811
|
+
it();
|
|
813
812
|
}
|
|
814
813
|
function no() {
|
|
815
814
|
if (h.value.hexchess) {
|
|
816
|
-
|
|
815
|
+
_e();
|
|
817
816
|
return;
|
|
818
817
|
}
|
|
819
|
-
if (
|
|
820
|
-
|
|
818
|
+
if (M.value !== null) {
|
|
819
|
+
M.value = null, Y.value = se();
|
|
821
820
|
return;
|
|
822
821
|
}
|
|
823
|
-
|
|
822
|
+
it();
|
|
823
|
+
}
|
|
824
|
+
function lo(s) {
|
|
825
|
+
M.value !== null && s.preventDefault();
|
|
824
826
|
}
|
|
825
|
-
function
|
|
826
|
-
if (typeof h.value.promotionFrom == "number" &&
|
|
827
|
-
const f = new
|
|
827
|
+
function Po(s) {
|
|
828
|
+
if (typeof h.value.promotionFrom == "number" && rt(h.value.promotionFrom)) {
|
|
829
|
+
const f = new at({
|
|
828
830
|
from: h.value.promotionFrom ?? 0,
|
|
829
831
|
to: h.value.promotionTo ?? 0,
|
|
830
832
|
promotion: s
|
|
831
833
|
});
|
|
832
|
-
|
|
834
|
+
to(f);
|
|
833
835
|
}
|
|
834
836
|
}
|
|
835
|
-
function
|
|
837
|
+
function se() {
|
|
836
838
|
return {
|
|
837
839
|
bottom: 0,
|
|
838
840
|
height: 0,
|
|
@@ -844,151 +846,148 @@ const Wo = {
|
|
|
844
846
|
y: 0
|
|
845
847
|
};
|
|
846
848
|
}
|
|
847
|
-
function
|
|
848
|
-
document.body.style.setProperty("cursor", null),
|
|
849
|
+
function it() {
|
|
850
|
+
document.body.style.setProperty("cursor", null), M.value = null, b.value = null, h.value = {
|
|
849
851
|
hexchess: null,
|
|
850
852
|
promotionEl: null,
|
|
851
853
|
promotionFrom: null,
|
|
852
854
|
promotionTo: null,
|
|
853
855
|
selected: null
|
|
854
|
-
},
|
|
856
|
+
}, Y.value = se(), X.value = [];
|
|
857
|
+
}
|
|
858
|
+
function so() {
|
|
859
|
+
var s;
|
|
860
|
+
typeof b.value == "number" ? X.value = ((s = v.hexchess) == null ? void 0 : s.movesFrom(b.value).map((f) => f.to)) ?? [] : X.value = [];
|
|
855
861
|
}
|
|
856
|
-
function
|
|
857
|
-
|
|
862
|
+
function ro() {
|
|
863
|
+
it(), window.removeEventListener("keyup", eo), window.removeEventListener("pointermove", oo), window.removeEventListener("pointerup", no), window.removeEventListener("resize", ut), window.removeEventListener("scroll", ut), window.removeEventListener("touchmove", lo);
|
|
858
864
|
}
|
|
859
|
-
return (s, f) => (
|
|
860
|
-
(
|
|
865
|
+
return (s, f) => (x(), C("div", null, [
|
|
866
|
+
(x(), C("svg", {
|
|
861
867
|
xmlns: "http://www.w3.org/2000/svg",
|
|
862
868
|
ref_key: "svgEl",
|
|
863
|
-
ref:
|
|
864
|
-
style:
|
|
865
|
-
viewBox: `0 0 ${
|
|
869
|
+
ref: Xt,
|
|
870
|
+
style: ct({ cursor: Gt.value }),
|
|
871
|
+
viewBox: `0 0 ${a(de)} ${a(de)}`
|
|
866
872
|
}, [
|
|
867
|
-
|
|
868
|
-
d:
|
|
869
|
-
fill:
|
|
873
|
+
vo("path", {
|
|
874
|
+
d: a(Ot)(a(Wo)),
|
|
875
|
+
fill: K.value.colors[1],
|
|
870
876
|
style: { pointerEvents: "none" }
|
|
871
|
-
}, null, 8,
|
|
872
|
-
(
|
|
877
|
+
}, null, 8, Xo),
|
|
878
|
+
(x(!0), C(ot, null, nt(a(o), (c, d) => (x(), C("path", Mo(
|
|
873
879
|
{ ref_for: !0 },
|
|
874
|
-
|
|
875
|
-
onClick: (g) =>
|
|
876
|
-
onMouseenter: () =>
|
|
877
|
-
onMouseleave: () =>
|
|
878
|
-
onPointerdown: (g) =>
|
|
879
|
-
onPointerup: (g) =>
|
|
880
|
+
i.active ? {
|
|
881
|
+
onClick: (g) => yo(d, g),
|
|
882
|
+
onMouseenter: () => wo(d),
|
|
883
|
+
onMouseleave: () => bo(),
|
|
884
|
+
onPointerdown: (g) => xo(d, g),
|
|
885
|
+
onPointerup: (g) => ko(d, g)
|
|
880
886
|
} : {},
|
|
881
887
|
{
|
|
882
|
-
d:
|
|
883
|
-
"data-hexboard-position":
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
key: v
|
|
888
|
+
d: a(Ot)(i.flipped ? c[4] : c[3]),
|
|
889
|
+
"data-hexboard-position": d,
|
|
890
|
+
fill: K.value.colors[a(o)[d][0]],
|
|
891
|
+
key: d
|
|
887
892
|
}
|
|
888
|
-
), null, 16,
|
|
889
|
-
(
|
|
890
|
-
d:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
key: `highlight-${a}`,
|
|
893
|
+
), null, 16, Yo))), 128)),
|
|
894
|
+
(x(!0), C(ot, null, nt(i.highlight, (c) => (x(), C("path", {
|
|
895
|
+
d: a(Ot)(i.flipped ? a(o)[c][4] : a(o)[c][3]),
|
|
896
|
+
fill: K.value.highlightColor,
|
|
897
|
+
key: `highlight-${c}`,
|
|
894
898
|
style: { pointerEvents: "none" }
|
|
895
|
-
}, null, 8,
|
|
896
|
-
typeof
|
|
899
|
+
}, null, 8, Ko))), 128)),
|
|
900
|
+
typeof Kt.value == "number" ? (x(), C("path", {
|
|
897
901
|
key: 0,
|
|
898
|
-
d:
|
|
899
|
-
|
|
900
|
-
fill: Q.value.selectedColor,
|
|
902
|
+
d: a(Ot)(i.flipped ? a(o)[Kt.value][4] : a(o)[Kt.value][3]),
|
|
903
|
+
fill: K.value.selectedColor,
|
|
901
904
|
ref: "selectedEl",
|
|
902
905
|
style: { pointerEvents: "none" }
|
|
903
|
-
}, null, 8,
|
|
904
|
-
|
|
905
|
-
textContent:
|
|
906
|
+
}, null, 8, Qo)) : tt("", !0),
|
|
907
|
+
K.value.labels ? (x(!0), C(ot, { key: 1 }, nt(a(zo), ([c, d, g], E) => (x(), C("text", {
|
|
908
|
+
textContent: ho(c),
|
|
906
909
|
"dominant-baseline": "central",
|
|
907
910
|
"text-anchor": "middle",
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
fill: mo(a),
|
|
911
|
+
key: `label-${E}`,
|
|
912
|
+
style: ct({
|
|
913
|
+
fill: go(c),
|
|
912
914
|
fontSize: ".5px",
|
|
913
915
|
pointerEvents: "none",
|
|
914
916
|
userSelect: "none"
|
|
915
917
|
}),
|
|
916
|
-
x:
|
|
917
|
-
y:
|
|
918
|
-
}, null, 12,
|
|
919
|
-
|
|
920
|
-
"data-piece-type":
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
key: `piece-${c(A)(v)}`,
|
|
918
|
+
x: a(R)(a(fe)(i.flipped ? g[0] : d[0])),
|
|
919
|
+
y: a(R)(a(ve)(i.flipped ? g[1] : d[1]))
|
|
920
|
+
}, null, 12, Vo))), 128)) : tt("", !0),
|
|
921
|
+
ce.value ? (x(!0), C(ot, { key: 2 }, nt(mo.value, ({ piece: c, index: d }) => (x(), io(co(i.pieces), {
|
|
922
|
+
"data-piece-type": c,
|
|
923
|
+
height: a(V),
|
|
924
|
+
key: `piece-${a(ae)(d)}`,
|
|
924
925
|
style: { pointerEvents: "none" },
|
|
925
|
-
type:
|
|
926
|
-
width:
|
|
927
|
-
x:
|
|
928
|
-
y:
|
|
929
|
-
}, null, 8, ["data-piece-type", "
|
|
930
|
-
(
|
|
931
|
-
cx:
|
|
932
|
-
cy:
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
key: `target-${c(A)(a)}`,
|
|
926
|
+
type: c,
|
|
927
|
+
width: a(V),
|
|
928
|
+
x: a(R)(a(fe)(a(o)[d][i.flipped ? 2 : 1][0] - a(V) / 2)),
|
|
929
|
+
y: a(R)(a(ve)(a(o)[d][i.flipped ? 2 : 1][1] + a(V) / 2))
|
|
930
|
+
}, null, 8, ["data-piece-type", "height", "type", "width", "x", "y"]))), 128)) : tt("", !0),
|
|
931
|
+
(x(!0), C(ot, null, nt(po.value, (c) => (x(), C("circle", {
|
|
932
|
+
cx: a(R)(a(fe)(a(o)[c][i.flipped ? 2 : 1][0])),
|
|
933
|
+
cy: a(R)(a(ve)(a(o)[c][i.flipped ? 2 : 1][1])),
|
|
934
|
+
fill: K.value.targetColor,
|
|
935
|
+
key: `target-${a(ae)(c)}`,
|
|
936
936
|
r: 0.3,
|
|
937
937
|
style: { pointerEvents: "none" }
|
|
938
|
-
}, null, 8,
|
|
939
|
-
], 12,
|
|
940
|
-
|
|
938
|
+
}, null, 8, Uo))), 128))
|
|
939
|
+
], 12, Oo)),
|
|
940
|
+
Qt.value ? (x(), C("svg", {
|
|
941
941
|
key: 0,
|
|
942
|
-
"data-testid": "drag-piece",
|
|
943
942
|
xmlns: "http://www.w3.org/2000/svg",
|
|
944
|
-
style:
|
|
945
|
-
height:
|
|
943
|
+
style: ct({
|
|
944
|
+
height: Y.value.height + "px",
|
|
946
945
|
left: "0px",
|
|
947
946
|
pointerEvents: "none",
|
|
948
947
|
position: "fixed",
|
|
949
948
|
top: "0px",
|
|
950
|
-
transform: `translate(${
|
|
951
|
-
width:
|
|
949
|
+
transform: `translate(${It.value.x}px, ${It.value.y}px) scale(1.1)`,
|
|
950
|
+
width: Y.value.width + "px",
|
|
952
951
|
willChange: "transform"
|
|
953
952
|
}),
|
|
954
|
-
viewBox: `0 0 ${
|
|
953
|
+
viewBox: `0 0 ${a(de)} ${a(de)}`
|
|
955
954
|
}, [
|
|
956
|
-
(
|
|
957
|
-
height:
|
|
955
|
+
(x(), io(co(i.pieces), {
|
|
956
|
+
height: a(V),
|
|
958
957
|
style: { pointerEvents: "none" },
|
|
959
|
-
type:
|
|
960
|
-
width:
|
|
961
|
-
x:
|
|
962
|
-
y:
|
|
958
|
+
type: Qt.value,
|
|
959
|
+
width: a(V),
|
|
960
|
+
x: a(R)(a(fe)(a(V) / -2)),
|
|
961
|
+
y: a(R)(a(ve)(a(V) / 2))
|
|
963
962
|
}, null, 8, ["height", "type", "width", "x", "y"]))
|
|
964
|
-
], 12,
|
|
965
|
-
typeof h.value.selected == "number" ? (
|
|
963
|
+
], 12, Zo)) : tt("", !0),
|
|
964
|
+
typeof h.value.selected == "number" ? (x(), C("div", {
|
|
966
965
|
key: 1,
|
|
967
|
-
style:
|
|
968
|
-
height:
|
|
969
|
-
left:
|
|
966
|
+
style: ct({
|
|
967
|
+
height: ie.value.height + "px",
|
|
968
|
+
left: ie.value.left + "px",
|
|
970
969
|
position: "fixed",
|
|
971
|
-
top:
|
|
972
|
-
width:
|
|
970
|
+
top: ie.value.top + "px",
|
|
971
|
+
width: ie.value.width + "px"
|
|
973
972
|
}),
|
|
974
|
-
onPointerup: f[0] || (f[0] =
|
|
973
|
+
onPointerup: f[0] || (f[0] = $o(() => {
|
|
975
974
|
}, ["stop"]))
|
|
976
975
|
}, [
|
|
977
|
-
|
|
978
|
-
b:
|
|
979
|
-
cancel:
|
|
980
|
-
file:
|
|
981
|
-
n:
|
|
982
|
-
promote:
|
|
983
|
-
q:
|
|
984
|
-
r:
|
|
985
|
-
rank: Number(
|
|
976
|
+
To(s.$slots, "promotion", {
|
|
977
|
+
b: st.value.b,
|
|
978
|
+
cancel: _e,
|
|
979
|
+
file: a(ae)(h.value.selected)[0],
|
|
980
|
+
n: st.value.n,
|
|
981
|
+
promote: Po,
|
|
982
|
+
q: st.value.q,
|
|
983
|
+
r: st.value.r,
|
|
984
|
+
rank: Number(a(ae)(h.value.selected).slice(1))
|
|
986
985
|
})
|
|
987
|
-
], 36)) :
|
|
986
|
+
], 36)) : tt("", !0)
|
|
988
987
|
]));
|
|
989
988
|
}
|
|
990
989
|
});
|
|
991
990
|
export {
|
|
992
|
-
|
|
993
|
-
|
|
991
|
+
Io as Hexboard,
|
|
992
|
+
qo as defaultOptions
|
|
994
993
|
};
|