@still-void/ui 1.1.0 → 2.0.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.
@@ -190,7 +190,7 @@ import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } fro
190
190
 
191
191
  // src/behaviors/clipboard.ts
192
192
  async function copyToClipboard(text) {
193
- if (!navigator.clipboard?.writeText) return false;
193
+ if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) return false;
194
194
  try {
195
195
  await navigator.clipboard.writeText(text);
196
196
  return true;
@@ -269,8 +269,14 @@ import { useMemo as useMemo2 } from "react";
269
269
  import { useEffect as useEffect3, useState as useState3 } from "react";
270
270
 
271
271
  // src/behaviors/readingProgress.ts
272
- var raf = typeof window !== "undefined" && typeof window.requestAnimationFrame === "function" ? (cb) => window.requestAnimationFrame(cb) : (cb) => setTimeout(cb, 16);
273
- var cancelRaf = typeof window !== "undefined" && typeof window.cancelAnimationFrame === "function" ? (id) => window.cancelAnimationFrame(id) : (id) => clearTimeout(id);
272
+ var raf = typeof window !== "undefined" && typeof window.requestAnimationFrame === "function" ? (cb) => window.requestAnimationFrame(cb) : (
273
+ /* v8 ignore next */
274
+ (cb) => setTimeout(cb, 16)
275
+ );
276
+ var cancelRaf = typeof window !== "undefined" && typeof window.cancelAnimationFrame === "function" ? (id) => window.cancelAnimationFrame(id) : (
277
+ /* v8 ignore next */
278
+ (id) => clearTimeout(id)
279
+ );
274
280
  function createReadingProgress(options = {}) {
275
281
  const varTarget = options.varTarget === null ? null : options.varTarget ?? document.documentElement;
276
282
  let percent = 0;
@@ -398,12 +404,437 @@ function ReadingProgress({ target, announce, className, ...rest }) {
398
404
  } : { "aria-hidden": true };
399
405
  return /* @__PURE__ */ jsx5("div", { className: cx(readingProgress(), className), ...a11yProps, ...rest, children: /* @__PURE__ */ jsx5("div", { className: readingProgressClasses.bar }) });
400
406
  }
407
+
408
+ // src/components/ui/dialog.tsx
409
+ import * as React from "react";
410
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
411
+
412
+ // src/lib/utils.ts
413
+ import { clsx } from "clsx";
414
+ import { twMerge } from "tailwind-merge";
415
+ function cn(...inputs) {
416
+ return twMerge(clsx(inputs));
417
+ }
418
+
419
+ // src/components/ui/dialog.tsx
420
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
421
+ var Dialog = DialogPrimitive.Root;
422
+ var DialogTrigger = DialogPrimitive.Trigger;
423
+ var DialogPortal = DialogPrimitive.Portal;
424
+ var DialogClose = DialogPrimitive.Close;
425
+ var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
426
+ DialogPrimitive.Overlay,
427
+ {
428
+ ref,
429
+ className: cn(
430
+ "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
431
+ className
432
+ ),
433
+ ...props
434
+ }
435
+ ));
436
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
437
+ var DialogContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
438
+ /* @__PURE__ */ jsx6(DialogOverlay, {}),
439
+ /* @__PURE__ */ jsx6(
440
+ DialogPrimitive.Content,
441
+ {
442
+ ref,
443
+ className: cn(
444
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-sv-border bg-sv-surface p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
445
+ className
446
+ ),
447
+ ...props
448
+ }
449
+ )
450
+ ] }));
451
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
452
+ var DialogHeader = ({
453
+ className,
454
+ ...props
455
+ }) => /* @__PURE__ */ jsx6(
456
+ "div",
457
+ {
458
+ className: cn(
459
+ "flex flex-col space-y-1.5 text-center sm:text-left",
460
+ className
461
+ ),
462
+ ...props
463
+ }
464
+ );
465
+ DialogHeader.displayName = "DialogHeader";
466
+ var DialogFooter = ({
467
+ className,
468
+ ...props
469
+ }) => /* @__PURE__ */ jsx6(
470
+ "div",
471
+ {
472
+ className: cn(
473
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
474
+ className
475
+ ),
476
+ ...props
477
+ }
478
+ );
479
+ DialogFooter.displayName = "DialogFooter";
480
+ var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
481
+ DialogPrimitive.Title,
482
+ {
483
+ ref,
484
+ className: cn(
485
+ "text-lg font-semibold leading-none tracking-tight",
486
+ className
487
+ ),
488
+ ...props
489
+ }
490
+ ));
491
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
492
+ var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
493
+ DialogPrimitive.Description,
494
+ {
495
+ ref,
496
+ className: cn("text-sm text-sv-text-2", className),
497
+ ...props
498
+ }
499
+ ));
500
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
501
+
502
+ // src/components/ui/select.tsx
503
+ import * as React2 from "react";
504
+ import * as SelectPrimitive from "@radix-ui/react-select";
505
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
506
+ var Select = SelectPrimitive.Root;
507
+ var SelectGroup = SelectPrimitive.Group;
508
+ var SelectValue = SelectPrimitive.Value;
509
+ var SelectTrigger = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
510
+ SelectPrimitive.Trigger,
511
+ {
512
+ ref,
513
+ className: cn(
514
+ "flex h-10 w-full items-center justify-between rounded-md border border-sv-border bg-sv-surface px-3 py-2 text-sm ring-offset-background placeholder:text-sv-text-2 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
515
+ className
516
+ ),
517
+ ...props
518
+ }
519
+ ));
520
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
521
+ var SelectScrollUpButton = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
522
+ SelectPrimitive.ScrollUpButton,
523
+ {
524
+ ref,
525
+ className: cn(
526
+ "flex cursor-pointer items-center justify-center py-1",
527
+ className
528
+ ),
529
+ ...props
530
+ }
531
+ ));
532
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
533
+ var SelectScrollDownButton = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
534
+ SelectPrimitive.ScrollDownButton,
535
+ {
536
+ ref,
537
+ className: cn(
538
+ "flex cursor-pointer items-center justify-center py-1",
539
+ className
540
+ ),
541
+ ...props
542
+ }
543
+ ));
544
+ SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
545
+ var SelectContent = React2.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx7(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
546
+ SelectPrimitive.Content,
547
+ {
548
+ ref,
549
+ className: cn(
550
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-sv-border bg-sv-surface text-sv-text shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
551
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
552
+ className
553
+ ),
554
+ position,
555
+ ...props,
556
+ children: [
557
+ /* @__PURE__ */ jsx7(SelectScrollUpButton, {}),
558
+ /* @__PURE__ */ jsx7(
559
+ SelectPrimitive.Viewport,
560
+ {
561
+ className: cn(
562
+ "p-1",
563
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
564
+ ),
565
+ children
566
+ }
567
+ ),
568
+ /* @__PURE__ */ jsx7(SelectScrollDownButton, {})
569
+ ]
570
+ }
571
+ ) }));
572
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
573
+ var SelectItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
574
+ SelectPrimitive.Item,
575
+ {
576
+ ref,
577
+ className: cn(
578
+ "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-sv-surface-2 focus:text-sv-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
579
+ className
580
+ ),
581
+ ...props
582
+ }
583
+ ));
584
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
585
+ var SelectLabel = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
586
+ SelectPrimitive.Label,
587
+ {
588
+ ref,
589
+ className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
590
+ ...props
591
+ }
592
+ ));
593
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
594
+ var SelectSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
595
+ SelectPrimitive.Separator,
596
+ {
597
+ ref,
598
+ className: cn("-mx-1 my-1 h-px bg-sv-border", className),
599
+ ...props
600
+ }
601
+ ));
602
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
603
+
604
+ // src/components/ui/dropdown-menu.tsx
605
+ import * as React3 from "react";
606
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
607
+ import { jsx as jsx8 } from "react/jsx-runtime";
608
+ var DropdownMenu = DropdownMenuPrimitive.Root;
609
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
610
+ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
611
+ var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
612
+ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
613
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
614
+ var DropdownMenuSubTrigger = React3.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx8(
615
+ DropdownMenuPrimitive.SubTrigger,
616
+ {
617
+ ref,
618
+ className: cn(
619
+ "flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm font-medium outline-none focus:bg-sv-surface data-[state=open]:bg-sv-surface-2",
620
+ inset && "pl-8",
621
+ className
622
+ ),
623
+ ...props
624
+ }
625
+ ));
626
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
627
+ var DropdownMenuSubContent = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
628
+ DropdownMenuPrimitive.SubContent,
629
+ {
630
+ ref,
631
+ className: cn(
632
+ "min-w-[8rem] overflow-hidden rounded-md border border-sv-border bg-sv-surface p-1 text-sv-text",
633
+ className
634
+ ),
635
+ ...props
636
+ }
637
+ ));
638
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
639
+ var DropdownMenuContent = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx8(
640
+ DropdownMenuPrimitive.Content,
641
+ {
642
+ ref,
643
+ className: cn(
644
+ "min-w-[8rem] overflow-hidden rounded-md border border-sv-border bg-sv-surface p-1 text-sv-text",
645
+ className
646
+ ),
647
+ ...props
648
+ }
649
+ ) }));
650
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
651
+ var DropdownMenuItem = React3.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx8(
652
+ DropdownMenuPrimitive.Item,
653
+ {
654
+ ref,
655
+ className: cn(
656
+ "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-sv-surface-2 focus:text-sv-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
657
+ inset && "pl-8",
658
+ className
659
+ ),
660
+ ...props
661
+ }
662
+ ));
663
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
664
+ var DropdownMenuCheckboxItem = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
665
+ DropdownMenuPrimitive.CheckboxItem,
666
+ {
667
+ ref,
668
+ className: cn(
669
+ "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-sv-surface-2 focus:text-sv-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
670
+ className
671
+ ),
672
+ ...props
673
+ }
674
+ ));
675
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
676
+ var DropdownMenuRadioItem = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
677
+ DropdownMenuPrimitive.RadioItem,
678
+ {
679
+ ref,
680
+ className: cn(
681
+ "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-sv-surface-2 focus:text-sv-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
682
+ className
683
+ ),
684
+ ...props
685
+ }
686
+ ));
687
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
688
+ var DropdownMenuLabel = React3.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx8(
689
+ DropdownMenuPrimitive.Label,
690
+ {
691
+ ref,
692
+ className: cn(
693
+ "px-2 py-1.5 text-sm font-semibold",
694
+ inset && "pl-8",
695
+ className
696
+ ),
697
+ ...props
698
+ }
699
+ ));
700
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
701
+ var DropdownMenuSeparator = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
702
+ DropdownMenuPrimitive.Separator,
703
+ {
704
+ ref,
705
+ className: cn("-mx-1 my-1 h-px bg-sv-border", className),
706
+ ...props
707
+ }
708
+ ));
709
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
710
+ var DropdownMenuShortcut = ({
711
+ className,
712
+ ...props
713
+ }) => /* @__PURE__ */ jsx8(
714
+ "span",
715
+ {
716
+ className: cn("ml-auto text-xs tracking-widest opacity-60", className),
717
+ ...props
718
+ }
719
+ );
720
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
721
+
722
+ // src/components/ui/tabs.tsx
723
+ import * as React4 from "react";
724
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
725
+ import { jsx as jsx9 } from "react/jsx-runtime";
726
+ var Tabs = TabsPrimitive.Root;
727
+ var TabsList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
728
+ TabsPrimitive.List,
729
+ {
730
+ ref,
731
+ className: cn(
732
+ "inline-flex h-10 items-center justify-center rounded-md bg-sv-surface-2 p-1 text-sv-text-2",
733
+ className
734
+ ),
735
+ ...props
736
+ }
737
+ ));
738
+ TabsList.displayName = TabsPrimitive.List.displayName;
739
+ var TabsTrigger = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
740
+ TabsPrimitive.Trigger,
741
+ {
742
+ ref,
743
+ className: cn(
744
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-sv-surface data-[state=active]:text-sv-text data-[state=active]:shadow-sm",
745
+ className
746
+ ),
747
+ ...props
748
+ }
749
+ ));
750
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
751
+ var TabsContent = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
752
+ TabsPrimitive.Content,
753
+ {
754
+ ref,
755
+ className: cn(
756
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
757
+ className
758
+ ),
759
+ ...props
760
+ }
761
+ ));
762
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
763
+
764
+ // src/components/ui/tooltip.tsx
765
+ import * as React5 from "react";
766
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
767
+ import { jsx as jsx10 } from "react/jsx-runtime";
768
+ var TooltipProvider = TooltipPrimitive.Provider;
769
+ var Tooltip = TooltipPrimitive.Root;
770
+ var TooltipTrigger = TooltipPrimitive.Trigger;
771
+ var TooltipContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx10(
772
+ TooltipPrimitive.Content,
773
+ {
774
+ ref,
775
+ sideOffset,
776
+ className: cn(
777
+ "z-50 overflow-hidden rounded-md border border-sv-border bg-sv-surface px-3 py-1.5 text-sm text-sv-text animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
778
+ className
779
+ ),
780
+ ...props
781
+ }
782
+ ));
783
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
401
784
  export {
402
785
  CopyButton,
786
+ DEFAULT_STORAGE_KEY,
787
+ Dialog,
788
+ DialogClose,
789
+ DialogContent,
790
+ DialogDescription,
791
+ DialogFooter,
792
+ DialogHeader,
793
+ DialogOverlay,
794
+ DialogPortal,
795
+ DialogTitle,
796
+ DialogTrigger,
797
+ DropdownMenu,
798
+ DropdownMenuCheckboxItem,
799
+ DropdownMenuContent,
800
+ DropdownMenuGroup,
801
+ DropdownMenuItem,
802
+ DropdownMenuLabel,
803
+ DropdownMenuPortal,
804
+ DropdownMenuRadioGroup,
805
+ DropdownMenuRadioItem,
806
+ DropdownMenuSeparator,
807
+ DropdownMenuShortcut,
808
+ DropdownMenuSub,
809
+ DropdownMenuSubContent,
810
+ DropdownMenuSubTrigger,
811
+ DropdownMenuTrigger,
403
812
  ReadingProgress,
813
+ Select,
814
+ SelectContent,
815
+ SelectGroup,
816
+ SelectItem,
817
+ SelectLabel,
818
+ SelectScrollDownButton,
819
+ SelectScrollUpButton,
820
+ SelectSeparator,
821
+ SelectTrigger,
822
+ SelectValue,
404
823
  TableOfContents,
824
+ Tabs,
825
+ TabsContent,
826
+ TabsList,
827
+ TabsTrigger,
405
828
  ThemeProvider,
406
829
  ThemeToggle,
830
+ Tooltip,
831
+ TooltipContent,
832
+ TooltipProvider,
833
+ TooltipTrigger,
834
+ copyToClipboard,
835
+ createReadingProgress,
836
+ createScrollSpy,
837
+ createThemeManager,
407
838
  useReadingProgress,
408
839
  useScrollSpy,
409
840
  useTheme