@hoardodile/ui 0.1.3 → 0.1.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.
@@ -0,0 +1,615 @@
1
+ import { clsx } from 'clsx';
2
+ import { extendTailwindMerge } from 'tailwind-merge';
3
+ import 'react';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
+
6
+ // src/lib/utils.ts
7
+ var mergeTheme = {
8
+ text: ["tiny", "ui", "doc", "doc-title", "doc-heading", "quote"],
9
+ spacing: ["chip", "control", "nav", "sidebar", "panel"],
10
+ tracking: ["label"],
11
+ shadow: ["card", "dialog"],
12
+ container: ["reading", "medium", "content"],
13
+ font: ["doc", "heading"],
14
+ ease: ["standard"],
15
+ animate: ["skel", "pop"]
16
+ };
17
+ var twMerge = extendTailwindMerge({
18
+ extend: { theme: mergeTheme }
19
+ });
20
+
21
+ // src/lib/utils.ts
22
+ function cn(...inputs) {
23
+ return twMerge(clsx(inputs));
24
+ }
25
+ function GoldSurface({
26
+ id,
27
+ active
28
+ }) {
29
+ const gradientId = `${id}-gold-gradient`;
30
+ return /* @__PURE__ */ jsxs(
31
+ "svg",
32
+ {
33
+ className: cn(
34
+ "size-full",
35
+ !active && "[filter:brightness(1.1)] group-hover:[filter:brightness(1.16)]"
36
+ ),
37
+ width: "100%",
38
+ height: "100%",
39
+ viewBox: "0 0 100 100",
40
+ preserveAspectRatio: "none",
41
+ children: [
42
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
43
+ "linearGradient",
44
+ {
45
+ id: gradientId,
46
+ x1: "0%",
47
+ y1: "0%",
48
+ x2: "100%",
49
+ y2: "0%",
50
+ gradientTransform: "rotate(30, 0.5, 0.5)",
51
+ children: [
52
+ /* @__PURE__ */ jsx("stop", { offset: "10%", stopColor: "#daa520" }),
53
+ /* @__PURE__ */ jsx("stop", { offset: "30%", stopColor: "#ffd700" }),
54
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#f0e68c" }),
55
+ /* @__PURE__ */ jsx("stop", { offset: "70%", stopColor: "#ffd700" }),
56
+ /* @__PURE__ */ jsx("stop", { offset: "90%", stopColor: "#daa520" })
57
+ ]
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ jsx(
61
+ "rect",
62
+ {
63
+ width: "100",
64
+ height: "100",
65
+ fill: active ? "#8a6d1f" : `url(#${gradientId})`
66
+ }
67
+ ),
68
+ !active && /* @__PURE__ */ jsx(
69
+ "rect",
70
+ {
71
+ x: "0",
72
+ y: "0",
73
+ width: "100",
74
+ height: "8",
75
+ fill: "#ffffff",
76
+ opacity: "0.12"
77
+ }
78
+ )
79
+ ]
80
+ }
81
+ );
82
+ }
83
+ var goldConfig = {
84
+ render: GoldSurface,
85
+ default: {
86
+ style: {
87
+ color: "#725603",
88
+ boxShadow: "inset 0 0 0 1px rgba(114, 86, 3, 0.2)"
89
+ }
90
+ },
91
+ active: {
92
+ style: {
93
+ color: "#ffffff"
94
+ }
95
+ }
96
+ };
97
+ function KintsugiSurface({
98
+ id,
99
+ active
100
+ }) {
101
+ if (active) {
102
+ return /* @__PURE__ */ jsx(
103
+ "svg",
104
+ {
105
+ className: cn(
106
+ "size-full",
107
+ !active && "[filter:brightness(1.02)] group-hover:[filter:brightness(1.06)]"
108
+ ),
109
+ width: "100%",
110
+ height: "100%",
111
+ viewBox: "0 0 100 100",
112
+ preserveAspectRatio: "none",
113
+ children: /* @__PURE__ */ jsx("rect", { width: "100", height: "100", fill: "#9a9a8a" })
114
+ }
115
+ );
116
+ }
117
+ const goldGradientId = `${id}-kintsugi-gold`;
118
+ return /* @__PURE__ */ jsxs(
119
+ "svg",
120
+ {
121
+ className: cn(
122
+ "size-full",
123
+ !active && "[filter:brightness(1.02)] group-hover:[filter:brightness(1.06)]"
124
+ ),
125
+ width: "100%",
126
+ height: "100%",
127
+ viewBox: "0 0 100 100",
128
+ preserveAspectRatio: "none",
129
+ children: [
130
+ /* @__PURE__ */ jsx("style", { children: `
131
+ @keyframes ${id}-gold-shimmer {
132
+ 0% { stroke-dashoffset: 60; }
133
+ 100% { stroke-dashoffset: 0; }
134
+ }
135
+ .${id}-gold-vein {
136
+ stroke-dasharray: 30 30;
137
+ animation: ${id}-gold-shimmer 5s linear infinite;
138
+ }
139
+ @media (prefers-reduced-motion: reduce) {
140
+ .${id}-gold-vein {
141
+ animation: none;
142
+ }
143
+ }
144
+ ` }),
145
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: goldGradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
146
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#b8860b" }),
147
+ /* @__PURE__ */ jsx("stop", { offset: "35%", stopColor: "#ffd700" }),
148
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#fffacd" }),
149
+ /* @__PURE__ */ jsx("stop", { offset: "65%", stopColor: "#ffd700" }),
150
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#b8860b" })
151
+ ] }) }),
152
+ /* @__PURE__ */ jsx("rect", { width: "100", height: "100", fill: "#d8d4c5" }),
153
+ /* @__PURE__ */ jsx("rect", { width: "100", height: "100", fill: "#b8c4b8", opacity: "0.35" }),
154
+ /* @__PURE__ */ jsx("ellipse", { cx: "30", cy: "25", rx: "40", ry: "25", fill: "#ffffff", opacity: "0.08" }),
155
+ /* @__PURE__ */ jsx("ellipse", { cx: "75", cy: "70", rx: "35", ry: "28", fill: "#000000", opacity: "0.04" }),
156
+ /* @__PURE__ */ jsx(
157
+ "path",
158
+ {
159
+ d: "M 5 20 Q 25 22 35 45 T 60 80",
160
+ fill: "none",
161
+ stroke: "#5a5650",
162
+ strokeWidth: "0.7",
163
+ opacity: "0.45"
164
+ }
165
+ ),
166
+ /* @__PURE__ */ jsx(
167
+ "path",
168
+ {
169
+ d: "M 80 10 Q 70 35 85 55 T 55 95",
170
+ fill: "none",
171
+ stroke: "#5a5650",
172
+ strokeWidth: "0.6",
173
+ opacity: "0.40"
174
+ }
175
+ ),
176
+ /* @__PURE__ */ jsx(
177
+ "path",
178
+ {
179
+ d: "M 10 70 Q 30 68 45 55 T 75 45",
180
+ fill: "none",
181
+ stroke: "#5a5650",
182
+ strokeWidth: "0.5",
183
+ opacity: "0.38"
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsx(
187
+ "path",
188
+ {
189
+ className: `${id}-gold-vein`,
190
+ d: "M 4 18 Q 24 20 34 43 T 58 78",
191
+ fill: "none",
192
+ stroke: `url(#${goldGradientId})`,
193
+ strokeWidth: "1.4",
194
+ strokeLinecap: "round"
195
+ }
196
+ ),
197
+ /* @__PURE__ */ jsx(
198
+ "path",
199
+ {
200
+ className: `${id}-gold-vein`,
201
+ d: "M 82 8 Q 72 33 87 53 T 53 93",
202
+ fill: "none",
203
+ stroke: `url(#${goldGradientId})`,
204
+ strokeWidth: "1.2",
205
+ strokeLinecap: "round"
206
+ }
207
+ ),
208
+ /* @__PURE__ */ jsx(
209
+ "path",
210
+ {
211
+ className: `${id}-gold-vein`,
212
+ d: "M 8 68 Q 28 66 43 53 T 73 43",
213
+ fill: "none",
214
+ stroke: `url(#${goldGradientId})`,
215
+ strokeWidth: "1.0",
216
+ strokeLinecap: "round"
217
+ }
218
+ )
219
+ ]
220
+ }
221
+ );
222
+ }
223
+ var kintsugiConfig = {
224
+ render: KintsugiSurface,
225
+ default: {
226
+ style: {
227
+ color: "#4a4030",
228
+ boxShadow: "inset 0 0 0 1px rgba(74, 64, 48, 0.12)"
229
+ }
230
+ },
231
+ active: {
232
+ style: {
233
+ color: "#ffffff"
234
+ }
235
+ }
236
+ };
237
+ function OilslickSurface({
238
+ id,
239
+ active
240
+ }) {
241
+ if (active) {
242
+ return /* @__PURE__ */ jsx(
243
+ "svg",
244
+ {
245
+ className: cn(
246
+ "size-full",
247
+ !active && "[filter:saturate(1.15)] group-hover:[filter:saturate(1.3)_brightness(1.08)]"
248
+ ),
249
+ width: "100%",
250
+ height: "100%",
251
+ viewBox: "0 0 100 100",
252
+ preserveAspectRatio: "none",
253
+ children: /* @__PURE__ */ jsx("rect", { width: "100", height: "100", fill: "#1a1a2e" })
254
+ }
255
+ );
256
+ }
257
+ const gradientA = `${id}-oilslick-a`;
258
+ const gradientB = `${id}-oilslick-b`;
259
+ const gradientC = `${id}-oilslick-c`;
260
+ return /* @__PURE__ */ jsxs(
261
+ "svg",
262
+ {
263
+ className: cn(
264
+ "size-full",
265
+ !active && "[filter:saturate(1.15)] group-hover:[filter:saturate(1.3)_brightness(1.08)]"
266
+ ),
267
+ width: "100%",
268
+ height: "100%",
269
+ viewBox: "0 0 100 100",
270
+ preserveAspectRatio: "none",
271
+ children: [
272
+ /* @__PURE__ */ jsxs("defs", { children: [
273
+ /* @__PURE__ */ jsxs("radialGradient", { id: gradientA, cx: "30%", cy: "30%", r: "70%", children: [
274
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#8b5cf6", children: /* @__PURE__ */ jsx(
275
+ "animate",
276
+ {
277
+ attributeName: "stop-color",
278
+ values: "#8b5cf6;#06b6d4;#8b5cf6",
279
+ dur: "8s",
280
+ repeatCount: "indefinite"
281
+ }
282
+ ) }),
283
+ /* @__PURE__ */ jsx("stop", { offset: "60%", stopColor: "#1e1b4b", stopOpacity: "0.9" }),
284
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#0f0f1a", stopOpacity: "0" })
285
+ ] }),
286
+ /* @__PURE__ */ jsxs("radialGradient", { id: gradientB, cx: "70%", cy: "60%", r: "60%", children: [
287
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#10b981", children: /* @__PURE__ */ jsx(
288
+ "animate",
289
+ {
290
+ attributeName: "stop-color",
291
+ values: "#10b981;#f59e0b;#ec4899;#10b981",
292
+ dur: "10s",
293
+ repeatCount: "indefinite"
294
+ }
295
+ ) }),
296
+ /* @__PURE__ */ jsx("stop", { offset: "55%", stopColor: "#1e1b4b", stopOpacity: "0.8" }),
297
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#0f0f1a", stopOpacity: "0" })
298
+ ] }),
299
+ /* @__PURE__ */ jsxs("radialGradient", { id: gradientC, cx: "50%", cy: "80%", r: "55%", children: [
300
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#ec4899", children: /* @__PURE__ */ jsx(
301
+ "animate",
302
+ {
303
+ attributeName: "stop-color",
304
+ values: "#ec4899;#8b5cf6;#06b6d4;#ec4899",
305
+ dur: "7s",
306
+ repeatCount: "indefinite"
307
+ }
308
+ ) }),
309
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#1e1b4b", stopOpacity: "0.7" }),
310
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#0f0f1a", stopOpacity: "0" })
311
+ ] })
312
+ ] }),
313
+ /* @__PURE__ */ jsx("rect", { width: "100", height: "100", fill: "#0a0a12" }),
314
+ /* @__PURE__ */ jsx(
315
+ "rect",
316
+ {
317
+ width: "100",
318
+ height: "100",
319
+ fill: `url(#${gradientA})`,
320
+ opacity: "0.85"
321
+ }
322
+ ),
323
+ /* @__PURE__ */ jsx(
324
+ "rect",
325
+ {
326
+ width: "100",
327
+ height: "100",
328
+ fill: `url(#${gradientB})`,
329
+ opacity: "0.75"
330
+ }
331
+ ),
332
+ /* @__PURE__ */ jsx(
333
+ "rect",
334
+ {
335
+ width: "100",
336
+ height: "100",
337
+ fill: `url(#${gradientC})`,
338
+ opacity: "0.70"
339
+ }
340
+ ),
341
+ /* @__PURE__ */ jsx(
342
+ "path",
343
+ {
344
+ d: "M -10 60 Q 25 45 50 60 T 110 55",
345
+ fill: "none",
346
+ stroke: "#ffffff",
347
+ strokeWidth: "0.8",
348
+ opacity: "0.12",
349
+ children: /* @__PURE__ */ jsx(
350
+ "animate",
351
+ {
352
+ attributeName: "d",
353
+ values: "M -10 60 Q 25 45 50 60 T 110 55;M -10 55 Q 30 70 55 50 T 110 65;M -10 60 Q 25 45 50 60 T 110 55",
354
+ dur: "12s",
355
+ repeatCount: "indefinite"
356
+ }
357
+ )
358
+ }
359
+ )
360
+ ]
361
+ }
362
+ );
363
+ }
364
+ var oilslickConfig = {
365
+ render: OilslickSurface,
366
+ default: {
367
+ style: {
368
+ color: "#ffffff",
369
+ boxShadow: "inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 10px rgba(139, 92, 246, 0.20)"
370
+ }
371
+ },
372
+ active: {
373
+ style: {
374
+ color: "#ffffff"
375
+ }
376
+ }
377
+ };
378
+ function RainbowSurface({
379
+ id,
380
+ active
381
+ }) {
382
+ const gradientId = `${id}-rainbow-gradient`;
383
+ return /* @__PURE__ */ jsxs(
384
+ "svg",
385
+ {
386
+ className: cn(
387
+ "size-full",
388
+ !active && "group-hover:[filter:brightness(1.08)]"
389
+ ),
390
+ width: "100%",
391
+ height: "100%",
392
+ viewBox: "0 0 100 100",
393
+ preserveAspectRatio: "none",
394
+ children: [
395
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
396
+ "linearGradient",
397
+ {
398
+ id: gradientId,
399
+ x1: "0%",
400
+ y1: "0%",
401
+ x2: "100%",
402
+ y2: "0%",
403
+ gradientTransform: "rotate(30, 0.5, 0.5)",
404
+ children: [
405
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#fbffca" }),
406
+ /* @__PURE__ */ jsx("stop", { offset: "33%", stopColor: "#baffbf" }),
407
+ /* @__PURE__ */ jsx("stop", { offset: "66%", stopColor: "#a7efff" }),
408
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#ffabff" })
409
+ ]
410
+ }
411
+ ) }),
412
+ /* @__PURE__ */ jsx(
413
+ "rect",
414
+ {
415
+ width: "100",
416
+ height: "100",
417
+ fill: active ? "#005458" : `url(#${gradientId})`
418
+ }
419
+ )
420
+ ]
421
+ }
422
+ );
423
+ }
424
+ var rainbowConfig = {
425
+ render: RainbowSurface,
426
+ default: {
427
+ className: "font-bold dark:[text-shadow:0_0_5px_rgba(0,0,0,0.5)]",
428
+ style: {
429
+ color: "#ffffff",
430
+ textShadow: "0 0 5px rgba(0, 0, 0, 0.2)",
431
+ boxShadow: "inset 0 0 0 1px rgba(0, 247, 255, 0.1)"
432
+ }
433
+ },
434
+ active: {
435
+ style: {
436
+ color: "#ffffff"
437
+ }
438
+ }
439
+ };
440
+ function SilverSurface({
441
+ id,
442
+ active
443
+ }) {
444
+ const gradientId = `${id}-silver-gradient`;
445
+ return /* @__PURE__ */ jsxs(
446
+ "svg",
447
+ {
448
+ className: cn(
449
+ "size-full",
450
+ !active && "[filter:brightness(1.1)] group-hover:[filter:brightness(1.16)]"
451
+ ),
452
+ width: "100%",
453
+ height: "100%",
454
+ viewBox: "0 0 100 100",
455
+ preserveAspectRatio: "none",
456
+ children: [
457
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
458
+ "linearGradient",
459
+ {
460
+ id: gradientId,
461
+ x1: "0%",
462
+ y1: "0%",
463
+ x2: "100%",
464
+ y2: "0%",
465
+ gradientTransform: "rotate(30, 0.5, 0.5)",
466
+ children: [
467
+ /* @__PURE__ */ jsx("stop", { offset: "10%", stopColor: "#afaeae" }),
468
+ /* @__PURE__ */ jsx("stop", { offset: "30%", stopColor: "#d6d6d6" }),
469
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#eeeeee" }),
470
+ /* @__PURE__ */ jsx("stop", { offset: "70%", stopColor: "#d6d6d6" }),
471
+ /* @__PURE__ */ jsx("stop", { offset: "90%", stopColor: "#afaeae" })
472
+ ]
473
+ }
474
+ ) }),
475
+ /* @__PURE__ */ jsx(
476
+ "rect",
477
+ {
478
+ width: "100",
479
+ height: "100",
480
+ fill: active ? "#5a5a5a" : `url(#${gradientId})`
481
+ }
482
+ ),
483
+ !active && /* @__PURE__ */ jsx(
484
+ "rect",
485
+ {
486
+ x: "0",
487
+ y: "0",
488
+ width: "100",
489
+ height: "8",
490
+ fill: "#ffffff",
491
+ opacity: "0.16"
492
+ }
493
+ )
494
+ ]
495
+ }
496
+ );
497
+ }
498
+ var silverConfig = {
499
+ render: SilverSurface,
500
+ default: {
501
+ style: {
502
+ color: "#2a2a2a",
503
+ boxShadow: "inset 0 0 0 1px rgba(0, 0, 0, 0.08)"
504
+ }
505
+ },
506
+ active: {
507
+ style: {
508
+ color: "#ffffff"
509
+ }
510
+ }
511
+ };
512
+ var SPECIAL_TAG_CONFIG = {
513
+ silver: silverConfig,
514
+ gold: goldConfig,
515
+ rainbow: rainbowConfig,
516
+ oilslick: oilslickConfig,
517
+ kintsugi: kintsugiConfig
518
+ };
519
+ function getSpecialTagStyleConfig(style) {
520
+ return SPECIAL_TAG_CONFIG[style];
521
+ }
522
+
523
+ // src/lib/colors.ts
524
+ var TAG_SPECIAL_STYLES = [
525
+ "silver",
526
+ "gold",
527
+ "rainbow",
528
+ "oilslick",
529
+ "kintsugi"
530
+ ];
531
+ function isSpecialTagStyle(color) {
532
+ return TAG_SPECIAL_STYLES.includes(color);
533
+ }
534
+ var WHITE_COLOR_PATTERN = /^(?:#fff(?:fff)?|white|rgba?\(\s*255\s*,\s*255\s*,\s*255\b)/i;
535
+ var BLACK_COLOR_PATTERN = /^(?:#000(?:000)?|black|rgba?\(\s*0\s*,\s*0\s*,\s*0\b)/i;
536
+ function isWhiteHex(color) {
537
+ if (color === "") return false;
538
+ return WHITE_COLOR_PATTERN.test(color.trim());
539
+ }
540
+ function isBlackHex(color) {
541
+ if (color === "") return false;
542
+ return BLACK_COLOR_PATTERN.test(color.trim());
543
+ }
544
+ function computeTagChipColors(color) {
545
+ if (color === "") {
546
+ return {
547
+ baseBg: "var(--color-muted)",
548
+ hoverBg: "var(--color-accent)",
549
+ fg: "var(--color-foreground)"
550
+ };
551
+ }
552
+ if (isWhiteHex(color)) {
553
+ return {
554
+ baseBg: "#ffffff",
555
+ hoverBg: "#f1f5f9",
556
+ fg: "#0a0a0a"
557
+ };
558
+ }
559
+ if (isBlackHex(color)) {
560
+ return {
561
+ baseBg: "#0a0a0a",
562
+ hoverBg: "#262626",
563
+ fg: "#ffffff"
564
+ };
565
+ }
566
+ return {
567
+ baseBg: `color-mix(in srgb, ${color} 6%, var(--color-card))`,
568
+ hoverBg: `color-mix(in srgb, ${color} 20%, var(--color-card))`,
569
+ fg: color
570
+ };
571
+ }
572
+
573
+ // src/lib/tag-surface.ts
574
+ function resolveTagChipSurface(color, active) {
575
+ if (isSpecialTagStyle(color)) {
576
+ const config = getSpecialTagStyleConfig(color);
577
+ return {
578
+ className: cn(
579
+ "relative isolate group",
580
+ config.default.className,
581
+ active ? config.active?.className : void 0
582
+ ),
583
+ style: {
584
+ ...config.default.style,
585
+ ...active ? config.active?.style : {}
586
+ },
587
+ texture: color
588
+ };
589
+ }
590
+ if (color === "") {
591
+ return active ? {
592
+ className: "bg-primary text-primary-foreground hover:bg-primary/90",
593
+ style: void 0,
594
+ texture: null
595
+ } : {
596
+ className: "bg-muted text-foreground hover:bg-accent",
597
+ style: void 0,
598
+ texture: null
599
+ };
600
+ }
601
+ const chipColors = computeTagChipColors(color);
602
+ return {
603
+ className: "bg-(--chip-bg) hover:bg-(--chip-hover-bg)",
604
+ style: {
605
+ ["--chip-bg"]: active ? chipColors.hoverBg : chipColors.baseBg,
606
+ ["--chip-hover-bg"]: chipColors.hoverBg,
607
+ color: chipColors.fg
608
+ },
609
+ texture: null
610
+ };
611
+ }
612
+
613
+ export { resolveTagChipSurface };
614
+ //# sourceMappingURL=tag-surface.js.map
615
+ //# sourceMappingURL=tag-surface.js.map