@duskmoon-dev/core 1.4.0 → 1.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.
@@ -36,6 +36,72 @@ export const css = `/**
36
36
  transform: scale(1);
37
37
  }
38
38
 
39
+ /* Direct popover structure (without .popover-content wrapper) */
40
+ .popover.popover-show,
41
+ .popover.show {
42
+ opacity: 1;
43
+ visibility: visible;
44
+ }
45
+
46
+ /* Popover as direct overlay (simpler structure) */
47
+ .popover[class*="popover-top"],
48
+ .popover[class*="popover-bottom"],
49
+ .popover[class*="popover-left"],
50
+ .popover[class*="popover-right"] {
51
+ position: absolute;
52
+ z-index: 1050;
53
+ min-width: 12rem;
54
+ max-width: 20rem;
55
+ padding: 1rem;
56
+ background-color: var(--color-surface);
57
+ border: 1px solid var(--color-outline-variant);
58
+ border-radius: 0.75rem;
59
+ box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
60
+ opacity: 0;
61
+ visibility: hidden;
62
+ transition: opacity 150ms ease-out, visibility 150ms ease-out;
63
+ }
64
+
65
+ .popover[class*="popover-top"].popover-show,
66
+ .popover[class*="popover-bottom"].popover-show,
67
+ .popover[class*="popover-left"].popover-show,
68
+ .popover[class*="popover-right"].popover-show {
69
+ opacity: 1;
70
+ visibility: visible;
71
+ }
72
+
73
+ /* Direct position: Top */
74
+ .popover.popover-top:not(:has(.popover-content)) {
75
+ bottom: 100%;
76
+ left: 50%;
77
+ transform: translateX(-50%);
78
+ margin-bottom: 0.75rem;
79
+ }
80
+
81
+ /* Direct position: Bottom */
82
+ .popover.popover-bottom:not(:has(.popover-content)) {
83
+ top: 100%;
84
+ left: 50%;
85
+ transform: translateX(-50%);
86
+ margin-top: 0.75rem;
87
+ }
88
+
89
+ /* Direct position: Left */
90
+ .popover.popover-left:not(:has(.popover-content)) {
91
+ right: 100%;
92
+ top: 50%;
93
+ transform: translateY(-50%);
94
+ margin-right: 0.75rem;
95
+ }
96
+
97
+ /* Direct position: Right */
98
+ .popover.popover-right:not(:has(.popover-content)) {
99
+ left: 100%;
100
+ top: 50%;
101
+ transform: translateY(-50%);
102
+ margin-left: 0.75rem;
103
+ }
104
+
39
105
  /* Popover Arrow */
40
106
  .popover-arrow {
41
107
  position: absolute;
@@ -212,12 +278,33 @@ export const css = `/**
212
278
  }
213
279
 
214
280
  /* Color Variants */
281
+ /*
282
+ * Color intensity for themed popovers.
283
+ * Override this variable to adjust how strongly colors appear:
284
+ * - 20% = subtle tint
285
+ * - 30% = moderate (default)
286
+ * - 40% = bold/prominent
287
+ */
288
+ .popover {
289
+ --popover-color-intensity: 30%;
290
+ }
291
+
292
+ /* Dark variant */
215
293
  .popover-dark .popover-content {
216
294
  background-color: var(--color-on-surface);
217
295
  color: var(--color-surface);
218
296
  border-color: transparent;
219
297
  }
220
298
 
