@bedard/hexboard 0.0.5 → 0.0.7
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 +3 -1
- package/dist/index.js +404 -458
- package/package.json +1 -1
- package/src/lib/components/hexboard/Hexboard.vue +2 -2
- package/src/lib/components/hexboard/pieces/Letter.vue +28 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/components/hexboard/pieces/Celtic.vue +0 -22
- package/src/lib/components/hexboard/pieces/Fantasy.vue +0 -22
- package/src/lib/components/hexboard/pieces/Gioco.vue +0 -22
- package/src/lib/components/hexboard/pieces/Spatial.vue +0 -22
- package/src/lib/components/hexboard/pieces/index.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Hexchess as
|
|
3
|
-
function
|
|
4
|
-
return [
|
|
1
|
+
import { defineComponent as ao, createElementBlock as P, openBlock as b, createElementVNode as fo, toDisplayString as vo, mergeModels as so, useModel as Zt, shallowRef as et, useTemplateRef as Co, computed as z, onMounted as Eo, onUnmounted as $o, watch as ro, createCommentVNode as tt, unref as f, normalizeStyle as at, Fragment as ot, renderList as nt, mergeProps as Lo, createBlock as io, resolveDynamicComponent as uo, withModifiers as Bo, renderSlot as Mo, h as To } from "vue";
|
|
2
|
+
import { Hexchess as co, position as W, San as ft, isPromotionPosition as Fo } from "@bedard/hexchess";
|
|
3
|
+
function r(u, $, d) {
|
|
4
|
+
return [u[0] + d * ($[0] - u[0]), u[1] + d * ($[1] - u[1])];
|
|
5
5
|
}
|
|
6
|
-
function n(
|
|
7
|
-
return
|
|
6
|
+
function n(u) {
|
|
7
|
+
return u.map(t);
|
|
8
8
|
}
|
|
9
|
-
function e(
|
|
9
|
+
function e(u) {
|
|
10
10
|
return [
|
|
11
|
-
x(
|
|
12
|
-
x(
|
|
13
|
-
x(
|
|
14
|
-
x(
|
|
15
|
-
x(
|
|
16
|
-
x(
|
|
11
|
+
x(u, -300, ie),
|
|
12
|
+
x(u, 0, ie),
|
|
13
|
+
x(u, -60, ie),
|
|
14
|
+
x(u, -120, ie),
|
|
15
|
+
x(u, -180, ie),
|
|
16
|
+
x(u, -240, ie)
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
-
function x(
|
|
20
|
-
const
|
|
19
|
+
function x(u, $, d) {
|
|
20
|
+
const Q = Ro($);
|
|
21
21
|
return [
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
d * Math.cos(Q) + u[0],
|
|
23
|
+
d * Math.sin(Q) + u[1]
|
|
24
24
|
];
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function Ro(u) {
|
|
27
|
+
return u * (Math.PI / 180);
|
|
28
28
|
}
|
|
29
|
-
function t(
|
|
30
|
-
return [-
|
|
29
|
+
function t(u) {
|
|
30
|
+
return [-u[0], -u[1]];
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return [
|
|
32
|
+
function l(u, $) {
|
|
33
|
+
return [u[0] + $[0], u[1] + $[1]];
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return ve / 2 +
|
|
35
|
+
function fe(u) {
|
|
36
|
+
return ve / 2 + u;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return ve / 2 -
|
|
38
|
+
function de(u) {
|
|
39
|
+
return ve / 2 - u;
|
|
40
40
|
}
|
|
41
|
-
const ve = 23.6,
|
|
41
|
+
const ve = 23.6, So = {
|
|
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 ve = 23.6, $t = {
|
|
|
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,
|
|
60
|
+
}, qo = "b/qbk/n1b1n/r5r/ppppppppp/11/5P5/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 w - 0 1", i = 1.7, V = 1.7, ie = 2 / Math.sqrt(3), p = ie * (Math.sqrt(3) / 2) * 2, w = p * 2, y = p * 3, k = p * 4, E = p * 5, m = [0, 0], A = x(m, 150, E), R = x(m, 150, k), D = x(m, 150, y), S = x(m, 150, w), M = x(m, 150, p), T = x(m, 30, p), q = x(m, 30, w), H = x(m, 30, y), N = x(m, 30, k), O = x(m, 30, E), U = l(A, [0, -E]), Z = l(R, [0, -E]), he = l(D, [0, -E]), pe = l(S, [0, -E]), me = l(M, [0, -E]), ge = l(m, [0, -E]), we = l(T, [0, -E]), ye = l(q, [0, -E]), be = l(H, [0, -E]), j = l(N, [0, -E]), G = l(O, [0, -E]), J = l(A, [0, -k]), I = l(R, [0, -k]), xe = l(D, [0, -k]), ke = l(S, [0, -k]), Pe = l(M, [0, -k]), Ce = l(m, [0, -k]), Ee = l(T, [0, -k]), $e = l(q, [0, -k]), Le = l(H, [0, -k]), _ = l(N, [0, -k]), ee = l(O, [0, -k]), Be = l(A, [0, -y]), Me = l(R, [0, -y]), dt = l(D, [0, -y]), vt = l(S, [0, -y]), ht = l(M, [0, -y]), pt = l(m, [0, -y]), mt = l(T, [0, -y]), gt = l(q, [0, -y]), wt = l(H, [0, -y]), Te = l(N, [0, -y]), Fe = l(O, [0, -y]), Re = l(A, [0, -w]), Se = l(R, [0, -w]), yt = l(D, [0, -w]), bt = l(S, [0, -w]), xt = l(M, [0, -w]), kt = l(m, [0, -w]), Pt = l(T, [0, -w]), Ct = l(q, [0, -w]), Et = l(H, [0, -w]), qe = l(N, [0, -w]), Ne = l(O, [0, -w]), ze = l(A, [0, -p]), We = l(R, [0, -p]), $t = l(D, [0, -p]), Lt = l(S, [0, -p]), Bt = l(M, [0, -p]), Mt = l(m, [0, -p]), Tt = l(T, [0, -p]), Ft = l(q, [0, -p]), Rt = l(H, [0, -p]), Ae = l(N, [0, -p]), De = l(O, [0, -p]), He = l(R, [0, p]), Oe = l(D, [0, p]), St = l(S, [0, p]), qt = l(M, [0, p]), Nt = l(m, [0, p]), zt = l(T, [0, p]), Wt = l(q, [0, p]), Xe = l(H, [0, p]), Ye = l(N, [0, p]), Ke = l(D, [0, w]), Qe = l(S, [0, w]), At = l(M, [0, w]), Dt = l(m, [0, w]), Ht = l(T, [0, w]), Ve = l(q, [0, w]), Ue = l(H, [0, w]), Ze = l(S, [0, y]), je = l(M, [0, y]), Ot = l(m, [0, y]), Ge = l(T, [0, y]), Je = l(q, [0, y]), te = l(M, [0, k]), oe = l(m, [0, k]), ne = l(T, [0, k]), le = l(m, [0, E]), 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
65
|
[0, Ze, t(Ze), e(Ze), n(e(Ze))],
|
|
66
|
-
[2,
|
|
67
|
-
[1,
|
|
68
|
-
[2,
|
|
69
|
-
[0,
|
|
66
|
+
[2, je, t(je), e(je), n(e(je))],
|
|
67
|
+
[1, Ot, t(Ot), e(Ot), n(e(Ot))],
|
|
68
|
+
[2, Ge, t(Ge), e(Ge), n(e(Ge))],
|
|
69
|
+
[0, Je, t(Je), e(Je), n(e(Je))],
|
|
70
70
|
[2, Ke, t(Ke), e(Ke), n(e(Ke))],
|
|
71
71
|
[1, Qe, t(Qe), e(Qe), n(e(Qe))],
|
|
72
|
-
[0,
|
|
73
|
-
[2,
|
|
74
|
-
[0,
|
|
75
|
-
[1,
|
|
76
|
-
[2,
|
|
77
|
-
[1,
|
|
78
|
-
[0,
|
|
79
|
-
[2,
|
|
80
|
-
[1,
|
|
81
|
-
[0,
|
|
82
|
-
[1,
|
|
83
|
-
[2,
|
|
84
|
-
[0,
|
|
85
|
-
[1,
|
|
86
|
-
[0,
|
|
87
|
-
[2,
|
|
88
|
-
[1,
|
|
89
|
-
[0,
|
|
90
|
-
[2,
|
|
72
|
+
[0, At, t(At), e(At), n(e(At))],
|
|
73
|
+
[2, Dt, t(Dt), e(Dt), n(e(Dt))],
|
|
74
|
+
[0, Ht, t(Ht), e(Ht), n(e(Ht))],
|
|
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, St, t(St), e(St), n(e(St))],
|
|
80
|
+
[1, qt, t(qt), e(qt), n(e(qt))],
|
|
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, 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
|
+
[2, R, t(R), e(R), n(e(R))],
|
|
88
|
+
[1, D, t(D), e(D), n(e(D))],
|
|
89
|
+
[0, S, t(S), e(S), n(e(S))],
|
|
90
|
+
[2, M, t(M), e(M), n(e(M))],
|
|
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, q, t(q), e(q), n(e(q))],
|
|
94
|
-
[1,
|
|
95
|
-
[2,
|
|
96
|
-
[0,
|
|
97
|
-
[1,
|
|
94
|
+
[1, H, t(H), e(H), n(e(H))],
|
|
95
|
+
[2, N, t(N), e(N), n(e(N))],
|
|
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, $t, t($t), e($t), n(e($t))],
|
|
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, 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, 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, bt, t(bt), e(bt), n(e(bt))],
|
|
112
|
+
[1, xt, t(xt), e(xt), n(e(xt))],
|
|
113
|
+
[0, kt, t(kt), e(kt), n(e(kt))],
|
|
114
|
+
[1, Pt, t(Pt), e(Pt), n(e(Pt))],
|
|
115
|
+
[2, Ct, t(Ct), e(Ct), n(e(Ct))],
|
|
116
|
+
[0, Et, t(Et), e(Et), n(e(Et))],
|
|
117
|
+
[1, qe, t(qe), e(qe), n(e(qe))],
|
|
118
|
+
[2, Ne, t(Ne), e(Ne), n(e(Ne))],
|
|
119
|
+
[0, Be, t(Be), e(Be), n(e(Be))],
|
|
120
|
+
[2, Me, t(Me), e(Me), n(e(Me))],
|
|
121
|
+
[1, dt, t(dt), e(dt), n(e(dt))],
|
|
122
|
+
[0, vt, t(vt), e(vt), n(e(vt))],
|
|
123
|
+
[2, ht, t(ht), e(ht), n(e(ht))],
|
|
124
|
+
[1, pt, t(pt), e(pt), n(e(pt))],
|
|
125
|
+
[2, mt, t(mt), e(mt), n(e(mt))],
|
|
126
|
+
[0, gt, t(gt), e(gt), n(e(gt))],
|
|
127
|
+
[1, wt, t(wt), e(wt), n(e(wt))],
|
|
128
|
+
[2, Te, t(Te), e(Te), n(e(Te))],
|
|
98
129
|
[0, Fe, t(Fe), e(Fe), n(e(Fe))],
|
|
99
|
-
[
|
|
100
|
-
[
|
|
101
|
-
[
|
|
102
|
-
[
|
|
103
|
-
[0,
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
[1, Ne, t(Ne), e(Ne), n(e(Ne))],
|
|
130
|
+
[1, J, t(J), e(J), n(e(J))],
|
|
131
|
+
[0, I, t(I), e(I), n(e(I))],
|
|
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
|
+
[1, $e, t($e), e($e), n(e($e))],
|
|
108
138
|
[2, Le, t(Le), e(Le), n(e(Le))],
|
|
109
|
-
[1, qe, t(qe), e(qe), n(e(qe))],
|
|
110
|
-
[0, k1, t(k1), e(k1), n(e(k1))],
|
|
111
|
-
[2, y1, t(y1), e(y1), n(e(y1))],
|
|
112
|
-
[1, x1, t(x1), e(x1), n(e(x1))],
|
|
113
|
-
[0, M1, t(M1), e(M1), n(e(M1))],
|
|
114
|
-
[1, z1, t(z1), e(z1), n(e(z1))],
|
|
115
|
-
[2, G1, t(G1), e(G1), n(e(G1))],
|
|
116
|
-
[0, P1, t(P1), e(P1), n(e(P1))],
|
|
117
|
-
[1, Oe, t(Oe), e(Oe), n(e(Oe))],
|
|
118
|
-
[2, je, t(je), e(je), n(e(je))],
|
|
119
|
-
[0, Te, t(Te), e(Te), n(e(Te))],
|
|
120
|
-
[2, Ee, t(Ee), e(Ee), n(e(Ee))],
|
|
121
|
-
[1, p1, t(p1), e(p1), n(e(p1))],
|
|
122
|
-
[0, h1, t(h1), e(h1), n(e(h1))],
|
|
123
|
-
[2, v1, t(v1), e(v1), n(e(v1))],
|
|
124
|
-
[1, g1, t(g1), e(g1), n(e(g1))],
|
|
125
|
-
[2, w1, t(w1), e(w1), n(e(w1))],
|
|
126
|
-
[0, m1, t(m1), e(m1), n(e(m1))],
|
|
127
|
-
[1, b1, t(b1), e(b1), n(e(b1))],
|
|
128
|
-
[2, Be, t(Be), e(Be), n(e(Be))],
|
|
129
|
-
[0, $e, t($e), e($e), n(e($e))],
|
|
130
|
-
[1, I, t(I), e(I), n(e(I))],
|
|
131
139
|
[0, _, t(_), e(_), n(e(_))],
|
|
132
|
-
[
|
|
133
|
-
[
|
|
134
|
-
[
|
|
135
|
-
[
|
|
136
|
-
[
|
|
137
|
-
[1, Ce, t(Ce), e(Ce), n(e(Ce))],
|
|
138
|
-
[2, Se, t(Se), e(Se), n(e(Se))],
|
|
139
|
-
[0, ee, t(ee), e(ee), n(e(ee))],
|
|
140
|
-
[1, te, t(te), e(te), n(e(te))],
|
|
141
|
-
[2, X, t(X), e(X), n(e(X))],
|
|
142
|
-
[1, Y, t(Y), e(Y), n(e(Y))],
|
|
143
|
-
[0, ge, t(ge), e(ge), n(e(ge))],
|
|
144
|
-
[2, we, t(we), e(we), n(e(we))],
|
|
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
145
|
[1, me, t(me), e(me), n(e(me))],
|
|
146
|
-
[0,
|
|
147
|
-
[1,
|
|
146
|
+
[0, ge, t(ge), e(ge), n(e(ge))],
|
|
147
|
+
[1, we, t(we), e(we), n(e(we))],
|
|
148
148
|
[2, ye, t(ye), e(ye), n(e(ye))],
|
|
149
|
-
[0,
|
|
150
|
-
[1,
|
|
151
|
-
[2,
|
|
152
|
-
],
|
|
153
|
-
["11",
|
|
154
|
-
["10",
|
|
155
|
-
["9",
|
|
156
|
-
["8",
|
|
157
|
-
["7",
|
|
158
|
-
["6",
|
|
159
|
-
["5",
|
|
160
|
-
["4",
|
|
161
|
-
["3",
|
|
162
|
-
["2",
|
|
163
|
-
["1",
|
|
164
|
-
["a",
|
|
165
|
-
["b",
|
|
166
|
-
["c",
|
|
167
|
-
["d",
|
|
168
|
-
["e",
|
|
169
|
-
["f",
|
|
170
|
-
["g",
|
|
171
|
-
["h",
|
|
172
|
-
["i",
|
|
173
|
-
["k",
|
|
174
|
-
["l",
|
|
175
|
-
["1",
|
|
176
|
-
["2",
|
|
177
|
-
["3",
|
|
178
|
-
["4",
|
|
179
|
-
["5",
|
|
180
|
-
["6",
|
|
181
|
-
["7",
|
|
182
|
-
["8",
|
|
183
|
-
["9",
|
|
184
|
-
["10",
|
|
185
|
-
["11",
|
|
186
|
-
],
|
|
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))]
|
|
152
|
+
], No = [
|
|
153
|
+
["11", r(ne, le, i), t(r(ne, le, i))],
|
|
154
|
+
["10", r(oe, te, i), t(r(oe, te, i))],
|
|
155
|
+
["9", r(je, Ze, i), t(r(je, Ze, i))],
|
|
156
|
+
["8", r(Qe, Ke, i), t(r(Qe, Ke, i))],
|
|
157
|
+
["7", r(Oe, He, i), t(r(Oe, He, i))],
|
|
158
|
+
["6", r(R, A, i), t(r(R, A, i))],
|
|
159
|
+
["5", r(We, ze, i), t(r(We, ze, i))],
|
|
160
|
+
["4", r(Se, Re, i), t(r(Se, Re, i))],
|
|
161
|
+
["3", r(Me, Be, i), t(r(Me, Be, i))],
|
|
162
|
+
["2", r(I, J, i), t(r(I, J, i))],
|
|
163
|
+
["1", r(Z, U, i), t(r(Z, U, i))],
|
|
164
|
+
["a", r(J, U, i), t(r(J, U, i))],
|
|
165
|
+
["b", r(I, Z, i), t(r(I, Z, i))],
|
|
166
|
+
["c", r(xe, he, i), t(r(xe, he, i))],
|
|
167
|
+
["d", r(ke, pe, i), t(r(ke, pe, i))],
|
|
168
|
+
["e", r(Pe, me, i), t(r(Pe, me, i))],
|
|
169
|
+
["f", r(Ce, ge, i), t(r(Ce, ge, i))],
|
|
170
|
+
["g", r(Ee, we, i), t(r(Ee, we, i))],
|
|
171
|
+
["h", r($e, ye, i), t(r($e, ye, i))],
|
|
172
|
+
["i", r(Le, be, i), t(r(Le, be, i))],
|
|
173
|
+
["k", r(_, j, i), t(r(_, j, i))],
|
|
174
|
+
["l", r(ee, G, i), t(r(ee, G, i))],
|
|
175
|
+
["1", r(j, G, i), t(r(j, G, i))],
|
|
176
|
+
["2", r(_, ee, i), t(r(_, ee, i))],
|
|
177
|
+
["3", r(Te, Fe, i), t(r(Te, Fe, i))],
|
|
178
|
+
["4", r(qe, Ne, i), t(r(qe, Ne, i))],
|
|
179
|
+
["5", r(Ae, De, i), t(r(Ae, De, i))],
|
|
180
|
+
["6", r(N, O, i), t(r(N, O, i))],
|
|
181
|
+
["7", r(Xe, Ye, i), t(r(Xe, Ye, i))],
|
|
182
|
+
["8", r(Ve, Ue, i), t(r(Ve, Ue, i))],
|
|
183
|
+
["9", r(Ge, Je, i), t(r(Ge, Je, i))],
|
|
184
|
+
["10", r(oe, ne, i), t(r(oe, ne, i))],
|
|
185
|
+
["11", r(te, le, i), t(r(te, le, i))]
|
|
186
|
+
], zo = [
|
|
187
187
|
o[
|
|
188
188
|
0
|
|
189
189
|
/* f11 */
|
|
@@ -557,111 +557,56 @@ const ve = 23.6, $t = {
|
|
|
557
557
|
/* e10 */
|
|
558
558
|
][3][0]
|
|
559
559
|
];
|
|
560
|
-
function
|
|
561
|
-
if (
|
|
560
|
+
function Xt(u) {
|
|
561
|
+
if (u.length === 0)
|
|
562
562
|
return "";
|
|
563
|
-
const [
|
|
564
|
-
let
|
|
565
|
-
for (const
|
|
566
|
-
|
|
567
|
-
return `${
|
|
563
|
+
const [$, ...d] = u;
|
|
564
|
+
let Q = `M ${Yt(fe($[0]))} ${Yt(de($[1]))} L `;
|
|
565
|
+
for (const F of d)
|
|
566
|
+
Q += `${Yt(fe(F[0]))} ${Yt(de(F[1]))} `;
|
|
567
|
+
return `${Q} Z`;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
569
|
+
function Yt(u) {
|
|
570
|
+
return u.toFixed(8);
|
|
571
571
|
}
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
key: 1,
|
|
578
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
579
|
-
viewBox: "0 0 50 50"
|
|
580
|
-
}, Ft = {
|
|
581
|
-
key: 2,
|
|
582
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
583
|
-
viewBox: "0 0 50 50"
|
|
584
|
-
}, Rt = {
|
|
585
|
-
key: 3,
|
|
586
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
587
|
-
viewBox: "0 0 50 50"
|
|
588
|
-
}, Nt = {
|
|
589
|
-
key: 4,
|
|
590
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
591
|
-
viewBox: "0 0 50 50"
|
|
592
|
-
}, Wt = {
|
|
593
|
-
key: 5,
|
|
594
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
595
|
-
viewBox: "0 0 50 50"
|
|
596
|
-
}, Vt = {
|
|
597
|
-
key: 6,
|
|
598
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
599
|
-
viewBox: "0 0 50 50"
|
|
600
|
-
}, At = {
|
|
601
|
-
key: 7,
|
|
602
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
603
|
-
viewBox: "0 0 50 50"
|
|
604
|
-
}, Dt = {
|
|
605
|
-
key: 8,
|
|
606
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
607
|
-
viewBox: "0 0 50 50"
|
|
608
|
-
}, Kt = {
|
|
609
|
-
key: 9,
|
|
610
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
611
|
-
viewBox: "0 0 50 50"
|
|
612
|
-
}, Qt = {
|
|
613
|
-
key: 10,
|
|
614
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
615
|
-
viewBox: "0 0 50 50"
|
|
616
|
-
}, Xt = {
|
|
617
|
-
key: 11,
|
|
618
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
619
|
-
viewBox: "0 0 50 50"
|
|
620
|
-
}, Yt = /* @__PURE__ */ dt({
|
|
621
|
-
__name: "Gioco",
|
|
572
|
+
const Wo = {
|
|
573
|
+
viewBox: "0 0 50 50",
|
|
574
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
575
|
+
}, Ao = ["textContent", "fill"], Do = /* @__PURE__ */ ao({
|
|
576
|
+
__name: "Letter",
|
|
622
577
|
props: {
|
|
623
578
|
type: {}
|
|
624
579
|
},
|
|
625
|
-
setup(
|
|
626
|
-
return (
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
])
|
|
641
|
-
B('<defs><linearGradient gradientTransform="translate(474.35 493.34)" gradientUnits="userSpaceOnUse" x1="-462.21" x2="-434.18" xlink:href="#gioco-a-wn" id="gioco-b-wn" y1="-469.84" y2="-469.84"></linearGradient><linearGradient id="gioco-a-wn"><stop offset="0" stop-color="#fff"></stop><stop offset="1" stop-color="#bba38a"></stop></linearGradient><linearGradient gradientTransform="translate(474.35 493.34)" gradientUnits="userSpaceOnUse" x1="-464.54" x2="-434.16" xlink:href="#gioco-a-wn" id="gioco-c-wn" y1="-452.1" y2="-452.1"></linearGradient></defs><path class="st28" d="m25.987 23.546-11.592 1.097-1.454-5.216 14.468-6.815 1.763-3.9 10.2 11.892-4.116 17.678H14.74c.245-11.292 9.64-8.1 11.247-14.736z" fill="url(#gioco-b-wn)" stroke="#323232" stroke-linejoin="round" stroke-width="1.6"></path><path d="m29.173 8.72-.879 1.945.426-.943c2.692 3.722 5.608 7.279 8.45 10.888l-5.285 17.671h3.372l4.117-17.671z" opacity=".1"></path><path d="M13.24 38.286c-1.437 0-2.627 1.216-2.627 2.685v.545l.013 2.684h28.748l.013-2.684v-.545c0-1.468-1.19-2.685-2.627-2.685H25z" fill="url(#gioco-c-wn)" stroke="#323232" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"></path><path d="M15.62 37.633c.159-4.472 2.145-6.971 8.667-9.837-.987 1.107-6.405 2.237-8.667 9.837zM14.418 21.67l-.523-1.803L28.03 13.21l1.217-2.764-.671 3.558-14.35 5.921z" fill="#fff"></path>', 5)
|
|
642
|
-
])])) : c.type === "B" ? (v(), g("svg", Dt, [...s[8] || (s[8] = [
|
|
643
|
-
B('<defs><linearGradient gradientTransform="matrix(1.019 0 0 1.0751 -3392.3 527.45)" gradientUnits="userSpaceOnUse" x1="3341.2" x2="3366.2" xlink:href="#gioco-a-wb" id="gioco-b-wb" y1="-469.26" y2="-469.26"></linearGradient><linearGradient id="gioco-a-wb"><stop offset="0" stop-color="#fff"></stop><stop offset="1" stop-color="#bba38a"></stop></linearGradient><linearGradient gradientTransform="matrix(1.1509 0 0 1.1499 214.24 -138.92)" gradientUnits="userSpaceOnUse" x1="-177.63" x2="-151.24" xlink:href="#gioco-a-wb" id="gioco-c-wb" y1="156.68" y2="156.68"></linearGradient></defs><path d="M26.87 8.223c-5.797-2.298-6.952 2.527-4.668 5.86-9.898 10.6-11.253 16.425-6.195 24.204h17.99c6.084-6.912 2.558-14.515-4.823-22.3-2.883 4.119-3.274 7.35-3.946 11.131l-3.62-.071c-.66-6.006 7.622-15.14 5.261-18.823z" fill="url(#gioco-b-wb)" stroke="#323232" stroke-linejoin="round" stroke-width="1.6"></path><path d="M24.933 7.654c-.625.02-.207.197-.771.567 0 .003.01.006.01.008 3.582-.311-2.369 11.772-3.394 18.894.536-3.014 1.325-5.68 3.082-8.725 2.003-4.351 4.237-8.681 3.008-10.169-.411-.38-1.144-.601-1.934-.575zm4.24 8.338c-.6.856-.517.67-.972 1.462 6.004 6.049 8.728 13.787 3.097 20.838h2.696c6.085-6.912 2.56-14.515-4.822-22.3z" opacity=".1"></path><path d="M13.24 38.286c-1.437 0-2.627 1.216-2.627 2.685v.545l.013 2.684h28.749l.012-2.684v-.545c0-1.468-1.19-2.685-2.627-2.685H25z" fill="url(#gioco-c-wb)" stroke="#323232" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"></path><path d="M14.895 34.327c-.716-1.396-3.266-6.812 4.513-15.739-2.1 4.86-5.958 8.69-4.513 15.739z" fill="#fff"></path>', 5)
|
|
644
|
-
])])) : c.type === "R" ? (v(), g("svg", Kt, [...s[9] || (s[9] = [
|
|
645
|
-
B('<defs><linearGradient gradientTransform="translate(582.87 492.95)" gradientUnits="userSpaceOnUse" x1="-570.82" x2="-544.4" xlink:href="#gioco-a-wr" id="gioco-b-wr" y1="-468.61" y2="-468.61"></linearGradient><linearGradient id="gioco-a-wr"><stop offset="0" stop-color="#fff"></stop><stop offset="1" stop-color="#bba38a"></stop></linearGradient><linearGradient gradientTransform="translate(582.87 492.95)" gradientUnits="userSpaceOnUse" x1="-573.06" x2="-542.69" xlink:href="#gioco-a-wr" id="gioco-c-wr" y1="-451.71" y2="-451.71"></linearGradient></defs><path d="M12.855 10.383v7.663c0 3.268 6.53 3.774 6.53 3.774-.352 9.864-5.036 16.486-5.036 16.486l21.428-.039s-4.651-6.62-5-16.446c0 0 6.896-.507 6.896-3.774v-7.663h-4.72s.459 2.25-.47 3.26c-1.035 1.126-2.418 1.126-3.454 0-.928-1.01-.47-3.26-.47-3.26h-6.59s.459 2.25-.47 3.26c-1.122 1.22-2.699 1.22-3.82 0-.929-1.01-.47-3.26-.47-3.26z" fill="url(#gioco-b-wr)" stroke="#323232" stroke-linejoin="round" stroke-width="1.6"></path><path d="m37.543 10.462.014 7.585c.263 3.48-24.58 2.135-24.523 1.03 2.098 2.532 4.445 2.613 6.352 2.744 7.292.498 9.8 8.89 13.306 16.446h2.97s-4.65-6.62-5-16.446c2.547-.395 2.954-.812 4.037-1.058h.018l-.002-.004c1.023-.236 2.81-1.376 2.842-2.713v-7.663z" opacity=".1"></path><path d="M13.239 38.286c-1.437 0-2.627 1.216-2.627 2.685v.544l.013 2.685h28.75l.012-2.685v-.544c0-1.469-1.19-2.685-2.627-2.685H25z" fill="url(#gioco-c-wr)" stroke="#323232" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"></path><g fill="#fff"><path d="M13.656 11.168v5.54c.48-1.867.299-4.088 1.554-5.54zM22.877 11.163c.055.896-.154 1.748-.269 2.616.48-1.866 1.823-2.616 1.823-2.616zM16.947 35.312c.875-1.143 3.603-10.333 3.233-13.244.7.39.658 10.057-3.233 13.244zM33.863 11.209c.005.598-.055 1.226-.187 2.02.48-1.867 1.295-2.04 1.295-2.04z"></path></g>', 5)
|
|
646
|
-
])])) : c.type === "Q" ? (v(), g("svg", Qt, [...s[10] || (s[10] = [
|
|
647
|
-
B('<defs><linearGradient gradientTransform="translate(545.92 492.79)" gradientUnits="userSpaceOnUse" x1="-540.02" x2="-501.82" xlink:href="#gioco-a-wq" id="gioco-b-wq" y1="-470.59" y2="-470.59"></linearGradient><linearGradient id="gioco-a-wq"><stop offset="0" stop-color="#fff"></stop><stop offset="1" stop-color="#bba38a"></stop></linearGradient><linearGradient gradientTransform="translate(545.92 492.79)" gradientUnits="userSpaceOnUse" x1="-536.12" x2="-505.75" xlink:href="#gioco-a-wq" id="gioco-c-wq" y1="-451.55" y2="-451.55"></linearGradient></defs><path d="M25 6.122c-2.635 0-4.771 2.098-4.771 4.685.002 1.855 1.118 3.534 2.846 4.283-.369 2.286-1.51 7.558-4.68 8.009-2.355.334-3.855-1.287-4.88-3.144a4.19 4.19 0 0 0 1.767-3.4c0-2.327-1.921-4.214-4.291-4.214S6.699 14.228 6.7 16.555c0 2.142 1.64 3.943 3.809 4.183l4.973 17.54h19.036l4.973-17.54c2.169-.24 3.807-2.041 3.809-4.183 0-2.327-1.922-4.214-4.292-4.214s-4.29 1.887-4.29 4.214a4.19 4.19 0 0 0 1.766 3.4c-1.025 1.857-2.525 3.478-4.88 3.144-3.17-.45-4.31-5.723-4.68-8.01 1.729-.748 2.845-2.427 2.847-4.282 0-2.587-2.136-4.685-4.77-4.685z" fill="url(#gioco-b-wq)" stroke="#323232" stroke-linejoin="round" stroke-width="1.6"></path><path d="M39.002 12.342a4.348 4.348 0 0 0-1.567.296c4.741 1.678 3.877 6.805.591 7.316L30.414 38.28h4.2l4.87-17.541c2.17-.241 3.808-2.042 3.81-4.184 0-2.327-1.922-4.214-4.292-4.213z" opacity=".1"></path><path d="M13.227 38.286c-1.437 0-2.627 1.216-2.627 2.685v.545l.013 2.684H39.36l.013-2.684v-.545c0-1.468-1.19-2.685-2.627-2.685h-11.76z" fill="url(#gioco-c-wq)" stroke="#323232" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"></path><g fill="#fff"><path d="M9.515 13.489c-.794 1.17-1.726 2.667-1.554 4.779 0 0-1.604-3.01 1.554-4.779zM23.659 7.23c-.853.874-2.37 2.934-2.133 5.374-.207-.084-1.73-3.893 2.133-5.374zM12.062 23.328l5.244 14.111-1.17.023z"></path></g>', 5)
|
|
648
|
-
])])) : c.type === "K" ? (v(), g("svg", Xt, [...s[11] || (s[11] = [
|
|
649
|
-
B('<defs><linearGradient gradientTransform="matrix(.26458 0 0 .25357 227.43 -666.55)" gradientUnits="userSpaceOnUse" x1="-825.75" x2="-704.44" xlink:href="#gioco-a-wk" id="gioco-b-wk" y1="2712.8" y2="2712.8"></linearGradient><linearGradient id="gioco-a-wk"><stop offset="0" stop-color="#fff"></stop><stop offset="1" stop-color="#bba38a"></stop></linearGradient><linearGradient gradientTransform="translate(225.05 -690.53)" gradientUnits="userSpaceOnUse" x1="-215.24" x2="-184.86" xlink:href="#gioco-a-wk" id="gioco-c-wk" y1="731.78" y2="731.78"></linearGradient></defs><path d="M25.006 3.868c-1.803.1-3.228 1.234-3.228 2.618 0 .565.244 1.644.693 2.097h-5.766v5.106h6.306l-2.61 2.833 2.673 2.167c-5.584.362-12.02 1.643-13.154 3.997-1.268 2.638 6.215 15.6 6.215 15.6h17.73s7.484-12.963 6.215-15.6c-1.133-2.357-7.594-3.64-13.179-3.999l2.71-2.165-2.61-2.833h6.306V8.583H27.54c.449-.453.693-1.531.693-2.097 0-1.384-1.425-2.518-3.228-2.618z" fill="url(#gioco-b-wk)" stroke="#323232" stroke-linejoin="round" stroke-width="1.6" style="paint-order:fill markers;"></path><path d="m31.289 38.283 2.573-.005s7.482-12.428 6.214-15.065c-4.136-3.824-13.18-4.525-13.18-4.525 11.05 2.822 12.618 5.028 4.393 19.595z" opacity=".1"></path><path d="M13.242 38.286c-1.437 0-2.627 1.216-2.627 2.685v.545l.013 2.684h28.749l.012-2.684v-.545c0-1.468-1.19-2.685-2.627-2.685h-11.76z" fill="url(#gioco-c-wk)" stroke="#323232" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"></path><g fill="#fff"><path d="M13.283 31.138s-3.074-6.555-2.666-8.092c.408-1.536 5.987-2.736 5.987-2.736-6.486 2.71-4.786 4.558-3.321 10.828zM17.521 12.884v-3.52l1.532-.011c-.891.007-1.532 2.147-1.532 3.531zM24.798 4.67s-2.614.92-1.53 3.522c-.178-.007-2.142-2.72 1.53-3.522z"></path></g>', 5)
|
|
650
|
-
])])) : fe("", !0);
|
|
580
|
+
setup(u) {
|
|
581
|
+
return ($, d) => (b(), P("svg", Wo, [
|
|
582
|
+
fo("text", {
|
|
583
|
+
textContent: vo(u.type),
|
|
584
|
+
"dominant-baseline": "middle",
|
|
585
|
+
"font-family": "sans-serif",
|
|
586
|
+
"font-size": "30",
|
|
587
|
+
"font-weight": "bold",
|
|
588
|
+
"text-anchor": "middle",
|
|
589
|
+
x: "25",
|
|
590
|
+
y: "27",
|
|
591
|
+
stroke: "oklch(37.3% 0.034 259.733)",
|
|
592
|
+
"stroke-width": "2",
|
|
593
|
+
fill: u.type === u.type.toLowerCase() ? "oklch(13% 0.028 261.692)" : "oklch(98.5% 0.002 247.839)"
|
|
594
|
+
}, null, 8, Ao)
|
|
595
|
+
]));
|
|
651
596
|
}
|
|
652
|
-
}),
|
|
597
|
+
}), Ho = ["viewBox"], Oo = ["d", "fill"], Xo = ["d", "data-hexboard-position", "data-testid", "fill"], Yo = ["d", "data-testid", "fill"], Ko = ["d", "data-testid", "fill"], Qo = ["textContent", "data-testid", "x", "y"], Vo = ["cx", "cy", "data-testid", "fill"], Uo = ["viewBox"], Go = /* @__PURE__ */ ao({
|
|
653
598
|
__name: "Hexboard",
|
|
654
|
-
props: /* @__PURE__ */
|
|
599
|
+
props: /* @__PURE__ */ so({
|
|
655
600
|
active: { type: Boolean, default: !1 },
|
|
656
601
|
autoselect: { type: Boolean, default: !1 },
|
|
657
602
|
flipped: { type: Boolean, default: !1 },
|
|
658
|
-
hexchess: { default: () =>
|
|
603
|
+
hexchess: { default: () => co.init() },
|
|
659
604
|
highlight: { default: () => [] },
|
|
660
605
|
ignoreTurn: { type: Boolean, default: !1 },
|
|
661
606
|
options: { default: () => ({}) },
|
|
662
|
-
pieces: { default: () =>
|
|
607
|
+
pieces: { default: () => Do },
|
|
663
608
|
playing: { type: [String, Boolean], default: !1 },
|
|
664
|
-
position: { default:
|
|
609
|
+
position: { default: qo }
|
|
665
610
|
}, {
|
|
666
611
|
"mouseover-position": {
|
|
667
612
|
default: null,
|
|
@@ -679,212 +624,212 @@ const jt = {
|
|
|
679
624
|
},
|
|
680
625
|
targetsModifiers: {}
|
|
681
626
|
}),
|
|
682
|
-
emits: /* @__PURE__ */
|
|
683
|
-
setup(
|
|
684
|
-
const
|
|
627
|
+
emits: /* @__PURE__ */ so(["clickPosition", "move"], ["update:mouseover-position", "update:selected", "update:targets"]),
|
|
628
|
+
setup(u, { emit: $ }) {
|
|
629
|
+
const d = u, Q = $, F = Zt(u, "mouseover-position"), L = Zt(u, "selected"), X = Zt(u, "targets"), Ie = et({ x: 0, y: 0 }), B = et(null), ue = et(se()), h = et({
|
|
685
630
|
hexchess: null,
|
|
686
631
|
promotionEl: null,
|
|
687
632
|
promotionFrom: null,
|
|
688
633
|
promotionTo: null,
|
|
689
634
|
selected: null
|
|
690
|
-
}),
|
|
691
|
-
let
|
|
692
|
-
const
|
|
693
|
-
(
|
|
635
|
+
}), Kt = Co("svgEl"), Y = et(se());
|
|
636
|
+
let Qt = !1;
|
|
637
|
+
const ho = z(() => h.value.hexchess ? [] : X.value), ce = z(() => h.value.hexchess ? h.value.hexchess : d.hexchess ? d.hexchess : co.init()), po = z(() => ce.value.board.reduce(
|
|
638
|
+
(s, a, c) => (a && c !== B.value && s.push({ piece: a, index: c }), s),
|
|
694
639
|
[]
|
|
695
|
-
)),
|
|
696
|
-
var
|
|
697
|
-
if (
|
|
640
|
+
)), lt = z(() => typeof h.value.selected == "number" ? null : L.value), jt = z(() => {
|
|
641
|
+
var s, a, c;
|
|
642
|
+
if (Vt.value)
|
|
698
643
|
return "grabbing";
|
|
699
|
-
if (!(!
|
|
700
|
-
if (
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
703
|
-
const
|
|
704
|
-
if ((
|
|
644
|
+
if (!(!d.active || F.value === null || h.value.hexchess)) {
|
|
645
|
+
if (L.value !== null && X.value.includes(F.value)) {
|
|
646
|
+
const v = (s = ce.value) == null ? void 0 : s.board[L.value];
|
|
647
|
+
if (v) {
|
|
648
|
+
const g = v === v.toLowerCase() ? "b" : "w", C = ((a = ce.value) == null ? void 0 : a.turn) === g;
|
|
649
|
+
if ((d.playing === !0 || C) && it(L.value))
|
|
705
650
|
return "pointer";
|
|
706
651
|
}
|
|
707
652
|
}
|
|
708
|
-
if (
|
|
709
|
-
return
|
|
653
|
+
if (st.value)
|
|
654
|
+
return d.playing === !0 || d.playing && Jt.value === ((c = ce.value) == null ? void 0 : c.turn) && d.playing === Jt.value ? "grab" : "pointer";
|
|
710
655
|
}
|
|
711
|
-
}),
|
|
712
|
-
x:
|
|
713
|
-
y:
|
|
714
|
-
})),
|
|
715
|
-
var
|
|
716
|
-
return
|
|
717
|
-
}),
|
|
718
|
-
var
|
|
719
|
-
const
|
|
656
|
+
}), Gt = z(() => ({
|
|
657
|
+
x: Ie.value.x - Y.value.width / 2,
|
|
658
|
+
y: Ie.value.y - Y.value.height / 2
|
|
659
|
+
})), Vt = z(() => !d.hexchess || h.value.hexchess || B.value === null ? null : d.hexchess.board[B.value]), K = z(() => ({ ...So, ...d.options })), Jt = z(() => st.value ? st.value === st.value.toLowerCase() ? "b" : "w" : null), st = z(() => {
|
|
660
|
+
var s;
|
|
661
|
+
return F.value === null ? null : ((s = ce.value) == null ? void 0 : s.board[F.value]) ?? null;
|
|
662
|
+
}), rt = z(() => {
|
|
663
|
+
var v;
|
|
664
|
+
const s = (v = h.value.hexchess) == null ? void 0 : v.board[h.value.selected ?? -1], a = s === (s == null ? void 0 : s.toUpperCase()), c = (g) => (C) => To(d.pieces, { ...C, type: g });
|
|
720
665
|
return {
|
|
721
|
-
n:
|
|
722
|
-
b:
|
|
723
|
-
r:
|
|
724
|
-
q:
|
|
666
|
+
n: c(a ? "N" : "n"),
|
|
667
|
+
b: c(a ? "B" : "b"),
|
|
668
|
+
r: c(a ? "R" : "r"),
|
|
669
|
+
q: c(a ? "Q" : "q")
|
|
725
670
|
};
|
|
726
671
|
});
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
}),
|
|
672
|
+
Eo(() => {
|
|
673
|
+
d.active && It();
|
|
674
|
+
}), $o(lo), ro(jt, (s) => {
|
|
730
675
|
document.body.style.setProperty(
|
|
731
676
|
"cursor",
|
|
732
|
-
|
|
677
|
+
s === "grabbing" ? "grabbing" : null
|
|
733
678
|
);
|
|
734
|
-
}),
|
|
735
|
-
() =>
|
|
736
|
-
(
|
|
679
|
+
}), ro(
|
|
680
|
+
() => d.active,
|
|
681
|
+
(s) => s ? It() : lo()
|
|
737
682
|
);
|
|
738
|
-
function
|
|
739
|
-
var
|
|
740
|
-
if (!
|
|
683
|
+
function Ut(s, a) {
|
|
684
|
+
var C, re;
|
|
685
|
+
if (!X.value.includes(s.to))
|
|
741
686
|
return;
|
|
742
|
-
const
|
|
743
|
-
if (!
|
|
687
|
+
const c = (C = d.hexchess) == null ? void 0 : C.board[s.from];
|
|
688
|
+
if (!c)
|
|
744
689
|
return;
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
hexchess:
|
|
750
|
-
promotionEl: (
|
|
751
|
-
promotionFrom:
|
|
752
|
-
promotionTo:
|
|
753
|
-
selected:
|
|
754
|
-
}, (
|
|
690
|
+
const v = c === c.toLowerCase() ? "b" : "w", g = ((re = d.hexchess) == null ? void 0 : re.turn) === v;
|
|
691
|
+
if (d.hexchess && (c === "p" || c === "P") && Fo(s.to, v)) {
|
|
692
|
+
const ae = d.hexchess.clone();
|
|
693
|
+
ae.board[s.from] = null, ae.board[s.to] = c, h.value = {
|
|
694
|
+
hexchess: ae,
|
|
695
|
+
promotionEl: (a == null ? void 0 : a.target) instanceof Element ? a.target : null,
|
|
696
|
+
promotionFrom: s.from,
|
|
697
|
+
promotionTo: s.to,
|
|
698
|
+
selected: s.to
|
|
699
|
+
}, (a == null ? void 0 : a.target) instanceof Element && (ue.value = a.target.getBoundingClientRect());
|
|
755
700
|
return;
|
|
756
701
|
}
|
|
757
|
-
|
|
702
|
+
it(s.from) && (d.ignoreTurn || g) && eo(s);
|
|
758
703
|
}
|
|
759
|
-
function
|
|
760
|
-
var
|
|
761
|
-
const
|
|
762
|
-
if (!
|
|
704
|
+
function it(s) {
|
|
705
|
+
var v;
|
|
706
|
+
const a = (v = d.hexchess) == null ? void 0 : v.board[s];
|
|
707
|
+
if (!a)
|
|
763
708
|
return !1;
|
|
764
|
-
const
|
|
765
|
-
return
|
|
709
|
+
const c = a === a.toLowerCase() ? "b" : "w";
|
|
710
|
+
return d.playing === !0 || d.playing === c;
|
|
766
711
|
}
|
|
767
|
-
function
|
|
768
|
-
var
|
|
769
|
-
return
|
|
712
|
+
function mo(s) {
|
|
713
|
+
var a, c;
|
|
714
|
+
return F.value === null ? K.value.labelColor : (a = W(F.value)) != null && a.startsWith(s) || (c = W(F.value)) != null && c.endsWith(s) ? K.value.labelActiveColor : K.value.labelInactiveColor;
|
|
770
715
|
}
|
|
771
|
-
function
|
|
772
|
-
|
|
716
|
+
function It() {
|
|
717
|
+
Ie.value = { x: 0, y: 0 }, window.addEventListener("keyup", _t), window.addEventListener("pointermove", to), window.addEventListener("pointerup", no), window.addEventListener("resize", ut), window.addEventListener("scroll", ut), window.addEventListener("touchmove", oo, { passive: !1 });
|
|
773
718
|
}
|
|
774
|
-
function
|
|
775
|
-
var
|
|
776
|
-
|
|
719
|
+
function ut() {
|
|
720
|
+
var s;
|
|
721
|
+
ue.value = ((s = h.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? se();
|
|
777
722
|
}
|
|
778
|
-
function
|
|
779
|
-
if (
|
|
780
|
-
if (
|
|
781
|
-
|
|
723
|
+
function go(s, a) {
|
|
724
|
+
if (d.active) {
|
|
725
|
+
if (Qt) {
|
|
726
|
+
Qt = !1;
|
|
782
727
|
return;
|
|
783
728
|
}
|
|
784
729
|
if (h.value.hexchess) {
|
|
785
|
-
h.value.selected !==
|
|
730
|
+
h.value.selected !== s && _e();
|
|
786
731
|
return;
|
|
787
732
|
}
|
|
788
|
-
if (
|
|
789
|
-
const
|
|
790
|
-
|
|
733
|
+
if (L.value !== null && X.value.includes(s)) {
|
|
734
|
+
const c = new ft({ from: L.value, to: s });
|
|
735
|
+
Ut(c, a);
|
|
791
736
|
return;
|
|
792
737
|
}
|
|
793
|
-
|
|
738
|
+
d.autoselect && !d.hexchess.board[s] && (L.value = null, X.value = []), Q("clickPosition", s);
|
|
794
739
|
}
|
|
795
740
|
}
|
|
796
|
-
function
|
|
797
|
-
if (
|
|
741
|
+
function _t(s) {
|
|
742
|
+
if (s.key === "Escape") {
|
|
798
743
|
if (h.value.hexchess) {
|
|
799
|
-
|
|
744
|
+
_e();
|
|
800
745
|
return;
|
|
801
746
|
}
|
|
802
|
-
|
|
747
|
+
d.autoselect && (L.value = null, X.value = []);
|
|
803
748
|
}
|
|
804
749
|
}
|
|
805
|
-
function
|
|
806
|
-
|
|
750
|
+
function eo(s) {
|
|
751
|
+
Q("move", s), ct();
|
|
807
752
|
}
|
|
808
|
-
function
|
|
809
|
-
var
|
|
810
|
-
if (
|
|
811
|
-
let
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
),
|
|
816
|
-
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
753
|
+
function wo(s, a) {
|
|
754
|
+
var c;
|
|
755
|
+
if (a.stopPropagation(), B.value !== null) {
|
|
756
|
+
let v = s;
|
|
757
|
+
const g = document.elementFromPoint(
|
|
758
|
+
a.clientX,
|
|
759
|
+
a.clientY
|
|
760
|
+
), C = g == null ? void 0 : g.getAttribute("data-hexboard-position");
|
|
761
|
+
C !== null && (v = Number(C));
|
|
762
|
+
const re = new ft({ from: B.value, to: v });
|
|
763
|
+
if (Ut(re, a), h.value.hexchess)
|
|
819
764
|
return;
|
|
820
|
-
|
|
765
|
+
B.value = null, Y.value = se();
|
|
821
766
|
return;
|
|
822
767
|
}
|
|
823
|
-
if (
|
|
824
|
-
const
|
|
825
|
-
return
|
|
768
|
+
if (L.value !== null && X.value.includes(s)) {
|
|
769
|
+
const v = new ft({ from: L.value, to: s });
|
|
770
|
+
return Ut(v, a), h.value.hexchess, void 0;
|
|
826
771
|
}
|
|
827
772
|
if (h.value.hexchess) {
|
|
828
|
-
|
|
773
|
+
_e();
|
|
829
774
|
return;
|
|
830
775
|
}
|
|
831
|
-
if ((
|
|
832
|
-
|
|
776
|
+
if ((c = d.hexchess) != null && c.board[s]) {
|
|
777
|
+
B.value = null, Y.value = se();
|
|
833
778
|
return;
|
|
834
779
|
}
|
|
835
|
-
|
|
780
|
+
ct();
|
|
836
781
|
}
|
|
837
|
-
function
|
|
838
|
-
const
|
|
782
|
+
function _e() {
|
|
783
|
+
const s = h.value.promotionFrom;
|
|
839
784
|
h.value = {
|
|
840
785
|
hexchess: null,
|
|
841
786
|
promotionEl: null,
|
|
842
787
|
promotionFrom: null,
|
|
843
788
|
promotionTo: null,
|
|
844
789
|
selected: null
|
|
845
|
-
}, typeof
|
|
790
|
+
}, typeof s == "number" && (L.value = s, X.value = d.hexchess.movesFrom(s).map((a) => a.to) ?? []), B.value = null, Qt = !0;
|
|
846
791
|
}
|
|
847
|
-
function
|
|
848
|
-
var
|
|
849
|
-
if (
|
|
792
|
+
function yo(s, a) {
|
|
793
|
+
var C, re, ae;
|
|
794
|
+
if (a.preventDefault(), h.value.hexchess)
|
|
850
795
|
return;
|
|
851
|
-
const
|
|
852
|
-
if (!
|
|
796
|
+
const c = (C = d.hexchess) == null ? void 0 : C.board[s];
|
|
797
|
+
if (!c || (d.autoselect && (L.value = s, X.value = ((re = d.hexchess) == null ? void 0 : re.movesFrom(s).map((Po) => Po.to)) ?? []), !it(s)))
|
|
853
798
|
return;
|
|
854
|
-
const
|
|
855
|
-
!
|
|
799
|
+
const v = c === c.toLowerCase() ? "b" : "w", g = ((ae = d.hexchess) == null ? void 0 : ae.turn) === v;
|
|
800
|
+
!d.ignoreTurn && !g || (B.value = s, Ie.value = { x: a.clientX, y: a.clientY }, Kt.value instanceof Element && (Y.value = Kt.value.getBoundingClientRect()));
|
|
856
801
|
}
|
|
857
|
-
function
|
|
858
|
-
|
|
802
|
+
function bo(s) {
|
|
803
|
+
F.value = s;
|
|
859
804
|
}
|
|
860
|
-
function
|
|
861
|
-
|
|
805
|
+
function xo() {
|
|
806
|
+
F.value = null;
|
|
862
807
|
}
|
|
863
|
-
function
|
|
864
|
-
|
|
808
|
+
function to(s) {
|
|
809
|
+
d.active && (Ie.value = { x: s.clientX, y: s.clientY });
|
|
865
810
|
}
|
|
866
|
-
function
|
|
867
|
-
|
|
811
|
+
function oo(s) {
|
|
812
|
+
B.value !== null && s.preventDefault();
|
|
868
813
|
}
|
|
869
|
-
function
|
|
814
|
+
function no() {
|
|
870
815
|
if (h.value.hexchess) {
|
|
871
|
-
|
|
816
|
+
_e();
|
|
872
817
|
return;
|
|
873
818
|
}
|
|
874
|
-
if (
|
|
875
|
-
|
|
819
|
+
if (B.value !== null) {
|
|
820
|
+
B.value = null, Y.value = se();
|
|
876
821
|
return;
|
|
877
822
|
}
|
|
878
|
-
|
|
823
|
+
ct();
|
|
879
824
|
}
|
|
880
|
-
function
|
|
881
|
-
if (typeof h.value.promotionFrom == "number" &&
|
|
882
|
-
const
|
|
825
|
+
function ko(s) {
|
|
826
|
+
if (typeof h.value.promotionFrom == "number" && it(h.value.promotionFrom)) {
|
|
827
|
+
const a = new ft({
|
|
883
828
|
from: h.value.promotionFrom ?? 0,
|
|
884
829
|
to: h.value.promotionTo ?? 0,
|
|
885
|
-
promotion:
|
|
830
|
+
promotion: s
|
|
886
831
|
});
|
|
887
|
-
|
|
832
|
+
eo(a);
|
|
888
833
|
}
|
|
889
834
|
}
|
|
890
835
|
function se() {
|
|
@@ -899,150 +844,151 @@ const jt = {
|
|
|
899
844
|
y: 0
|
|
900
845
|
};
|
|
901
846
|
}
|
|
902
|
-
function
|
|
903
|
-
document.body.style.setProperty("cursor", null),
|
|
847
|
+
function ct() {
|
|
848
|
+
document.body.style.setProperty("cursor", null), B.value = null, L.value = null, h.value = {
|
|
904
849
|
hexchess: null,
|
|
905
850
|
promotionEl: null,
|
|
906
851
|
promotionFrom: null,
|
|
907
852
|
promotionTo: null,
|
|
908
853
|
selected: null
|
|
909
|
-
},
|
|
854
|
+
}, Y.value = se(), X.value = [];
|
|
910
855
|
}
|
|
911
|
-
function
|
|
912
|
-
|
|
856
|
+
function lo() {
|
|
857
|
+
ct(), window.removeEventListener("keyup", _t), window.removeEventListener("pointermove", to), window.removeEventListener("pointerup", no), window.removeEventListener("resize", ut), window.removeEventListener("scroll", ut), window.removeEventListener("touchmove", oo);
|
|
913
858
|
}
|
|
914
|
-
return (
|
|
915
|
-
(
|
|
859
|
+
return (s, a) => (b(), P("div", null, [
|
|
860
|
+
(b(), P("svg", {
|
|
916
861
|
xmlns: "http://www.w3.org/2000/svg",
|
|
917
862
|
ref_key: "svgEl",
|
|
918
|
-
ref:
|
|
919
|
-
style:
|
|
863
|
+
ref: Kt,
|
|
864
|
+
style: at({ cursor: jt.value }),
|
|
920
865
|
viewBox: `0 0 ${f(ve)} ${f(ve)}`
|
|
921
866
|
}, [
|
|
922
|
-
|
|
923
|
-
d: f(
|
|
924
|
-
fill:
|
|
867
|
+
fo("path", {
|
|
868
|
+
d: f(Xt)(f(zo)),
|
|
869
|
+
fill: K.value.colors[1],
|
|
925
870
|
style: { pointerEvents: "none" }
|
|
926
|
-
}, null, 8,
|
|
927
|
-
(
|
|
871
|
+
}, null, 8, Oo),
|
|
872
|
+
(b(!0), P(ot, null, nt(f(o), (c, v) => (b(), P("path", Lo(
|
|
928
873
|
{ ref_for: !0 },
|
|
929
|
-
|
|
930
|
-
onClick: (
|
|
931
|
-
onMouseenter: () =>
|
|
932
|
-
onMouseleave: () =>
|
|
933
|
-
onPointerdown: (
|
|
934
|
-
onPointerup: (
|
|
874
|
+
u.active ? {
|
|
875
|
+
onClick: (g) => go(v, g),
|
|
876
|
+
onMouseenter: () => bo(v),
|
|
877
|
+
onMouseleave: () => xo(),
|
|
878
|
+
onPointerdown: (g) => yo(v, g),
|
|
879
|
+
onPointerup: (g) => wo(v, g)
|
|
935
880
|
} : {},
|
|
936
881
|
{
|
|
937
|
-
d: f(
|
|
938
|
-
"data-hexboard-position":
|
|
939
|
-
"data-testid": `position-${f(
|
|
940
|
-
fill:
|
|
941
|
-
key:
|
|
882
|
+
d: f(Xt)(u.flipped ? c[4] : c[3]),
|
|
883
|
+
"data-hexboard-position": v,
|
|
884
|
+
"data-testid": `position-${f(W)(v)}`,
|
|
885
|
+
fill: K.value.colors[f(o)[v][0]],
|
|
886
|
+
key: v
|
|
942
887
|
}
|
|
943
|
-
), null, 16,
|
|
944
|
-
(
|
|
945
|
-
d: f(
|
|
946
|
-
"data-testid": `highlight-${f(
|
|
947
|
-
fill:
|
|
948
|
-
key: `highlight-${
|
|
888
|
+
), null, 16, Xo))), 128)),
|
|
889
|
+
(b(!0), P(ot, null, nt(u.highlight, (c) => (b(), P("path", {
|
|
890
|
+
d: f(Xt)(u.flipped ? f(o)[c][4] : f(o)[c][3]),
|
|
891
|
+
"data-testid": `highlight-${f(W)(c)}`,
|
|
892
|
+
fill: K.value.highlightColor,
|
|
893
|
+
key: `highlight-${c}`,
|
|
949
894
|
style: { pointerEvents: "none" }
|
|
950
|
-
}, null, 8,
|
|
951
|
-
typeof
|
|
895
|
+
}, null, 8, Yo))), 128)),
|
|
896
|
+
typeof lt.value == "number" ? (b(), P("path", {
|
|
952
897
|
key: 0,
|
|
953
|
-
d: f(
|
|
954
|
-
"data-testid": `selected-${f(
|
|
955
|
-
fill:
|
|
898
|
+
d: f(Xt)(u.flipped ? f(o)[lt.value][4] : f(o)[lt.value][3]),
|
|
899
|
+
"data-testid": `selected-${f(W)(lt.value)}`,
|
|
900
|
+
fill: K.value.selectedColor,
|
|
956
901
|
ref: "selectedEl",
|
|
957
902
|
style: { pointerEvents: "none" }
|
|
958
|
-
}, null, 8,
|
|
959
|
-
|
|
960
|
-
textContent:
|
|
903
|
+
}, null, 8, Ko)) : tt("", !0),
|
|
904
|
+
K.value.labels ? (b(!0), P(ot, { key: 1 }, nt(f(No), ([c, v, g], C) => (b(), P("text", {
|
|
905
|
+
textContent: vo(c),
|
|
961
906
|
"dominant-baseline": "central",
|
|
962
907
|
"text-anchor": "middle",
|
|
963
|
-
"data-testid": `label-${
|
|
964
|
-
key: `label-${
|
|
965
|
-
style:
|
|
966
|
-
fill:
|
|
908
|
+
"data-testid": `label-${c}`,
|
|
909
|
+
key: `label-${C}`,
|
|
910
|
+
style: at({
|
|
911
|
+
fill: mo(c),
|
|
967
912
|
fontSize: ".5px",
|
|
968
913
|
pointerEvents: "none",
|
|
969
914
|
userSelect: "none"
|
|
970
915
|
}),
|
|
971
|
-
x: f(
|
|
972
|
-
y: f(
|
|
973
|
-
}, null, 12,
|
|
974
|
-
|
|
975
|
-
"data-piece-type":
|
|
976
|
-
"data-testid": `piece-${f(
|
|
977
|
-
height: f(
|
|
978
|
-
key: `piece-${f(
|
|
916
|
+
x: f(fe)(u.flipped ? g[0] : v[0]),
|
|
917
|
+
y: f(de)(u.flipped ? g[1] : v[1])
|
|
918
|
+
}, null, 12, Qo))), 128)) : tt("", !0),
|
|
919
|
+
ce.value ? (b(!0), P(ot, { key: 2 }, nt(po.value, ({ piece: c, index: v }) => (b(), io(uo(u.pieces), {
|
|
920
|
+
"data-piece-type": c,
|
|
921
|
+
"data-testid": `piece-${f(W)(v)}`,
|
|
922
|
+
height: f(V),
|
|
923
|
+
key: `piece-${f(W)(v)}`,
|
|
979
924
|
style: { pointerEvents: "none" },
|
|
980
|
-
type:
|
|
981
|
-
width: f(
|
|
982
|
-
x: f(
|
|
983
|
-
y: f(
|
|
984
|
-
}, null, 8, ["data-piece-type", "data-testid", "height", "type", "width", "x", "y"]))), 128)) :
|
|
985
|
-
(
|
|
986
|
-
cx: f(
|
|
987
|
-
cy: f(
|
|
988
|
-
"data-testid": `target-${f(
|
|
989
|
-
fill:
|
|
990
|
-
key: `target-${f(
|
|
925
|
+
type: c,
|
|
926
|
+
width: f(V),
|
|
927
|
+
x: f(fe)(f(o)[v][u.flipped ? 2 : 1][0] - f(V) / 2),
|
|
928
|
+
y: f(de)(f(o)[v][u.flipped ? 2 : 1][1] + f(V) / 2)
|
|
929
|
+
}, null, 8, ["data-piece-type", "data-testid", "height", "type", "width", "x", "y"]))), 128)) : tt("", !0),
|
|
930
|
+
(b(!0), P(ot, null, nt(ho.value, (c) => (b(), P("circle", {
|
|
931
|
+
cx: f(fe)(f(o)[c][u.flipped ? 2 : 1][0]),
|
|
932
|
+
cy: f(de)(f(o)[c][u.flipped ? 2 : 1][1]),
|
|
933
|
+
"data-testid": `target-${f(W)(c)}`,
|
|
934
|
+
fill: K.value.targetColor,
|
|
935
|
+
key: `target-${f(W)(c)}`,
|
|
991
936
|
r: 0.3,
|
|
992
937
|
style: { pointerEvents: "none" }
|
|
993
|
-
}, null, 8,
|
|
994
|
-
], 12,
|
|
995
|
-
|
|
938
|
+
}, null, 8, Vo))), 128))
|
|
939
|
+
], 12, Ho)),
|
|
940
|
+
Vt.value ? (b(), P("svg", {
|
|
996
941
|
key: 0,
|
|
997
942
|
"data-testid": "drag-piece",
|
|
998
943
|
xmlns: "http://www.w3.org/2000/svg",
|
|
999
|
-
style:
|
|
1000
|
-
height:
|
|
944
|
+
style: at({
|
|
945
|
+
height: Y.value.height + "px",
|
|
1001
946
|
left: "0px",
|
|
1002
947
|
pointerEvents: "none",
|
|
1003
948
|
position: "fixed",
|
|
1004
949
|
top: "0px",
|
|
1005
|
-
transform: `translate(${
|
|
1006
|
-
width:
|
|
950
|
+
transform: `translate(${Gt.value.x}px, ${Gt.value.y}px) scale(1.1)`,
|
|
951
|
+
width: Y.value.width + "px",
|
|
1007
952
|
willChange: "transform"
|
|
1008
953
|
}),
|
|
1009
954
|
viewBox: `0 0 ${f(ve)} ${f(ve)}`
|
|
1010
955
|
}, [
|
|
1011
|
-
(
|
|
1012
|
-
height: f(
|
|
956
|
+
(b(), io(uo(u.pieces), {
|
|
957
|
+
height: f(V),
|
|
1013
958
|
style: { pointerEvents: "none" },
|
|
1014
|
-
type:
|
|
1015
|
-
width: f(
|
|
1016
|
-
x: f(
|
|
1017
|
-
y: f(
|
|
959
|
+
type: Vt.value,
|
|
960
|
+
width: f(V),
|
|
961
|
+
x: f(fe)(f(V) / -2),
|
|
962
|
+
y: f(de)(f(V) / 2)
|
|
1018
963
|
}, null, 8, ["height", "type", "width", "x", "y"]))
|
|
1019
|
-
], 12,
|
|
1020
|
-
typeof h.value.selected == "number" ? (
|
|
964
|
+
], 12, Uo)) : tt("", !0),
|
|
965
|
+
typeof h.value.selected == "number" ? (b(), P("div", {
|
|
1021
966
|
key: 1,
|
|
1022
|
-
style:
|
|
1023
|
-
height:
|
|
1024
|
-
left:
|
|
967
|
+
style: at({
|
|
968
|
+
height: ue.value.height + "px",
|
|
969
|
+
left: ue.value.left + "px",
|
|
1025
970
|
position: "fixed",
|
|
1026
|
-
top:
|
|
1027
|
-
width:
|
|
971
|
+
top: ue.value.top + "px",
|
|
972
|
+
width: ue.value.width + "px"
|
|
1028
973
|
}),
|
|
1029
|
-
onPointerup:
|
|
974
|
+
onPointerup: a[0] || (a[0] = Bo(() => {
|
|
1030
975
|
}, ["stop"]))
|
|
1031
976
|
}, [
|
|
1032
|
-
|
|
1033
|
-
b:
|
|
1034
|
-
cancel:
|
|
1035
|
-
file: f(
|
|
1036
|
-
n:
|
|
1037
|
-
promote:
|
|
1038
|
-
q:
|
|
1039
|
-
r:
|
|
1040
|
-
rank: Number(f(
|
|
977
|
+
Mo(s.$slots, "promotion", {
|
|
978
|
+
b: rt.value.b,
|
|
979
|
+
cancel: _e,
|
|
980
|
+
file: f(W)(h.value.selected)[0],
|
|
981
|
+
n: rt.value.n,
|
|
982
|
+
promote: ko,
|
|
983
|
+
q: rt.value.q,
|
|
984
|
+
r: rt.value.r,
|
|
985
|
+
rank: Number(f(W)(h.value.selected).slice(1))
|
|
1041
986
|
})
|
|
1042
|
-
], 36)) :
|
|
987
|
+
], 36)) : tt("", !0)
|
|
1043
988
|
]));
|
|
1044
989
|
}
|
|
1045
990
|
});
|
|
1046
991
|
export {
|
|
1047
|
-
|
|
992
|
+
Go as Hexboard,
|
|
993
|
+
So as defaultOptions
|
|
1048
994
|
};
|