@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 +8 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +293 -292
- package/package.json +1 -1
- package/src/lib/components/hexboard/Hexboard.vue +9 -9
- package/src/lib/index.ts +2 -0
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
|
|
2
|
-
import { Hexchess as co, position as
|
|
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,
|
|
12
|
-
x(u, 0,
|
|
13
|
-
x(u, -60,
|
|
14
|
-
x(u, -120,
|
|
15
|
-
x(u, -180,
|
|
16
|
-
x(u, -240,
|
|
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
|
|
20
|
+
const V = Ro($);
|
|
21
21
|
return [
|
|
22
|
-
d * Math.cos(
|
|
23
|
-
d * Math.sin(
|
|
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
|
|
36
|
+
return he / 2 + u;
|
|
37
|
+
}
|
|
38
|
+
function ve(u) {
|
|
39
|
+
return he / 2 - u;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
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,
|
|
61
|
-
[2,
|
|
62
|
-
[1,
|
|
63
|
-
[0,
|
|
64
|
-
[1,
|
|
65
|
-
[0,
|
|
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
|
-
[
|
|
70
|
-
[2,
|
|
71
|
-
[
|
|
72
|
-
[
|
|
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
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[0,
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
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
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[1,
|
|
89
|
-
[
|
|
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,
|
|
94
|
-
[1,
|
|
95
|
-
[2,
|
|
96
|
-
[0,
|
|
97
|
-
[1,
|
|
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
|
-
[
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[1,
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[
|
|
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
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
121
|
-
[
|
|
122
|
-
[
|
|
123
|
-
[2,
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
[
|
|
127
|
-
[
|
|
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
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[
|
|
134
|
-
[0,
|
|
135
|
-
[
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
[
|
|
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
|
-
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
143
|
-
[
|
|
144
|
-
[
|
|
145
|
-
[1,
|
|
146
|
-
[
|
|
147
|
-
[
|
|
148
|
-
[
|
|
149
|
-
[
|
|
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
|
-
[
|
|
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(
|
|
154
|
-
["10", r(
|
|
155
|
-
["9", r(
|
|
156
|
-
["8", r(
|
|
157
|
-
["7", r(
|
|
158
|
-
["6", r(
|
|
159
|
-
["5", r(
|
|
160
|
-
["4", r(
|
|
161
|
-
["3", r(
|
|
162
|
-
["2", r(
|
|
163
|
-
["1", r(
|
|
164
|
-
["a", r(
|
|
165
|
-
["b", r(
|
|
166
|
-
["c", r(
|
|
167
|
-
["d", r(
|
|
168
|
-
["e", r(
|
|
169
|
-
["f", r(
|
|
170
|
-
["g", r(
|
|
171
|
-
["h", r(
|
|
172
|
-
["i", r(
|
|
173
|
-
["k", r(
|
|
174
|
-
["l", r(
|
|
175
|
-
["1", r(
|
|
176
|
-
["2", r(
|
|
177
|
-
["3", r(
|
|
178
|
-
["4", r(
|
|
179
|
-
["5", r(
|
|
180
|
-
["6", r(
|
|
181
|
-
["7", r(
|
|
182
|
-
["8", r(
|
|
183
|
-
["9", r(
|
|
184
|
-
["10", r(
|
|
185
|
-
["11", r(
|
|
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
|
|
560
|
+
function Yt(u) {
|
|
561
561
|
if (u.length === 0)
|
|
562
562
|
return "";
|
|
563
563
|
const [$, ...d] = u;
|
|
564
|
-
let
|
|
564
|
+
let V = `M ${R(de($[0]))} ${R(ve($[1]))} L `;
|
|
565
565
|
for (const F of d)
|
|
566
|
-
|
|
567
|
-
return `${
|
|
566
|
+
V += `${R(de(F[0]))} ${R(ve(F[1]))} `;
|
|
567
|
+
return `${V} Z`;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
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,
|
|
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"),
|
|
635
|
+
}), Kt = Co("svgEl"), K = tt(re());
|
|
636
636
|
let Qt = !1;
|
|
637
|
-
const ho =
|
|
638
|
-
(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
|
-
)),
|
|
641
|
-
var s,
|
|
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 &&
|
|
646
|
-
const v = (s =
|
|
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 = ((
|
|
649
|
-
if ((d.playing === !0 || C) &&
|
|
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 (
|
|
654
|
-
return d.playing === !0 || d.playing && Jt.value === ((
|
|
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 =
|
|
657
|
-
x:
|
|
658
|
-
y:
|
|
659
|
-
})), Vt =
|
|
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 =
|
|
662
|
-
}),
|
|
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],
|
|
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:
|
|
667
|
-
b:
|
|
668
|
-
r:
|
|
669
|
-
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,
|
|
684
|
-
var C,
|
|
685
|
-
if (!
|
|
683
|
+
function Ut(s, f) {
|
|
684
|
+
var C, ie;
|
|
685
|
+
if (!Y.value.includes(s.to))
|
|
686
686
|
return;
|
|
687
|
-
const
|
|
688
|
-
if (!
|
|
687
|
+
const a = (C = d.hexchess) == null ? void 0 : C.board[s.from];
|
|
688
|
+
if (!a)
|
|
689
689
|
return;
|
|
690
|
-
const v =
|
|
691
|
-
if (d.hexchess && (
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
hexchess:
|
|
695
|
-
promotionEl: (
|
|
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
|
-
}, (
|
|
699
|
+
}, (f == null ? void 0 : f.target) instanceof Element && (ce.value = f.target.getBoundingClientRect());
|
|
700
700
|
return;
|
|
701
701
|
}
|
|
702
|
-
|
|
702
|
+
ut(s.from) && (d.ignoreTurn || g) && eo(s);
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function ut(s) {
|
|
705
705
|
var v;
|
|
706
|
-
const
|
|
707
|
-
if (!
|
|
706
|
+
const f = (v = d.hexchess) == null ? void 0 : v.board[s];
|
|
707
|
+
if (!f)
|
|
708
708
|
return !1;
|
|
709
|
-
const
|
|
710
|
-
return d.playing === !0 || d.playing ===
|
|
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
|
|
714
|
-
return F.value === null ?
|
|
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
|
-
|
|
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
|
|
719
|
+
function ct() {
|
|
720
720
|
var s;
|
|
721
|
-
|
|
721
|
+
ce.value = ((s = h.value.promotionEl) == null ? void 0 : s.getBoundingClientRect()) ?? re();
|
|
722
722
|
}
|
|
723
|
-
function go(s,
|
|
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 &&
|
|
730
|
+
h.value.selected !== s && et();
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
733
|
-
if (L.value !== null &&
|
|
734
|
-
const
|
|
735
|
-
Ut(
|
|
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,
|
|
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
|
-
|
|
744
|
+
et();
|
|
745
745
|
return;
|
|
746
746
|
}
|
|
747
|
-
d.autoselect && (L.value = null,
|
|
747
|
+
d.autoselect && (L.value = null, Y.value = []);
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
function eo(s) {
|
|
751
|
-
|
|
751
|
+
V("move", s), at();
|
|
752
752
|
}
|
|
753
|
-
function wo(s,
|
|
754
|
-
var
|
|
755
|
-
if (
|
|
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
|
-
|
|
759
|
-
|
|
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
|
|
763
|
-
if (Ut(
|
|
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,
|
|
765
|
+
B.value = null, K.value = re();
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
|
-
if (L.value !== null &&
|
|
769
|
-
const v = new
|
|
770
|
-
return Ut(v,
|
|
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
|
-
|
|
773
|
+
et();
|
|
774
774
|
return;
|
|
775
775
|
}
|
|
776
|
-
if ((
|
|
777
|
-
B.value = null,
|
|
776
|
+
if ((a = d.hexchess) != null && a.board[s]) {
|
|
777
|
+
B.value = null, K.value = re();
|
|
778
778
|
return;
|
|
779
779
|
}
|
|
780
|
-
|
|
780
|
+
at();
|
|
781
781
|
}
|
|
782
|
-
function
|
|
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,
|
|
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,
|
|
793
|
-
var C,
|
|
794
|
-
if (
|
|
792
|
+
function yo(s, f) {
|
|
793
|
+
var C, ie, fe;
|
|
794
|
+
if (f.preventDefault(), h.value.hexchess)
|
|
795
795
|
return;
|
|
796
|
-
const
|
|
797
|
-
if (!
|
|
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 =
|
|
800
|
-
!d.ignoreTurn && !g || (B.value = s,
|
|
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 && (
|
|
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
|
-
|
|
816
|
+
et();
|
|
817
817
|
return;
|
|
818
818
|
}
|
|
819
819
|
if (B.value !== null) {
|
|
820
|
-
B.value = null,
|
|
820
|
+
B.value = null, K.value = re();
|
|
821
821
|
return;
|
|
822
822
|
}
|
|
823
|
-
|
|
823
|
+
at();
|
|
824
824
|
}
|
|
825
825
|
function ko(s) {
|
|
826
|
-
if (typeof h.value.promotionFrom == "number" &&
|
|
827
|
-
const
|
|
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(
|
|
832
|
+
eo(f);
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
function
|
|
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
|
|
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
|
-
},
|
|
854
|
+
}, K.value = re(), Y.value = [];
|
|
855
855
|
}
|
|
856
856
|
function lo() {
|
|
857
|
-
|
|
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,
|
|
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:
|
|
865
|
-
viewBox: `0 0 ${
|
|
864
|
+
style: ft({ cursor: jt.value }),
|
|
865
|
+
viewBox: `0 0 ${c(he)} ${c(he)}`
|
|
866
866
|
}, [
|
|
867
867
|
fo("path", {
|
|
868
|
-
d:
|
|
869
|
-
fill:
|
|
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(
|
|
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:
|
|
882
|
+
d: c(Yt)(u.flipped ? a[4] : a[3]),
|
|
883
883
|
"data-hexboard-position": v,
|
|
884
|
-
"data-testid": `position-${
|
|
885
|
-
fill:
|
|
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(
|
|
890
|
-
d:
|
|
891
|
-
"data-testid": `highlight-${
|
|
892
|
-
fill:
|
|
893
|
-
key: `highlight-${
|
|
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
|
|
896
|
+
typeof st.value == "number" ? (b(), P("path", {
|
|
897
897
|
key: 0,
|
|
898
|
-
d:
|
|
899
|
-
"data-testid": `selected-${
|
|
900
|
-
fill:
|
|
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)) :
|
|
904
|
-
|
|
905
|
-
textContent: vo(
|
|
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-${
|
|
908
|
+
"data-testid": `label-${a}`,
|
|
909
909
|
key: `label-${C}`,
|
|
910
|
-
style:
|
|
911
|
-
fill: mo(
|
|
910
|
+
style: ft({
|
|
911
|
+
fill: mo(a),
|
|
912
912
|
fontSize: ".5px",
|
|
913
913
|
pointerEvents: "none",
|
|
914
914
|
userSelect: "none"
|
|
915
915
|
}),
|
|
916
|
-
x:
|
|
917
|
-
y:
|
|
918
|
-
}, null, 12, Qo))), 128)) :
|
|
919
|
-
|
|
920
|
-
"data-piece-type":
|
|
921
|
-
"data-testid": `piece-${
|
|
922
|
-
height:
|
|
923
|
-
key: `piece-${
|
|
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:
|
|
926
|
-
width:
|
|
927
|
-
x:
|
|
928
|
-
y:
|
|
929
|
-
}, null, 8, ["data-piece-type", "data-testid", "height", "type", "width", "x", "y"]))), 128)) :
|
|
930
|
-
(b(!0), P(
|
|
931
|
-
cx:
|
|
932
|
-
cy:
|
|
933
|
-
"data-testid": `target-${
|
|
934
|
-
fill:
|
|
935
|
-
key: `target-${
|
|
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:
|
|
945
|
-
height:
|
|
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:
|
|
951
|
+
width: K.value.width + "px",
|
|
952
952
|
willChange: "transform"
|
|
953
953
|
}),
|
|
954
|
-
viewBox: `0 0 ${
|
|
954
|
+
viewBox: `0 0 ${c(he)} ${c(he)}`
|
|
955
955
|
}, [
|
|
956
956
|
(b(), io(uo(u.pieces), {
|
|
957
|
-
height:
|
|
957
|
+
height: c(U),
|
|
958
958
|
style: { pointerEvents: "none" },
|
|
959
959
|
type: Vt.value,
|
|
960
|
-
width:
|
|
961
|
-
x:
|
|
962
|
-
y:
|
|
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)) :
|
|
964
|
+
], 12, Uo)) : ot("", !0),
|
|
965
965
|
typeof h.value.selected == "number" ? (b(), P("div", {
|
|
966
966
|
key: 1,
|
|
967
|
-
style:
|
|
968
|
-
height:
|
|
969
|
-
left:
|
|
967
|
+
style: ft({
|
|
968
|
+
height: ce.value.height + "px",
|
|
969
|
+
left: ce.value.left + "px",
|
|
970
970
|
position: "fixed",
|
|
971
|
-
top:
|
|
972
|
-
width:
|
|
971
|
+
top: ce.value.top + "px",
|
|
972
|
+
width: ce.value.width + "px"
|
|
973
973
|
}),
|
|
974
|
-
onPointerup:
|
|
974
|
+
onPointerup: f[0] || (f[0] = Bo(() => {
|
|
975
975
|
}, ["stop"]))
|
|
976
976
|
}, [
|
|
977
977
|
Mo(s.$slots, "promotion", {
|
|
978
|
-
b:
|
|
979
|
-
cancel:
|
|
980
|
-
file:
|
|
981
|
-
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:
|
|
984
|
-
r:
|
|
985
|
-
rank: Number(
|
|
983
|
+
q: it.value.q,
|
|
984
|
+
r: it.value.r,
|
|
985
|
+
rank: Number(c(A)(h.value.selected).slice(1))
|
|
986
986
|
})
|
|
987
|
-
], 36)) :
|
|
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
|
@@ -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