299
+ .popover-dark[class*="popover-top"],
300
+ .popover-dark[class*="popover-bottom"],
301
+ .popover-dark[class*="popover-left"],
302
+ .popover-dark[class*="popover-right"] {
303
+ background-color: var(--color-on-surface);
304
+ color: var(--color-surface);
305
+ border-color: transparent;
306
+ }
307
+
221
308
  .popover-dark .popover-arrow {
222
309
  background-color: var(--color-on-surface);
223
310
  border-color: transparent;
@@ -232,16 +319,106 @@ export const css = `/**
232
319
  opacity: 0.9;
233
320
  }
234
321
 
322
+ /* Primary variant */
235
323
  .popover-primary .popover-content {
236
- background-color: var(--color-primary-container);
324
+ background-color: color-mix(in oklch, var(--color-primary) var(--popover-color-intensity), var(--color-surface));
325
+ border-color: var(--color-primary);
326
+ }
327
+
328
+ .popover-primary[class*="popover-top"],
329
+ .popover-primary[class*="popover-bottom"],
330
+ .popover-primary[class*="popover-left"],
331
+ .popover-primary[class*="popover-right"] {
332
+ background-color: color-mix(in oklch, var(--color-primary) var(--popover-color-intensity), var(--color-surface));
237
333
  border-color: var(--color-primary);
238
334
  }
239
335
 
240
336
  .popover-primary .popover-arrow {
241
- background-color: var(--color-primary-container);
337
+ background-color: color-mix(in oklch, var(--color-primary) var(--popover-color-intensity), var(--color-surface));
242
338
  border-color: var(--color-primary);
243
339
  }
244
340
 
341
+ .popover-primary .popover-body {
342
+ color: var(--color-on-surface);
343
+ }
344
+
345
+ .popover-primary .popover-title {
346
+ color: var(--color-on-surface);
347
+ }
348
+
349
+ /* Secondary variant */
350
+ .popover-secondary .popover-content {
351
+ background-color: color-mix(in oklch, var(--color-secondary) var(--popover-color-intensity), var(--color-surface));
352
+ border-color: var(--color-secondary);
353
+ }
354
+
355
+ .popover-secondary[class*="popover-top"],
356
+ .popover-secondary[class*="popover-bottom"],
357
+ .popover-secondary[class*="popover-left"],
358
+ .popover-secondary[class*="popover-right"] {
359
+ background-color: color-mix(in oklch, var(--color-secondary) var(--popover-color-intensity), var(--color-surface));
360
+ border-color: var(--color-secondary);
361
+ }
362
+
363
+ .popover-secondary .popover-arrow {
364
+ background-color: color-mix(in oklch, var(--color-secondary) var(--popover-color-intensity), var(--color-surface));
365
+ border-color: var(--color-secondary);
366
+ }
367
+
368
+ .popover-secondary .popover-body {
369
+ color: var(--color-on-surface);
370
+ }
371
+
372
+ .popover-secondary .popover-title {
373
+ color: var(--color-on-surface);
374
+ }
375
+
376
+ /* Tertiary variant */
377
+ .popover-tertiary .popover-content {
378
+ background-color: color-mix(in oklch, var(--color-tertiary) var(--popover-color-intensity), var(--color-surface));
379
+ border-color: var(--color-tertiary);
380
+ }
381
+
382
+ .popover-tertiary[class*="popover-top"],
383
+ .popover-tertiary[class*="popover-bottom"],
384
+ .popover-tertiary[class*="popover-left"],
385
+ .popover-tertiary[class*="popover-right"] {
386
+ background-color: color-mix(in oklch, var(--color-tertiary) var(--popover-color-intensity), var(--color-surface));
387
+ border-color: var(--color-tertiary);
388
+ }
389
+
390
+ .popover-tertiary .popover-arrow {
391
+ background-color: color-mix(in oklch, var(--color-tertiary) var(--popover-color-intensity), var(--color-surface));
392
+ border-color: var(--color-tertiary);
393
+ }
394
+
395
+ .popover-tertiary .popover-body {
396
+ color: var(--color-on-surface);
397
+ }
398
+
399
+ .popover-tertiary .popover-title {
400
+ color: var(--color-on-surface);
401
+ }
402
+
403
+ /* Surface highest variant */
404
+ .popover-surface-highest .popover-content {
405
+ background-color: var(--color-surface-container-highest);
406
+ border-color: var(--color-outline-variant);
407
+ }
408
+
409
+ .popover-surface-highest[class*="popover-top"],
410
+ .popover-surface-highest[class*="popover-bottom"],
411
+ .popover-surface-highest[class*="popover-left"],
412
+ .popover-surface-highest[class*="popover-right"] {
413
+ background-color: var(--color-surface-container-highest);
414
+ border-color: var(--color-outline-variant);
415
+ }
416
+
417
+ .popover-surface-highest .popover-arrow {
418
+ background-color: var(--color-surface-container-highest);
419
+ border-color: var(--color-outline-variant);
420
+ }
421
+
245
422
  /* Hover Trigger */
246
423
  .popover-hover:hover .popover-content,
247
424
  .popover-hover:focus-within .popover-content {
@@ -316,11 +493,221 @@ export const css = `/**
316
493
  justify-content: center;
317
494
  }
318
495
 
496
+ /* ========================================
497
+ * HTML Popover API Support
498
+ * Uses native [popover] attribute with :popover-open pseudo-class
499
+ * ======================================== */
500
+
501
+ /* Native popover base styles */
502
+ .popover[popover] {
503
+ position: fixed;
504
+ inset: unset;
505
+ z-index: 1050;
506
+ min-width: 12rem;
507
+ max-width: 20rem;
508
+ padding: 1rem;
509
+ margin: 0;
510
+ background-color: var(--color-surface);
511
+ border: 1px solid var(--color-outline-variant);
512
+ border-radius: 0.75rem;
513
+ box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
514
+ opacity: 0;
515
+ transform: scale(0.95);
516
+ transition: opacity 150ms ease-out, transform 150ms ease-out, overlay 150ms ease-out allow-discrete, display 150ms ease-out allow-discrete;
517
+ }
518
+
519
+ /* Popover open state */
520
+ .popover[popover]:popover-open {
521
+ opacity: 1;
522
+ transform: scale(1);
523
+ }
524
+
525
+ /* Starting state for entry animation */
526
+ @starting-style {
527
+ .popover[popover]:popover-open {
528
+ opacity: 0;
529
+ transform: scale(0.95);
530
+ }
531
+ }
532
+
533
+ /* Native popover backdrop */
534
+ .popover[popover]::backdrop {
535
+ background-color: rgb(0 0 0 / 0);
536
+ transition: background-color 150ms ease-out, overlay 150ms ease-out allow-discrete, display 150ms ease-out allow-discrete;
537
+ }
538
+
539
+ .popover[popover]:popover-open::backdrop {
540
+ background-color: rgb(0 0 0 / 0.1);
541
+ }
542
+
543
+ @starting-style {
544
+ .popover[popover]:popover-open::backdrop {
545
+ background-color: rgb(0 0 0 / 0);
546
+ }
547
+ }
548
+
549
+ /* Native popover with modal backdrop */
550
+ .popover-modal[popover]::backdrop {
551
+ background-color: rgb(0 0 0 / 0);
552
+ transition: background-color 150ms ease-out, overlay 150ms ease-out allow-discrete, display 150ms ease-out allow-discrete;
553
+ }
554
+
555
+ .popover-modal[popover]:popover-open::backdrop {
556
+ background-color: rgb(0 0 0 / 0.3);
557
+ }
558
+
559
+ @starting-style {
560
+ .popover-modal[popover]:popover-open::backdrop {
561
+ background-color: rgb(0 0 0 / 0);
562
+ }
563
+ }
564
+
565
+ /* Native popover color variants */
566
+ .popover-primary[popover] {
567
+ background-color: color-mix(in oklch, var(--color-primary) var(--popover-color-intensity), var(--color-surface));
568
+ border-color: var(--color-primary);
569
+ }
570
+
571
+ .popover-primary[popover] .popover-body {
572
+ color: var(--color-on-surface);
573
+ }
574
+
575
+ .popover-primary[popover] .popover-title {
576
+ color: var(--color-on-surface);
577
+ }
578
+
579
+ .popover-secondary[popover] {
580
+ background-color: color-mix(in oklch, var(--color-secondary) var(--popover-color-intensity), var(--color-surface));
581
+ border-color: var(--color-secondary);
582
+ }
583
+
584
+ .popover-secondary[popover] .popover-body {
585
+ color: var(--color-on-surface);
586
+ }
587
+
588
+ .popover-secondary[popover] .popover-title {
589
+ color: var(--color-on-surface);
590
+ }
591
+
592
+ .popover-tertiary[popover] {
593
+ background-color: color-mix(in oklch, var(--color-tertiary) var(--popover-color-intensity), var(--color-surface));
594
+ border-color: var(--color-tertiary);
595
+ }
596
+
597
+ .popover-tertiary[popover] .popover-body {
598
+ color: var(--color-on-surface);
599
+ }
600
+
601
+ .popover-tertiary[popover] .popover-title {
602
+ color: var(--color-on-surface);
603
+ }
604
+
605
+ .popover-dark[popover] {
606
+ background-color: var(--color-on-surface);
607
+ border-color: transparent;
608
+ }
609
+
610
+ .popover-dark[popover] .popover-body {
611
+ color: var(--color-surface);
612
+ opacity: 0.9;
613
+ }
614
+
615
+ .popover-dark[popover] .popover-title {
616
+ color: var(--color-surface);
617
+ }
618
+
619
+ .popover-surface-highest[popover] {
620
+ background-color: var(--color-surface-container-highest);
621
+ border-color: var(--color-outline-variant);
622
+ }
623
+
624
+ /* Native popover size variants */
625
+ .popover-sm[popover] {
626
+ min-width: 8rem;
627
+ max-width: 14rem;
628
+ padding: 0.75rem;
629
+ }
630
+
631
+ .popover-lg[popover] {
632
+ min-width: 16rem;
633
+ max-width: 28rem;
634
+ padding: 1.25rem;
635
+ }
636
+
637
+ .popover-full[popover] {
638
+ min-width: 0;
639
+ max-width: none;
640
+ width: max-content;
641
+ }
642
+
643
+ /* ========================================
644
+ * CSS Anchor Positioning
645
+ * Enables popovers to track their trigger element on scroll
646
+ * Usage: Add anchor-name CSS property to trigger, position-anchor to popover
647
+ * ======================================== */
648
+
649
+ /* Popover trigger anchor - use inline style or custom class to set anchor-name */
650
+ [popovertarget] {
651
+ /* Each trigger needs unique anchor-name, set via inline style:
652
+ style="anchor-name: --my-popover" */
653
+ }
654
+
655
+ /* Anchored popover positioning */
656
+ .popover[popover][style*="position-anchor"] {
657
+ position: absolute;
658
+ position-area: bottom;
659
+ margin-top: 0.5rem;
660
+ }
661
+
662
+ /* Position variants for anchored popovers */
663
+ .popover-top[popover][style*="position-anchor"] {
664
+ position-area: top;
665
+ margin-top: 0;
666
+ margin-bottom: 0.5rem;
667
+ }
668
+
669
+ .popover-bottom[popover][style*="position-anchor"] {
670
+ position-area: bottom;
671
+ margin-top: 0.5rem;
672
+ margin-bottom: 0;
673
+ }
674
+
675
+ .popover-left[popover][style*="position-anchor"] {
676
+ position-area: left;
677
+ margin-top: 0;
678
+ margin-right: 0.5rem;
679
+ }
680
+
681
+ .popover-right[popover][style*="position-anchor"] {
682
+ position-area: right;
683
+ margin-top: 0;
684
+ margin-left: 0.5rem;
685
+ }
686
+
687
+ /* Anchored popover alignment variants */
688
+ .popover-start[popover][style*="position-anchor"] {
689
+ position-area: bottom start;
690
+ }
691
+
692
+ .popover-end[popover][style*="position-anchor"] {
693
+ position-area: bottom end;
694
+ }
695
+
696
+ .popover-top.popover-start[popover][style*="position-anchor"] {
697
+ position-area: top start;
698
+ }
699
+
700
+ .popover-top.popover-end[popover][style*="position-anchor"] {
701
+ position-area: top end;
702
+ }
703
+
319
704
  /* Reduce Motion */
320
705
  @media (prefers-reduced-motion: reduce) {
321
706
  .popover-content,
322
707
  .popover-close,
323
- .popover-menu-item {
708
+ .popover-menu-item,
709
+ .popover[popover],
710
+ .popover[popover]::backdrop {
324
711
  transition: none;
325
712
  }
326
713
  }