@bedard/hexboard 0.0.6 → 0.0.8

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,11 @@
1
+ # 0.0.8
2
+
3
+ - Round SVG coordinates for better SSR hydration
4
+
5
+ # 0.0.7
6
+
7
+ - Export `defaultOptions` constant and `HexboardOptions` type
8
+
1
9
  # 0.0.6
2
10
 
3
11
  - Replaced CC-licensed piece artwork with simple letter representations. Custom piece assets can be provided via the `pieces` prop
package/dist/index.d.ts CHANGED
@@ -97,10 +97,12 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
97
97
  /** cancel promotion and restore original selection */
98
98
  declare function cancelPromotion(): void;
99
99
 
100
+ export declare const defaultOptions: HexboardOptions;
101
+
100
102
  export declare const Hexboard: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
101
103
 
102
104
  /** hexboard options */
103
- declare interface HexboardOptions {
105
+ export declare interface HexboardOptions {
104
106
  /** position colors */
105
107
  colors: [string, string, string];
106
108
  /** color of highlighted position */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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";
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
3
  function r(u, $, d) {
4
4
  return [u[0] + d * ($[0] - u[0]), u[1] + d * ($[1] - u[1])];
5
5
  }
@@ -8,19 +8,19 @@ function n(u) {
8
8
  }
9
9
  function e(u) {
10
10
  return [
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)
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)
17
17
  ];
18
18
  }
19
19
  function x(u, $, d) {
20
- const Q = Ro($);
20
+ const V = Ro($);
21
21
  return [
22
- d * Math.cos(Q) + u[0],
23
- d * Math.sin(Q) + u[1]
22
+ d * Math.cos(V) + u[0],
23
+ d * Math.sin(V) + u[1]
24
24
  ];
25
25
  }
26
26
  function Ro(u) {
@@ -32,13 +32,13 @@ function t(u) {
32
32
  function l(u, $) {
33
33
  return [u[0] + $[0], u[1] + $[1]];
34
34
  }
35
- function fe(u) {
36
- return ve / 2 + u;
37
- }
38
35
  function de(u) {
39
- return ve / 2 - u;
36
+ return he / 2 + u;
37
+ }
38
+ function ve(u) {
39
+ return he / 2 - u;
40
40
  }
41
- const ve = 23.6, So = {
41
+ const he = 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,132 +57,132 @@ const ve = 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, 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
- [0, Ze, t(Ze), e(Ze), n(e(Ze))],
66
- [2, je, t(je), e(je), n(e(je))],
67
- [1, Ot, t(Ot), e(Ot), n(e(Ot))],
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))],
65
+ [0, je, t(je), e(je), n(e(je))],
68
66
  [2, Ge, t(Ge), e(Ge), n(e(Ge))],
69
- [0, Je, t(Je), e(Je), n(e(Je))],
70
- [2, Ke, t(Ke), e(Ke), n(e(Ke))],
71
- [1, Qe, t(Qe), e(Qe), n(e(Qe))],
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))],
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))],
70
+ [2, Qe, t(Qe), e(Qe), n(e(Qe))],
75
71
  [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))],
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))],
75
+ [1, Ue, t(Ue), e(Ue), n(e(Ue))],
76
+ [2, Ze, t(Ze), e(Ze), n(e(Ze))],
77
+ [1, Oe, t(Oe), e(Oe), n(e(Oe))],
84
78
  [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))],
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))],
84
+ [0, Ye, t(Ye), e(Ye), n(e(Ye))],
85
+ [1, Ke, t(Ke), e(Ke), n(e(Ke))],
86
+ [0, D, t(D), e(D), n(e(D))],
87
+ [2, S, t(S), e(S), n(e(S))],
88
+ [1, H, t(H), e(H), n(e(H))],
89
+ [0, q, t(q), e(q), n(e(q))],
90
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
- [0, q, t(q), e(q), n(e(q))],
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))],
93
+ [0, N, t(N), e(N), n(e(N))],
94
+ [1, O, t(O), e(O), n(e(O))],
95
+ [2, z, t(z), e(z), n(e(z))],
96
+ [0, X, t(X), e(X), n(e(X))],
97
+ [1, We, t(We), e(We), n(e(We))],
106
98
  [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))],
