@harmonics/lattice-ui 0.5.1 → 0.7.0
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 +18 -0
- package/README.md +88 -8
- package/dist/board.js +685 -0
- package/dist/define.js +1 -1
- package/dist/elements-DdyLdkzr.js +1346 -0
- package/dist/{hexes-B4uCADpF.js → hexes-DwdbCYSF.js} +197 -160
- package/dist/hexes.js +1 -1
- package/dist/index.js +3 -1
- package/dist/types/boardTypes.d.ts +2 -0
- package/dist/types/elements/board-entry.d.ts +9 -0
- package/dist/types/elements/board.d.ts +59 -0
- package/dist/types/elements/icon.d.ts +1 -1
- package/dist/types/elements/index.d.ts +1 -1
- package/dist/types/elements/shape.d.ts +35 -3
- package/dist/types/elements/solid.d.ts +17 -1
- package/dist/woods-C8W11GkD.js +708 -0
- package/package.json +6 -2
- package/react.d.ts +19 -0
- package/dist/elements-Ka2LbDpP.js +0 -1832
|
@@ -2,30 +2,30 @@ var e = {
|
|
|
2
2
|
width: 76.21,
|
|
3
3
|
height: 132,
|
|
4
4
|
half: 38.11
|
|
5
|
-
}, t = {
|
|
5
|
+
}, t = "M 38.11 0 L 76.21 22 L 76.21 66 L 38.11 88 L 0 66 L 0 22 Z", n = {
|
|
6
6
|
sky: "M 76.21 66.00 L 38.11 88.00 L -0.00 66.00 L 0.00 22.00 L 38.11 0.00 L 76.21 22.00 Z M 38.11 132.00 L 0.00 154.00 L -38.11 132.00 L -38.11 88.00 L -0.00 66.00 L 38.11 88.00 Z M 114.32 132.00 L 76.21 154.00 L 38.11 132.00 L 38.11 88.00 L 76.21 66.00 L 114.32 88.00 Z",
|
|
7
7
|
earth: "M 76.21 66.00 L 38.11 88.00 L -0.00 66.00 L 0.00 22.00 L 38.11 0.00 L 76.21 22.00 Z M 38.11 44.00 L 76.21 66.00 M 57.16 55.00 L 57.16 77.00 L 38.11 66.00 Z M 38.11 44.00 L 38.11 88.00 M 38.11 66.00 L 19.05 77.00 L 19.05 55.00 Z M 38.11 44.00 L -0.00 66.00 M 19.05 55.00 L -0.00 44.00 L 19.05 33.00 Z M 38.11 44.00 L 0.00 22.00 M 19.05 33.00 L 19.05 11.00 L 38.11 22.00 Z M 38.11 44.00 L 38.11 0.00 M 38.11 22.00 L 57.16 11.00 L 57.16 33.00 Z M 38.11 44.00 L 76.21 22.00 M 57.16 33.00 L 76.21 44.00 L 57.16 55.00 Z M 38.11 132.00 L 0.00 154.00 L -38.11 132.00 L -38.11 88.00 L -0.00 66.00 L 38.11 88.00 Z M 0.00 110.00 L 38.11 132.00 M 19.05 121.00 L 19.05 143.00 L 0.00 132.00 Z M 0.00 110.00 L 0.00 154.00 M 0.00 132.00 L -19.05 143.00 L -19.05 121.00 Z M 0.00 110.00 L -38.11 132.00 M -19.05 121.00 L -38.11 110.00 L -19.05 99.00 Z M 0.00 110.00 L -38.11 88.00 M -19.05 99.00 L -19.05 77.00 L -0.00 88.00 Z M 0.00 110.00 L -0.00 66.00 M -0.00 88.00 L 19.05 77.00 L 19.05 99.00 Z M 0.00 110.00 L 38.11 88.00 M 19.05 99.00 L 38.11 110.00 L 19.05 121.00 Z M 114.32 132.00 L 76.21 154.00 L 38.11 132.00 L 38.11 88.00 L 76.21 66.00 L 114.32 88.00 Z M 76.21 110.00 L 114.32 132.00 M 95.26 121.00 L 95.26 143.00 L 76.21 132.00 Z M 76.21 110.00 L 76.21 154.00 M 76.21 132.00 L 57.16 143.00 L 57.16 121.00 Z M 76.21 110.00 L 38.11 132.00 M 57.16 121.00 L 38.11 110.00 L 57.16 99.00 Z M 76.21 110.00 L 38.11 88.00 M 57.16 99.00 L 57.16 77.00 L 76.21 88.00 Z M 76.21 110.00 L 76.21 66.00 M 76.21 88.00 L 95.26 77.00 L 95.26 99.00 Z M 76.21 110.00 L 114.32 88.00 M 95.26 99.00 L 114.32 110.00 L 95.26 121.00 Z"
|
|
8
|
-
},
|
|
9
|
-
function
|
|
8
|
+
}, r = 44, { width: i } = e, a = i / 2;
|
|
9
|
+
function o(e) {
|
|
10
10
|
return {
|
|
11
|
-
x:
|
|
11
|
+
x: i * (e.q + e.r / 2),
|
|
12
12
|
y: 66 * e.r
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function s(e) {
|
|
16
16
|
return {
|
|
17
|
-
x:
|
|
18
|
-
y:
|
|
17
|
+
x: a * e.j,
|
|
18
|
+
y: r * e.i + 22 * e.j
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
let t =
|
|
21
|
+
function c(e) {
|
|
22
|
+
let t = s(e);
|
|
23
23
|
return {
|
|
24
24
|
x: t.x,
|
|
25
25
|
y: 22 + t.y
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function l(e) {
|
|
29
29
|
let { i: t, j: n } = e;
|
|
30
30
|
return e.k === 0 ? [
|
|
31
31
|
{
|
|
@@ -55,27 +55,27 @@ function c(e) {
|
|
|
55
55
|
}
|
|
56
56
|
];
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let
|
|
58
|
+
function u(e, t) {
|
|
59
|
+
let n = e - a, i = 2 / 3 * ((t - 44) / r), o = Math.sqrt(3) / 3 * (n / r) - i / 2, s = -o - i, c = Math.round(o), l = Math.round(i), u = Math.round(s), d = Math.abs(c - o), f = Math.abs(l - i), p = Math.abs(u - s);
|
|
60
60
|
return d > f && d > p ? c = -l - u : f > p && (l = -c - u), {
|
|
61
61
|
q: c + 0,
|
|
62
62
|
r: l + 0
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
let
|
|
65
|
+
function d(e, t) {
|
|
66
|
+
let n = Math.round(e / a);
|
|
67
67
|
return {
|
|
68
|
-
i: Math.round((t - 22 - 22 *
|
|
69
|
-
j:
|
|
68
|
+
i: Math.round((t - 22 - 22 * n) / r) + 0,
|
|
69
|
+
j: n + 0
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function f(e) {
|
|
73
73
|
return {
|
|
74
74
|
i: e.r - e.q,
|
|
75
75
|
j: 1 + 2 * e.q + e.r
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function p(e) {
|
|
79
79
|
let t = e.j - 1 - e.i;
|
|
80
80
|
if (t % 3 != 0) return;
|
|
81
81
|
let n = t / 3;
|
|
@@ -84,8 +84,8 @@ function f(e) {
|
|
|
84
84
|
r: e.i + n + 0
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
let { i: t, j: n } =
|
|
87
|
+
function m(e) {
|
|
88
|
+
let { i: t, j: n } = f(e);
|
|
89
89
|
return [
|
|
90
90
|
{
|
|
91
91
|
i: t,
|
|
@@ -119,7 +119,7 @@ function p(e) {
|
|
|
119
119
|
}
|
|
120
120
|
];
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function h(e) {
|
|
123
123
|
let { i: t, j: n } = e;
|
|
124
124
|
return e.k === 0 ? [
|
|
125
125
|
{
|
|
@@ -155,39 +155,43 @@ function m(e) {
|
|
|
155
155
|
}
|
|
156
156
|
];
|
|
157
157
|
}
|
|
158
|
-
var
|
|
158
|
+
var g = (e) => `${e.i},${e.j},${e.k}`, _ = (e) => `${e.i},${e.j}`, v = (e, t) => ({
|
|
159
159
|
left: 0,
|
|
160
160
|
top: 0,
|
|
161
161
|
right: e,
|
|
162
162
|
bottom: t
|
|
163
|
-
}),
|
|
164
|
-
function
|
|
165
|
-
let t = b.get(e);
|
|
166
|
-
return t || (t = e.parts.flatMap(y), b.set(e, t)), t;
|
|
167
|
-
}
|
|
168
|
-
function C(e) {
|
|
163
|
+
}), y = (e, t) => t.x >= e.left && t.y >= e.top && t.x <= e.right && t.y <= e.bottom, b = (e) => e.kind === "cell" ? m(e.at) : [e.at], x = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap();
|
|
164
|
+
function w(e) {
|
|
169
165
|
let t = x.get(e);
|
|
170
|
-
return t || (t =
|
|
166
|
+
return t || (t = e.parts.flatMap(b), x.set(e, t)), t;
|
|
171
167
|
}
|
|
172
|
-
function
|
|
173
|
-
let
|
|
168
|
+
function T(e) {
|
|
169
|
+
let t = S.get(e);
|
|
170
|
+
return t || (t = new Set(w(e).map(g)), S.set(e, t)), t;
|
|
171
|
+
}
|
|
172
|
+
function E(e) {
|
|
173
|
+
let t = C.get(e);
|
|
174
|
+
return t === void 0 && (t = w(e).reduce((e, t) => Math.max(e, ...l(t).map((e) => c(e).y)), -Infinity), C.set(e, t)), t;
|
|
175
|
+
}
|
|
176
|
+
function D(e, t) {
|
|
177
|
+
let n = new Set(e.flatMap(m).map(g)), r = t.map(T);
|
|
174
178
|
return (e) => {
|
|
175
|
-
let t =
|
|
179
|
+
let t = g(e);
|
|
176
180
|
return n.has(t) || r.some((e) => e.has(t));
|
|
177
181
|
};
|
|
178
182
|
}
|
|
179
|
-
function
|
|
180
|
-
let i =
|
|
181
|
-
return
|
|
183
|
+
function O(e, t, n, r = []) {
|
|
184
|
+
let i = D(r, t.filter((t) => t.id !== e.id));
|
|
185
|
+
return w(e).every((e) => l(e).every((e) => y(n, c(e))) && !i(e));
|
|
182
186
|
}
|
|
183
|
-
var
|
|
184
|
-
function
|
|
187
|
+
var k = (e) => e.parts.some((e) => e.kind === "cell");
|
|
188
|
+
function A(e, t) {
|
|
185
189
|
if (t.i === 0 && t.j === 0) return e;
|
|
186
190
|
let n = (e) => ({
|
|
187
191
|
i: e.i + t.i,
|
|
188
192
|
j: e.j + t.j
|
|
189
193
|
});
|
|
190
|
-
if (
|
|
194
|
+
if (k(e) && (t.j - t.i) % 3 != 0) throw Error("a piece with a cell moves a whole cell at a time");
|
|
191
195
|
let r = e.parts.map((e) => e.kind === "tri" ? {
|
|
192
196
|
...e,
|
|
193
197
|
at: {
|
|
@@ -196,13 +200,13 @@ function D(e, t) {
|
|
|
196
200
|
}
|
|
197
201
|
} : {
|
|
198
202
|
...e,
|
|
199
|
-
at:
|
|
203
|
+
at: p(n(f(e.at)))
|
|
200
204
|
}), i = {
|
|
201
205
|
...e,
|
|
202
206
|
parts: r,
|
|
203
207
|
pivot: n(e.pivot)
|
|
204
|
-
}, a =
|
|
205
|
-
return
|
|
208
|
+
}, a = j.get(e);
|
|
209
|
+
return j.set(i, a ? {
|
|
206
210
|
from: a.from,
|
|
207
211
|
by: {
|
|
208
212
|
i: a.by.i + t.i,
|
|
@@ -213,9 +217,9 @@ function D(e, t) {
|
|
|
213
217
|
by: t
|
|
214
218
|
}), i;
|
|
215
219
|
}
|
|
216
|
-
var
|
|
217
|
-
function
|
|
218
|
-
let n =
|
|
220
|
+
var j = /* @__PURE__ */ new WeakMap();
|
|
221
|
+
function M(e, t) {
|
|
222
|
+
let n = f(u(e + a, t + 44)), r = f({
|
|
219
223
|
q: 0,
|
|
220
224
|
r: 0
|
|
221
225
|
});
|
|
@@ -224,18 +228,18 @@ function k(e, t) {
|
|
|
224
228
|
j: n.j - r.j
|
|
225
229
|
};
|
|
226
230
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
231
|
+
function N(e, t, n) {
|
|
232
|
+
return k(e) ? M(t, n) : d(t, n + 22);
|
|
229
233
|
}
|
|
230
|
-
var
|
|
234
|
+
var P = {
|
|
231
235
|
reach: .5,
|
|
232
236
|
capture: .3,
|
|
233
237
|
release: .5,
|
|
234
238
|
lean: .6
|
|
235
239
|
};
|
|
236
|
-
function
|
|
237
|
-
let r =
|
|
238
|
-
if (
|
|
240
|
+
function F(e, t, n) {
|
|
241
|
+
let r = N(e, t, n);
|
|
242
|
+
if (k(e)) return r;
|
|
239
243
|
let i = [r, ...[
|
|
240
244
|
[1, 0],
|
|
241
245
|
[-1, 0],
|
|
@@ -247,17 +251,17 @@ function M(e, t, n) {
|
|
|
247
251
|
i: r.i + e,
|
|
248
252
|
j: r.j + t
|
|
249
253
|
}))], a = (e) => {
|
|
250
|
-
let r =
|
|
254
|
+
let r = s(e);
|
|
251
255
|
return Math.hypot(t - r.x, n - r.y);
|
|
252
256
|
};
|
|
253
257
|
return i.reduce((e, t) => a(t) < a(e) ? t : e);
|
|
254
258
|
}
|
|
255
259
|
var ee = (e) => e * e * (3 - 2 * e);
|
|
256
|
-
function te(e, t,
|
|
257
|
-
let
|
|
260
|
+
function te(e, t, n, a) {
|
|
261
|
+
let o = (k(e) ? i : r) * P.reach;
|
|
258
262
|
if (a) {
|
|
259
|
-
let e =
|
|
260
|
-
if (Math.hypot(t - e.x,
|
|
263
|
+
let e = s(a);
|
|
264
|
+
if (Math.hypot(t - e.x, n - e.y) <= o * P.release) return {
|
|
261
265
|
step: a,
|
|
262
266
|
x: e.x,
|
|
263
267
|
y: e.y,
|
|
@@ -265,7 +269,7 @@ function te(e, t, i, a) {
|
|
|
265
269
|
held: a
|
|
266
270
|
};
|
|
267
271
|
}
|
|
268
|
-
let c =
|
|
272
|
+
let c = F(e, t, n), l = s(c), u = Math.hypot(t - l.x, n - l.y), d = o * P.capture;
|
|
269
273
|
if (u <= d) return {
|
|
270
274
|
step: c,
|
|
271
275
|
x: l.x,
|
|
@@ -273,16 +277,16 @@ function te(e, t, i, a) {
|
|
|
273
277
|
pull: 1,
|
|
274
278
|
held: c
|
|
275
279
|
};
|
|
276
|
-
let f = u >=
|
|
280
|
+
let f = u >= o ? 0 : 1 - ee((u - d) / (o - d)), p = f * P.lean;
|
|
277
281
|
return {
|
|
278
282
|
step: c,
|
|
279
283
|
x: t + (l.x - t) * p,
|
|
280
|
-
y:
|
|
284
|
+
y: n + (l.y - n) * p,
|
|
281
285
|
pull: f,
|
|
282
286
|
held: void 0
|
|
283
287
|
};
|
|
284
288
|
}
|
|
285
|
-
function
|
|
289
|
+
function ne(e, t = .12) {
|
|
286
290
|
let n = (t) => `translate(${e.x * t}px, ${e.y * t}px)`;
|
|
287
291
|
return [
|
|
288
292
|
{
|
|
@@ -306,8 +310,8 @@ function N(e, t = .12) {
|
|
|
306
310
|
}
|
|
307
311
|
];
|
|
308
312
|
}
|
|
309
|
-
function
|
|
310
|
-
return (
|
|
313
|
+
function re(e, t) {
|
|
314
|
+
return (k(e) ? {
|
|
311
315
|
ArrowRight: {
|
|
312
316
|
i: -1,
|
|
313
317
|
j: 2
|
|
@@ -343,11 +347,11 @@ function P(e, t) {
|
|
|
343
347
|
}
|
|
344
348
|
})[t];
|
|
345
349
|
}
|
|
346
|
-
var
|
|
350
|
+
var I = (e) => ({
|
|
347
351
|
i: e.i + e.j,
|
|
348
352
|
j: -e.i + 0
|
|
349
353
|
});
|
|
350
|
-
function
|
|
354
|
+
function L(e) {
|
|
351
355
|
let t = Math.min(...e.map((e) => e.i)), n = e.filter((e) => e.i === t);
|
|
352
356
|
return n.length === 2 ? {
|
|
353
357
|
i: t,
|
|
@@ -359,103 +363,103 @@ function I(e) {
|
|
|
359
363
|
k: 1
|
|
360
364
|
};
|
|
361
365
|
}
|
|
362
|
-
function
|
|
366
|
+
function R(e, t) {
|
|
363
367
|
let n = (t % 6 + 6) % 6, r = e.pivot, i = (e) => {
|
|
364
368
|
let t = {
|
|
365
369
|
i: e.i - r.i,
|
|
366
370
|
j: e.j - r.j
|
|
367
371
|
};
|
|
368
|
-
for (let e = 0; e < n; e++) t =
|
|
372
|
+
for (let e = 0; e < n; e++) t = I(t);
|
|
369
373
|
return {
|
|
370
374
|
i: t.i + r.i,
|
|
371
375
|
j: t.j + r.j
|
|
372
376
|
};
|
|
373
377
|
}, a = e.parts.map((e) => e.kind === "tri" ? {
|
|
374
378
|
...e,
|
|
375
|
-
at:
|
|
379
|
+
at: L(l(e.at).map(i))
|
|
376
380
|
} : {
|
|
377
381
|
...e,
|
|
378
|
-
at:
|
|
382
|
+
at: p(i(f(e.at)))
|
|
379
383
|
});
|
|
380
384
|
return {
|
|
381
385
|
...e,
|
|
382
386
|
parts: a
|
|
383
387
|
};
|
|
384
388
|
}
|
|
385
|
-
var
|
|
386
|
-
function
|
|
387
|
-
let t = e.flatMap(
|
|
389
|
+
var z = (e) => c(e.pivot);
|
|
390
|
+
function B(e) {
|
|
391
|
+
let t = e.flatMap(b).flatMap((e) => l(e).map(c)), n = {
|
|
388
392
|
x: t.reduce((e, t) => e + t.x, 0) / t.length,
|
|
389
393
|
y: t.reduce((e, t) => e + t.y, 0) / t.length
|
|
390
394
|
};
|
|
391
|
-
return e.some((e) => e.kind === "cell") ?
|
|
395
|
+
return e.some((e) => e.kind === "cell") ? f(u(n.x, n.y)) : d(n.x, n.y);
|
|
392
396
|
}
|
|
393
|
-
var
|
|
397
|
+
var V = (e, t) => ({
|
|
394
398
|
id: e,
|
|
395
399
|
parts: t,
|
|
396
|
-
pivot:
|
|
400
|
+
pivot: B(t)
|
|
397
401
|
});
|
|
398
|
-
function
|
|
399
|
-
let n = t instanceof Set ? t : new Set(t.map(
|
|
400
|
-
return e.some((e) =>
|
|
401
|
-
}
|
|
402
|
-
var
|
|
403
|
-
function
|
|
404
|
-
let n =
|
|
405
|
-
for (let t of
|
|
406
|
-
if (!n.has(
|
|
407
|
-
let i = new Set(
|
|
408
|
-
a.length === 2 && r.push([
|
|
402
|
+
function H(e, t) {
|
|
403
|
+
let n = t instanceof Set ? t : new Set(t.map(g));
|
|
404
|
+
return e.some((e) => h(e).some((e) => n.has(g(e))));
|
|
405
|
+
}
|
|
406
|
+
var U = (e, t) => w(e).length <= w(t).length ? H(w(e), T(t)) : H(w(t), T(e));
|
|
407
|
+
function W(e, t) {
|
|
408
|
+
let n = T(t), r = [];
|
|
409
|
+
for (let t of w(e)) for (let e of h(t)) {
|
|
410
|
+
if (!n.has(g(e))) continue;
|
|
411
|
+
let i = new Set(l(t).map(_)), a = l(e).filter((e) => i.has(_(e)));
|
|
412
|
+
a.length === 2 && r.push([c(a[0]), c(a[1])]);
|
|
409
413
|
}
|
|
410
414
|
return r;
|
|
411
415
|
}
|
|
412
|
-
function
|
|
416
|
+
function G(e) {
|
|
413
417
|
let t = /* @__PURE__ */ new Map();
|
|
414
418
|
e.parts.forEach((e, n) => {
|
|
415
|
-
for (let r of
|
|
419
|
+
for (let r of b(e)) t.set(g(r), n);
|
|
416
420
|
});
|
|
417
421
|
let n = [];
|
|
418
422
|
for (let [e, r] of t) {
|
|
419
|
-
let [i, a, o] = e.split(",").map(Number),
|
|
423
|
+
let [i, a, o] = e.split(",").map(Number), s = {
|
|
420
424
|
i,
|
|
421
425
|
j: a,
|
|
422
426
|
k: o
|
|
423
427
|
};
|
|
424
|
-
for (let e of
|
|
425
|
-
let i = t.get(
|
|
428
|
+
for (let e of h(s)) {
|
|
429
|
+
let i = t.get(g(e));
|
|
426
430
|
if (i === void 0 || i <= r) continue;
|
|
427
|
-
let a = new Set(
|
|
428
|
-
o.length === 2 && n.push([
|
|
431
|
+
let a = new Set(l(s).map(_)), o = l(e).filter((e) => a.has(_(e)));
|
|
432
|
+
o.length === 2 && n.push([c(o[0]), c(o[1])]);
|
|
429
433
|
}
|
|
430
434
|
}
|
|
431
435
|
return n;
|
|
432
436
|
}
|
|
433
|
-
function
|
|
434
|
-
let n = t.filter((t) => t.id !== e.id &&
|
|
437
|
+
function K(e, t) {
|
|
438
|
+
let n = t.filter((t) => t.id !== e.id && U(e, t)), r = [...e.parts, ...n.flatMap((e) => e.parts)];
|
|
435
439
|
return {
|
|
436
|
-
piece:
|
|
440
|
+
piece: V(e.id, r),
|
|
437
441
|
absorbed: n.map((e) => e.id)
|
|
438
442
|
};
|
|
439
443
|
}
|
|
440
|
-
function
|
|
444
|
+
function q(e, t) {
|
|
441
445
|
let n = [...e], r = [];
|
|
442
446
|
for (; n.length > 0;) {
|
|
443
447
|
let e = [n.shift()];
|
|
444
448
|
for (let t = 0; t < e.length; t++) {
|
|
445
|
-
let r =
|
|
446
|
-
for (let t = n.length - 1; t >= 0; t--)
|
|
449
|
+
let r = b(e[t]);
|
|
450
|
+
for (let t = n.length - 1; t >= 0; t--) H(r, b(n[t])) && e.push(...n.splice(t, 1));
|
|
447
451
|
}
|
|
448
|
-
r.push(
|
|
452
|
+
r.push(V(t(), e));
|
|
449
453
|
}
|
|
450
454
|
return r;
|
|
451
455
|
}
|
|
452
|
-
function
|
|
456
|
+
function J(e, t, n) {
|
|
453
457
|
let r = e.parts[t], i = e.parts.filter((e, n) => n !== t);
|
|
454
|
-
return [
|
|
458
|
+
return [V(n(), [r]), ...q(i, n)];
|
|
455
459
|
}
|
|
456
|
-
var
|
|
457
|
-
function
|
|
458
|
-
return
|
|
460
|
+
var Y = (e, t) => e.parts.map((e) => V(t(), [e]));
|
|
461
|
+
function ie(e) {
|
|
462
|
+
return k(e) ? [
|
|
459
463
|
{
|
|
460
464
|
i: -1,
|
|
461
465
|
j: 2
|
|
@@ -508,47 +512,80 @@ function Y(e) {
|
|
|
508
512
|
];
|
|
509
513
|
}
|
|
510
514
|
function X(e, t, n, r = [], i = 6, a = () => !0) {
|
|
511
|
-
let
|
|
515
|
+
let o = ie(e), c = /* @__PURE__ */ new Set(["0,0"]), l = [{
|
|
512
516
|
i: 0,
|
|
513
517
|
j: 0
|
|
514
518
|
}];
|
|
515
519
|
for (let u = 0; u <= i; u++) {
|
|
516
520
|
let i = l.map((t) => ({
|
|
517
521
|
d: t,
|
|
518
|
-
at:
|
|
519
|
-
far: Math.hypot(
|
|
520
|
-
})).filter((e) =>
|
|
522
|
+
at: A(e, t),
|
|
523
|
+
far: Math.hypot(s(t).x, s(t).y)
|
|
524
|
+
})).filter((e) => O(e.at, t, n, r) && a(e.at)).sort((e, t) => e.far - t.far);
|
|
521
525
|
if (i[0]) return i[0].at;
|
|
522
526
|
let u = [];
|
|
523
|
-
for (let e of l) for (let t of
|
|
527
|
+
for (let e of l) for (let t of o) {
|
|
524
528
|
let n = {
|
|
525
529
|
i: e.i + t.i,
|
|
526
530
|
j: e.j + t.j
|
|
527
|
-
}, r =
|
|
531
|
+
}, r = _(n);
|
|
528
532
|
c.has(r) || (c.add(r), u.push(n));
|
|
529
533
|
}
|
|
530
534
|
l = u;
|
|
531
535
|
}
|
|
532
536
|
}
|
|
533
|
-
var
|
|
534
|
-
function
|
|
535
|
-
let
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
537
|
+
var ae = (e) => s(e);
|
|
538
|
+
function oe(e, t, n, r = []) {
|
|
539
|
+
let i = D(r, t.filter((t) => t.id !== e.id)), a = /* @__PURE__ */ new Set();
|
|
540
|
+
return e.parts.forEach((e, t) => {
|
|
541
|
+
b(e).some((e) => i(e) || l(e).some((e) => !y(n, c(e)))) && a.add(t);
|
|
542
|
+
}), a;
|
|
543
|
+
}
|
|
544
|
+
function se(e) {
|
|
545
|
+
let t = new Set(w(e).map(g)), n = [];
|
|
546
|
+
for (let r of w(e)) for (let e of h(r)) {
|
|
547
|
+
if (t.has(g(e))) continue;
|
|
548
|
+
let i = new Set(l(r).map(_)), a = l(e).filter((e) => i.has(_(e)));
|
|
549
|
+
a.length === 2 && n.push([c(a[0]), c(a[1])]);
|
|
540
550
|
}
|
|
541
551
|
return n;
|
|
542
552
|
}
|
|
543
|
-
function
|
|
544
|
-
let
|
|
545
|
-
|
|
553
|
+
function ce(e, t, n = [], r = []) {
|
|
554
|
+
let i = [...e], o = [];
|
|
555
|
+
for (; i.length > 0;) {
|
|
556
|
+
let e = [i.shift()];
|
|
557
|
+
for (let t = 0; t < e.length; t++) for (let n = i.length - 1; n >= 0; n--) U(e[t], i[n]) && e.push(...i.splice(n, 1));
|
|
558
|
+
o.push(e);
|
|
559
|
+
}
|
|
560
|
+
let s = (e) => e.reduce((e, t) => e + t.parts.length, 0);
|
|
561
|
+
o.sort((e, t) => s(t) - s(e));
|
|
562
|
+
let u = /* @__PURE__ */ new Map(), d = [...r];
|
|
563
|
+
for (let e of o) {
|
|
564
|
+
let r = V("group", e.flatMap((e) => e.parts)), i = (e) => d.every((t) => !U(e, t)), o = r;
|
|
565
|
+
if (!O(r, d, t, n) || !i(r)) {
|
|
566
|
+
let e = w(r).flatMap((e) => l(e).map(c)), s = Math.min(...e.map((e) => e.x)), u = Math.max(...e.map((e) => e.x)), f = Math.min(...e.map((e) => e.y)), p = Math.max(...e.map((e) => e.y)), m = A(r, N(r, s < t.left ? t.left - s + a : u > t.right ? t.right - u - a : 0, f < t.top ? t.top - f + 33 : p > t.bottom ? t.bottom - p - 33 : 0));
|
|
567
|
+
o = (O(m, d, t, n) && i(m) ? m : X(m, d, t, n, 12, i) ?? X(m, d, t, n, 12)) ?? r;
|
|
568
|
+
}
|
|
569
|
+
let s = {
|
|
570
|
+
i: o.pivot.i - r.pivot.i,
|
|
571
|
+
j: o.pivot.j - r.pivot.j
|
|
572
|
+
};
|
|
573
|
+
for (let t of e) u.set(t.id, s), d.push(A(t, s));
|
|
574
|
+
}
|
|
575
|
+
return e.map((e) => A(e, u.get(e.id) ?? {
|
|
576
|
+
i: 0,
|
|
577
|
+
j: 0
|
|
578
|
+
}));
|
|
579
|
+
}
|
|
580
|
+
function Z(e, t, n, r, i) {
|
|
581
|
+
let a = u(t, n);
|
|
582
|
+
if (e === "cell") return V(i, [{
|
|
546
583
|
kind: e,
|
|
547
584
|
at: a,
|
|
548
585
|
tone: r
|
|
549
586
|
}]);
|
|
550
|
-
let { i: o, j: s } =
|
|
551
|
-
return
|
|
587
|
+
let { i: o, j: s } = f(a);
|
|
588
|
+
return V(i, [{
|
|
552
589
|
kind: e,
|
|
553
590
|
at: {
|
|
554
591
|
i: o - 1,
|
|
@@ -558,8 +595,8 @@ function re(e, t, n, r, i) {
|
|
|
558
595
|
tone: r
|
|
559
596
|
}]);
|
|
560
597
|
}
|
|
561
|
-
function
|
|
562
|
-
let n = (e) => Math.round(e * 100) / 100,
|
|
598
|
+
function le(e, t) {
|
|
599
|
+
let n = (e) => Math.round(e * 100) / 100, r = (e) => `M${e.map((e) => `${n(e.x)} ${n(e.y)}`).join("L")}Z`, s = (e) => ({
|
|
563
600
|
x: e.x,
|
|
564
601
|
y: e.y - t
|
|
565
602
|
}), u = /* @__PURE__ */ new Map(), d = (e, t, n) => {
|
|
@@ -571,40 +608,40 @@ function ie(e, t) {
|
|
|
571
608
|
i.d.push(n), u.set(r, i);
|
|
572
609
|
};
|
|
573
610
|
for (let t of e.parts) if (t.kind === "cell") {
|
|
574
|
-
let { x: e, y: n } =
|
|
611
|
+
let { x: e, y: n } = o(t.at), c = (t, r) => ({
|
|
575
612
|
x: e + t,
|
|
576
613
|
y: n + r
|
|
577
|
-
}), [
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
614
|
+
}), [l, u, f] = [
|
|
615
|
+
c(0, 66),
|
|
616
|
+
c(a, 88),
|
|
617
|
+
c(i, 66)
|
|
581
618
|
];
|
|
582
|
-
d("shade", t.tone,
|
|
583
|
-
|
|
619
|
+
d("shade", t.tone, r([
|
|
620
|
+
l,
|
|
584
621
|
u,
|
|
585
|
-
|
|
586
|
-
l
|
|
587
|
-
])), d("shadow", t.tone,
|
|
622
|
+
s(u),
|
|
623
|
+
s(l)
|
|
624
|
+
])), d("shadow", t.tone, r([
|
|
588
625
|
u,
|
|
589
626
|
f,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
])), d("top", t.tone,
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
].map(
|
|
627
|
+
s(f),
|
|
628
|
+
s(u)
|
|
629
|
+
])), d("top", t.tone, r([
|
|
630
|
+
c(a, 0),
|
|
631
|
+
c(i, 22),
|
|
632
|
+
c(i, 66),
|
|
633
|
+
c(a, 88),
|
|
634
|
+
c(0, 66),
|
|
635
|
+
c(0, 22)
|
|
636
|
+
].map(s)));
|
|
600
637
|
} else {
|
|
601
|
-
let e =
|
|
602
|
-
d(t.at.k === 0 ? "shadow" : "shade", t.tone,
|
|
638
|
+
let e = l(t.at).map(c), n = e[2], i = e[1];
|
|
639
|
+
d(t.at.k === 0 ? "shadow" : "shade", t.tone, r([
|
|
603
640
|
n,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
])), d("top", t.tone,
|
|
641
|
+
i,
|
|
642
|
+
s(i),
|
|
643
|
+
s(n)
|
|
644
|
+
])), d("top", t.tone, r(e.map(s)));
|
|
608
645
|
}
|
|
609
646
|
let f = [
|
|
610
647
|
"shade",
|
|
@@ -617,7 +654,7 @@ function ie(e, t) {
|
|
|
617
654
|
kind: e.kind,
|
|
618
655
|
d: e.d.join("")
|
|
619
656
|
})),
|
|
620
|
-
seams:
|
|
657
|
+
seams: G(e).map(([e, r]) => `M${n(e.x)} ${n(e.y - t)}L${n(r.x)} ${n(r.y - t)}`).join("")
|
|
621
658
|
};
|
|
622
659
|
}
|
|
623
660
|
function Q(e, t, n, r) {
|
|
@@ -633,38 +670,38 @@ function $(e, t) {
|
|
|
633
670
|
}
|
|
634
671
|
return !1;
|
|
635
672
|
}
|
|
636
|
-
function
|
|
637
|
-
let { x:
|
|
673
|
+
function ue(e, t, n = 0) {
|
|
674
|
+
let { x: r, y: s } = o(t);
|
|
638
675
|
return $(e, [
|
|
639
676
|
{
|
|
640
|
-
x:
|
|
677
|
+
x: r + a,
|
|
641
678
|
y: s - n
|
|
642
679
|
},
|
|
643
680
|
{
|
|
644
|
-
x:
|
|
681
|
+
x: r + i,
|
|
645
682
|
y: s + 22 - n
|
|
646
683
|
},
|
|
647
684
|
{
|
|
648
|
-
x:
|
|
685
|
+
x: r + i,
|
|
649
686
|
y: s + 66 - n
|
|
650
687
|
},
|
|
651
688
|
{
|
|
652
|
-
x:
|
|
689
|
+
x: r + a,
|
|
653
690
|
y: s + 88 - n
|
|
654
691
|
},
|
|
655
692
|
{
|
|
656
|
-
x:
|
|
693
|
+
x: r,
|
|
657
694
|
y: s + 66 - n
|
|
658
695
|
},
|
|
659
696
|
{
|
|
660
|
-
x:
|
|
697
|
+
x: r,
|
|
661
698
|
y: s + 22 - n
|
|
662
699
|
}
|
|
663
700
|
]);
|
|
664
701
|
}
|
|
665
|
-
function
|
|
702
|
+
function de(e, t) {
|
|
666
703
|
for (let n = 1; n < e.length; n++) for (let r = 1; r < t.length; r++) if (Q(e[n - 1], e[n], t[r - 1], t[r])) return !0;
|
|
667
704
|
return !1;
|
|
668
705
|
}
|
|
669
706
|
//#endregion
|
|
670
|
-
export {
|
|
707
|
+
export { re as A, z as C, W as D, G as E, R as F, Z as I, e as L, U as M, m as N, N as O, b as P, t as R, V as S, v as T, ce as _, o as a, X as b, l as c, de as d, $ as f, u as g, K as h, E as i, ae as j, ne as k, w as l, le as m, Y as n, d as o, O as p, oe as r, c as s, P as t, ue as u, te as v, J as w, se as x, A as y, n as z };
|
package/dist/hexes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as MAGNET, n as apart,
|
|
1
|
+
export { t as MAGNET, n as apart, a as boxOf, o as cornerAt, s as cornerOf, c as cornersOf, l as covered, u as crossesCell, d as crossesLine, f as crossesRing, p as fits, h as glued, g as hexAt, v as magnetOf, y as moved, b as nearestFit, x as outlineOf, S as pieceOf, C as pivotPoint, w as pulledOff, T as screenArea, E as seamsOf, D as sharedSides, O as snapDelta, k as snapFrames, A as stepFor, j as stepOnScreen, M as touching, N as trisOf, F as turned, I as unitAt } from "./hexes-DwdbCYSF.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as e, r as t } from "./woods-C8W11GkD.js";
|
|
2
|
+
import { _ as n, a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, y as b } from "./elements-DdyLdkzr.js";
|
|
3
|
+
export { b as FACES, c as FACE_TAG, f as HexSky, a as ICON_NAMES, o as ICON_TAG, s as LatticeFace, m as LatticeIcon, i as LatticeShape, n as MOODS, t as SHAPE_NAMES, u as SHAPE_TAG, r as SHEARS_TAG, h as SKY_TAG, p as ShearsPadElement, e as TONES, l as defineHexSky, _ as defineLatticeElements, y as defineLatticeFace, d as defineLatticeIcon, v as defineLatticeShape, g as defineShearsPad };
|