@bedard/hexboard 0.0.8 → 0.0.9

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 CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.0.9
2
+
3
+ - Fix click-move capturing (https://github.com/scottbedard/hexboard/issues/1)
4
+ - Remove `data-testid` from built files
5
+
1
6
  # 0.0.8
2
7
 
3
8
  - Round SVG coordinates for better SSR hydration
package/dist/index.js CHANGED
@@ -1,44 +1,44 @@
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 tt, useTemplateRef as Co, computed as W, onMounted as Eo, onUnmounted as $o, watch as ro, createCommentVNode as ot, unref as c, normalizeStyle as ft, Fragment as nt, renderList as lt, 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 A, San as dt, 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])];
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 tt, useTemplateRef as Co, computed as A, onMounted as Eo, onUnmounted as Lo, watch as ro, createCommentVNode as ot, unref as a, normalizeStyle as at, Fragment as nt, renderList as lt, mergeProps as Bo, createBlock as uo, resolveDynamicComponent as io, withModifiers as Mo, renderSlot as $o, h as To } from "vue";
2
+ import { Hexchess as co, position as fe, San as ft, isPromotionPosition as Fo } 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(u) {
7
- return u.map(t);
6
+ function n(i) {
7
+ return i.map(t);
8
8
  }
9
- function e(u) {
9
+ function e(i) {
10
10
  return [
11
- x(u, -300, ue),
12
- x(u, 0, ue),
13
- x(u, -60, ue),
14
- x(u, -120, ue),
15
- x(u, -180, ue),
16
- x(u, -240, ue)
11
+ x(i, -300, ue),
12
+ x(i, 0, ue),
13
+ x(i, -60, ue),
14
+ x(i, -120, ue),
15
+ x(i, -180, ue),
16
+ x(i, -240, ue)
17
17
  ];
18
18
  }
19
- function x(u, $, d) {
20
- const V = Ro($);
19
+ function x(i, B, v) {
20
+ const Q = Ro(B);
21
21
  return [
22
- d * Math.cos(V) + u[0],
23
- d * Math.sin(V) + u[1]
22
+ v * Math.cos(Q) + i[0],
23
+ v * Math.sin(Q) + i[1]
24
24
  ];
25
25
  }
26
- function Ro(u) {
27
- return u * (Math.PI / 180);
26
+ function Ro(i) {
27
+ return i * (Math.PI / 180);
28
28
  }
29
- function t(u) {
30
- return [-u[0], -u[1]];
29
+ function t(i) {
30
+ return [-i[0], -i[1]];
31
31
  }
32
- function l(u, $) {
33
- return [u[0] + $[0], u[1] + $[1]];
32
+ function l(i, B) {
33
+ return [i[0] + B[0], i[1] + B[1]];
34
34
  }
35
- function de(u) {
36
- return he / 2 + u;
35
+ function ve(i) {
36
+ return de / 2 + i;
37
37
  }
38
- function ve(u) {
39
- return he / 2 - u;
38
+ function he(i) {
39
+ return de / 2 - i;
40
40
  }
41
- const he = 23.6, So = {
41
+ const de = 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,37 +57,37 @@ const he = 23.6, So = {
57
57
  // red-500
58
58
  targetColor: "oklch(63.7% 0.237 25.331)"
59
59
  // red-500
60
- }, qo = "b/qbk/n1b1n/r5r/ppppppppp/11/5P5/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 w - 0 1", i = 1.7, U = 1.7, ue = 2 / Math.sqrt(3), p = ue * (Math.sqrt(3) / 2) * 2, w = p * 2, y = p * 3, k = p * 4, E = p * 5, m = [0, 0], D = x(m, 150, E), S = x(m, 150, k), H = x(m, 150, y), q = x(m, 150, w), M = x(m, 150, p), T = x(m, 30, p), N = x(m, 30, w), O = x(m, 30, y), z = x(m, 30, k), X = x(m, 30, E), Z = l(D, [0, -E]), j = l(S, [0, -E]), pe = l(H, [0, -E]), me = l(q, [0, -E]), ge = l(M, [0, -E]), we = l(m, [0, -E]), ye = l(T, [0, -E]), be = l(N, [0, -E]), xe = l(O, [0, -E]), G = l(z, [0, -E]), J = l(X, [0, -E]), I = l(D, [0, -k]), _ = l(S, [0, -k]), ke = l(H, [0, -k]), Pe = l(q, [0, -k]), Ce = l(M, [0, -k]), Ee = l(m, [0, -k]), $e = l(T, [0, -k]), Le = l(N, [0, -k]), Be = l(O, [0, -k]), ee = l(z, [0, -k]), te = l(X, [0, -k]), Me = l(D, [0, -y]), Te = l(S, [0, -y]), vt = l(H, [0, -y]), ht = l(q, [0, -y]), pt = l(M, [0, -y]), mt = l(m, [0, -y]), gt = l(T, [0, -y]), wt = l(N, [0, -y]), yt = l(O, [0, -y]), Fe = l(z, [0, -y]), Re = l(X, [0, -y]), Se = l(D, [0, -w]), qe = l(S, [0, -w]), bt = l(H, [0, -w]), xt = l(q, [0, -w]), kt = l(M, [0, -w]), Pt = l(m, [0, -w]), Ct = l(T, [0, -w]), Et = l(N, [0, -w]), $t = l(O, [0, -w]), Ne = l(z, [0, -w]), ze = l(X, [0, -w]), We = l(D, [0, -p]), Ae = l(S, [0, -p]), Lt = l(H, [0, -p]), Bt = l(q, [0, -p]), Mt = l(M, [0, -p]), Tt = l(m, [0, -p]), Ft = l(T, [0, -p]), Rt = l(N, [0, -p]), St = l(O, [0, -p]), De = l(z, [0, -p]), He = l(X, [0, -p]), Oe = l(S, [0, p]), Xe = l(H, [0, p]), qt = l(q, [0, p]), Nt = l(M, [0, p]), zt = l(m, [0, p]), Wt = l(T, [0, p]), At = l(N, [0, p]), Ye = l(O, [0, p]), Ke = l(z, [0, p]), Qe = l(H, [0, w]), Ve = l(q, [0, w]), Dt = l(M, [0, w]), Ht = l(m, [0, w]), Ot = l(T, [0, w]), Ue = l(N, [0, w]), Ze = l(O, [0, w]), je = l(q, [0, y]), Ge = l(M, [0, y]), Xt = l(m, [0, y]), Je = l(T, [0, y]), Ie = l(N, [0, y]), oe = l(M, [0, k]), ne = l(m, [0, k]), le = l(T, [0, k]), se = l(m, [0, E]), o = [
61
- [2, se, t(se), e(se), n(e(se))],
62
- [1, oe, t(oe), e(oe), n(e(oe))],
63
- [0, ne, t(ne), e(ne), n(e(ne))],
64
- [1, le, t(le), e(le), n(e(le))],
60
+ }, qo = "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, w = p * 2, y = p * 3, k = p * 4, L = p * 5, m = [0, 0], D = x(m, 150, L), S = x(m, 150, k), H = x(m, 150, y), q = x(m, 150, w), $ = x(m, 150, p), T = x(m, 30, p), N = x(m, 30, w), O = x(m, 30, y), z = x(m, 30, k), X = x(m, 30, L), U = l(D, [0, -L]), Z = l(S, [0, -L]), pe = l(H, [0, -L]), me = l(q, [0, -L]), ge = l($, [0, -L]), we = l(m, [0, -L]), ye = l(T, [0, -L]), be = l(N, [0, -L]), xe = l(O, [0, -L]), j = l(z, [0, -L]), G = l(X, [0, -L]), I = l(D, [0, -k]), J = l(S, [0, -k]), ke = l(H, [0, -k]), Pe = l(q, [0, -k]), Ce = l($, [0, -k]), Ee = l(m, [0, -k]), Le = l(T, [0, -k]), Be = l(N, [0, -k]), Me = l(O, [0, -k]), _ = l(z, [0, -k]), ee = l(X, [0, -k]), $e = l(D, [0, -y]), Te = l(S, [0, -y]), vt = l(H, [0, -y]), ht = l(q, [0, -y]), dt = l($, [0, -y]), pt = l(m, [0, -y]), mt = l(T, [0, -y]), gt = l(N, [0, -y]), wt = l(O, [0, -y]), Fe = l(z, [0, -y]), Re = l(X, [0, -y]), Se = l(D, [0, -w]), qe = l(S, [0, -w]), yt = l(H, [0, -w]), bt = l(q, [0, -w]), xt = l($, [0, -w]), kt = l(m, [0, -w]), Pt = l(T, [0, -w]), Ct = l(N, [0, -w]), Et = l(O, [0, -w]), Ne = l(z, [0, -w]), ze = l(X, [0, -w]), We = l(D, [0, -p]), Ae = l(S, [0, -p]), Lt = l(H, [0, -p]), Bt = l(q, [0, -p]), Mt = l($, [0, -p]), $t = l(m, [0, -p]), Tt = l(T, [0, -p]), Ft = l(N, [0, -p]), Rt = l(O, [0, -p]), De = l(z, [0, -p]), He = l(X, [0, -p]), Oe = l(S, [0, p]), Xe = l(H, [0, p]), St = l(q, [0, p]), qt = l($, [0, p]), Nt = l(m, [0, p]), zt = l(T, [0, p]), Wt = l(N, [0, p]), Ye = l(O, [0, p]), Ke = l(z, [0, p]), Qe = l(H, [0, w]), Ve = l(q, [0, w]), At = l($, [0, w]), Dt = l(m, [0, w]), Ht = l(T, [0, w]), Ue = l(N, [0, w]), Ze = l(O, [0, w]), je = l(q, [0, y]), Ge = l($, [0, y]), Ot = l(m, [0, y]), Ie = l(T, [0, y]), Je = l(N, [0, y]), te = l($, [0, k]), oe = l(m, [0, k]), ne = l(T, [0, k]), 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
65
  [0, je, t(je), e(je), n(e(je))],
66
66
  [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
- [0, Ie, t(Ie), e(Ie), n(e(Ie))],
67
+ [1, Ot, t(Ot), e(Ot), n(e(Ot))],
68
+ [2, Ie, t(Ie), e(Ie), n(e(Ie))],
69
+ [0, Je, t(Je), e(Je), n(e(Je))],
70
70
  [2, Qe, t(Qe), e(Qe), n(e(Qe))],
71
71
  [1, Ve, t(Ve), e(Ve), n(e(Ve))],
72
- [0, Dt, t(Dt), e(Dt), n(e(Dt))],
73
- [2, Ht, t(Ht), e(Ht), n(e(Ht))],
74
- [0, Ot, t(Ot), e(Ot), n(e(Ot))],
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
75
  [1, Ue, t(Ue), e(Ue), n(e(Ue))],
76
76
  [2, Ze, t(Ze), e(Ze), n(e(Ze))],
77
77
  [1, Oe, t(Oe), e(Oe), n(e(Oe))],
78
78
  [0, Xe, t(Xe), e(Xe), n(e(Xe))],
79
- [2, qt, t(qt), e(qt), n(e(qt))],
80
- [1, Nt, t(Nt), e(Nt), n(e(Nt))],
81
- [0, zt, t(zt), e(zt), n(e(zt))],
82
- [1, Wt, t(Wt), e(Wt), n(e(Wt))],
83
- [2, At, t(At), e(At), n(e(At))],
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
84
  [0, Ye, t(Ye), e(Ye), n(e(Ye))],
85
85
  [1, Ke, t(Ke), e(Ke), n(e(Ke))],
86
86
  [0, D, t(D), e(D), n(e(D))],
87
87
  [2, S, t(S), e(S), n(e(S))],
88
88
  [1, H, t(H), e(H), n(e(H))],
89
89
  [0, q, t(q), e(q), n(e(q))],
90
- [2, M, t(M), e(M), n(e(M))],
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))],
@@ -99,47 +99,47 @@ const he = 23.6, So = {
99
99
  [2, Lt, t(Lt), e(Lt), n(e(Lt))],
100
100
  [1, Bt, t(Bt), e(Bt), n(e(Bt))],
101
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))],
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
106
  [0, De, t(De), e(De), n(e(De))],
107
107
  [1, He, t(He), e(He), n(e(He))],
108
108
  [2, Se, t(Se), e(Se), n(e(Se))],
109
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))],
115
- [2, Et, t(Et), e(Et), n(e(Et))],
116
- [0, $t, t($t), e($t), n(e($t))],
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
117
  [1, Ne, t(Ne), e(Ne), n(e(Ne))],
118
118
  [2, ze, t(ze), e(ze), n(e(ze))],
119
- [0, Me, t(Me), e(Me), n(e(Me))],
119
+ [0, $e, t($e), e($e), n(e($e))],
120
120
  [2, Te, t(Te), e(Te), n(e(Te))],
121
121
  [1, vt, t(vt), e(vt), n(e(vt))],
122
122
  [0, ht, t(ht), e(ht), n(e(ht))],
123
- [2, pt, t(pt), e(pt), n(e(pt))],
124
- [1, mt, t(mt), e(mt), n(e(mt))],
125
- [2, gt, t(gt), e(gt), n(e(gt))],
126
- [0, wt, t(wt), e(wt), n(e(wt))],
127
- [1, yt, t(yt), e(yt), n(e(yt))],
123
+ [2, dt, t(dt), e(dt), n(e(dt))],
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
128
  [2, Fe, t(Fe), e(Fe), n(e(Fe))],
129
129
  [0, Re, t(Re), e(Re), n(e(Re))],
130
130
  [1, I, t(I), e(I), n(e(I))],
131
- [0, _, t(_), e(_), n(e(_))],
131
+ [0, J, t(J), e(J), n(e(J))],
132
132
  [2, ke, t(ke), e(ke), n(e(ke))],
133
133
  [1, Pe, t(Pe), e(Pe), n(e(Pe))],
134
134
  [0, Ce, t(Ce), e(Ce), n(e(Ce))],
135
135
  [2, Ee, t(Ee), e(Ee), n(e(Ee))],
136
- [0, $e, t($e), e($e), n(e($e))],
137
- [1, Le, t(Le), e(Le), n(e(Le))],
138
- [2, Be, t(Be), e(Be), n(e(Be))],
139
- [0, ee, t(ee), e(ee), n(e(ee))],
140
- [1, te, t(te), e(te), n(e(te))],
141
- [2, Z, t(Z), e(Z), n(e(Z))],
142
- [1, j, t(j), e(j), n(e(j))],
136
+ [0, Le, t(Le), e(Le), n(e(Le))],
137
+ [1, Be, t(Be), e(Be), n(e(Be))],
138
+ [2, Me, t(Me), e(Me), n(e(Me))],
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
143
  [0, pe, t(pe), e(pe), n(e(pe))],
144
144
  [2, me, t(me), e(me), n(e(me))],
145
145
  [1, ge, t(ge), e(ge), n(e(ge))],
@@ -147,42 +147,42 @@ const he = 23.6, So = {
147
147
  [1, ye, t(ye), e(ye), n(e(ye))],
148
148
  [2, be, t(be), e(be), n(e(be))],
149
149
  [0, xe, t(xe), e(xe), n(e(xe))],
150
- [1, G, t(G), e(G), n(e(G))],
151
- [2, J, t(J), e(J), n(e(J))]
150
+ [1, j, t(j), e(j), n(e(j))],
151
+ [2, G, t(G), e(G), n(e(G))]
152
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))]
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(Ge, je, u), t(r(Ge, je, u))],
156
+ ["8", r(Ve, Qe, u), t(r(Ve, Qe, u))],
157
+ ["7", r(Xe, Oe, u), t(r(Xe, Oe, u))],
158
+ ["6", r(S, D, u), t(r(S, D, u))],
159
+ ["5", r(Ae, We, u), t(r(Ae, We, u))],
160
+ ["4", r(qe, Se, u), t(r(qe, Se, u))],
161
+ ["3", r(Te, $e, u), t(r(Te, $e, 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(ke, pe, u), t(r(ke, pe, u))],
167
+ ["d", r(Pe, me, u), t(r(Pe, me, u))],
168
+ ["e", r(Ce, ge, u), t(r(Ce, ge, u))],
169
+ ["f", r(Ee, we, u), t(r(Ee, we, u))],
170
+ ["g", r(Le, ye, u), t(r(Le, ye, u))],
171
+ ["h", r(Be, be, u), t(r(Be, be, u))],
172
+ ["i", r(Me, xe, u), t(r(Me, xe, 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(Fe, Re, u), t(r(Fe, Re, u))],
178
+ ["4", r(Ne, ze, u), t(r(Ne, ze, u))],
179
+ ["5", r(De, He, u), t(r(De, He, u))],
180
+ ["6", r(z, X, u), t(r(z, X, u))],
181
+ ["7", r(Ye, Ke, u), t(r(Ye, Ke, u))],
182
+ ["8", r(Ue, Ze, u), t(r(Ue, Ze, u))],
183
+ ["9", r(Ie, Je, u), t(r(Ie, Je, u))],
184
+ ["10", r(oe, ne, u), t(r(oe, ne, u))],
185
+ ["11", r(te, le, u), t(r(te, le, u))]
186
186
  ], zo = [
187
187
  o[
188
188
  0
@@ -557,17 +557,17 @@ const he = 23.6, So = {
557
557
  /* e10 */
558
558
  ][3][0]
559
559
  ];
560
- function Yt(u) {
561
- if (u.length === 0)
560
+ function Xt(i) {
561
+ if (i.length === 0)
562
562
  return "";
563
- const [$, ...d] = u;
564
- let V = `M ${R(de($[0]))} ${R(ve($[1]))} L `;
565
- for (const F of d)
566
- V += `${R(de(F[0]))} ${R(ve(F[1]))} `;
567
- return `${V} Z`;
563
+ const [B, ...v] = i;
564
+ let Q = `M ${R(ve(B[0]))} ${R(he(B[1]))} L `;
565
+ for (const F of v)
566
+ Q += `${R(ve(F[0]))} ${R(he(F[1]))} `;
567
+ return `${Q} Z`;
568
568
  }
569
- function R(u) {
570
- return u.toFixed(8);
569
+ function R(i) {
570
+ return i.toFixed(8);
571
571
  }
572
572
  const Wo = {
573
573
  viewBox: "0 0 50 50",
@@ -577,10 +577,10 @@ const Wo = {
577
577
  props: {
578
578
  type: {}
579
579
  },
580
- setup(u) {
581
- return ($, d) => (b(), P("svg", Wo, [
580
+ setup(i) {
581
+ return (B, v) => (b(), P("svg", Wo, [
582
582
  fo("text", {
583
- textContent: vo(u.type),
583
+ textContent: vo(i.type),
584
584
  "dominant-baseline": "middle",
585
585
  "font-family": "sans-serif",
586
586
  "font-size": "30",
@@ -590,11 +590,11 @@ const Wo = {
590
590
  y: "27",
591
591
  stroke: "oklch(37.3% 0.034 259.733)",
592
592
  "stroke-width": "2",
593
- fill: u.type === u.type.toLowerCase() ? "oklch(13% 0.028 261.692)" : "oklch(98.5% 0.002 247.839)"
593
+ fill: i.type === i.type.toLowerCase() ? "oklch(13% 0.028 261.692)" : "oklch(98.5% 0.002 247.839)"
594
594
  }, null, 8, Ao)
595
595
  ]));
596
596
  }
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({
597
+ }), Ho = ["viewBox"], Oo = ["d", "fill"], Xo = ["d", "data-hexboard-position", "fill"], Yo = ["d", "fill"], Ko = ["d", "fill"], Qo = ["textContent", "x", "y"], Vo = ["cx", "cy", "fill"], Uo = ["viewBox"], Go = /* @__PURE__ */ ao({
598
598
  __name: "Hexboard",
599
599
  props: /* @__PURE__ */ so({
600
600
  active: { type: Boolean, default: !1 },
@@ -625,179 +625,179 @@ const Wo = {
625
625
  targetsModifiers: {}
626
626
  }),
627
627
  emits: /* @__PURE__ */ so(["clickPosition", "move"], ["update:mouseover-position", "update:selected", "update:targets"]),
628
- setup(u, { emit: $ }) {
629
- const d = u, V = $, F = Zt(u, "mouseover-position"), L = Zt(u, "selected"), Y = Zt(u, "targets"), _e = tt({ x: 0, y: 0 }), B = tt(null), ce = tt(re()), h = tt({
628
+ setup(i, { emit: B }) {
629
+ const v = i, Q = B, F = Zt(i, "mouseover-position"), C = Zt(i, "selected"), W = Zt(i, "targets"), _e = tt({ x: 0, y: 0 }), M = tt(null), ie = tt(se()), d = tt({
630
630
  hexchess: null,
631
631
  promotionEl: null,
632
632
  promotionFrom: null,
633
633
  promotionTo: null,
634
634
  selected: null
635
- }), Kt = Co("svgEl"), K = tt(re());
636
- let Qt = !1;
637
- const ho = W(() => h.value.hexchess ? [] : Y.value), ae = W(() => h.value.hexchess ? h.value.hexchess : d.hexchess ? d.hexchess : co.init()), po = W(() => ae.value.board.reduce(
638
- (s, f, a) => (f && a !== B.value && s.push({ piece: f, index: a }), s),
635
+ }), Yt = Co("svgEl"), Y = tt(se());
636
+ let Kt = !1;
637
+ const ho = A(() => d.value.hexchess ? [] : W.value), ce = A(() => d.value.hexchess ? d.value.hexchess : v.hexchess ? v.hexchess : co.init()), po = A(() => ce.value.board.reduce(
638
+ (s, f, c) => (f && c !== M.value && s.push({ piece: f, index: c }), s),
639
639
  []
640
- )), st = W(() => typeof h.value.selected == "number" ? null : L.value), jt = W(() => {
641
- var s, f, a;
640
+ )), Qt = A(() => typeof d.value.selected == "number" ? null : C.value), jt = A(() => {
641
+ var s, f, c;
642
642
  if (Vt.value)
643
643
  return "grabbing";
644
- if (!(!d.active || F.value === null || h.value.hexchess)) {
645
- if (L.value !== null && Y.value.includes(F.value)) {
646
- const v = (s = ae.value) == null ? void 0 : s.board[L.value];
647
- if (v) {
648
- const g = v === v.toLowerCase() ? "b" : "w", C = ((f = ae.value) == null ? void 0 : f.turn) === g;
649
- if ((d.playing === !0 || C) && ut(L.value))
644
+ if (!(!v.active || F.value === null || d.value.hexchess)) {
645
+ if (C.value !== null && W.value.includes(F.value)) {
646
+ const h = (s = ce.value) == null ? void 0 : s.board[C.value];
647
+ if (h) {
648
+ const g = h === h.toLowerCase() ? "b" : "w", E = ((f = ce.value) == null ? void 0 : f.turn) === g;
649
+ if ((v.playing === !0 || E) && ut(C.value))
650
650
  return "pointer";
651
651
  }
652
652
  }
653
- if (rt.value)
654
- return d.playing === !0 || d.playing && Jt.value === ((a = ae.value) == null ? void 0 : a.turn) && d.playing === Jt.value ? "grab" : "pointer";
653
+ if (st.value)
654
+ return v.playing === !0 || v.playing && It.value === ((c = ce.value) == null ? void 0 : c.turn) && v.playing === It.value ? "grab" : "pointer";
655
655
  }
656
- }), Gt = W(() => ({
657
- x: _e.value.x - K.value.width / 2,
658
- y: _e.value.y - K.value.height / 2
659
- })), Vt = W(() => !d.hexchess || h.value.hexchess || B.value === null ? null : d.hexchess.board[B.value]), Q = W(() => ({ ...So, ...d.options })), Jt = W(() => rt.value ? rt.value === rt.value.toLowerCase() ? "b" : "w" : null), rt = W(() => {
656
+ }), Gt = A(() => ({
657
+ x: _e.value.x - Y.value.width / 2,
658
+ y: _e.value.y - Y.value.height / 2
659
+ })), Vt = A(() => !v.hexchess || d.value.hexchess || M.value === null ? null : v.hexchess.board[M.value]), K = A(() => ({ ...So, ...v.options })), It = A(() => st.value ? st.value === st.value.toLowerCase() ? "b" : "w" : null), st = A(() => {
660
660
  var s;
661
- return F.value === null ? null : ((s = ae.value) == null ? void 0 : s.board[F.value]) ?? null;
662
- }), it = W(() => {
663
- var v;
664
- const s = (v = h.value.hexchess) == null ? void 0 : v.board[h.value.selected ?? -1], f = s === (s == null ? void 0 : s.toUpperCase()), a = (g) => (C) => To(d.pieces, { ...C, type: g });
661
+ return F.value === null ? null : ((s = ce.value) == null ? void 0 : s.board[F.value]) ?? null;
662
+ }), rt = A(() => {
663
+ var h;
664
+ const s = (h = d.value.hexchess) == null ? void 0 : h.board[d.value.selected ?? -1], f = s === (s == null ? void 0 : s.toUpperCase()), c = (g) => (E) => To(v.pieces, { ...E, type: g });
665
665
  return {
666
- n: a(f ? "N" : "n"),
667
- b: a(f ? "B" : "b"),
668
- r: a(f ? "R" : "r"),
669
- q: a(f ? "Q" : "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
- d.active && It();
674
- }), $o(lo), ro(jt, (s) => {
673
+ v.active && Jt();
674
+ }), Lo(lo), ro(jt, (s) => {
675
675
  document.body.style.setProperty(
676
676
  "cursor",
677
677
  s === "grabbing" ? "grabbing" : null
678
678
  );
679
679
  }), ro(
680
- () => d.active,
681
- (s) => s ? It() : lo()
680
+ () => v.active,
681
+ (s) => s ? Jt() : lo()
682
682
  );
683
683
  function Ut(s, f) {
684
- var C, ie;
685
- if (!Y.value.includes(s.to))
684
+ var E, re;
685
+ if (!W.value.includes(s.to))
686
686
  return;
687
- const a = (C = d.hexchess) == null ? void 0 : C.board[s.from];
688
- if (!a)
687
+ const c = (E = v.hexchess) == null ? void 0 : E.board[s.from];
688
+ if (!c)
689
689
  return;
690
- const v = a === a.toLowerCase() ? "b" : "w", g = ((ie = d.hexchess) == null ? void 0 : ie.turn) === v;
691
- if (d.hexchess && (a === "p" || a === "P") && Fo(s.to, v)) {
692
- const fe = d.hexchess.clone();
693
- fe.board[s.from] = null, fe.board[s.to] = a, h.value = {
694
- hexchess: fe,
690
+ const h = c === c.toLowerCase() ? "b" : "w", g = ((re = v.hexchess) == null ? void 0 : re.turn) === h;
691
+ if (v.hexchess && (c === "p" || c === "P") && Fo(s.to, h)) {
692
+ const ae = v.hexchess.clone();
693
+ ae.board[s.from] = null, ae.board[s.to] = c, d.value = {
694
+ hexchess: ae,
695
695
  promotionEl: (f == null ? void 0 : f.target) instanceof Element ? f.target : null,
696
696
  promotionFrom: s.from,
697
697
  promotionTo: s.to,
698
698
  selected: s.to
699
- }, (f == null ? void 0 : f.target) instanceof Element && (ce.value = f.target.getBoundingClientRect());
699
+ }, (f == null ? void 0 : f.target) instanceof Element && (ie.value = f.target.getBoundingClientRect());
700
700
  return;
701
701
  }
702
- ut(s.from) && (d.ignoreTurn || g) && eo(s);
702
+ ut(s.from) && (v.ignoreTurn || g) && eo(s);
703
703
  }
704
704
  function ut(s) {
705
- var v;
706
- const f = (v = d.hexchess) == null ? void 0 : v.board[s];
705
+ var h;
706
+ const f = (h = v.hexchess) == null ? void 0 : h.board[s];
707
707
  if (!f)
708
708
  return !1;
709
- const a = f === f.toLowerCase() ? "b" : "w";
710
- return d.playing === !0 || d.playing === a;
709
+ const c = f === f.toLowerCase() ? "b" : "w";
710
+ return v.playing === !0 || v.playing === c;
711
711
  }
712
712
  function mo(s) {
713
- var f, a;
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;
713
+ var f, c;
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
715
  }
716
- function It() {
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 });
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 });
718
718
  }
719
- function ct() {
719
+ function it() {
720
720
  var s;
721
- ce.value = ((s = h.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? re();
721
+ ie.value = ((s = d.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? se();
722
722
  }
723
723
  function go(s, f) {
724
- if (d.active) {
725
- if (Qt) {
726
- Qt = !1;
724
+ if (v.active) {
725
+ if (Kt) {
726
+ Kt = !1;
727
727
  return;
728
728
  }
729
- if (h.value.hexchess) {
730
- h.value.selected !== s && et();
729
+ if (d.value.hexchess) {
730
+ d.value.selected !== s && et();
731
731
  return;
732
732
  }
733
- if (L.value !== null && Y.value.includes(s)) {
734
- const a = new dt({ from: L.value, to: s });
735
- Ut(a, f);
733
+ if (C.value !== null && W.value.includes(s)) {
734
+ const c = new ft({ from: C.value, to: s });
735
+ Ut(c, f);
736
736
  return;
737
737
  }
738
- d.autoselect && !d.hexchess.board[s] && (L.value = null, Y.value = []), V("clickPosition", s);
738
+ v.autoselect && !v.hexchess.board[s] && (C.value = null, W.value = []), Q("clickPosition", s);
739
739
  }
740
740
  }
741
741
  function _t(s) {
742
742
  if (s.key === "Escape") {
743
- if (h.value.hexchess) {
743
+ if (d.value.hexchess) {
744
744
  et();
745
745
  return;
746
746
  }
747
- d.autoselect && (L.value = null, Y.value = []);
747
+ v.autoselect && (C.value = null, W.value = []);
748
748
  }
749
749
  }
750
750
  function eo(s) {
751
- V("move", s), at();
751
+ Q("move", s), ct();
752
752
  }
753
753
  function wo(s, f) {
754
- var a;
755
- if (f.stopPropagation(), B.value !== null) {
756
- let v = s;
754
+ var c;
755
+ if (f.stopPropagation(), M.value !== null) {
756
+ let h = s;
757
757
  const g = document.elementFromPoint(
758
758
  f.clientX,
759
759
  f.clientY
760
- ), C = g == null ? void 0 : g.getAttribute("data-hexboard-position");
761
- C !== null && (v = Number(C));
762
- const ie = new dt({ from: B.value, to: v });
763
- if (Ut(ie, f), h.value.hexchess)
760
+ ), E = g == null ? void 0 : g.getAttribute("data-hexboard-position");
761
+ E !== null && (h = Number(E));
762
+ const re = new ft({ from: M.value, to: h });
763
+ if (Ut(re, f), d.value.hexchess)
764
764
  return;
765
- B.value = null, K.value = re();
765
+ M.value = null, Y.value = se();
766
766
  return;
767
767
  }
768
- if (L.value !== null && Y.value.includes(s)) {
769
- const v = new dt({ from: L.value, to: s });
770
- return Ut(v, f), h.value.hexchess, void 0;
768
+ if (C.value !== null && W.value.includes(s)) {
769
+ const h = new ft({ from: C.value, to: s });
770
+ return Ut(h, f), d.value.hexchess, void 0;
771
771
  }
772
- if (h.value.hexchess) {
772
+ if (d.value.hexchess) {
773
773
  et();
774
774
  return;
775
775
  }
776
- if ((a = d.hexchess) != null && a.board[s]) {
777
- B.value = null, K.value = re();
776
+ if ((c = v.hexchess) != null && c.board[s]) {
777
+ M.value = null, Y.value = se();
778
778
  return;
779
779
  }
780
- at();
780
+ ct();
781
781
  }
782
782
  function et() {
783
- const s = h.value.promotionFrom;
784
- h.value = {
783
+ const s = d.value.promotionFrom;
784
+ d.value = {
785
785
  hexchess: null,
786
786
  promotionEl: null,
787
787
  promotionFrom: null,
788
788
  promotionTo: null,
789
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;
790
+ }, typeof s == "number" && (C.value = s, W.value = v.hexchess.movesFrom(s).map((f) => f.to) ?? []), M.value = null, Kt = !0;
791
791
  }
792
792
  function yo(s, f) {
793
- var C, ie, fe;
794
- if (f.preventDefault(), h.value.hexchess)
793
+ var E, re, ae;
794
+ if (f.preventDefault(), d.value.hexchess || C.value !== null && W.value.includes(s))
795
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)))
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
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()));
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
801
  }
802
802
  function bo(s) {
803
803
  F.value = s;
@@ -806,33 +806,33 @@ const Wo = {
806
806
  F.value = null;
807
807
  }
808
808
  function to(s) {
809
- d.active && (_e.value = { x: s.clientX, y: s.clientY });
809
+ v.active && (_e.value = { x: s.clientX, y: s.clientY });
810
810
  }
811
811
  function oo(s) {
812
- B.value !== null && s.preventDefault();
812
+ M.value !== null && s.preventDefault();
813
813
  }
814
814
  function no() {
815
- if (h.value.hexchess) {
815
+ if (d.value.hexchess) {
816
816
  et();
817
817
  return;
818
818
  }
819
- if (B.value !== null) {
820
- B.value = null, K.value = re();
819
+ if (M.value !== null) {
820
+ M.value = null, Y.value = se();
821
821
  return;
822
822
  }
823
- at();
823
+ ct();
824
824
  }
825
825
  function ko(s) {
826
- if (typeof h.value.promotionFrom == "number" && ut(h.value.promotionFrom)) {
827
- const f = new dt({
828
- from: h.value.promotionFrom ?? 0,
829
- to: h.value.promotionTo ?? 0,
826
+ if (typeof d.value.promotionFrom == "number" && ut(d.value.promotionFrom)) {
827
+ const f = new ft({
828
+ from: d.value.promotionFrom ?? 0,
829
+ to: d.value.promotionTo ?? 0,
830
830
  promotion: s
831
831
  });
832
832
  eo(f);
833
833
  }
834
834
  }
835
- function re() {
835
+ function se() {
836
836
  return {
837
837
  bottom: 0,
838
838
  height: 0,
@@ -844,145 +844,138 @@ const Wo = {
844
844
  y: 0
845
845
  };
846
846
  }
847
- function at() {
848
- document.body.style.setProperty("cursor", null), B.value = null, L.value = null, h.value = {
847
+ function ct() {
848
+ document.body.style.setProperty("cursor", null), M.value = null, C.value = null, d.value = {
849
849
  hexchess: null,
850
850
  promotionEl: null,
851
851
  promotionFrom: null,
852
852
  promotionTo: null,
853
853
  selected: null
854
- }, K.value = re(), Y.value = [];
854
+ }, Y.value = se(), W.value = [];
855
855
  }
856
856
  function lo() {
857
- at(), window.removeEventListener("keyup", _t), window.removeEventListener("pointermove", to), window.removeEventListener("pointerup", no), window.removeEventListener("resize", ct), window.removeEventListener("scroll", ct), window.removeEventListener("touchmove", oo);
857
+ ct(), window.removeEventListener("keyup", _t), window.removeEventListener("pointermove", to), window.removeEventListener("pointerup", no), window.removeEventListener("resize", it), window.removeEventListener("scroll", it), window.removeEventListener("touchmove", oo);
858
858
  }
859
859
  return (s, f) => (b(), P("div", null, [
860
860
  (b(), P("svg", {
861
861
  xmlns: "http://www.w3.org/2000/svg",
862
862
  ref_key: "svgEl",
863
- ref: Kt,
864
- style: ft({ cursor: jt.value }),
865
- viewBox: `0 0 ${c(he)} ${c(he)}`
863
+ ref: Yt,
864
+ style: at({ cursor: jt.value }),
865
+ viewBox: `0 0 ${a(de)} ${a(de)}`
866
866
  }, [
867
867
  fo("path", {
868
- d: c(Yt)(c(zo)),
869
- fill: Q.value.colors[1],
868
+ d: a(Xt)(a(zo)),
869
+ fill: K.value.colors[1],
870
870
  style: { pointerEvents: "none" }
871
871
  }, null, 8, Oo),
872
- (b(!0), P(nt, null, lt(c(o), (a, v) => (b(), P("path", Lo(
872
+ (b(!0), P(nt, null, lt(a(o), (c, h) => (b(), P("path", Bo(
873
873
  { ref_for: !0 },
874
- u.active ? {
875
- onClick: (g) => go(v, g),
876
- onMouseenter: () => bo(v),
874
+ i.active ? {
875
+ onClick: (g) => go(h, g),
876
+ onMouseenter: () => bo(h),
877
877
  onMouseleave: () => xo(),
878
- onPointerdown: (g) => yo(v, g),
879
- onPointerup: (g) => wo(v, g)
878
+ onPointerdown: (g) => yo(h, g),
879
+ onPointerup: (g) => wo(h, g)
880
880
  } : {},
881
881
  {
882
- d: c(Yt)(u.flipped ? a[4] : a[3]),
883
- "data-hexboard-position": v,
884
- "data-testid": `position-${c(A)(v)}`,
885
- fill: Q.value.colors[c(o)[v][0]],
886
- key: v
882
+ d: a(Xt)(i.flipped ? c[4] : c[3]),
883
+ "data-hexboard-position": h,
884
+ fill: K.value.colors[a(o)[h][0]],
885
+ key: h
887
886
  }
888
887
  ), null, 16, Xo))), 128)),
889
- (b(!0), P(nt, null, lt(u.highlight, (a) => (b(), P("path", {
890
- d: c(Yt)(u.flipped ? c(o)[a][4] : c(o)[a][3]),
891
- "data-testid": `highlight-${c(A)(a)}`,
892
- fill: Q.value.highlightColor,
893
- key: `highlight-${a}`,
888
+ (b(!0), P(nt, null, lt(i.highlight, (c) => (b(), P("path", {
889
+ d: a(Xt)(i.flipped ? a(o)[c][4] : a(o)[c][3]),
890
+ fill: K.value.highlightColor,
891
+ key: `highlight-${c}`,
894
892
  style: { pointerEvents: "none" }
895
893
  }, null, 8, Yo))), 128)),
896
- typeof st.value == "number" ? (b(), P("path", {
894
+ typeof Qt.value == "number" ? (b(), P("path", {
897
895
  key: 0,
898
- d: c(Yt)(u.flipped ? c(o)[st.value][4] : c(o)[st.value][3]),
899
- "data-testid": `selected-${c(A)(st.value)}`,
900
- fill: Q.value.selectedColor,
896
+ d: a(Xt)(i.flipped ? a(o)[Qt.value][4] : a(o)[Qt.value][3]),
897
+ fill: K.value.selectedColor,
901
898
  ref: "selectedEl",
902
899
  style: { pointerEvents: "none" }
903
900
  }, null, 8, Ko)) : ot("", !0),
904
- Q.value.labels ? (b(!0), P(nt, { key: 1 }, lt(c(No), ([a, v, g], C) => (b(), P("text", {
905
- textContent: vo(a),
901
+ K.value.labels ? (b(!0), P(nt, { key: 1 }, lt(a(No), ([c, h, g], E) => (b(), P("text", {
902
+ textContent: vo(c),
906
903
  "dominant-baseline": "central",
907
904
  "text-anchor": "middle",
908
- "data-testid": `label-${a}`,
909
- key: `label-${C}`,
910
- style: ft({
911
- fill: mo(a),
905
+ key: `label-${E}`,
906
+ style: at({
907
+ fill: mo(c),
912
908
  fontSize: ".5px",
913
909
  pointerEvents: "none",
914
910
  userSelect: "none"
915
911
  }),
916
- x: c(R)(c(de)(u.flipped ? g[0] : v[0])),
917
- y: c(R)(c(ve)(u.flipped ? g[1] : v[1]))
912
+ x: a(R)(a(ve)(i.flipped ? g[0] : h[0])),
913
+ y: a(R)(a(he)(i.flipped ? g[1] : h[1]))
918
914
  }, null, 12, Qo))), 128)) : ot("", !0),
919
- ae.value ? (b(!0), P(nt, { key: 2 }, lt(po.value, ({ piece: a, index: v }) => (b(), io(uo(u.pieces), {
920
- "data-piece-type": a,
921
- "data-testid": `piece-${c(A)(v)}`,
922
- height: c(U),
923
- key: `piece-${c(A)(v)}`,
915
+ ce.value ? (b(!0), P(nt, { key: 2 }, lt(po.value, ({ piece: c, index: h }) => (b(), uo(io(i.pieces), {
916
+ "data-piece-type": c,
917
+ height: a(V),
918
+ key: `piece-${a(fe)(h)}`,
924
919
  style: { pointerEvents: "none" },
925
- type: a,
926
- width: c(U),
927
- x: c(R)(c(de)(c(o)[v][u.flipped ? 2 : 1][0] - c(U) / 2)),
928
- y: c(R)(c(ve)(c(o)[v][u.flipped ? 2 : 1][1] + c(U) / 2))
929
- }, null, 8, ["data-piece-type", "data-testid", "height", "type", "width", "x", "y"]))), 128)) : ot("", !0),
930
- (b(!0), P(nt, null, lt(ho.value, (a) => (b(), P("circle", {
931
- cx: c(R)(c(de)(c(o)[a][u.flipped ? 2 : 1][0])),
932
- cy: c(R)(c(ve)(c(o)[a][u.flipped ? 2 : 1][1])),
933
- "data-testid": `target-${c(A)(a)}`,
934
- fill: Q.value.targetColor,
935
- key: `target-${c(A)(a)}`,
920
+ type: c,
921
+ width: a(V),
922
+ x: a(R)(a(ve)(a(o)[h][i.flipped ? 2 : 1][0] - a(V) / 2)),
923
+ y: a(R)(a(he)(a(o)[h][i.flipped ? 2 : 1][1] + a(V) / 2))
924
+ }, null, 8, ["data-piece-type", "height", "type", "width", "x", "y"]))), 128)) : ot("", !0),
925
+ (b(!0), P(nt, null, lt(ho.value, (c) => (b(), P("circle", {
926
+ cx: a(R)(a(ve)(a(o)[c][i.flipped ? 2 : 1][0])),
927
+ cy: a(R)(a(he)(a(o)[c][i.flipped ? 2 : 1][1])),
928
+ fill: K.value.targetColor,
929
+ key: `target-${a(fe)(c)}`,
936
930
  r: 0.3,
937
931
  style: { pointerEvents: "none" }
938
932
  }, null, 8, Vo))), 128))
939
933
  ], 12, Ho)),
940
934
  Vt.value ? (b(), P("svg", {
941
935
  key: 0,
942
- "data-testid": "drag-piece",
943
936
  xmlns: "http://www.w3.org/2000/svg",
944
- style: ft({
945
- height: K.value.height + "px",
937
+ style: at({
938
+ height: Y.value.height + "px",
946
939
  left: "0px",
947
940
  pointerEvents: "none",
948
941
  position: "fixed",
949
942
  top: "0px",
950
943
  transform: `translate(${Gt.value.x}px, ${Gt.value.y}px) scale(1.1)`,
951
- width: K.value.width + "px",
944
+ width: Y.value.width + "px",
952
945
  willChange: "transform"
953
946
  }),
954
- viewBox: `0 0 ${c(he)} ${c(he)}`
947
+ viewBox: `0 0 ${a(de)} ${a(de)}`
955
948
  }, [
956
- (b(), io(uo(u.pieces), {
957
- height: c(U),
949
+ (b(), uo(io(i.pieces), {
950
+ height: a(V),
958
951
  style: { pointerEvents: "none" },
959
952
  type: Vt.value,
960
- width: c(U),
961
- x: c(R)(c(de)(c(U) / -2)),
962
- y: c(R)(c(ve)(c(U) / 2))
953
+ width: a(V),
954
+ x: a(R)(a(ve)(a(V) / -2)),
955
+ y: a(R)(a(he)(a(V) / 2))
963
956
  }, null, 8, ["height", "type", "width", "x", "y"]))
964
957
  ], 12, Uo)) : ot("", !0),
965
- typeof h.value.selected == "number" ? (b(), P("div", {
958
+ typeof d.value.selected == "number" ? (b(), P("div", {
966
959
  key: 1,
967
- style: ft({
968
- height: ce.value.height + "px",
969
- left: ce.value.left + "px",
960
+ style: at({
961
+ height: ie.value.height + "px",
962
+ left: ie.value.left + "px",
970
963
  position: "fixed",
971
- top: ce.value.top + "px",
972
- width: ce.value.width + "px"
964
+ top: ie.value.top + "px",
965
+ width: ie.value.width + "px"
973
966
  }),
974
- onPointerup: f[0] || (f[0] = Bo(() => {
967
+ onPointerup: f[0] || (f[0] = Mo(() => {
975
968
  }, ["stop"]))
976
969
  }, [
977
- Mo(s.$slots, "promotion", {
978
- b: it.value.b,
970
+ $o(s.$slots, "promotion", {
971
+ b: rt.value.b,
979
972
  cancel: et,
980
- file: c(A)(h.value.selected)[0],
981
- n: it.value.n,
973
+ file: a(fe)(d.value.selected)[0],
974
+ n: rt.value.n,
982
975
  promote: ko,
983
- q: it.value.q,
984
- r: it.value.r,
985
- rank: Number(c(A)(h.value.selected).slice(1))
976
+ q: rt.value.q,
977
+ r: rt.value.r,
978
+ rank: Number(a(fe)(d.value.selected).slice(1))
986
979
  })
987
980
  ], 36)) : ot("", !0)
988
981
  ]));
package/package.json CHANGED
@@ -58,5 +58,5 @@
58
58
  "license": "MIT",
59
59
  "type": "module",
60
60
  "types": "dist/index.d.ts",
61
- "version": "0.0.8"
61
+ "version": "0.0.9"
62
62
  }
@@ -738,6 +738,12 @@ function onPointerdownPosition(index: number, evt: PointerEvent) {
738
738
  return
739
739
  }
740
740
 
741
+ // If clicking on a valid target for the selected piece, don't re-select
742
+ // (the move will be handled in onPointerupPosition/onClickPosition)
743
+ if (selected.value !== null && targets.value.includes(index)) {
744
+ return
745
+ }
746
+
741
747
  const piece = props.hexchess?.board[index]
742
748
 
743
749
  if (!piece) {
@@ -3,7 +3,7 @@ import { expect, test, vi } from 'vitest'
3
3
  import { Hexboard } from '../lib'
4
4
  import { Hexchess } from '@bedard/hexchess'
5
5
  import { index, San } from '@bedard/hexchess'
6
- import { makeMove, setup } from './utils'
6
+ import { dragMove, clickMove, setup } from './utils'
7
7
  import { page } from 'vitest/browser'
8
8
  import { ref, nextTick } from 'vue'
9
9
  import { userEvent } from 'vitest/browser'
@@ -520,23 +520,7 @@ test('drag and drop piece emits move event', async () => {
520
520
  )
521
521
  })
522
522
 
523
- const fromPosition = page.getByTestId('position-f5')
524
- const toPosition = page.getByTestId('position-f6')
525
-
526
- // Start dragging the piece (pointerdown)
527
- await fromPosition
528
- .element()
529
- .dispatchEvent(new PointerEvent('pointerdown', { bubbles: true }))
530
- await nextTick()
531
-
532
- // Verify dragging started
533
- await expect.element(page.getByTestId('drag-piece')).toBeVisible()
534
-
535
- // Move pointer to target position and release (pointerup)
536
- await toPosition
537
- .element()
538
- .dispatchEvent(new PointerEvent('pointerup', { bubbles: true }))
539
- await nextTick()
523
+ await dragMove(page, 'f5f6')
540
524
 
541
525
  // Verify move event was emitted with correct San object
542
526
  await expect(onMove).toHaveBeenCalledOnce()
@@ -644,7 +628,7 @@ test('promotion', async () => {
644
628
  )
645
629
  })
646
630
 
647
- await makeMove(page, 'f10f11')
631
+ await clickMove(page, 'f10f11')
648
632
  await page.getByTestId('promote').click()
649
633
  await expect(page.getByTestId('piece-f11')).toHaveAttribute(
650
634
  'data-piece-type',
@@ -682,7 +666,7 @@ test('canceled promotion', async () => {
682
666
  })
683
667
 
684
668
  // Move pawn to promotion square
685
- await makeMove(page, 'f10f11')
669
+ await clickMove(page, 'f10f11')
686
670
 
687
671
  // Promotion UI should be visible
688
672
  await expect.element(page.getByTestId('cancel')).toBeVisible()
@@ -730,7 +714,7 @@ test('clicking position during promotion cancels it', async () => {
730
714
  })
731
715
 
732
716
  // Move pawn to promotion square
733
- await makeMove(page, 'f10f11')
717
+ await clickMove(page, 'f10f11')
734
718
 
735
719
  // Promotion UI should be visible
736
720
  await expect.element(page.getByTestId('promote')).toBeVisible()
@@ -771,14 +755,14 @@ test('ignoreTurn allows moving pieces out of turn', async () => {
771
755
  })
772
756
 
773
757
  // Initial position is white's turn, try to move black's pawn without ignoreTurn
774
- await makeMove(page, 'f7f6')
758
+ await clickMove(page, 'f7f6')
775
759
  await expect(onMove).not.toHaveBeenCalled()
776
760
 
777
761
  // Enable ignoreTurn and try again
778
762
  ignoreTurn.value = true
779
763
  await nextTick()
780
764
 
781
- await makeMove(page, 'f7f6')
765
+ await clickMove(page, 'f7f6')
782
766
  await expect(onMove).toHaveBeenCalledOnce()
783
767
  await expect(onMove).toHaveBeenCalledWith(
784
768
  expect.objectContaining({
@@ -791,6 +775,7 @@ test('ignoreTurn allows moving pieces out of turn', async () => {
791
775
  test('dragging piece to non-target position keeps selection', async () => {
792
776
  const selected = ref<number | null>(null)
793
777
  const targets = ref<number[]>([])
778
+ const onMove = vi.fn()
794
779
 
795
780
  setup(() => {
796
781
  return () => (
@@ -801,32 +786,63 @@ test('dragging piece to non-target position keeps selection', async () => {
801
786
  playing="w"
802
787
  v-model:selected={selected.value}
803
788
  v-model:targets={targets.value}
789
+ onMove={onMove}
804
790
  />
805
791
  <div data-testid="selected-value" v-text={selected.value} />
806
792
  </>
807
793
  )
808
794
  })
809
795
 
810
- const piecePosition = page.getByTestId('position-f5')
811
- const nonTargetPosition = page.getByTestId('position-a1')
812
-
813
- // Start dragging the piece
814
- await piecePosition
815
- .element()
816
- .dispatchEvent(new PointerEvent('pointerdown', { bubbles: true }))
817
- await nextTick()
796
+ await dragMove(page, 'f5a1')
818
797
 
819
- // Verify piece is selected
798
+ // Piece should still be selected
820
799
  await expect.element(page.getByTestId('selected-f5')).toBeVisible()
821
800
  await expect(selected.value).toBe(index('f5'))
822
801
 
823
- // Release on a non-target position
824
- await nonTargetPosition
825
- .element()
826
- .dispatchEvent(new PointerEvent('pointerup', { bubbles: true }))
827
- await nextTick()
802
+ // No move should have been emitted
803
+ await expect(onMove).not.toHaveBeenCalled()
804
+ })
828
805
 
829
- // Piece should still be selected
830
- await expect.element(page.getByTestId('selected-f5')).toBeVisible()
831
- await expect(selected.value).toBe(index('f5'))
806
+ test('click capture', async () => {
807
+ const hexchess = ref(
808
+ Hexchess.parse('b/qbk/n1b1n/r5r/ppp1ppppp/11/4pP5/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 w e6 0 2'),
809
+ )
810
+
811
+ setup(() => {
812
+ return () => (
813
+ <Hexboard
814
+ active
815
+ autoselect
816
+ playing={true}
817
+ hexchess={hexchess.value}
818
+ onMove={san => hexchess.value.applyMoveUnsafe(san)}
819
+ />
820
+ )
821
+ })
822
+
823
+ await clickMove(page, 'f5e5')
824
+
825
+ await expect(hexchess.value.toString()).toBe('b/qbk/n1b1n/r5r/ppp1ppppp/11/4P6/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 b - 0 2')
826
+ })
827
+
828
+ test('drag capture', async () => {
829
+ const hexchess = ref(
830
+ Hexchess.parse('b/qbk/n1b1n/r5r/ppp1ppppp/11/4pP5/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 w e6 0 2'),
831
+ )
832
+
833
+ setup(() => {
834
+ return () => (
835
+ <Hexboard
836
+ active
837
+ autoselect
838
+ playing={true}
839
+ hexchess={hexchess.value}
840
+ onMove={san => hexchess.value.applyMoveUnsafe(san)}
841
+ />
842
+ )
843
+ })
844
+
845
+ await dragMove(page, 'f5e5')
846
+
847
+ await expect(hexchess.value.toString()).toBe('b/qbk/n1b1n/r5r/ppp1ppppp/11/4P6/4P1P4/3P1B1P3/2P2B2P2/1PRNQBKNRP1 b - 0 2')
832
848
  })
@@ -1,11 +1,12 @@
1
1
  import { position } from '@bedard/hexchess'
2
2
  import { San } from '@bedard/hexchess'
3
+ import { expect } from 'vitest'
3
4
  import type { BrowserPage } from 'vitest/browser'
4
5
  import { render } from 'vitest-browser-vue'
5
6
  import { nextTick } from 'vue'
6
7
 
7
- /** make a move on the hexboard */
8
- export async function makeMove(
8
+ /** make a move on the hexboard by clicking */
9
+ export async function clickMove(
9
10
  page: BrowserPage,
10
11
  ...sans: string[]
11
12
  ): Promise<void> {
@@ -20,6 +21,31 @@ export async function makeMove(
20
21
  }
21
22
  }
22
23
 
24
+ /** drag and drop a piece on the hexboard */
25
+ export async function dragMove(
26
+ page: BrowserPage,
27
+ ...sans: string[]
28
+ ): Promise<void> {
29
+ for (const str of sans) {
30
+ const san = San.from(str)
31
+
32
+ const fromPosition = page.getByTestId(`position-${position(san.from)}`)
33
+ const toPosition = page.getByTestId(`position-${position(san.to)}`)
34
+
35
+ await fromPosition
36
+ .element()
37
+ .dispatchEvent(new PointerEvent('pointerdown', { bubbles: true }))
38
+ await nextTick()
39
+
40
+ await expect.element(page.getByTestId('drag-piece')).toBeVisible()
41
+
42
+ await toPosition
43
+ .element()
44
+ .dispatchEvent(new PointerEvent('pointerup', { bubbles: true }))
45
+ await nextTick()
46
+ }
47
+ }
48
+
23
49
  /** setup a component */
24
50
  export function setup(setup: () => any): ReturnType<typeof render> {
25
51
  return render({ setup })
package/vite.config.ts CHANGED
@@ -27,7 +27,24 @@ export default defineConfig({
27
27
  rollupTypes: true,
28
28
  }),
29
29
  tailwindcss(),
30
- vue(),
30
+ vue({
31
+ template: {
32
+ compilerOptions: {
33
+ nodeTransforms: [
34
+ (node) => {
35
+ // remove data-testid attributes from production build
36
+ if (node.type === 1 && node.props) {
37
+ node.props = node.props
38
+ .filter(prop =>
39
+ !(prop.type === 6 && prop.name === 'data-testid')
40
+ && !(prop.type === 7 && prop.name === 'bind' && prop.arg?.type === 4 && prop.arg.content === 'data-testid'),
41
+ )
42
+ }
43
+ },
44
+ ],
45
+ },
46
+ },
47
+ }),
31
48
  ],
32
49
  resolve: {
33
50
  alias: {