99
+ [2, Lt, t(Lt), e(Lt), n(e(Lt))],
100
+ [1, Bt, t(Bt), e(Bt), n(e(Bt))],
101
+ [0, Mt, t(Mt), e(Mt), n(e(Mt))],
102
+ [2, Tt, t(Tt), e(Tt), n(e(Tt))],
103
+ [0, Ft, t(Ft), e(Ft), n(e(Ft))],
104
+ [1, Rt, t(Rt), e(Rt), n(e(Rt))],
105
+ [2, St, t(St), e(St), n(e(St))],
106
+ [0, De, t(De), e(De), n(e(De))],
107
+ [1, He, t(He), e(He), n(e(He))],
108
+ [2, Se, t(Se), e(Se), n(e(Se))],
117
109
  [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))],
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))],
117
+ [1, Ne, t(Ne), e(Ne), n(e(Ne))],
118
+ [2, ze, t(ze), e(ze), n(e(ze))],
119
+ [0, Me, t(Me), e(Me), n(e(Me))],
128
120
  [2, Te, t(Te), e(Te), n(e(Te))],
129
- [0, Fe, t(Fe), e(Fe), n(e(Fe))],
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))],
138
- [2, Le, t(Le), e(Le), n(e(Le))],
121
+ [1, vt, t(vt), e(vt), n(e(vt))],
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))],
128
+ [2, Fe, t(Fe), e(Fe), n(e(Fe))],
129
+ [0, Re, t(Re), e(Re), n(e(Re))],
130
+ [1, I, t(I), e(I), n(e(I))],
139
131
  [0, _, t(_), e(_), n(e(_))],
140
- [1, ee, t(ee), e(ee), n(e(ee))],
141
- [2, U, t(U), e(U), n(e(U))],
142
- [1, Z, t(Z), e(Z), n(e(Z))],
143
- [0, he, t(he), e(he), n(e(he))],
144
- [2, pe, t(pe), e(pe), n(e(pe))],
145
- [1, me, t(me), e(me), n(e(me))],
146
- [0, ge, t(ge), e(ge), n(e(ge))],
147
- [1, we, t(we), e(we), n(e(we))],
148
- [2, ye, t(ye), e(ye), n(e(ye))],
149
- [0, be, t(be), e(be), n(e(be))],
132
+ [2, ke, t(ke), e(ke), n(e(ke))],
133
+ [1, Pe, t(Pe), e(Pe), n(e(Pe))],
134
+ [0, Ce, t(Ce), e(Ce), n(e(Ce))],
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))],
150
142
  [1, j, t(j), e(j), n(e(j))],
