@mkbabb/glass-ui 3.2.0 → 3.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.
- package/dist/{CardFooter-3-VGho1J.js → CardFooter-C390imy7.js} +2 -2
- package/dist/{CollapsibleContent-wlmlDujU.js → CollapsibleContent-cauTbZEM.js} +1 -1
- package/dist/{CommandShortcut-C6lsz3pG.js → CommandShortcut-BiVyqipe.js} +5 -4
- package/dist/DataTable-FfkaAg2z.js +465 -0
- package/dist/DialogContent-IQ8_BRrC.js +100 -0
- package/dist/{DiscoGlyph-B7YooI2-.js → DiscoGlyph-BaZ8OawK.js} +1 -1
- package/dist/{GlyphFace-Bvk6OIas.js → GlyphFace-B_7vOmYn.js} +1 -1
- package/dist/HoverPopover-DTSYkJtw.js +96 -0
- package/dist/{IconTooltip-DXveGjx7.js → IconTooltip-BTyYn4mr.js} +1 -1
- package/dist/Input-CU9CNKmo.js +52 -0
- package/dist/{MetricBadge-J_GBCb8e.js → MetricBadge-BlrdbOGN.js} +1 -1
- package/dist/{NumberFieldContent-B6L6YrQz.js → NumberFieldContent-iOTQ5rGO.js} +8 -4
- package/dist/{PopoverContent-CxEEUL7Y.js → PopoverContent-B8WtJECb.js} +1 -1
- package/dist/Progress-DjM86vfb.js +254 -0
- package/dist/{ScrollingText-1Qjnwz6H.js → ScrollingText-P9o_DuMn.js} +1 -1
- package/dist/{SelectScrollDownButton-BvvvAbuh.js → SelectScrollDownButton-BGn3rjs9.js} +9 -8
- package/dist/TabsIndicator-DA0x9gPr.js +97 -0
- package/dist/{ToggleGroupItem-Cy7xHFEo.js → ToggleGroupItem-gyXj998A.js} +37 -40
- package/dist/UnderlineTabs-Cq_AD03t.js +39 -0
- package/dist/animated-digit.js +2 -2
- package/dist/api/index.d.ts +2 -0
- package/dist/api.js +1 -1
- package/dist/aurora.js +454 -271
- package/dist/{button-DS3ULf5i.js → button-Ckn3eDfB.js} +27 -22
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.js +2 -2
- package/dist/collapsible.js +1 -1
- package/dist/color-rkK4RMx2.js +33 -0
- package/dist/color.d.ts +1 -0
- package/dist/color.js +2 -0
- package/dist/command.js +1 -1
- package/dist/compile-DVgAxagk.js +106 -0
- package/dist/components/custom/animated-digit/AnimatedDigit.vue.d.ts +7 -7
- package/dist/components/custom/aurora/Aurora.vue.d.ts +3 -3
- package/dist/components/custom/aurora/composables/color.d.ts +3 -25
- package/dist/components/custom/aurora/composables/cursorModel.d.ts +45 -0
- package/dist/components/custom/aurora/composables/frameLoop.d.ts +30 -0
- package/dist/components/custom/aurora/composables/glSetup.d.ts +29 -0
- package/dist/components/custom/aurora/composables/runtime.d.ts +45 -35
- package/dist/components/custom/aurora/composables/uniformBridge.d.ts +67 -0
- package/dist/components/custom/aurora/composables/useAurora.d.ts +14 -1
- package/dist/components/custom/aurora/composables/useCursorInteraction.d.ts +1 -1
- package/dist/components/custom/aurora/constants/budget.d.ts +50 -0
- package/dist/components/custom/aurora/{presets.d.ts → constants/presets.d.ts} +2 -5
- package/dist/components/custom/aurora/constants/shaders/aurora.frag.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/brush.glsl.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/composition.glsl.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/flow.glsl.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/mediums.glsl.d.ts +2 -0
- package/dist/components/custom/aurora/constants/shaders/tonemap.glsl.d.ts +1 -0
- package/dist/components/custom/aurora/index.d.ts +2 -2
- package/dist/components/custom/configurator/ConfiguratorLayer.vue.d.ts +14 -7
- package/dist/components/custom/configurator/density.d.ts +3 -8
- package/dist/components/custom/dock/DockBackgroundToggle.vue.d.ts +46 -0
- package/dist/components/custom/dock/DockIconButton.vue.d.ts +3 -3
- package/dist/components/custom/dock/DockLayerGroup.vue.d.ts +2 -2
- package/dist/components/custom/dock/GlassDock.vue.d.ts +22 -18
- package/dist/components/custom/dock/composables/dockContext.d.ts +4 -4
- package/dist/components/custom/dock/composables/dockLayerContext.d.ts +13 -6
- package/dist/components/custom/dock/composables/useLayerTransition.d.ts +32 -8
- package/dist/components/custom/dock/index.d.ts +1 -0
- package/dist/components/custom/expandable-container/ExpandableContainer.vue.d.ts +10 -0
- package/dist/components/custom/glass-panel/GlassPanel.vue.d.ts +1 -1
- package/dist/components/custom/glyph-face/keys.d.ts +3 -29
- package/dist/components/custom/goo-blob/GooBlob.vue.d.ts +48 -0
- package/dist/components/custom/goo-blob/composables/easing.d.ts +6 -0
- package/dist/components/custom/goo-blob/composables/useBlobMood.d.ts +14 -0
- package/dist/components/custom/goo-blob/composables/useBlobPointer.d.ts +18 -0
- package/dist/components/custom/goo-blob/composables/useBlobSatellites.d.ts +13 -0
- package/dist/components/custom/goo-blob/composables/useMetaballRenderer.d.ts +42 -0
- package/dist/components/custom/goo-blob/index.d.ts +7 -0
- package/dist/components/custom/goo-blob/shaders/metaball.frag.d.ts +1 -0
- package/dist/components/custom/goo-blob/shaders/metaball.vert.d.ts +1 -0
- package/dist/components/custom/goo-blob/shaders/oklch-perturb.glsl.d.ts +1 -0
- package/dist/components/custom/goo-blob/shaders/sdf-body.glsl.d.ts +1 -0
- package/dist/components/custom/goo-blob/shaders/watercolor-edges.glsl.d.ts +2 -0
- package/dist/components/custom/goo-blob/types.d.ts +77 -0
- package/dist/components/custom/hover-popover/HoverPopover.vue.d.ts +48 -9
- package/dist/components/custom/labeled-field/LabeledField.vue.d.ts +2 -0
- package/dist/components/custom/labeled-field/LabeledSelect.vue.d.ts +2 -2
- package/dist/components/custom/metric-stack/MetricRow.vue.d.ts +2 -2
- package/dist/components/custom/responsive-tabs/ResponsiveTabs.vue.d.ts +13 -7
- package/dist/components/custom/search/FuzzySearch.vue.d.ts +1 -1
- package/dist/components/custom/search/SearchBar.vue.d.ts +1 -1
- package/dist/components/custom/sortable-list/SortableHandle.vue.d.ts +7 -1
- package/dist/components/custom/sortable-list/context.d.ts +2 -3
- package/dist/components/custom/tabs/BouncyTabs.vue.d.ts +6 -3
- package/dist/components/custom/tabs/BouncyToggle.vue.d.ts +7 -3
- package/dist/components/custom/tabs/UnderlineTabs.vue.d.ts +6 -3
- package/dist/components/custom/tabs/composables/useBouncySlider.d.ts +39 -0
- package/dist/components/custom/timeline/ContinuousMarkers.vue.d.ts +49 -0
- package/dist/components/custom/timeline/ContinuousRail.vue.d.ts +26 -0
- package/dist/components/custom/timeline/ContinuousTimeline.vue.d.ts +4 -4
- package/dist/components/custom/typewriter/TypewriterText.vue.d.ts +2 -2
- package/dist/components/custom/watercolor-dot/WatercolorDot.vue.d.ts +45 -0
- package/dist/components/custom/watercolor-dot/index.d.ts +3 -0
- package/dist/components/custom/watercolor-dot/prng.d.ts +5 -0
- package/dist/components/custom/watercolor-dot/useWatercolorBlob.d.ts +24 -0
- package/dist/components/ui/_shared/menuItemVariants.d.ts +1 -1
- package/dist/components/ui/avatar/Avatar.vue.d.ts +1 -1
- package/dist/components/ui/avatar/AvatarImage.vue.d.ts +5 -1
- package/dist/components/ui/avatar/index.d.ts +1 -1
- package/dist/components/ui/badge/index.d.ts +2 -2
- package/dist/components/ui/button/Button.vue.d.ts +3 -1
- package/dist/components/ui/button/index.d.ts +2 -2
- package/dist/components/ui/carousel/CarouselNext.vue.d.ts +2 -2
- package/dist/components/ui/carousel/CarouselPrevious.vue.d.ts +2 -2
- package/dist/components/ui/combobox/Combobox.vue.d.ts +2 -2
- package/dist/components/ui/combobox/ComboboxInput.vue.d.ts +2 -1
- package/dist/components/ui/command/Command.vue.d.ts +3 -3
- package/dist/components/ui/command/CommandInput.vue.d.ts +2 -1
- package/dist/components/ui/data-table/DataTable.vue.d.ts +5 -4
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +8 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts +4 -4
- package/dist/components/ui/input/Input.vue.d.ts +19 -1
- package/dist/components/ui/multi-select/MultiSelect.vue.d.ts +8 -4
- package/dist/components/ui/progress/Progress.vue.d.ts +26 -88
- package/dist/components/ui/progress/ProgressDefault.vue.d.ts +14 -0
- package/dist/components/ui/progress/ProgressGradient.vue.d.ts +25 -0
- package/dist/components/ui/progress/ProgressSectioned.vue.d.ts +36 -0
- package/dist/components/ui/progress/index.d.ts +5 -2
- package/dist/components/ui/progress/useProgressGeometry.d.ts +60 -0
- package/dist/components/ui/select/Select.vue.d.ts +2 -2
- package/dist/components/ui/select/SelectContent.vue.d.ts +1 -1
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +3 -0
- package/dist/components/ui/sheet/index.d.ts +1 -1
- package/dist/components/ui/slider/index.d.ts +12 -11
- package/dist/components/ui/tags-input/TagsInput.vue.d.ts +2 -2
- package/dist/components/ui/textarea/Textarea.vue.d.ts +5 -1
- package/dist/components/ui/toast/Toast.vue.d.ts +4 -4
- package/dist/components/ui/toggle/Toggle.vue.d.ts +1 -1
- package/dist/components/ui/toggle/index.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggleGroupContext.d.ts +2 -3
- package/dist/composables/color/index.d.ts +49 -0
- package/dist/composables/context/createContext.d.ts +56 -0
- package/dist/composables/context/index.d.ts +1 -0
- package/dist/composables/dark/darkModeSyncScript.d.ts +23 -0
- package/dist/composables/dark/index.d.ts +3 -0
- package/dist/composables/dark/useGlobalDark.d.ts +19 -2
- package/dist/composables/dom/index.d.ts +0 -3
- package/dist/composables/dom/useClipboard.d.ts +35 -12
- package/dist/composables/dom/useDocumentVisibility.d.ts +20 -0
- package/dist/composables/glass/webgl/compile.d.ts +15 -0
- package/dist/composables/glass/webgl/shaders/procedural-color.glsl.d.ts +3 -0
- package/dist/composables/glass/webgl/useWebGLCanvas.d.ts +55 -0
- package/dist/composables/motion/core/index.d.ts +1 -1
- package/dist/composables/motion/index.d.ts +1 -1
- package/dist/composables/motion/useCountup.d.ts +29 -0
- package/dist/composables/motion/useNumericTransition.d.ts +14 -3
- package/dist/composables/motion/vReveal.d.ts +2 -0
- package/dist/composables/sidebar/useSidebarState.d.ts +2 -2
- package/dist/composables/sortable/dragController.d.ts +44 -0
- package/dist/composables/sortable/dropResolver.d.ts +34 -0
- package/dist/composables/sortable/ghostRenderer.d.ts +44 -0
- package/dist/composables/sortable/index.d.ts +1 -1
- package/dist/composables/sortable/touchGate.d.ts +26 -0
- package/dist/composables/sortable/transitionTiming.d.ts +50 -0
- package/dist/composables/sortable/types.d.ts +133 -0
- package/dist/composables/sortable/useSortable.d.ts +25 -153
- package/dist/configurator.js +1 -1
- package/dist/confirm-dialog.js +1 -1
- package/dist/controls.js +4 -4
- package/dist/createContext-DBMGRlx4.js +25 -0
- package/dist/dark.d.ts +2 -1
- package/dist/dark.js +9 -2
- package/dist/data-table.js +1 -1
- package/dist/dialog.js +1 -1
- package/dist/disco-glyph.js +1 -1
- package/dist/dock.js +400 -261
- package/dist/dockContext-spUj_-E5.js +9 -0
- package/dist/dom.js +6 -6
- package/dist/{dropdown-menu-naE0skDg.js → dropdown-menu-EFjl5iKo.js} +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/expandable-container.js +26 -20
- package/dist/fonts/README.md +21 -0
- package/dist/fonts/fraunces/fraunces-latin.woff2 +0 -0
- package/dist/forms.js +68 -59
- package/dist/glass-panel.js +1 -1
- package/dist/glass-ui.css +1 -1
- package/dist/glass-ui.js +226 -328
- package/dist/glyph-face.js +2 -2
- package/dist/goo-blob.d.ts +1 -0
- package/dist/goo-blob.js +538 -0
- package/dist/header-ribbon.js +2 -2
- package/dist/hover-card.js +1 -1
- package/dist/hover-popover.js +1 -1
- package/dist/icon-tooltip.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/instrument-chassis.js +1 -1
- package/dist/instrument-rail.js +1 -1
- package/dist/keys-BFoma9vm.js +9 -0
- package/dist/label.js +1 -1
- package/dist/labeled-field.js +57 -39
- package/dist/metric-badge.js +1 -1
- package/dist/motion-core.js +82 -123
- package/dist/motion.js +62 -14
- package/dist/number-field.js +1 -1
- package/dist/paper-backdrop.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/{presets-BpTf63Hp.js → presets-1OhFpaIC.js} +1 -1
- package/dist/prng-Bz_1Tydc.js +15 -0
- package/dist/progress.js +2 -2
- package/dist/reactive.js +2 -2
- package/dist/responsive-tabs.js +38 -32
- package/dist/scrolling-text.js +1 -1
- package/dist/search.js +8 -8
- package/dist/select.js +3 -3
- package/dist/separator.js +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-wx8ifVFB.js → slider-BOh8ycfZ.js} +7 -11
- package/dist/slider.js +1 -1
- package/dist/sortable-list.js +36 -38
- package/dist/stacked-icons.js +2 -2
- package/dist/styles/animations.css +1 -1
- package/dist/styles/cards.css +1 -1
- package/dist/styles/components.css +1 -1
- package/dist/styles/dock-controls.css +486 -0
- package/dist/styles/dock.css +284 -450
- package/dist/styles/fonts.css +25 -0
- package/dist/styles/glass-specular-track.css +154 -0
- package/dist/styles/glass.css +74 -2
- package/dist/styles/index.css +21 -2
- package/dist/styles/instrument-chassis.css +11 -4
- package/dist/styles/theme.css +73 -21
- package/dist/styles/tokens.css +271 -140
- package/dist/styles/typography.css +14 -8
- package/dist/styles/utilities.css +36 -8
- package/dist/styles/view-transition.css +10 -4
- package/dist/switch.js +1 -1
- package/dist/tabs.js +139 -112
- package/dist/timeline.js +219 -158
- package/dist/toast.js +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/{useAnimatedNumber-BOxrS3a6.js → useAnimatedNumber-BF6r64lA.js} +1 -1
- package/dist/useClipboard-D8vFyRCa.js +97 -0
- package/dist/{useConfiguratorState-Dq2gNv4A.js → useConfiguratorState-DUtC1jxr.js} +82 -86
- package/dist/useGlobalDark-CWiaCoEw.js +34 -0
- package/dist/useIntersectionPause-DAdVPVp4.js +53 -0
- package/dist/useSortable-DnyGXKKY.js +246 -0
- package/dist/{useTouchGate-XX8gHfay.js → useTouchGate-CS5Csc2h.js} +1 -1
- package/dist/utils/prng.d.ts +4 -0
- package/dist/vReveal-u2wSG2El.js +35 -0
- package/dist/watercolor-dot.d.ts +1 -0
- package/dist/watercolor-dot.js +129 -0
- package/package.json +101 -16
- package/src/fonts/README.md +21 -0
- package/src/fonts/fraunces/fraunces-latin.woff2 +0 -0
- package/src/styles/animations.css +1 -1
- package/src/styles/cards.css +1 -1
- package/src/styles/dock-controls.css +486 -0
- package/src/styles/dock.css +284 -450
- package/src/styles/fonts.css +25 -0
- package/src/styles/glass-specular-track.css +154 -0
- package/src/styles/glass.css +74 -2
- package/src/styles/index.css +21 -2
- package/src/styles/instrument-chassis.css +11 -4
- package/src/styles/theme.css +73 -21
- package/src/styles/tokens.css +271 -140
- package/src/styles/typography.css +14 -8
- package/src/styles/utilities.css +36 -8
- package/src/styles/view-transition.css +10 -4
- package/dist/DataTable-BsrDYdoE.js +0 -460
- package/dist/DialogContent-B61rP8lj.js +0 -93
- package/dist/HoverPopover-BlEwqG7S.js +0 -96
- package/dist/Input-IFsIzId2.js +0 -30
- package/dist/Progress-Bs44qWEM.js +0 -126
- package/dist/UnderlineTabs-B4FV2zi_.js +0 -37
- package/dist/components/custom/aurora/shaders/aurora.frag.d.ts +0 -1
- package/dist/composables/dom/useBreakpoint.d.ts +0 -38
- package/dist/composables/dom/useIdleReady.d.ts +0 -63
- package/dist/composables/dom/useViewportReady.d.ts +0 -87
- package/dist/composables/glass/webgl/frostShader.d.ts +0 -27
- package/dist/composables/motion/useAnimatedNumberMap.d.ts +0 -29
- package/dist/composables/motion/useStagger.d.ts +0 -50
- package/dist/dockContext-DM58L1Jt.js +0 -16
- package/dist/keys-SIKQYNx1.js +0 -11
- package/dist/supportsCssTimeline-IQY3gfKD.js +0 -12
- package/dist/useGlobalDark-BUUTZvkU.js +0 -24
- package/dist/useIdleReady-sLhGo6CL.js +0 -162
- package/dist/useIntersectionPause-CUmANkoc.js +0 -39
- package/dist/useSortable-DLK9kwZp.js +0 -189
- /package/dist/{HoverCardContent-DGUhpRVt.js → HoverCardContent-ICfIMZX1.js} +0 -0
- /package/dist/{InstrumentChassis-CqKPBNqp.js → InstrumentChassis-DaHIZCqy.js} +0 -0
- /package/dist/{InstrumentRail-CCjvKkpB.js → InstrumentRail-B0qqLFN0.js} +0 -0
- /package/dist/{Label-D53EOwLE.js → Label-CZk-3nTc.js} +0 -0
- /package/dist/{PaperBackdrop-Ds-wDsKf.js → PaperBackdrop-D_YZW47j.js} +0 -0
- /package/dist/{SelectGroup-DAgcsfFw.js → SelectGroup-CMdoCjRE.js} +0 -0
- /package/dist/{SelectSeparator-DN1jzLaI.js → SelectSeparator-CaJnPF3_.js} +0 -0
- /package/dist/{Separator-DXxac0j8.js → Separator-C2XtAXRp.js} +0 -0
- /package/dist/{Switch-imA0Hdjs.js → Switch-x8n6husW.js} +0 -0
- /package/dist/{Toaster-Brs6QjBU.js → Toaster-DdhMKfus.js} +0 -0
- /package/dist/{TooltipProvider-MZFRxOvT.js → TooltipProvider-D-JrSqDu.js} +0 -0
- /package/dist/components/custom/aurora/{renderMode.d.ts → constants/renderMode.d.ts} +0 -0
- /package/dist/components/custom/aurora/{shaders → constants/shaders}/aurora.vert.d.ts +0 -0
- /package/dist/{constants-DfWPi8kh.js → constants-DsCdlK9I.js} +0 -0
- /package/dist/{sheet-BnvZRXPq.js → sheet-CQYYrkr9.js} +0 -0
- /package/dist/{useGlassRenderer-C98tZnJ7.js → useGlassRenderer-Dn3WpfG-.js} +0 -0
- /package/dist/{useInterval-B58LmYth.js → useInterval-CHVYFpXV.js} +0 -0
- /package/dist/{useResizeObserver-C_7GjpRn.js → useResizeObserver-DX-STszm.js} +0 -0
- /package/dist/{useTextHighlight-CLST6an0.js → useTextHighlight-Dmtofpk2.js} +0 -0
- /package/dist/{useTimer-6FoosoDY.js → useTimer-DGgoxTXL.js} +0 -0
- /package/dist/{useUserInvalidAria-BW5iyqWR.js → useUserInvalidAria-DmvZ_6Dx.js} +0 -0
- /package/dist/{useViewTransition-CUJM7fXT.js → useViewTransition-D4ssvnXZ.js} +0 -0
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import type { BasicColorSchema } from "@vueuse/core";
|
|
2
|
+
export interface UseGlobalDarkOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The first-paint color scheme seed, threaded to `useDark({ initialValue })`.
|
|
5
|
+
* ONE-SHOT: only the FIRST `useGlobalDark()` call constructs the singleton, so
|
|
6
|
+
* only its `initialValue` is honored. A later call passing a CONFLICTING value
|
|
7
|
+
* THROWS (the misconfiguration is loud, not silently ignored); a matching
|
|
8
|
+
* re-seed is a no-op. Defaults to vueuse's `"auto"` (prefers-color-scheme).
|
|
9
|
+
* Pair with `darkModeSyncScript()` so the parse-time `<head>` script and this
|
|
10
|
+
* runtime seed agree.
|
|
11
|
+
*/
|
|
12
|
+
initialValue?: BasicColorSchema;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The single shared dark-mode instance. The first call may pass an
|
|
16
|
+
* `initialValue` seed (one-shot — see `UseGlobalDarkOptions`); subsequent calls
|
|
17
|
+
* receive the already-constructed singleton and their `initialValue` is ignored.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useGlobalDark(options?: UseGlobalDarkOptions): {
|
|
3
20
|
isDark: import("@vueuse/core").UseDarkReturn;
|
|
4
21
|
toggleDark: () => void;
|
|
5
22
|
disableTransitions: import("vue").Ref<boolean, boolean>;
|
|
@@ -2,8 +2,5 @@ export * from "./useResizeObserver";
|
|
|
2
2
|
export * from "./useTouchGate";
|
|
3
3
|
export * from "./useTokenColor";
|
|
4
4
|
export * from "./useClipboard";
|
|
5
|
-
export * from "./useViewportReady";
|
|
6
|
-
export * from "./useBreakpoint";
|
|
7
|
-
export * from "./useIdleReady";
|
|
8
5
|
export * from "./useUserInvalidAria";
|
|
9
6
|
export * from "./useTextHighlight";
|
|
@@ -1,34 +1,57 @@
|
|
|
1
1
|
import { type Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Why a copy did not succeed. `'clipboard-api'` — the async
|
|
4
|
+
* `navigator.clipboard.writeText` channel threw or rejected; `'exec-command'`
|
|
5
|
+
* — the legacy `document.execCommand("copy")` fallback returned/threw failure;
|
|
6
|
+
* `'no-api'` — neither channel exists in this environment (SSR / locked-down).
|
|
7
|
+
*/
|
|
8
|
+
export type CopyFailureReason = "clipboard-api" | "exec-command" | "no-api";
|
|
2
9
|
export interface UseClipboardOptions {
|
|
3
10
|
/** Milliseconds before `copied` auto-resets to `false` (default 1500). */
|
|
4
11
|
resetMs?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Called with the NAMED reason when a copy attempt fails on a given
|
|
14
|
+
* channel. Both the clipboard-API and exec-command arms report through this
|
|
15
|
+
* (the exec-command arm only after the clipboard-API arm has already
|
|
16
|
+
* failed). Surfaces the failure instead of swallowing it.
|
|
17
|
+
*/
|
|
18
|
+
onCopyError?: (reason: CopyFailureReason) => void;
|
|
19
|
+
}
|
|
20
|
+
/** Result of a composable `copy()` — the success flag plus, on failure, the
|
|
21
|
+
* named reason the copy did not land. */
|
|
22
|
+
export interface CopyResult {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
/** The failure channel when `ok` is false; `undefined` on success. */
|
|
25
|
+
reason?: CopyFailureReason;
|
|
5
26
|
}
|
|
6
27
|
export interface UseClipboardReturn {
|
|
7
28
|
/** Reactive flag—flips `true` on successful copy, auto-resets after `resetMs`. */
|
|
8
29
|
copied: Ref<boolean>;
|
|
9
|
-
/**
|
|
10
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Copy `text` to the clipboard. Resolves `{ ok }` on success or
|
|
32
|
+
* `{ ok: false, reason }` naming the channel that failed — the failure is
|
|
33
|
+
* REPORTED, never silently swallowed.
|
|
34
|
+
*/
|
|
35
|
+
copy: (text: string) => Promise<CopyResult>;
|
|
11
36
|
}
|
|
12
37
|
/**
|
|
13
38
|
* Bare clipboard copy—stateless `Promise<boolean>` return, no reactive `copied`
|
|
14
|
-
* flag.
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* The `resetMs` option is currently a no-op for the bare function (no reactive
|
|
20
|
-
* state to auto-reset); kept on the signature for forward-compatibility with
|
|
21
|
-
* future paired-callback hooks.
|
|
39
|
+
* flag. Use this when call sites manage their own confirmation state (e.g.
|
|
40
|
+
* hand-rolled `ref + setTimeout`) or in non-component contexts (utility
|
|
41
|
+
* modules, stores). A copy failure is reported through `options.onCopyError`
|
|
42
|
+
* (the boolean return stays the verbatim cross-repo signature).
|
|
22
43
|
*
|
|
23
44
|
* @example
|
|
24
45
|
* import { copyToClipboard } from "@mkbabb/glass-ui";
|
|
25
46
|
*
|
|
26
47
|
* async function shareLink(url: string) {
|
|
27
|
-
* const ok = await copyToClipboard(url
|
|
48
|
+
* const ok = await copyToClipboard(url, {
|
|
49
|
+
* onCopyError: (reason) => toast.show(`Copy failed: ${reason}`),
|
|
50
|
+
* });
|
|
28
51
|
* if (ok) toast.show("Link copied");
|
|
29
52
|
* }
|
|
30
53
|
*/
|
|
31
|
-
export declare function copyToClipboard(text: string,
|
|
54
|
+
export declare function copyToClipboard(text: string, options?: UseClipboardOptions): Promise<boolean>;
|
|
32
55
|
/**
|
|
33
56
|
* Reactive clipboard copy with auto-reset confirmation flag.
|
|
34
57
|
*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Scope-aware `document.visibilityState` leaf (AV.W14) — the single source for
|
|
4
|
+
* the `visibilitychange → document.hidden` pattern that the motion composables
|
|
5
|
+
* (`useRAFLoop`, `useIntersectionPause`) and the WebGL substrate hand-rolled
|
|
6
|
+
* four times over. Returns a `Ref<boolean>` `hidden` that flips on
|
|
7
|
+
* `visibilitychange`; SSR-safe (defaults `false` when `document` is absent) and
|
|
8
|
+
* self-disposing (the listener is removed on scope teardown).
|
|
9
|
+
*
|
|
10
|
+
* KISS: a per-call listener bound to the calling scope — NOT a global singleton.
|
|
11
|
+
* Each consumer's reactive `hidden` ref is independent, so a consumer's own
|
|
12
|
+
* pause policy (which `hidden`-true states it actually reacts to) is never
|
|
13
|
+
* fragmented by a shared global flag; the de-dup is the listener boilerplate +
|
|
14
|
+
* disposal, not the policy.
|
|
15
|
+
*/
|
|
16
|
+
export interface UseDocumentVisibilityReturn {
|
|
17
|
+
/** Reactive `document.hidden` — `false` under SSR / when the API is absent. */
|
|
18
|
+
hidden: Ref<boolean>;
|
|
19
|
+
}
|
|
20
|
+
export declare function useDocumentVisibility(): UseDocumentVisibilityReturn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared WebGL2 shader compile/link pair (AV.W14) — the single error-checked
|
|
3
|
+
* source the aurora GL setup (`glSetup.ts`) and the goo-blob renderer
|
|
4
|
+
* (`useMetaballRenderer.ts`) both build their program from. Each consumer was
|
|
5
|
+
* hand-rolling a byte-identical `compile`/`link` differing only in the error
|
|
6
|
+
* log prefix; the `label` parameter preserves that per-consumer diagnostic.
|
|
7
|
+
*
|
|
8
|
+
* On a compile/link failure the GL resource is deleted before the throw (so a
|
|
9
|
+
* caller that catches does not leak a dead shader/program), and the GPU info
|
|
10
|
+
* log is named in the message — the loud failure, not a silent draw of garbage.
|
|
11
|
+
*/
|
|
12
|
+
/** Compile a single shader; throws (and deletes the shader) on COMPILE_STATUS failure. */
|
|
13
|
+
export declare function compileShader(gl: WebGL2RenderingContext, type: number, src: string, label?: string): WebGLShader;
|
|
14
|
+
/** Link a vertex/fragment shader pair; throws (and deletes the program) on LINK_STATUS failure. */
|
|
15
|
+
export declare function linkProgram(gl: WebGL2RenderingContext, vs: WebGLShader, fs: WebGLShader, label?: string): WebGLProgram;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const OETF_GLSL = "\nfloat srgbToLinearCh(float c) {\n return c <= 0.04045 ? c / 12.92 : pow((c + 0.055) / 1.055, 2.4);\n}\nvec3 srgbToLinear(vec3 c) {\n return vec3(srgbToLinearCh(c.r), srgbToLinearCh(c.g), srgbToLinearCh(c.b));\n}\n\nfloat linearToSrgbCh(float c) {\n return c <= 0.0031308 ? c * 12.92 : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 linearToSrgb(vec3 c) {\n return vec3(linearToSrgbCh(c.r), linearToSrgbCh(c.g), linearToSrgbCh(c.b));\n}";
|
|
2
|
+
export declare const FBM_ROT_GLSL = "const mat2 FBM_ROT = mat2(0.8, 0.6, -0.6, 0.8);";
|
|
3
|
+
export declare const OKLCH_MATRICES_GLSL = "\n// value.js LINEAR_SRGB_TO_LMS (constants.ts), row-major; written here as GLSL\n// columns (= the transpose) so mat3 * vec3 evaluates the row-major M\u00B7v.\nconst mat3 LINEAR_SRGB_TO_LMS = mat3(\n 0.4122214708, 0.2119034982, 0.0883024619,\n 0.5363325363, 0.6806995451, 0.2817188376,\n 0.0514459929, 0.1073969566, 0.6299787005\n);\n\n// value.js srgbToOKLab's INLINE LMS\u2192OKLab coefficients (gamut.ts lines 295-297 \u2014\n// these differ at the ~1e-9 digit from LMS_TO_OKLAB_MATRIX; use the inline ones to\n// mirror the exact value.js path), row-major \u2192 GLSL columns.\nconst mat3 LMS_TO_OKLAB = mat3(\n 0.2104542553, 1.9779984951, 0.0259040371,\n 0.7936177850, -2.4285922050, 0.7827717662,\n -0.0040720468, 0.4505937099, -0.8086757660\n);\n\n// value.js OKLAB_TO_LMS_COEFF (constants.ts), row-major \u2192 GLSL columns. Rows:\n// l = [1, 0.3963377774, 0.2158037573], m = [1, -0.1055613458, -0.0638541728],\n// s = [1, -0.0894841775, -1.2914855480].\nconst mat3 OKLAB_TO_LMS = mat3(\n 1.0, 1.0, 1.0,\n 0.3963377774, -0.1055613458, -0.0894841775,\n 0.2158037573, -0.0638541728, -1.2914855480\n);\n\n// value.js LMS_TO_LINEAR_SRGB (constants.ts), row-major \u2192 GLSL columns.\nconst mat3 LMS_TO_LINEAR_SRGB = mat3(\n 4.0767416621, -1.2684380046, -0.0041960863,\n -3.3077115913, 2.6097574011, -0.7034186147,\n 0.2309699292, -0.3413193965, 1.7076147010\n);\n\n// Gamma sRGB \u2192 raw OKLab (L, a, b). Mirrors value.js srgbToOKLab.\nvec3 srgbToOklab(vec3 c) {\n vec3 lin = srgbToLinear(c);\n vec3 lms = LINEAR_SRGB_TO_LMS * lin;\n vec3 lmsCbrt = sign(lms) * pow(abs(lms), vec3(1.0 / 3.0));\n return LMS_TO_OKLAB * lmsCbrt;\n}\n\n// Raw OKLab (L, a, b) \u2192 linear sRGB. Mirrors value.js oklabToLinearSRGB.\nvec3 oklabToLinearSrgb(vec3 lab) {\n vec3 lms_ = OKLAB_TO_LMS * lab;\n vec3 lms = lms_ * lms_ * lms_;\n return LMS_TO_LINEAR_SRGB * lms;\n}\n\n// OKLab \u2192 OKLCh: H in RADIANS. Mirrors value.js rawOklabToOklch (which returns\n// degrees; we stay in radians and only fold to [0, 2pi)).\nvec3 oklabToOklch(vec3 lab) {\n float C = length(lab.yz);\n float H = atan(lab.z, lab.y);\n if (H < 0.0) H += 2.0 * PI;\n return vec3(lab.x, C, H);\n}\n\n// OKLCh (H radians) \u2192 OKLab. Mirrors value.js rawOklchToOklab.\nvec3 oklchToOklab(vec3 lch) {\n return vec3(lch.x, lch.y * cos(lch.z), lch.y * sin(lch.z));\n}";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type WebGLSuspendReason = "tab-hidden" | "off-screen" | "manual";
|
|
2
|
+
/** The per-frame hooks a consumer's `setup(gl)` returns. */
|
|
3
|
+
export interface WebGLCanvasFrame {
|
|
4
|
+
/** Draw one frame at `timeSec`. The consumer uploads its uniforms + draws. */
|
|
5
|
+
frame: (timeSec: number) => void;
|
|
6
|
+
/** Demand-gate: is there live motion to render next frame? `false` → park. */
|
|
7
|
+
shouldContinue: () => boolean;
|
|
8
|
+
/** Size the canvas + set the viewport. The consumer owns its DPR policy. */
|
|
9
|
+
resize: () => void;
|
|
10
|
+
/** Frame time from elapsed seconds — the consumer owns frozen/reduced-motion. */
|
|
11
|
+
time?: (elapsedSec: number) => number;
|
|
12
|
+
/** Delete GL resources (program/buffers/VAO). Runs on dispose + before a restore re-setup. */
|
|
13
|
+
teardown?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface WebGLCanvasOptions {
|
|
16
|
+
/** `getContext("webgl2", …)` attributes (the consumer's — e.g. premultiplied alpha). */
|
|
17
|
+
contextAttrs?: WebGLContextAttributes;
|
|
18
|
+
/** `"capture"` pre-seeds the `manual` suspension (renderAt-only). Default `"live"`. */
|
|
19
|
+
mode?: "live" | "capture";
|
|
20
|
+
/**
|
|
21
|
+
* Honor `prefers-reduced-motion: reduce` by painting ONE static frame then
|
|
22
|
+
* parking the loop (AV.W7 G1). The substrate live-monitors the query via a
|
|
23
|
+
* `matchMedia` `change` listener and re-arms (one static frame) on un-reduce.
|
|
24
|
+
* Default `true` for live mode, `false` for capture mode (a capture runtime
|
|
25
|
+
* draws deterministic frames via `renderAt`, never the live loop). A consumer
|
|
26
|
+
* reads the live value via `handle.reducedMotion` (e.g. aurora's frozen-t).
|
|
27
|
+
*/
|
|
28
|
+
respectReducedMotion?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Build the program + geometry on a fresh context. Called on `arm()` AND on
|
|
31
|
+
* every `webglcontextrestored`. Returns the per-frame hooks.
|
|
32
|
+
*/
|
|
33
|
+
setup: (gl: WebGL2RenderingContext) => WebGLCanvasFrame;
|
|
34
|
+
}
|
|
35
|
+
export interface WebGLCanvasHandle {
|
|
36
|
+
/** Run the expensive init (context + `setup` + arm the loop). Idempotent; no-op post-dispose. */
|
|
37
|
+
arm: () => void;
|
|
38
|
+
suspend: (reason?: WebGLSuspendReason) => void;
|
|
39
|
+
resume: (reason?: WebGLSuspendReason) => void;
|
|
40
|
+
/** Re-arm a parked loop (a setter that re-introduced motion calls this). */
|
|
41
|
+
wake: () => void;
|
|
42
|
+
/** Draw one frame at `timeSec` out-of-loop (capture / thumbnail). */
|
|
43
|
+
renderAt: (timeSec: number) => void;
|
|
44
|
+
dispose: () => void;
|
|
45
|
+
/** The live context (null before arm / after dispose / mid-loss). */
|
|
46
|
+
readonly gl: WebGL2RenderingContext | null;
|
|
47
|
+
/**
|
|
48
|
+
* The live `prefers-reduced-motion: reduce` state (AV.W7 G1). The substrate
|
|
49
|
+
* owns + re-monitors it; consumers read it (e.g. aurora freezes its frame
|
|
50
|
+
* time at the authored offset while this is `true`). `false` when
|
|
51
|
+
* `respectReducedMotion` is off.
|
|
52
|
+
*/
|
|
53
|
+
readonly reducedMotion: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare function createWebGLCanvas(canvas: HTMLCanvasElement, options: WebGLCanvasOptions): WebGLCanvasHandle;
|
|
@@ -3,7 +3,7 @@ export * from "../useStaggerReveal";
|
|
|
3
3
|
export * from "../useScrollProgress";
|
|
4
4
|
export * from "../useRAFLoop";
|
|
5
5
|
export * from "../useIntersectionPause";
|
|
6
|
-
export * from "../useStagger";
|
|
7
6
|
export * from "../useYieldToMain";
|
|
8
7
|
export * from "../usePrioritizedTask";
|
|
9
8
|
export * from "../useViewTransition";
|
|
9
|
+
export * from "../vReveal";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
export interface Countup {
|
|
3
|
+
/** Animate the count-ups inside the currently-active slide/region. */
|
|
4
|
+
runActive: () => void;
|
|
5
|
+
/** Snap EVERY `[data-countup]` in the document to its end value (still capture). */
|
|
6
|
+
settle: () => void;
|
|
7
|
+
/** Cancel every in-flight tween (also runs on scope-dispose). */
|
|
8
|
+
cancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface UseCountupOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Easing applied to tween progress — a value.js-FREE callable
|
|
13
|
+
* `(p: number) => number` over `[0, 1]`. A callable keeps the
|
|
14
|
+
* `NumericAnimation` engine off the value.js boundary (a string name would
|
|
15
|
+
* dynamic-import the value.js easing registry).
|
|
16
|
+
*/
|
|
17
|
+
easeFn: (p: number) => number;
|
|
18
|
+
/** When it returns true, `runActive` is a no-op (e.g. export/print mode). */
|
|
19
|
+
skip?: () => boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Walk `[data-countup]` figures under `hostRef` and tween each from 0 → target.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const { runActive, settle } = useCountup(deckRef, { easeFn: (p) => p });
|
|
26
|
+
* // on slide-activate: runActive();
|
|
27
|
+
* // on still-capture: settle();
|
|
28
|
+
*/
|
|
29
|
+
export declare function useCountup(hostRef: Ref<HTMLElement | null>, opts: UseCountupOptions): Countup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TimingFunction
|
|
1
|
+
import type { TimingFunction } from "@mkbabb/keyframes.js";
|
|
2
2
|
export type SpringSnapshot<K extends string> = Record<K, number>;
|
|
3
3
|
export interface UseNumericTransitionOptions<K extends string> {
|
|
4
4
|
/** Named numeric endpoints to interpolate between. */
|
|
@@ -6,8 +6,19 @@ export interface UseNumericTransitionOptions<K extends string> {
|
|
|
6
6
|
to: SpringSnapshot<K>;
|
|
7
7
|
/** Playback duration in ms. */
|
|
8
8
|
duration: number;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* keyframes.js timing function — an explicit callable `(t) => number`.
|
|
11
|
+
*
|
|
12
|
+
* AW.W27: this is a CALLABLE `TimingFunction`, NOT a string easing name.
|
|
13
|
+
* keyframes 4 removed string-name acceptance from `NumericAnimationOptions`
|
|
14
|
+
* (a name now resolves only through the ASYNC `resolveEasing`, which crosses
|
|
15
|
+
* the value.js dynamic boundary the dock/motion light surface must never
|
|
16
|
+
* pull in). Narrowing glass-ui's public option to a callable decouples it
|
|
17
|
+
* from keyframes' name-resolution churn AND is assignable to every supported
|
|
18
|
+
* keyframes major (2.2 / 3 / 4). A consumer wanting a named curve passes the
|
|
19
|
+
* function directly (e.g. `(t) => 1 - Math.pow(1 - t, 3)` for easeOutCubic).
|
|
20
|
+
*/
|
|
21
|
+
timingFunction?: TimingFunction;
|
|
11
22
|
/** Per-frame consumer. Receives the same zero-allocation record each tick. */
|
|
12
23
|
onFrame?: (values: SpringSnapshot<K>) => void;
|
|
13
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Ref, MaybeRefOrGetter } from "vue";
|
|
1
|
+
import type { Ref, MaybeRefOrGetter, ComputedRef } from "vue";
|
|
2
2
|
import type { TreeNode, TreeIndexEntry, SidebarSection, SidebarState } from "./types";
|
|
3
3
|
export interface UseSidebarStateOptions<T extends TreeNode = SidebarSection> {
|
|
4
4
|
sections: T[];
|
|
@@ -26,7 +26,7 @@ export interface UseSidebarStateOptions<T extends TreeNode = SidebarSection> {
|
|
|
26
26
|
export interface GenericSidebarState<T extends TreeNode> {
|
|
27
27
|
sections: T[];
|
|
28
28
|
activeId: Ref<string | null>;
|
|
29
|
-
activeRootId:
|
|
29
|
+
activeRootId: ComputedRef<string | null>;
|
|
30
30
|
treeIndex: Map<string, TreeIndexEntry<T>>;
|
|
31
31
|
isExpanded(id: string): boolean;
|
|
32
32
|
toggleSection(id: string): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sortable drag-state controller — the drag lifecycle + cross-list routing.
|
|
3
|
+
*
|
|
4
|
+
* Owns the live drag state (`dragId` / `pos` / `dropIndex` / `pointerCaptureActive`)
|
|
5
|
+
* and the `beginDrag` → `onPointerMove` → `onPointerUp` → `endDrag` lifecycle. It
|
|
6
|
+
* composes the leaf services: the ghost renderer (visual clone), the drop resolver
|
|
7
|
+
* (collision/measure + cross-list lookup), and the touch gate (handle constraint +
|
|
8
|
+
* pointer-capture optimization). Same-list reorders and foreign-list transfers are
|
|
9
|
+
* both routed here through the unified resolver.
|
|
10
|
+
*/
|
|
11
|
+
import { type ShallowRef } from "vue";
|
|
12
|
+
import type { InstanceHandle, SortableId } from "./types";
|
|
13
|
+
import type { GhostRenderer } from "./ghostRenderer";
|
|
14
|
+
export interface DragControllerDeps {
|
|
15
|
+
/** Live items array accessor (the reactive source-of-truth). */
|
|
16
|
+
getItems: () => readonly unknown[];
|
|
17
|
+
getId: (item: unknown) => SortableId;
|
|
18
|
+
/** Per-id element cache, shared with the row registry. */
|
|
19
|
+
elements: Map<SortableId, Element | null>;
|
|
20
|
+
/** This instance's registry handle (for cross-list lookups). */
|
|
21
|
+
handle: InstanceHandle;
|
|
22
|
+
onReorder: (next: unknown[]) => void;
|
|
23
|
+
/** Horizontal-axis drop resolution (`axis === "x"`). */
|
|
24
|
+
horizontal: boolean;
|
|
25
|
+
ghost: GhostRenderer;
|
|
26
|
+
}
|
|
27
|
+
export interface DragController {
|
|
28
|
+
/** Live id of the dragged row, or null. */
|
|
29
|
+
dragId: ShallowRef<SortableId | null>;
|
|
30
|
+
/** Live pointer position in page coordinates, or null. */
|
|
31
|
+
pos: ShallowRef<{
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
} | null>;
|
|
35
|
+
/** Resolved local drop index, or null. */
|
|
36
|
+
dropIndex: ShallowRef<number | null>;
|
|
37
|
+
/** Whether the active drag holds a pointer capture. */
|
|
38
|
+
pointerCaptureActive: ShallowRef<boolean>;
|
|
39
|
+
/** Start a drag for the row `id` from the pointerdown event `e`. */
|
|
40
|
+
beginDrag: (id: SortableId, e: PointerEvent) => void;
|
|
41
|
+
/** Tear down an in-flight drag (also the defensive scope-dispose path). */
|
|
42
|
+
endDrag: () => void;
|
|
43
|
+
}
|
|
44
|
+
export declare function createDragController(deps: DragControllerDeps): DragController;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sortable drop resolution — pure collision/measure math over the elements map.
|
|
3
|
+
*
|
|
4
|
+
* No DOM mutation: these read row bounding rects and resolve an insertion index.
|
|
5
|
+
* Walking registered row elements via the elements map (rather than subscribing
|
|
6
|
+
* to each row's box reactively) keeps the cost at O(rows) per pointermove frame
|
|
7
|
+
* and avoids a layout-thrash storm.
|
|
8
|
+
*
|
|
9
|
+
* The module-level instance registry lives here too — it is the cross-list
|
|
10
|
+
* resolution home: `findForeignTarget` hit-tests sibling instances in the same
|
|
11
|
+
* group, unifying the local-drop vs foreign-drop index math behind one resolver.
|
|
12
|
+
*/
|
|
13
|
+
import type { InstanceHandle, SortableId } from "./types";
|
|
14
|
+
/**
|
|
15
|
+
* Every live `useSortable` instance registers here for cross-list lookups. On
|
|
16
|
+
* drag move, the source instance looks up any other instance in the same group
|
|
17
|
+
* whose container contains the cursor, and transfers the drop target to it.
|
|
18
|
+
* Entries are removed on scope dispose.
|
|
19
|
+
*/
|
|
20
|
+
export declare const instances: Set<InstanceHandle>;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve an insertion index by walking the registered row elements and finding
|
|
23
|
+
* the first row whose axis midpoint is past the cursor. Returns `list.length`
|
|
24
|
+
* (drop at end) when the cursor is past every row.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveDropIndexIn(elMap: Map<SortableId, Element | null>, list: readonly {
|
|
27
|
+
id: SortableId;
|
|
28
|
+
}[], clientX: number, clientY: number, horizontal: boolean): number;
|
|
29
|
+
/**
|
|
30
|
+
* Find a sibling instance in the same group whose container bounds contain the
|
|
31
|
+
* cursor — the foreign drop target. Returns null when the source has no group or
|
|
32
|
+
* the cursor is over no sibling.
|
|
33
|
+
*/
|
|
34
|
+
export declare function findForeignTarget(sourceHandle: InstanceHandle, clientX: number, clientY: number): InstanceHandle | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sortable drag ghost — the snap-physics + visual clone of the grabbed row.
|
|
3
|
+
*
|
|
4
|
+
* The ghost is a fixed-position DOM clone of the source row, positioned under the
|
|
5
|
+
* grab point so it tracks the cursor rather than teleporting. The clone inherits
|
|
6
|
+
* scoped `data-v-*` attributes + classes so stylesheet selectors continue to
|
|
7
|
+
* match, giving a pixel-faithful preview without any per-consumer markup.
|
|
8
|
+
*
|
|
9
|
+
* `createGhostRenderer()` returns the stateful trio (`createGhost` / `updateGhost`
|
|
10
|
+
* / `destroyGhost`) closing over the live ghost element + its cursor offset.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* True when a computed `border-radius` string has any non-zero corner. Computed
|
|
14
|
+
* values resolve to space-separated lengths (e.g. `"0px"`, `"6px"`, `"12px 12px
|
|
15
|
+
* 0px 0px"`) with an optional `/` separating the horizontal/vertical radii of
|
|
16
|
+
* elliptical corners. A radius is "zero" only when every numeric component parses
|
|
17
|
+
* to 0; a non-length token (`%`, `auto`) counts as non-zero so we never miss a
|
|
18
|
+
* rounded corner.
|
|
19
|
+
*
|
|
20
|
+
* Exported (and re-exported from `useSortable`) for the D9 drag-ring regression
|
|
21
|
+
* test — keep it a pure string predicate.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isNonZeroRadius(radius: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the effective VISIBLE corner radius for the dragged content. Returns
|
|
26
|
+
* the source's own computed `border-radius` when it is non-zero; otherwise walks
|
|
27
|
+
* descendants depth-first and returns the first element's non-zero radius (the
|
|
28
|
+
* common case where the SortableItem root is unrounded and the rounded surface
|
|
29
|
+
* lives on an inner child). Returns `null` when nothing in the subtree is rounded
|
|
30
|
+
* — caller leaves the ghost radius untouched.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveVisibleRadius(source: HTMLElement): string | null;
|
|
33
|
+
export interface GhostRenderer {
|
|
34
|
+
/**
|
|
35
|
+
* Build the drag ghost by cloning the source row's DOM and positioning a
|
|
36
|
+
* fixed copy at its current bounding rect.
|
|
37
|
+
*/
|
|
38
|
+
createGhost: (source: HTMLElement, clientX: number, clientY: number) => void;
|
|
39
|
+
/** Track the ghost under the cursor at its captured grab offset. */
|
|
40
|
+
updateGhost: (clientX: number, clientY: number) => void;
|
|
41
|
+
/** Remove the ghost from the document. */
|
|
42
|
+
destroyGhost: () => void;
|
|
43
|
+
}
|
|
44
|
+
export declare function createGhostRenderer(): GhostRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useSortable, type UseSortableReturn, type SortableId
|
|
1
|
+
export { useSortable, type UseSortableReturn, type SortableId } from "./useSortable";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sortable touch-gesture resolver + pointer-capture optimization.
|
|
3
|
+
*
|
|
4
|
+
* `targetIsHandle` gates whether a pointerdown starts a drag (the grip
|
|
5
|
+
* constraint). `acquirePointerCapture` is the optimization layer: a successful
|
|
6
|
+
* `setPointerCapture` routes move/up events to the captured element, but it is
|
|
7
|
+
* NOT the drag's primary path — the document `pointermove`/`pointerup` listeners
|
|
8
|
+
* carry the drag unconditionally (AV.W1.1b). Capture failure is SURFACED (not
|
|
9
|
+
* swallowed) via the returned boolean + a once-per-process dev warning, so a
|
|
10
|
+
* consumer can observe the degraded-but-correct path.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* True when the pointerdown target satisfies the grip constraint. `null` selector
|
|
14
|
+
* allows drag from anywhere on the row; otherwise the target must be (or descend
|
|
15
|
+
* from) an element matching the selector.
|
|
16
|
+
*/
|
|
17
|
+
export declare function targetIsHandle(target: EventTarget | null, handleSelector: string | null): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Attempt the `setPointerCapture` optimization on the pointerdown host. Returns
|
|
20
|
+
* the resulting `pointerCaptureActive` state: `true` when a capture is held (or
|
|
21
|
+
* when the host has no `setPointerCapture` method at all — no degradation to
|
|
22
|
+
* signal), `false` ONLY when the method is present but THREW — in which case the
|
|
23
|
+
* drag still runs on the document listeners (the unconditional primary path) and
|
|
24
|
+
* the failure is dev-warned once.
|
|
25
|
+
*/
|
|
26
|
+
export declare function acquirePointerCapture(host: Element | null, pointerId: number): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sortable visual-transition timing — the drop-target class grammar.
|
|
3
|
+
*
|
|
4
|
+
* Owns the drop-hint class names and the single-row insertion-line resolution:
|
|
5
|
+
* exactly ONE class at most per row (never both), so the user sees one insertion
|
|
6
|
+
* line instead of a doubled pair at adjacent edges. The drag-state controller
|
|
7
|
+
* drives these; the row binding reflects them as a reactive class object.
|
|
8
|
+
*/
|
|
9
|
+
import type { SortableId } from "./types";
|
|
10
|
+
export declare const DROP_ABOVE_CLASS = "is-sortable-drop-above";
|
|
11
|
+
export declare const DROP_BELOW_CLASS = "is-sortable-drop-below";
|
|
12
|
+
export declare const DRAG_GHOST_CLASS = "sortable-drag-ghost";
|
|
13
|
+
export declare const SOURCE_DRAGGING_CLASS = "is-sortable-dragging";
|
|
14
|
+
/**
|
|
15
|
+
* Drop-target class flags for a single row under a given drop index. ONE class at
|
|
16
|
+
* most — never both — so the user sees exactly one insertion line.
|
|
17
|
+
*
|
|
18
|
+
* Insertion-line convention:
|
|
19
|
+
* drop === 0 → top of row 0 (DROP_ABOVE on row 0)
|
|
20
|
+
* drop === k (middle) → top of row k (DROP_ABOVE on row k)
|
|
21
|
+
* drop === length → bottom of last row (DROP_BELOW on last)
|
|
22
|
+
*
|
|
23
|
+
* Two rows adjacent to the insertion line sharing the line visually equals one
|
|
24
|
+
* drawn border (not two) — picking a single row eliminates the prior "doubled
|
|
25
|
+
* and wrong" appearance.
|
|
26
|
+
*
|
|
27
|
+
* `rowIndex` is the row's current index in the list; pass `< 0` (not found) to
|
|
28
|
+
* receive the all-false result.
|
|
29
|
+
*/
|
|
30
|
+
export declare function flagsFor(rowIndex: number, drop: number, listLength: number): {
|
|
31
|
+
above: boolean;
|
|
32
|
+
below: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Compose the reactive drop-target class object for a row from the live local +
|
|
36
|
+
* external drop indices. Local and external are mutually exclusive in practice —
|
|
37
|
+
* either this instance owns the drag or a sibling does — but both are honored so a
|
|
38
|
+
* stale value can never double-paint.
|
|
39
|
+
*/
|
|
40
|
+
export declare function computeDropClasses(args: {
|
|
41
|
+
rowIndex: number;
|
|
42
|
+
listLength: number;
|
|
43
|
+
/** Local same-list drop index, or null when this instance is not dragging. */
|
|
44
|
+
localDrop: number | null;
|
|
45
|
+
/** True while this instance owns an active drag. */
|
|
46
|
+
isLocalDragging: boolean;
|
|
47
|
+
/** External (foreign-source) drop index set via the registry, or null. */
|
|
48
|
+
externalDrop: number | null;
|
|
49
|
+
}): Record<string, boolean>;
|
|
50
|
+
export type { SortableId };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sortable shared types — the contract surface the controller + services share.
|
|
3
|
+
*
|
|
4
|
+
* Kept in one leaf module so the five cohesive services + the `useSortable`
|
|
5
|
+
* orchestrator import the same definitions without a circular edge. The public
|
|
6
|
+
* `useSortable` / `UseSortableReturn` / `SortableId` surface is re-exported
|
|
7
|
+
* unchanged from `useSortable.ts` (the consumer contract is byte-identical).
|
|
8
|
+
*/
|
|
9
|
+
import type { ComputedRef, Ref } from "vue";
|
|
10
|
+
/**
|
|
11
|
+
* Identifier type for sortable rows. Must be stable across reorders (e.g. a
|
|
12
|
+
* record id, not a positional index).
|
|
13
|
+
*/
|
|
14
|
+
export type SortableId = string | number;
|
|
15
|
+
export interface SortableOptions<T> {
|
|
16
|
+
/** The reactive array being reordered. */
|
|
17
|
+
items: Ref<readonly T[]> | ComputedRef<readonly T[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Extract a stable id from an item. The id is used both as the drop-target
|
|
20
|
+
* key (via `data-sortable-id`) and as the row registration key. Two items
|
|
21
|
+
* with the same id in the same list is undefined behavior.
|
|
22
|
+
*/
|
|
23
|
+
getId: (item: T) => SortableId;
|
|
24
|
+
/**
|
|
25
|
+
* Called once per successful same-list drop with the full reordered array.
|
|
26
|
+
* Also called with the post-removal array when an item is transferred OUT to
|
|
27
|
+
* another list in the same group.
|
|
28
|
+
*/
|
|
29
|
+
onReorder: (next: T[]) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Cross-list group id. Instances that share a group id accept drops from each
|
|
32
|
+
* other. Undefined (the default) isolates this instance — drags stay within
|
|
33
|
+
* the same list.
|
|
34
|
+
*/
|
|
35
|
+
group?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Called when a foreign item is dropped into this list. The consumer is
|
|
38
|
+
* responsible for the insert (typically by calling its own onReorder
|
|
39
|
+
* counterpart to mutate the source-of-truth). The item type is `unknown`
|
|
40
|
+
* because the source list may own a different T — the group id is the only
|
|
41
|
+
* contract that asserts compatibility.
|
|
42
|
+
*/
|
|
43
|
+
onInsert?: (index: number, item: unknown) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Optional grip constraint. When set, drag only starts if the pointerdown
|
|
46
|
+
* target is (or is a descendant of) an element matching this selector.
|
|
47
|
+
* Defaults to `[data-sortable-handle]` — the selector that <SortableHandle>
|
|
48
|
+
* emits. Pass `null` to allow drag from anywhere on the row.
|
|
49
|
+
*/
|
|
50
|
+
handleSelector?: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Axis constraint for drop resolution. `"y"` uses row midpoint Y (vertical
|
|
53
|
+
* list), `"x"` uses row midpoint X (horizontal list). Default: `"y"`.
|
|
54
|
+
*/
|
|
55
|
+
axis?: "x" | "y";
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Handlers + attrs to spread on a row element. `SortableList` calls
|
|
59
|
+
* `registerItem(id)` once per row and forwards these via a `v-bind` on the row's
|
|
60
|
+
* root.
|
|
61
|
+
*/
|
|
62
|
+
export interface SortableRowBinding {
|
|
63
|
+
/** Template ref callback. Spread on the row's root element via `:ref`. */
|
|
64
|
+
ref: (el: Element | null) => void;
|
|
65
|
+
/** Data attribute set — includes `data-sortable-id`. */
|
|
66
|
+
dataAttrs: Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Reactive class object — carries the drop-target hint classes
|
|
69
|
+
* (`is-sortable-drop-above` / `-below`) when this row is the live drop target
|
|
70
|
+
* during a drag.
|
|
71
|
+
*/
|
|
72
|
+
class: ComputedRef<Record<string, boolean>>;
|
|
73
|
+
/** Pointerdown handler — spread as `@pointerdown`. */
|
|
74
|
+
onPointerdown: (e: PointerEvent) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Container binding — spread on the list's root element so the composable can
|
|
78
|
+
* hit-test it during cross-list drags.
|
|
79
|
+
*/
|
|
80
|
+
export interface SortableContainerBinding {
|
|
81
|
+
ref: (el: Element | null) => void;
|
|
82
|
+
dataAttrs: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
export interface UseSortableReturn {
|
|
85
|
+
/**
|
|
86
|
+
* Register a row by its stable id. Returns the binding object the row should
|
|
87
|
+
* spread on its root element. Idempotent — calling with the same id returns
|
|
88
|
+
* the same binding so Vue's `v-bind` stays stable across rerenders.
|
|
89
|
+
*/
|
|
90
|
+
registerItem: (id: SortableId) => SortableRowBinding;
|
|
91
|
+
/**
|
|
92
|
+
* Binding to spread on the list's container element. Marks it as a drop
|
|
93
|
+
* target for cross-list drags in the same group and exposes the container
|
|
94
|
+
* bounding rect for hit testing.
|
|
95
|
+
*/
|
|
96
|
+
container: SortableContainerBinding;
|
|
97
|
+
/** True while a drag is in progress. */
|
|
98
|
+
isDragging: ComputedRef<boolean>;
|
|
99
|
+
/** Id of the row currently being dragged, or null. */
|
|
100
|
+
dragId: ComputedRef<SortableId | null>;
|
|
101
|
+
/** Live pointer position in page coordinates while a drag is in progress. */
|
|
102
|
+
dragPosition: ComputedRef<{
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
} | null>;
|
|
106
|
+
/** Index the drop will land at, or null when no target. */
|
|
107
|
+
dropIndex: ComputedRef<number | null>;
|
|
108
|
+
/**
|
|
109
|
+
* `true` while the active drag holds a pointer capture; `false` when the
|
|
110
|
+
* `setPointerCapture` optimization was unavailable and the drag is running on
|
|
111
|
+
* the document `pointermove`/`pointerup` listeners alone (still fully
|
|
112
|
+
* functional). Surfaced so a consumer can observe the degraded-but-correct
|
|
113
|
+
* path instead of it being an invisible swallow.
|
|
114
|
+
*/
|
|
115
|
+
pointerCaptureActive: ComputedRef<boolean>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Module-level registry entry for a live `useSortable` instance. Used for
|
|
119
|
+
* cross-list drop resolution — on drag move, the source instance looks up any
|
|
120
|
+
* other instance in the same group whose container contains the cursor, and
|
|
121
|
+
* transfers the drop target to it.
|
|
122
|
+
*/
|
|
123
|
+
export interface InstanceHandle {
|
|
124
|
+
group?: string;
|
|
125
|
+
getContainer: () => Element | null;
|
|
126
|
+
getItems: () => readonly unknown[];
|
|
127
|
+
getId: (item: unknown) => SortableId;
|
|
128
|
+
getElements: () => Map<SortableId, Element | null>;
|
|
129
|
+
setExternalDropIndex: (index: number | null) => void;
|
|
130
|
+
acceptExternal: (index: number, item: unknown) => void;
|
|
131
|
+
/** The target insertion index at drop time (set by pointermove). */
|
|
132
|
+
getExternalDropIndex?: () => number | null;
|
|
133
|
+
}
|