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