151
- [2, G, t(G), e(G), n(e(G))]
143
+ [0, pe, t(pe), e(pe), n(e(pe))],
144
+ [2, me, t(me), e(me), n(e(me))],
145
+ [1, ge, t(ge), e(ge), n(e(ge))],
146
+ [0, we, t(we), e(we), n(e(we))],
147
+ [1, ye, t(ye), e(ye), n(e(ye))],
148
+ [2, be, t(be), e(be), n(e(be))],
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))]
152
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))]
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))]
186
186
  ], zo = [
187
187
  o[
188
188
  0
@@ -557,16 +557,16 @@ const ve = 23.6, So = {
557
557
  /* e10 */
558
558
  ][3][0]
559
559
  ];
560
- function Xt(u) {
560
+ function Yt(u) {
561
561
  if (u.length === 0)
562
562
  return "";
563
563
  const [$, ...d] = u;
564
- let Q = `M ${Yt(fe($[0]))} ${Yt(de($[1]))} L `;
564
+ let V = `M ${R(de($[0]))} ${R(ve($[1]))} L `;
565
565
  for (const F of d)
566
- Q += `${Yt(fe(F[0]))} ${Yt(de(F[1]))} `;
567
- return `${Q} Z`;
566
+ V += `${R(de(F[0]))} ${R(ve(F[1]))} `;
567
+ return `${V} Z`;
568
568
  }
569
- function Yt(u) {
569
+ function R(u) {
570
570
  return u.toFixed(8);
571
571
  }
572
572
  const Wo = {
@@ -626,47 +626,47 @@ const Wo = {
626
626
  }),
627
627
  emits: /* @__PURE__ */ so(["clickPosition", "move"], ["update:mouseover-position", "update:selected", "update:targets"]),
628
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({
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({
630
630
  hexchess: null,
631
631
  promotionEl: null,
632
632
  promotionFrom: null,
633
633
  promotionTo: null,
634
634
  selected: null
635
- }), Kt = Co("svgEl"), Y = et(se());
635
+ }), Kt = Co("svgEl"), K = tt(re());
636
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),
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),
639
639
  []
640
- )), lt = z(() => typeof h.value.selected == "number" ? null : L.value), jt = z(() => {
641
- var s, a, c;
640
+ )), st = W(() => typeof h.value.selected == "number" ? null : L.value), jt = W(() => {
641
+ var s, f, a;
642
642
  if (Vt.value)
643
643
  return "grabbing";
644
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];
645
+ if (L.value !== null && Y.value.includes(F.value)) {
646
+ const v = (s = ae.value) == null ? void 0 : s.board[L.value];
647
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))
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))
650
650
  return "pointer";
651
651
  }
652
652
  }
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";
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";
655
655
  }
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(() => {
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(() => {
660
660
  var s;
661
- return F.value === null ? null : ((s = ce.value) == null ? void 0 : s.board[F.value]) ?? null;
662
- }), rt = z(() => {
661
+ return F.value === null ? null : ((s = ae.value) == null ? void 0 : s.board[F.value]) ?? null;
662
+ }), it = W(() => {
663
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 });
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 });
665
665
  return {
666
- n: c(a ? "N" : "n"),
667
- b: c(a ? "B" : "b"),
668
- r: c(a ? "R" : "r"),
669
- q: c(a ? "Q" : "q")
666
+ n: a(f ? "N" : "n"),
667
+ b: a(f ? "B" : "b"),
668
+ r: a(f ? "R" : "r"),
669
+ q: a(f ? "Q" : "q")
670
670
  };
671
671
  });
672
672
  Eo(() => {
@@ -680,106 +680,106 @@ const Wo = {
680
680
  () => d.active,
681
681
  (s) => s ? It() : lo()
682
682
  );
683
- function Ut(s, a) {
684
- var C, re;
685
- if (!X.value.includes(s.to))
683
+ function Ut(s, f) {
684
+ var C, ie;
685
+ if (!Y.value.includes(s.to))
686
686
  return;
687
- const c = (C = d.hexchess) == null ? void 0 : C.board[s.from];
688
- if (!c)
687
+ const a = (C = d.hexchess) == null ? void 0 : C.board[s.from];
688
+ if (!a)
689
689
  return;
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,
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,
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
- }, (a == null ? void 0 : a.target) instanceof Element && (ue.value = a.target.getBoundingClientRect());
699
+ }, (f == null ? void 0 : f.target) instanceof Element && (ce.value = f.target.getBoundingClientRect());
700
700
  return;
701
701
  }
702
- it(s.from) && (d.ignoreTurn || g) && eo(s);
702
+ ut(s.from) && (d.ignoreTurn || g) && eo(s);
703
703
  }
704
- function it(s) {
704
+ function ut(s) {
705
705
  var v;
706
- const a = (v = d.hexchess) == null ? void 0 : v.board[s];
707
- if (!a)
706
+ const f = (v = d.hexchess) == null ? void 0 : v.board[s];
707
+ if (!f)
708
708
  return !1;
709
- const c = a === a.toLowerCase() ? "b" : "w";
710
- return d.playing === !0 || d.playing === c;
709
+ const a = f === f.toLowerCase() ? "b" : "w";
710
+ return d.playing === !0 || d.playing === a;
711
711
  }
712
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;
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;
715
715
  }
