@bccampus/ui-components 0.2.0 → 0.4.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.
Files changed (56) hide show
  1. package/dist/banner.js +14 -14
  2. package/dist/button.d.ts +1 -1
  3. package/dist/button.js +17 -17
  4. package/dist/caption.js +7 -8
  5. package/dist/card.js +34 -34
  6. package/dist/composite.d.ts +151 -0
  7. package/dist/composite.js +472 -0
  8. package/dist/generate-tiles-DuagGD1d.js +244 -0
  9. package/dist/horizontal-list.js +32 -32
  10. package/dist/icon-generator.js +43 -270
  11. package/dist/igenerate-tiles.d.ts +43 -0
  12. package/dist/igenerate-tiles.js +7 -0
  13. package/dist/index-U7DVCmS_.js +76 -0
  14. package/dist/input.js +4 -4
  15. package/dist/masked-image-generator.js +18 -18
  16. package/dist/navigation-menu.d.ts +27 -0
  17. package/dist/navigation-menu.js +1139 -0
  18. package/dist/overlay.js +2 -2
  19. package/dist/page-header.d.ts +5 -1
  20. package/dist/page-header.js +10 -9
  21. package/dist/page-section.js +14 -14
  22. package/dist/page.js +4 -4
  23. package/dist/search-input.js +11 -11
  24. package/dist/tag.js +8 -9
  25. package/dist/ui-components.d.ts +30 -2
  26. package/dist/ui-components.js +47 -37
  27. package/package.json +17 -1
  28. package/src/components/ui/banner.tsx +2 -2
  29. package/src/components/ui/button.tsx +8 -7
  30. package/src/components/ui/card.tsx +5 -5
  31. package/src/components/ui/composite/CompositeData.ts +215 -0
  32. package/src/components/ui/composite/CompositeDataItem.ts +144 -0
  33. package/src/components/ui/composite/composite-component-item.tsx +50 -0
  34. package/src/components/ui/composite/composite-component.tsx +100 -0
  35. package/src/components/ui/composite/composite-data-context.tsx +31 -0
  36. package/src/components/ui/composite/index.ts +4 -0
  37. package/src/components/ui/composite/types.ts +81 -0
  38. package/src/components/ui/horizontal-list.tsx +2 -2
  39. package/src/components/ui/index.ts +1 -0
  40. package/src/components/ui/navigation-menu.tsx +165 -0
  41. package/src/components/ui/page-header.tsx +13 -5
  42. package/src/components/ui/page-section.tsx +8 -8
  43. package/src/components/ui/page.tsx +3 -1
  44. package/src/components/ui/popover.tsx +46 -0
  45. package/src/hooks/use-effect-after-mount.ts +27 -0
  46. package/src/hooks/use-id.ts +5 -0
  47. package/src/hooks/use-keyboard-event.ts +144 -0
  48. package/src/lib/object.ts +48 -0
  49. package/src/lib/set-operations.ts +52 -0
  50. package/src/styles/theme.css +7 -7
  51. package/src/styles/typography.css +334 -341
  52. package/tsconfig.node.json +25 -25
  53. package/vite.config.ts +7 -3
  54. package/vite.ladle.config.ts +17 -0
  55. package/dist/index-DlfV3JTY.js +0 -70
  56. package/dist/jsx-runtime-BzflLqGi.js +0 -282
