@harmonics/lattice-ui 0.1.0 → 0.5.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,624 @@
1
+ var e = {
2
+ width: 76.21,
3
+ height: 132,
4
+ half: 38.11
5
+ }, t = {
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
+ }, n = 44, { width: r } = e, i = r / 2;
9
+ function a(e) {
10
+ return {
11
+ x: r * (e.q + e.r / 2),
12
+ y: 66 * e.r
13
+ };
14
+ }
15
+ function o(e) {
16
+ return {
17
+ x: i * e.j,
18
+ y: n * e.i + 22 * e.j
19
+ };
20
+ }
21
+ function s(e) {
22
+ let t = o(e);
23
+ return {
24
+ x: t.x,
25
+ y: 22 + t.y
26
+ };
27
+ }
28
+ function c(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 l(e, t) {
59
+ let r = e - i, a = 2 / 3 * ((t - 44) / n), o = Math.sqrt(3) / 3 * (r / n) - a / 2, s = -o - a, c = Math.round(o), l = Math.round(a), u = Math.round(s), d = Math.abs(c - o), f = Math.abs(l - a), 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 u(e, t) {
66
+ let r = Math.round(e / i);
67
+ return {
68
+ i: Math.round((t - 22 - 22 * r) / n) + 0,
69
+ j: r + 0
70
+ };
71
+ }
72
+ function d(e) {
73
+ return {
74
+ i: e.r - e.q,
75
+ j: 1 + 2 * e.q + e.r
76
+ };
77
+ }
78
+ function f(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 p(e) {
88
+ let { i: t, j: n } = d(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 m(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 h = (e) => `${e.i},${e.j},${e.k}`, g = (e) => `${e.i},${e.j}`, _ = (e, t) => ({
159
+ left: 0,
160
+ top: 0,
161
+ right: e,
162
+ bottom: t
163
+ }), v = (e, t) => t.x >= e.left && t.y >= e.top && t.x <= e.right && t.y <= e.bottom, y = (e) => e.kind === "cell" ? p(e.at) : [e.at], b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap();
164
+ function S(e) {
165
+ let t = b.get(e);
166
+ return t || (t = e.parts.flatMap(y), b.set(e, t)), t;
167
+ }
168
+ function C(e) {
169
+ let t = x.get(e);
170
+ return t || (t = new Set(S(e).map(h)), x.set(e, t)), t;
171
+ }
172
+ function w(e, t) {
173
+ let n = new Set(e.flatMap(p).map(h)), r = t.map(C);
174
+ return (e) => {
175
+ let t = h(e);
176
+ return n.has(t) || r.some((e) => e.has(t));
177
+ };
178
+ }
179
+ function T(e, t, n, r = []) {
180
+ let i = w(r, t.filter((t) => t.id !== e.id));
181
+ return S(e).every((e) => c(e).every((e) => v(n, s(e))) && !i(e));
182
+ }
183
+ var E = (e) => e.parts.some((e) => e.kind === "cell");
184
+ function D(e, t) {
185
+ if (t.i === 0 && t.j === 0) return e;
186
+ let n = (e) => ({
187
+ i: e.i + t.i,
188
+ j: e.j + t.j
189
+ });
190
+ if (E(e) && (t.j - t.i) % 3 != 0) throw Error("a piece with a cell moves a whole cell at a time");
191
+ let r = e.parts.map((e) => e.kind === "tri" ? {
192
+ ...e,
193
+ at: {
194
+ ...n(e.at),
195
+ k: e.at.k
196
+ }
197
+ } : {
198
+ ...e,
199
+ at: f(n(d(e.at)))
200
+ }), i = {
201
+ ...e,
202
+ parts: r,
203
+ pivot: n(e.pivot)
204
+ }, a = O.get(e);
205
+ return O.set(i, a ? {
206
+ from: a.from,
207
+ by: {
208
+ i: a.by.i + t.i,
209
+ j: a.by.j + t.j
210
+ }
211
+ } : {
212
+ from: e,
213
+ by: t
214
+ }), i;
215
+ }
216
+ var O = /* @__PURE__ */ new WeakMap();
217
+ function k(e, t) {
218
+ let n = d(l(e + i, t + 44)), r = d({
219
+ q: 0,
220
+ r: 0
221
+ });
222
+ return {
223
+ i: n.i - r.i,
224
+ j: n.j - r.j
225
+ };
226
+ }
227
+ function A(e, t, n) {
228
+ return E(e) ? k(t, n) : u(t, n + 22);
229
+ }
230
+ var j = {
231
+ reach: .5,
232
+ capture: .3,
233
+ release: .5,
234
+ lean: .6
235
+ };
236
+ function M(e, t, n) {
237
+ let r = A(e, t, n);
238
+ if (E(e)) return r;
239
+ let i = [r, ...[
240
+ [1, 0],
241
+ [-1, 0],
242
+ [0, 1],
243
+ [0, -1],
244
+ [1, -1],
245
+ [-1, 1]
246
+ ].map(([e, t]) => ({
247
+ i: r.i + e,
248
+ j: r.j + t
249
+ }))], a = (e) => {
250
+ let r = o(e);
251
+ return Math.hypot(t - r.x, n - r.y);
252
+ };
253
+ return i.reduce((e, t) => a(t) < a(e) ? t : e);
254
+ }
255
+ var N = (e) => e * e * (3 - 2 * e);
256
+ function P(e, t, i, a) {
257
+ let s = (E(e) ? r : n) * j.reach;
258
+ if (a) {
259
+ let e = o(a);
260
+ if (Math.hypot(t - e.x, i - e.y) <= s * j.release) return {
261
+ step: a,
262
+ x: e.x,
263
+ y: e.y,
264
+ pull: 1,
265
+ held: a
266
+ };
267
+ }
268
+ let c = M(e, t, i), l = o(c), u = Math.hypot(t - l.x, i - l.y), d = s * j.capture;
269
+ if (u <= d) return {
270
+ step: c,
271
+ x: l.x,
272
+ y: l.y,
273
+ pull: 1,
274
+ held: c
275
+ };
276
+ let f = u >= s ? 0 : 1 - N((u - d) / (s - d)), p = f * j.lean;
277
+ return {
278
+ step: c,
279
+ x: t + (l.x - t) * p,
280
+ y: i + (l.y - i) * p,
281
+ pull: f,
282
+ held: void 0
283
+ };
284
+ }
285
+ function F(e, t = .12) {
286
+ let n = (t) => `translate(${e.x * t}px, ${e.y * t}px)`;
287
+ return [
288
+ {
289
+ transform: n(1),
290
+ offset: 0,
291
+ easing: "cubic-bezier(0.3, 0, 0.6, 1)"
292
+ },
293
+ {
294
+ transform: n(-t),
295
+ offset: .6,
296
+ easing: "ease-in-out"
297
+ },
298
+ {
299
+ transform: n(t * .3),
300
+ offset: .84,
301
+ easing: "ease-in-out"
302
+ },
303
+ {
304
+ transform: n(0),
305
+ offset: 1
306
+ }
307
+ ];
308
+ }
309
+ function I(e, t) {
310
+ return (E(e) ? {
311
+ ArrowRight: {
312
+ i: -1,
313
+ j: 2
314
+ },
315
+ ArrowLeft: {
316
+ i: 1,
317
+ j: -2
318
+ },
319
+ ArrowDown: {
320
+ i: 1,
321
+ j: 1
322
+ },
323
+ ArrowUp: {
324
+ i: -1,
325
+ j: -1
326
+ }
327
+ } : {
328
+ ArrowRight: {
329
+ i: -1,
330
+ j: 2
331
+ },
332
+ ArrowLeft: {
333
+ i: 1,
334
+ j: -2
335
+ },
336
+ ArrowDown: {
337
+ i: 1,
338
+ j: 0
339
+ },
340
+ ArrowUp: {
341
+ i: -1,
342
+ j: 0
343
+ }
344
+ })[t];
345
+ }
346
+ var L = (e) => ({
347
+ i: e.i + e.j,
348
+ j: -e.i + 0
349
+ });
350
+ function R(e) {
351
+ let t = Math.min(...e.map((e) => e.i)), n = e.filter((e) => e.i === t);
352
+ return n.length === 2 ? {
353
+ i: t,
354
+ j: Math.min(...n.map((e) => e.j)),
355
+ k: 0
356
+ } : {
357
+ i: t,
358
+ j: n[0].j - 1,
359
+ k: 1
360
+ };
361
+ }
362
+ function z(e, t) {
363
+ let n = (t % 6 + 6) % 6, r = e.pivot, i = (e) => {
364
+ let t = {
365
+ i: e.i - r.i,
366
+ j: e.j - r.j
367
+ };
368
+ for (let e = 0; e < n; e++) t = L(t);
369
+ return {
370
+ i: t.i + r.i,
371
+ j: t.j + r.j
372
+ };
373
+ }, a = e.parts.map((e) => e.kind === "tri" ? {
374
+ ...e,
375
+ at: R(c(e.at).map(i))
376
+ } : {
377
+ ...e,
378
+ at: f(i(d(e.at)))
379
+ });
380
+ return {
381
+ ...e,
382
+ parts: a
383
+ };
384
+ }
385
+ var B = (e) => s(e.pivot);
386
+ function V(e) {
387
+ let t = e.flatMap(y).flatMap((e) => c(e).map(s)), n = {
388
+ x: t.reduce((e, t) => e + t.x, 0) / t.length,
389
+ y: t.reduce((e, t) => e + t.y, 0) / t.length
390
+ };
391
+ return e.some((e) => e.kind === "cell") ? d(l(n.x, n.y)) : u(n.x, n.y);
392
+ }
393
+ var H = (e, t) => ({
394
+ id: e,
395
+ parts: t,
396
+ pivot: V(t)
397
+ });
398
+ function U(e, t) {
399
+ let n = t instanceof Set ? t : new Set(t.map(h));
400
+ return e.some((e) => m(e).some((e) => n.has(h(e))));
401
+ }
402
+ var W = (e, t) => S(e).length <= S(t).length ? U(S(e), C(t)) : U(S(t), C(e));
403
+ function G(e, t) {
404
+ let n = C(t), r = [];
405
+ for (let t of S(e)) for (let e of m(t)) {
406
+ if (!n.has(h(e))) continue;
407
+ let i = new Set(c(t).map(g)), a = c(e).filter((e) => i.has(g(e)));
408
+ a.length === 2 && r.push([s(a[0]), s(a[1])]);
409
+ }
410
+ return r;
411
+ }
412
+ function K(e) {
413
+ let t = /* @__PURE__ */ new Map();
414
+ e.parts.forEach((e, n) => {
415
+ for (let r of y(e)) t.set(h(r), n);
416
+ });
417
+ let n = [];
418
+ for (let [e, r] of t) {
419
+ let [i, a, o] = e.split(",").map(Number), l = {
420
+ i,
421
+ j: a,
422
+ k: o
423
+ };
424
+ for (let e of m(l)) {
425
+ let i = t.get(h(e));
426
+ if (i === void 0 || i <= r) continue;
427
+ let a = new Set(c(l).map(g)), o = c(e).filter((e) => a.has(g(e)));
428
+ o.length === 2 && n.push([s(o[0]), s(o[1])]);
429
+ }
430
+ }
431
+ return n;
432
+ }
433
+ function q(e, t) {
434
+ let n = t.filter((t) => t.id !== e.id && W(e, t)), r = [...e.parts, ...n.flatMap((e) => e.parts)];
435
+ return {
436
+ piece: H(e.id, r),
437
+ absorbed: n.map((e) => e.id)
438
+ };
439
+ }
440
+ function J(e, t) {
441
+ let n = [...e], r = [];
442
+ for (; n.length > 0;) {
443
+ let e = [n.shift()];
444
+ for (let t = 0; t < e.length; t++) {
445
+ let r = y(e[t]);
446
+ for (let t = n.length - 1; t >= 0; t--) U(r, y(n[t])) && e.push(...n.splice(t, 1));
447
+ }
448
+ r.push(H(t(), e));
449
+ }
450
+ return r;
451
+ }
452
+ function Y(e, t, n) {
453
+ let r = e.parts[t], i = e.parts.filter((e, n) => n !== t);
454
+ return [H(n(), [r]), ...J(i, n)];
455
+ }
456
+ var X = (e, t) => e.parts.map((e) => H(t(), [e]));
457
+ function Z(e) {
458
+ return E(e) ? [
459
+ {
460
+ i: -1,
461
+ j: 2
462
+ },
463
+ {
464
+ i: 1,
465
+ j: -2
466
+ },
467
+ {
468
+ i: 1,
469
+ j: 1
470
+ },
471
+ {
472
+ i: -1,
473
+ j: -1
474
+ },
475
+ {
476
+ i: 2,
477
+ j: -1
478
+ },
479
+ {
480
+ i: -2,
481
+ j: 1
482
+ }
483
+ ] : [
484
+ {
485
+ i: 1,
486
+ j: 0
487
+ },
488
+ {
489
+ i: -1,
490
+ j: 0
491
+ },
492
+ {
493
+ i: 0,
494
+ j: 1
495
+ },
496
+ {
497
+ i: 0,
498
+ j: -1
499
+ },
500
+ {
501
+ i: 1,
502
+ j: -1
503
+ },
504
+ {
505
+ i: -1,
506
+ j: 1
507
+ }
508
+ ];
509
+ }
510
+ function Q(e, t, n, r = [], i = 6, a = () => !0) {
511
+ let s = Z(e), c = /* @__PURE__ */ new Set(["0,0"]), l = [{
512
+ i: 0,
513
+ j: 0
514
+ }];
515
+ for (let u = 0; u <= i; u++) {
516
+ let i = l.map((t) => ({
517
+ d: t,
518
+ at: D(e, t),
519
+ far: Math.hypot(o(t).x, o(t).y)
520
+ })).filter((e) => T(e.at, t, n, r) && a(e.at)).sort((e, t) => e.far - t.far);
521
+ if (i[0]) return i[0].at;
522
+ let u = [];
523
+ for (let e of l) for (let t of s) {
524
+ let n = {
525
+ i: e.i + t.i,
526
+ j: e.j + t.j
527
+ }, r = g(n);
528
+ c.has(r) || (c.add(r), u.push(n));
529
+ }
530
+ l = u;
531
+ }
532
+ }
533
+ var $ = (e) => o(e);
534
+ function ee(e) {
535
+ let t = new Set(S(e).map(h)), n = [];
536
+ for (let r of S(e)) for (let e of m(r)) {
537
+ if (t.has(h(e))) continue;
538
+ let i = new Set(c(r).map(g)), a = c(e).filter((e) => i.has(g(e)));
539
+ a.length === 2 && n.push([s(a[0]), s(a[1])]);
540
+ }
541
+ return n;
542
+ }
543
+ function te(e, t, n, r, i) {
544
+ let a = l(t, n);
545
+ if (e === "cell") return H(i, [{
546
+ kind: e,
547
+ at: a,
548
+ tone: r
549
+ }]);
550
+ let { i: o, j: s } = d(a);
551
+ return H(i, [{
552
+ kind: e,
553
+ at: {
554
+ i: o - 1,
555
+ j: s,
556
+ k: 0
557
+ },
558
+ tone: r
559
+ }]);
560
+ }
561
+ function ne(e, t) {
562
+ let n = (e) => Math.round(e * 100) / 100, o = (e) => `M${e.map((e) => `${n(e.x)} ${n(e.y)}`).join("L")}Z`, l = (e) => ({
563
+ x: e.x,
564
+ y: e.y - t
565
+ }), u = /* @__PURE__ */ new Map(), d = (e, t, n) => {
566
+ let r = `${e}:${t}`, i = u.get(r) ?? {
567
+ tone: t,
568
+ kind: e,
569
+ d: []
570
+ };
571
+ i.d.push(n), u.set(r, i);
572
+ };
573
+ for (let t of e.parts) if (t.kind === "cell") {
574
+ let { x: e, y: n } = a(t.at), s = (t, r) => ({
575
+ x: e + t,
576
+ y: n + r
577
+ }), [c, u, f] = [
578
+ s(0, 66),
579
+ s(i, 88),
580
+ s(r, 66)
581
+ ];
582
+ d("shade", t.tone, o([
583
+ c,
584
+ u,
585
+ l(u),
586
+ l(c)
587
+ ])), d("shadow", t.tone, o([
588
+ u,
589
+ f,
590
+ l(f),
591
+ l(u)
592
+ ])), d("top", t.tone, o([
593
+ s(i, 0),
594
+ s(r, 22),
595
+ s(r, 66),
596
+ s(i, 88),
597
+ s(0, 66),
598
+ s(0, 22)
599
+ ].map(l)));
600
+ } else {
601
+ let e = c(t.at).map(s), n = e[2], r = e[1];
602
+ d(t.at.k === 0 ? "shadow" : "shade", t.tone, o([
603
+ n,
604
+ r,
605
+ l(r),
606
+ l(n)
607
+ ])), d("top", t.tone, o(e.map(l)));
608
+ }
609
+ let f = [
610
+ "shade",
611
+ "shadow",
612
+ "top"
613
+ ];
614
+ return {
615
+ faces: [...u.values()].sort((e, t) => f.indexOf(e.kind) - f.indexOf(t.kind) || e.tone - t.tone).map((e) => ({
616
+ tone: e.tone,
617
+ kind: e.kind,
618
+ d: e.d.join("")
619
+ })),
620
+ seams: K(e).map(([e, r]) => `M${n(e.x)} ${n(e.y - t)}L${n(r.x)} ${n(r.y - t)}`).join("")
621
+ };
622
+ }
623
+ //#endregion
624
+ export { e as A, F as C, p as D, W as E, z as O, A as S, $ as T, B as _, s as a, K as b, T as c, l as d, P as f, H as g, ee as h, u as i, t as j, te as k, ne as l, Q as m, X as n, c as o, D as p, a as r, S as s, j as t, q as u, Y as v, I as w, G as x, _ as y };
package/dist/hexes.js ADDED
@@ -0,0 +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";
package/dist/index.js CHANGED
@@ -1 +1 @@
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-DMimFemm.js";
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";
@@ -0,0 +1 @@
1
+ export { type Area, apart, boxOf, type Corner, cornerAt, cornerOf, cornersOf, covered, fits, glued, type Hex, hexAt, MAGNET, type Magnet, magnetOf, moved, nearestFit, outlineOf, type Part, type Piece, pieceOf, pivotPoint, pulledOff, screenArea, seamsOf, sharedSides, snapDelta, snapFrames, stepFor, stepOnScreen, type Tri, touching, trisOf, turned, unitAt, } from "../hexes";
@@ -3,11 +3,14 @@ export declare const SKY_TAG = "hex-sky";
3
3
  export declare class HexSky extends LatticeElement {
4
4
  static readonly observedAttributes: string[];
5
5
  private readonly kindSignal;
6
+ private readonly orientSignal;
6
7
  private readonly scaleSignal;
7
8
  private readonly xSignal;
8
9
  private readonly ySignal;
9
10
  get kind(): "sky" | "earth";
10
11
  set kind(kind: string);
12
+ get orient(): "pointy" | "flat";
13
+ set orient(orient: string);
11
14
  get scale(): number;
12
15
  set scale(scale: number | string);
13
16
  get x(): number;
@@ -84,6 +84,47 @@ export declare function slidOf(piece: Piece): {
84
84
  export declare function cellStep(dx: number, dy: number): Corner;
85
85
  /** The step a pointer's move of (dx, dy) on the screen comes to: the nearest one the piece can take. */
86
86
  export declare function snapDelta(piece: Piece, dx: number, dy: number): Corner;
87
+ /**
88
+ * How the slots pull, as parts of a piece's unit (a cell across, or a triangle's side): how far a
89
+ * slot reaches, how near catches and holds, how far a held piece must be tugged to come free (more
90
+ * than catches it, so it never flickers at the edge), and how far it leans in before it is caught.
91
+ */
92
+ export declare const MAGNET: {
93
+ readonly reach: 0.5;
94
+ readonly capture: 0.3;
95
+ readonly release: 0.5;
96
+ readonly lean: 0.6;
97
+ };
98
+ /** Where a carried piece is drawn, and the slot it would land in. */
99
+ export interface Magnet {
100
+ /** The slot: the step from where the piece was lifted. */
101
+ step: Corner;
102
+ /** Where to draw it, as a move from where it was lifted, on the screen. */
103
+ x: number;
104
+ y: number;
105
+ /** How hard the slot pulls, 0 to 1: 1 while held. */
106
+ pull: number;
107
+ /** The slot it is held in, to hand back on the next move; none while it only leans. */
108
+ held: Corner | undefined;
109
+ }
110
+ /**
111
+ * A carried piece moved (dx, dy) by the pointer since it was lifted, and held in `held` before:
112
+ * where it is drawn and where it would land. Near a slot it leans in; nearer, the slot catches it
113
+ * and it is drawn there exactly; it stays caught until it is tugged past `MAGNET.release`.
114
+ */
115
+ export declare function magnetOf(piece: Piece, dx: number, dy: number, held?: Corner): Magnet;
116
+ /**
117
+ * The click into a slot: keyframes (Web Animations) that bring a piece from `from` (how far it is
118
+ * off, on the screen) to rest, passing it by `overshoot` of the way and settling back.
119
+ */
120
+ export declare function snapFrames(from: {
121
+ x: number;
122
+ y: number;
123
+ }, overshoot?: number): {
124
+ transform: string;
125
+ offset: number;
126
+ easing?: string;
127
+ }[];
87
128
  /** How the arrow keys step a piece: a cell, or a triangle's side, in each direction. */
88
129
  export declare function stepFor(piece: Piece, key: string): Corner | undefined;
89
130
  /** The piece turned `turns` sixths clockwise (negative: anticlockwise) about its pivot. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harmonics/lattice-ui",
3
- "version": "0.1.0",
3
+ "version": "0.5.0",
4
4
  "description": "The Harmonics tree's look as Custom Elements: a lattice face, the hexagon sky, raised lattice shapes, a shears cut gesture and two marks. Any page, any framework.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,6 +16,10 @@
16
16
  "types": "./dist/types/elements/define.d.ts",
17
17
  "default": "./dist/define.js"
18
18
  },
19
+ "./hexes": {
20
+ "types": "./dist/types/elements/hexes.d.ts",
21
+ "default": "./dist/hexes.js"
22
+ },
19
23
  "./react": {
20
24
  "types": "./react.d.ts"
21
25
  },
@@ -42,6 +46,6 @@
42
46
  "repository": {
43
47
  "type": "git",
44
48
  "url": "git+https://github.com/Blankenship-Daniel/harmonics.git",
45
- "directory": "experiments/tree-alt/kit"
49
+ "directory": "packages/lattice-ui/kit"
46
50
  }
47
51
  }