716
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 });
717
+ _e.value = { x: 0, y: 0 }, window.addEventListener("keyup", _t), window.addEventListener("pointermove", to), window.addEventListener("pointerup", no), window.addEventListener("resize", ct), window.addEventListener("scroll", ct), window.addEventListener("touchmove", oo, { passive: !1 });
718
718
  }
719
- function ut() {
719
+ function ct() {
720
720
  var s;
721
- ue.value = ((s = h.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? se();
721
+ ce.value = ((s = h.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? re();
722
722
  }
723
- function go(s, a) {
723
+ function go(s, f) {
724
724
  if (d.active) {
725
725
  if (Qt) {
726
726
  Qt = !1;
727
727
  return;
728
728
  }
729
729
  if (h.value.hexchess) {
730
- h.value.selected !== s && _e();
730
+ h.value.selected !== s && et();
731
731
  return;
732
732
  }
733
- if (L.value !== null && X.value.includes(s)) {
734
- const c = new ft({ from: L.value, to: s });
735
- Ut(c, a);
733
+ if (L.value !== null && Y.value.includes(s)) {
734
+ const a = new dt({ from: L.value, to: s });
735
+ Ut(a, f);
736
736
  return;
737
737
  }
738
- d.autoselect && !d.hexchess.board[s] && (L.value = null, X.value = []), Q("clickPosition", s);
738
+ d.autoselect && !d.hexchess.board[s] && (L.value = null, Y.value = []), V("clickPosition", s);
739
739
  }
740
740
  }
741
741
  function _t(s) {
742
742
  if (s.key === "Escape") {
743
743
  if (h.value.hexchess) {
744
- _e();
744
+ et();
745
745
  return;
746
746
  }
747
- d.autoselect && (L.value = null, X.value = []);
747
+ d.autoselect && (L.value = null, Y.value = []);
748
748
  }
749
749
  }
750
750
  function eo(s) {
751
- Q("move", s), ct();
751
+ V("move", s), at();
752
752
  }
753
- function wo(s, a) {
754
- var c;
755
- if (a.stopPropagation(), B.value !== null) {
753
+ function wo(s, f) {
754
+ var a;
755
+ if (f.stopPropagation(), B.value !== null) {
756
756
  let v = s;
757
757
  const g = document.elementFromPoint(
758
- a.clientX,
759
- a.clientY
758
+ f.clientX,
759
+ f.clientY
760
760
  ), C = g == null ? void 0 : g.getAttribute("data-hexboard-position");
761
761
  C !== null && (v = Number(C));
762
- const re = new ft({ from: B.value, to: v });
763
- if (Ut(re, a), h.value.hexchess)
762
+ const ie = new dt({ from: B.value, to: v });
763
+ if (Ut(ie, f), h.value.hexchess)
764
764
  return;
765
- B.value = null, Y.value = se();
765
+ B.value = null, K.value = re();
766
766
  return;
767
767
  }
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;
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;
771
771
  }
772
772
  if (h.value.hexchess) {
773
- _e();
773
+ et();
774
774
  return;
775
775
  }
776
- if ((c = d.hexchess) != null && c.board[s]) {
777
- B.value = null, Y.value = se();
776
+ if ((a = d.hexchess) != null && a.board[s]) {
777
+ B.value = null, K.value = re();
778
778
  return;
779
779
  }
780
- ct();
780
+ at();
781
781
  }
782
- function _e() {
782
+ function et() {
783
783
  const s = h.value.promotionFrom;
784
784
  h.value = {
785
785
  hexchess: null,
@@ -787,17 +787,17 @@ const Wo = {
787
787
  promotionFrom: null,
788
788
  promotionTo: null,
789
789
  selected: null
790
- }, typeof s == "number" && (L.value = s, X.value = d.hexchess.movesFrom(s).map((a) => a.to) ?? []), B.value = null, Qt = !0;
790
+ }, typeof s == "number" && (L.value = s, Y.value = d.hexchess.movesFrom(s).map((f) => f.to) ?? []), B.value = null, Qt = !0;
791
791
  }
792
- function yo(s, a) {
793
- var C, re, ae;
794
- if (a.preventDefault(), h.value.hexchess)
792
+ function yo(s, f) {
793
+ var C, ie, fe;
794
+ if (f.preventDefault(), h.value.hexchess)
795
795
  return;
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)))
796
+ const a = (C = d.hexchess) == null ? void 0 : C.board[s];
797
+ if (!a || (d.autoselect && (L.value = s, Y.value = ((ie = d.hexchess) == null ? void 0 : ie.movesFrom(s).map((Po) => Po.to)) ?? []), !ut(s)))
798
798
  return;
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()));
799
+ const v = a === a.toLowerCase() ? "b" : "w", g = ((fe = d.hexchess) == null ? void 0 : fe.turn) === v;
800
+ !d.ignoreTurn && !g || (B.value = s, _e.value = { x: f.clientX, y: f.clientY }, Kt.value instanceof Element && (K.value = Kt.value.getBoundingClientRect()));
801
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 && (Ie.value = { x: s.clientX, y: s.clientY });
809
+ d.active && (_e.value = { x: s.clientX, y: s.clientY });
810
810
  }
811
811
  function oo(s) {
812
812
  B.value !== null && s.preventDefault();
813
813
  }
814
814
  function no() {
815
815
  if (h.value.hexchess) {
816
- _e();
816
+ et();
817
817
  return;
818
818
  }
819
819
  if (B.value !== null) {
820
- B.value = null, Y.value = se();
820
+ B.value = null, K.value = re();
821
821
  return;
822
822
  }
823
- ct();
823
+ at();
824
824
  }
825
825
  function ko(s) {
826
- if (typeof h.value.promotionFrom == "number" && it(h.value.promotionFrom)) {
827
- const a = new ft({
826
+ if (typeof h.value.promotionFrom == "number" && ut(h.value.promotionFrom)) {
827
+ const f = new dt({
828
828
  from: h.value.promotionFrom ?? 0,
829
829
  to: h.value.promotionTo ?? 0,
830
830
  promotion: s
831
831
  });
832
- eo(a);
832
+ eo(f);
833
833
  }
834
834
  }
835
- function se() {
835
+ function re() {
836
836
  return {
837
837
  bottom: 0,
838
838
  height: 0,
@@ -844,32 +844,32 @@ const Wo = {
844
844
  y: 0
845
845
  };
846
846
  }
847
- function ct() {
847
+ function at() {
848
848
  document.body.style.setProperty("cursor", null), B.value = null, L.value = null, h.value = {
849
849
  hexchess: null,
850
850
  promotionEl: null,
851
851
  promotionFrom: null,
852
852
  promotionTo: null,
853
853
  selected: null
854
- }, Y.value = se(), X.value = [];
854
+ }, K.value = re(), Y.value = [];
855
855
  }
856
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);
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);
858
858
  }
859
- return (s, a) => (b(), P("div", null, [
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
863
  ref: Kt,
864
- style: at({ cursor: jt.value }),
865
- viewBox: `0 0 ${f(ve)} ${f(ve)}`
864
+ style: ft({ cursor: jt.value }),
865
+ viewBox: `0 0 ${c(he)} ${c(he)}`
866
866
  }, [
867
867
  fo("path", {
868
- d: f(Xt)(f(zo)),
869
- fill: K.value.colors[1],
868
+ d: c(Yt)(c(zo)),
869
+ fill: Q.value.colors[1],
870
870
  style: { pointerEvents: "none" }
871
871
  }, null, 8, Oo),
872
- (b(!0), P(ot, null, nt(f(o), (c, v) => (b(), P("path", Lo(
872
+ (b(!0), P(nt, null, lt(c(o), (a, v) => (b(), P("path", Lo(
873
873
  { ref_for: !0 },
874
874
  u.active ? {
875
875
  onClick: (g) => go(v, g),
@@ -879,60 +879,60 @@ const Wo = {
879
879
  onPointerup: (g) => wo(v, g)
880
880
  } : {},
881
881
  {
882
- d: f(Xt)(u.flipped ? c[4] : c[3]),
882
+ d: c(Yt)(u.flipped ? a[4] : a[3]),
883
883
  "data-hexboard-position": v,
884
- "data-testid": `position-${f(W)(v)}`,
885
- fill: K.value.colors[f(o)[v][0]],
884
+ "data-testid": `position-${c(A)(v)}`,
885
+ fill: Q.value.colors[c(o)[v][0]],
886
886
  key: v
887
887
  }
888
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}`,
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}`,
894
894
  style: { pointerEvents: "none" }
895
895
  }, null, 8, Yo))), 128)),
896
- typeof lt.value == "number" ? (b(), P("path", {
896
+ typeof st.value == "number" ? (b(), P("path", {
897
897
  key: 0,
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,
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,
901
901
  ref: "selectedEl",
902
902
  style: { pointerEvents: "none" }
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),
903
+ }, 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),
906
906
  "dominant-baseline": "central",
907
907
  "text-anchor": "middle",
908
- "data-testid": `label-${c}`,
908
+ "data-testid": `label-${a}`,
909
909
  key: `label-${C}`,
910
- style: at({
911
- fill: mo(c),
910
+ style: ft({
911
+ fill: mo(a),
912
912
  fontSize: ".5px",
913
913
  pointerEvents: "none",
914
914
  userSelect: "none"
915
915
  }),
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)}`,
916
+ x: c(R)(c(de)(u.flipped ? g[0] : v[0])),
917
+ y: c(R)(c(ve)(u.flipped ? g[1] : v[1]))
918
+ }, 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)}`,
924
924
  style: { pointerEvents: "none" },
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)}`,
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)}`,
936
936
  r: 0.3,
937
937
  style: { pointerEvents: "none" }
938
938
  }, null, 8, Vo))), 128))
@@ -941,53 +941,54 @@ const Wo = {
941
941
  key: 0,
942
942
  "data-testid": "drag-piece",
943
943
  xmlns: "http://www.w3.org/2000/svg",
944
- style: at({
945
- height: Y.value.height + "px",
944
+ style: ft({
945
+ height: K.value.height + "px",
946
946
  left: "0px",
947
947
  pointerEvents: "none",
948
948
  position: "fixed",
949
949
  top: "0px",
950
950
  transform: `translate(${Gt.value.x}px, ${Gt.value.y}px) scale(1.1)`,
951
- width: Y.value.width + "px",
951
+ width: K.value.width + "px",
952
952
  willChange: "transform"
953
953
  }),
954
- viewBox: `0 0 ${f(ve)} ${f(ve)}`
954
+ viewBox: `0 0 ${c(he)} ${c(he)}`
955
955
  }, [
956
956
  (b(), io(uo(u.pieces), {
957
- height: f(V),
957
+ height: c(U),
958
958
  style: { pointerEvents: "none" },
959
959
  type: Vt.value,
960
- width: f(V),
961
- x: f(fe)(f(V) / -2),
962
- y: f(de)(f(V) / 2)
960
+ width: c(U),
961
+ x: c(R)(c(de)(c(U) / -2)),
962
+ y: c(R)(c(ve)(c(U) / 2))
963
963
  }, null, 8, ["height", "type", "width", "x", "y"]))
964
- ], 12, Uo)) : tt("", !0),
964
+ ], 12, Uo)) : ot("", !0),
965
965
  typeof h.value.selected == "number" ? (b(), P("div", {
966
966
  key: 1,
967
- style: at({
968
- height: ue.value.height + "px",
969
- left: ue.value.left + "px",
967
+ style: ft({
968
+ height: ce.value.height + "px",
969
+ left: ce.value.left + "px",
970
970
  position: "fixed",
971
- top: ue.value.top + "px",
972
- width: ue.value.width + "px"
971
+ top: ce.value.top + "px",
972
+ width: ce.value.width + "px"
973
973
  }),
974
- onPointerup: a[0] || (a[0] = Bo(() => {
974
+ onPointerup: f[0] || (f[0] = Bo(() => {
975
975
  }, ["stop"]))
976
976
  }, [
977
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,
978
+ b: it.value.b,
979
+ cancel: et,
980
+ file: c(A)(h.value.selected)[0],
981
+ n: it.value.n,
982
982
  promote: ko,
983
- q: rt.value.q,
984
- r: rt.value.r,
985
- rank: Number(f(W)(h.value.selected).slice(1))
983
+ q: it.value.q,
984
+ r: it.value.r,
985
+ rank: Number(c(A)(h.value.selected).slice(1))
986
986
  })
987
- ], 36)) : tt("", !0)
987
+ ], 36)) : ot("", !0)
988
988
  ]));
989
989
  }
990
990
  });
991
991
  export {
992
- Go as Hexboard
992
+ Go as Hexboard,
993
+ So as defaultOptions
993
994
  };
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.6"
61
+ "version": "0.0.8"
62
62
  }
@@ -69,8 +69,8 @@
69
69
  pointerEvents: 'none',
70
70
  userSelect: 'none',
71
71
  }"
72
- :x="x(flipped ? positionFlipped[0] : p[0])"
73
- :y="y(flipped ? positionFlipped[1] : p[1])"
72
+ :x="rounded(x(flipped ? positionFlipped[0] : p[0]))"
73
+ :y="rounded(y(flipped ? positionFlipped[1] : p[1]))"
74
74
  />
75
75
  </template>
76
76
 
@@ -86,16 +86,16 @@
86
86
  :style="{ pointerEvents: 'none' }"
87
87
  :type="piece"
88
88
  :width="pieceSize"
89
- :x="x(board[index][flipped ? 2 : 1][0] - pieceSize / 2)"
90
- :y="y(board[index][flipped ? 2 : 1][1] + pieceSize / 2)"
89
+ :x="rounded(x(board[index][flipped ? 2 : 1][0] - pieceSize / 2))"
90
+ :y="rounded(y(board[index][flipped ? 2 : 1][1] + pieceSize / 2))"
91
91
  />
92
92
  </template>
93
93
 
94
94
  <!-- targets -->
95
95
  <circle
96
96
  v-for="targetIndex in currentTargets"
97
- :cx="x(board[targetIndex][flipped ? 2 : 1][0])"
98
- :cy="y(board[targetIndex][flipped ? 2 : 1][1])"
97
+ :cx="rounded(x(board[targetIndex][flipped ? 2 : 1][0]))"
98
+ :cy="rounded(y(board[targetIndex][flipped ? 2 : 1][1]))"
99
99
  :data-testid="`target-${indexToPosition(targetIndex)}`"
100
100
  :fill="normalizedOptions.targetColor"
101
101
  :key="`target-${indexToPosition(targetIndex)}`"
@@ -127,8 +127,8 @@
127
127
  :style="{ pointerEvents: 'none' }"
128
128
  :type="dragPiece"
129
129
  :width="pieceSize"
130
- :x="x(pieceSize / -2)"
131
- :y="y(pieceSize / 2)"
130
+ :x="rounded(x(pieceSize / -2))"
131
+ :y="rounded(y(pieceSize / 2))"
132
132
  />
133
133
  </svg>
134
134
 
@@ -188,7 +188,7 @@ import {
188
188
  perimeter,
189
189
  pieceSize,
190
190
  } from './constants'
191
- import { d } from './dom'
191
+ import { d, rounded } from './dom'
192
192
  import { x, y } from './geometry'
193
193
  import LetterPiece from './pieces/Letter.vue'
194
194
  import type { HexboardOptions, Rect } from './types'
package/src/lib/index.ts CHANGED
@@ -1 +1,3 @@
1
+ export { defaultOptions } from './components/hexboard/constants'
1
2
  export { default as Hexboard } from './components/hexboard/Hexboard.vue'
3
+ export type { HexboardOptions } from './components/hexboard/types'