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