@mkbabb/glass-ui 0.2.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.
- package/README.md +172 -0
- package/dist/glass-ui.css +1 -0
- package/dist/glass-ui.js +10019 -0
- package/dist/index.d.ts +6619 -0
- package/package.json +65 -0
- package/src/components/custom/aurora/Aurora.vue +34 -0
- package/src/components/custom/aurora/composables/color.ts +122 -0
- package/src/components/custom/aurora/composables/useAurora.ts +355 -0
- package/src/components/custom/aurora/index.ts +8 -0
- package/src/components/custom/confirm-dialog/ConfirmDialog.vue +88 -0
- package/src/components/custom/confirm-dialog/index.ts +1 -0
- package/src/components/custom/controls/DarkModeToggle.vue +96 -0
- package/src/components/custom/controls/index.ts +1 -0
- package/src/components/custom/dock/DockLayerGroup.vue +21 -0
- package/src/components/custom/dock/DockPopover.vue +263 -0
- package/src/components/custom/dock/GlassDock.vue +276 -0
- package/src/components/custom/dock/composables/index.ts +16 -0
- package/src/components/custom/dock/composables/isTeleportedTarget.ts +19 -0
- package/src/components/custom/dock/composables/useDockActionBar.ts +33 -0
- package/src/components/custom/dock/composables/useDockState.ts +301 -0
- package/src/components/custom/dock/composables/useDockTransition.ts +146 -0
- package/src/components/custom/dock/composables/useLayerTransition.ts +135 -0
- package/src/components/custom/dock/composables/usePopupMutex.ts +83 -0
- package/src/components/custom/dock/index.ts +9 -0
- package/src/components/custom/expandable-container/ExpandableContainer.vue +64 -0
- package/src/components/custom/expandable-container/index.ts +1 -0
- package/src/components/custom/glass-panel/GlassPanel.vue +98 -0
- package/src/components/custom/glass-panel/index.ts +2 -0
- package/src/components/custom/icon-tooltip/IconTooltip.vue +20 -0
- package/src/components/custom/icon-tooltip/index.ts +1 -0
- package/src/components/custom/index.ts +15 -0
- package/src/components/custom/infinite-scroll/InfiniteScroll.vue +55 -0
- package/src/components/custom/infinite-scroll/composables/index.ts +2 -0
- package/src/components/custom/infinite-scroll/composables/types.ts +23 -0
- package/src/components/custom/infinite-scroll/composables/useInfiniteScroll.ts +73 -0
- package/src/components/custom/infinite-scroll/index.ts +1 -0
- package/src/components/custom/labeled-field/LabeledInput.vue +29 -0
- package/src/components/custom/labeled-field/LabeledSelect.vue +59 -0
- package/src/components/custom/labeled-field/LabeledSlider.vue +32 -0
- package/src/components/custom/labeled-field/LabeledSwitch.vue +27 -0
- package/src/components/custom/labeled-field/index.ts +4 -0
- package/src/components/custom/metaballs/MetaballCanvas.vue +23 -0
- package/src/components/custom/metaballs/index.ts +4 -0
- package/src/components/custom/metaballs/shaders.ts +63 -0
- package/src/components/custom/metaballs/types.ts +29 -0
- package/src/components/custom/metaballs/useMetaballs.ts +252 -0
- package/src/components/custom/search/FuzzySearch.vue +589 -0
- package/src/components/custom/search/SearchBar.vue +44 -0
- package/src/components/custom/search/composables/fuzzySearchIndex.ts +224 -0
- package/src/components/custom/search/composables/index.ts +5 -0
- package/src/components/custom/search/composables/types.ts +34 -0
- package/src/components/custom/search/composables/useFuzzySearch.ts +115 -0
- package/src/components/custom/search/index.ts +7 -0
- package/src/components/custom/sidebar/ProgressiveSidebar.vue +256 -0
- package/src/components/custom/sidebar/composables/index.ts +6 -0
- package/src/components/custom/sidebar/composables/useScrollTracker.ts +242 -0
- package/src/components/custom/sidebar/composables/useSidebarFollow.ts +247 -0
- package/src/components/custom/sidebar/composables/useSidebarState.ts +72 -0
- package/src/components/custom/sidebar/composables/useTreeIndex.ts +152 -0
- package/src/components/custom/sidebar/index.ts +15 -0
- package/src/components/custom/sidebar/types.ts +50 -0
- package/src/components/custom/tabs/BouncyTabs.vue +39 -0
- package/src/components/custom/tabs/BouncyToggle.vue +352 -0
- package/src/components/custom/tabs/UnderlineTabs.vue +115 -0
- package/src/components/custom/tabs/index.ts +5 -0
- package/src/components/custom/timeline/GlassTimeline.vue +174 -0
- package/src/components/custom/timeline/index.ts +1 -0
- package/src/components/custom/typewriter/TypewriterText.vue +239 -0
- package/src/components/custom/typewriter/composables/index.ts +1 -0
- package/src/components/custom/typewriter/composables/useTypewriter.ts +413 -0
- package/src/components/custom/typewriter/index.ts +7 -0
- package/src/components/custom/typewriter/types.ts +159 -0
- package/src/components/custom/typewriter/utils/keyboard.ts +213 -0
- package/src/components/custom/typewriter/utils/pausePatterns.ts +55 -0
- package/src/components/custom/typewriter/utils/timing.ts +104 -0
- package/src/components/custom/typewriter/utils/typoStateMachine.ts +197 -0
- package/src/components/index.ts +2 -0
- package/src/components/ui/accordion/Accordion.vue +19 -0
- package/src/components/ui/accordion/AccordionContent.vue +24 -0
- package/src/components/ui/accordion/AccordionItem.vue +24 -0
- package/src/components/ui/accordion/AccordionTrigger.vue +39 -0
- package/src/components/ui/accordion/index.ts +4 -0
- package/src/components/ui/alert/Alert.vue +20 -0
- package/src/components/ui/alert/AlertDescription.vue +17 -0
- package/src/components/ui/alert/AlertTitle.vue +17 -0
- package/src/components/ui/alert/index.ts +23 -0
- package/src/components/ui/avatar/Avatar.vue +21 -0
- package/src/components/ui/avatar/AvatarFallback.vue +11 -0
- package/src/components/ui/avatar/AvatarImage.vue +9 -0
- package/src/components/ui/avatar/index.ts +24 -0
- package/src/components/ui/badge/Badge.vue +16 -0
- package/src/components/ui/badge/index.ts +25 -0
- package/src/components/ui/button/Button.vue +26 -0
- package/src/components/ui/button/index.ts +43 -0
- package/src/components/ui/card/Card.vue +28 -0
- package/src/components/ui/card/CardContent.vue +14 -0
- package/src/components/ui/card/CardDescription.vue +14 -0
- package/src/components/ui/card/CardFooter.vue +14 -0
- package/src/components/ui/card/CardHeader.vue +14 -0
- package/src/components/ui/card/CardTitle.vue +21 -0
- package/src/components/ui/card/index.ts +6 -0
- package/src/components/ui/carousel/Carousel.vue +53 -0
- package/src/components/ui/carousel/CarouselContent.vue +35 -0
- package/src/components/ui/carousel/CarouselItem.vue +24 -0
- package/src/components/ui/carousel/CarouselNext.vue +40 -0
- package/src/components/ui/carousel/CarouselPrevious.vue +40 -0
- package/src/components/ui/carousel/index.ts +10 -0
- package/src/components/ui/carousel/interface.ts +26 -0
- package/src/components/ui/carousel/useCarousel.ts +56 -0
- package/src/components/ui/checkbox/Checkbox.vue +33 -0
- package/src/components/ui/checkbox/index.ts +1 -0
- package/src/components/ui/collapsible/Collapsible.vue +15 -0
- package/src/components/ui/collapsible/CollapsibleContent.vue +11 -0
- package/src/components/ui/collapsible/CollapsibleTrigger.vue +11 -0
- package/src/components/ui/collapsible/index.ts +3 -0
- package/src/components/ui/combobox/Combobox.vue +17 -0
- package/src/components/ui/combobox/ComboboxAnchor.vue +23 -0
- package/src/components/ui/combobox/ComboboxEmpty.vue +21 -0
- package/src/components/ui/combobox/ComboboxGroup.vue +27 -0
- package/src/components/ui/combobox/ComboboxInput.vue +41 -0
- package/src/components/ui/combobox/ComboboxItem.vue +24 -0
- package/src/components/ui/combobox/ComboboxItemIndicator.vue +23 -0
- package/src/components/ui/combobox/ComboboxList.vue +29 -0
- package/src/components/ui/combobox/ComboboxSeparator.vue +21 -0
- package/src/components/ui/combobox/ComboboxViewport.vue +23 -0
- package/src/components/ui/combobox/index.ts +12 -0
- package/src/components/ui/command/Command.vue +30 -0
- package/src/components/ui/command/CommandDialog.vue +21 -0
- package/src/components/ui/command/CommandEmpty.vue +20 -0
- package/src/components/ui/command/CommandGroup.vue +29 -0
- package/src/components/ui/command/CommandInput.vue +33 -0
- package/src/components/ui/command/CommandItem.vue +26 -0
- package/src/components/ui/command/CommandList.vue +27 -0
- package/src/components/ui/command/CommandSeparator.vue +23 -0
- package/src/components/ui/command/CommandShortcut.vue +14 -0
- package/src/components/ui/command/index.ts +9 -0
- package/src/components/ui/context-menu/ContextMenu.vue +15 -0
- package/src/components/ui/context-menu/ContextMenuCheckboxItem.vue +40 -0
- package/src/components/ui/context-menu/ContextMenuContent.vue +36 -0
- package/src/components/ui/context-menu/ContextMenuGroup.vue +11 -0
- package/src/components/ui/context-menu/ContextMenuItem.vue +34 -0
- package/src/components/ui/context-menu/ContextMenuLabel.vue +25 -0
- package/src/components/ui/context-menu/ContextMenuPortal.vue +11 -0
- package/src/components/ui/context-menu/ContextMenuRadioGroup.vue +19 -0
- package/src/components/ui/context-menu/ContextMenuRadioItem.vue +40 -0
- package/src/components/ui/context-menu/ContextMenuSeparator.vue +20 -0
- package/src/components/ui/context-menu/ContextMenuShortcut.vue +14 -0
- package/src/components/ui/context-menu/ContextMenuSub.vue +19 -0
- package/src/components/ui/context-menu/ContextMenuSubContent.vue +35 -0
- package/src/components/ui/context-menu/ContextMenuSubTrigger.vue +34 -0
- package/src/components/ui/context-menu/ContextMenuTrigger.vue +13 -0
- package/src/components/ui/context-menu/index.ts +14 -0
- package/src/components/ui/data-table/DataTable.vue +167 -0
- package/src/components/ui/data-table/DataTablePagination.vue +112 -0
- package/src/components/ui/data-table/index.ts +3 -0
- package/src/components/ui/data-table/types.ts +48 -0
- package/src/components/ui/dialog/Dialog.vue +14 -0
- package/src/components/ui/dialog/DialogClose.vue +11 -0
- package/src/components/ui/dialog/DialogContent.vue +61 -0
- package/src/components/ui/dialog/DialogDescription.vue +24 -0
- package/src/components/ui/dialog/DialogFooter.vue +19 -0
- package/src/components/ui/dialog/DialogHeader.vue +16 -0
- package/src/components/ui/dialog/DialogScrollContent.vue +65 -0
- package/src/components/ui/dialog/DialogTitle.vue +29 -0
- package/src/components/ui/dialog/DialogTrigger.vue +11 -0
- package/src/components/ui/dialog/index.ts +9 -0
- package/src/components/ui/drawer/Drawer.vue +19 -0
- package/src/components/ui/drawer/DrawerContent.vue +28 -0
- package/src/components/ui/drawer/DrawerDescription.vue +20 -0
- package/src/components/ui/drawer/DrawerFooter.vue +14 -0
- package/src/components/ui/drawer/DrawerHeader.vue +14 -0
- package/src/components/ui/drawer/DrawerOverlay.vue +18 -0
- package/src/components/ui/drawer/DrawerTitle.vue +20 -0
- package/src/components/ui/drawer/index.ts +8 -0
- package/src/components/ui/dropdown-menu/DropdownMenu.vue +14 -0
- package/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +40 -0
- package/src/components/ui/dropdown-menu/DropdownMenuContent.vue +44 -0
- package/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +11 -0
- package/src/components/ui/dropdown-menu/DropdownMenuItem.vue +28 -0
- package/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +24 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +22 -0
- package/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +14 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +36 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +33 -0
- package/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +13 -0
- package/src/components/ui/dropdown-menu/index.ts +16 -0
- package/src/components/ui/hover-card/HoverCard.vue +14 -0
- package/src/components/ui/hover-card/HoverCardContent.vue +41 -0
- package/src/components/ui/hover-card/HoverCardTrigger.vue +11 -0
- package/src/components/ui/hover-card/index.ts +3 -0
- package/src/components/ui/index.ts +41 -0
- package/src/components/ui/input/Input.vue +24 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/label/Label.vue +27 -0
- package/src/components/ui/label/index.ts +1 -0
- package/src/components/ui/multi-select/MultiSelect.vue +141 -0
- package/src/components/ui/multi-select/index.ts +7 -0
- package/src/components/ui/notification/Notification.vue +85 -0
- package/src/components/ui/notification/index.ts +1 -0
- package/src/components/ui/number-field/NumberField.vue +23 -0
- package/src/components/ui/number-field/NumberFieldContent.vue +14 -0
- package/src/components/ui/number-field/NumberFieldDecrement.vue +25 -0
- package/src/components/ui/number-field/NumberFieldIncrement.vue +25 -0
- package/src/components/ui/number-field/NumberFieldInput.vue +8 -0
- package/src/components/ui/number-field/index.ts +5 -0
- package/src/components/ui/popover/Popover.vue +15 -0
- package/src/components/ui/popover/PopoverContent.vue +61 -0
- package/src/components/ui/popover/PopoverTrigger.vue +11 -0
- package/src/components/ui/popover/index.ts +3 -0
- package/src/components/ui/progress/Progress.vue +39 -0
- package/src/components/ui/progress/index.ts +1 -0
- package/src/components/ui/radio-group/RadioGroup.vue +25 -0
- package/src/components/ui/radio-group/RadioGroupItem.vue +39 -0
- package/src/components/ui/radio-group/index.ts +2 -0
- package/src/components/ui/scroll-area/ScrollArea.vue +29 -0
- package/src/components/ui/scroll-area/ScrollBar.vue +30 -0
- package/src/components/ui/scroll-area/index.ts +2 -0
- package/src/components/ui/scroll-pane/ScrollPane.vue +25 -0
- package/src/components/ui/scroll-pane/ScrollPaneHeader.vue +75 -0
- package/src/components/ui/scroll-pane/index.ts +2 -0
- package/src/components/ui/select/Select.vue +15 -0
- package/src/components/ui/select/SelectContent.vue +57 -0
- package/src/components/ui/select/SelectGroup.vue +19 -0
- package/src/components/ui/select/SelectItem.vue +47 -0
- package/src/components/ui/select/SelectItemText.vue +11 -0
- package/src/components/ui/select/SelectLabel.vue +13 -0
- package/src/components/ui/select/SelectScrollDownButton.vue +24 -0
- package/src/components/ui/select/SelectScrollUpButton.vue +24 -0
- package/src/components/ui/select/SelectSeparator.vue +17 -0
- package/src/components/ui/select/SelectTrigger.vue +45 -0
- package/src/components/ui/select/SelectValue.vue +11 -0
- package/src/components/ui/select/index.ts +11 -0
- package/src/components/ui/separator/Separator.vue +35 -0
- package/src/components/ui/separator/index.ts +1 -0
- package/src/components/ui/sheet/Sheet.vue +14 -0
- package/src/components/ui/sheet/SheetClose.vue +11 -0
- package/src/components/ui/sheet/SheetContent.vue +56 -0
- package/src/components/ui/sheet/SheetDescription.vue +22 -0
- package/src/components/ui/sheet/SheetFooter.vue +19 -0
- package/src/components/ui/sheet/SheetHeader.vue +16 -0
- package/src/components/ui/sheet/SheetTitle.vue +22 -0
- package/src/components/ui/sheet/SheetTrigger.vue +11 -0
- package/src/components/ui/sheet/index.ts +31 -0
- package/src/components/ui/skeleton/Skeleton.vue +14 -0
- package/src/components/ui/skeleton/index.ts +1 -0
- package/src/components/ui/slider/Slider.vue +66 -0
- package/src/components/ui/slider/index.ts +1 -0
- package/src/components/ui/switch/Switch.vue +37 -0
- package/src/components/ui/switch/index.ts +1 -0
- package/src/components/ui/table/Table.vue +16 -0
- package/src/components/ui/table/TableBody.vue +14 -0
- package/src/components/ui/table/TableCaption.vue +14 -0
- package/src/components/ui/table/TableCell.vue +14 -0
- package/src/components/ui/table/TableEmpty.vue +39 -0
- package/src/components/ui/table/TableFooter.vue +16 -0
- package/src/components/ui/table/TableHead.vue +21 -0
- package/src/components/ui/table/TableHeader.vue +14 -0
- package/src/components/ui/table/TableRow.vue +21 -0
- package/src/components/ui/table/index.ts +9 -0
- package/src/components/ui/tabs/Tabs.vue +15 -0
- package/src/components/ui/tabs/TabsContent.vue +22 -0
- package/src/components/ui/tabs/TabsIndicator.vue +22 -0
- package/src/components/ui/tabs/TabsList.vue +25 -0
- package/src/components/ui/tabs/TabsTrigger.vue +29 -0
- package/src/components/ui/tabs/index.ts +5 -0
- package/src/components/ui/tags-input/TagsInput.vue +22 -0
- package/src/components/ui/tags-input/TagsInputInput.vue +19 -0
- package/src/components/ui/tags-input/TagsInputItem.vue +22 -0
- package/src/components/ui/tags-input/TagsInputItemDelete.vue +24 -0
- package/src/components/ui/tags-input/TagsInputItemText.vue +19 -0
- package/src/components/ui/tags-input/index.ts +5 -0
- package/src/components/ui/textarea/Textarea.vue +24 -0
- package/src/components/ui/textarea/index.ts +1 -0
- package/src/components/ui/toast/Toast.vue +57 -0
- package/src/components/ui/toast/ToastAction.vue +30 -0
- package/src/components/ui/toast/ToastClose.vue +31 -0
- package/src/components/ui/toast/ToastDescription.vue +25 -0
- package/src/components/ui/toast/ToastTitle.vue +25 -0
- package/src/components/ui/toast/Toaster.vue +31 -0
- package/src/components/ui/toast/index.ts +8 -0
- package/src/components/ui/toast/use-toast.ts +136 -0
- package/src/components/ui/toggle/Toggle.vue +35 -0
- package/src/components/ui/toggle/index.ts +27 -0
- package/src/components/ui/toggle-group/ToggleGroup.vue +34 -0
- package/src/components/ui/toggle-group/ToggleGroupItem.vue +35 -0
- package/src/components/ui/toggle-group/index.ts +2 -0
- package/src/components/ui/tooltip/Tooltip.vue +14 -0
- package/src/components/ui/tooltip/TooltipContent.vue +31 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +11 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +11 -0
- package/src/components/ui/tooltip/index.ts +4 -0
- package/src/composables/glass/index.ts +8 -0
- package/src/composables/glass/useGlassRenderer.ts +252 -0
- package/src/composables/glass/webgl/frostShader.ts +221 -0
- package/src/composables/glass/webgpu/glassShader.wgsl +173 -0
- package/src/composables/index.ts +32 -0
- package/src/composables/infinite-scroll/index.ts +2 -0
- package/src/composables/infinite-scroll/types.ts +25 -0
- package/src/composables/infinite-scroll/useInfiniteScroll.ts +101 -0
- package/src/composables/interaction/index.ts +5 -0
- package/src/composables/interaction/useHeightTransition.ts +82 -0
- package/src/composables/interaction/useHoverPopover.ts +64 -0
- package/src/composables/interaction/useHoverToggle.ts +103 -0
- package/src/composables/interaction/useLeaveTimer.ts +17 -0
- package/src/composables/interaction/useTouchGate.ts +207 -0
- package/src/composables/pagination/index.ts +2 -0
- package/src/composables/pagination/useOffsetPagination.ts +70 -0
- package/src/composables/prng.ts +32 -0
- package/src/composables/useCharSplit.ts +31 -0
- package/src/composables/useClipboard.ts +46 -0
- package/src/composables/useGlobalDark.ts +61 -0
- package/src/composables/useKeyboardShortcuts.ts +205 -0
- package/src/composables/useWatercolorBlob.ts +136 -0
- package/src/composables/virtual/index.ts +22 -0
- package/src/composables/virtual/useVirtualSectionWindow.ts +338 -0
- package/src/composables/virtual/useWindowedStore.ts +86 -0
- package/src/composables/virtual/virtualSectionLayout.ts +212 -0
- package/src/index.ts +9 -0
- package/src/styles/animations.css +233 -0
- package/src/styles/cards.css +66 -0
- package/src/styles/dock.css +221 -0
- package/src/styles/floating-panel.css +49 -0
- package/src/styles/glass.css +266 -0
- package/src/styles/index.css +26 -0
- package/src/styles/scroll-pane.css +10 -0
- package/src/styles/theme.css +138 -0
- package/src/styles/tokens.css +333 -0
- package/src/styles/transitions.css +226 -0
- package/src/styles/typography.css +277 -0
- package/src/styles/utilities.css +697 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure layout computation functions for virtual section scrolling.
|
|
3
|
+
*
|
|
4
|
+
* These are stateless — they take data in, return layout info out.
|
|
5
|
+
* No Vue reactivity, no DOM access.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** A flattened section item with hierarchy metadata for virtual scrolling. */
|
|
9
|
+
export interface FlatSection {
|
|
10
|
+
id: string;
|
|
11
|
+
index: number;
|
|
12
|
+
depth: number;
|
|
13
|
+
parentId: string | null;
|
|
14
|
+
rootId: string;
|
|
15
|
+
rootIndex: number;
|
|
16
|
+
estimatedHeight: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A single entry in a computed section layout with resolved position. */
|
|
20
|
+
export interface SectionLayoutEntry<T extends FlatSection = FlatSection> {
|
|
21
|
+
item: T;
|
|
22
|
+
height: number;
|
|
23
|
+
top: number;
|
|
24
|
+
bottom: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Complete layout for a list of sections — entries plus total height. */
|
|
28
|
+
export interface SectionLayout<T extends FlatSection = FlatSection> {
|
|
29
|
+
entries: SectionLayoutEntry<T>[];
|
|
30
|
+
totalHeight: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The visible window range with spacer sizes for virtual scrolling. */
|
|
34
|
+
export interface SectionWindowRange {
|
|
35
|
+
startIndex: number;
|
|
36
|
+
endIndex: number;
|
|
37
|
+
topSpacerPx: number;
|
|
38
|
+
bottomSpacerPx: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** A forced index range that must be included in the visible window. */
|
|
42
|
+
export interface ForcedSectionWindowRange {
|
|
43
|
+
startIndex: number;
|
|
44
|
+
endIndex: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Build a layout from a flat list of sections using a height resolver.
|
|
49
|
+
*
|
|
50
|
+
* Each entry gets an absolute `top` and `bottom` offset in pixels,
|
|
51
|
+
* computed sequentially from index 0. Heights are rounded and clamped >= 1.
|
|
52
|
+
*/
|
|
53
|
+
export function buildSectionLayout<T extends FlatSection>(
|
|
54
|
+
items: readonly T[],
|
|
55
|
+
getHeight: (item: T) => number,
|
|
56
|
+
): SectionLayout<T> {
|
|
57
|
+
let offset = 0;
|
|
58
|
+
const entries = items.map((item) => {
|
|
59
|
+
const height = Math.max(1, Math.round(getHeight(item)));
|
|
60
|
+
const top = offset;
|
|
61
|
+
offset += height;
|
|
62
|
+
return {
|
|
63
|
+
item,
|
|
64
|
+
height,
|
|
65
|
+
top,
|
|
66
|
+
bottom: offset,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
entries,
|
|
72
|
+
totalHeight: offset,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Binary search for the first entry whose bottom edge is past `startOffset`.
|
|
78
|
+
* Returns the index of the first visible item.
|
|
79
|
+
*/
|
|
80
|
+
function findStartIndex<T extends FlatSection>(
|
|
81
|
+
entries: readonly SectionLayoutEntry<T>[],
|
|
82
|
+
startOffset: number,
|
|
83
|
+
): number {
|
|
84
|
+
if (entries.length === 0) return 0;
|
|
85
|
+
let low = 0;
|
|
86
|
+
let high = entries.length - 1;
|
|
87
|
+
while (low < high) {
|
|
88
|
+
const mid = Math.floor((low + high) / 2);
|
|
89
|
+
if (entries[mid].bottom <= startOffset) {
|
|
90
|
+
low = mid + 1;
|
|
91
|
+
} else {
|
|
92
|
+
high = mid;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return low;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Binary search for the last entry whose top edge is before `endOffset`.
|
|
100
|
+
* Returns the index of the last visible item.
|
|
101
|
+
*/
|
|
102
|
+
function findEndIndex<T extends FlatSection>(
|
|
103
|
+
entries: readonly SectionLayoutEntry<T>[],
|
|
104
|
+
endOffset: number,
|
|
105
|
+
): number {
|
|
106
|
+
if (entries.length === 0) return 0;
|
|
107
|
+
let low = 0;
|
|
108
|
+
let high = entries.length - 1;
|
|
109
|
+
while (low < high) {
|
|
110
|
+
const mid = Math.ceil((low + high) / 2);
|
|
111
|
+
if (entries[mid].top < endOffset) {
|
|
112
|
+
low = mid;
|
|
113
|
+
} else {
|
|
114
|
+
high = mid - 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return low;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Resolve which section indices are visible given scroll state.
|
|
122
|
+
*
|
|
123
|
+
* Uses binary search for O(log n) lookup. Overscan extends the window
|
|
124
|
+
* before and after the viewport. An optional `forcedRange` guarantees
|
|
125
|
+
* certain indices are always included (used for warm-up targeting).
|
|
126
|
+
*/
|
|
127
|
+
export function resolveSectionWindow<T extends FlatSection>(
|
|
128
|
+
layout: SectionLayout<T>,
|
|
129
|
+
scrollTopPx: number,
|
|
130
|
+
viewportHeightPx: number,
|
|
131
|
+
overscanBeforePx: number,
|
|
132
|
+
overscanAfterPx: number,
|
|
133
|
+
forcedRange?: ForcedSectionWindowRange | null,
|
|
134
|
+
): SectionWindowRange {
|
|
135
|
+
if (layout.entries.length === 0) {
|
|
136
|
+
return {
|
|
137
|
+
startIndex: 0,
|
|
138
|
+
endIndex: -1,
|
|
139
|
+
topSpacerPx: 0,
|
|
140
|
+
bottomSpacerPx: 0,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const startOffset = Math.max(0, scrollTopPx - overscanBeforePx);
|
|
145
|
+
const endOffset = Math.max(
|
|
146
|
+
0,
|
|
147
|
+
scrollTopPx + viewportHeightPx + overscanAfterPx,
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
let startIndex = findStartIndex(layout.entries, startOffset);
|
|
151
|
+
let endIndex = findEndIndex(layout.entries, endOffset);
|
|
152
|
+
|
|
153
|
+
if (forcedRange) {
|
|
154
|
+
startIndex = Math.min(startIndex, forcedRange.startIndex);
|
|
155
|
+
endIndex = Math.max(endIndex, forcedRange.endIndex);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
startIndex = Math.max(0, Math.min(startIndex, layout.entries.length - 1));
|
|
159
|
+
endIndex = Math.max(startIndex, Math.min(endIndex, layout.entries.length - 1));
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
startIndex,
|
|
163
|
+
endIndex,
|
|
164
|
+
topSpacerPx: layout.entries[startIndex]?.top ?? 0,
|
|
165
|
+
bottomSpacerPx: Math.max(
|
|
166
|
+
0,
|
|
167
|
+
layout.totalHeight - (layout.entries[endIndex]?.bottom ?? 0),
|
|
168
|
+
),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Find the section that is "active" at a given scroll offset.
|
|
174
|
+
*
|
|
175
|
+
* Returns the last section whose top edge is at or before `activeOffsetPx`.
|
|
176
|
+
* Useful for highlighting the current section in a navigation sidebar.
|
|
177
|
+
*/
|
|
178
|
+
export function resolveActiveSection<T extends FlatSection>(
|
|
179
|
+
layout: SectionLayout<T>,
|
|
180
|
+
activeOffsetPx: number,
|
|
181
|
+
): T | null {
|
|
182
|
+
if (layout.entries.length === 0) return null;
|
|
183
|
+
|
|
184
|
+
let low = 0;
|
|
185
|
+
let high = layout.entries.length - 1;
|
|
186
|
+
while (low < high) {
|
|
187
|
+
const mid = Math.ceil((low + high) / 2);
|
|
188
|
+
if (layout.entries[mid].top <= activeOffsetPx) {
|
|
189
|
+
low = mid;
|
|
190
|
+
} else {
|
|
191
|
+
high = mid - 1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return layout.entries[low]?.item ?? null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Find the pixel offset of a section by its `id`.
|
|
200
|
+
* Returns `null` if the section is not in the layout.
|
|
201
|
+
*/
|
|
202
|
+
export function findSectionOffset<T extends FlatSection>(
|
|
203
|
+
layout: SectionLayout<T>,
|
|
204
|
+
id: string,
|
|
205
|
+
): number | null {
|
|
206
|
+
for (const entry of layout.entries) {
|
|
207
|
+
if (entry.item.id === id) {
|
|
208
|
+
return entry.top;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* Shared @keyframes — global animations used across projects */
|
|
2
|
+
|
|
3
|
+
/* ── Floating panel entrance ── */
|
|
4
|
+
@keyframes floating-panel-in {
|
|
5
|
+
from {
|
|
6
|
+
opacity: 0;
|
|
7
|
+
filter: blur(4px);
|
|
8
|
+
scale: 0.96;
|
|
9
|
+
}
|
|
10
|
+
to {
|
|
11
|
+
opacity: 1;
|
|
12
|
+
filter: blur(0);
|
|
13
|
+
scale: 1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* ── Dialog open / close ── */
|
|
18
|
+
@keyframes dialog-in {
|
|
19
|
+
from {
|
|
20
|
+
opacity: 0;
|
|
21
|
+
transform: scale(0.95) translateY(8px);
|
|
22
|
+
}
|
|
23
|
+
to {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
transform: scale(1) translateY(0);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes dialog-out {
|
|
30
|
+
from {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
transform: scale(1) translateY(0);
|
|
33
|
+
}
|
|
34
|
+
to {
|
|
35
|
+
opacity: 0;
|
|
36
|
+
transform: scale(0.95) translateY(8px);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ── Dialog ↔ drawer transitions ── */
|
|
41
|
+
@keyframes dialog-out-to-drawer {
|
|
42
|
+
from {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
transform: scale(1) translateX(0);
|
|
45
|
+
}
|
|
46
|
+
to {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transform: scale(0.35) translateX(-120%);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@keyframes dialog-in-from-drawer {
|
|
53
|
+
from {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
transform: scale(0.35) translateX(-120%);
|
|
56
|
+
}
|
|
57
|
+
to {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
transform: scale(1) translateX(0);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (width < 640px) {
|
|
64
|
+
@keyframes dialog-out-to-drawer {
|
|
65
|
+
from {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
transform: scale(1) translateY(0);
|
|
68
|
+
}
|
|
69
|
+
to {
|
|
70
|
+
opacity: 0;
|
|
71
|
+
transform: scale(0.5) translateY(60%);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
@keyframes dialog-in-from-drawer {
|
|
75
|
+
from {
|
|
76
|
+
opacity: 0;
|
|
77
|
+
transform: scale(0.5) translateY(60%);
|
|
78
|
+
}
|
|
79
|
+
to {
|
|
80
|
+
opacity: 1;
|
|
81
|
+
transform: scale(1) translateY(0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* ── Card menu entrance ── */
|
|
87
|
+
@keyframes card-menu-in {
|
|
88
|
+
from {
|
|
89
|
+
opacity: 0;
|
|
90
|
+
filter: blur(4px);
|
|
91
|
+
transform: translateX(-100%) scale(0.96);
|
|
92
|
+
}
|
|
93
|
+
to {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
filter: blur(0);
|
|
96
|
+
transform: translateX(-100%) scale(1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* ── Golden shimmer ── */
|
|
101
|
+
@keyframes golden-shimmer {
|
|
102
|
+
0%,
|
|
103
|
+
100% {
|
|
104
|
+
background-position: 100% 100%;
|
|
105
|
+
}
|
|
106
|
+
50% {
|
|
107
|
+
background-position: 0% 0%;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* ── Collapsible (reka-ui) ── */
|
|
112
|
+
@keyframes collapsible-open {
|
|
113
|
+
from {
|
|
114
|
+
height: 0;
|
|
115
|
+
opacity: 0;
|
|
116
|
+
}
|
|
117
|
+
to {
|
|
118
|
+
height: var(--reka-collapsible-content-height);
|
|
119
|
+
opacity: 1;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@keyframes collapsible-close {
|
|
124
|
+
from {
|
|
125
|
+
height: var(--reka-collapsible-content-height);
|
|
126
|
+
opacity: 1;
|
|
127
|
+
}
|
|
128
|
+
to {
|
|
129
|
+
height: 0;
|
|
130
|
+
opacity: 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* ── Tooltip entrance ── */
|
|
135
|
+
@keyframes tooltip-in {
|
|
136
|
+
from {
|
|
137
|
+
opacity: 0;
|
|
138
|
+
transform: scale(0.96);
|
|
139
|
+
}
|
|
140
|
+
to {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
transform: scale(1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* ── Generic fade-in ── */
|
|
147
|
+
@keyframes fade-in {
|
|
148
|
+
from {
|
|
149
|
+
opacity: 0;
|
|
150
|
+
transform: translateY(6px);
|
|
151
|
+
}
|
|
152
|
+
to {
|
|
153
|
+
opacity: 1;
|
|
154
|
+
transform: translateY(0);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* ── Scale-in ── */
|
|
159
|
+
@keyframes scale-in {
|
|
160
|
+
from {
|
|
161
|
+
opacity: 0;
|
|
162
|
+
transform: scale(0.95);
|
|
163
|
+
}
|
|
164
|
+
to {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
transform: scale(1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* ── Slide-up ── */
|
|
171
|
+
@keyframes slide-up {
|
|
172
|
+
from {
|
|
173
|
+
opacity: 0;
|
|
174
|
+
transform: translateY(16px);
|
|
175
|
+
}
|
|
176
|
+
to {
|
|
177
|
+
opacity: 1;
|
|
178
|
+
transform: translateY(0);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* ── Rainbow hue rotate ── */
|
|
183
|
+
@keyframes rainbow-hue {
|
|
184
|
+
from {
|
|
185
|
+
filter: hue-rotate(0deg);
|
|
186
|
+
}
|
|
187
|
+
to {
|
|
188
|
+
filter: hue-rotate(360deg);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* ── Shimmer sweep (background-position for .shimmer-text) ── */
|
|
193
|
+
@keyframes shimmer-sweep {
|
|
194
|
+
0% {
|
|
195
|
+
background-position: -200% 0;
|
|
196
|
+
}
|
|
197
|
+
100% {
|
|
198
|
+
background-position: 200% 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* ── Shake (horizontal ±4px for .shake-error) ── */
|
|
203
|
+
@keyframes shake {
|
|
204
|
+
0%,
|
|
205
|
+
100% {
|
|
206
|
+
transform: translateX(0);
|
|
207
|
+
}
|
|
208
|
+
10%,
|
|
209
|
+
30%,
|
|
210
|
+
50%,
|
|
211
|
+
70%,
|
|
212
|
+
90% {
|
|
213
|
+
transform: translateX(-4px);
|
|
214
|
+
}
|
|
215
|
+
20%,
|
|
216
|
+
40%,
|
|
217
|
+
60%,
|
|
218
|
+
80% {
|
|
219
|
+
transform: translateX(4px);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* ── Kinetic typography: weight breathing ── */
|
|
224
|
+
@keyframes weight-breathe {
|
|
225
|
+
0%, 100% { font-variation-settings: "wght" 300; }
|
|
226
|
+
50% { font-variation-settings: "wght" 500; }
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* ── Kinetic typography: scroll-driven weight reveal ── */
|
|
230
|
+
@keyframes weight-reveal {
|
|
231
|
+
from { font-variation-settings: "wght" 100; opacity: 0.3; }
|
|
232
|
+
to { font-variation-settings: "wght" 400; opacity: 1; }
|
|
233
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* Card utilities — cartoon, elevated, paper texture */
|
|
2
|
+
|
|
3
|
+
@layer components {
|
|
4
|
+
/* Shared card base */
|
|
5
|
+
.cartoon-card,
|
|
6
|
+
.elevated-card {
|
|
7
|
+
border-radius: var(--radius-xl);
|
|
8
|
+
border: 2px solid color-mix(in srgb, var(--foreground) calc(var(--border-opacity-light) * 100%), transparent);
|
|
9
|
+
background: var(--card);
|
|
10
|
+
color: var(--card-foreground);
|
|
11
|
+
transition:
|
|
12
|
+
box-shadow var(--duration-fast) var(--ease-standard),
|
|
13
|
+
border-color var(--duration-fast) var(--ease-standard);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Cartoon card — thick border + offset hard shadow */
|
|
17
|
+
.cartoon-card {
|
|
18
|
+
box-shadow: var(--shadow-cartoon-md);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cartoon-card:hover {
|
|
22
|
+
border-color: color-mix(in srgb, var(--foreground) calc(var(--border-opacity-medium) * 100%), transparent);
|
|
23
|
+
box-shadow: var(--shadow-cartoon-lg);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:where(.dark) .cartoon-card {
|
|
27
|
+
border-color: color-mix(in srgb, var(--foreground) 12%, transparent);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:where(.dark) .cartoon-card:hover {
|
|
31
|
+
border-color: color-mix(in srgb, var(--foreground) 18%, transparent);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Elevated card — soft shadow */
|
|
35
|
+
.elevated-card {
|
|
36
|
+
box-shadow: var(--shadow-md);
|
|
37
|
+
transition:
|
|
38
|
+
box-shadow var(--duration-fast) var(--ease-standard),
|
|
39
|
+
border-color var(--duration-fast) var(--ease-standard),
|
|
40
|
+
transform var(--duration-normal) var(--ease-standard);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.elevated-card:hover {
|
|
44
|
+
box-shadow: var(--shadow-lg);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Paper texture overlay */
|
|
48
|
+
.paper-texture {
|
|
49
|
+
background-image: var(--paper-clean-texture);
|
|
50
|
+
background-repeat: repeat;
|
|
51
|
+
background-size: var(--paper-texture-size);
|
|
52
|
+
background-blend-mode: multiply;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.paper-texture-aged {
|
|
56
|
+
background-image: var(--paper-aged-texture);
|
|
57
|
+
background-repeat: repeat;
|
|
58
|
+
background-size: var(--paper-texture-size);
|
|
59
|
+
background-blend-mode: multiply;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:where(.dark) .paper-texture,
|
|
63
|
+
:where(.dark) .paper-texture-aged {
|
|
64
|
+
background-blend-mode: screen;
|
|
65
|
+
}
|
|
66
|
+
}
|