@mkbabb/glass-ui 3.1.1 → 3.3.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-CSGcJkqa.js → CardFooter-C390imy7.js} +3 -3
- package/dist/{CollapsibleContent-CVMOcYlV.js → CollapsibleContent-cauTbZEM.js} +1 -1
- package/dist/{CommandShortcut-DWT19a2Y.js → CommandShortcut-BiVyqipe.js} +7 -6
- package/dist/{ContextMenuSubContent-gAFxJ-qi.js → ContextMenuSubContent-DrWkXKQP.js} +4 -4
- package/dist/DataTable-FfkaAg2z.js +465 -0
- package/dist/DialogContent-IQ8_BRrC.js +100 -0
- package/dist/{DialogFooter-ClrNEOVU.js → DialogFooter-Er0wA3K6.js} +2 -2
- package/dist/{DiscoGlyph-C3JfMnRV.js → DiscoGlyph-BaZ8OawK.js} +1 -1
- package/dist/{GlyphFace-BRS8vUb7.js → GlyphFace-B_7vOmYn.js} +1 -1
- package/dist/HoverPopover-DTSYkJtw.js +96 -0
- package/dist/{IconTooltip-BkaA7tZ2.js → IconTooltip-BTyYn4mr.js} +1 -1
- package/dist/Input-CU9CNKmo.js +52 -0
- package/dist/{MetricBadge-DmAihkXd.js → MetricBadge-BlrdbOGN.js} +2 -2
- package/dist/{Notification-OqIpADml.js → Notification-DP_ApJLo.js} +3 -3
- package/dist/{NumberFieldContent-DTH9gb_N.js → NumberFieldContent-iOTQ5rGO.js} +9 -5
- package/dist/{PopoverContent-EiklFrna.js → PopoverContent-B8WtJECb.js} +1 -1
- package/dist/Progress-DjM86vfb.js +254 -0
- package/dist/{ScrollingText-BFd0i2zJ.js → ScrollingText-P9o_DuMn.js} +2 -2
- package/dist/{SelectScrollDownButton-Dth8-wXQ.js → SelectScrollDownButton-BGn3rjs9.js} +12 -11
- package/dist/TabsIndicator-DA0x9gPr.js +97 -0
- package/dist/{Toaster-Bjlunvq4.js → Toaster-DdhMKfus.js} +1 -1
- package/dist/{ToggleGroupItem-OesUouE7.js → ToggleGroupItem-gyXj998A.js} +37 -40
- package/dist/UnderlineTabs-Cq_AD03t.js +39 -0
- package/dist/animated-digit.js +3 -3
- package/dist/api/index.d.ts +2 -0
- package/dist/api.js +1 -1
- package/dist/aurora.js +471 -320
- package/dist/badge.js +1 -1
- package/dist/{button-C0aHmBbt.js → button-Ckn3eDfB.js} +27 -22
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.js +6 -6
- package/dist/{check-dwgetki8.js → check-CdkxGxXJ.js} +1 -1
- package/dist/{chevron-down-DILQA1t6.js → chevron-down-pBY8sYfV.js} +1 -1
- package/dist/{chevron-right-fS7fal2t.js → chevron-right-BjeKC22V.js} +1 -1
- package/dist/{chevron-up-BtYjYQOS.js → chevron-up-DBeNHUm1.js} +1 -1
- 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 +42 -16
- 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} +3 -6
- 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 +4 -3
- package/dist/components/custom/configurator/Configurator.vue.d.ts +26 -0
- 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/configurator/index.d.ts +1 -1
- package/dist/components/custom/dock/DockBackgroundToggle.vue.d.ts +46 -0
- package/dist/components/custom/dock/DockIconButton.vue.d.ts +15 -4
- package/dist/components/custom/dock/DockLayerGroup.vue.d.ts +2 -2
- package/dist/components/custom/dock/GlassDock.vue.d.ts +34 -13
- 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 +1 -3
- package/dist/composables/dom/useClipboard.d.ts +35 -12
- package/dist/composables/dom/useDocumentVisibility.d.ts +20 -0
- package/dist/composables/dom/useTextHighlight.d.ts +40 -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 +2 -1
- package/dist/composables/motion/index.d.ts +1 -1
- package/dist/composables/motion/useCountup.d.ts +29 -0
- package/dist/composables/motion/usePrioritizedTask.d.ts +41 -0
- 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 -140
- package/dist/configurator.js +1 -1
- package/dist/confirm-dialog.js +3 -3
- package/dist/context-menu.js +2 -2
- package/dist/controls.js +5 -5
- 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 +2 -2
- package/dist/disco-glyph.js +1 -1
- package/dist/dock.js +410 -254
- package/dist/dockContext-spUj_-E5.js +9 -0
- package/dist/dom.js +6 -5
- package/dist/{dropdown-menu-BvRUamNs.js → dropdown-menu-EFjl5iKo.js} +4 -4
- package/dist/dropdown-menu.js +1 -1
- package/dist/expandable-container.js +28 -22
- package/dist/fonts/README.md +21 -0
- package/dist/fonts/fraunces/fraunces-latin.woff2 +0 -0
- package/dist/forms.js +70 -61
- package/dist/glass-carousel.js +59 -52
- package/dist/glass-panel.js +2 -2
- package/dist/glass-ui.css +1 -1
- package/dist/glass-ui.js +159 -254
- 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 +3 -3
- 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/keyboard.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/metric-stack.js +1 -1
- package/dist/{minimize-2-LsCJ_eNt.js → minimize-2-BP27-qBY.js} +1 -1
- package/dist/motion-core.js +154 -135
- package/dist/motion.js +63 -15
- package/dist/notification.js +1 -1
- package/dist/number-field.js +1 -1
- package/dist/paper-backdrop.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/{presets-a-D93K1S.js → presets-1OhFpaIC.js} +5 -5
- package/dist/prng-Bz_1Tydc.js +15 -0
- package/dist/progress.js +2 -2
- package/dist/pulse.js +1 -1
- package/dist/reactive.js +2 -2
- package/dist/responsive-tabs.js +38 -32
- package/dist/scrolling-text.js +1 -1
- package/dist/{search-DBAiUABx.js → search-DBG8qaRs.js} +1 -1
- package/dist/search.js +153 -149
- package/dist/select.js +3 -3
- package/dist/separator.js +1 -1
- package/dist/{sheet-CukNDezz.js → sheet-CQYYrkr9.js} +3 -3
- package/dist/sheet.js +1 -1
- package/dist/{slider-DJvHkTRe.js → slider-BOh8ycfZ.js} +8 -12
- package/dist/slider.js +1 -1
- package/dist/sortable-list.js +37 -39
- 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 +45 -0
- package/dist/styles/dock-controls.css +486 -0
- package/dist/styles/dock.css +325 -431
- 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 +25 -2
- package/dist/styles/instrument-chassis.css +11 -4
- package/dist/styles/theme.css +73 -21
- package/dist/styles/tokens.css +282 -140
- package/dist/styles/typography.css +14 -8
- package/dist/styles/utilities.css +92 -8
- package/dist/styles/view-transition.css +10 -4
- package/dist/switch.js +1 -1
- package/dist/tabs.js +148 -106
- package/dist/timeline.js +220 -159
- 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/typewriter.js +1 -1
- package/dist/{useAnimatedNumber-DKQYVB7s.js → useAnimatedNumber-BF6r64lA.js} +1 -1
- package/dist/useClipboard-D8vFyRCa.js +97 -0
- package/dist/useConfiguratorState-DUtC1jxr.js +276 -0
- package/dist/useGlobalDark-CWiaCoEw.js +34 -0
- package/dist/useIntersectionPause-DAdVPVp4.js +53 -0
- package/dist/useSortable-DnyGXKKY.js +246 -0
- package/dist/useTextHighlight-Dmtofpk2.js +72 -0
- package/dist/{useTouchGate-D9Zvrzyc.js → useTouchGate-CS5Csc2h.js} +1 -1
- package/dist/{useViewTransition-DYIK6Gzb.js → useViewTransition-D4ssvnXZ.js} +5 -3
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/platformSupport.d.ts +8 -0
- 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/dist/{x-q7pJa83X.js → x-C4pz9nbD.js} +1 -1
- package/package.json +110 -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 +325 -431
- 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 +282 -140
- package/src/styles/typography.css +14 -8
- package/src/styles/utilities.css +92 -8
- package/src/styles/view-transition.css +10 -4
- package/dist/DataTable-R8-Zidms.js +0 -460
- package/dist/DialogContent-2fALDSvc.js +0 -93
- package/dist/HoverPopover-CWFCfLx3.js +0 -96
- package/dist/Input-DDpFn568.js +0 -30
- package/dist/Progress-FApA9fm_.js +0 -126
- package/dist/UnderlineTabs-DAWMLmJG.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-D5NZCWJs.js +0 -16
- package/dist/keys-CaTQS-vx.js +0 -11
- package/dist/useConfiguratorState-CtRBE0m_.js +0 -268
- package/dist/useGlobalDark-B0WvLJE3.js +0 -24
- package/dist/useIdleReady-Cmkhm03v.js +0 -162
- package/dist/useIntersectionPause-IY2CwPQb.js +0 -39
- package/dist/useSortable-Cq2Y1JLO.js +0 -175
- /package/dist/{ContextMenuContent-otjFIu8v.js → ContextMenuContent-De01_83g.js} +0 -0
- /package/dist/{HoverCardContent-DaGrgJBO.js → HoverCardContent-ICfIMZX1.js} +0 -0
- /package/dist/{InstrumentChassis-CnHTMxds.js → InstrumentChassis-DaHIZCqy.js} +0 -0
- /package/dist/{InstrumentRail-C6dEbi8E.js → InstrumentRail-B0qqLFN0.js} +0 -0
- /package/dist/{Label-DJty89bp.js → Label-CZk-3nTc.js} +0 -0
- /package/dist/{ModalOverlay-iWiAgbYH.js → ModalOverlay-B_CBtqcE.js} +0 -0
- /package/dist/{PaperBackdrop-CeZ-w0R0.js → PaperBackdrop-D_YZW47j.js} +0 -0
- /package/dist/{SelectGroup-DdR4tdDY.js → SelectGroup-CMdoCjRE.js} +0 -0
- /package/dist/{SelectSeparator-CXm_hlqA.js → SelectSeparator-CaJnPF3_.js} +0 -0
- /package/dist/{Separator-D8AUMhxY.js → Separator-C2XtAXRp.js} +0 -0
- /package/dist/{Switch-Cr1t_F_U.js → Switch-x8n6husW.js} +0 -0
- /package/dist/{TooltipProvider-DE78vbEP.js → TooltipProvider-D-JrSqDu.js} +0 -0
- /package/dist/{_plugin-vue_export-helper-Dq1MygBL.js → _plugin-vue_export-helper-C1je1s0u.js} +0 -0
- /package/dist/{badge-x46my_Fo.js → badge-Cl6JZ1B7.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-DwBwnG8N.js → constants-DsCdlK9I.js} +0 -0
- /package/dist/{createLucideIcon-Bn9a1b70.js → createLucideIcon-DuDoe_ra.js} +0 -0
- /package/dist/{menuItemVariants-BsbGNq9C.js → menuItemVariants-C2QlXqT3.js} +0 -0
- /package/dist/{useGlassRenderer-Ds-nmrGz.js → useGlassRenderer-Dn3WpfG-.js} +0 -0
- /package/dist/{useInterval-DVgGUf_y.js → useInterval-CHVYFpXV.js} +0 -0
- /package/dist/{useKeyboardShortcuts-Dpw_RUcB.js → useKeyboardShortcuts-BQfnAHHW.js} +0 -0
- /package/dist/{useResizeObserver-Cg9npuM3.js → useResizeObserver-DX-STszm.js} +0 -0
- /package/dist/{useSpringMount-Cfk1XK1R.js → useSpringMount-CnizvZGm.js} +0 -0
- /package/dist/{useTimer-NAaj9zNq.js → useTimer-DGgoxTXL.js} +0 -0
- /package/dist/{useUserInvalidAria-DVu1eTXG.js → useUserInvalidAria-DmvZ_6Dx.js} +0 -0
package/dist/aurora.js
CHANGED
|
@@ -1,191 +1,365 @@
|
|
|
1
|
-
import { t as e } from "./_plugin-vue_export-helper-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
var v = "#version 300 es\nin vec2 aPos;\nout vec2 vUv;\nvoid main() {\n vUv = aPos * 0.5 + 0.5;\n gl_Position = vec4(aPos, 0.0, 1.0);\n}", y = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\n#define MAX_NUCLEI 6\n#define MAX_STOPS 8\n\n// ── Uniforms ───────────────────────────────────────────────────────────────\nuniform float uTime;\n\n// Palette baked CPU-side to linear-sRGB\nuniform vec3 uPalette[MAX_STOPS];\nuniform int uStopCount;\n\n// Nuclei (parallel arrays)\nuniform int uNucleiCount;\nuniform vec2 uNucleiPos[MAX_NUCLEI];\nuniform float uNucleiRadius[MAX_NUCLEI];\nuniform float uNucleiPaletteBias[MAX_NUCLEI];\nuniform float uNucleiValueBias[MAX_NUCLEI];\nuniform float uNucleiDriftRadius[MAX_NUCLEI];\nuniform float uNucleiDriftPhase[MAX_NUCLEI];\n// Anisotropy: per-nucleus elongation (1.0 = isotropic) and major-axis angle (radians).\n// Defaults (1.0 / 0.0) reduce to the original circular Gaussian.\nuniform float uNucleiElong[MAX_NUCLEI];\nuniform float uNucleiAngle[MAX_NUCLEI];\nuniform float uSoftmaxBeta;\nuniform float uValueVariance;\n\n// Warp\nuniform float uWarpAmount;\nuniform float uWarpScale;\nuniform float uWarpDrift;\nuniform int uWarpMode; // 0=fbm 1=cellular 2=hybrid\nuniform int uNoiseOctaves;\n\n// Medium\n// 0 smooth, 1 pastel, 2 watercolor, 3 oil\nuniform int uMedium;\nuniform int uFlowPattern; // 0 none, 1 radial, 2 swirl, 3 diagonal, 4 multi\nuniform vec2 uFlowFocal;\nuniform float uFlowAngle;\nuniform float uFlowCurl;\nuniform vec2 uCursor; // in 0..1 screen space (matches pN)\nuniform float uCursorStrength; // 0..1 attraction amount\nuniform float uCursorRadius; // radius of influence (0.05..0.5)\nuniform float uStrokeAmount;\nuniform float uStrokeScale;\nuniform float uStrokeAnisotropy;\nuniform int uStrokeLayers; // 1 or 2 (crosshatch)\nuniform int uStrokeMode; // 0 oil (modern gestural), 1 palette-knife, 2 crayon/oil-pastel, 3 modern-chunky\nuniform float uWetEdge;\nuniform float uGranulation;\nuniform float uImpasto;\nuniform float uBrokenColor;\nuniform float uCanvasGrain;\n\n// Motion\nuniform float uNucleiDrift;\nuniform float uPaletteDrift;\nuniform float uBreathDepth;\nuniform float uBreathPeriod;\n\n// Output\nuniform float uSaturation;\nuniform float uPaperGrain;\nuniform float uAlpha;\n\n// ── Noise ──────────────────────────────────────────────────────────────────\nfloat hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\n\nvec2 hash22(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)),\n dot(p, vec2(269.5, 183.3)));\n return fract(sin(p) * 43758.5453);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float a = hash21(i);\n float b = hash21(i + vec2(1.0, 0.0));\n float c = hash21(i + vec2(0.0, 1.0));\n float d = hash21(i + vec2(1.0, 1.0));\n return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);\n}\n\nfloat fbm(vec2 p) {\n float v = 0.0;\n float a = 0.5;\n mat2 r = mat2(0.8, 0.6, -0.6, 0.8);\n for (int i = 0; i < 5; i++) {\n if (i >= uNoiseOctaves) break;\n v += a * vnoise(p);\n p = r * p * 2.02;\n a *= 0.5;\n }\n return v;\n}\n\n// Cellular / Worley f1\nfloat cellular(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n float m = 1e9;\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec2 g = vec2(float(x), float(y));\n vec2 o = hash22(i + g);\n vec2 r = g + o - f;\n m = min(m, dot(r, r));\n }\n }\n return sqrt(m);\n}\n\n// ── Warp ──────────────────────────────────────────────────────────────────\nvec2 domainWarp(vec2 p, float t) {\n // Quilez canonical double warp\n vec2 q = vec2(fbm(p * uWarpScale + vec2(0.0, 0.0) + t * uWarpDrift),\n fbm(p * uWarpScale + vec2(5.2, 1.3) + t * uWarpDrift));\n vec2 r = vec2(fbm(p * uWarpScale + 4.0 * q + vec2(1.7, 9.2)),\n fbm(p * uWarpScale + 4.0 * q + vec2(8.3, 2.8)));\n\n vec2 warp = r;\n if (uWarpMode == 1) {\n // cellular — chunky territories (MEADOW block-like)\n float c1 = cellular(p * uWarpScale * 1.5 + vec2(t * uWarpDrift * 2.0, 0.0));\n float c2 = cellular(p * uWarpScale * 1.5 + vec2(11.0, 7.0 + t * uWarpDrift * 2.0));\n warp = vec2(c1, c2);\n } else if (uWarpMode == 2) {\n // hybrid — fbm + cellular averaged\n float c1 = cellular(p * uWarpScale * 1.2);\n float c2 = cellular(p * uWarpScale * 1.2 + vec2(11.0, 7.0));\n warp = mix(r, vec2(c1, c2), 0.5);\n }\n vec2 warped = p + uWarpAmount * warp;\n\n // Cursor swirl — rotate p around uCursor with radial falloff.\n // This warps the underlying color field so the bands sweep around the pointer.\n if (uCursorStrength > 0.001) {\n vec2 toP = p - uCursor;\n float d = length(toP);\n float r = max(uCursorRadius, 0.01);\n // Smooth falloff; strong near cursor, zero beyond ~1.5× radius.\n float w = exp(-(d * d) / (r * r * 0.45));\n // Max rotation ~120° at cursor center, scaled by strength\n float ang = w * uCursorStrength * 2.1;\n float ca = cos(ang), sa = sin(ang);\n vec2 rotated = vec2(ca * toP.x - sa * toP.y, sa * toP.x + ca * toP.y) + uCursor;\n // Also pinch slightly toward the cursor (gravity) — adds depth to swirl\n float pinch = w * uCursorStrength * 0.08;\n rotated = mix(rotated, uCursor, pinch);\n // Blend original warped position with cursor-rotated version\n warped = mix(warped, rotated + uWarpAmount * warp * 0.7, w * uCursorStrength);\n }\n\n return warped;\n}\n\n// ── Palette LUT ───────────────────────────────────────────────────────────\nvec3 samplePalette(float id) {\n id = clamp(id, 0.0, 1.0);\n float scaled = id * float(uStopCount - 1);\n int i0 = int(floor(scaled));\n int i1 = min(i0 + 1, uStopCount - 1);\n float t = fract(scaled);\n t = smoothstep(0.0, 1.0, t);\n return mix(uPalette[i0], uPalette[i1], t);\n}\n\n// ── Nuclei field ──────────────────────────────────────────────────────────\nvoid nucleiField(vec2 p, float t, out float paletteId, out float valueMod) {\n float accumBias = 0.0;\n float accumValue = 0.0;\n float accumW = 0.0;\n for (int i = 0; i < MAX_NUCLEI; i++) {\n if (i >= uNucleiCount) break;\n vec2 posI = uNucleiPos[i]\n + uNucleiDriftRadius[i] * vec2(\n cos(t * uNucleiDrift + uNucleiDriftPhase[i]),\n sin(t * uNucleiDrift + uNucleiDriftPhase[i] * 1.13)\n );\n vec2 diff = p - posI;\n // Anisotropic Gaussian: rotate diff into the nucleus's local frame\n // (major axis along uNucleiAngle), then scale the major-axis component by\n // 1/elongation so the squared distance describes an ellipse. Defaults\n // 1.0/0.0 reduce to the isotropic dot(diff, diff).\n float ca = cos(uNucleiAngle[i]);\n float sa = sin(uNucleiAngle[i]);\n vec2 local = vec2( ca * diff.x + sa * diff.y,\n -sa * diff.x + ca * diff.y);\n float along = local.x / max(uNucleiElong[i], 0.01);\n float across = local.y;\n float d2 = along * along + across * across;\n float r = max(uNucleiRadius[i], 0.01);\n float w = exp(-uSoftmaxBeta * d2 / (r * r));\n accumBias += w * uNucleiPaletteBias[i];\n accumValue += w * uNucleiValueBias[i];\n accumW += w;\n }\n paletteId = accumBias / max(accumW, 1e-4);\n valueMod = accumValue / max(accumW, 1e-4);\n\n // Palette drift — subtle global paletteId shift\n paletteId += 0.04 * sin(t * uPaletteDrift * 6.2831) * uPaletteDrift * 20.0;\n paletteId = clamp(paletteId, 0.0, 1.0);\n}\n\n// ── Flow field ────────────────────────────────────────────────────────────\nvec2 flowField(vec2 p, float t) {\n vec2 dir = vec2(1.0, 0.0);\n if (uFlowPattern == 1) {\n // radial\n dir = normalize(p - uFlowFocal + 1e-4);\n } else if (uFlowPattern == 2) {\n // swirl — tangent to radial\n vec2 rad = normalize(p - uFlowFocal + 1e-4);\n dir = vec2(-rad.y, rad.x);\n } else if (uFlowPattern == 3) {\n // diagonal\n float a = radians(uFlowAngle);\n dir = vec2(cos(a), sin(a));\n } else if (uFlowPattern == 4) {\n // multi — curl-noise driven\n float n = fbm(p * 2.0 + t * 0.02);\n float a = n * 6.2831;\n dir = vec2(cos(a), sin(a));\n }\n // curl — perturb by noise. Radial gets much less curl so rays stay clean.\n if (uFlowCurl > 0.0) {\n float n = fbm(p * 3.0) - 0.5;\n float curlAmt = uFlowCurl;\n if (uFlowPattern == 1) curlAmt *= 0.25; // radial: preserve ray clarity\n if (uFlowPattern == 2) curlAmt *= 0.55; // swirl: allow moderate curl\n float a = atan(dir.y, dir.x) + n * 3.14159 * curlAmt;\n dir = vec2(cos(a), sin(a));\n }\n // cursor influence — swirl around the cursor position\n if (uCursorStrength > 0.001) {\n vec2 toCur = uCursor - p;\n float d = length(toCur);\n float r = max(uCursorRadius, 0.01);\n float w = exp(-(d * d) / (r * r * 0.5));\n // swirl tangent\n vec2 tangent = vec2(-toCur.y, toCur.x) / max(d, 1e-4);\n float a0 = atan(dir.y, dir.x);\n float a1 = atan(tangent.y, tangent.x);\n // blend angle\n float da = a1 - a0;\n da = atan(sin(da), cos(da)); // wrap to [-pi, pi]\n float a = a0 + da * w * uCursorStrength;\n dir = vec2(cos(a), sin(a));\n }\n return dir;\n}\n\n// ── Color utils ───────────────────────────────────────────────────────────\nconst vec3 W_LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 hueShift(vec3 c, float degrees) {\n float a = radians(degrees);\n float co = cos(a), si = sin(a);\n mat3 m = mat3(\n 0.299 + 0.701 * co + 0.168 * si,\n 0.587 - 0.587 * co + 0.330 * si,\n 0.114 - 0.114 * co - 0.497 * si,\n\n 0.299 - 0.299 * co - 0.328 * si,\n 0.587 + 0.413 * co + 0.035 * si,\n 0.114 - 0.114 * co + 0.292 * si,\n\n 0.299 - 0.300 * co + 1.250 * si,\n 0.587 - 0.588 * co - 1.050 * si,\n 0.114 + 0.886 * co - 0.203 * si\n );\n return m * c;\n}\n\nvec3 brokenColorJitter(vec3 c, float hueSeed, float valueSeed, float strength) {\n float amt = clamp(uBrokenColor * strength, 0.0, 1.0);\n if (amt <= 0.001) return c;\n float hueDeg = (hueSeed - 0.5) * 32.0 * amt;\n float valueMul = 1.0 + (valueSeed - 0.5) * 0.28 * amt;\n return max(hueShift(c, hueDeg) * valueMul, vec3(0.0));\n}\n\nvec3 saturate3(vec3 c, float amt) {\n float l = dot(c, W_LUMA);\n return mix(vec3(l), c, amt);\n}\n\n// ACES approximation\nvec3 aces(vec3 x) {\n float a = 2.51;\n float b = 0.03;\n float c = 2.43;\n float d = 0.59;\n float e = 0.14;\n return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);\n}\n\n// ── Medium overlays ───────────────────────────────────────────────────────\n\n// A quick re-computation of base color for edge-mask sampling\nvec3 sampleBase(vec2 p, float t) {\n vec2 pw = domainWarp(p, t);\n float id; float vm;\n nucleiField(pw, t, id, vm);\n vec3 c = samplePalette(id);\n c *= 1.0 + uValueVariance * vm;\n return c;\n}\n\nvec3 mediumWatercolor(vec3 col, vec2 p, float t) {\n // Wet-edge cauliflowers via luma-gradient magnitude\n float eps = 0.004;\n vec3 cx1 = sampleBase(p + vec2(eps, 0.0), t);\n vec3 cx2 = sampleBase(p - vec2(eps, 0.0), t);\n vec3 cy1 = sampleBase(p + vec2(0.0, eps), t);\n vec3 cy2 = sampleBase(p - vec2(0.0, eps), t);\n float gx = dot(cx1 - cx2, W_LUMA);\n float gy = dot(cy1 - cy2, W_LUMA);\n float edge = sqrt(gx * gx + gy * gy) / (2.0 * eps);\n float mask = smoothstep(0.0, 2.5, edge);\n col *= mix(1.0, 0.78, mask * uWetEdge);\n\n // Granulation — pigment settles in paper tooth\n float paper = 0.5 * vnoise(p * 160.0) + 0.5 * vnoise(p * 360.0);\n float pigLoad = 1.0 - dot(col, W_LUMA);\n col *= 1.0 - uGranulation * pigLoad * (paper - 0.5);\n\n // Wash banding — faint horizontal wet gradient\n float band = fbm(vec2(p.x * 1.5, p.y * 0.4));\n col *= 1.0 + 0.04 * (band - 0.5);\n return col;\n}\n\nvec3 mediumPastel(vec3 col, vec2 p, float t) {\n vec2 flow = flowField(p, t);\n vec2 perp = vec2(-flow.y, flow.x);\n float along = dot(p, flow) * uStrokeScale;\n float across = dot(p, perp) * uStrokeScale;\n across += 0.03 * (vnoise(p * 260.0) - 0.5);\n\n float aniso = mix(1.0, 0.18, uStrokeAnisotropy);\n float stroke = fbm(vec2(along * aniso, across));\n col *= mix(1.0, 0.82 + 0.32 * stroke, uStrokeAmount);\n\n // Pastel tooth — tiny high-frequency grain\n float tooth = vnoise(p * 800.0);\n col *= 1.0 - 0.08 * uStrokeAmount * (tooth - 0.5);\n return col;\n}\n\n// ── Curved swept brushstroke primitive ────────────────────────────────────\n// A stroke is a curved spine from A to B with quadratic bulge K (sideways offset\n// at midpoint). Width varies along length via a shape profile. Edge is ragged\n// (bristle-modulated), ends are rounded blobs, inside has streak modulation.\n//\n// For pixel p, we invert an approximate projection onto the curved spine:\n// 1) project p onto straight AB axis -> along0, cross0\n// 2) at parameter along0, spine offset = 4·K·along0·(1-along0) perpendicular\n// 3) cross = cross0 - spineOffset, refine along one iteration\n// Coverage blends paint atop col based on per-stroke color sampled from the\n// underlying base at spine midpoint — so overlapping strokes from different\n// palette regions meet at hard, ragged demarcations.\n\nstruct StrokeHit {\n float coverage; // 0..1\n vec3 color;\n float alongT; // 0..1 along spine, for internal modulation\n float crossN; // cross distance / current half-width, signed\n float edgeN; // distance to edge in half-widths (0 = at edge, 1 = at spine)\n};\n\nStrokeHit noHit() { return StrokeHit(0.0, vec3(0.0), 0.0, 0.0, 0.0); }\n\nvec2 rotateDir(vec2 dir, float angle) {\n float ca = cos(angle), sa = sin(angle);\n return vec2(dir.x * ca - dir.y * sa, dir.x * sa + dir.y * ca);\n}\n\nvec2 safeDir(vec2 dir) {\n float len = length(dir);\n return len > 1e-4 ? dir / len : vec2(1.0, 0.0);\n}\n\n// Shape profile along the stroke. type:\n// 0 tapered — thin-fat-thin (classic brush)\n// 1 load-drag — fat start, tapers to a point\n// 2 dab — ellipse-like, round center\n// 3 even — near-constant, slight end taper\nfloat strokeShape(float t, int type) {\n t = clamp(t, 0.0, 1.0);\n if (type == 1) {\n // loaded at t=0, tapering\n return pow(1.0 - t, 0.55) * smoothstep(0.0, 0.08, t);\n } else if (type == 2) {\n // dab / blob\n float d = t - 0.5;\n return exp(-d * d * 12.0);\n } else if (type == 3) {\n // mostly even, slight end softening\n return smoothstep(0.0, 0.08, t) * smoothstep(1.0, 0.92, t) * 0.95 + 0.05;\n }\n // 0 tapered\n return smoothstep(0.0, 0.22, t) * smoothstep(1.0, 0.78, t);\n}\n\n// A single curved stroke.\n// a, b — endpoints\n// halfW — base half-width (world units)\n// bulge — signed perpendicular midpoint offset, in world units\n// shapeType — 0..3\n// bristleFreq — spatial frequency of edge raggedness\n// bristleAmp — 0..0.5 fraction of halfW chewed away at edge extrema\n// streakSeed — uniqueness seed for internal streaks\n// colAtMid — pre-sampled color at midpoint\nStrokeHit curvedStroke(vec2 p, vec2 a, vec2 b, float halfW,\n float bulge, int shapeType,\n float bristleFreq, float bristleAmp,\n float streakSeed, vec3 colAtMid) {\n vec2 ab = b - a;\n float L = length(ab);\n if (L < 1e-5) return noHit();\n vec2 tang = ab / L;\n vec2 norm = vec2(-tang.y, tang.x);\n\n vec2 rel = p - a;\n float along0 = dot(rel, tang) / L; // straight projection 0..1 along AB\n float cross0 = dot(rel, norm); // signed cross\n\n // Spine sideways offset due to bulge (parabolic)\n float bend = 4.0 * bulge * along0 * (1.0 - along0);\n float cross1 = cross0 - bend;\n\n // One refinement step: as the spine bends, the closest-point along shifts.\n // Spine tangent differs from straight tangent; first-order correction:\n float dBend = 4.0 * bulge * (1.0 - 2.0 * along0); // d(bend)/d(along)\n float along1 = along0 + (cross1 * dBend) / (L * (1.0 + dBend * dBend / (L * L)));\n\n // Bristle-ragged edge: half-width gets chewed by 1D noise along the spine\n float edgeNoise = fbm(vec2(along1 * bristleFreq, streakSeed * 7.3)) - 0.5;\n float edgeNoise2 = fbm(vec2(along1 * bristleFreq * 2.3, streakSeed * 3.1 + 17.0)) - 0.5;\n float edgeMod = 1.0 - bristleAmp * (0.6 + 0.4 * edgeNoise) * (0.5 + edgeNoise2);\n\n // Width profile along the stroke\n float shape = strokeShape(along1, shapeType);\n float halfWNow = halfW * shape * edgeMod;\n\n // Inside-segment coverage\n float cov = 0.0;\n if (along1 >= 0.0 && along1 <= 1.0 && halfWNow > 1e-6) {\n float cn = abs(cross1) / halfWNow;\n // razor-hard edge with tiny aa\n cov = 1.0 - smoothstep(0.88, 1.02, cn);\n }\n\n // End-cap blobs (rounded tips, not perpendicular cuts)\n float capA = 0.0, capB = 0.0;\n {\n vec2 capCenterA = a + norm * (bulge * 0.0); // at a\n vec2 capCenterB = a + tang * L + norm * bend * 0.0 + norm * 0.0; // at b; bend is 0 at endpoints\n capCenterB = b;\n float endShapeA = strokeShape(0.02, shapeType);\n float endShapeB = strokeShape(0.98, shapeType);\n float rA = halfW * endShapeA * (0.9 + 0.2 * fbm(vec2(streakSeed * 13.0)));\n float rB = halfW * endShapeB * (0.9 + 0.2 * fbm(vec2(streakSeed * 19.0 + 5.0)));\n float dA = length(p - capCenterA);\n float dB = length(p - capCenterB);\n capA = 1.0 - smoothstep(rA * 0.85, rA * 1.05, dA);\n capB = 1.0 - smoothstep(rB * 0.85, rB * 1.05, dB);\n // Only apply caps if we're BEYOND the segment; otherwise the segment wins.\n capA *= (along1 < 0.05) ? 1.0 : 0.0;\n capB *= (along1 > 0.95) ? 1.0 : 0.0;\n }\n\n float coverage = max(cov, max(capA, capB));\n if (coverage < 0.002) return noHit();\n\n // Edge distance (for impasto later): 0 at edge, 1 at spine\n float edgeDist = halfWNow > 1e-6 ? clamp(1.0 - abs(cross1) / halfWNow, 0.0, 1.0) : 0.0;\n\n return StrokeHit(\n coverage,\n colAtMid,\n clamp(along1, 0.0, 1.0),\n halfWNow > 1e-6 ? cross1 / halfWNow : 0.0,\n edgeDist\n );\n}\n\n// Composite stroke over col with internal streaking + impasto edge highlight.\n// streakAmp — 0..0.2 how much internal streaks darken/lighten\n// impastoAmp — 0..1 edge catch-light strength\n// hardness — 0..1 how crisp the compositing transition is (1 = razor, 0 = creamy)\nvoid paintOver(inout vec3 col, StrokeHit s, float streakFreq, float streakAmp,\n float impastoAmp, float hardness, float streakSeed) {\n if (s.coverage < 0.002) return;\n float strokeOpacity = clamp(uStrokeAmount, 0.0, 1.0);\n if (strokeOpacity <= 0.001) return;\n vec3 c = s.color;\n\n // Internal streaks — fbm along spine, modulated by cross position. Gives\n // the loaded-brush look: some bristles carry more pigment than others.\n float streakA = fbm(vec2(s.alongT * streakFreq, s.crossN * 2.7 + streakSeed));\n float streakB = fbm(vec2(s.alongT * streakFreq * 0.6 + streakSeed * 3.7, s.crossN * 4.1));\n float streak = 0.6 * (streakA - 0.5) + 0.4 * (streakB - 0.5);\n c *= 1.0 + streak * streakAmp * 2.0;\n\n // Subtle value variance across width (hollow-center catch-light)\n float crossShade = smoothstep(0.0, 0.4, s.edgeN) * (1.0 - smoothstep(0.65, 1.0, s.edgeN));\n c *= 1.0 + crossShade * 0.05;\n\n // Impasto edge highlight — bright rim on one side of the stroke\n float rim = smoothstep(0.85, 1.0, 1.0 - s.edgeN) * step(0.0, s.crossN);\n c += impastoAmp * rim * vec3(0.18, 0.15, 0.11);\n // Shadow on the other side (darker, cooler)\n float shadow = smoothstep(0.85, 1.0, 1.0 - s.edgeN) * step(0.0, -s.crossN);\n c -= impastoAmp * shadow * 0.25 * vec3(0.10, 0.09, 0.07);\n\n float softLimit = mix(0.35, 0.98, hardness);\n float alpha = smoothstep(0.0, 1.0 - softLimit, s.coverage) * strokeOpacity;\n col = mix(col, c, alpha);\n}\n\n// Best-of-9-neighbor placement: sample 3x3 surrounding cells and take the\n// stroke that covers this pixel most. Breaks the grid by per-cell jitter and\n// sparse density via noise thresholding.\nStrokeHit bestOil(vec2 p, float cellSize, float lenMul, float halfWMul,\n float jitterAmt, float density, int shapeType,\n float bristleAmp, vec2 flow, float t, float seed) {\n vec2 cell = floor(p / cellSize);\n\n StrokeHit best = noHit();\n // 3x3 neighborhood\n for (int dy = -1; dy <= 1; dy++) {\n for (int dx = -1; dx <= 1; dx++) {\n vec2 cc = cell + vec2(float(dx), float(dy));\n vec2 hh = hash22(cc + seed) - 0.5;\n // Density gate — noise threshold; sparse placement.\n float gate = hash21(cc * 1.7 + seed * 0.3);\n if (gate > density) continue;\n\n vec2 center = (cc + 0.5 + hh * jitterAmt) * cellSize;\n\n // Per-stroke direction: consume the layer-provided flow, then add only\n // deterministic local perturbation so alternate stroke layers stay live.\n vec2 f = safeDir(flow);\n float angJ = (hash21(cc + seed + 11.0) - 0.5) * 0.9; // +/- 0.45 rad\n float localCurl = (fbm(center * (2.6 + seed * 0.11) + seed * 1.9) - 0.5) * 0.55 * uFlowCurl;\n vec2 dir = rotateDir(f, angJ + localCurl);\n\n float lenV = cellSize * lenMul * (0.65 + 0.55 * hash21(cc + seed + 23.0));\n float halfW = cellSize * halfWMul * (0.70 + 0.55 * hash21(cc + seed + 41.0));\n float bulge = (hash21(cc + seed + 53.0) - 0.5) * lenV * 0.35;\n\n vec2 a = center - dir * (lenV * 0.5);\n vec2 b = center + dir * (lenV * 0.5);\n\n vec3 colMid = brokenColorJitter(\n sampleBase(center, t),\n hash21(cc + seed + 89.0),\n hash21(cc * 2.3 + seed + 97.0),\n 1.0\n );\n\n StrokeHit h = curvedStroke(p, a, b, halfW, bulge, shapeType,\n 7.0, bristleAmp,\n hash21(cc + seed + 67.0), colMid);\n if (h.coverage > best.coverage) best = h;\n }\n }\n return best;\n}\n\n// ── Crayon / oil-pastel — paper tooth × wax pigment ───────────────────────\n// Crayon is not strokes. It's pigment crumbs dragged across paper tooth.\n// Model: heavy 2D tooth noise at multiple scales, anisotropically stretched\n// along flow direction, multiplied into the base color. Add a slow \"waxy\n// film\" that slightly unifies hues, and occasional darker \"pressed\" spots\n// where the crayon dug in. NO straight segments.\nvec3 mediumOil_crayon(vec3 col, vec2 p, float t) {\n vec2 flow = flowField(p, t);\n float ang = atan(flow.y, flow.x);\n float ca = cos(-ang), sa = sin(-ang);\n vec2 pr = vec2(p.x * ca - p.y * sa, p.x * sa + p.y * ca);\n\n // Anisotropic tooth — squished along flow, coarse cross flow.\n float aniso = mix(0.45, 0.95, uStrokeAnisotropy);\n float scale = max(uStrokeScale * 1.6, 180.0);\n\n float t1 = vnoise(vec2(pr.x * scale * aniso, pr.y * scale));\n float t2 = vnoise(vec2(pr.x * scale * aniso * 0.4, pr.y * scale * 0.4) + 11.0);\n float t3 = vnoise(vec2(pr.x * scale * aniso * 2.1, pr.y * scale * 2.1) + 23.0);\n float tooth = 0.55 * t1 + 0.30 * t2 + 0.15 * t3;\n // Center at 0, amplify\n tooth = (tooth - 0.5) * 1.4;\n\n // Multiplicative darkening where tooth is low (pigment skipped paper valleys)\n float lay = 1.0 + tooth * 0.32 * uStrokeAmount;\n vec3 result = col * lay;\n\n // Occasional pressed-in crumbs — rare darker crumbs\n float crumbs = smoothstep(0.78, 0.95, vnoise(pr * scale * 3.0));\n result *= 1.0 - crumbs * 0.18 * uStrokeAmount;\n\n // Waxy highlight film — slight lightening on tooth peaks\n float waxy = smoothstep(0.55, 0.85, t1);\n result += waxy * 0.04 * vec3(1.0);\n\n // Paper tooth overlay (subtler than oil's canvas)\n float paperTooth = vnoise(p * 340.0) - 0.5;\n result *= 1.0 + paperTooth * 0.14 * uCanvasGrain;\n\n // Broken-color pigment: stable wax/pigment patches, not temporal flicker.\n vec2 pigmentCell = floor(pr * max(scale * 0.18, 32.0));\n float pigmentMask = smoothstep(0.28, 0.82, vnoise(pr * scale * 0.21 + 19.0));\n result = brokenColorJitter(\n result,\n hash21(pigmentCell + 17.0),\n hash21(pigmentCell * 2.1 + 31.0),\n 0.45 + 0.55 * pigmentMask\n );\n\n // Crayon is saturation-amplified\n result = saturate3(result, 1.12);\n\n return result;\n}\n\nvec3 mediumOil(vec3 col, vec2 p, float t) {\n // Mode knobs (uStrokeMode):\n // 0 oil — balanced modern-abstract/palette-knife hybrid\n // 1 knife — palette-knife impasto: razor edges, heavy bristle/shadow\n // 2 crayon — soft-edged wax smudges on tooth (no straight segments)\n // 3 brushwork — thick bristle brush\n int mode = uStrokeMode;\n\n // Per-mode parameters\n int shapeType = 0; // tapered\n float bristleAmp = 0.25; // 0..0.5\n float streakFreq = 9.0;\n float streakAmp = 0.09;\n float impastoAmp = 0.9;\n float hardness = 0.80; // edge compositing\n float toothScale = 240.0;\n float toothAmp = 0.09;\n float pigmentSat = 1.03;\n float densityBig = 0.65;\n float densityMed = 0.78;\n float densitySml = 0.90;\n\n if (mode == 1) { // palette knife\n shapeType = 3; // flat, even\n bristleAmp = 0.12;\n streakFreq = 4.0; streakAmp = 0.05;\n impastoAmp = 1.6;\n hardness = 0.95;\n toothAmp = 0.04;\n densityBig = 0.80; densityMed = 0.88; densitySml = 0.70;\n } else if (mode == 2) { // crayon — handled specially below\n return mediumOil_crayon(col, p, t);\n } else if (mode == 3) { // thick brushwork\n shapeType = 0; // tapered\n bristleAmp = 0.32;\n streakFreq = 14.0; streakAmp = 0.14;\n impastoAmp = 1.2;\n hardness = 0.85;\n toothAmp = 0.07;\n }\n\n // Scales & multipliers from uniforms\n float baseScale = max(uStrokeScale * 0.006, 0.008);\n // Three layers: big gestural, medium body, small dabs\n float sBig = baseScale * 2.4;\n float sMed = baseScale * 1.1;\n float sSml = baseScale * 0.45;\n\n float lenMulBig = mix(2.2, 3.8, uStrokeAnisotropy);\n float widMulBig = mix(0.55, 0.32, uStrokeAnisotropy);\n float lenMulMed = mix(2.0, 3.4, uStrokeAnisotropy);\n float widMulMed = mix(0.50, 0.30, uStrokeAnisotropy);\n float lenMulSml = mix(1.6, 2.6, uStrokeAnisotropy);\n float widMulSml = mix(0.45, 0.32, uStrokeAnisotropy);\n\n float jitterAmt = 0.75; // large jitter — no grid\n vec2 flow = flowField(p, t);\n\n vec3 result = col;\n\n // Layer 1 — big gestural strokes (sparse, shaping)\n StrokeHit hBig = bestOil(p, sBig, lenMulBig, widMulBig, jitterAmt * 0.55,\n densityBig, shapeType, bristleAmp, flow, t, 1.3);\n paintOver(result, hBig, streakFreq * 0.7, streakAmp,\n uImpasto * impastoAmp * uStrokeAmount, hardness, 1.3);\n\n // Layer 2 — medium body strokes\n StrokeHit hMed = bestOil(p + vec2(11.3, 3.7), sMed, lenMulMed, widMulMed,\n jitterAmt, densityMed, shapeType, bristleAmp, flow, t, 2.7);\n paintOver(result, hMed, streakFreq, streakAmp,\n uImpasto * impastoAmp * uStrokeAmount, hardness, 2.7);\n\n // Layer 3 — small dabs (more frequent, smaller)\n int smlShape = (mode == 1) ? 2 : shapeType; // knife uses dabs for sparkle\n StrokeHit hSml = bestOil(p + vec2(-5.1, 8.4), sSml, lenMulSml, widMulSml,\n jitterAmt * 1.3, densitySml, smlShape,\n bristleAmp * 0.85, flow, t, 4.1);\n paintOver(result, hSml, streakFreq * 1.4, streakAmp * 0.8,\n uImpasto * impastoAmp * 0.65 * uStrokeAmount, hardness, 4.1);\n\n // Layer 4 — fill dabs (very dense, very small) — covers bald spots\n float sFill = baseScale * 0.22;\n float lenMulFill = mix(1.4, 2.0, uStrokeAnisotropy);\n float widMulFill = mix(0.50, 0.38, uStrokeAnisotropy);\n int fillShape = (mode == 1) ? 3 : 2; // knife=even, others=dab (round fills)\n StrokeHit hFill = bestOil(p + vec2(3.9, -6.2), sFill, lenMulFill, widMulFill,\n jitterAmt * 1.5, 0.95, fillShape,\n bristleAmp * 0.6, flow, t, 8.9);\n paintOver(result, hFill, streakFreq * 1.8, streakAmp * 0.6,\n uImpasto * impastoAmp * 0.4 * uStrokeAmount, hardness * 0.9, 8.9);\n\n // Optional crosshatch layer\n if (uStrokeLayers == 2) {\n vec2 flow2 = vec2(-flow.y, flow.x);\n StrokeHit hX = bestOil(p + vec2(7.3, -2.1), sMed, lenMulMed * 0.9, widMulMed,\n jitterAmt, densityMed * 0.7, shapeType, bristleAmp, flow2, t, 6.5);\n paintOver(result, hX, streakFreq, streakAmp * 0.85,\n uImpasto * impastoAmp * 0.55 * uStrokeAmount, hardness, 6.5);\n }\n\n // Canvas tooth — linen weave\n float tooth1 = vnoise(p * toothScale);\n float tooth2 = vnoise(p * toothScale * vec2(0.6, 2.4) + 37.0);\n float tooth = (0.6 * tooth1 + 0.4 * tooth2) - 0.5;\n result *= 1.0 + tooth * toothAmp * uCanvasGrain;\n\n // Pigment saturation boost\n result = saturate3(result, pigmentSat);\n\n return result;\n}\n\n// ── Main ──────────────────────────────────────────────────────────────────\nvoid main() {\n // Normalized 0..1 coordinates for nuclei, domain warp, and medium sampling.\n vec2 uv = vUv;\n vec2 pN = uv;\n\n float t = uTime;\n\n // Warp in pN space\n vec2 p_warp = domainWarp(pN, t);\n\n // Composition\n float paletteId; float valueMod;\n nucleiField(p_warp, t, paletteId, valueMod);\n vec3 col = samplePalette(paletteId);\n col *= 1.0 + uValueVariance * valueMod;\n\n // Breath — slow global luminance wobble\n float breath = sin(t * 6.2831 / max(uBreathPeriod, 1.0));\n col *= 1.0 + uBreathDepth * breath * 0.5;\n\n // Medium\n if (uMedium == 1) col = mediumPastel(col, pN, t);\n else if (uMedium == 2) col = mediumWatercolor(col, pN, t);\n else if (uMedium == 3) col = mediumOil(col, pN, t);\n\n // Saturation trim\n col = saturate3(col, uSaturation);\n\n // Tonemap + film grain\n col = aces(col);\n float grain = hash21(gl_FragCoord.xy + t * 17.0);\n col += (grain - 0.5) * uPaperGrain;\n\n col = clamp(col * 0.985 + 0.008, 0.0, 1.0);\n fragColor = vec4(col * uAlpha, uAlpha);\n}\n";
|
|
7
|
-
|
|
8
|
-
//#region src/components/custom/aurora/
|
|
9
|
-
function b(e, t, n) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-C1je1s0u.js";
|
|
2
|
+
import { a as t, i as n, n as r, o as i, r as a, t as o } from "./compile-DVgAxagk.js";
|
|
3
|
+
import { n as s, r as c, t as l } from "./presets-1OhFpaIC.js";
|
|
4
|
+
import { a as u, r as d, t as f } from "./color-rkK4RMx2.js";
|
|
5
|
+
import { t as p } from "./useIntersectionPause-DAdVPVp4.js";
|
|
6
|
+
import { computed as m, createElementBlock as h, createElementVNode as g, defineComponent as _, normalizeClass as v, normalizeStyle as y, onBeforeUnmount as b, onMounted as x, openBlock as S, readonly as C, ref as w, unref as ee, watch as T } from "vue";
|
|
7
|
+
import { gamutMapOKLab as E, isInSRGBGamut as D, oklabToLinearSRGB as O, rawOklabToOklch as k, rawOklchToOklab as A, srgbToOKLab as te } from "@mkbabb/value.js";
|
|
8
|
+
//#region src/components/custom/aurora/constants/shaders/aurora.vert.ts
|
|
9
|
+
var ne = "#version 300 es\nin vec2 aPos;\nout vec2 vUv;\nvoid main() {\n vUv = aPos * 0.5 + 0.5;\n gl_Position = vec4(aPos, 0.0, 1.0);\n}", re = "// ── Palette LUT ───────────────────────────────────────────────────────────\nvec3 samplePalette(float id) {\n id = clamp(id, 0.0, 1.0);\n float scaled = id * float(uStopCount - 1);\n int i0 = int(floor(scaled));\n int i1 = min(i0 + 1, uStopCount - 1);\n float t = fract(scaled);\n t = smoothstep(0.0, 1.0, t);\n return mix(uPalette[i0], uPalette[i1], t);\n}\n\n// ── Nuclei field ──────────────────────────────────────────────────────────\nvoid nucleiField(vec2 p, float t, out float paletteId, out float valueMod) {\n float accumBias = 0.0;\n float accumValue = 0.0;\n float accumW = 0.0;\n for (int i = 0; i < MAX_NUCLEI; i++) {\n if (i >= uNucleiCount) break;\n vec2 posI = uNucleiPos[i]\n + uNucleiDriftRadius[i] * vec2(\n cos(t * uNucleiDrift * K_NUCLEI + uNucleiDriftPhase[i]),\n sin(t * uNucleiDrift * K_NUCLEI + uNucleiDriftPhase[i] * 1.13)\n );\n vec2 diff = p - posI;\n // Anisotropic Gaussian: rotate diff into the nucleus's local frame\n // (major axis along uNucleiAngle), then scale the major-axis component by\n // 1/elongation so the squared distance describes an ellipse. Defaults\n // 1.0/0.0 reduce to the isotropic dot(diff, diff).\n float ca = cos(uNucleiAngle[i]);\n float sa = sin(uNucleiAngle[i]);\n vec2 local = vec2( ca * diff.x + sa * diff.y,\n -sa * diff.x + ca * diff.y);\n float along = local.x / max(uNucleiElong[i], 0.01);\n float across = local.y;\n float d2 = along * along + across * across;\n float r = max(uNucleiRadius[i], 0.01);\n float w = exp(-uSoftmaxBeta * d2 / (r * r));\n accumBias += w * uNucleiPaletteBias[i];\n accumValue += w * uNucleiValueBias[i];\n accumW += w;\n }\n paletteId = accumBias / max(accumW, 1e-4);\n valueMod = accumValue / max(accumW, 1e-4);\n\n // Palette drift — slow global paletteId breathe between adjacent stops. The\n // rate rides K_PAL (perceptible ~30–60s hue cycle at the default coefficient);\n // the amplitude lifts the authored coefficient into a 0.03..0.06 paletteId band\n // so the palette visibly travels rather than dithering within one stop.\n float palAmp = clamp(uPaletteDrift * 6.0, 0.0, 0.06);\n paletteId += palAmp * sin(t * uPaletteDrift * K_PAL);\n paletteId = clamp(paletteId, 0.0, 1.0);\n}\n", ie = "// ── Flow field ────────────────────────────────────────────────────────────\nvec2 flowField(vec2 p, float t) {\n vec2 dir = vec2(1.0, 0.0);\n if (uFlowPattern == 1) {\n // radial\n dir = normalize(p - uFlowFocal + 1e-4);\n } else if (uFlowPattern == 2) {\n // swirl — tangent to radial\n vec2 rad = normalize(p - uFlowFocal + 1e-4);\n dir = vec2(-rad.y, rad.x);\n } else if (uFlowPattern == 3) {\n // diagonal\n float a = radians(uFlowAngle);\n dir = vec2(cos(a), sin(a));\n } else if (uFlowPattern == 4) {\n // multi — curl-noise driven\n float n = fbm(p * 2.0 + t * 0.02);\n float a = n * 6.2831;\n dir = vec2(cos(a), sin(a));\n }\n // curl — perturb by noise. Radial gets much less curl so rays stay clean.\n if (uFlowCurl > 0.0) {\n float n = fbm(p * 3.0) - 0.5;\n float curlAmt = uFlowCurl;\n if (uFlowPattern == 1) curlAmt *= 0.25; // radial: preserve ray clarity\n if (uFlowPattern == 2) curlAmt *= 0.55; // swirl: allow moderate curl\n float a = atan(dir.y, dir.x) + n * 3.14159 * curlAmt;\n dir = vec2(cos(a), sin(a));\n }\n // cursor influence — swirl around the cursor position\n if (uCursorStrength > 0.001) {\n vec2 toCur = uCursor - p;\n float d = length(toCur);\n float r = max(uCursorRadius, 0.01);\n float w = exp(-(d * d) / (r * r * 0.5));\n // swirl tangent\n vec2 tangent = vec2(-toCur.y, toCur.x) / max(d, 1e-4);\n float a0 = atan(dir.y, dir.x);\n float a1 = atan(tangent.y, tangent.x);\n // blend angle\n float da = a1 - a0;\n da = atan(sin(da), cos(da)); // wrap to [-pi, pi]\n float a = a0 + da * w * uCursorStrength;\n dir = vec2(cos(a), sin(a));\n }\n return dir;\n}\n", ae = "// ACES approximation\nvec3 aces(vec3 x) {\n float a = 2.51;\n float b = 0.03;\n float c = 2.43;\n float d = 0.59;\n float e = 0.14;\n return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);\n}\n", oe = "// ── Curved swept brushstroke primitive ────────────────────────────────────\n// A stroke is a curved spine from A to B with quadratic bulge K (sideways offset\n// at midpoint). Width varies along length via a shape profile. Edge is ragged\n// (bristle-modulated), ends are rounded blobs, inside has streak modulation.\n//\n// For pixel p, we invert an approximate projection onto the curved spine:\n// 1) project p onto straight AB axis -> along0, cross0\n// 2) at parameter along0, spine offset = 4·K·along0·(1-along0) perpendicular\n// 3) cross = cross0 - spineOffset, refine along one iteration\n// Coverage blends paint atop col based on per-stroke color sampled from the\n// underlying base at spine midpoint — so overlapping strokes from different\n// palette regions meet at hard, ragged demarcations.\n\nstruct StrokeHit {\n float coverage; // 0..1\n vec3 color;\n float alongT; // 0..1 along spine, for internal modulation\n float crossN; // cross distance / current half-width, signed\n float edgeN; // distance to edge in half-widths (0 = at edge, 1 = at spine)\n};\n\nStrokeHit noHit() { return StrokeHit(0.0, vec3(0.0), 0.0, 0.0, 0.0); }\n\nvec2 rotateDir(vec2 dir, float angle) {\n float ca = cos(angle), sa = sin(angle);\n return vec2(dir.x * ca - dir.y * sa, dir.x * sa + dir.y * ca);\n}\n\nvec2 safeDir(vec2 dir) {\n float len = length(dir);\n return len > 1e-4 ? dir / len : vec2(1.0, 0.0);\n}\n\n// Shape profile along the stroke. type:\n// 0 tapered — thin-fat-thin (classic brush)\n// 1 load-drag — fat start, tapers to a point\n// 2 dab — ellipse-like, round center\n// 3 even — near-constant, slight end taper\nfloat strokeShape(float t, int type) {\n t = clamp(t, 0.0, 1.0);\n if (type == 1) {\n // loaded at t=0, tapering\n return pow(1.0 - t, 0.55) * smoothstep(0.0, 0.08, t);\n } else if (type == 2) {\n // dab / blob\n float d = t - 0.5;\n return exp(-d * d * 12.0);\n } else if (type == 3) {\n // mostly even, slight end softening\n return smoothstep(0.0, 0.08, t) * smoothstep(1.0, 0.92, t) * 0.95 + 0.05;\n }\n // 0 tapered\n return smoothstep(0.0, 0.22, t) * smoothstep(1.0, 0.78, t);\n}\n\n// A single curved stroke.\n// a, b — endpoints\n// halfW — base half-width (world units)\n// bulge — signed perpendicular midpoint offset, in world units\n// shapeType — 0..3\n// bristleFreq — spatial frequency of edge raggedness\n// bristleAmp — 0..0.5 fraction of halfW chewed away at edge extrema\n// streakSeed — uniqueness seed for internal streaks\n// colAtMid — pre-sampled color at midpoint\nStrokeHit curvedStroke(vec2 p, vec2 a, vec2 b, float halfW,\n float bulge, int shapeType,\n float bristleFreq, float bristleAmp,\n float streakSeed, vec3 colAtMid) {\n vec2 ab = b - a;\n float L = length(ab);\n if (L < 1e-5) return noHit();\n vec2 tang = ab / L;\n vec2 norm = vec2(-tang.y, tang.x);\n\n vec2 rel = p - a;\n float along0 = dot(rel, tang) / L; // straight projection 0..1 along AB\n float cross0 = dot(rel, norm); // signed cross\n\n // Spine sideways offset due to bulge (parabolic)\n float bend = 4.0 * bulge * along0 * (1.0 - along0);\n float cross1 = cross0 - bend;\n\n // One refinement step: as the spine bends, the closest-point along shifts.\n // Spine tangent differs from straight tangent; first-order correction:\n float dBend = 4.0 * bulge * (1.0 - 2.0 * along0); // d(bend)/d(along)\n float along1 = along0 + (cross1 * dBend) / (L * (1.0 + dBend * dBend / (L * L)));\n\n // Bristle-ragged edge: half-width gets chewed by 1D noise along the spine\n float edgeNoise = fbm(vec2(along1 * bristleFreq, streakSeed * 7.3)) - 0.5;\n float edgeNoise2 = fbm(vec2(along1 * bristleFreq * 2.3, streakSeed * 3.1 + 17.0)) - 0.5;\n float edgeMod = 1.0 - bristleAmp * (0.6 + 0.4 * edgeNoise) * (0.5 + edgeNoise2);\n\n // Width profile along the stroke\n float shape = strokeShape(along1, shapeType);\n float halfWNow = halfW * shape * edgeMod;\n\n // Inside-segment coverage\n float cov = 0.0;\n if (along1 >= 0.0 && along1 <= 1.0 && halfWNow > 1e-6) {\n float cn = abs(cross1) / halfWNow;\n // fwidth-derived AA: half-width from the field's screen-space gradient so the\n // edge holds ~1px regardless of zoom/DPR (mirrors metaball.frag.ts:252-255).\n float aaC = max(fwidth(cn), 1e-6);\n cov = 1.0 - smoothstep(1.0 - aaC, 1.0 + aaC, cn);\n }\n\n // End-cap blobs (rounded tips, not perpendicular cuts)\n float capA = 0.0, capB = 0.0;\n {\n vec2 capCenterA = a + norm * (bulge * 0.0); // at a\n vec2 capCenterB = a + tang * L + norm * bend * 0.0 + norm * 0.0; // at b; bend is 0 at endpoints\n capCenterB = b;\n float endShapeA = strokeShape(0.02, shapeType);\n float endShapeB = strokeShape(0.98, shapeType);\n float rA = halfW * endShapeA * (0.9 + 0.2 * fbm(vec2(streakSeed * 13.0)));\n float rB = halfW * endShapeB * (0.9 + 0.2 * fbm(vec2(streakSeed * 19.0 + 5.0)));\n float dA = length(p - capCenterA);\n float dB = length(p - capCenterB);\n // fwidth-derived AA on the clean Euclidean cap distances (mirrors metaball.frag.ts:252-255).\n float aaA = max(fwidth(dA), 1e-6);\n float aaB = max(fwidth(dB), 1e-6);\n capA = 1.0 - smoothstep(rA - aaA, rA + aaA, dA);\n capB = 1.0 - smoothstep(rB - aaB, rB + aaB, dB);\n // Only apply caps if we're BEYOND the segment; otherwise the segment wins.\n capA *= (along1 < 0.05) ? 1.0 : 0.0;\n capB *= (along1 > 0.95) ? 1.0 : 0.0;\n }\n\n float coverage = max(cov, max(capA, capB));\n if (coverage < 0.002) return noHit();\n\n // Edge distance (for impasto later): 0 at edge, 1 at spine\n float edgeDist = halfWNow > 1e-6 ? clamp(1.0 - abs(cross1) / halfWNow, 0.0, 1.0) : 0.0;\n\n return StrokeHit(\n coverage,\n colAtMid,\n clamp(along1, 0.0, 1.0),\n halfWNow > 1e-6 ? cross1 / halfWNow : 0.0,\n edgeDist\n );\n}\n\n// Composite stroke over col with internal streaking + impasto edge highlight.\n// streakAmp — 0..0.2 how much internal streaks darken/lighten\n// impastoAmp — 0..1 edge catch-light strength\n// hardness — 0..1 how crisp the compositing transition is (1 = razor, 0 = creamy)\nvoid paintOver(inout vec3 col, StrokeHit s, float streakFreq, float streakAmp,\n float impastoAmp, float hardness, float streakSeed) {\n if (s.coverage < 0.002) return;\n float strokeOpacity = clamp(uStrokeAmount, 0.0, 1.0);\n if (strokeOpacity <= 0.001) return;\n vec3 c = s.color;\n\n // Internal streaks — fbm along spine, modulated by cross position. Gives\n // the loaded-brush look: some bristles carry more pigment than others.\n float streakA = fbm(vec2(s.alongT * streakFreq, s.crossN * 2.7 + streakSeed));\n float streakB = fbm(vec2(s.alongT * streakFreq * 0.6 + streakSeed * 3.7, s.crossN * 4.1));\n float streak = 0.6 * (streakA - 0.5) + 0.4 * (streakB - 0.5);\n c *= 1.0 + streak * streakAmp * 2.0;\n\n // Subtle value variance across width (hollow-center catch-light)\n float crossShade = smoothstep(0.0, 0.4, s.edgeN) * (1.0 - smoothstep(0.65, 1.0, s.edgeN));\n c *= 1.0 + crossShade * 0.05;\n\n // Impasto edge highlight — bright rim on one side of the stroke\n float rim = smoothstep(0.85, 1.0, 1.0 - s.edgeN) * step(0.0, s.crossN);\n c += impastoAmp * rim * vec3(0.18, 0.15, 0.11);\n // Shadow on the other side (darker, cooler)\n float shadow = smoothstep(0.85, 1.0, 1.0 - s.edgeN) * step(0.0, -s.crossN);\n c -= impastoAmp * shadow * 0.25 * vec3(0.10, 0.09, 0.07);\n\n float softLimit = mix(0.35, 0.98, hardness);\n float alpha = smoothstep(0.0, 1.0 - softLimit, s.coverage) * strokeOpacity;\n col = mix(col, c, alpha);\n}\n\n// Best-of-9-neighbor placement: sample 3x3 surrounding cells and take the\n// stroke that covers this pixel most. Breaks the grid by per-cell jitter and\n// sparse density via noise thresholding.\nStrokeHit bestOil(vec2 p, float cellSize, float lenMul, float halfWMul,\n float jitterAmt, float density, int shapeType,\n float bristleAmp, vec2 flow, float t, float seed) {\n vec2 cell = floor(p / cellSize);\n\n StrokeHit best = noHit();\n // 3x3 neighborhood\n for (int dy = -1; dy <= 1; dy++) {\n for (int dx = -1; dx <= 1; dx++) {\n vec2 cc = cell + vec2(float(dx), float(dy));\n vec2 hh = hash22(cc + seed) - 0.5;\n // Density gate — noise threshold; sparse placement.\n float gate = hash21(cc * 1.7 + seed * 0.3);\n if (gate > density) continue;\n\n vec2 center = (cc + 0.5 + hh * jitterAmt) * cellSize;\n\n // Per-stroke direction: consume the layer-provided flow, then add only\n // deterministic local perturbation so alternate stroke layers stay live.\n vec2 f = safeDir(flow);\n float angJ = (hash21(cc + seed + 11.0) - 0.5) * 0.9; // +/- 0.45 rad\n float localCurl = (fbm(center * (2.6 + seed * 0.11) + seed * 1.9) - 0.5) * 0.55 * uFlowCurl;\n vec2 dir = rotateDir(f, angJ + localCurl);\n\n float lenV = cellSize * lenMul * (0.65 + 0.55 * hash21(cc + seed + 23.0));\n float halfW = cellSize * halfWMul * (0.70 + 0.55 * hash21(cc + seed + 41.0));\n float bulge = (hash21(cc + seed + 53.0) - 0.5) * lenV * 0.35;\n\n vec2 a = center - dir * (lenV * 0.5);\n vec2 b = center + dir * (lenV * 0.5);\n\n vec3 colMid = brokenColorJitter(\n sampleBase(center, t),\n hash21(cc + seed + 89.0),\n hash21(cc * 2.3 + seed + 97.0),\n 1.0\n );\n\n StrokeHit h = curvedStroke(p, a, b, halfW, bulge, shapeType,\n 7.0, bristleAmp,\n hash21(cc + seed + 67.0), colMid);\n if (h.coverage > best.coverage) best = h;\n }\n }\n return best;\n}\n", j = "// ── Medium overlays ───────────────────────────────────────────────────────\n\n// A quick re-computation of base color for edge-mask sampling\nvec3 sampleBase(vec2 p, float t) {\n vec2 pw = domainWarp(p, t);\n float id; float vm;\n nucleiField(pw, t, id, vm);\n vec3 c = samplePalette(id);\n c *= 1.0 + uValueVariance * vm;\n return c;\n}\n\nvec3 mediumWatercolor(vec3 col, vec2 p, float t) {\n // Wet-edge cauliflowers via luma-gradient magnitude\n float eps = 0.004;\n vec3 cx1 = sampleBase(p + vec2(eps, 0.0), t);\n vec3 cx2 = sampleBase(p - vec2(eps, 0.0), t);\n vec3 cy1 = sampleBase(p + vec2(0.0, eps), t);\n vec3 cy2 = sampleBase(p - vec2(0.0, eps), t);\n float gx = dot(cx1 - cx2, W_LUMA);\n float gy = dot(cy1 - cy2, W_LUMA);\n float edge = sqrt(gx * gx + gy * gy) / (2.0 * eps);\n float mask = smoothstep(0.0, 2.5, edge);\n col *= mix(1.0, 0.78, mask * uWetEdge);\n\n // Granulation — pigment settles in paper tooth\n float paper = 0.5 * vnoise(p * 160.0) + 0.5 * vnoise(p * 360.0);\n float pigLoad = 1.0 - dot(col, W_LUMA);\n col *= 1.0 - uGranulation * pigLoad * (paper - 0.5);\n\n // Wash banding — faint horizontal wet gradient\n float band = fbm(vec2(p.x * 1.5, p.y * 0.4));\n col *= 1.0 + 0.04 * (band - 0.5);\n return col;\n}\n\nvec3 mediumPastel(vec3 col, vec2 p, float t) {\n vec2 flow = flowField(p, t);\n vec2 perp = vec2(-flow.y, flow.x);\n float along = dot(p, flow) * uStrokeScale;\n float across = dot(p, perp) * uStrokeScale;\n across += 0.03 * (vnoise(p * 260.0) - 0.5);\n\n float aniso = mix(1.0, 0.18, uStrokeAnisotropy);\n float stroke = fbm(vec2(along * aniso, across));\n col *= mix(1.0, 0.82 + 0.32 * stroke, uStrokeAmount);\n\n // Pastel tooth — tiny high-frequency grain\n float tooth = vnoise(p * 800.0);\n col *= 1.0 - 0.08 * uStrokeAmount * (tooth - 0.5);\n return col;\n}\n", M = "// ── Crayon / oil-pastel — paper tooth × wax pigment (PEER medium) ─────────\n// Crayon is not strokes. It's pigment crumbs dragged across paper tooth.\n// Model: heavy 2D tooth noise at multiple scales, anisotropically stretched\n// along flow direction, multiplied into the base color. Add a slow \"waxy\n// film\" that slightly unifies hues, and occasional darker \"pressed\" spots\n// where the crayon dug in. NO straight segments. Dispatched at main() level as\n// a peer of pastel/watercolor/oil — never a branch inside mediumOil().\nvec3 mediumCrayon(vec3 col, vec2 p, float t) {\n vec2 flow = flowField(p, t);\n float ang = atan(flow.y, flow.x);\n float ca = cos(-ang), sa = sin(-ang);\n vec2 pr = vec2(p.x * ca - p.y * sa, p.x * sa + p.y * ca);\n\n // Anisotropic tooth — squished along flow, coarse cross flow.\n float aniso = mix(0.45, 0.95, uStrokeAnisotropy);\n float scale = max(uStrokeScale * 1.6, 180.0);\n\n float t1 = vnoise(vec2(pr.x * scale * aniso, pr.y * scale));\n float t2 = vnoise(vec2(pr.x * scale * aniso * 0.4, pr.y * scale * 0.4) + 11.0);\n float t3 = vnoise(vec2(pr.x * scale * aniso * 2.1, pr.y * scale * 2.1) + 23.0);\n float tooth = 0.55 * t1 + 0.30 * t2 + 0.15 * t3;\n // Center at 0, amplify\n tooth = (tooth - 0.5) * 1.4;\n\n // Multiplicative darkening where tooth is low (pigment skipped paper valleys)\n float lay = 1.0 + tooth * 0.32 * uStrokeAmount;\n vec3 result = col * lay;\n\n // Occasional pressed-in crumbs — rare darker crumbs\n float crumbs = smoothstep(0.78, 0.95, vnoise(pr * scale * 3.0));\n result *= 1.0 - crumbs * 0.18 * uStrokeAmount;\n\n // Waxy highlight film — slight lightening on tooth peaks\n float waxy = smoothstep(0.55, 0.85, t1);\n result += waxy * 0.04 * vec3(1.0);\n\n // Paper tooth overlay (subtler than oil's canvas)\n float paperTooth = vnoise(p * 340.0) - 0.5;\n result *= 1.0 + paperTooth * 0.14 * uCanvasGrain;\n\n // Broken-color pigment: stable wax/pigment patches, not temporal flicker.\n vec2 pigmentCell = floor(pr * max(scale * 0.18, 32.0));\n float pigmentMask = smoothstep(0.28, 0.82, vnoise(pr * scale * 0.21 + 19.0));\n result = brokenColorJitter(\n result,\n hash21(pigmentCell + 17.0),\n hash21(pigmentCell * 2.1 + 31.0),\n 0.45 + 0.55 * pigmentMask\n );\n\n // Crayon is saturation-amplified\n result = saturate3(result, 1.12);\n\n return result;\n}\n\nvec3 mediumOil(vec3 col, vec2 p, float t) {\n // Mode knobs (uStrokeMode) — oil-stroke modes ONLY (crayon is a peer medium,\n // uMedium==4, dispatched at main()):\n // 0 oil — balanced modern-abstract/palette-knife hybrid\n // 1 knife — palette-knife impasto: razor edges, heavy bristle/shadow\n // 3 brushwork — thick bristle brush\n int mode = uStrokeMode;\n\n // Per-mode parameters\n int shapeType = 0; // tapered\n float bristleAmp = 0.25; // 0..0.5\n float streakFreq = 9.0;\n float streakAmp = 0.09;\n float impastoAmp = 0.9;\n float hardness = 0.80; // edge compositing\n float toothScale = 240.0;\n float toothAmp = 0.09;\n float pigmentSat = 1.03;\n float densityBig = 0.65;\n float densityMed = 0.78;\n float densitySml = 0.90;\n\n if (mode == 1) { // palette knife\n shapeType = 3; // flat, even\n bristleAmp = 0.12;\n streakFreq = 4.0; streakAmp = 0.05;\n impastoAmp = 1.6;\n hardness = 0.95;\n toothAmp = 0.04;\n densityBig = 0.80; densityMed = 0.88; densitySml = 0.70;\n } else if (mode == 3) { // thick brushwork\n shapeType = 0; // tapered\n bristleAmp = 0.32;\n streakFreq = 14.0; streakAmp = 0.14;\n impastoAmp = 1.2;\n hardness = 0.85;\n toothAmp = 0.07;\n }\n\n // Scales & multipliers from uniforms\n float baseScale = max(uStrokeScale * 0.006, 0.008);\n // Three layers: big gestural, medium body, small dabs\n float sBig = baseScale * 2.4;\n float sMed = baseScale * 1.1;\n float sSml = baseScale * 0.45;\n\n float lenMulBig = mix(2.2, 3.8, uStrokeAnisotropy);\n float widMulBig = mix(0.55, 0.32, uStrokeAnisotropy);\n float lenMulMed = mix(2.0, 3.4, uStrokeAnisotropy);\n float widMulMed = mix(0.50, 0.30, uStrokeAnisotropy);\n float lenMulSml = mix(1.6, 2.6, uStrokeAnisotropy);\n float widMulSml = mix(0.45, 0.32, uStrokeAnisotropy);\n\n float jitterAmt = 0.75; // large jitter — no grid\n vec2 flow = flowField(p, t);\n\n vec3 result = col;\n\n // Layer 1 — big gestural strokes (sparse, shaping)\n StrokeHit hBig = bestOil(p, sBig, lenMulBig, widMulBig, jitterAmt * 0.55,\n densityBig, shapeType, bristleAmp, flow, t, 1.3);\n paintOver(result, hBig, streakFreq * 0.7, streakAmp,\n uImpasto * impastoAmp * uStrokeAmount, hardness, 1.3);\n\n // Layer 2 — medium body strokes\n StrokeHit hMed = bestOil(p + vec2(11.3, 3.7), sMed, lenMulMed, widMulMed,\n jitterAmt, densityMed, shapeType, bristleAmp, flow, t, 2.7);\n paintOver(result, hMed, streakFreq, streakAmp,\n uImpasto * impastoAmp * uStrokeAmount, hardness, 2.7);\n\n // Layer 3 — small dabs (more frequent, smaller)\n int smlShape = (mode == 1) ? 2 : shapeType; // knife uses dabs for sparkle\n StrokeHit hSml = bestOil(p + vec2(-5.1, 8.4), sSml, lenMulSml, widMulSml,\n jitterAmt * 1.3, densitySml, smlShape,\n bristleAmp * 0.85, flow, t, 4.1);\n paintOver(result, hSml, streakFreq * 1.4, streakAmp * 0.8,\n uImpasto * impastoAmp * 0.65 * uStrokeAmount, hardness, 4.1);\n\n // Layer 4 — fill dabs (very dense, very small) — covers bald spots\n float sFill = baseScale * 0.22;\n float lenMulFill = mix(1.4, 2.0, uStrokeAnisotropy);\n float widMulFill = mix(0.50, 0.38, uStrokeAnisotropy);\n int fillShape = (mode == 1) ? 3 : 2; // knife=even, others=dab (round fills)\n StrokeHit hFill = bestOil(p + vec2(3.9, -6.2), sFill, lenMulFill, widMulFill,\n jitterAmt * 1.5, 0.95, fillShape,\n bristleAmp * 0.6, flow, t, 8.9);\n paintOver(result, hFill, streakFreq * 1.8, streakAmp * 0.6,\n uImpasto * impastoAmp * 0.4 * uStrokeAmount, hardness * 0.9, 8.9);\n\n // Optional crosshatch layer\n if (uStrokeLayers == 2) {\n vec2 flow2 = vec2(-flow.y, flow.x);\n StrokeHit hX = bestOil(p + vec2(7.3, -2.1), sMed, lenMulMed * 0.9, widMulMed,\n jitterAmt, densityMed * 0.7, shapeType, bristleAmp, flow2, t, 6.5);\n paintOver(result, hX, streakFreq, streakAmp * 0.85,\n uImpasto * impastoAmp * 0.55 * uStrokeAmount, hardness, 6.5);\n }\n\n // Canvas tooth — linen weave\n float tooth1 = vnoise(p * toothScale);\n float tooth2 = vnoise(p * toothScale * vec2(0.6, 2.4) + 37.0);\n float tooth = (0.6 * tooth1 + 0.4 * tooth2) - 0.5;\n result *= 1.0 + tooth * toothAmp * uCanvasGrain;\n\n // Pigment saturation boost\n result = saturate3(result, pigmentSat);\n\n return result;\n}", N = "\n", P = `#version 300 es
|
|
10
|
+
precision highp float;
|
|
11
|
+
|
|
12
|
+
in vec2 vUv;
|
|
13
|
+
out vec4 fragColor;
|
|
14
|
+
|
|
15
|
+
#define MAX_NUCLEI 6
|
|
16
|
+
#define MAX_STOPS 8
|
|
17
|
+
|
|
18
|
+
// ── Uniforms ───────────────────────────────────────────────────────────────
|
|
19
|
+
uniform float uTime;
|
|
20
|
+
|
|
21
|
+
// Palette baked CPU-side to linear-sRGB
|
|
22
|
+
uniform vec3 uPalette[MAX_STOPS];
|
|
23
|
+
uniform int uStopCount;
|
|
24
|
+
|
|
25
|
+
// Nuclei (parallel arrays)
|
|
26
|
+
uniform int uNucleiCount;
|
|
27
|
+
uniform vec2 uNucleiPos[MAX_NUCLEI];
|
|
28
|
+
uniform float uNucleiRadius[MAX_NUCLEI];
|
|
29
|
+
uniform float uNucleiPaletteBias[MAX_NUCLEI];
|
|
30
|
+
uniform float uNucleiValueBias[MAX_NUCLEI];
|
|
31
|
+
uniform float uNucleiDriftRadius[MAX_NUCLEI];
|
|
32
|
+
uniform float uNucleiDriftPhase[MAX_NUCLEI];
|
|
33
|
+
// Anisotropy: per-nucleus elongation (1.0 = isotropic) and major-axis angle (radians).
|
|
34
|
+
// Defaults (1.0 / 0.0) reduce to the original circular Gaussian.
|
|
35
|
+
uniform float uNucleiElong[MAX_NUCLEI];
|
|
36
|
+
uniform float uNucleiAngle[MAX_NUCLEI];
|
|
37
|
+
uniform float uSoftmaxBeta;
|
|
38
|
+
uniform float uValueVariance;
|
|
39
|
+
|
|
40
|
+
// Warp
|
|
41
|
+
uniform float uWarpAmount;
|
|
42
|
+
uniform float uWarpScale;
|
|
43
|
+
uniform float uWarpDrift;
|
|
44
|
+
uniform int uWarpMode; // 0=fbm 1=cellular 2=hybrid
|
|
45
|
+
uniform int uNoiseOctaves;
|
|
46
|
+
|
|
47
|
+
// Medium
|
|
48
|
+
// 0 smooth, 1 pastel, 2 watercolor, 3 oil, 4 crayon (peer medium — wax pigment
|
|
49
|
+
// on paper tooth; NOT an oil-stroke sub-mode, so it dispatches at main() level).
|
|
50
|
+
uniform int uMedium;
|
|
51
|
+
uniform int uFlowPattern; // 0 none, 1 radial, 2 swirl, 3 diagonal, 4 multi
|
|
52
|
+
uniform vec2 uFlowFocal;
|
|
53
|
+
uniform float uFlowAngle;
|
|
54
|
+
uniform float uFlowCurl;
|
|
55
|
+
uniform vec2 uCursor; // in 0..1 screen space (matches pN)
|
|
56
|
+
uniform float uCursorStrength; // 0..1 attraction amount
|
|
57
|
+
uniform float uCursorRadius; // radius of influence (0.05..0.5)
|
|
58
|
+
uniform float uStrokeAmount;
|
|
59
|
+
uniform float uStrokeScale;
|
|
60
|
+
uniform float uStrokeAnisotropy;
|
|
61
|
+
uniform int uStrokeLayers; // 1 or 2 (crosshatch)
|
|
62
|
+
uniform int uStrokeMode; // 0 oil (modern gestural), 1 palette-knife, 3 modern-chunky (crayon is uMedium==4, a peer medium)
|
|
63
|
+
uniform float uWetEdge;
|
|
64
|
+
uniform float uGranulation;
|
|
65
|
+
uniform float uImpasto;
|
|
66
|
+
uniform float uBrokenColor;
|
|
67
|
+
uniform float uCanvasGrain;
|
|
68
|
+
|
|
69
|
+
// Motion
|
|
70
|
+
uniform float uNucleiDrift;
|
|
71
|
+
uniform float uPaletteDrift;
|
|
72
|
+
uniform float uBreathDepth;
|
|
73
|
+
uniform float uBreathPeriod;
|
|
74
|
+
|
|
75
|
+
// Output
|
|
76
|
+
uniform float uSaturation;
|
|
77
|
+
uniform float uPaperGrain;
|
|
78
|
+
uniform float uAlpha;
|
|
79
|
+
|
|
80
|
+
// ── Time rate ────────────────────────────────────────────────────────────────
|
|
81
|
+
// The authoring coefficients (uNucleiDrift, uPaletteDrift, uWarpDrift) live in a
|
|
82
|
+
// human-friendly 0..~0.05 band — that scale is what the config schema and every
|
|
83
|
+
// demo preset are tuned against. But that band, multiplied straight into uTime
|
|
84
|
+
// (seconds), yields rad/sec rates so small the field reads visually static (one
|
|
85
|
+
// nuclei orbit took ~10 min at the old default). These K_* constants decouple
|
|
86
|
+
// the AUTHORING scale from the RAD/SEC scale: each time term wraps its coefficient
|
|
87
|
+
// in the matching K_, lifting the same authored value to a perceptible period
|
|
88
|
+
// without touching any preset. Tuned so the field reads SLOWLY ALIVE — drift over
|
|
89
|
+
// a ~5–15s window, never a frantic pan. These are downstream of uTime, which the
|
|
90
|
+
// runtime FREEZES under reduced-motion (t = frozenOffset) before the shader sees
|
|
91
|
+
// it, so the lift cannot leak motion into the reduced-motion path.
|
|
92
|
+
const float K_NUCLEI = 14.0; // nuclei orbit: ~one cycle per ~45s at default 0.01
|
|
93
|
+
const float K_PAL = 24.0; // palette hue breathe: ~one cycle per ~33s at default
|
|
94
|
+
const float K_WARP = 5.0; // domain warp scroll: a perceptible fbm-cell traverse
|
|
95
|
+
|
|
96
|
+
// ── Noise ──────────────────────────────────────────────────────────────────
|
|
97
|
+
float hash21(vec2 p) {
|
|
98
|
+
p = fract(p * vec2(123.34, 456.21));
|
|
99
|
+
p += dot(p, p + 45.32);
|
|
100
|
+
return fract(p.x * p.y);
|
|
25
101
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
];
|
|
102
|
+
|
|
103
|
+
vec2 hash22(vec2 p) {
|
|
104
|
+
p = vec2(dot(p, vec2(127.1, 311.7)),
|
|
105
|
+
dot(p, vec2(269.5, 183.3)));
|
|
106
|
+
return fract(sin(p) * 43758.5453);
|
|
32
107
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
108
|
+
|
|
109
|
+
float vnoise(vec2 p) {
|
|
110
|
+
vec2 i = floor(p);
|
|
111
|
+
vec2 f = fract(p);
|
|
112
|
+
vec2 u = f * f * (3.0 - 2.0 * f);
|
|
113
|
+
float a = hash21(i);
|
|
114
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
115
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
116
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
117
|
+
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
|
|
40
118
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
119
|
+
|
|
120
|
+
// The rotated-octave FBM rotation constant — spliced from the shared chunk (AV.W2
|
|
121
|
+
// — the one FBM_ROT). The loop below stays aurora-local (2.02 lacunarity +
|
|
122
|
+
// uniform-driven octaves, per §3a — only the rotation constant converges).
|
|
123
|
+
${t}
|
|
124
|
+
|
|
125
|
+
float fbm(vec2 p) {
|
|
126
|
+
float v = 0.0;
|
|
127
|
+
float a = 0.5;
|
|
128
|
+
for (int i = 0; i < 5; i++) {
|
|
129
|
+
if (i >= uNoiseOctaves) break;
|
|
130
|
+
v += a * vnoise(p);
|
|
131
|
+
p = FBM_ROT * p * 2.02;
|
|
132
|
+
a *= 0.5;
|
|
133
|
+
}
|
|
134
|
+
return v;
|
|
48
135
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
136
|
+
|
|
137
|
+
// The sRGB OETF (linearToSrgb) — spliced from the shared procedural-color chunk
|
|
138
|
+
// (AV.W2 — the single OETF source; the AV.W1 local copy is deleted here). Aurora's
|
|
139
|
+
// linear pipeline closes the seam with this transfer before fragColor (the
|
|
140
|
+
// proof:aurora-space-gamma seam).
|
|
141
|
+
${i}
|
|
142
|
+
|
|
143
|
+
// Interleaved Gradient Noise (Jimenez) — a 1-LSB triangular dither applied in
|
|
144
|
+
// DISPLAY space AFTER the OETF, so 8-bit mid-tone banding on the soft gradient is
|
|
145
|
+
// quantization-dithered at the value being quantized (post-transfer, not linear).
|
|
146
|
+
float ign(vec2 p) {
|
|
147
|
+
return fract(52.9829189 * fract(dot(p, vec2(0.06711056, 0.00583715))));
|
|
56
148
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
149
|
+
|
|
150
|
+
// Cellular / Worley f1
|
|
151
|
+
float cellular(vec2 p) {
|
|
152
|
+
vec2 i = floor(p);
|
|
153
|
+
vec2 f = fract(p);
|
|
154
|
+
float m = 1e9;
|
|
155
|
+
for (int y = -1; y <= 1; y++) {
|
|
156
|
+
for (int x = -1; x <= 1; x++) {
|
|
157
|
+
vec2 g = vec2(float(x), float(y));
|
|
158
|
+
vec2 o = hash22(i + g);
|
|
159
|
+
vec2 r = g + o - f;
|
|
160
|
+
m = min(m, dot(r, r));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return sqrt(m);
|
|
60
164
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
165
|
+
|
|
166
|
+
// ── Warp ──────────────────────────────────────────────────────────────────
|
|
167
|
+
vec2 domainWarp(vec2 p, float t) {
|
|
168
|
+
// Quilez canonical double warp
|
|
169
|
+
vec2 q = vec2(fbm(p * uWarpScale + vec2(0.0, 0.0) + t * uWarpDrift * K_WARP),
|
|
170
|
+
fbm(p * uWarpScale + vec2(5.2, 1.3) + t * uWarpDrift * K_WARP));
|
|
171
|
+
vec2 r = vec2(fbm(p * uWarpScale + 4.0 * q + vec2(1.7, 9.2)),
|
|
172
|
+
fbm(p * uWarpScale + 4.0 * q + vec2(8.3, 2.8)));
|
|
173
|
+
|
|
174
|
+
vec2 warp = r;
|
|
175
|
+
if (uWarpMode == 1) {
|
|
176
|
+
// cellular — chunky territories (MEADOW block-like)
|
|
177
|
+
float c1 = cellular(p * uWarpScale * 1.5 + vec2(t * uWarpDrift * K_WARP * 2.0, 0.0));
|
|
178
|
+
float c2 = cellular(p * uWarpScale * 1.5 + vec2(11.0, 7.0 + t * uWarpDrift * K_WARP * 2.0));
|
|
179
|
+
warp = vec2(c1, c2);
|
|
180
|
+
} else if (uWarpMode == 2) {
|
|
181
|
+
// hybrid — fbm + cellular averaged
|
|
182
|
+
float c1 = cellular(p * uWarpScale * 1.2);
|
|
183
|
+
float c2 = cellular(p * uWarpScale * 1.2 + vec2(11.0, 7.0));
|
|
184
|
+
warp = mix(r, vec2(c1, c2), 0.5);
|
|
185
|
+
}
|
|
186
|
+
vec2 warped = p + uWarpAmount * warp;
|
|
187
|
+
|
|
188
|
+
// Cursor swirl — rotate p around uCursor with radial falloff.
|
|
189
|
+
// This warps the underlying color field so the bands sweep around the pointer.
|
|
190
|
+
if (uCursorStrength > 0.001) {
|
|
191
|
+
vec2 toP = p - uCursor;
|
|
192
|
+
float d = length(toP);
|
|
193
|
+
float r = max(uCursorRadius, 0.01);
|
|
194
|
+
// Smooth falloff; strong near cursor, zero beyond ~1.5× radius.
|
|
195
|
+
float w = exp(-(d * d) / (r * r * 0.45));
|
|
196
|
+
// Max rotation ~120° at cursor center, scaled by strength
|
|
197
|
+
float ang = w * uCursorStrength * 2.1;
|
|
198
|
+
float ca = cos(ang), sa = sin(ang);
|
|
199
|
+
vec2 rotated = vec2(ca * toP.x - sa * toP.y, sa * toP.x + ca * toP.y) + uCursor;
|
|
200
|
+
// Also pinch slightly toward the cursor (gravity) — adds depth to swirl
|
|
201
|
+
float pinch = w * uCursorStrength * 0.08;
|
|
202
|
+
rotated = mix(rotated, uCursor, pinch);
|
|
203
|
+
// Blend original warped position with cursor-rotated version
|
|
204
|
+
warped = mix(warped, rotated + uWarpAmount * warp * 0.7, w * uCursorStrength);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return warped;
|
|
64
208
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
209
|
+
|
|
210
|
+
` + re + N + ie + N + "// ── Color utils ───────────────────────────────────────────────────────────\nconst vec3 W_LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 hueShift(vec3 c, float degrees) {\n float a = radians(degrees);\n float co = cos(a), si = sin(a);\n mat3 m = mat3(\n 0.299 + 0.701 * co + 0.168 * si,\n 0.587 - 0.587 * co + 0.330 * si,\n 0.114 - 0.114 * co - 0.497 * si,\n\n 0.299 - 0.299 * co - 0.328 * si,\n 0.587 + 0.413 * co + 0.035 * si,\n 0.114 - 0.114 * co + 0.292 * si,\n\n 0.299 - 0.300 * co + 1.250 * si,\n 0.587 - 0.588 * co - 1.050 * si,\n 0.114 + 0.886 * co - 0.203 * si\n );\n return m * c;\n}\n\nvec3 brokenColorJitter(vec3 c, float hueSeed, float valueSeed, float strength) {\n float amt = clamp(uBrokenColor * strength, 0.0, 1.0);\n if (amt <= 0.001) return c;\n float hueDeg = (hueSeed - 0.5) * 32.0 * amt;\n float valueMul = 1.0 + (valueSeed - 0.5) * 0.28 * amt;\n return max(hueShift(c, hueDeg) * valueMul, vec3(0.0));\n}\n\nvec3 saturate3(vec3 c, float amt) {\n float l = dot(c, W_LUMA);\n return mix(vec3(l), c, amt);\n}\n\n" + ae + N + j + N + oe + N + M + N + "\n// ── Main ──────────────────────────────────────────────────────────────────\nvoid main() {\n // Normalized 0..1 coordinates for nuclei, domain warp, and medium sampling.\n vec2 uv = vUv;\n vec2 pN = uv;\n\n float t = uTime;\n\n // Warp in pN space\n vec2 p_warp = domainWarp(pN, t);\n\n // Composition\n float paletteId; float valueMod;\n nucleiField(p_warp, t, paletteId, valueMod);\n vec3 col = samplePalette(paletteId);\n col *= 1.0 + uValueVariance * valueMod;\n\n // Breath — slow global luminance wobble\n float breath = sin(t * 6.2831 / max(uBreathPeriod, 1.0));\n col *= 1.0 + uBreathDepth * breath * 0.5;\n\n // Medium — crayon (4) is a peer dispatched here, not a mediumOil sub-mode.\n if (uMedium == 1) col = mediumPastel(col, pN, t);\n else if (uMedium == 2) col = mediumWatercolor(col, pN, t);\n else if (uMedium == 3) col = mediumOil(col, pN, t);\n else if (uMedium == 4) col = mediumCrayon(col, pN, t);\n\n // Saturation trim\n col = saturate3(col, uSaturation);\n\n // Tonemap + film grain\n col = aces(col);\n float grain = hash21(gl_FragCoord.xy + t * 17.0);\n col += (grain - 0.5) * uPaperGrain;\n\n col = clamp(col * 0.985 + 0.008, 0.0, 1.0);\n\n // MANDATORY OETF — closes the seam (mirrors metaball.frag.ts:278). The whole\n // pipeline above (linear palette LUT, ACES tonemap, grain) runs in LINEAR; without\n // this transfer the aurora ships ~2.2× too dark (linear 0.5 → ~0.215, not ~0.735).\n col = linearToSrgb(col);\n\n // 1-LSB triangular IGN dither in DISPLAY space, AFTER the OETF — breaks 8-bit\n // mid-tone banding on the soft gradient. Texture-free (the canonical Jimenez IGN).\n col += (1.0 / 255.0) * (ign(gl_FragCoord.xy) - 0.5);\n\n // Premultiply operates on DISPLAY-space color (matches the blob: OETF, then premul).\n fragColor = vec4(col * uAlpha, uAlpha);\n}\n", F = "[Aurora]", I = /* @__PURE__ */ "uTime.uPalette.uStopCount.uNucleiCount.uNucleiPos.uNucleiRadius.uNucleiPaletteBias.uNucleiValueBias.uNucleiDriftRadius.uNucleiDriftPhase.uNucleiElong.uNucleiAngle.uSoftmaxBeta.uValueVariance.uWarpAmount.uWarpScale.uWarpDrift.uWarpMode.uNoiseOctaves.uMedium.uFlowPattern.uFlowFocal.uFlowAngle.uFlowCurl.uCursor.uCursorStrength.uCursorRadius.uStrokeAmount.uStrokeScale.uStrokeAnisotropy.uStrokeLayers.uStrokeMode.uWetEdge.uGranulation.uImpasto.uBrokenColor.uCanvasGrain.uNucleiDrift.uPaletteDrift.uBreathDepth.uBreathPeriod.uSaturation.uPaperGrain.uAlpha".split(".");
|
|
211
|
+
function L(e, t, n) {
|
|
212
|
+
let i = o(e, e.VERTEX_SHADER, t, F), a = o(e, e.FRAGMENT_SHADER, n, F), s = r(e, i, a, F);
|
|
213
|
+
e.useProgram(s);
|
|
214
|
+
let c = e.createVertexArray();
|
|
215
|
+
e.bindVertexArray(c);
|
|
216
|
+
let l = e.createBuffer();
|
|
217
|
+
e.bindBuffer(e.ARRAY_BUFFER, l), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
218
|
+
-1,
|
|
219
|
+
-1,
|
|
220
|
+
3,
|
|
221
|
+
-1,
|
|
222
|
+
-1,
|
|
223
|
+
3
|
|
224
|
+
]), e.STATIC_DRAW);
|
|
225
|
+
let u = e.getAttribLocation(s, "aPos");
|
|
226
|
+
e.enableVertexAttribArray(u), e.vertexAttribPointer(u, 2, e.FLOAT, !1, 0, 0);
|
|
227
|
+
let d = {};
|
|
228
|
+
for (let t of I) d[t] = e.getUniformLocation(s, t);
|
|
229
|
+
return {
|
|
230
|
+
program: s,
|
|
231
|
+
vs: i,
|
|
232
|
+
fs: a,
|
|
233
|
+
uniforms: d,
|
|
234
|
+
geometry: {
|
|
235
|
+
vao: c,
|
|
236
|
+
buf: l
|
|
237
|
+
}
|
|
238
|
+
};
|
|
72
239
|
}
|
|
73
|
-
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/components/custom/aurora/composables/color.ts
|
|
242
|
+
function R(e, t = 8, n) {
|
|
74
243
|
let r = n ?? new Float32Array(t * 3), i = Math.min(e.length, t);
|
|
75
244
|
for (let t = 0; t < i; t++) {
|
|
76
|
-
let [n, i, a] =
|
|
245
|
+
let [n, i, a] = u(e[t]);
|
|
77
246
|
r[t * 3 + 0] = n, r[t * 3 + 1] = i, r[t * 3 + 2] = a;
|
|
78
247
|
}
|
|
79
248
|
for (let e = i; e < t; e++) r[e * 3 + 0] = 0, r[e * 3 + 1] = 0, r[e * 3 + 2] = 0;
|
|
80
249
|
return r;
|
|
81
250
|
}
|
|
82
|
-
function
|
|
251
|
+
function z(e) {
|
|
83
252
|
if (e.length === 0) return "transparent";
|
|
84
|
-
if (e.length === 1) return
|
|
253
|
+
if (e.length === 1) return d(e[0]);
|
|
85
254
|
let t = e.length;
|
|
86
255
|
return `linear-gradient(135deg, ${e.map((e, n) => {
|
|
87
256
|
let r = Math.round(n / (t - 1) * 100);
|
|
88
|
-
return `${
|
|
257
|
+
return `${d(e)} ${r}%`;
|
|
89
258
|
}).join(", ")})`;
|
|
90
259
|
}
|
|
91
|
-
function
|
|
92
|
-
let
|
|
93
|
-
return `#${i(t)}${i(n)}${i(r)}`;
|
|
94
|
-
}
|
|
95
|
-
function P(e) {
|
|
96
|
-
let t = e.replace("#", ""), [n, r, i] = O(parseInt(t.slice(0, 2), 16), parseInt(t.slice(2, 4), 16), parseInt(t.slice(4, 6), 16));
|
|
260
|
+
function B(e) {
|
|
261
|
+
let t = e.replace("#", ""), n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), [a, o, s] = te(n / 255, r / 255, i / 255), [c, l, u] = k(a, o, s);
|
|
97
262
|
return {
|
|
98
|
-
L:
|
|
99
|
-
C:
|
|
100
|
-
h:
|
|
263
|
+
L: c,
|
|
264
|
+
C: l,
|
|
265
|
+
h: u
|
|
101
266
|
};
|
|
102
267
|
}
|
|
103
|
-
var
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
268
|
+
var V = [.35, .95];
|
|
269
|
+
function H(e, t = {}) {
|
|
270
|
+
let n = typeof e == "string" ? f(e) : e, { stopCount: r = 4, harmony: i = "analogous", lightnessSpread: a = .32, chromaFalloff: o = .85, hueSpread: s = 28 } = t, c = Math.max(2, Math.min(8, Math.round(r))), [l, u] = V, d = n.L - a / 2, p = n.L + a / 2;
|
|
271
|
+
d < l && (p += l - d, d = l), p > u && (d -= p - u, p = u), d = Math.max(l, d), p = Math.min(u, p);
|
|
272
|
+
let m = [];
|
|
273
|
+
for (let e = 0; e < c; e++) {
|
|
274
|
+
let t = c === 1 ? 0 : e / (c - 1), r = d + (p - d) * t, a = n.C * (1 - (1 - o) * t), l = U(n.h, i, s, t);
|
|
275
|
+
m.push(W({
|
|
276
|
+
L: r,
|
|
277
|
+
C: a,
|
|
278
|
+
h: l
|
|
279
|
+
}));
|
|
108
280
|
}
|
|
109
|
-
|
|
110
|
-
let t = F.getImageData(0, 0, 1, 1).data;
|
|
111
|
-
return [
|
|
112
|
-
t[0],
|
|
113
|
-
t[1],
|
|
114
|
-
t[2]
|
|
115
|
-
];
|
|
281
|
+
return m;
|
|
116
282
|
}
|
|
117
|
-
function
|
|
118
|
-
let
|
|
283
|
+
function U(e, t, n, r) {
|
|
284
|
+
let i = (e) => (e % 360 + 360) % 360;
|
|
285
|
+
switch (t) {
|
|
286
|
+
case "monochrome": return i(e);
|
|
287
|
+
case "complementary": return i(e + 180 * r);
|
|
288
|
+
case "triad": return i(e + 240 * r);
|
|
289
|
+
default: return i(e + n * (r - .5) * 2);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function W(e) {
|
|
293
|
+
let [t, n, r] = A(e.L, e.C, e.h), [i, a, o] = E(t, n, r), [s, c, l] = k(i, a, o), u = c;
|
|
294
|
+
for (let e = 0; e < 6; e++) {
|
|
295
|
+
let [e, t, n] = A(s, u, l), [r, i, a] = O(e, t, n);
|
|
296
|
+
if (D(r, i, a)) break;
|
|
297
|
+
u *= .999;
|
|
298
|
+
}
|
|
119
299
|
return {
|
|
120
|
-
L:
|
|
121
|
-
C:
|
|
122
|
-
h:
|
|
300
|
+
L: s,
|
|
301
|
+
C: u,
|
|
302
|
+
h: l
|
|
123
303
|
};
|
|
124
304
|
}
|
|
125
305
|
//#endregion
|
|
126
|
-
//#region src/components/custom/aurora/composables/
|
|
127
|
-
var
|
|
306
|
+
//#region src/components/custom/aurora/composables/uniformBridge.ts
|
|
307
|
+
var G = {
|
|
128
308
|
smooth: 0,
|
|
129
309
|
pastel: 1,
|
|
130
310
|
watercolor: 2,
|
|
131
|
-
oil: 3
|
|
132
|
-
|
|
311
|
+
oil: 3,
|
|
312
|
+
crayon: 4
|
|
313
|
+
}, K = {
|
|
133
314
|
none: 0,
|
|
134
315
|
radial: 1,
|
|
135
316
|
swirl: 2,
|
|
136
317
|
diagonal: 3,
|
|
137
318
|
multi: 4
|
|
138
|
-
},
|
|
319
|
+
}, se = {
|
|
139
320
|
fbm: 0,
|
|
140
321
|
cellular: 1,
|
|
141
322
|
hybrid: 2
|
|
142
|
-
},
|
|
323
|
+
}, q = {
|
|
143
324
|
oil: 0,
|
|
144
325
|
knife: 1,
|
|
145
|
-
crayon: 2,
|
|
146
326
|
chunky: 3
|
|
147
|
-
}
|
|
148
|
-
function
|
|
149
|
-
return e.
|
|
327
|
+
};
|
|
328
|
+
function ce(e) {
|
|
329
|
+
return e.medium === "oil" && e.strokeMode === "crayon" ? G.crayon : G[e.medium];
|
|
150
330
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
331
|
+
function le(e) {
|
|
332
|
+
return e.strokeMode === "crayon" ? q.oil : q[e.strokeMode];
|
|
153
333
|
}
|
|
154
|
-
function
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
334
|
+
function ue(e, t, n, r) {
|
|
335
|
+
let i = (e) => 1 - e, a = {
|
|
336
|
+
palette: new Float32Array(24),
|
|
337
|
+
pos: new Float32Array(12),
|
|
338
|
+
rad: new Float32Array(6),
|
|
339
|
+
pb: new Float32Array(6),
|
|
340
|
+
vb: new Float32Array(6),
|
|
341
|
+
dr: new Float32Array(6),
|
|
342
|
+
dp: new Float32Array(6),
|
|
343
|
+
elong: new Float32Array(6),
|
|
344
|
+
angle: new Float32Array(6)
|
|
345
|
+
};
|
|
346
|
+
return function(o) {
|
|
347
|
+
e.useProgram(t), R(o.palette, 8, a.palette), e.uniform3fv(n.uPalette, a.palette), e.uniform1i(n.uStopCount, Math.min(o.palette.length, 8));
|
|
348
|
+
let s = Math.min(o.nuclei.length, 6);
|
|
349
|
+
e.uniform1i(n.uNucleiCount, s);
|
|
350
|
+
for (let e = 0; e < s; e++) {
|
|
351
|
+
let t = o.nuclei[e];
|
|
352
|
+
a.pos[e * 2 + 0] = t.x, a.pos[e * 2 + 1] = i(t.y), a.rad[e] = t.radius, a.pb[e] = t.paletteBias, a.vb[e] = t.valueBias, a.dr[e] = t.driftRadius, a.dp[e] = t.driftPhase, a.elong[e] = t.elongation ?? 1, a.angle[e] = -(t.angle ?? 0) * Math.PI / 180;
|
|
353
|
+
}
|
|
354
|
+
for (let e = s; e < 6; e++) a.pos[e * 2 + 0] = 0, a.pos[e * 2 + 1] = 0, a.rad[e] = 0, a.pb[e] = 0, a.vb[e] = 0, a.dr[e] = 0, a.dp[e] = 0, a.elong[e] = 1, a.angle[e] = 0;
|
|
355
|
+
e.uniform2fv(n.uNucleiPos, a.pos), e.uniform1fv(n.uNucleiRadius, a.rad), e.uniform1fv(n.uNucleiPaletteBias, a.pb), e.uniform1fv(n.uNucleiValueBias, a.vb), e.uniform1fv(n.uNucleiDriftRadius, a.dr), e.uniform1fv(n.uNucleiDriftPhase, a.dp), e.uniform1fv(n.uNucleiElong, a.elong), e.uniform1fv(n.uNucleiAngle, a.angle), e.uniform1f(n.uSoftmaxBeta, o.softmaxBeta), e.uniform1f(n.uValueVariance, o.valueVariance), e.uniform1f(n.uWarpAmount, o.warpAmount), e.uniform1f(n.uWarpScale, o.warpScale), e.uniform1f(n.uWarpDrift, o.warpDrift), e.uniform1i(n.uWarpMode, se[o.warpMode]), e.uniform1i(n.uNoiseOctaves, o.noiseOctaves), e.uniform1i(n.uMedium, ce(o)), e.uniform1i(n.uFlowPattern, K[o.flow.pattern]), e.uniform2f(n.uFlowFocal, o.flow.focalX, i(o.flow.focalY)), e.uniform1f(n.uFlowAngle, o.flow.angle), e.uniform1f(n.uFlowCurl, o.flow.curl), e.uniform2f(n.uCursor, r.x, i(r.y)), e.uniform1f(n.uCursorStrength, r.strength), e.uniform1f(n.uCursorRadius, r.radius), e.uniform1f(n.uStrokeAmount, o.strokeAmount), e.uniform1f(n.uStrokeScale, o.strokeScale), e.uniform1f(n.uStrokeAnisotropy, o.strokeAnisotropy), e.uniform1i(n.uStrokeLayers, o.strokeLayers), e.uniform1i(n.uStrokeMode, le(o)), e.uniform1f(n.uWetEdge, o.wetEdge), e.uniform1f(n.uGranulation, o.granulation), e.uniform1f(n.uImpasto, o.impasto), e.uniform1f(n.uBrokenColor, o.brokenColor), e.uniform1f(n.uCanvasGrain, o.canvasGrain), e.uniform1f(n.uNucleiDrift, o.nucleiDrift), e.uniform1f(n.uPaletteDrift, o.paletteDrift), e.uniform1f(n.uBreathDepth, o.breathDepth), e.uniform1f(n.uBreathPeriod, o.breathPeriod), e.uniform1f(n.uSaturation, o.saturation), e.uniform1f(n.uPaperGrain, o.paperGrain), e.uniform1f(n.uAlpha, o.alpha);
|
|
356
|
+
};
|
|
169
357
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
function d(e) {
|
|
176
|
-
let t = o();
|
|
177
|
-
a.add(e), t && !o() && (cancelAnimationFrame(l), l = 0);
|
|
178
|
-
}
|
|
179
|
-
function f(e) {
|
|
180
|
-
let t = !o();
|
|
181
|
-
a.delete(e), t && o() && u && (c = performance.now() - 1e3, u());
|
|
182
|
-
}
|
|
183
|
-
let p = typeof document < "u";
|
|
184
|
-
function m() {
|
|
185
|
-
document.hidden ? d("tab-hidden") : f("tab-hidden");
|
|
186
|
-
}
|
|
187
|
-
p && document.addEventListener("visibilitychange", m);
|
|
188
|
-
let h = {
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/components/custom/aurora/composables/cursorModel.ts
|
|
360
|
+
var J = .22, de = .18, fe = .992;
|
|
361
|
+
function pe() {
|
|
362
|
+
return {
|
|
189
363
|
x: .5,
|
|
190
364
|
y: .5,
|
|
191
365
|
targetX: .5,
|
|
@@ -193,127 +367,104 @@ function X(e, t, n = {}) {
|
|
|
193
367
|
strength: 0,
|
|
194
368
|
targetStrength: 0,
|
|
195
369
|
radius: .25
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function me(e) {
|
|
373
|
+
e.x += (e.targetX - e.x) * J, e.y += (e.targetY - e.y) * J, e.strength += (e.targetStrength - e.strength) * de, e.targetStrength *= fe;
|
|
374
|
+
}
|
|
375
|
+
function he(e) {
|
|
376
|
+
return e.targetStrength > .001 || e.strength > .001 || Math.abs(e.x - e.targetX) > .001 || Math.abs(e.y - e.targetY) > .001;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/components/custom/aurora/composables/frameLoop.ts
|
|
380
|
+
function ge(e) {
|
|
381
|
+
let { gl: t, prog: n, uniforms: r, cursor: i, getConfig: a, getReducedMotion: o } = e, s = (e) => 1 - e;
|
|
382
|
+
function c(e) {
|
|
383
|
+
t.useProgram(n), t.uniform2f(r.uCursor, i.x, s(i.y)), t.uniform1f(r.uCursorStrength, i.strength), t.uniform1f(r.uCursorRadius, i.radius), t.uniform1f(r.uTime, e), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLES, 0, 3);
|
|
205
384
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
385
|
+
function l() {
|
|
386
|
+
if (o()) return !1;
|
|
387
|
+
let e = a();
|
|
388
|
+
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 ? !0 : he(i);
|
|
208
389
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
390
|
+
return {
|
|
391
|
+
frame: (e) => {
|
|
392
|
+
me(i), c(e);
|
|
393
|
+
},
|
|
394
|
+
needsAnimation: l
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/components/custom/aurora/composables/runtime.ts
|
|
399
|
+
function _e(e) {
|
|
400
|
+
return e.mode === "capture" ? !0 : e.initStrategy === "eager";
|
|
401
|
+
}
|
|
402
|
+
function Y(e) {
|
|
403
|
+
return typeof e.preserveDrawingBuffer == "boolean" ? e.preserveDrawingBuffer : e.mode === "capture";
|
|
404
|
+
}
|
|
405
|
+
function X(e, t, r = {}) {
|
|
406
|
+
let i = Y(r), o = t, s = pe(), c = null, l = a(e, {
|
|
407
|
+
mode: r.mode === "capture" ? "capture" : "live",
|
|
408
|
+
contextAttrs: {
|
|
212
409
|
antialias: !1,
|
|
213
410
|
alpha: !0,
|
|
214
411
|
premultipliedAlpha: !0,
|
|
215
|
-
preserveDrawingBuffer:
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
let p = t.createBuffer();
|
|
223
|
-
t.bindBuffer(t.ARRAY_BUFFER, p), t.bufferData(t.ARRAY_BUFFER, new Float32Array([
|
|
224
|
-
-1,
|
|
225
|
-
-1,
|
|
226
|
-
3,
|
|
227
|
-
-1,
|
|
228
|
-
-1,
|
|
229
|
-
3
|
|
230
|
-
]), t.STATIC_DRAW);
|
|
231
|
-
let m = t.getAttribLocation(d, "aPos");
|
|
232
|
-
t.enableVertexAttribArray(m), t.vertexAttribPointer(m, 2, t.FLOAT, !1, 0, 0);
|
|
233
|
-
let b = {};
|
|
234
|
-
for (let e of ee) b[e] = t.getUniformLocation(d, e);
|
|
235
|
-
function x() {
|
|
236
|
-
let n = Math.min(window.devicePixelRatio || 1, 2), r = e.clientWidth || e.parentElement?.clientWidth || 1, i = e.clientHeight || e.parentElement?.clientHeight || 1, a = Math.max(1, Math.floor(r * n)), o = Math.max(1, Math.floor(i * n));
|
|
237
|
-
e.width = a, e.height = o, t.viewport(0, 0, a, o), t.useProgram(d);
|
|
238
|
-
}
|
|
239
|
-
let S = new ResizeObserver(() => x());
|
|
240
|
-
S.observe(e), requestAnimationFrame(() => {
|
|
241
|
-
x(), requestAnimationFrame(x);
|
|
242
|
-
});
|
|
243
|
-
let C = {
|
|
244
|
-
palette: new Float32Array(24),
|
|
245
|
-
pos: new Float32Array(12),
|
|
246
|
-
rad: new Float32Array(6),
|
|
247
|
-
pb: new Float32Array(6),
|
|
248
|
-
vb: new Float32Array(6),
|
|
249
|
-
dr: new Float32Array(6),
|
|
250
|
-
dp: new Float32Array(6),
|
|
251
|
-
elong: new Float32Array(6),
|
|
252
|
-
angle: new Float32Array(6)
|
|
253
|
-
};
|
|
254
|
-
function w(e) {
|
|
255
|
-
i = e, t.useProgram(d), j(e.palette, 8, C.palette), t.uniform3fv(b.uPalette, C.palette), t.uniform1i(b.uStopCount, Math.min(e.palette.length, 8));
|
|
256
|
-
let n = Math.min(e.nuclei.length, 6);
|
|
257
|
-
t.uniform1i(b.uNucleiCount, n);
|
|
258
|
-
for (let t = 0; t < n; t++) {
|
|
259
|
-
let n = e.nuclei[t];
|
|
260
|
-
C.pos[t * 2 + 0] = n.x, C.pos[t * 2 + 1] = 1 - n.y, C.rad[t] = n.radius, C.pb[t] = n.paletteBias, C.vb[t] = n.valueBias, C.dr[t] = n.driftRadius, C.dp[t] = n.driftPhase, C.elong[t] = n.elongation ?? 1, C.angle[t] = -(n.angle ?? 0) * Math.PI / 180;
|
|
412
|
+
preserveDrawingBuffer: i
|
|
413
|
+
},
|
|
414
|
+
setup: (t) => {
|
|
415
|
+
let { program: r, vs: i, fs: a, uniforms: u, geometry: d } = L(t, ne, P);
|
|
416
|
+
function f() {
|
|
417
|
+
let i = n(), a = e.clientWidth || e.parentElement?.clientWidth || 1, o = e.clientHeight || e.parentElement?.clientHeight || 1, s = Math.max(1, Math.floor(a * i)), c = Math.max(1, Math.floor(o * i));
|
|
418
|
+
e.width = s, e.height = c, t.viewport(0, 0, s, c), t.useProgram(r);
|
|
261
419
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
t.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
function A(e) {
|
|
285
|
-
E(e);
|
|
286
|
-
}
|
|
287
|
-
function M() {
|
|
288
|
-
cancelAnimationFrame(l), l = 0, u = null, S.disconnect(), t.deleteProgram(d), t.deleteShader(n), t.deleteShader(a), t.deleteBuffer(p), t.deleteVertexArray(f);
|
|
289
|
-
let e = t.getExtension("WEBGL_lose_context");
|
|
290
|
-
e && e.loseContext();
|
|
420
|
+
let p = ue(t, r, u, s), m = ge({
|
|
421
|
+
gl: t,
|
|
422
|
+
prog: r,
|
|
423
|
+
uniforms: u,
|
|
424
|
+
cursor: s,
|
|
425
|
+
getConfig: () => o,
|
|
426
|
+
getReducedMotion: () => l.reducedMotion
|
|
427
|
+
});
|
|
428
|
+
return t.clearColor(0, 0, 0, 0), t.disable(t.DEPTH_TEST), t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA), c = (e) => {
|
|
429
|
+
o = e, p(e);
|
|
430
|
+
}, c(o), requestAnimationFrame(() => {
|
|
431
|
+
f(), requestAnimationFrame(f);
|
|
432
|
+
}), {
|
|
433
|
+
frame: m.frame,
|
|
434
|
+
shouldContinue: m.needsAnimation,
|
|
435
|
+
resize: f,
|
|
436
|
+
time: (e) => l.reducedMotion ? 3.7 : e,
|
|
437
|
+
teardown: () => {
|
|
438
|
+
t.deleteProgram(r), t.deleteShader(i), t.deleteShader(a), t.deleteBuffer(d.buf), t.deleteVertexArray(d.vao);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
291
441
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
442
|
+
});
|
|
443
|
+
function u(e, t, n = .8) {
|
|
444
|
+
s.targetX = e, s.targetY = t, s.targetStrength = n, l.wake();
|
|
445
|
+
}
|
|
446
|
+
function d() {
|
|
447
|
+
s.targetStrength = 0, l.wake();
|
|
448
|
+
}
|
|
449
|
+
function f(e) {
|
|
450
|
+
s.radius = e, l.wake();
|
|
298
451
|
}
|
|
299
|
-
function
|
|
300
|
-
|
|
452
|
+
function p(e) {
|
|
453
|
+
l.wake();
|
|
301
454
|
}
|
|
302
|
-
return
|
|
303
|
-
arm:
|
|
455
|
+
return r.mode !== "capture" && _e(r) && l.arm(), {
|
|
456
|
+
arm: () => l.arm(),
|
|
304
457
|
update: (e) => {
|
|
305
|
-
|
|
458
|
+
o = e, c?.(e), l.wake();
|
|
306
459
|
},
|
|
307
|
-
setCursor:
|
|
308
|
-
clearCursor:
|
|
309
|
-
setCursorRadius:
|
|
310
|
-
setReducedMotion:
|
|
311
|
-
pause: (e = "manual") =>
|
|
312
|
-
resume: (e = "manual") =>
|
|
313
|
-
renderAt: (e) =>
|
|
314
|
-
dispose: () =>
|
|
315
|
-
g ? g.dispose() : _ = !0, T();
|
|
316
|
-
}
|
|
460
|
+
setCursor: u,
|
|
461
|
+
clearCursor: d,
|
|
462
|
+
setCursorRadius: f,
|
|
463
|
+
setReducedMotion: p,
|
|
464
|
+
pause: (e = "manual") => l.suspend(e),
|
|
465
|
+
resume: (e = "manual") => l.resume(e),
|
|
466
|
+
renderAt: (e) => l.renderAt(e),
|
|
467
|
+
dispose: () => l.dispose()
|
|
317
468
|
};
|
|
318
469
|
}
|
|
319
470
|
//#endregion
|
|
@@ -323,7 +474,7 @@ function Z(e) {
|
|
|
323
474
|
}
|
|
324
475
|
//#endregion
|
|
325
476
|
//#region src/components/custom/aurora/composables/useAurora.ts
|
|
326
|
-
function
|
|
477
|
+
function ve(e) {
|
|
327
478
|
if (typeof window > "u") return () => {};
|
|
328
479
|
if (typeof window.requestIdleCallback == "function") {
|
|
329
480
|
let t = window.requestIdleCallback(() => e(), { timeout: 2e3 });
|
|
@@ -341,11 +492,11 @@ function te(e) {
|
|
|
341
492
|
};
|
|
342
493
|
}
|
|
343
494
|
function Q(e, t, n = {}, r = {}) {
|
|
344
|
-
let
|
|
345
|
-
function
|
|
346
|
-
|
|
495
|
+
let i = Z(t), a = r.renderMode === "css", o = null, s = null, c = null, l = null, u = null, d = null, f = !1, m = w(!1), h = n.mode === "capture" || n.initStrategy === "eager";
|
|
496
|
+
function g() {
|
|
497
|
+
d && o && o.setReducedMotion(d.matches);
|
|
347
498
|
}
|
|
348
|
-
function
|
|
499
|
+
function _(e) {
|
|
349
500
|
let t = e instanceof Error ? e : Error(String(e));
|
|
350
501
|
if (n.onInitError) {
|
|
351
502
|
n.onInitError(t);
|
|
@@ -353,58 +504,58 @@ function Q(e, t, n = {}, r = {}) {
|
|
|
353
504
|
}
|
|
354
505
|
Promise.reject(t);
|
|
355
506
|
}
|
|
356
|
-
function
|
|
357
|
-
if (!(
|
|
358
|
-
|
|
507
|
+
function v() {
|
|
508
|
+
if (!(f || !o)) {
|
|
509
|
+
f = !0;
|
|
359
510
|
try {
|
|
360
|
-
|
|
511
|
+
o.arm();
|
|
361
512
|
} catch (e) {
|
|
362
|
-
|
|
513
|
+
_(e);
|
|
363
514
|
return;
|
|
364
515
|
}
|
|
365
|
-
|
|
516
|
+
m.value = !0, d = window.matchMedia("(prefers-reduced-motion: reduce)"), d.addEventListener("change", g), s = T(i, (e) => o?.update(e), { deep: !0 });
|
|
366
517
|
}
|
|
367
518
|
}
|
|
368
|
-
return
|
|
519
|
+
return x(() => {
|
|
369
520
|
let t = e.value;
|
|
370
|
-
if (!t ||
|
|
521
|
+
if (!t || a) return;
|
|
371
522
|
try {
|
|
372
|
-
|
|
523
|
+
o = X(t, i(), {
|
|
373
524
|
initStrategy: "deferred",
|
|
374
525
|
...n
|
|
375
526
|
});
|
|
376
527
|
} catch (e) {
|
|
377
|
-
|
|
528
|
+
_(e);
|
|
378
529
|
return;
|
|
379
530
|
}
|
|
380
|
-
if (
|
|
381
|
-
|
|
531
|
+
if (h) {
|
|
532
|
+
v();
|
|
382
533
|
return;
|
|
383
534
|
}
|
|
384
|
-
|
|
385
|
-
pause: () =>
|
|
386
|
-
resume: () =>
|
|
535
|
+
u = p(e, {
|
|
536
|
+
pause: () => o?.pause("off-screen"),
|
|
537
|
+
resume: () => o?.resume("off-screen")
|
|
387
538
|
}, { pauseWhenHidden: !1 });
|
|
388
|
-
let r =
|
|
389
|
-
|
|
390
|
-
!e ||
|
|
391
|
-
|
|
539
|
+
let r = u.isIntersecting;
|
|
540
|
+
c = T(r, (e) => {
|
|
541
|
+
!e || f || l || (l = ve(() => {
|
|
542
|
+
l = null, r.value && v();
|
|
392
543
|
}));
|
|
393
544
|
}, { immediate: !0 });
|
|
394
|
-
}),
|
|
395
|
-
|
|
545
|
+
}), b(() => {
|
|
546
|
+
l?.(), c?.(), s?.(), u?.dispose(), d?.removeEventListener("change", g), o?.dispose(), o = null;
|
|
396
547
|
}), {
|
|
397
|
-
setCursor: (e, t, n) =>
|
|
398
|
-
clearCursor: () =>
|
|
399
|
-
setCursorRadius: (e) =>
|
|
400
|
-
renderAt: (e) =>
|
|
401
|
-
pause: () =>
|
|
402
|
-
resume: () =>
|
|
403
|
-
isArmed: m
|
|
548
|
+
setCursor: (e, t, n) => o?.setCursor(e, t, n),
|
|
549
|
+
clearCursor: () => o?.clearCursor(),
|
|
550
|
+
setCursorRadius: (e) => o?.setCursorRadius(e),
|
|
551
|
+
renderAt: (e) => o?.renderAt(e),
|
|
552
|
+
pause: () => o?.pause(),
|
|
553
|
+
resume: () => o?.resume(),
|
|
554
|
+
isArmed: C(m)
|
|
404
555
|
};
|
|
405
556
|
}
|
|
406
557
|
//#endregion
|
|
407
|
-
//#region src/components/custom/aurora/renderMode.ts
|
|
558
|
+
//#region src/components/custom/aurora/constants/renderMode.ts
|
|
408
559
|
function $(e) {
|
|
409
560
|
if (e !== "auto") return e;
|
|
410
561
|
if (typeof navigator > "u" || typeof window > "u") return "webgl";
|
|
@@ -413,48 +564,48 @@ function $(e) {
|
|
|
413
564
|
}
|
|
414
565
|
//#endregion
|
|
415
566
|
//#region src/components/custom/aurora/Aurora.vue
|
|
416
|
-
var
|
|
567
|
+
var ye = /* @__PURE__ */ e(/* @__PURE__ */ _({
|
|
417
568
|
__name: "Aurora",
|
|
418
569
|
props: {
|
|
419
|
-
config: { default: () =>
|
|
570
|
+
config: { default: () => l },
|
|
420
571
|
runtimeOptions: {},
|
|
421
572
|
onInitError: {},
|
|
422
573
|
renderMode: { default: "auto" },
|
|
423
574
|
opacityCeiling: { default: 1 }
|
|
424
575
|
},
|
|
425
576
|
setup(e, { expose: t }) {
|
|
426
|
-
let n = e, r = $(n.renderMode), i =
|
|
577
|
+
let n = e, r = $(n.renderMode), i = m(() => Math.max(0, Math.min(1, n.opacityCeiling))), a = w(null), o = Q(a, () => n.config, m(() => ({
|
|
427
578
|
...n.runtimeOptions ?? {},
|
|
428
579
|
...n.onInitError ? { onInitError: n.onInitError } : {}
|
|
429
|
-
})).value, { renderMode: r }),
|
|
580
|
+
})).value, { renderMode: r }), s = m(() => z(n.config.palette));
|
|
430
581
|
return t({
|
|
431
582
|
config: n.config,
|
|
432
|
-
canvasRef:
|
|
433
|
-
setCursor:
|
|
434
|
-
clearCursor:
|
|
435
|
-
setCursorRadius:
|
|
436
|
-
renderAt:
|
|
437
|
-
pause:
|
|
438
|
-
resume:
|
|
439
|
-
isArmed:
|
|
440
|
-
}), (e, t) => (
|
|
583
|
+
canvasRef: a,
|
|
584
|
+
setCursor: o.setCursor,
|
|
585
|
+
clearCursor: o.clearCursor,
|
|
586
|
+
setCursorRadius: o.setCursorRadius,
|
|
587
|
+
renderAt: o.renderAt,
|
|
588
|
+
pause: o.pause,
|
|
589
|
+
resume: o.resume,
|
|
590
|
+
isArmed: o.isArmed
|
|
591
|
+
}), (e, t) => (S(), h("div", {
|
|
441
592
|
class: "aurora-root block h-full w-full overflow-hidden",
|
|
442
|
-
style:
|
|
443
|
-
}, [
|
|
593
|
+
style: y({ "--aurora-opacity-ceiling": i.value })
|
|
594
|
+
}, [g("div", {
|
|
444
595
|
class: "aurora-placeholder h-full w-full",
|
|
445
596
|
"aria-hidden": "true",
|
|
446
|
-
style:
|
|
447
|
-
}, null, 4),
|
|
597
|
+
style: y({ backgroundImage: s.value })
|
|
598
|
+
}, null, 4), g("canvas", {
|
|
448
599
|
ref_key: "canvasRef",
|
|
449
|
-
ref:
|
|
600
|
+
ref: a,
|
|
450
601
|
"aria-hidden": "true",
|
|
451
|
-
class:
|
|
602
|
+
class: v(["aurora-canvas block h-full w-full", { "aurora-canvas--armed": ee(o).isArmed.value }])
|
|
452
603
|
}, null, 2)], 4));
|
|
453
604
|
}
|
|
454
|
-
}), [["__scopeId", "data-v-
|
|
605
|
+
}), [["__scopeId", "data-v-c5277232"]]);
|
|
455
606
|
//#endregion
|
|
456
607
|
//#region src/components/custom/aurora/composables/useCursorInteraction.ts
|
|
457
|
-
function
|
|
608
|
+
function be(e, t, n) {
|
|
458
609
|
let r = Z(t), i = n.hitFraction ?? .35, a = null, o = null;
|
|
459
610
|
function s(e, t) {
|
|
460
611
|
let n = t.getBoundingClientRect();
|
|
@@ -483,38 +634,38 @@ function re(e, t, n) {
|
|
|
483
634
|
}
|
|
484
635
|
return i > 1e-4 ? n / i : .5;
|
|
485
636
|
}
|
|
486
|
-
function
|
|
637
|
+
function d() {
|
|
487
638
|
if (r().nuclei.length === 0) return .5;
|
|
488
639
|
let e = r().nuclei.map((e) => e.radius).sort((e, t) => e - t);
|
|
489
640
|
return e[Math.floor(e.length / 2)];
|
|
490
641
|
}
|
|
491
|
-
function
|
|
642
|
+
function f(e, t) {
|
|
492
643
|
return {
|
|
493
644
|
x: e,
|
|
494
645
|
y: t,
|
|
495
|
-
radius:
|
|
646
|
+
radius: d(),
|
|
496
647
|
paletteBias: u(e, t),
|
|
497
648
|
valueBias: 0,
|
|
498
649
|
driftRadius: .012,
|
|
499
650
|
driftPhase: Math.random() * Math.PI * 2
|
|
500
651
|
};
|
|
501
652
|
}
|
|
502
|
-
function
|
|
653
|
+
function p(t) {
|
|
503
654
|
let i = e.value;
|
|
504
655
|
if (!i) return;
|
|
505
656
|
let { x: o, y: c } = s(t, i);
|
|
506
657
|
a !== null && (r().nuclei[a].x = Math.max(0, Math.min(1, o)), r().nuclei[a].y = Math.max(0, Math.min(1, c))), n.setCursor(o, c, 1);
|
|
507
658
|
}
|
|
508
|
-
function
|
|
659
|
+
function m() {
|
|
509
660
|
a === null && n.clearCursor();
|
|
510
661
|
}
|
|
511
|
-
function
|
|
662
|
+
function h(t) {
|
|
512
663
|
let n = e.value;
|
|
513
664
|
if (!n) return;
|
|
514
665
|
let { x: i, y: c } = s(t, n), u = l(i, c);
|
|
515
666
|
if (t.altKey && u === null) {
|
|
516
667
|
if (r().nuclei.length >= 6) return;
|
|
517
|
-
r().nuclei.push(
|
|
668
|
+
r().nuclei.push(f(i, c)), t.preventDefault();
|
|
518
669
|
return;
|
|
519
670
|
}
|
|
520
671
|
if ((t.shiftKey || t.button === 2) && u !== null) {
|
|
@@ -524,7 +675,7 @@ function re(e, t, n) {
|
|
|
524
675
|
}
|
|
525
676
|
u !== null && t.button === 0 && (a = u, o = t.pointerId, n.setPointerCapture(t.pointerId), t.preventDefault());
|
|
526
677
|
}
|
|
527
|
-
function
|
|
678
|
+
function g(t) {
|
|
528
679
|
let n = e.value;
|
|
529
680
|
if (n && o !== null && t.pointerId === o) {
|
|
530
681
|
try {
|
|
@@ -533,7 +684,7 @@ function re(e, t, n) {
|
|
|
533
684
|
o = null, a = null;
|
|
534
685
|
}
|
|
535
686
|
}
|
|
536
|
-
function
|
|
687
|
+
function _(t) {
|
|
537
688
|
let n = e.value;
|
|
538
689
|
if (!n) return;
|
|
539
690
|
let i = {
|
|
@@ -542,13 +693,13 @@ function re(e, t, n) {
|
|
|
542
693
|
}, a = n.getBoundingClientRect(), o = l((i.clientX - a.left) / Math.max(a.width, 1), (i.clientY - a.top) / Math.max(a.height, 1));
|
|
543
694
|
o !== null && r().nuclei.length > 1 && (r().nuclei.splice(o, 1), t.preventDefault());
|
|
544
695
|
}
|
|
545
|
-
return
|
|
696
|
+
return x(() => {
|
|
546
697
|
let t = e.value;
|
|
547
|
-
t && (t.addEventListener("pointermove",
|
|
548
|
-
}),
|
|
698
|
+
t && (t.addEventListener("pointermove", p), t.addEventListener("pointerleave", m), t.addEventListener("pointerdown", h), t.addEventListener("pointerup", g), t.addEventListener("pointercancel", g), t.addEventListener("contextmenu", _));
|
|
699
|
+
}), b(() => {
|
|
549
700
|
let t = e.value;
|
|
550
|
-
t && (t.removeEventListener("pointermove",
|
|
701
|
+
t && (t.removeEventListener("pointermove", p), t.removeEventListener("pointerleave", m), t.removeEventListener("pointerdown", h), t.removeEventListener("pointerup", g), t.removeEventListener("pointercancel", g), t.removeEventListener("contextmenu", _));
|
|
551
702
|
}), { isDragging: () => a };
|
|
552
703
|
}
|
|
553
704
|
//#endregion
|
|
554
|
-
export {
|
|
705
|
+
export { ye as Aurora, l as DEFAULT_AURORA_CONFIG, s as MAX_NUCLEI, c as MAX_STOPS, X as createAurora, f as cssToOklch, H as deriveAurora, R as flattenPalette, B as hexToOklchStop, d as oklchStopToHex, u as oklchToLinear, z as paletteToCssGradient, $ as resolveRenderMode, Q as useAurora, be as useCursorInteraction };
|