@@ -0,0 +1,472 @@
1
+ import { jsx as b, jsxs as q } from "react/jsx-runtime";
2
+ import { useMemo as w, createContext as L, useContext as N, useRef as E, useCallback as p, useSyncExternalStore as $, useId as M, useImperativeHandle as A } from "react";
3
+ const O = (o, t) => {
4
+ const e = { ...o };
5
+ return t.forEach((s) => {
6
+ const n = s.split("."), l = n.pop();
7
+ if (l) {
8
+ const i = n.reduce((r, d) => r && d in r ? r[d] : void 0, e);
9
+ i && l in i && delete i[l];
10
+ }
11
+ }), e;
12
+ };
13
+ let R = Symbol("clean"), c = [], f = 0;
14
+ const g = 4;
15
+ let K = (o) => {
16
+ let t = [], e = {
17
+ get() {
18
+ return e.lc || e.listen(() => {
19
+ })(), e.value;
20
+ },
21
+ lc: 0,
22
+ listen(s) {
23
+ return e.lc = t.push(s), () => {
24
+ for (let l = f + g; l < c.length; )
25
+ c[l] === s ? c.splice(l, g) : l += g;
26
+ let n = t.indexOf(s);
27
+ ~n && (t.splice(n, 1), --e.lc || e.off());
28
+ };
29
+ },
30
+ notify(s, n) {
31
+ let l = !c.length;
32
+ for (let i of t)
33
+ c.push(i, e.value, s, n);
34
+ if (l) {
35
+ for (f = 0; f < c.length; f += g)
36
+ c[f](
37
+ c[f + 1],
38
+ c[f + 2],
39
+ c[f + 3]
40
+ );
41
+ c.length = 0;
42
+ }
43
+ },
44
+ /* It will be called on last listener unsubscribing.
45
+ We will redefine it in onMount and onStop. */
46
+ off() {
47
+ },
48
+ set(s) {
49
+ let n = e.value;
50
+ n !== s && (e.value = s, e.notify(n));
51
+ },
52
+ subscribe(s) {
53
+ let n = e.listen(s);
54
+ return s(e.value), n;
55
+ },
56
+ value: o
57
+ };
58
+ return process.env.NODE_ENV !== "production" && (e[R] = () => {
59
+ t = [], e.lc = 0, e.off();
60
+ }), e;
61
+ };
62
+ function U(o, t, e) {
63
+ let s = new Set(t).add(void 0);
64
+ return o.listen((n, l, i) => {
65
+ s.has(i) && e(n, l, i);
66
+ });
67
+ }
68
+ let S = (o = {}) => {
69
+ let t = K(o);
70
+ return t.setKey = function(e, s) {
71
+ let n = t.value;
72
+ typeof s > "u" && e in t.value ? (t.value = { ...t.value }, delete t.value[e], t.notify(n, e)) : t.value[e] !== s && (t.value = {
73
+ ...t.value,
74
+ [e]: s
75
+ }, t.notify(n, e));
76
+ }, t;
77
+ };
78
+ class u {
79
+ #e;
80
+ parent = null;
81
+ children;
82
+ level;
83
+ data;
84
+ state;
85
+ pointers;
86
+ childrenProp;
87
+ constructor(t, e, s) {
88
+ this.#e = e.getItemKey(t), this.data = S(O(t, [e.itemChildrenProp])), this.state = S({
89
+ focused: !1,
90
+ selected: !1,
91
+ disabled: !1,
92
+ ...e.initialState
93
+ }), this.pointers = {}, this.parent = s, this.level = s ? s.level + 1 : 0, this.childrenProp = e.itemChildrenProp;
94
+ const n = e.getItemChildren(t);
95
+ n && (this.children = n.map((l) => new u(l, e, this)));
96
+ }
97
+ get key() {
98
+ return this.#e;
99
+ }
100
+ *[Symbol.iterator]() {
101
+ if (this.key !== "ALL" && (yield this), this.children)
102
+ for (const t of this.children)
103
+ for (const e of t) yield e;
104
+ }
105
+ toJSON() {
106
+ const t = { ...this.data.get() };
107
+ if (this.children) {
108
+ t[this.childrenProp] = [];
109
+ for (const e of this.children)
110
+ t[this.childrenProp].push(e.toJSON());
111
+ }
112
+ return t;
113
+ }
114
+ descendants() {
115
+ if (!this.children) return [];
116
+ const t = [];
117
+ return this.children.forEach(
118
+ (e) => {
119
+ t.push(e);
120
+ const s = e.descendants();
121
+ s && t.push(...s);
122
+ }
123
+ ), t;
124
+ }
125
+ ancestors() {
126
+ const t = [];
127
+ let e = this.parent;
128
+ for (; e; )
129
+ t.push(e), e = e.parent;
130
+ return t;
131
+ }
132
+ toggleSelect(t = !1) {
133
+ this.state.get().selected ? this.deselect(t) : this.select(t);
134
+ }
135
+ select(t = !1) {
136
+ if (this.state.setKey("selected", !0), t && this.children) {
137
+ const e = this.children.map((s) => s.select(!0)).flat();
138
+ return [this.key, ...e];
139
+ }
140
+ return [this.key];
141
+ }
142
+ deselect(t = !1) {
143
+ if (this.state.setKey("selected", !1), t && this.children) {
144
+ const e = this.children.map((s) => s.deselect(!0)).flat();
145
+ return [this.key, ...e];
146
+ }
147
+ return [this.key];
148
+ }
149
+ disable(t = !1) {
150
+ if (this.state.setKey("disabled", !0), t && this.children) {
151
+ const e = this.children.map((s) => s.disable(!0)).flat();
152
+ return [this.key, ...e];
153
+ }
154
+ return [this.key];
155
+ }
156
+ enable(t = !1) {
157
+ if (this.state.setKey("disabled", !1), t && this.children) {
158
+ const e = this.children.map((s) => s.enable(!0)).flat();
159
+ return [this.key, ...e];
160
+ }
161
+ return [this.key];
162
+ }
163
+ }
164
+ const j = /* @__PURE__ */ new Set(["ctrl", "shift", "alt", "meta"]), C = {
165
+ " ": "space"
166
+ };
167
+ function J(o, t) {
168
+ if (o.size !== t.size) return !1;
169
+ for (const e of t)
170
+ if (!o.has(e)) return !1;
171
+ return !0;
172
+ }
173
+ function Q(o) {
174
+ const t = [];
175
+ for (const [e, s] of Object.entries(o)) {
176
+ const n = e.toLowerCase().trim().split(/\s*\+\s*/);
177
+ n.length === 1 && j.has(n[0]) ? console.error(`[useKeyboardEvent] \`${e}\`: A key sequence cannot be only a modifier key.`) : n.includes("") ? console.error(`[useKeyboardEvent] \`${e}\`: Unknown key defined in the sequence.`) : t.push({
178
+ sequence: new Set(n),
179
+ handler: s
180
+ });
181
+ }
182
+ return t;
183
+ }
184
+ const v = {
185
+ eventKeyProp: "key"
186
+ };
187
+ function z(o, t = v) {
188
+ const e = { ...t, ...v }, s = Q(o);
189
+ return (n) => {
190
+ const l = /* @__PURE__ */ new Set(), i = n[e.eventKeyProp];
191
+ n.ctrlKey && l.add("ctrl"), n.shiftKey && l.add("shift"), n.altKey && l.add("alt"), n.metaKey && l.add("meta"), C[i] ? l.add(C[i]) : l.add(i.toLowerCase());
192
+ const r = s.find((d) => J(l, d.sequence));
193
+ r && (n.preventDefault(), n.stopPropagation(), r.handler(n));
194
+ };
195
+ }
196
+ function T(o, t) {
197
+ return w(() => z(o, t), [o, t]);
198
+ }
199
+ function I(o, t) {
200
+ const e = new Set(o);
201
+ for (const s of t)
202
+ e.add(s);
203
+ return e;
204
+ }
205
+ function Y(o, t) {
206
+ const e = new Set(o);
207
+ for (const s of t)
208
+ e.delete(s);
209
+ return e;
210
+ }
211
+ class G {
212
+ #e;
213
+ lookup = /* @__PURE__ */ new Map();
214
+ firstFocusableItem;
215
+ focusedItem = K(null);
216
+ disabledKeys = K(/* @__PURE__ */ new Set());
217
+ selectedKeys = K(/* @__PURE__ */ new Set());
218
+ root;
219
+ constructor(t, e) {
220
+ this.#e = {
221
+ itemKeyProp: "key",
222
+ itemChildrenProp: "children",
223
+ disabledKeys: [],
224
+ selectedKeys: [],
225
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
+ getItemKey: (s) => s[this.#e.itemKeyProp],
227
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
+ getItemChildren: (s) => s[this.#e.itemChildrenProp] ? s[this.#e.itemChildrenProp] : void 0,
229
+ ...e
230
+ }, this.init(t);
231
+ }
232
+ *[Symbol.iterator]() {
233
+ if (this.root.children)
234
+ for (const t of this.root.children)
235
+ yield t;
236
+ }
237
+ toJSON() {
238
+ return this.root.toJSON()[this.#e.itemChildrenProp];
239
+ }
240
+ init(t) {
241
+ this.root = new u(
242
+ { [this.#e.itemKeyProp]: "ALL", [this.#e.itemChildrenProp]: t },
243
+ this.#e,
244
+ null
245
+ ), this.lookup = new Map([...this.root].map((s) => [s.key, s])), this.#e.disabledKeys.forEach((s) => this.disable(s)), this.#e.selectedKeys.forEach((s) => this.select(s)), this.firstFocusableItem = this.getFirstFocusableItem() ?? null, this.firstFocusableItem && (this.firstFocusableItem.state.setKey("focused", !0), this.focusedItem.set(this.firstFocusableItem));
246
+ const e = [...this.lookup];
247
+ for (let s = 0; s < e.length; s++) {
248
+ const [n, l] = e[s];
249
+ if (this.isFocusable(l) && s < e.length - 1) {
250
+ let i = s === e.length - 1 ? 0 : s + 1;
251
+ for (; i < e.length && !this.isFocusable(e[i][1]); )
252
+ i = (i + 1) % e.length;
253
+ l.pointers.down = e[i][0], e[i][1].pointers.up = n;
254
+ }
255
+ }
256
+ }
257
+ isFocusable(t) {
258
+ return !t.state.get().disabled;
259
+ }
260
+ getFirstFocusableItem() {
261
+ let t = this.lookup.values().next();
262
+ for (; t.value && !this.isFocusable(t.value); )
263
+ t = this.lookup.values().next();
264
+ return t.value;
265
+ }
266
+ item(t) {
267
+ return this.lookup.get(t);
268
+ }
269
+ descendants(t) {
270
+ const e = this.lookup.get(t);
271
+ if (e)
272
+ return e.descendants();
273
+ }
274
+ ancestors(t) {
275
+ const e = this.lookup.get(t);
276
+ if (e)
277
+ return e.ancestors();
278
+ }
279
+ focus(t) {
280
+ const e = t instanceof u ? t : this.lookup.get(t);
281
+ if (e) {
282
+ if (this.focusedItem.get()) {
283
+ if (e.key === this.focusedItem.get()?.key) return;
284
+ this.focusedItem.get().state.setKey("focused", !1);
285
+ }
286
+ e.state.setKey("focused", !0), this.focusedItem.set(e);
287
+ }
288
+ }
289
+ toggleSelect(t, e = !1) {
290
+ const s = t instanceof u ? t : this.lookup.get(t);
291
+ s && (s.state.get().selected ? this.deselect(s, e) : this.select(s, e));
292
+ }
293
+ select(t, e = !1) {
294
+ const s = t instanceof u ? t : this.lookup.get(t);
295
+ if (!s) return;
296
+ const n = s.select(e);
297
+ this.selectedKeys.set(I(this.selectedKeys.get(), n));
298
+ }
299
+ deselect(t, e = !1) {
300
+ const s = t instanceof u ? t : this.lookup.get(t);
301
+ if (!s) return;
302
+ const n = s.deselect(e);
303
+ this.selectedKeys.set(Y(this.selectedKeys.get(), n));
304
+ }
305
+ disable(t, e = !1) {
306
+ const s = t instanceof u ? t : this.lookup.get(t);
307
+ if (!s) return;
308
+ const n = s.disable(e);
309
+ this.disabledKeys.set(I(this.selectedKeys.get(), n));
310
+ }
311
+ enable(t, e = !1) {
312
+ const s = t instanceof u ? t : this.lookup.get(t);
313
+ if (!s) return;
314
+ const n = s.enable(e);
315
+ this.disabledKeys.set(I(this.selectedKeys.get(), n));
316
+ }
317
+ updateItem(t, e) {
318
+ const s = this.lookup.get(t);
319
+ if (s) {
320
+ const n = {
321
+ ...s.data.get(),
322
+ ...typeof e == "function" ? e(s.data.get()) : e
323
+ }, l = this.#e.getItemKey(n);
324
+ if (s.key !== l) throw "Item key cannot be updated!";
325
+ this.#t(t), s.data.set(n);
326
+ }
327
+ }
328
+ #t(t) {
329
+ this.selectedKeys.get().has(t) && this.selectedKeys.set(/* @__PURE__ */ new Set([...this.selectedKeys.get()]));
330
+ }
331
+ }
332
+ const P = L(void 0);
333
+ function H() {
334
+ const o = N(P);
335
+ if (!o)
336
+ throw new Error("No CompositeDataContext has been set, use CompositeDataContext to provide a context");
337
+ return o;
338
+ }
339
+ function X({
340
+ data: o,
341
+ children: t,
342
+ ...e
343
+ }) {
344
+ const s = w(() => new G(o, e), [o, e]);
345
+ return /* @__PURE__ */ b(P, { value: s, children: t });
346
+ }
347
+ let k = (o, t) => (e) => {
348
+ o.current !== e && (o.current = e, t());
349
+ };
350
+ function x(o, { keys: t, deps: e = [o, t] } = {}) {
351
+ let s = E();
352
+ s.current = o.get();
353
+ let n = p((i) => (k(s, i)(o.value), t?.length > 0 ? U(o, t, k(s, i)) : o.listen(k(s, i))), e), l = () => s.current;
354
+ return $(n, l, l);
355
+ }
356
+ function D({
357
+ id: o,
358
+ className: t,
359
+ item: e,
360
+ mouseEventHandler: s,
361
+ keyboardEventHandler: n,
362
+ render: l
363
+ }) {
364
+ const i = x(e.data), r = x(e.state), d = w(() => r.disabled ? {} : {
365
+ mouseEventHandler: () => s?.(e),
366
+ keyboardEventHandler: () => n?.(e)
367
+ }, [r.disabled, e, n, s]);
368
+ return /* @__PURE__ */ q(
369
+ "div",
370
+ {
371
+ id: o,
372
+ role: "option",
373
+ "aria-disabled": r.disabled,
374
+ "data-key": e.key,
375
+ tabIndex: r.disabled ? void 0 : r.focused ? 0 : -1,
376
+ className: t,
377
+ children: [
378
+ l({ data: i, key: e.key, level: e.level }, r, d),
379
+ e.children && e.children.length > 0 && [...e.children].map((a) => /* @__PURE__ */ b(
380
+ D,
381
+ {
382
+ id: `${o}-${e.key}`,
383
+ item: a,
384
+ render: l,
385
+ className: t,
386
+ mouseEventHandler: s,
387
+ keyboardEventHandler: n
388
+ },
389
+ a.key
390
+ ))
391
+ ]
392
+ }
393
+ );
394
+ }
395
+ function V(o) {
396
+ return o ?? M();
397
+ }
398
+ function Z({
399
+ renderItem: o,
400
+ className: t,
401
+ itemClassName: e,
402
+ ref: s,
403
+ id: n,
404
+ ...l
405
+ }) {
406
+ const i = H(), r = E(null), d = V(n), a = p(
407
+ (h) => {
408
+ i.focus(h);
409
+ },
410
+ [i]
411
+ ), y = p(() => {
412
+ i.focusedItem.get()?.pointers.down && a(i.focusedItem.get().pointers.down);
413
+ }, [i, a]), m = p(() => {
414
+ i.focusedItem.get()?.pointers.up && a(i.focusedItem.get().pointers.up);
415
+ }, [i, a]), F = T({
416
+ ArrowUp: m,
417
+ ArrowLeft: m,
418
+ ArrowDown: y,
419
+ ArrowRight: y,
420
+ Space: () => {
421
+ i.focusedItem.get() && i.toggleSelect(i.focusedItem.get());
422
+ }
423
+ }), _ = p(
424
+ (h) => {
425
+ a(h.key), i.toggleSelect(h);
426
+ },
427
+ [i, a]
428
+ );
429
+ return A(
430
+ s,
431
+ () => ({
432
+ focusDown() {
433
+ y();
434
+ },
435
+ focusUp() {
436
+ m();
437
+ },
438
+ select() {
439
+ i.focusedItem.get() && i.toggleSelect(i.focusedItem.get());
440
+ }
441
+ }),
442
+ [i, y, m]
443
+ ), /* @__PURE__ */ b(
444
+ "div",
445
+ {
446
+ ref: r,
447
+ id: d,
448
+ className: t,
449
+ tabIndex: -1,
450
+ role: "listbox",
451
+ onKeyDown: F,
452
+ ...l,
453
+ children: [...i].map((h) => /* @__PURE__ */ b(
454
+ D,
455
+ {
456
+ className: e,
457
+ id: `${d}-${h.key}`,
458
+ item: h,
459
+ render: o,
460
+ mouseEventHandler: _
461
+ },
462
+ h.key
463
+ ))
464
+ }
465
+ );
466
+ }
467
+ export {
468
+ Z as CompositeComponent,
469
+ X as CompositeComponentContext,
470
+ D as CompositeComponentItem,
471
+ H as useCompositeContext
472
+ };
@@ -0,0 +1,244 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { c as m } from "./utils-CRiPKpXj.js";
3
+ const r = {
4
+ Blank: 0,
5
+ Rand: 1,
6
+ Mosaic: 2,
7
+ MosaicCircle: 3,
8
+ MosaicDiamond: 4,
9
+ Square: 6,
10
+ Circle: 7,
11
+ Diamond: 8,
12
+ Hexagon: 9,
13
+ RandBasic: 10,
14
+ TriangleSE: 11,
15
+ TriangleSW: 12,
16
+ TriangleNW: 13,
17
+ TriangleNE: 14,
18
+ TriangleRand: 15,
19
+ CaretN: 16,
20
+ CaretE: 17,
21
+ CaretS: 18,
22
+ CaretW: 19,
23
+ CaretRand: 20,
24
+ PieSE: 21,
25
+ PieSW: 22,
26
+ PieNW: 23,
27
+ PieNE: 24,
28
+ PieRand: 25
29
+ }, p = [
30
+ r.Square,
31
+ r.Circle,
32
+ r.Diamond,
33
+ r.Hexagon,
34
+ r.TriangleSE,
35
+ r.TriangleSW,
36
+ r.TriangleNW,
37
+ r.TriangleNE,
38
+ r.PieSE,
39
+ r.PieSW,
40
+ r.PieNW,
41
+ r.PieNE
42
+ ], h = {
43
+ [r.Blank]: () => null,
44
+ [r.Rand]: (c, $, a, s) => h[p[Math.floor(Math.random() * p.length)]](c, $, a, s),
45
+ [r.Mosaic]: (c, $, a, s) => h[Math.random() > 0.8 ? r.Blank : r.Square](c, $, a, s),
46
+ [r.MosaicCircle]: (c, $, a, s) => h[Math.random() > 0.8 ? r.Blank : r.Circle](c, $, a, s),
47
+ [r.MosaicDiamond]: (c, $, a, s) => h[Math.random() > 0.8 ? r.Blank : r.Diamond](c, $, a, s),
48
+ [r.Square]: (c, $, a, s) => /* @__PURE__ */ n(
49
+ "rect",
50
+ {
51
+ x: a * c,
52
+ y: a * $,
53
+ width: a * s.scale,
54
+ height: a * s.scale,
55
+ className: m("fill-current stroke-none", s?.className)
56
+ },
57
+ `tile-${c}-${$}`
58
+ ),
59
+ [r.Circle]: (c, $, a, s) => /* @__PURE__ */ n(
60
+ "circle",
61
+ {
62
+ cx: a * (c + 0.5 * s.scale),
63
+ cy: a * ($ + 0.5 * s.scale),
64
+ r: a / 2 * s.scale,
65
+ className: m("fill-current stroke-none", s?.className)
66
+ },
67
+ `tile-${c}-${$}`
68
+ ),
69
+ [r.Diamond]: (c, $, a, s) => /* @__PURE__ */ n(
70
+ "path",
71
+ {
72
+ d: `M ${a * (c + 0.5 * s.scale)} ${a * $}
73
+ L ${a * (c + s.scale)} ${a * ($ + 0.5 * s.scale)}
74
+ L ${a * (c + 0.5 * s.scale)} ${a * ($ + s.scale)}
75
+ L ${a * c} ${a * ($ + 0.5 * s.scale)} Z`,
76
+ className: m("fill-current stroke-none", s?.className)
77
+ },
78
+ `tile-${c}-${$}`
79
+ ),
80
+ [r.Hexagon]: (c, $, a, s) => {
81
+ const d = a / Math.sqrt(3), N = (a - d) / 2;
82
+ return /* @__PURE__ */ n(
83
+ "path",
84
+ {
85
+ rotate: 45,
86
+ d: `M ${a * c + N * s.scale} ${a * $}
87
+ L ${a * c + (N + d) * s.scale} ${a * $}
88
+ L ${a * (c + s.scale)} ${a * ($ + 0.5 * s.scale)}
89
+ L ${a * c + (N + d) * s.scale} ${a * ($ + s.scale)}
90
+ L ${a * c + N * s.scale} ${a * ($ + s.scale)}
91
+ L ${a * c} ${a * ($ + 0.5 * s.scale)} Z`,
92
+ className: m("fill-current stroke-none", s?.className)
93
+ },
94
+ `tile-${c}-${$}`
95
+ );
96
+ },
97
+ [r.RandBasic]: (c, $, a, s) => h[r.Square + Math.floor(Math.random() * 4)](c, $, a, s),
98
+ [r.TriangleSE]: (c, $, a, s) => /* @__PURE__ */ n(
99
+ "path",
100
+ {
101
+ d: `M ${a * (c + s.scale)} ${a * $}
102
+ L ${a * c} ${a * ($ + s.scale)}
103
+ L ${a * (c + s.scale)} ${a * ($ + s.scale)} Z`,
104
+ className: m("fill-current stroke-none", s?.className)
105
+ },
106
+ `tile-${c}-${$}`
107
+ ),
108
+ [r.TriangleSW]: (c, $, a, s) => /* @__PURE__ */ n(
109
+ "path",
110
+ {
111
+ d: `M ${a * c} ${a * $}
112
+ L ${a * (c + s.scale)} ${a * ($ + s.scale)}
113
+ L ${a * c} ${a * ($ + s.scale)} Z`,
114
+ className: m("fill-current stroke-none", s?.className)
115
+ },
116
+ `tile-${c}-${$}`
117
+ ),
118
+ [r.TriangleNW]: (c, $, a, s) => /* @__PURE__ */ n(
119
+ "path",
120
+ {
121
+ d: `M ${a * (c + s.scale)} ${a * $}
122
+ L ${a * c} ${a * ($ + s.scale)}
123
+ L ${a * c} ${a * $} Z`,
124
+ className: m("fill-current stroke-none", s?.className)
125
+ },
126
+ `tile-${c}-${$}`
127
+ ),
128
+ [r.TriangleNE]: (c, $, a, s) => /* @__PURE__ */ n(
129
+ "path",
130
+ {
131
+ d: `M ${a * c} ${a * $}
132
+ L ${a * (c + s.scale)} ${a * ($ + s.scale)}
133
+ L ${a * (c + s.scale)} ${a * $} Z`,
134
+ className: m("fill-current stroke-none", s?.className)
135
+ },
136
+ `tile-${c}-${$}`
137
+ ),
138
+ [r.TriangleRand]: (c, $, a, s) => h[r.TriangleSE + Math.floor(Math.random() * 4)](
139
+ c,
140
+ $,
141
+ a,
142
+ s
143
+ ),
144
+ [r.CaretN]: (c, $, a, s) => /* @__PURE__ */ n(
145
+ "path",
146
+ {
147
+ d: `M ${a * c} ${a * ($ + s.scale)}
148
+ L ${a * (c + s.scale)} ${a * ($ + s.scale)}
149
+ L ${a * (c + 0.5 * s.scale)} ${a * $} Z`,
150
+ className: m("fill-current stroke-none", s?.className)
151
+ },
152
+ `tile-${c}-${$}`
153
+ ),
154
+ [r.CaretE]: (c, $, a, s) => /* @__PURE__ */ n(
155
+ "path",
156
+ {
157
+ d: `M ${a * c} ${a * $}
158
+ L ${a * (c + s.scale)} ${a * ($ + 0.5 * s.scale)}
159
+ L ${a * c} ${a * ($ + s.scale)} Z`,
160
+ className: m("fill-current stroke-none", s?.className)
161
+ },
162
+ `tile-${c}-${$}`
163
+ ),
164
+ [r.CaretS]: (c, $, a, s) => /* @__PURE__ */ n(
165
+ "path",
166
+ {
167
+ d: `M ${a * c} ${a * $}
168
+ L ${a * (c + s.scale)} ${a * $}
169
+ L ${a * (c + 0.5 * s.scale)} ${a * ($ + s.scale)} Z`,
170
+ className: m("fill-current stroke-none", s?.className)
171
+ },
172
+ `tile-${c}-${$}`
173
+ ),
174
+ [r.CaretW]: (c, $, a, s) => /* @__PURE__ */ n(
175
+ "path",
176
+ {
177
+ d: `M ${a * (c + s.scale)} ${a * $}
178
+ L ${a * c} ${a * ($ + 0.5 * s.scale)}
179
+ L ${a * (c + s.scale)} ${a * ($ + s.scale)} Z`,
180
+ className: m("fill-current stroke-none", s?.className)
181
+ },
182
+ `tile-${c}-${$}`
183
+ ),
184
+ [r.CaretRand]: (c, $, a, s) => h[r.CaretN + Math.floor(Math.random() * 4)](c, $, a, s),
185
+ [r.PieSE]: (c, $, a, s) => /* @__PURE__ */ n(
186
+ "path",
187
+ {
188
+ d: `M ${a * s.scale + a * c} ${a * $}
189
+ A ${a * s.scale} ${a * s.scale}, 0, 0, 0, ${a * c} ${a * s.scale + a * $}
190
+ L ${a * s.scale + a * c} ${a * s.scale + a * $} Z`,
191
+ className: m("fill-current stroke-none", s?.className)
192
+ },
193
+ `tile-${c}-${$}`
194
+ ),
195
+ [r.PieSW]: (c, $, a, s) => /* @__PURE__ */ n(
196
+ "path",
197
+ {
198
+ d: `M ${a * s.scale + a * c} ${a * s.scale + a * $}
199
+ A ${a * s.scale} ${a * s.scale}, 0, 0, 0, ${a * c} ${a * $}
200
+ L ${a * c} ${a * s.scale + a * $} Z`,
201
+ className: m("fill-current stroke-none", s?.className)
202
+ },
203
+ `tile-${c}-${$}`
204
+ ),
205
+ [r.PieNW]: (c, $, a, s) => /* @__PURE__ */ n(
206
+ "path",
207
+ {
208
+ d: `M ${a * c} ${a * s.scale + a * $}
209
+ A ${a * s.scale} ${a * s.scale}, 0, 0, 0, ${a * s.scale + a * c} ${a * $}
210
+ L ${a * c} ${a * $} Z`,
211
+ className: m("fill-current stroke-none", s?.className)
212
+ },
213
+ `tile-${c}-${$}`
214
+ ),
215
+ [r.PieNE]: (c, $, a, s) => /* @__PURE__ */ n(
216
+ "path",
217
+ {
218
+ d: `M ${a * c} ${a * $}
219
+ A ${a * s.scale} ${a * s.scale}, 0, 0, 0, ${a * s.scale + a * c} ${a * s.scale + a * $}
220
+ L ${a * s.scale + a * c} ${a * $} Z`,
221
+ className: m("fill-current stroke-none", s?.className)
222
+ },
223
+ `tile-${c}-${$}`
224
+ ),
225
+ [r.PieRand]: (c, $, a, s) => h[r.PieSE + Math.floor(Math.random() * 4)](c, $, a, s)
226
+ }, o = (c, $, a) => {
227
+ const s = [];
228
+ for (let d = 0; d < $; d++) {
229
+ s[d] = [];
230
+ for (let N = 0; N < c; N++)
231
+ s[d].push(a);
232
+ }
233
+ return s;
234
+ }, T = (c, $, a) => c.map(
235
+ (s, d) => s.map((N, L) => {
236
+ const M = typeof N == "object" ? { className: m(a, N.className), scale: N.scale ?? 1, shape: N.shape } : { className: a, scale: 1, shape: N };
237
+ return h[M.shape](L, d, $, M);
238
+ })
239
+ ).flat();
240
+ export {
241
+ r as T,
242
+ o as a,
243
+ T as g
244
+ };