@harmonics/lattice-ui 0.5.0 → 0.6.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.
@@ -0,0 +1,707 @@
1
+ var e = {
2
+ width: 76.21,
3
+ height: 132,
4
+ half: 38.11
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
+ 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
+ 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
+ }, r = 44, { width: i } = e, a = i / 2;
9
+ function o(e) {
10
+ return {
11
+ x: i * (e.q + e.r / 2),
12
+ y: 66 * e.r
13
+ };
14
+ }
15
+ function s(e) {
16
+ return {
17
+ x: a * e.j,
18
+ y: r * e.i + 22 * e.j
19
+ };
20
+ }
21
+ function c(e) {
22
+ let t = s(e);
23
+ return {
24
+ x: t.x,
25
+ y: 22 + t.y
26
+ };
27
+ }
28
+ function l(e) {
29
+ let { i: t, j: n } = e;
30
+ return e.k === 0 ? [
31
+ {
32
+ i: t,
33
+ j: n
34
+ },
35
+ {
36
+ i: t,
37
+ j: n + 1
38
+ },
39
+ {
40
+ i: t + 1,
41
+ j: n
42
+ }
43
+ ] : [
44
+ {
45
+ i: t,
46
+ j: n + 1
47
+ },
48
+ {
49
+ i: t + 1,
50
+ j: n + 1
51
+ },
52
+ {
53
+ i: t + 1,
54
+ j: n
55
+ }
56
+ ];
57
+ }
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
+ return d > f && d > p ? c = -l - u : f > p && (l = -c - u), {
61
+ q: c + 0,
62
+ r: l + 0
63
+ };
64
+ }
65
+ function d(e, t) {
66
+ let n = Math.round(e / a);
67
+ return {
68
+ i: Math.round((t - 22 - 22 * n) / r) + 0,
69
+ j: n + 0
70
+ };
71
+ }
72
+ function f(e) {
73
+ return {
74
+ i: e.r - e.q,
75
+ j: 1 + 2 * e.q + e.r
76
+ };
77
+ }
78
+ function p(e) {
79
+ let t = e.j - 1 - e.i;
80
+ if (t % 3 != 0) return;
81
+ let n = t / 3;
82
+ return {
83
+ q: n + 0,
84
+ r: e.i + n + 0
85
+ };
86
+ }
87
+ function m(e) {
88
+ let { i: t, j: n } = f(e);
89
+ return [
90
+ {
91
+ i: t,
92
+ j: n,
93
+ k: 0
94
+ },
95
+ {
96
+ i: t - 1,
97
+ j: n,
98
+ k: 0
99
+ },
100
+ {
101
+ i: t,
102
+ j: n - 1,
103
+ k: 0
104
+ },
105
+ {
106
+ i: t - 1,
107
+ j: n,
108
+ k: 1
109
+ },
110
+ {
111
+ i: t,
112
+ j: n - 1,
113
+ k: 1
114
+ },
115
+ {
116
+ i: t - 1,
117
+ j: n - 1,
118
+ k: 1
119
+ }
120
+ ];
121
+ }
122
+ function h(e) {
123
+ let { i: t, j: n } = e;
124
+ return e.k === 0 ? [
125
+ {
126
+ i: t - 1,
127
+ j: n,
128
+ k: 1
129
+ },
130
+ {
131
+ i: t,
132
+ j: n,
133
+ k: 1
134
+ },
135
+ {
136
+ i: t,
137
+ j: n - 1,
138
+ k: 1
139
+ }
140
+ ] : [
141
+ {
142
+ i: t,
143
+ j: n + 1,
144
+ k: 0
145
+ },
146
+ {
147
+ i: t + 1,
148
+ j: n,
149
+ k: 0
150
+ },
151
+ {
152
+ i: t,
153
+ j: n,
154
+ k: 0
155
+ }
156
+ ];
157
+ }
158
+ var g = (e) => `${e.i},${e.j},${e.k}`, _ = (e) => `${e.i},${e.j}`, v = (e, t) => ({
159
+ left: 0,
160
+ top: 0,
161
+ right: e,
162
+ bottom: t
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) {
165
+ let t = x.get(e);
166
+ return t || (t = e.parts.flatMap(b), x.set(e, t)), t;
167
+ }
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);
178
+ return (e) => {
179
+ let t = g(e);
180
+ return n.has(t) || r.some((e) => e.has(t));
181
+ };
182
+ }
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));
186
+ }
187
+ var k = (e) => e.parts.some((e) => e.kind === "cell");
188
+ function A(e, t) {
189
+ if (t.i === 0 && t.j === 0) return e;
190
+ let n = (e) => ({
191
+ i: e.i + t.i,
192
+ j: e.j + t.j
193
+ });
194
+ if (k(e) && (t.j - t.i) % 3 != 0) throw Error("a piece with a cell moves a whole cell at a time");
195
+ let r = e.parts.map((e) => e.kind === "tri" ? {
196
+ ...e,
197
+ at: {
198
+ ...n(e.at),
199
+ k: e.at.k
200
+ }
201
+ } : {
202
+ ...e,
203
+ at: p(n(f(e.at)))
204
+ }), i = {
205
+ ...e,
206
+ parts: r,
207
+ pivot: n(e.pivot)
208
+ }, a = j.get(e);
209
+ return j.set(i, a ? {
210
+ from: a.from,
211
+ by: {
212
+ i: a.by.i + t.i,
213
+ j: a.by.j + t.j
214
+ }
215
+ } : {
216
+ from: e,
217
+ by: t
218
+ }), i;
219
+ }
220
+ var j = /* @__PURE__ */ new WeakMap();
221
+ function M(e, t) {
222
+ let n = f(u(e + a, t + 44)), r = f({
223
+ q: 0,
224
+ r: 0
225
+ });
226
+ return {
227
+ i: n.i - r.i,
228
+ j: n.j - r.j
229
+ };
230
+ }
231
+ function N(e, t, n) {
232
+ return k(e) ? M(t, n) : d(t, n + 22);
233
+ }
234
+ var P = {
235
+ reach: .5,
236
+ capture: .3,
237
+ release: .5,
238
+ lean: .6
239
+ };
240
+ function F(e, t, n) {
241
+ let r = N(e, t, n);
242
+ if (k(e)) return r;
243
+ let i = [r, ...[
244
+ [1, 0],
245
+ [-1, 0],
246
+ [0, 1],
247
+ [0, -1],
248
+ [1, -1],
249
+ [-1, 1]
250
+ ].map(([e, t]) => ({
251
+ i: r.i + e,
252
+ j: r.j + t
253
+ }))], a = (e) => {
254
+ let r = s(e);
255
+ return Math.hypot(t - r.x, n - r.y);
256
+ };
257
+ return i.reduce((e, t) => a(t) < a(e) ? t : e);
258
+ }
259
+ var ee = (e) => e * e * (3 - 2 * e);
260
+ function te(e, t, n, a) {
261
+ let o = (k(e) ? i : r) * P.reach;
262
+ if (a) {
263
+ let e = s(a);
264
+ if (Math.hypot(t - e.x, n - e.y) <= o * P.release) return {
265
+ step: a,
266
+ x: e.x,
267
+ y: e.y,
268
+ pull: 1,
269
+ held: a
270
+ };
271
+ }
272
+ let c = F(e, t, n), l = s(c), u = Math.hypot(t - l.x, n - l.y), d = o * P.capture;
273
+ if (u <= d) return {
274
+ step: c,
275
+ x: l.x,
276
+ y: l.y,
277
+ pull: 1,
278
+ held: c
279
+ };
280
+ let f = u >= o ? 0 : 1 - ee((u - d) / (o - d)), p = f * P.lean;
281
+ return {
282
+ step: c,
283
+ x: t + (l.x - t) * p,
284
+ y: n + (l.y - n) * p,
285
+ pull: f,
286
+ held: void 0
287
+ };
288
+ }
289
+ function ne(e, t = .12) {
290
+ let n = (t) => `translate(${e.x * t}px, ${e.y * t}px)`;
291
+ return [
292
+ {
293
+ transform: n(1),
294
+ offset: 0,
295
+ easing: "cubic-bezier(0.3, 0, 0.6, 1)"
296
+ },
297
+ {
298
+ transform: n(-t),
299
+ offset: .6,
300
+ easing: "ease-in-out"
301
+ },
302
+ {
303
+ transform: n(t * .3),
304
+ offset: .84,
305
+ easing: "ease-in-out"
306
+ },
307
+ {
308
+ transform: n(0),
309
+ offset: 1
310
+ }
311
+ ];
312
+ }
313
+ function re(e, t) {
314
+ return (k(e) ? {
315
+ ArrowRight: {
316
+ i: -1,
317
+ j: 2
318
+ },
319
+ ArrowLeft: {
320
+ i: 1,
321
+ j: -2
322
+ },
323
+ ArrowDown: {
324
+ i: 1,
325
+ j: 1
326
+ },
327
+ ArrowUp: {
328
+ i: -1,
329
+ j: -1
330
+ }
331
+ } : {
332
+ ArrowRight: {
333
+ i: -1,
334
+ j: 2
335
+ },
336
+ ArrowLeft: {
337
+ i: 1,
338
+ j: -2
339
+ },
340
+ ArrowDown: {
341
+ i: 1,
342
+ j: 0
343
+ },
344
+ ArrowUp: {
345
+ i: -1,
346
+ j: 0
347
+ }
348
+ })[t];
349
+ }
350
+ var I = (e) => ({
351
+ i: e.i + e.j,
352
+ j: -e.i + 0
353
+ });
354
+ function L(e) {
355
+ let t = Math.min(...e.map((e) => e.i)), n = e.filter((e) => e.i === t);
356
+ return n.length === 2 ? {
357
+ i: t,
358
+ j: Math.min(...n.map((e) => e.j)),
359
+ k: 0
360
+ } : {
361
+ i: t,
362
+ j: n[0].j - 1,
363
+ k: 1
364
+ };
365
+ }
366
+ function R(e, t) {
367
+ let n = (t % 6 + 6) % 6, r = e.pivot, i = (e) => {
368
+ let t = {
369
+ i: e.i - r.i,
370
+ j: e.j - r.j
371
+ };
372
+ for (let e = 0; e < n; e++) t = I(t);
373
+ return {
374
+ i: t.i + r.i,
375
+ j: t.j + r.j
376
+ };
377
+ }, a = e.parts.map((e) => e.kind === "tri" ? {
378
+ ...e,
379
+ at: L(l(e.at).map(i))
380
+ } : {
381
+ ...e,
382
+ at: p(i(f(e.at)))
383
+ });
384
+ return {
385
+ ...e,
386
+ parts: a
387
+ };
388
+ }
389
+ var z = (e) => c(e.pivot);
390
+ function B(e) {
391
+ let t = e.flatMap(b).flatMap((e) => l(e).map(c)), n = {
392
+ x: t.reduce((e, t) => e + t.x, 0) / t.length,
393
+ y: t.reduce((e, t) => e + t.y, 0) / t.length
394
+ };
395
+ return e.some((e) => e.kind === "cell") ? f(u(n.x, n.y)) : d(n.x, n.y);
396
+ }
397
+ var V = (e, t) => ({
398
+ id: e,
399
+ parts: t,
400
+ pivot: B(t)
401
+ });
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])]);
413
+ }
414
+ return r;
415
+ }
416
+ function G(e) {
417
+ let t = /* @__PURE__ */ new Map();
418
+ e.parts.forEach((e, n) => {
419
+ for (let r of b(e)) t.set(g(r), n);
420
+ });
421
+ let n = [];
422
+ for (let [e, r] of t) {
423
+ let [i, a, o] = e.split(",").map(Number), s = {
424
+ i,
425
+ j: a,
426
+ k: o
427
+ };
428
+ for (let e of h(s)) {
429
+ let i = t.get(g(e));
430
+ if (i === void 0 || i <= r) continue;
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])]);
433
+ }
434
+ }
435
+ return n;
436
+ }
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)];
439
+ return {
440
+ piece: V(e.id, r),
441
+ absorbed: n.map((e) => e.id)
442
+ };
443
+ }
444
+ function q(e, t) {
445
+ let n = [...e], r = [];
446
+ for (; n.length > 0;) {
447
+ let e = [n.shift()];
448
+ for (let t = 0; t < e.length; 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));
451
+ }
452
+ r.push(V(t(), e));
453
+ }
454
+ return r;
455
+ }
456
+ function J(e, t, n) {
457
+ let r = e.parts[t], i = e.parts.filter((e, n) => n !== t);
458
+ return [V(n(), [r]), ...q(i, n)];
459
+ }
460
+ var Y = (e, t) => e.parts.map((e) => V(t(), [e]));
461
+ function ie(e) {
462
+ return k(e) ? [
463
+ {
464
+ i: -1,
465
+ j: 2
466
+ },
467
+ {
468
+ i: 1,
469
+ j: -2
470
+ },
471
+ {
472
+ i: 1,
473
+ j: 1
474
+ },
475
+ {
476
+ i: -1,
477
+ j: -1
478
+ },
479
+ {
480
+ i: 2,
481
+ j: -1
482
+ },
483
+ {
484
+ i: -2,
485
+ j: 1
486
+ }
487
+ ] : [
488
+ {
489
+ i: 1,
490
+ j: 0
491
+ },
492
+ {
493
+ i: -1,
494
+ j: 0
495
+ },
496
+ {
497
+ i: 0,
498
+ j: 1
499
+ },
500
+ {
501
+ i: 0,
502
+ j: -1
503
+ },
504
+ {
505
+ i: 1,
506
+ j: -1
507
+ },
508
+ {
509
+ i: -1,
510
+ j: 1
511
+ }
512
+ ];
513
+ }
514
+ function X(e, t, n, r = [], i = 6, a = () => !0) {
515
+ let o = ie(e), c = /* @__PURE__ */ new Set(["0,0"]), l = [{
516
+ i: 0,
517
+ j: 0
518
+ }];
519
+ for (let u = 0; u <= i; u++) {
520
+ let i = l.map((t) => ({
521
+ d: t,
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);
525
+ if (i[0]) return i[0].at;
526
+ let u = [];
527
+ for (let e of l) for (let t of o) {
528
+ let n = {
529
+ i: e.i + t.i,
530
+ j: e.j + t.j
531
+ }, r = _(n);
532
+ c.has(r) || (c.add(r), u.push(n));
533
+ }
534
+ l = u;
535
+ }
536
+ }
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])]);
550
+ }
551
+ return n;
552
+ }
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, [{
583
+ kind: e,
584
+ at: a,
585
+ tone: r
586
+ }]);
587
+ let { i: o, j: s } = f(a);
588
+ return V(i, [{
589
+ kind: e,
590
+ at: {
591
+ i: o - 1,
592
+ j: s,
593
+ k: 0
594
+ },
595
+ tone: r
596
+ }]);
597
+ }
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) => ({
600
+ x: e.x,
601
+ y: e.y - t
602
+ }), u = /* @__PURE__ */ new Map(), d = (e, t, n) => {
603
+ let r = `${e}:${t}`, i = u.get(r) ?? {
604
+ tone: t,
605
+ kind: e,
606
+ d: []
607
+ };
608
+ i.d.push(n), u.set(r, i);
609
+ };
610
+ for (let t of e.parts) if (t.kind === "cell") {
611
+ let { x: e, y: n } = o(t.at), c = (t, r) => ({
612
+ x: e + t,
613
+ y: n + r
614
+ }), [l, u, f] = [
615
+ c(0, 66),
616
+ c(a, 88),
617
+ c(i, 66)
618
+ ];
619
+ d("shade", t.tone, r([
620
+ l,
621
+ u,
622
+ s(u),
623
+ s(l)
624
+ ])), d("shadow", t.tone, r([
625
+ u,
626
+ f,
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)));
637
+ } else {
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([
640
+ n,
641
+ i,
642
+ s(i),
643
+ s(n)
644
+ ])), d("top", t.tone, r(e.map(s)));
645
+ }
646
+ let f = [
647
+ "shade",
648
+ "shadow",
649
+ "top"
650
+ ];
651
+ return {
652
+ faces: [...u.values()].sort((e, t) => f.indexOf(e.kind) - f.indexOf(t.kind) || e.tone - t.tone).map((e) => ({
653
+ tone: e.tone,
654
+ kind: e.kind,
655
+ d: e.d.join("")
656
+ })),
657
+ seams: G(e).map(([e, r]) => `M${n(e.x)} ${n(e.y - t)}L${n(r.x)} ${n(r.y - t)}`).join("")
658
+ };
659
+ }
660
+ function Q(e, t, n, r) {
661
+ let i = (e, t, n) => (t.x - e.x) * (n.y - e.y) - (t.y - e.y) * (n.x - e.x), a = i(n, r, e), o = i(n, r, t), s = i(e, t, n), c = i(e, t, r);
662
+ return a * o < 0 && s * c < 0;
663
+ }
664
+ function $(e, t) {
665
+ let n = 0;
666
+ for (let r = 1; r < e.length; r++) {
667
+ let i = e[r - 1], a = e[r];
668
+ for (let e = 0; e < t.length; e++) Q(i, a, t[e], t[(e + 1) % t.length]) && n++;
669
+ if (n >= 2) return !0;
670
+ }
671
+ return !1;
672
+ }
673
+ function ue(e, t, n = 0) {
674
+ let { x: r, y: s } = o(t);
675
+ return $(e, [
676
+ {
677
+ x: r + a,
678
+ y: s - n
679
+ },
680
+ {
681
+ x: r + i,
682
+ y: s + 22 - n
683
+ },
684
+ {
685
+ x: r + i,
686
+ y: s + 66 - n
687
+ },
688
+ {
689
+ x: r + a,
690
+ y: s + 88 - n
691
+ },
692
+ {
693
+ x: r,
694
+ y: s + 66 - n
695
+ },
696
+ {
697
+ x: r,
698
+ y: s + 22 - n
699
+ }
700
+ ]);
701
+ }
702
+ function de(e, t) {
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;
704
+ return !1;
705
+ }
706
+ //#endregion
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, r as boxOf, i as cornerAt, a as cornerOf, o as cornersOf, s as covered, c as fits, u as glued, d as hexAt, f as magnetOf, p as moved, m as nearestFit, h as outlineOf, g as pieceOf, _ as pivotPoint, v as pulledOff, y as screenArea, b as seamsOf, x as sharedSides, S as snapDelta, C as snapFrames, w as stepFor, T as stepOnScreen, E as touching, D as trisOf, O as turned, k as unitAt } from "./hexes-DN9eyQho.js";
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
- export { x as FACES, _ as FACE_TAG, n as HexSky, p as ICON_NAMES, m as ICON_TAG, v as LatticeFace, h as LatticeIcon, c as LatticeShape, y as MOODS, d as SHAPE_NAMES, l as SHAPE_TAG, a as SHEARS_TAG, r as SKY_TAG, o as ShearsPadElement, f as TONES, i as defineHexSky, t as defineLatticeElements, b as defineLatticeFace, g as defineLatticeIcon, u as defineLatticeShape, s as defineShearsPad } from "./elements-Czlt91Ar.js";
1
+ import { i as e, r as t } from "./woods-FI5aDpfQ.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-GhyUSrb9.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 };
@@ -0,0 +1,2 @@
1
+ /** What was done to the pieces, as a `change` says it. */
2
+ export type BoardAction = "move" | "turn" | "glue" | "break" | "pull" | "add" | "remove";
@@ -0,0 +1,9 @@
1
+ import { BOARD_TAG, type BoardChangeDetail, type BoardPiece, defineLatticeBoard, LatticeBoard, type LatticeBoardEventMap } from "./board";
2
+ export type { BoardAction } from "../boardTypes";
3
+ export type { Part, Piece } from "../hexes";
4
+ export { BOARD_TAG, type BoardChangeDetail, type BoardPiece, defineLatticeBoard, LatticeBoard, type LatticeBoardEventMap, };
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ "lattice-board": LatticeBoard;
8
+ }
9
+ }