@tarsis/toolkit 0.7.3 → 0.7.5
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/{Container-BVX2MW1U.cjs → Container-DBXALrl1.cjs} +1 -1
- package/dist/{SelectBase-BC6WKZVF.cjs → SelectBase-CKsJgF0R.cjs} +3 -7
- package/dist/{SelectBase-DPcXvMTa.js → SelectBase-CdQKpIjl.js} +2 -6
- package/dist/components/Accordions/Expand/Expand.d.ts +8 -0
- package/dist/components/Accordions/GridAccordion/GridAccordion.d.ts +1 -0
- package/dist/components/Accordions/MinimalisticAccordion/MinimalisticAccordion.d.ts +10 -0
- package/dist/components/Accordions/index.d.ts +3 -0
- package/dist/components/Backgrounds/BackgroundCircles/BackgroundCircles.d.ts +1 -0
- package/dist/components/Backgrounds/ComplexGradient/ComplexGradient.d.ts +1 -0
- package/dist/components/Backgrounds/RaysBackground/RaysBackground.d.ts +1 -0
- package/dist/components/Backgrounds/Texture/Texture.d.ts +5 -0
- package/dist/components/Backgrounds/WebGLSmoke/WebGLSmoke.d.ts +1 -0
- package/dist/components/Backgrounds/index.d.ts +5 -0
- package/dist/components/Badges/ComingSoonBadge/ComingSoonBadge.d.ts +1 -0
- package/dist/components/Badges/index.d.ts +1 -0
- package/dist/components/Buttons/ActivateButton/ActivateButton.d.ts +1 -0
- package/dist/components/Buttons/AirplaneAnimation/AirplaneAnimation.d.ts +1 -0
- package/dist/components/Buttons/AnimatedHoverButton/AnimatedHoverButton.d.ts +7 -0
- package/dist/components/Buttons/AnimatedHoverGlowButton/AnimatedHoverGlowButton.d.ts +1 -0
- package/dist/components/Buttons/AuroraButton/AuroraButton.d.ts +1 -0
- package/dist/components/Buttons/BubblyParticlesButton/BubblyParticlesButton.d.ts +1 -0
- package/dist/components/Buttons/BurningButton/BurningButton.d.ts +1 -0
- package/dist/components/Buttons/ButtonBase/ButtonBase.d.ts +25 -0
- package/dist/components/Buttons/ButtonHoverFill/ButtonHoverFill.d.ts +1 -0
- package/dist/components/Buttons/ButtonShimmer/ButtonShimmer.d.ts +1 -0
- package/dist/components/Buttons/ButtonWithDot/ButtonWithDot.d.ts +1 -0
- package/dist/components/Buttons/ClaymorphicHeart/ClaymorphicHeart.d.ts +5 -0
- package/dist/components/Buttons/ClickButtonParticles/ClickButtonParticles.d.ts +1 -0
- package/dist/components/Buttons/ColorfulButtons/ColorfulButtons.d.ts +1 -0
- package/dist/components/Buttons/ConfettiButton/ConfettiButton.d.ts +7 -0
- package/dist/components/Buttons/DDDButton/DDDButton.d.ts +8 -0
- package/dist/components/Buttons/DarkMatterButton/DarkMatterButton.d.ts +1 -0
- package/dist/components/Buttons/DockButton/DockButton.d.ts +8 -0
- package/dist/components/Buttons/DoubleArrowButton/DoubleArrowButton.d.ts +1 -0
- package/dist/components/Buttons/DoubleArrowCollabButton/DoubleArrowCollabButton.d.ts +7 -0
- package/dist/components/Buttons/DoubleStateButton/DoubleStateButton.d.ts +8 -0
- package/dist/components/Buttons/DynamicIconButton/DynamicIconButton.d.ts +1 -0
- package/dist/components/Buttons/EchoClickButton/EchoClickButton.d.ts +1 -0
- package/dist/components/Buttons/ElectrifiedButton/ElectrifiedButton.d.ts +1 -0
- package/dist/components/Buttons/ElectrifiedButtonGS/ElectrifiedButtonGS.d.ts +1 -0
- package/dist/components/Buttons/FailedDownloadButton/FailedDownloadButton.d.ts +1 -0
- package/dist/components/Buttons/FootprintButton/FootprintButton.d.ts +1 -0
- package/dist/components/Buttons/GalaxyButton/GalaxyButton.d.ts +1 -0
- package/dist/components/Buttons/GlassToolbar/GlassToolbar.d.ts +11 -0
- package/dist/components/Buttons/GlowButton/GlowButton.d.ts +7 -0
- package/dist/components/Buttons/GoHoverButton/GoHoverButton.d.ts +1 -0
- package/dist/components/Buttons/GodRaysButton/GodRaysButton.d.ts +1 -0
- package/dist/components/Buttons/GooeyButton/GooeyButton.d.ts +1 -0
- package/dist/components/Buttons/GravityButton/GravityButton.d.ts +1 -0
- package/dist/components/Buttons/HeartFoldButton/HeartFoldButton.d.ts +1 -0
- package/dist/components/Buttons/HoldSubmitButton/HoldSubmitButton.d.ts +1 -0
- package/dist/components/Buttons/HoverGlowButton/HoverGlowButton.d.ts +7 -0
- package/dist/components/Buttons/HoverGlowButton/HoverGlowButton.utils.d.ts +1 -0
- package/dist/components/Buttons/Ios15Button/Ios15Button.d.ts +1 -0
- package/dist/components/Buttons/MagneticButton/MagneticButton.d.ts +1 -0
- package/dist/components/Buttons/MinimalisticGlassButton/MinimalisticGlassButton.d.ts +1 -0
- package/dist/components/Buttons/MorphingSubmitButton/MorphingSubmitButton.d.ts +1 -0
- package/dist/components/Buttons/MultiStageButton/MultiStageButton.d.ts +1 -0
- package/dist/components/Buttons/NeonButton/NeonButton.d.ts +7 -0
- package/dist/components/Buttons/NoisyButton/NoisyButton.d.ts +1 -0
- package/dist/components/Buttons/OrbitalSubmitButton/OrbitalSubmitButton.d.ts +1 -0
- package/dist/components/Buttons/PaperPlanButton/PaperPlanButton.d.ts +1 -0
- package/dist/components/Buttons/PlayPauseButton/PlayPauseButton.d.ts +1 -0
- package/dist/components/Buttons/PlayPauseMusicButton/PlayPauseMusicButton.d.ts +1 -0
- package/dist/components/Buttons/PositionHover/PositionHover.d.ts +1 -0
- package/dist/components/Buttons/PredictionButton/PredictionButton.d.ts +1 -0
- package/dist/components/Buttons/PredictionButton/PredictionButton.helpers.d.ts +5 -0
- package/dist/components/Buttons/ProgressButton/ProgressButton.d.ts +7 -0
- package/dist/components/Buttons/PsychedelicButton/PsychedelicButton.d.ts +5 -0
- package/dist/components/Buttons/ReflectiveButton/MacCursor.d.ts +1 -0
- package/dist/components/Buttons/ReflectiveButton/ReflectiveButton.d.ts +23 -0
- package/dist/components/Buttons/ReflectiveButton/ReflectiveButton.helpers.d.ts +2 -0
- package/dist/components/Buttons/ReflectiveButton/reflectiveButtonTestUtils.d.ts +2 -0
- package/dist/components/Buttons/ReflectiveButton/useUserMediaVideo.d.ts +12 -0
- package/dist/components/Buttons/RepostButton/RepostButton.d.ts +1 -0
- package/dist/components/Buttons/RubberButton/RubberButton.d.ts +1 -0
- package/dist/components/Buttons/RunningButton/RunningButton.d.ts +1 -0
- package/dist/components/Buttons/ShimmerButton/ShimmerButton.d.ts +1 -0
- package/dist/components/Buttons/ShimmeringBorderGradient/ShimmeringBorderGradient.d.ts +1 -0
- package/dist/components/Buttons/ShinyCtaButton/ShinyCtaButton.d.ts +7 -0
- package/dist/components/Buttons/SkeuomorphicLikeButton/SkeuomorphicLikeButton.d.ts +1 -0
- package/dist/components/Buttons/SlidingButton/SlidingButton.d.ts +1 -0
- package/dist/components/Buttons/SlidingStepper/SlidingStepper.d.ts +1 -0
- package/dist/components/Buttons/SparkleButton/SparkleButton.d.ts +1 -0
- package/dist/components/Buttons/SparklyButton/SparklyButton.d.ts +1 -0
- package/dist/components/Buttons/SquishButton/SquishButton.d.ts +7 -0
- package/dist/components/Buttons/SuccessLoadingButton/SuccessLoadingButton.d.ts +10 -0
- package/dist/components/Buttons/ThreadsLikeButton/ThreadsLikeButton.d.ts +1 -0
- package/dist/components/Buttons/ThumbsUpButton/ThumbsUpButton.d.ts +1 -0
- package/dist/components/Buttons/TicklishButton/TicklishButton.d.ts +1 -0
- package/dist/components/Buttons/TrickButton/TrickButton.d.ts +1 -0
- package/dist/components/Buttons/index.d.ts +70 -0
- package/dist/components/Cards/AccentShardCard/AccentShardCard.d.ts +1 -0
- package/dist/components/Cards/AnimatedBlendedCard/AnimatedBlendedCard.d.ts +1 -0
- package/dist/components/Cards/BrandCard/BrandCard.d.ts +10 -0
- package/dist/components/Cards/BrandCard/FigmaLogo/FigmaLogo.d.ts +1 -0
- package/dist/components/Cards/CaptionCard/CaptionCard.d.ts +10 -0
- package/dist/components/Cards/CardGlow/CardGlow.d.ts +1 -0
- package/dist/components/Cards/CardTile/CardTile.d.ts +8 -0
- package/dist/components/Cards/ChequeredCard/ChequeredCard.d.ts +1 -0
- package/dist/components/Cards/DDDHoverCard/DDDHoverCard.d.ts +1 -0
- package/dist/components/Cards/EnvelopeTile/EnvelopeTile.d.ts +8 -0
- package/dist/components/Cards/GlowingTile/GlowingTile.d.ts +1 -0
- package/dist/components/Cards/GradientGlowingTile/GradientGlowingTile.d.ts +1 -0
- package/dist/components/Cards/HoverTile/HoverTile.d.ts +8 -0
- package/dist/components/Cards/Hoverable3DCard/Hoverable3DCard.d.ts +1 -0
- package/dist/components/Cards/ImageCard/ImageCard.d.ts +1 -0
- package/dist/components/Cards/InvertedRadius/InvertedRadius.d.ts +9 -0
- package/dist/components/Cards/PhotoCard/PhotoCard.d.ts +1 -0
- package/dist/components/Cards/ProductTile/ProductTile.d.ts +8 -0
- package/dist/components/Cards/ProfileCard/ProfileCard.d.ts +1 -0
- package/dist/components/Cards/ShineAnimation/ShineAnimation.d.ts +1 -0
- package/dist/components/Cards/ShineCard/ShineCard.d.ts +17 -0
- package/dist/components/Cards/StackingCards/StackingCards.d.ts +1 -0
- package/dist/components/Cards/index.d.ts +22 -0
- package/dist/components/Carousels/BulletsCarousel/BulletsCarousel.d.ts +1 -0
- package/dist/components/Carousels/CardCarousel/CardCarousel.d.ts +6 -0
- package/dist/components/Carousels/CardCarousel/CardCarousel.helpers.d.ts +10 -0
- package/dist/components/Carousels/CardCarousel/CardCarouselItem.d.ts +6 -0
- package/dist/components/Carousels/CoverFlowGallery/CoverFlowGallery.d.ts +1 -0
- package/dist/components/Carousels/FullScreenImageCarousel/FullScreenImageCarousel.d.ts +1 -0
- package/dist/components/Carousels/GalleryReverseScroll/GalleryReverseScroll.d.ts +1 -0
- package/dist/components/Carousels/GlideImageGallery/GlideImageGallery.d.ts +1 -0
- package/dist/components/Carousels/ListItemHover/ListItemHover.d.ts +1 -0
- package/dist/components/Carousels/RotatedCardsCarousel/RotatedCardsCarousel.d.ts +1 -0
- package/dist/components/Carousels/RotatedCardsCarousel/RotatedCardsCarousel.helpers.d.ts +6 -0
- package/dist/components/Carousels/Scroller/Scroller.d.ts +9 -0
- package/dist/components/Carousels/Scroller/Scroller.utils.d.ts +1 -0
- package/dist/components/Carousels/ShadowedCardsList/ShadowedCardsList.d.ts +1 -0
- package/dist/components/Carousels/SlidingImages/SlidingImages.d.ts +1 -0
- package/dist/components/Carousels/index.d.ts +11 -0
- package/dist/components/Checkboxes/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkboxes/CheckboxBase/CheckboxBase.d.ts +23 -0
- package/dist/components/Checkboxes/IndeterminateCheckboxes/IndeterminateCheckboxes.d.ts +1 -0
- package/dist/components/Checkboxes/StrikethroughCheckboxes/StrikethroughCheckbox.d.ts +8 -0
- package/dist/components/Checkboxes/StrikethroughCheckboxes/StrikethroughCheckboxes.d.ts +1 -0
- package/dist/components/Checkboxes/index.d.ts +5 -0
- package/dist/components/Chipses/Chips/Chips.d.ts +1 -0
- package/dist/components/Chipses/FlipChips/Chip.d.ts +7 -0
- package/dist/components/Chipses/FlipChips/FlipChips.d.ts +1 -0
- package/dist/components/Chipses/index.d.ts +2 -0
- package/dist/components/Clocks/DailClock/DailClock.d.ts +1 -0
- package/dist/components/Clocks/MotionClock/MotionClock.d.ts +1 -0
- package/dist/components/Clocks/NeumorphicAnalogClock/NeumorphicAnalogClock.d.ts +5 -0
- package/dist/components/Clocks/index.d.ts +3 -0
- package/dist/components/Cursors/CircleTextHover/CircleTextHover.d.ts +1 -0
- package/dist/components/Cursors/ClickSpark/ClickSpark.d.ts +1 -0
- package/dist/components/Cursors/DarkMatterMouseEffect/DarkMatterMouseEffect.d.ts +1 -0
- package/dist/components/Cursors/ElasticCursor/ElasticCursor.d.ts +1 -0
- package/dist/components/Cursors/MagicMouseEffect/MagicMouseEffect.d.ts +1 -0
- package/dist/components/Cursors/SplashCursor/SplashCursor.d.ts +5 -0
- package/dist/components/Cursors/index.d.ts +6 -0
- package/dist/components/Dials/DialControl/DialControl.d.ts +5 -0
- package/dist/components/Dials/DialFuturistic/DialFuturistic.d.ts +1 -0
- package/dist/components/Dials/MetalCircleController/MetalCircleController.d.ts +1 -0
- package/dist/components/Dials/index.d.ts +3 -0
- package/dist/components/Docks/Dock/Dock.d.ts +1 -0
- package/dist/components/Docks/DockHas/DockHas.d.ts +1 -0
- package/dist/components/Docks/DockMotion/DockMotion.d.ts +17 -0
- package/dist/components/Docks/DockMotion/DockMotionDivider.d.ts +1 -0
- package/dist/components/Docks/DockMotion/DockMotionEmbedded.d.ts +4 -0
- package/dist/components/Docks/DockMotion/DockMotionItem.d.ts +55 -0
- package/dist/components/Docks/DockMotion/audioCache.d.ts +2 -0
- package/dist/components/Docks/DockMotion/index.d.ts +140 -0
- package/dist/components/Docks/index.d.ts +3 -0
- package/dist/components/Grids/AutoMasonryGrid/AutoMasonryGrid.d.ts +1 -0
- package/dist/components/Grids/DenseGrid/DenseGrid.d.ts +1 -0
- package/dist/components/Grids/Grid3DCards/Grid3DCards.d.ts +1 -0
- package/dist/components/Grids/Grid3DCards/PhotoCard.d.ts +6 -0
- package/dist/components/Grids/GridHover/GridHover.d.ts +1 -0
- package/dist/components/Grids/GridViewTransition/GridViewTransition.d.ts +1 -0
- package/dist/components/Grids/LeaningCards/LeaningCards.d.ts +1 -0
- package/dist/components/Grids/index.d.ts +6 -0
- package/dist/components/Hamburgers/BoldHamburger/BoldHamburger.d.ts +1 -0
- package/dist/components/Hamburgers/HamburgerMusic/HamburgerMusic.d.ts +1 -0
- package/dist/components/Hamburgers/HamburgerX/HamburgerX.d.ts +7 -0
- package/dist/components/Hamburgers/index.d.ts +3 -0
- package/dist/components/Headers/Header/Header.d.ts +8 -0
- package/dist/components/Headers/StickyHeader/StickyHeader.d.ts +1 -0
- package/dist/components/Headers/index.d.ts +2 -0
- package/dist/components/Heros/AnimatedHeroTitle/AnimatedHeroTitle.d.ts +1 -0
- package/dist/components/Heros/ContrastBackgroundText/ContrastBackgroundText.d.ts +1 -0
- package/dist/components/Heros/FluidGooeyTextBackground/FluidGooeyTextBackground.d.ts +1 -0
- package/dist/components/Heros/index.d.ts +3 -0
- package/dist/components/Icons/GlassIcon/GlassIcon.d.ts +1 -0
- package/dist/components/Icons/NeumorphicLogo/NeumorphicLogo.d.ts +1 -0
- package/dist/components/Icons/SlidingIcon/SlidingIcon.d.ts +1 -0
- package/dist/components/Icons/SquircleAvatar/SquircleAvatar.d.ts +1 -0
- package/dist/components/Icons/index.d.ts +4 -0
- package/dist/components/Inputs/ClearInput/ClearInput.d.ts +1 -0
- package/dist/components/Inputs/EmailInput/EmailInput.d.ts +1 -0
- package/dist/components/Inputs/FloatingLabelInput/FloatingLabelInput.d.ts +1 -0
- package/dist/components/Inputs/GlowingInput/GlowingInput.d.ts +1 -0
- package/dist/components/Inputs/InputBase/InputBase.d.ts +21 -0
- package/dist/components/Inputs/InputFirework/InputFirework.d.ts +1 -0
- package/dist/components/Inputs/NewsletterInput/NewsletterInput.d.ts +1 -0
- package/dist/components/Inputs/PasswordInput/PasswordInput.d.ts +1 -0
- package/dist/components/Inputs/SearchInput/SearchInput.d.ts +1 -0
- package/dist/components/Inputs/ShadowedClick/ShadowedClick.d.ts +1 -0
- package/dist/components/Inputs/SignatureAnimation/SignatureAnimation.d.ts +6 -0
- package/dist/components/Inputs/SignatureAnimation/SignatureAnimation.letters.d.ts +20 -0
- package/dist/components/Inputs/index.d.ts +12 -0
- package/dist/components/Links/BorderLink/BorderLink.d.ts +4 -0
- package/dist/components/Links/CircleLink/CircleLink.d.ts +4 -0
- package/dist/components/Links/ForwardArrowLink/ForwardArrowLink.d.ts +1 -0
- package/dist/components/Links/PaintedLink/PaintedLink.d.ts +1 -0
- package/dist/components/Links/RegularLink/RegularLink.d.ts +6 -0
- package/dist/components/Links/ShakyLine/ShakyLine.d.ts +1 -0
- package/dist/components/Links/UnderlinedLink/UnderlinedLink.d.ts +6 -0
- package/dist/components/Links/UnderlinedLink2/UnderlinedLink2.d.ts +1 -0
- package/dist/components/Links/index.d.ts +8 -0
- package/dist/components/Loaders/AcrobaticPreloader/AcrobaticPreloader.d.ts +1 -0
- package/dist/components/Loaders/AlienSkeuomorphicLoaders/AlienSkeuomorphicLoaders.d.ts +1 -0
- package/dist/components/Loaders/CanOfDigits/CanOfDigits.d.ts +7 -0
- package/dist/components/Loaders/ChaseLoader/ChaseLoader.d.ts +1 -0
- package/dist/components/Loaders/CircleDotsLoader/CircleDotsLoader.d.ts +5 -0
- package/dist/components/Loaders/CubeLoader/CubeLoader.d.ts +1 -0
- package/dist/components/Loaders/EndlessLoader/EndlessLoader.d.ts +5 -0
- package/dist/components/Loaders/EndlessLoader/gl.d.ts +30 -0
- package/dist/components/Loaders/EndlessLoader/shaders.d.ts +2 -0
- package/dist/components/Loaders/InfiniteLoader/InfiniteLoader.d.ts +1 -0
- package/dist/components/Loaders/LoaderGenerator/LoaderGenerator.d.ts +1 -0
- package/dist/components/Loaders/LoadingBook/LoadingBook.d.ts +1 -0
- package/dist/components/Loaders/LoadingWave/LoadingWave.d.ts +1 -0
- package/dist/components/Loaders/LoadingWave/LoadingWave.utils.d.ts +1 -0
- package/dist/components/Loaders/OffTrackPreloader/OffTrackPreloader.d.ts +1 -0
- package/dist/components/Loaders/PieLoader/PieLoader.d.ts +1 -0
- package/dist/components/Loaders/PulseInLoader/PulseInLoader.d.ts +1 -0
- package/dist/components/Loaders/PulseOutLoader/PulseOutLoader.d.ts +1 -0
- package/dist/components/Loaders/RingLoader/RingLoader.d.ts +6 -0
- package/dist/components/Loaders/RoundScaleLoader/RoundScaleLoader.d.ts +1 -0
- package/dist/components/Loaders/SkateboardPreloader/SkateboardPreloader.d.ts +1 -0
- package/dist/components/Loaders/SmileyPreloader/SmileyPreloader.d.ts +1 -0
- package/dist/components/Loaders/SnowballPreloader/SnowballPreloader.d.ts +1 -0
- package/dist/components/Loaders/SpinningClickAnimation/SpinningClickAnimation.d.ts +8 -0
- package/dist/components/Loaders/StretchyLoader/StretchyLoader.d.ts +1 -0
- package/dist/components/Loaders/StuntPreloader/StuntPreloader.d.ts +1 -0
- package/dist/components/Loaders/SubtleBorderAnimation/SubtleBorderAnimation.d.ts +1 -0
- package/dist/components/Loaders/SuccessLoader/SuccessLoader.d.ts +5 -0
- package/dist/components/Loaders/ThreeDotsLoader/ThreeDotsLoader.d.ts +1 -0
- package/dist/components/Loaders/TimeCirclesLoader/TimeCirclesLoader.d.ts +1 -0
- package/dist/components/Loaders/index.d.ts +27 -0
- package/dist/components/Marquees/CardMarquee/CardMarquee.d.ts +1 -0
- package/dist/components/Marquees/Ticker/Ticker.d.ts +1 -0
- package/dist/components/Marquees/index.d.ts +2 -0
- package/dist/components/Menus/AnimatedIconsNav/AnimatedIconsNav.d.ts +1 -0
- package/dist/components/Menus/AnimatedShareMenu/AnimatedShareMenu.d.ts +1 -0
- package/dist/components/Menus/CurtainRevealMenu/CurtainRevealMenu.d.ts +5 -0
- package/dist/components/Menus/DetachedMenu/DetachedMenu.d.ts +1 -0
- package/dist/components/Menus/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/dist/components/Menus/Futuristic3DHoverMenu/Futuristic3DHoverMenu.d.ts +1 -0
- package/dist/components/Menus/GlowingDropdown/GlowingDropdown.d.ts +1 -0
- package/dist/components/Menus/GlowingDropdown/GlowingSelect.d.ts +6 -0
- package/dist/components/Menus/GlowingTabs/GlowingTab.d.ts +9 -0
- package/dist/components/Menus/GlowingTabs/GlowingTabs.d.ts +1 -0
- package/dist/components/Menus/GlowingTabs2/GlowingTab2.d.ts +10 -0
- package/dist/components/Menus/GlowingTabs2/GlowingTabs2.d.ts +1 -0
- package/dist/components/Menus/MagnifiedNavItems/MagnifiedNavItems.d.ts +1 -0
- package/dist/components/Menus/MobileNavBar/MobileNavBar.d.ts +1 -0
- package/dist/components/Menus/NavigationMenu/NavigationMenu.d.ts +1 -0
- package/dist/components/Menus/ParallaxMenu/ParallaxMenu.d.ts +1 -0
- package/dist/components/Menus/PianoNav/PianoNav.d.ts +1 -0
- package/dist/components/Menus/PinDropdown/PinDropdown.d.ts +1 -0
- package/dist/components/Menus/RadialMenu/RadialMenu.d.ts +1 -0
- package/dist/components/Menus/RadialNavigation/RadialNavigation.d.ts +18 -0
- package/dist/components/Menus/SinglePopoverMenu/SinglePopoverMenu.d.ts +1 -0
- package/dist/components/Menus/TabBarAnimation/TabBarAnimation.d.ts +14 -0
- package/dist/components/Menus/WavyMenu/WavyMenu.d.ts +1 -0
- package/dist/components/Menus/WavyMenu/WavyMenuItem.d.ts +10 -0
- package/dist/components/Menus/index.d.ts +20 -0
- package/dist/components/Pages/BugsPage/BugsPage.d.ts +7 -0
- package/dist/components/Pages/RedirectPage/RedirectPage.d.ts +1 -0
- package/dist/components/Pages/index.d.ts +2 -0
- package/dist/components/Parallax/ParallaxEmoji/ParallaxEmoji.d.ts +7 -0
- package/dist/components/Parallax/index.d.ts +1 -0
- package/dist/components/Players/ApertureVideo/ApertureVideo.d.ts +1 -0
- package/dist/components/Players/GlassMusicPlayer/GlassMusicPlayer.d.ts +13 -0
- package/dist/components/Players/index.d.ts +2 -0
- package/dist/components/Radios/RadioHopping/RadioHopping.d.ts +1 -0
- package/dist/components/Radios/RadioParticles/RadioParticles.d.ts +1 -0
- package/dist/components/Radios/RadioRolling/RadioRolling.d.ts +1 -0
- package/dist/components/Radios/RadioSlidingFocus/RadioSlidingFocus.d.ts +13 -0
- package/dist/components/Radios/index.d.ts +4 -0
- package/dist/components/Scrolls/ScrollCountdown/ScrollCountdown.d.ts +1 -0
- package/dist/components/Scrolls/ScrollDrivenTextBlowOut/ScrollDrivenTextBlowOut.d.ts +1 -0
- package/dist/components/Scrolls/ScrollTextHighlight/ScrollTextHighlight.d.ts +1 -0
- package/dist/components/Scrolls/ScrollTimeline/ScrollTimeline.d.ts +1 -0
- package/dist/components/Scrolls/ScrollWithLight/ScrollWithLight.d.ts +1 -0
- package/dist/components/Scrolls/ScrollingTextReveal/ScrollingTextReveal.d.ts +1 -0
- package/dist/components/Scrolls/index.d.ts +6 -0
- package/dist/components/Sliders/DDDRangeSlider/DDDRangeSlider.d.ts +1 -0
- package/dist/components/Sliders/GlowSlider/GlowSlider.d.ts +1 -0
- package/dist/components/Sliders/NeumorphicSlider/NeumorphicSlider.d.ts +1 -0
- package/dist/components/Sliders/index.d.ts +3 -0
- package/dist/components/Stars/FeedbackReactions/FeedbackReactions.d.ts +1 -0
- package/dist/components/Stars/index.d.ts +1 -0
- package/dist/components/Switches/DaySwitch/DaySwitch.d.ts +1 -0
- package/dist/components/Switches/GlassSwitch/GlassSwitch.d.ts +1 -0
- package/dist/components/Switches/IosSwitch/IosSwitch.d.ts +6 -0
- package/dist/components/Switches/NeonToggleSwitch/NeonToggleSwitch.d.ts +1 -0
- package/dist/components/Switches/NeuromorphicToggle/NeuromorphicToggle.d.ts +5 -0
- package/dist/components/Switches/SegmentedToggle/SegmentedToggle.d.ts +1 -0
- package/dist/components/Switches/StretchToggle/StretchToggle.d.ts +1 -0
- package/dist/components/Switches/SwitchBase/SwitchBase.d.ts +21 -0
- package/dist/components/Switches/TippingSwitch/TippingSwitch.d.ts +5 -0
- package/dist/components/Switches/ToggleBubble/ToggleBubble.d.ts +1 -0
- package/dist/components/Switches/ToggleClipPath/ToggleClipPath.d.ts +1 -0
- package/dist/components/Switches/index.d.ts +11 -0
- package/dist/components/Texts/EnlightenedText/EnlightenedText.d.ts +6 -0
- package/dist/components/Texts/GlowingText/GlowingText.d.ts +1 -0
- package/dist/components/Texts/GrainyGradientText/GrainyGradientText.d.ts +1 -0
- package/dist/components/Texts/JellyText/JellyText.d.ts +6 -0
- package/dist/components/Texts/MagicalText/MagicalText.d.ts +5 -0
- package/dist/components/Texts/ScrambledText/ScrambledText.d.ts +6 -0
- package/dist/components/Texts/ScrambledText/ScrambledText.helpers.d.ts +1 -0
- package/dist/components/Texts/ScramblingLetters/ScramblingLetters.d.ts +1 -0
- package/dist/components/Texts/ShakingText/ShakingText.d.ts +5 -0
- package/dist/components/Texts/ShiningText/ShiningText.d.ts +6 -0
- package/dist/components/Texts/SpiralLoadingText/SpiralLoadingText.d.ts +6 -0
- package/dist/components/Texts/TextMorphing/TextMorphing.d.ts +1 -0
- package/dist/components/Texts/TextOutline/TextOutline.d.ts +1 -0
- package/dist/components/Texts/TextShadow/TextShadow.d.ts +1 -0
- package/dist/components/Texts/WeightText/WeightText.d.ts +5 -0
- package/dist/components/Texts/index.d.ts +14 -0
- package/dist/components/Toasts/Toast.d.ts +6 -0
- package/dist/components/Toasts/Toasts.d.ts +6 -0
- package/dist/components/Tooltips/Tooltip/Tooltip.d.ts +15 -0
- package/dist/components/Tooltips/TooltipRangeSlider/TooltipRangeSlider.d.ts +1 -0
- package/dist/components/Tooltips/index.d.ts +2 -0
- package/dist/components/index.d.ts +123 -0
- package/dist/components/primitives/Cluster/Cluster.d.ts +14 -0
- package/dist/components/primitives/Container/Container.d.ts +13 -0
- package/dist/components/primitives/DialogBase/DialogBase.d.ts +18 -0
- package/dist/components/primitives/FormField/FormField.d.ts +33 -0
- package/dist/components/primitives/FormField/FormFieldContext.d.ts +4 -0
- package/dist/components/primitives/PopoverBase/PopoverBase.d.ts +18 -0
- package/dist/components/primitives/Portal/Portal.d.ts +8 -0
- package/dist/components/primitives/SelectBase/SelectBase.d.ts +23 -0
- package/dist/components/primitives/Slot/Slot.d.ts +12 -0
- package/dist/components/primitives/Stack/Stack.d.ts +14 -0
- package/dist/components/primitives/ThemeProvider/ThemeContext.d.ts +12 -0
- package/dist/components/primitives/ThemeProvider/ThemeProvider.d.ts +18 -0
- package/dist/components/primitives/ThemeProvider/themeDom.d.ts +11 -0
- package/dist/components/primitives/TooltipBase/TooltipBase.d.ts +17 -0
- package/dist/components/primitives/VisuallyHidden/VisuallyHidden.d.ts +7 -0
- package/dist/components/shared/contracts.d.ts +4 -0
- package/dist/components/shared/polymorphic.d.ts +6 -0
- package/dist/components/unsorted/AdjoinedFilters/AdjoinedFilters.d.ts +1 -0
- package/dist/components/unsorted/Appearance/Appearance.d.ts +5 -0
- package/dist/components/unsorted/AreaLight/AreaLight.d.ts +1 -0
- package/dist/components/unsorted/AvatarHover/AvatarHover.d.ts +1 -0
- package/dist/components/unsorted/BackgroundSlider/BackgroundSlider.d.ts +2 -0
- package/dist/components/unsorted/BlurVignette/BlurVignette.d.ts +10 -0
- package/dist/components/unsorted/BlurredBackground/BlurredBackground.d.ts +1 -0
- package/dist/components/unsorted/BorderGradient/BorderGradient.d.ts +1 -0
- package/dist/components/unsorted/BouncyClock/BouncyClock.d.ts +1 -0
- package/dist/components/unsorted/BreakingProgress/BreakingProgress.d.ts +5 -0
- package/dist/components/unsorted/BrownianMotion/BrownianMotion.d.ts +1 -0
- package/dist/components/unsorted/CardDetails/CardDetails.d.ts +1 -0
- package/dist/components/unsorted/ChromaticAberration/ChromaticAberration.d.ts +1 -0
- package/dist/components/unsorted/CircleLinesAnimation/CircleLinesAnimation.d.ts +1 -0
- package/dist/components/unsorted/CircleParticles/CircleParticles.d.ts +1 -0
- package/dist/components/unsorted/CollapseAnimation/CollapseAnimation.d.ts +1 -0
- package/dist/components/unsorted/ContactList/ContactList.d.ts +1 -0
- package/dist/components/unsorted/CookieBanner/CookieBanner.d.ts +1 -0
- package/dist/components/unsorted/Counter/Counter.d.ts +1 -0
- package/dist/components/unsorted/DissolveElementEffect/DissolveElementEffect.d.ts +11 -0
- package/dist/components/unsorted/Duck/Duck.d.ts +1 -0
- package/dist/components/unsorted/DynamicIsland/DynamicIsland.d.ts +5 -0
- package/dist/components/unsorted/FadeUp/FadeUp.d.ts +7 -0
- package/dist/components/unsorted/FileIcons/FileIcons.d.ts +1 -0
- package/dist/components/unsorted/Fingerprint/Fingerprint.d.ts +5 -0
- package/dist/components/unsorted/GlidingReveal/GlidingReveal.d.ts +1 -0
- package/dist/components/unsorted/GlitterCard/GlitterCard.d.ts +1 -0
- package/dist/components/unsorted/GlowingShadows/GlowingShadows.d.ts +1 -0
- package/dist/components/unsorted/GradientBorder/GradientBorder.d.ts +1 -0
- package/dist/components/unsorted/Illumination/Illumination.d.ts +1 -0
- package/dist/components/unsorted/ImageClipping/ImageClipping.d.ts +1 -0
- package/dist/components/unsorted/LandingXYScroll/LandingXYScroll.d.ts +1 -0
- package/dist/components/unsorted/LayeredComponents/LayeredComponents.d.ts +1 -0
- package/dist/components/unsorted/Lock/Lock.d.ts +3 -0
- package/dist/components/unsorted/LoveGlow/LoveGlow.d.ts +1 -0
- package/dist/components/unsorted/Mathober/Mathober.d.ts +1 -0
- package/dist/components/unsorted/MotionDigits/MotionDigits.d.ts +1 -0
- package/dist/components/unsorted/MouseMoveGallery/MouseMoveGallery.d.ts +1 -0
- package/dist/components/unsorted/MouseMoveGallery/MouseMoveGallery.helpers.d.ts +1 -0
- package/dist/components/unsorted/MultiGradientBackground/MultiGradientBackground.d.ts +1 -0
- package/dist/components/unsorted/MultipathSvgAnimation/MultipathSvgAnimation.d.ts +1 -0
- package/dist/components/unsorted/NamedPointer/NamedPointer.d.ts +6 -0
- package/dist/components/unsorted/NotificationBell/NotificationBell.d.ts +1 -0
- package/dist/components/unsorted/PhotoZoom/PhotoZoom.d.ts +1 -0
- package/dist/components/unsorted/PolaroidStack/PolaroidStack.d.ts +1 -0
- package/dist/components/unsorted/QuickTimeClock/QuickTimeClock.d.ts +1 -0
- package/dist/components/unsorted/RealisticSmoke/RealisticSmoke.d.ts +1 -0
- package/dist/components/unsorted/RevealImageAnimation/RevealImageAnimation.d.ts +1 -0
- package/dist/components/unsorted/RhombusGallery/RhombusGallery.d.ts +1 -0
- package/dist/components/unsorted/SchrodingerFormControls/SchrodingerFormControls.d.ts +1 -0
- package/dist/components/unsorted/SegmentedControls/SegmentedControls.d.ts +12 -0
- package/dist/components/unsorted/ShapeSelection/ShapeSelection.d.ts +6 -0
- package/dist/components/unsorted/SlideIn/SlideIn.d.ts +18 -0
- package/dist/components/unsorted/SmokeTextDisappearance/SmokeTextDisappearance.d.ts +5 -0
- package/dist/components/unsorted/SmoothScroll/SmoothScroll.d.ts +1 -0
- package/dist/components/unsorted/SolarEclipse/BaileysBead.d.ts +15 -0
- package/dist/components/unsorted/SolarEclipse/SolarEclipse.d.ts +1 -0
- package/dist/components/unsorted/SolarEclipse/SolarEclipse.helpers.d.ts +12 -0
- package/dist/components/unsorted/SpeechToText/SpeechToText.d.ts +22 -0
- package/dist/components/unsorted/StaticSolarEclipse/StaticSolarEclipse.d.ts +1 -0
- package/dist/components/unsorted/StickyList/StickyList.d.ts +1 -0
- package/dist/components/unsorted/TextImageHover/TextImageHover.d.ts +1 -0
- package/dist/components/unsorted/ThanosDisappearEffect/ThanosDisappearEffect.d.ts +6 -0
- package/dist/components/unsorted/ThanosDisappearEffectList/ThanosDisappearEffectList.d.ts +1 -0
- package/dist/components/unsorted/ThanosDissolve/ThanosDissolve.d.ts +9 -0
- package/dist/components/unsorted/TranslucentBackdrop/TranslucentBackdrop.d.ts +1 -0
- package/dist/components/unsorted/TurbulenceFilter/TurbulenceFilter.d.ts +1 -0
- package/dist/components/unsorted/ViewTransitionAddToCard/ViewTransitionAddToCard.d.ts +1 -0
- package/dist/components/unsorted/ViewTransitionImageGallery/ViewTransitionImageGallery.d.ts +1 -0
- package/dist/components/unsorted/VoiceAnimation/VoiceAnimation.d.ts +1 -0
- package/dist/dat.gui.module-C-Oxsf3K.cjs +2198 -0
- package/dist/dat.gui.module-DscbDI-N.js +2198 -0
- package/dist/{gl-B0NhVYRl.cjs → gl-DEE7rq9M.cjs} +5 -5
- package/dist/global.d.ts +87 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/useAnimatedText/index.d.ts +1 -0
- package/dist/hooks/useAnimatedText/useAnimatedText.d.ts +1 -0
- package/dist/hooks/useBowser.d.ts +11 -0
- package/dist/hooks/useControllableState.d.ts +2 -0
- package/dist/hooks/useDebounce.d.ts +50 -0
- package/dist/hooks/useEffectEvent.d.ts +16 -0
- package/dist/hooks/useFormField.d.ts +36 -0
- package/dist/hooks/useGsapContext.d.ts +20 -0
- package/dist/hooks/useInterval.d.ts +25 -0
- package/dist/hooks/useLiveRef.d.ts +1 -0
- package/dist/hooks/useMatchMedia.d.ts +1 -0
- package/dist/hooks/useMergeRefs.d.ts +5 -0
- package/dist/hooks/useOklch.d.ts +1 -0
- package/dist/hooks/useOutsideClick.d.ts +22 -0
- package/dist/hooks/usePrevious.d.ts +2 -0
- package/dist/hooks/useRaf.d.ts +24 -0
- package/dist/hooks/useReducedMotion.d.ts +2 -0
- package/dist/hooks/useThrottle.d.ts +20 -0
- package/dist/hooks/useTimeout.d.ts +25 -0
- package/dist/hooks/useWindowReady.d.ts +1 -0
- package/dist/hooks.cjs +21 -35
- package/dist/hooks.js +19 -33
- package/dist/index.cjs +317 -2807
- package/dist/index.d.ts +5 -2588
- package/dist/index.js +310 -2800
- package/dist/internal/assets.d.ts +18 -0
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +7 -45
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.d.ts +18 -178
- package/dist/primitives.js +1 -1
- package/dist/server.d.ts +5 -70
- package/dist/styles.css +483 -483
- package/dist/test/a11y.d.ts +5 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/tokens/animation.d.ts +38 -0
- package/dist/tokens/colorValidation.d.ts +18 -0
- package/dist/tokens/index.d.ts +8 -0
- package/dist/tokens/spring.d.ts +39 -0
- package/dist/tokens/tokens.d.ts +333 -0
- package/dist/tokens.d.ts +2 -436
- package/dist/utils/array/index.d.ts +2 -0
- package/dist/utils/array/move.d.ts +1 -0
- package/dist/utils/array/times.d.ts +1 -0
- package/dist/utils/collections/BoundedMap.d.ts +19 -0
- package/dist/utils/collections/index.d.ts +2 -0
- package/dist/utils/common/index.d.ts +2 -0
- package/dist/utils/common/logger.d.ts +36 -0
- package/dist/utils/common/noop.d.ts +1 -0
- package/dist/utils/conditional/index.d.ts +3 -0
- package/dist/utils/conditional/is.d.ts +3 -0
- package/dist/utils/conditional/isNonNullable.d.ts +1 -0
- package/dist/utils/conditional/notReachable.d.ts +1 -0
- package/dist/utils/error.d.ts +6 -0
- package/dist/utils/format.d.ts +10 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/math.d.ts +6 -0
- package/dist/utils/object/index.d.ts +2 -0
- package/dist/utils/object/keys.d.ts +1 -0
- package/dist/utils/object/values.d.ts +1 -0
- package/dist/utils/presence.d.ts +16 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/svg.d.ts +1 -0
- package/dist/utils/ui/chain.d.ts +2 -0
- package/dist/utils/ui/index.d.ts +1 -0
- package/dist/utils/viewTransition.d.ts +17 -0
- package/package.json +25 -25
- package/dist/hooks.d.ts +0 -291
- package/dist/utils.d.ts +0 -165
- /package/dist/{gl-BipoEx9s.js → gl-D6wtjXIm.js} +0 -0
|
@@ -0,0 +1,2198 @@
|
|
|
1
|
+
//#region node_modules/dat.gui/build/dat.gui.module.js
|
|
2
|
+
/**
|
|
3
|
+
* dat-gui JavaScript Controller Library
|
|
4
|
+
* https://github.com/dataarts/dat.gui
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2011 Data Arts Team, Google Creative Lab
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*/
|
|
14
|
+
function ___$insertStyle(css) {
|
|
15
|
+
if (!css) return;
|
|
16
|
+
if (typeof window === "undefined") return;
|
|
17
|
+
var style = document.createElement("style");
|
|
18
|
+
style.setAttribute("type", "text/css");
|
|
19
|
+
style.innerHTML = css;
|
|
20
|
+
document.head.appendChild(style);
|
|
21
|
+
return css;
|
|
22
|
+
}
|
|
23
|
+
function colorToString(color, forceCSSHex) {
|
|
24
|
+
var colorFormat = color.__state.conversionName.toString();
|
|
25
|
+
var r = Math.round(color.r);
|
|
26
|
+
var g = Math.round(color.g);
|
|
27
|
+
var b = Math.round(color.b);
|
|
28
|
+
var a = color.a;
|
|
29
|
+
var h = Math.round(color.h);
|
|
30
|
+
var s = color.s.toFixed(1);
|
|
31
|
+
var v = color.v.toFixed(1);
|
|
32
|
+
if (forceCSSHex || colorFormat === "THREE_CHAR_HEX" || colorFormat === "SIX_CHAR_HEX") {
|
|
33
|
+
var str = color.hex.toString(16);
|
|
34
|
+
while (str.length < 6) str = "0" + str;
|
|
35
|
+
return "#" + str;
|
|
36
|
+
} else if (colorFormat === "CSS_RGB") return "rgb(" + r + "," + g + "," + b + ")";
|
|
37
|
+
else if (colorFormat === "CSS_RGBA") return "rgba(" + r + "," + g + "," + b + "," + a + ")";
|
|
38
|
+
else if (colorFormat === "HEX") return "0x" + color.hex.toString(16);
|
|
39
|
+
else if (colorFormat === "RGB_ARRAY") return "[" + r + "," + g + "," + b + "]";
|
|
40
|
+
else if (colorFormat === "RGBA_ARRAY") return "[" + r + "," + g + "," + b + "," + a + "]";
|
|
41
|
+
else if (colorFormat === "RGB_OBJ") return "{r:" + r + ",g:" + g + ",b:" + b + "}";
|
|
42
|
+
else if (colorFormat === "RGBA_OBJ") return "{r:" + r + ",g:" + g + ",b:" + b + ",a:" + a + "}";
|
|
43
|
+
else if (colorFormat === "HSV_OBJ") return "{h:" + h + ",s:" + s + ",v:" + v + "}";
|
|
44
|
+
else if (colorFormat === "HSVA_OBJ") return "{h:" + h + ",s:" + s + ",v:" + v + ",a:" + a + "}";
|
|
45
|
+
return "unknown format";
|
|
46
|
+
}
|
|
47
|
+
var ARR_EACH = Array.prototype.forEach;
|
|
48
|
+
var ARR_SLICE = Array.prototype.slice;
|
|
49
|
+
var Common = {
|
|
50
|
+
BREAK: {},
|
|
51
|
+
extend: function extend(target) {
|
|
52
|
+
this.each(ARR_SLICE.call(arguments, 1), function(obj) {
|
|
53
|
+
(this.isObject(obj) ? Object.keys(obj) : []).forEach(function(key) {
|
|
54
|
+
if (!this.isUndefined(obj[key])) target[key] = obj[key];
|
|
55
|
+
}.bind(this));
|
|
56
|
+
}, this);
|
|
57
|
+
return target;
|
|
58
|
+
},
|
|
59
|
+
defaults: function defaults(target) {
|
|
60
|
+
this.each(ARR_SLICE.call(arguments, 1), function(obj) {
|
|
61
|
+
(this.isObject(obj) ? Object.keys(obj) : []).forEach(function(key) {
|
|
62
|
+
if (this.isUndefined(target[key])) target[key] = obj[key];
|
|
63
|
+
}.bind(this));
|
|
64
|
+
}, this);
|
|
65
|
+
return target;
|
|
66
|
+
},
|
|
67
|
+
compose: function compose() {
|
|
68
|
+
var toCall = ARR_SLICE.call(arguments);
|
|
69
|
+
return function() {
|
|
70
|
+
var args = ARR_SLICE.call(arguments);
|
|
71
|
+
for (var i = toCall.length - 1; i >= 0; i--) args = [toCall[i].apply(this, args)];
|
|
72
|
+
return args[0];
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
each: function each(obj, itr, scope) {
|
|
76
|
+
if (!obj) return;
|
|
77
|
+
if (ARR_EACH && obj.forEach && obj.forEach === ARR_EACH) obj.forEach(itr, scope);
|
|
78
|
+
else if (obj.length === obj.length + 0) {
|
|
79
|
+
var key = void 0;
|
|
80
|
+
var l = void 0;
|
|
81
|
+
for (key = 0, l = obj.length; key < l; key++) if (key in obj && itr.call(scope, obj[key], key) === this.BREAK) return;
|
|
82
|
+
} else for (var _key in obj) if (itr.call(scope, obj[_key], _key) === this.BREAK) return;
|
|
83
|
+
},
|
|
84
|
+
defer: function defer(fnc) {
|
|
85
|
+
setTimeout(fnc, 0);
|
|
86
|
+
},
|
|
87
|
+
debounce: function debounce(func, threshold, callImmediately) {
|
|
88
|
+
var timeout = void 0;
|
|
89
|
+
return function() {
|
|
90
|
+
var obj = this;
|
|
91
|
+
var args = arguments;
|
|
92
|
+
function delayed() {
|
|
93
|
+
timeout = null;
|
|
94
|
+
if (!callImmediately) func.apply(obj, args);
|
|
95
|
+
}
|
|
96
|
+
var callNow = callImmediately || !timeout;
|
|
97
|
+
clearTimeout(timeout);
|
|
98
|
+
timeout = setTimeout(delayed, threshold);
|
|
99
|
+
if (callNow) func.apply(obj, args);
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
toArray: function toArray(obj) {
|
|
103
|
+
if (obj.toArray) return obj.toArray();
|
|
104
|
+
return ARR_SLICE.call(obj);
|
|
105
|
+
},
|
|
106
|
+
isUndefined: function isUndefined(obj) {
|
|
107
|
+
return obj === void 0;
|
|
108
|
+
},
|
|
109
|
+
isNull: function isNull(obj) {
|
|
110
|
+
return obj === null;
|
|
111
|
+
},
|
|
112
|
+
isNaN: function(_isNaN) {
|
|
113
|
+
function isNaN(_x) {
|
|
114
|
+
return _isNaN.apply(this, arguments);
|
|
115
|
+
}
|
|
116
|
+
isNaN.toString = function() {
|
|
117
|
+
return _isNaN.toString();
|
|
118
|
+
};
|
|
119
|
+
return isNaN;
|
|
120
|
+
}(function(obj) {
|
|
121
|
+
return isNaN(obj);
|
|
122
|
+
}),
|
|
123
|
+
isArray: Array.isArray || function(obj) {
|
|
124
|
+
return obj.constructor === Array;
|
|
125
|
+
},
|
|
126
|
+
isObject: function isObject(obj) {
|
|
127
|
+
return obj === Object(obj);
|
|
128
|
+
},
|
|
129
|
+
isNumber: function isNumber(obj) {
|
|
130
|
+
return obj === obj + 0;
|
|
131
|
+
},
|
|
132
|
+
isString: function isString(obj) {
|
|
133
|
+
return obj === obj + "";
|
|
134
|
+
},
|
|
135
|
+
isBoolean: function isBoolean(obj) {
|
|
136
|
+
return obj === false || obj === true;
|
|
137
|
+
},
|
|
138
|
+
isFunction: function isFunction(obj) {
|
|
139
|
+
return obj instanceof Function;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var INTERPRETATIONS = [
|
|
143
|
+
{
|
|
144
|
+
litmus: Common.isString,
|
|
145
|
+
conversions: {
|
|
146
|
+
THREE_CHAR_HEX: {
|
|
147
|
+
read: function read(original) {
|
|
148
|
+
var test = original.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);
|
|
149
|
+
if (test === null) return false;
|
|
150
|
+
return {
|
|
151
|
+
space: "HEX",
|
|
152
|
+
hex: parseInt("0x" + test[1].toString() + test[1].toString() + test[2].toString() + test[2].toString() + test[3].toString() + test[3].toString(), 0)
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
write: colorToString
|
|
156
|
+
},
|
|
157
|
+
SIX_CHAR_HEX: {
|
|
158
|
+
read: function read(original) {
|
|
159
|
+
var test = original.match(/^#([A-F0-9]{6})$/i);
|
|
160
|
+
if (test === null) return false;
|
|
161
|
+
return {
|
|
162
|
+
space: "HEX",
|
|
163
|
+
hex: parseInt("0x" + test[1].toString(), 0)
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
write: colorToString
|
|
167
|
+
},
|
|
168
|
+
CSS_RGB: {
|
|
169
|
+
read: function read(original) {
|
|
170
|
+
var test = original.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
|
|
171
|
+
if (test === null) return false;
|
|
172
|
+
return {
|
|
173
|
+
space: "RGB",
|
|
174
|
+
r: parseFloat(test[1]),
|
|
175
|
+
g: parseFloat(test[2]),
|
|
176
|
+
b: parseFloat(test[3])
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
write: colorToString
|
|
180
|
+
},
|
|
181
|
+
CSS_RGBA: {
|
|
182
|
+
read: function read(original) {
|
|
183
|
+
var test = original.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
|
|
184
|
+
if (test === null) return false;
|
|
185
|
+
return {
|
|
186
|
+
space: "RGB",
|
|
187
|
+
r: parseFloat(test[1]),
|
|
188
|
+
g: parseFloat(test[2]),
|
|
189
|
+
b: parseFloat(test[3]),
|
|
190
|
+
a: parseFloat(test[4])
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
write: colorToString
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
litmus: Common.isNumber,
|
|
199
|
+
conversions: { HEX: {
|
|
200
|
+
read: function read(original) {
|
|
201
|
+
return {
|
|
202
|
+
space: "HEX",
|
|
203
|
+
hex: original,
|
|
204
|
+
conversionName: "HEX"
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
write: function write(color) {
|
|
208
|
+
return color.hex;
|
|
209
|
+
}
|
|
210
|
+
} }
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
litmus: Common.isArray,
|
|
214
|
+
conversions: {
|
|
215
|
+
RGB_ARRAY: {
|
|
216
|
+
read: function read(original) {
|
|
217
|
+
if (original.length !== 3) return false;
|
|
218
|
+
return {
|
|
219
|
+
space: "RGB",
|
|
220
|
+
r: original[0],
|
|
221
|
+
g: original[1],
|
|
222
|
+
b: original[2]
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
write: function write(color) {
|
|
226
|
+
return [
|
|
227
|
+
color.r,
|
|
228
|
+
color.g,
|
|
229
|
+
color.b
|
|
230
|
+
];
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
RGBA_ARRAY: {
|
|
234
|
+
read: function read(original) {
|
|
235
|
+
if (original.length !== 4) return false;
|
|
236
|
+
return {
|
|
237
|
+
space: "RGB",
|
|
238
|
+
r: original[0],
|
|
239
|
+
g: original[1],
|
|
240
|
+
b: original[2],
|
|
241
|
+
a: original[3]
|
|
242
|
+
};
|
|
243
|
+
},
|
|
244
|
+
write: function write(color) {
|
|
245
|
+
return [
|
|
246
|
+
color.r,
|
|
247
|
+
color.g,
|
|
248
|
+
color.b,
|
|
249
|
+
color.a
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
litmus: Common.isObject,
|
|
257
|
+
conversions: {
|
|
258
|
+
RGBA_OBJ: {
|
|
259
|
+
read: function read(original) {
|
|
260
|
+
if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b) && Common.isNumber(original.a)) return {
|
|
261
|
+
space: "RGB",
|
|
262
|
+
r: original.r,
|
|
263
|
+
g: original.g,
|
|
264
|
+
b: original.b,
|
|
265
|
+
a: original.a
|
|
266
|
+
};
|
|
267
|
+
return false;
|
|
268
|
+
},
|
|
269
|
+
write: function write(color) {
|
|
270
|
+
return {
|
|
271
|
+
r: color.r,
|
|
272
|
+
g: color.g,
|
|
273
|
+
b: color.b,
|
|
274
|
+
a: color.a
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
RGB_OBJ: {
|
|
279
|
+
read: function read(original) {
|
|
280
|
+
if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b)) return {
|
|
281
|
+
space: "RGB",
|
|
282
|
+
r: original.r,
|
|
283
|
+
g: original.g,
|
|
284
|
+
b: original.b
|
|
285
|
+
};
|
|
286
|
+
return false;
|
|
287
|
+
},
|
|
288
|
+
write: function write(color) {
|
|
289
|
+
return {
|
|
290
|
+
r: color.r,
|
|
291
|
+
g: color.g,
|
|
292
|
+
b: color.b
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
HSVA_OBJ: {
|
|
297
|
+
read: function read(original) {
|
|
298
|
+
if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v) && Common.isNumber(original.a)) return {
|
|
299
|
+
space: "HSV",
|
|
300
|
+
h: original.h,
|
|
301
|
+
s: original.s,
|
|
302
|
+
v: original.v,
|
|
303
|
+
a: original.a
|
|
304
|
+
};
|
|
305
|
+
return false;
|
|
306
|
+
},
|
|
307
|
+
write: function write(color) {
|
|
308
|
+
return {
|
|
309
|
+
h: color.h,
|
|
310
|
+
s: color.s,
|
|
311
|
+
v: color.v,
|
|
312
|
+
a: color.a
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
HSV_OBJ: {
|
|
317
|
+
read: function read(original) {
|
|
318
|
+
if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v)) return {
|
|
319
|
+
space: "HSV",
|
|
320
|
+
h: original.h,
|
|
321
|
+
s: original.s,
|
|
322
|
+
v: original.v
|
|
323
|
+
};
|
|
324
|
+
return false;
|
|
325
|
+
},
|
|
326
|
+
write: function write(color) {
|
|
327
|
+
return {
|
|
328
|
+
h: color.h,
|
|
329
|
+
s: color.s,
|
|
330
|
+
v: color.v
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
];
|
|
337
|
+
var result = void 0;
|
|
338
|
+
var toReturn = void 0;
|
|
339
|
+
var interpret = function interpret() {
|
|
340
|
+
toReturn = false;
|
|
341
|
+
var original = arguments.length > 1 ? Common.toArray(arguments) : arguments[0];
|
|
342
|
+
Common.each(INTERPRETATIONS, function(family) {
|
|
343
|
+
if (family.litmus(original)) {
|
|
344
|
+
Common.each(family.conversions, function(conversion, conversionName) {
|
|
345
|
+
result = conversion.read(original);
|
|
346
|
+
if (toReturn === false && result !== false) {
|
|
347
|
+
toReturn = result;
|
|
348
|
+
result.conversionName = conversionName;
|
|
349
|
+
result.conversion = conversion;
|
|
350
|
+
return Common.BREAK;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
return Common.BREAK;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
return toReturn;
|
|
357
|
+
};
|
|
358
|
+
var tmpComponent = void 0;
|
|
359
|
+
var ColorMath = {
|
|
360
|
+
hsv_to_rgb: function hsv_to_rgb(h, s, v) {
|
|
361
|
+
var hi = Math.floor(h / 60) % 6;
|
|
362
|
+
var f = h / 60 - Math.floor(h / 60);
|
|
363
|
+
var p = v * (1 - s);
|
|
364
|
+
var q = v * (1 - f * s);
|
|
365
|
+
var t = v * (1 - (1 - f) * s);
|
|
366
|
+
var c = [
|
|
367
|
+
[
|
|
368
|
+
v,
|
|
369
|
+
t,
|
|
370
|
+
p
|
|
371
|
+
],
|
|
372
|
+
[
|
|
373
|
+
q,
|
|
374
|
+
v,
|
|
375
|
+
p
|
|
376
|
+
],
|
|
377
|
+
[
|
|
378
|
+
p,
|
|
379
|
+
v,
|
|
380
|
+
t
|
|
381
|
+
],
|
|
382
|
+
[
|
|
383
|
+
p,
|
|
384
|
+
q,
|
|
385
|
+
v
|
|
386
|
+
],
|
|
387
|
+
[
|
|
388
|
+
t,
|
|
389
|
+
p,
|
|
390
|
+
v
|
|
391
|
+
],
|
|
392
|
+
[
|
|
393
|
+
v,
|
|
394
|
+
p,
|
|
395
|
+
q
|
|
396
|
+
]
|
|
397
|
+
][hi];
|
|
398
|
+
return {
|
|
399
|
+
r: c[0] * 255,
|
|
400
|
+
g: c[1] * 255,
|
|
401
|
+
b: c[2] * 255
|
|
402
|
+
};
|
|
403
|
+
},
|
|
404
|
+
rgb_to_hsv: function rgb_to_hsv(r, g, b) {
|
|
405
|
+
var min = Math.min(r, g, b);
|
|
406
|
+
var max = Math.max(r, g, b);
|
|
407
|
+
var delta = max - min;
|
|
408
|
+
var h = void 0;
|
|
409
|
+
var s = void 0;
|
|
410
|
+
if (max !== 0) s = delta / max;
|
|
411
|
+
else return {
|
|
412
|
+
h: NaN,
|
|
413
|
+
s: 0,
|
|
414
|
+
v: 0
|
|
415
|
+
};
|
|
416
|
+
if (r === max) h = (g - b) / delta;
|
|
417
|
+
else if (g === max) h = 2 + (b - r) / delta;
|
|
418
|
+
else h = 4 + (r - g) / delta;
|
|
419
|
+
h /= 6;
|
|
420
|
+
if (h < 0) h += 1;
|
|
421
|
+
return {
|
|
422
|
+
h: h * 360,
|
|
423
|
+
s,
|
|
424
|
+
v: max / 255
|
|
425
|
+
};
|
|
426
|
+
},
|
|
427
|
+
rgb_to_hex: function rgb_to_hex(r, g, b) {
|
|
428
|
+
var hex = this.hex_with_component(0, 2, r);
|
|
429
|
+
hex = this.hex_with_component(hex, 1, g);
|
|
430
|
+
hex = this.hex_with_component(hex, 0, b);
|
|
431
|
+
return hex;
|
|
432
|
+
},
|
|
433
|
+
component_from_hex: function component_from_hex(hex, componentIndex) {
|
|
434
|
+
return hex >> componentIndex * 8 & 255;
|
|
435
|
+
},
|
|
436
|
+
hex_with_component: function hex_with_component(hex, componentIndex, value) {
|
|
437
|
+
return value << (tmpComponent = componentIndex * 8) | hex & ~(255 << tmpComponent);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
|
|
441
|
+
return typeof obj;
|
|
442
|
+
} : function(obj) {
|
|
443
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
444
|
+
};
|
|
445
|
+
var classCallCheck = function(instance, Constructor) {
|
|
446
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
447
|
+
};
|
|
448
|
+
var createClass = function() {
|
|
449
|
+
function defineProperties(target, props) {
|
|
450
|
+
for (var i = 0; i < props.length; i++) {
|
|
451
|
+
var descriptor = props[i];
|
|
452
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
453
|
+
descriptor.configurable = true;
|
|
454
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
455
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return function(Constructor, protoProps, staticProps) {
|
|
459
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
460
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
461
|
+
return Constructor;
|
|
462
|
+
};
|
|
463
|
+
}();
|
|
464
|
+
var get = function get(object, property, receiver) {
|
|
465
|
+
if (object === null) object = Function.prototype;
|
|
466
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
467
|
+
if (desc === void 0) {
|
|
468
|
+
var parent = Object.getPrototypeOf(object);
|
|
469
|
+
if (parent === null) return;
|
|
470
|
+
else return get(parent, property, receiver);
|
|
471
|
+
} else if ("value" in desc) return desc.value;
|
|
472
|
+
else {
|
|
473
|
+
var getter = desc.get;
|
|
474
|
+
if (getter === void 0) return;
|
|
475
|
+
return getter.call(receiver);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
var inherits = function(subClass, superClass) {
|
|
479
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
480
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
481
|
+
value: subClass,
|
|
482
|
+
enumerable: false,
|
|
483
|
+
writable: true,
|
|
484
|
+
configurable: true
|
|
485
|
+
} });
|
|
486
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
487
|
+
};
|
|
488
|
+
var possibleConstructorReturn = function(self, call) {
|
|
489
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
490
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
491
|
+
};
|
|
492
|
+
var Color = function() {
|
|
493
|
+
function Color() {
|
|
494
|
+
classCallCheck(this, Color);
|
|
495
|
+
this.__state = interpret.apply(this, arguments);
|
|
496
|
+
if (this.__state === false) throw new Error("Failed to interpret color arguments");
|
|
497
|
+
this.__state.a = this.__state.a || 1;
|
|
498
|
+
}
|
|
499
|
+
createClass(Color, [
|
|
500
|
+
{
|
|
501
|
+
key: "toString",
|
|
502
|
+
value: function toString() {
|
|
503
|
+
return colorToString(this);
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
key: "toHexString",
|
|
508
|
+
value: function toHexString() {
|
|
509
|
+
return colorToString(this, true);
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
key: "toOriginal",
|
|
514
|
+
value: function toOriginal() {
|
|
515
|
+
return this.__state.conversion.write(this);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
]);
|
|
519
|
+
return Color;
|
|
520
|
+
}();
|
|
521
|
+
function defineRGBComponent(target, component, componentHexIndex) {
|
|
522
|
+
Object.defineProperty(target, component, {
|
|
523
|
+
get: function get$$1() {
|
|
524
|
+
if (this.__state.space === "RGB") return this.__state[component];
|
|
525
|
+
Color.recalculateRGB(this, component, componentHexIndex);
|
|
526
|
+
return this.__state[component];
|
|
527
|
+
},
|
|
528
|
+
set: function set$$1(v) {
|
|
529
|
+
if (this.__state.space !== "RGB") {
|
|
530
|
+
Color.recalculateRGB(this, component, componentHexIndex);
|
|
531
|
+
this.__state.space = "RGB";
|
|
532
|
+
}
|
|
533
|
+
this.__state[component] = v;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
function defineHSVComponent(target, component) {
|
|
538
|
+
Object.defineProperty(target, component, {
|
|
539
|
+
get: function get$$1() {
|
|
540
|
+
if (this.__state.space === "HSV") return this.__state[component];
|
|
541
|
+
Color.recalculateHSV(this);
|
|
542
|
+
return this.__state[component];
|
|
543
|
+
},
|
|
544
|
+
set: function set$$1(v) {
|
|
545
|
+
if (this.__state.space !== "HSV") {
|
|
546
|
+
Color.recalculateHSV(this);
|
|
547
|
+
this.__state.space = "HSV";
|
|
548
|
+
}
|
|
549
|
+
this.__state[component] = v;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
Color.recalculateRGB = function(color, component, componentHexIndex) {
|
|
554
|
+
if (color.__state.space === "HEX") color.__state[component] = ColorMath.component_from_hex(color.__state.hex, componentHexIndex);
|
|
555
|
+
else if (color.__state.space === "HSV") Common.extend(color.__state, ColorMath.hsv_to_rgb(color.__state.h, color.__state.s, color.__state.v));
|
|
556
|
+
else throw new Error("Corrupted color state");
|
|
557
|
+
};
|
|
558
|
+
Color.recalculateHSV = function(color) {
|
|
559
|
+
var result = ColorMath.rgb_to_hsv(color.r, color.g, color.b);
|
|
560
|
+
Common.extend(color.__state, {
|
|
561
|
+
s: result.s,
|
|
562
|
+
v: result.v
|
|
563
|
+
});
|
|
564
|
+
if (!Common.isNaN(result.h)) color.__state.h = result.h;
|
|
565
|
+
else if (Common.isUndefined(color.__state.h)) color.__state.h = 0;
|
|
566
|
+
};
|
|
567
|
+
Color.COMPONENTS = [
|
|
568
|
+
"r",
|
|
569
|
+
"g",
|
|
570
|
+
"b",
|
|
571
|
+
"h",
|
|
572
|
+
"s",
|
|
573
|
+
"v",
|
|
574
|
+
"hex",
|
|
575
|
+
"a"
|
|
576
|
+
];
|
|
577
|
+
defineRGBComponent(Color.prototype, "r", 2);
|
|
578
|
+
defineRGBComponent(Color.prototype, "g", 1);
|
|
579
|
+
defineRGBComponent(Color.prototype, "b", 0);
|
|
580
|
+
defineHSVComponent(Color.prototype, "h");
|
|
581
|
+
defineHSVComponent(Color.prototype, "s");
|
|
582
|
+
defineHSVComponent(Color.prototype, "v");
|
|
583
|
+
Object.defineProperty(Color.prototype, "a", {
|
|
584
|
+
get: function get$$1() {
|
|
585
|
+
return this.__state.a;
|
|
586
|
+
},
|
|
587
|
+
set: function set$$1(v) {
|
|
588
|
+
this.__state.a = v;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
Object.defineProperty(Color.prototype, "hex", {
|
|
592
|
+
get: function get$$1() {
|
|
593
|
+
if (this.__state.space !== "HEX") {
|
|
594
|
+
this.__state.hex = ColorMath.rgb_to_hex(this.r, this.g, this.b);
|
|
595
|
+
this.__state.space = "HEX";
|
|
596
|
+
}
|
|
597
|
+
return this.__state.hex;
|
|
598
|
+
},
|
|
599
|
+
set: function set$$1(v) {
|
|
600
|
+
this.__state.space = "HEX";
|
|
601
|
+
this.__state.hex = v;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
var Controller = function() {
|
|
605
|
+
function Controller(object, property) {
|
|
606
|
+
classCallCheck(this, Controller);
|
|
607
|
+
this.initialValue = object[property];
|
|
608
|
+
this.domElement = document.createElement("div");
|
|
609
|
+
this.object = object;
|
|
610
|
+
this.property = property;
|
|
611
|
+
this.__onChange = void 0;
|
|
612
|
+
this.__onFinishChange = void 0;
|
|
613
|
+
}
|
|
614
|
+
createClass(Controller, [
|
|
615
|
+
{
|
|
616
|
+
key: "onChange",
|
|
617
|
+
value: function onChange(fnc) {
|
|
618
|
+
this.__onChange = fnc;
|
|
619
|
+
return this;
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
key: "onFinishChange",
|
|
624
|
+
value: function onFinishChange(fnc) {
|
|
625
|
+
this.__onFinishChange = fnc;
|
|
626
|
+
return this;
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
key: "setValue",
|
|
631
|
+
value: function setValue(newValue) {
|
|
632
|
+
this.object[this.property] = newValue;
|
|
633
|
+
if (this.__onChange) this.__onChange.call(this, newValue);
|
|
634
|
+
this.updateDisplay();
|
|
635
|
+
return this;
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
key: "getValue",
|
|
640
|
+
value: function getValue() {
|
|
641
|
+
return this.object[this.property];
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
key: "updateDisplay",
|
|
646
|
+
value: function updateDisplay() {
|
|
647
|
+
return this;
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
key: "isModified",
|
|
652
|
+
value: function isModified() {
|
|
653
|
+
return this.initialValue !== this.getValue();
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
]);
|
|
657
|
+
return Controller;
|
|
658
|
+
}();
|
|
659
|
+
var EVENT_MAP = {
|
|
660
|
+
HTMLEvents: ["change"],
|
|
661
|
+
MouseEvents: [
|
|
662
|
+
"click",
|
|
663
|
+
"mousemove",
|
|
664
|
+
"mousedown",
|
|
665
|
+
"mouseup",
|
|
666
|
+
"mouseover"
|
|
667
|
+
],
|
|
668
|
+
KeyboardEvents: ["keydown"]
|
|
669
|
+
};
|
|
670
|
+
var EVENT_MAP_INV = {};
|
|
671
|
+
Common.each(EVENT_MAP, function(v, k) {
|
|
672
|
+
Common.each(v, function(e) {
|
|
673
|
+
EVENT_MAP_INV[e] = k;
|
|
674
|
+
});
|
|
675
|
+
});
|
|
676
|
+
var CSS_VALUE_PIXELS = /(\d+(\.\d+)?)px/;
|
|
677
|
+
function cssValueToPixels(val) {
|
|
678
|
+
if (val === "0" || Common.isUndefined(val)) return 0;
|
|
679
|
+
var match = val.match(CSS_VALUE_PIXELS);
|
|
680
|
+
if (!Common.isNull(match)) return parseFloat(match[1]);
|
|
681
|
+
return 0;
|
|
682
|
+
}
|
|
683
|
+
var dom = {
|
|
684
|
+
makeSelectable: function makeSelectable(elem, selectable) {
|
|
685
|
+
if (elem === void 0 || elem.style === void 0) return;
|
|
686
|
+
elem.onselectstart = selectable ? function() {
|
|
687
|
+
return false;
|
|
688
|
+
} : function() {};
|
|
689
|
+
elem.style.MozUserSelect = selectable ? "auto" : "none";
|
|
690
|
+
elem.style.KhtmlUserSelect = selectable ? "auto" : "none";
|
|
691
|
+
elem.unselectable = selectable ? "on" : "off";
|
|
692
|
+
},
|
|
693
|
+
makeFullscreen: function makeFullscreen(elem, hor, vert) {
|
|
694
|
+
var vertical = vert;
|
|
695
|
+
var horizontal = hor;
|
|
696
|
+
if (Common.isUndefined(horizontal)) horizontal = true;
|
|
697
|
+
if (Common.isUndefined(vertical)) vertical = true;
|
|
698
|
+
elem.style.position = "absolute";
|
|
699
|
+
if (horizontal) {
|
|
700
|
+
elem.style.left = 0;
|
|
701
|
+
elem.style.right = 0;
|
|
702
|
+
}
|
|
703
|
+
if (vertical) {
|
|
704
|
+
elem.style.top = 0;
|
|
705
|
+
elem.style.bottom = 0;
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
fakeEvent: function fakeEvent(elem, eventType, pars, aux) {
|
|
709
|
+
var params = pars || {};
|
|
710
|
+
var className = EVENT_MAP_INV[eventType];
|
|
711
|
+
if (!className) throw new Error("Event type " + eventType + " not supported.");
|
|
712
|
+
var evt = document.createEvent(className);
|
|
713
|
+
switch (className) {
|
|
714
|
+
case "MouseEvents":
|
|
715
|
+
var clientX = params.x || params.clientX || 0;
|
|
716
|
+
var clientY = params.y || params.clientY || 0;
|
|
717
|
+
evt.initMouseEvent(eventType, params.bubbles || false, params.cancelable || true, window, params.clickCount || 1, 0, 0, clientX, clientY, false, false, false, false, 0, null);
|
|
718
|
+
break;
|
|
719
|
+
case "KeyboardEvents":
|
|
720
|
+
var init = evt.initKeyboardEvent || evt.initKeyEvent;
|
|
721
|
+
Common.defaults(params, {
|
|
722
|
+
cancelable: true,
|
|
723
|
+
ctrlKey: false,
|
|
724
|
+
altKey: false,
|
|
725
|
+
shiftKey: false,
|
|
726
|
+
metaKey: false,
|
|
727
|
+
keyCode: void 0,
|
|
728
|
+
charCode: void 0
|
|
729
|
+
});
|
|
730
|
+
init(eventType, params.bubbles || false, params.cancelable, window, params.ctrlKey, params.altKey, params.shiftKey, params.metaKey, params.keyCode, params.charCode);
|
|
731
|
+
break;
|
|
732
|
+
default:
|
|
733
|
+
evt.initEvent(eventType, params.bubbles || false, params.cancelable || true);
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
Common.defaults(evt, aux);
|
|
737
|
+
elem.dispatchEvent(evt);
|
|
738
|
+
},
|
|
739
|
+
bind: function bind(elem, event, func, newBool) {
|
|
740
|
+
var bool = newBool || false;
|
|
741
|
+
if (elem.addEventListener) elem.addEventListener(event, func, bool);
|
|
742
|
+
else if (elem.attachEvent) elem.attachEvent("on" + event, func);
|
|
743
|
+
return dom;
|
|
744
|
+
},
|
|
745
|
+
unbind: function unbind(elem, event, func, newBool) {
|
|
746
|
+
var bool = newBool || false;
|
|
747
|
+
if (elem.removeEventListener) elem.removeEventListener(event, func, bool);
|
|
748
|
+
else if (elem.detachEvent) elem.detachEvent("on" + event, func);
|
|
749
|
+
return dom;
|
|
750
|
+
},
|
|
751
|
+
addClass: function addClass(elem, className) {
|
|
752
|
+
if (elem.className === void 0) elem.className = className;
|
|
753
|
+
else if (elem.className !== className) {
|
|
754
|
+
var classes = elem.className.split(/ +/);
|
|
755
|
+
if (classes.indexOf(className) === -1) {
|
|
756
|
+
classes.push(className);
|
|
757
|
+
elem.className = classes.join(" ").replace(/^\s+/, "").replace(/\s+$/, "");
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return dom;
|
|
761
|
+
},
|
|
762
|
+
removeClass: function removeClass(elem, className) {
|
|
763
|
+
if (className) if (elem.className === className) elem.removeAttribute("class");
|
|
764
|
+
else {
|
|
765
|
+
var classes = elem.className.split(/ +/);
|
|
766
|
+
var index = classes.indexOf(className);
|
|
767
|
+
if (index !== -1) {
|
|
768
|
+
classes.splice(index, 1);
|
|
769
|
+
elem.className = classes.join(" ");
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
else elem.className = void 0;
|
|
773
|
+
return dom;
|
|
774
|
+
},
|
|
775
|
+
hasClass: function hasClass(elem, className) {
|
|
776
|
+
return new RegExp("(?:^|\\s+)" + className + "(?:\\s+|$)").test(elem.className) || false;
|
|
777
|
+
},
|
|
778
|
+
getWidth: function getWidth(elem) {
|
|
779
|
+
var style = getComputedStyle(elem);
|
|
780
|
+
return cssValueToPixels(style["border-left-width"]) + cssValueToPixels(style["border-right-width"]) + cssValueToPixels(style["padding-left"]) + cssValueToPixels(style["padding-right"]) + cssValueToPixels(style.width);
|
|
781
|
+
},
|
|
782
|
+
getHeight: function getHeight(elem) {
|
|
783
|
+
var style = getComputedStyle(elem);
|
|
784
|
+
return cssValueToPixels(style["border-top-width"]) + cssValueToPixels(style["border-bottom-width"]) + cssValueToPixels(style["padding-top"]) + cssValueToPixels(style["padding-bottom"]) + cssValueToPixels(style.height);
|
|
785
|
+
},
|
|
786
|
+
getOffset: function getOffset(el) {
|
|
787
|
+
var elem = el;
|
|
788
|
+
var offset = {
|
|
789
|
+
left: 0,
|
|
790
|
+
top: 0
|
|
791
|
+
};
|
|
792
|
+
if (elem.offsetParent) do {
|
|
793
|
+
offset.left += elem.offsetLeft;
|
|
794
|
+
offset.top += elem.offsetTop;
|
|
795
|
+
elem = elem.offsetParent;
|
|
796
|
+
} while (elem);
|
|
797
|
+
return offset;
|
|
798
|
+
},
|
|
799
|
+
isActive: function isActive(elem) {
|
|
800
|
+
return elem === document.activeElement && (elem.type || elem.href);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
var BooleanController = function(_Controller) {
|
|
804
|
+
inherits(BooleanController, _Controller);
|
|
805
|
+
function BooleanController(object, property) {
|
|
806
|
+
classCallCheck(this, BooleanController);
|
|
807
|
+
var _this2 = possibleConstructorReturn(this, (BooleanController.__proto__ || Object.getPrototypeOf(BooleanController)).call(this, object, property));
|
|
808
|
+
var _this = _this2;
|
|
809
|
+
_this2.__prev = _this2.getValue();
|
|
810
|
+
_this2.__checkbox = document.createElement("input");
|
|
811
|
+
_this2.__checkbox.setAttribute("type", "checkbox");
|
|
812
|
+
function onChange() {
|
|
813
|
+
_this.setValue(!_this.__prev);
|
|
814
|
+
}
|
|
815
|
+
dom.bind(_this2.__checkbox, "change", onChange, false);
|
|
816
|
+
_this2.domElement.appendChild(_this2.__checkbox);
|
|
817
|
+
_this2.updateDisplay();
|
|
818
|
+
return _this2;
|
|
819
|
+
}
|
|
820
|
+
createClass(BooleanController, [{
|
|
821
|
+
key: "setValue",
|
|
822
|
+
value: function setValue(v) {
|
|
823
|
+
var toReturn = get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), "setValue", this).call(this, v);
|
|
824
|
+
if (this.__onFinishChange) this.__onFinishChange.call(this, this.getValue());
|
|
825
|
+
this.__prev = this.getValue();
|
|
826
|
+
return toReturn;
|
|
827
|
+
}
|
|
828
|
+
}, {
|
|
829
|
+
key: "updateDisplay",
|
|
830
|
+
value: function updateDisplay() {
|
|
831
|
+
if (this.getValue() === true) {
|
|
832
|
+
this.__checkbox.setAttribute("checked", "checked");
|
|
833
|
+
this.__checkbox.checked = true;
|
|
834
|
+
this.__prev = true;
|
|
835
|
+
} else {
|
|
836
|
+
this.__checkbox.checked = false;
|
|
837
|
+
this.__prev = false;
|
|
838
|
+
}
|
|
839
|
+
return get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), "updateDisplay", this).call(this);
|
|
840
|
+
}
|
|
841
|
+
}]);
|
|
842
|
+
return BooleanController;
|
|
843
|
+
}(Controller);
|
|
844
|
+
var OptionController = function(_Controller) {
|
|
845
|
+
inherits(OptionController, _Controller);
|
|
846
|
+
function OptionController(object, property, opts) {
|
|
847
|
+
classCallCheck(this, OptionController);
|
|
848
|
+
var _this2 = possibleConstructorReturn(this, (OptionController.__proto__ || Object.getPrototypeOf(OptionController)).call(this, object, property));
|
|
849
|
+
var options = opts;
|
|
850
|
+
var _this = _this2;
|
|
851
|
+
_this2.__select = document.createElement("select");
|
|
852
|
+
if (Common.isArray(options)) {
|
|
853
|
+
var map = {};
|
|
854
|
+
Common.each(options, function(element) {
|
|
855
|
+
map[element] = element;
|
|
856
|
+
});
|
|
857
|
+
options = map;
|
|
858
|
+
}
|
|
859
|
+
Common.each(options, function(value, key) {
|
|
860
|
+
var opt = document.createElement("option");
|
|
861
|
+
opt.innerHTML = key;
|
|
862
|
+
opt.setAttribute("value", value);
|
|
863
|
+
_this.__select.appendChild(opt);
|
|
864
|
+
});
|
|
865
|
+
_this2.updateDisplay();
|
|
866
|
+
dom.bind(_this2.__select, "change", function() {
|
|
867
|
+
var desiredValue = this.options[this.selectedIndex].value;
|
|
868
|
+
_this.setValue(desiredValue);
|
|
869
|
+
});
|
|
870
|
+
_this2.domElement.appendChild(_this2.__select);
|
|
871
|
+
return _this2;
|
|
872
|
+
}
|
|
873
|
+
createClass(OptionController, [{
|
|
874
|
+
key: "setValue",
|
|
875
|
+
value: function setValue(v) {
|
|
876
|
+
var toReturn = get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), "setValue", this).call(this, v);
|
|
877
|
+
if (this.__onFinishChange) this.__onFinishChange.call(this, this.getValue());
|
|
878
|
+
return toReturn;
|
|
879
|
+
}
|
|
880
|
+
}, {
|
|
881
|
+
key: "updateDisplay",
|
|
882
|
+
value: function updateDisplay() {
|
|
883
|
+
if (dom.isActive(this.__select)) return this;
|
|
884
|
+
this.__select.value = this.getValue();
|
|
885
|
+
return get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), "updateDisplay", this).call(this);
|
|
886
|
+
}
|
|
887
|
+
}]);
|
|
888
|
+
return OptionController;
|
|
889
|
+
}(Controller);
|
|
890
|
+
var StringController = function(_Controller) {
|
|
891
|
+
inherits(StringController, _Controller);
|
|
892
|
+
function StringController(object, property) {
|
|
893
|
+
classCallCheck(this, StringController);
|
|
894
|
+
var _this2 = possibleConstructorReturn(this, (StringController.__proto__ || Object.getPrototypeOf(StringController)).call(this, object, property));
|
|
895
|
+
var _this = _this2;
|
|
896
|
+
function onChange() {
|
|
897
|
+
_this.setValue(_this.__input.value);
|
|
898
|
+
}
|
|
899
|
+
function onBlur() {
|
|
900
|
+
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
901
|
+
}
|
|
902
|
+
_this2.__input = document.createElement("input");
|
|
903
|
+
_this2.__input.setAttribute("type", "text");
|
|
904
|
+
dom.bind(_this2.__input, "keyup", onChange);
|
|
905
|
+
dom.bind(_this2.__input, "change", onChange);
|
|
906
|
+
dom.bind(_this2.__input, "blur", onBlur);
|
|
907
|
+
dom.bind(_this2.__input, "keydown", function(e) {
|
|
908
|
+
if (e.keyCode === 13) this.blur();
|
|
909
|
+
});
|
|
910
|
+
_this2.updateDisplay();
|
|
911
|
+
_this2.domElement.appendChild(_this2.__input);
|
|
912
|
+
return _this2;
|
|
913
|
+
}
|
|
914
|
+
createClass(StringController, [{
|
|
915
|
+
key: "updateDisplay",
|
|
916
|
+
value: function updateDisplay() {
|
|
917
|
+
if (!dom.isActive(this.__input)) this.__input.value = this.getValue();
|
|
918
|
+
return get(StringController.prototype.__proto__ || Object.getPrototypeOf(StringController.prototype), "updateDisplay", this).call(this);
|
|
919
|
+
}
|
|
920
|
+
}]);
|
|
921
|
+
return StringController;
|
|
922
|
+
}(Controller);
|
|
923
|
+
function numDecimals(x) {
|
|
924
|
+
var _x = x.toString();
|
|
925
|
+
if (_x.indexOf(".") > -1) return _x.length - _x.indexOf(".") - 1;
|
|
926
|
+
return 0;
|
|
927
|
+
}
|
|
928
|
+
var NumberController = function(_Controller) {
|
|
929
|
+
inherits(NumberController, _Controller);
|
|
930
|
+
function NumberController(object, property, params) {
|
|
931
|
+
classCallCheck(this, NumberController);
|
|
932
|
+
var _this = possibleConstructorReturn(this, (NumberController.__proto__ || Object.getPrototypeOf(NumberController)).call(this, object, property));
|
|
933
|
+
var _params = params || {};
|
|
934
|
+
_this.__min = _params.min;
|
|
935
|
+
_this.__max = _params.max;
|
|
936
|
+
_this.__step = _params.step;
|
|
937
|
+
if (Common.isUndefined(_this.__step)) if (_this.initialValue === 0) _this.__impliedStep = 1;
|
|
938
|
+
else _this.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(_this.initialValue)) / Math.LN10)) / 10;
|
|
939
|
+
else _this.__impliedStep = _this.__step;
|
|
940
|
+
_this.__precision = numDecimals(_this.__impliedStep);
|
|
941
|
+
return _this;
|
|
942
|
+
}
|
|
943
|
+
createClass(NumberController, [
|
|
944
|
+
{
|
|
945
|
+
key: "setValue",
|
|
946
|
+
value: function setValue(v) {
|
|
947
|
+
var _v = v;
|
|
948
|
+
if (this.__min !== void 0 && _v < this.__min) _v = this.__min;
|
|
949
|
+
else if (this.__max !== void 0 && _v > this.__max) _v = this.__max;
|
|
950
|
+
if (this.__step !== void 0 && _v % this.__step !== 0) _v = Math.round(_v / this.__step) * this.__step;
|
|
951
|
+
return get(NumberController.prototype.__proto__ || Object.getPrototypeOf(NumberController.prototype), "setValue", this).call(this, _v);
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
key: "min",
|
|
956
|
+
value: function min(minValue) {
|
|
957
|
+
this.__min = minValue;
|
|
958
|
+
return this;
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
key: "max",
|
|
963
|
+
value: function max(maxValue) {
|
|
964
|
+
this.__max = maxValue;
|
|
965
|
+
return this;
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
key: "step",
|
|
970
|
+
value: function step(stepValue) {
|
|
971
|
+
this.__step = stepValue;
|
|
972
|
+
this.__impliedStep = stepValue;
|
|
973
|
+
this.__precision = numDecimals(stepValue);
|
|
974
|
+
return this;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
]);
|
|
978
|
+
return NumberController;
|
|
979
|
+
}(Controller);
|
|
980
|
+
function roundToDecimal(value, decimals) {
|
|
981
|
+
var tenTo = Math.pow(10, decimals);
|
|
982
|
+
return Math.round(value * tenTo) / tenTo;
|
|
983
|
+
}
|
|
984
|
+
var NumberControllerBox = function(_NumberController) {
|
|
985
|
+
inherits(NumberControllerBox, _NumberController);
|
|
986
|
+
function NumberControllerBox(object, property, params) {
|
|
987
|
+
classCallCheck(this, NumberControllerBox);
|
|
988
|
+
var _this2 = possibleConstructorReturn(this, (NumberControllerBox.__proto__ || Object.getPrototypeOf(NumberControllerBox)).call(this, object, property, params));
|
|
989
|
+
_this2.__truncationSuspended = false;
|
|
990
|
+
var _this = _this2;
|
|
991
|
+
var prevY = void 0;
|
|
992
|
+
function onChange() {
|
|
993
|
+
var attempted = parseFloat(_this.__input.value);
|
|
994
|
+
if (!Common.isNaN(attempted)) _this.setValue(attempted);
|
|
995
|
+
}
|
|
996
|
+
function onFinish() {
|
|
997
|
+
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
998
|
+
}
|
|
999
|
+
function onBlur() {
|
|
1000
|
+
onFinish();
|
|
1001
|
+
}
|
|
1002
|
+
function onMouseDrag(e) {
|
|
1003
|
+
var diff = prevY - e.clientY;
|
|
1004
|
+
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
|
1005
|
+
prevY = e.clientY;
|
|
1006
|
+
}
|
|
1007
|
+
function onMouseUp() {
|
|
1008
|
+
dom.unbind(window, "mousemove", onMouseDrag);
|
|
1009
|
+
dom.unbind(window, "mouseup", onMouseUp);
|
|
1010
|
+
onFinish();
|
|
1011
|
+
}
|
|
1012
|
+
function onMouseDown(e) {
|
|
1013
|
+
dom.bind(window, "mousemove", onMouseDrag);
|
|
1014
|
+
dom.bind(window, "mouseup", onMouseUp);
|
|
1015
|
+
prevY = e.clientY;
|
|
1016
|
+
}
|
|
1017
|
+
_this2.__input = document.createElement("input");
|
|
1018
|
+
_this2.__input.setAttribute("type", "text");
|
|
1019
|
+
dom.bind(_this2.__input, "change", onChange);
|
|
1020
|
+
dom.bind(_this2.__input, "blur", onBlur);
|
|
1021
|
+
dom.bind(_this2.__input, "mousedown", onMouseDown);
|
|
1022
|
+
dom.bind(_this2.__input, "keydown", function(e) {
|
|
1023
|
+
if (e.keyCode === 13) {
|
|
1024
|
+
_this.__truncationSuspended = true;
|
|
1025
|
+
this.blur();
|
|
1026
|
+
_this.__truncationSuspended = false;
|
|
1027
|
+
onFinish();
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
_this2.updateDisplay();
|
|
1031
|
+
_this2.domElement.appendChild(_this2.__input);
|
|
1032
|
+
return _this2;
|
|
1033
|
+
}
|
|
1034
|
+
createClass(NumberControllerBox, [{
|
|
1035
|
+
key: "updateDisplay",
|
|
1036
|
+
value: function updateDisplay() {
|
|
1037
|
+
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
|
|
1038
|
+
return get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), "updateDisplay", this).call(this);
|
|
1039
|
+
}
|
|
1040
|
+
}]);
|
|
1041
|
+
return NumberControllerBox;
|
|
1042
|
+
}(NumberController);
|
|
1043
|
+
function map(v, i1, i2, o1, o2) {
|
|
1044
|
+
return o1 + (o2 - o1) * ((v - i1) / (i2 - i1));
|
|
1045
|
+
}
|
|
1046
|
+
var NumberControllerSlider = function(_NumberController) {
|
|
1047
|
+
inherits(NumberControllerSlider, _NumberController);
|
|
1048
|
+
function NumberControllerSlider(object, property, min, max, step) {
|
|
1049
|
+
classCallCheck(this, NumberControllerSlider);
|
|
1050
|
+
var _this2 = possibleConstructorReturn(this, (NumberControllerSlider.__proto__ || Object.getPrototypeOf(NumberControllerSlider)).call(this, object, property, {
|
|
1051
|
+
min,
|
|
1052
|
+
max,
|
|
1053
|
+
step
|
|
1054
|
+
}));
|
|
1055
|
+
var _this = _this2;
|
|
1056
|
+
_this2.__background = document.createElement("div");
|
|
1057
|
+
_this2.__foreground = document.createElement("div");
|
|
1058
|
+
dom.bind(_this2.__background, "mousedown", onMouseDown);
|
|
1059
|
+
dom.bind(_this2.__background, "touchstart", onTouchStart);
|
|
1060
|
+
dom.addClass(_this2.__background, "slider");
|
|
1061
|
+
dom.addClass(_this2.__foreground, "slider-fg");
|
|
1062
|
+
function onMouseDown(e) {
|
|
1063
|
+
document.activeElement.blur();
|
|
1064
|
+
dom.bind(window, "mousemove", onMouseDrag);
|
|
1065
|
+
dom.bind(window, "mouseup", onMouseUp);
|
|
1066
|
+
onMouseDrag(e);
|
|
1067
|
+
}
|
|
1068
|
+
function onMouseDrag(e) {
|
|
1069
|
+
e.preventDefault();
|
|
1070
|
+
var bgRect = _this.__background.getBoundingClientRect();
|
|
1071
|
+
_this.setValue(map(e.clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
|
|
1072
|
+
return false;
|
|
1073
|
+
}
|
|
1074
|
+
function onMouseUp() {
|
|
1075
|
+
dom.unbind(window, "mousemove", onMouseDrag);
|
|
1076
|
+
dom.unbind(window, "mouseup", onMouseUp);
|
|
1077
|
+
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
1078
|
+
}
|
|
1079
|
+
function onTouchStart(e) {
|
|
1080
|
+
if (e.touches.length !== 1) return;
|
|
1081
|
+
dom.bind(window, "touchmove", onTouchMove);
|
|
1082
|
+
dom.bind(window, "touchend", onTouchEnd);
|
|
1083
|
+
onTouchMove(e);
|
|
1084
|
+
}
|
|
1085
|
+
function onTouchMove(e) {
|
|
1086
|
+
var clientX = e.touches[0].clientX;
|
|
1087
|
+
var bgRect = _this.__background.getBoundingClientRect();
|
|
1088
|
+
_this.setValue(map(clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
|
|
1089
|
+
}
|
|
1090
|
+
function onTouchEnd() {
|
|
1091
|
+
dom.unbind(window, "touchmove", onTouchMove);
|
|
1092
|
+
dom.unbind(window, "touchend", onTouchEnd);
|
|
1093
|
+
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
1094
|
+
}
|
|
1095
|
+
_this2.updateDisplay();
|
|
1096
|
+
_this2.__background.appendChild(_this2.__foreground);
|
|
1097
|
+
_this2.domElement.appendChild(_this2.__background);
|
|
1098
|
+
return _this2;
|
|
1099
|
+
}
|
|
1100
|
+
createClass(NumberControllerSlider, [{
|
|
1101
|
+
key: "updateDisplay",
|
|
1102
|
+
value: function updateDisplay() {
|
|
1103
|
+
var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
|
|
1104
|
+
this.__foreground.style.width = pct * 100 + "%";
|
|
1105
|
+
return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), "updateDisplay", this).call(this);
|
|
1106
|
+
}
|
|
1107
|
+
}]);
|
|
1108
|
+
return NumberControllerSlider;
|
|
1109
|
+
}(NumberController);
|
|
1110
|
+
var FunctionController = function(_Controller) {
|
|
1111
|
+
inherits(FunctionController, _Controller);
|
|
1112
|
+
function FunctionController(object, property, text) {
|
|
1113
|
+
classCallCheck(this, FunctionController);
|
|
1114
|
+
var _this2 = possibleConstructorReturn(this, (FunctionController.__proto__ || Object.getPrototypeOf(FunctionController)).call(this, object, property));
|
|
1115
|
+
var _this = _this2;
|
|
1116
|
+
_this2.__button = document.createElement("div");
|
|
1117
|
+
_this2.__button.innerHTML = text === void 0 ? "Fire" : text;
|
|
1118
|
+
dom.bind(_this2.__button, "click", function(e) {
|
|
1119
|
+
e.preventDefault();
|
|
1120
|
+
_this.fire();
|
|
1121
|
+
return false;
|
|
1122
|
+
});
|
|
1123
|
+
dom.addClass(_this2.__button, "button");
|
|
1124
|
+
_this2.domElement.appendChild(_this2.__button);
|
|
1125
|
+
return _this2;
|
|
1126
|
+
}
|
|
1127
|
+
createClass(FunctionController, [{
|
|
1128
|
+
key: "fire",
|
|
1129
|
+
value: function fire() {
|
|
1130
|
+
if (this.__onChange) this.__onChange.call(this);
|
|
1131
|
+
this.getValue().call(this.object);
|
|
1132
|
+
if (this.__onFinishChange) this.__onFinishChange.call(this, this.getValue());
|
|
1133
|
+
}
|
|
1134
|
+
}]);
|
|
1135
|
+
return FunctionController;
|
|
1136
|
+
}(Controller);
|
|
1137
|
+
var ColorController = function(_Controller) {
|
|
1138
|
+
inherits(ColorController, _Controller);
|
|
1139
|
+
function ColorController(object, property) {
|
|
1140
|
+
classCallCheck(this, ColorController);
|
|
1141
|
+
var _this2 = possibleConstructorReturn(this, (ColorController.__proto__ || Object.getPrototypeOf(ColorController)).call(this, object, property));
|
|
1142
|
+
_this2.__color = new Color(_this2.getValue());
|
|
1143
|
+
_this2.__temp = new Color(0);
|
|
1144
|
+
var _this = _this2;
|
|
1145
|
+
_this2.domElement = document.createElement("div");
|
|
1146
|
+
dom.makeSelectable(_this2.domElement, false);
|
|
1147
|
+
_this2.__selector = document.createElement("div");
|
|
1148
|
+
_this2.__selector.className = "selector";
|
|
1149
|
+
_this2.__saturation_field = document.createElement("div");
|
|
1150
|
+
_this2.__saturation_field.className = "saturation-field";
|
|
1151
|
+
_this2.__field_knob = document.createElement("div");
|
|
1152
|
+
_this2.__field_knob.className = "field-knob";
|
|
1153
|
+
_this2.__field_knob_border = "2px solid ";
|
|
1154
|
+
_this2.__hue_knob = document.createElement("div");
|
|
1155
|
+
_this2.__hue_knob.className = "hue-knob";
|
|
1156
|
+
_this2.__hue_field = document.createElement("div");
|
|
1157
|
+
_this2.__hue_field.className = "hue-field";
|
|
1158
|
+
_this2.__input = document.createElement("input");
|
|
1159
|
+
_this2.__input.type = "text";
|
|
1160
|
+
_this2.__input_textShadow = "0 1px 1px ";
|
|
1161
|
+
dom.bind(_this2.__input, "keydown", function(e) {
|
|
1162
|
+
if (e.keyCode === 13) onBlur.call(this);
|
|
1163
|
+
});
|
|
1164
|
+
dom.bind(_this2.__input, "blur", onBlur);
|
|
1165
|
+
dom.bind(_this2.__selector, "mousedown", function() {
|
|
1166
|
+
dom.addClass(this, "drag").bind(window, "mouseup", function() {
|
|
1167
|
+
dom.removeClass(_this.__selector, "drag");
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
dom.bind(_this2.__selector, "touchstart", function() {
|
|
1171
|
+
dom.addClass(this, "drag").bind(window, "touchend", function() {
|
|
1172
|
+
dom.removeClass(_this.__selector, "drag");
|
|
1173
|
+
});
|
|
1174
|
+
});
|
|
1175
|
+
var valueField = document.createElement("div");
|
|
1176
|
+
Common.extend(_this2.__selector.style, {
|
|
1177
|
+
width: "122px",
|
|
1178
|
+
height: "102px",
|
|
1179
|
+
padding: "3px",
|
|
1180
|
+
backgroundColor: "#222",
|
|
1181
|
+
boxShadow: "0px 1px 3px rgba(0,0,0,0.3)"
|
|
1182
|
+
});
|
|
1183
|
+
Common.extend(_this2.__field_knob.style, {
|
|
1184
|
+
position: "absolute",
|
|
1185
|
+
width: "12px",
|
|
1186
|
+
height: "12px",
|
|
1187
|
+
border: _this2.__field_knob_border + (_this2.__color.v < .5 ? "#fff" : "#000"),
|
|
1188
|
+
boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
|
|
1189
|
+
borderRadius: "12px",
|
|
1190
|
+
zIndex: 1
|
|
1191
|
+
});
|
|
1192
|
+
Common.extend(_this2.__hue_knob.style, {
|
|
1193
|
+
position: "absolute",
|
|
1194
|
+
width: "15px",
|
|
1195
|
+
height: "2px",
|
|
1196
|
+
borderRight: "4px solid #fff",
|
|
1197
|
+
zIndex: 1
|
|
1198
|
+
});
|
|
1199
|
+
Common.extend(_this2.__saturation_field.style, {
|
|
1200
|
+
width: "100px",
|
|
1201
|
+
height: "100px",
|
|
1202
|
+
border: "1px solid #555",
|
|
1203
|
+
marginRight: "3px",
|
|
1204
|
+
display: "inline-block",
|
|
1205
|
+
cursor: "pointer"
|
|
1206
|
+
});
|
|
1207
|
+
Common.extend(valueField.style, {
|
|
1208
|
+
width: "100%",
|
|
1209
|
+
height: "100%",
|
|
1210
|
+
background: "none"
|
|
1211
|
+
});
|
|
1212
|
+
linearGradient(valueField, "top", "rgba(0,0,0,0)", "#000");
|
|
1213
|
+
Common.extend(_this2.__hue_field.style, {
|
|
1214
|
+
width: "15px",
|
|
1215
|
+
height: "100px",
|
|
1216
|
+
border: "1px solid #555",
|
|
1217
|
+
cursor: "ns-resize",
|
|
1218
|
+
position: "absolute",
|
|
1219
|
+
top: "3px",
|
|
1220
|
+
right: "3px"
|
|
1221
|
+
});
|
|
1222
|
+
hueGradient(_this2.__hue_field);
|
|
1223
|
+
Common.extend(_this2.__input.style, {
|
|
1224
|
+
outline: "none",
|
|
1225
|
+
textAlign: "center",
|
|
1226
|
+
color: "#fff",
|
|
1227
|
+
border: 0,
|
|
1228
|
+
fontWeight: "bold",
|
|
1229
|
+
textShadow: _this2.__input_textShadow + "rgba(0,0,0,0.7)"
|
|
1230
|
+
});
|
|
1231
|
+
dom.bind(_this2.__saturation_field, "mousedown", fieldDown);
|
|
1232
|
+
dom.bind(_this2.__saturation_field, "touchstart", fieldDown);
|
|
1233
|
+
dom.bind(_this2.__field_knob, "mousedown", fieldDown);
|
|
1234
|
+
dom.bind(_this2.__field_knob, "touchstart", fieldDown);
|
|
1235
|
+
dom.bind(_this2.__hue_field, "mousedown", fieldDownH);
|
|
1236
|
+
dom.bind(_this2.__hue_field, "touchstart", fieldDownH);
|
|
1237
|
+
function fieldDown(e) {
|
|
1238
|
+
setSV(e);
|
|
1239
|
+
dom.bind(window, "mousemove", setSV);
|
|
1240
|
+
dom.bind(window, "touchmove", setSV);
|
|
1241
|
+
dom.bind(window, "mouseup", fieldUpSV);
|
|
1242
|
+
dom.bind(window, "touchend", fieldUpSV);
|
|
1243
|
+
}
|
|
1244
|
+
function fieldDownH(e) {
|
|
1245
|
+
setH(e);
|
|
1246
|
+
dom.bind(window, "mousemove", setH);
|
|
1247
|
+
dom.bind(window, "touchmove", setH);
|
|
1248
|
+
dom.bind(window, "mouseup", fieldUpH);
|
|
1249
|
+
dom.bind(window, "touchend", fieldUpH);
|
|
1250
|
+
}
|
|
1251
|
+
function fieldUpSV() {
|
|
1252
|
+
dom.unbind(window, "mousemove", setSV);
|
|
1253
|
+
dom.unbind(window, "touchmove", setSV);
|
|
1254
|
+
dom.unbind(window, "mouseup", fieldUpSV);
|
|
1255
|
+
dom.unbind(window, "touchend", fieldUpSV);
|
|
1256
|
+
onFinish();
|
|
1257
|
+
}
|
|
1258
|
+
function fieldUpH() {
|
|
1259
|
+
dom.unbind(window, "mousemove", setH);
|
|
1260
|
+
dom.unbind(window, "touchmove", setH);
|
|
1261
|
+
dom.unbind(window, "mouseup", fieldUpH);
|
|
1262
|
+
dom.unbind(window, "touchend", fieldUpH);
|
|
1263
|
+
onFinish();
|
|
1264
|
+
}
|
|
1265
|
+
function onBlur() {
|
|
1266
|
+
var i = interpret(this.value);
|
|
1267
|
+
if (i !== false) {
|
|
1268
|
+
_this.__color.__state = i;
|
|
1269
|
+
_this.setValue(_this.__color.toOriginal());
|
|
1270
|
+
} else this.value = _this.__color.toString();
|
|
1271
|
+
}
|
|
1272
|
+
function onFinish() {
|
|
1273
|
+
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.__color.toOriginal());
|
|
1274
|
+
}
|
|
1275
|
+
_this2.__saturation_field.appendChild(valueField);
|
|
1276
|
+
_this2.__selector.appendChild(_this2.__field_knob);
|
|
1277
|
+
_this2.__selector.appendChild(_this2.__saturation_field);
|
|
1278
|
+
_this2.__selector.appendChild(_this2.__hue_field);
|
|
1279
|
+
_this2.__hue_field.appendChild(_this2.__hue_knob);
|
|
1280
|
+
_this2.domElement.appendChild(_this2.__input);
|
|
1281
|
+
_this2.domElement.appendChild(_this2.__selector);
|
|
1282
|
+
_this2.updateDisplay();
|
|
1283
|
+
function setSV(e) {
|
|
1284
|
+
if (e.type.indexOf("touch") === -1) e.preventDefault();
|
|
1285
|
+
var fieldRect = _this.__saturation_field.getBoundingClientRect();
|
|
1286
|
+
var _ref = e.touches && e.touches[0] || e, clientX = _ref.clientX, clientY = _ref.clientY;
|
|
1287
|
+
var s = (clientX - fieldRect.left) / (fieldRect.right - fieldRect.left);
|
|
1288
|
+
var v = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
|
|
1289
|
+
if (v > 1) v = 1;
|
|
1290
|
+
else if (v < 0) v = 0;
|
|
1291
|
+
if (s > 1) s = 1;
|
|
1292
|
+
else if (s < 0) s = 0;
|
|
1293
|
+
_this.__color.v = v;
|
|
1294
|
+
_this.__color.s = s;
|
|
1295
|
+
_this.setValue(_this.__color.toOriginal());
|
|
1296
|
+
return false;
|
|
1297
|
+
}
|
|
1298
|
+
function setH(e) {
|
|
1299
|
+
if (e.type.indexOf("touch") === -1) e.preventDefault();
|
|
1300
|
+
var fieldRect = _this.__hue_field.getBoundingClientRect();
|
|
1301
|
+
var h = 1 - ((e.touches && e.touches[0] || e).clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
|
|
1302
|
+
if (h > 1) h = 1;
|
|
1303
|
+
else if (h < 0) h = 0;
|
|
1304
|
+
_this.__color.h = h * 360;
|
|
1305
|
+
_this.setValue(_this.__color.toOriginal());
|
|
1306
|
+
return false;
|
|
1307
|
+
}
|
|
1308
|
+
return _this2;
|
|
1309
|
+
}
|
|
1310
|
+
createClass(ColorController, [{
|
|
1311
|
+
key: "updateDisplay",
|
|
1312
|
+
value: function updateDisplay() {
|
|
1313
|
+
var i = interpret(this.getValue());
|
|
1314
|
+
if (i !== false) {
|
|
1315
|
+
var mismatch = false;
|
|
1316
|
+
Common.each(Color.COMPONENTS, function(component) {
|
|
1317
|
+
if (!Common.isUndefined(i[component]) && !Common.isUndefined(this.__color.__state[component]) && i[component] !== this.__color.__state[component]) {
|
|
1318
|
+
mismatch = true;
|
|
1319
|
+
return {};
|
|
1320
|
+
}
|
|
1321
|
+
}, this);
|
|
1322
|
+
if (mismatch) Common.extend(this.__color.__state, i);
|
|
1323
|
+
}
|
|
1324
|
+
Common.extend(this.__temp.__state, this.__color.__state);
|
|
1325
|
+
this.__temp.a = 1;
|
|
1326
|
+
var flip = this.__color.v < .5 || this.__color.s > .5 ? 255 : 0;
|
|
1327
|
+
var _flip = 255 - flip;
|
|
1328
|
+
Common.extend(this.__field_knob.style, {
|
|
1329
|
+
marginLeft: 100 * this.__color.s - 7 + "px",
|
|
1330
|
+
marginTop: 100 * (1 - this.__color.v) - 7 + "px",
|
|
1331
|
+
backgroundColor: this.__temp.toHexString(),
|
|
1332
|
+
border: this.__field_knob_border + "rgb(" + flip + "," + flip + "," + flip + ")"
|
|
1333
|
+
});
|
|
1334
|
+
this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + "px";
|
|
1335
|
+
this.__temp.s = 1;
|
|
1336
|
+
this.__temp.v = 1;
|
|
1337
|
+
linearGradient(this.__saturation_field, "left", "#fff", this.__temp.toHexString());
|
|
1338
|
+
this.__input.value = this.__color.toString();
|
|
1339
|
+
Common.extend(this.__input.style, {
|
|
1340
|
+
backgroundColor: this.__color.toHexString(),
|
|
1341
|
+
color: "rgb(" + flip + "," + flip + "," + flip + ")",
|
|
1342
|
+
textShadow: this.__input_textShadow + "rgba(" + _flip + "," + _flip + "," + _flip + ",.7)"
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
}]);
|
|
1346
|
+
return ColorController;
|
|
1347
|
+
}(Controller);
|
|
1348
|
+
var vendors = [
|
|
1349
|
+
"-moz-",
|
|
1350
|
+
"-o-",
|
|
1351
|
+
"-webkit-",
|
|
1352
|
+
"-ms-",
|
|
1353
|
+
""
|
|
1354
|
+
];
|
|
1355
|
+
function linearGradient(elem, x, a, b) {
|
|
1356
|
+
elem.style.background = "";
|
|
1357
|
+
Common.each(vendors, function(vendor) {
|
|
1358
|
+
elem.style.cssText += "background: " + vendor + "linear-gradient(" + x + ", " + a + " 0%, " + b + " 100%); ";
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
function hueGradient(elem) {
|
|
1362
|
+
elem.style.background = "";
|
|
1363
|
+
elem.style.cssText += "background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";
|
|
1364
|
+
elem.style.cssText += "background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
1365
|
+
elem.style.cssText += "background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
1366
|
+
elem.style.cssText += "background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
1367
|
+
elem.style.cssText += "background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
1368
|
+
}
|
|
1369
|
+
var css = {
|
|
1370
|
+
load: function load(url, indoc) {
|
|
1371
|
+
var doc = indoc || document;
|
|
1372
|
+
var link = doc.createElement("link");
|
|
1373
|
+
link.type = "text/css";
|
|
1374
|
+
link.rel = "stylesheet";
|
|
1375
|
+
link.href = url;
|
|
1376
|
+
doc.getElementsByTagName("head")[0].appendChild(link);
|
|
1377
|
+
},
|
|
1378
|
+
inject: function inject(cssContent, indoc) {
|
|
1379
|
+
var doc = indoc || document;
|
|
1380
|
+
var injected = document.createElement("style");
|
|
1381
|
+
injected.type = "text/css";
|
|
1382
|
+
injected.innerHTML = cssContent;
|
|
1383
|
+
var head = doc.getElementsByTagName("head")[0];
|
|
1384
|
+
try {
|
|
1385
|
+
head.appendChild(injected);
|
|
1386
|
+
} catch (e) {}
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
var saveDialogContents = "<div id=\"dg-save\" class=\"dg dialogue\">\n\n Here's the new load parameter for your <code>GUI</code>'s constructor:\n\n <textarea id=\"dg-new-constructor\"></textarea>\n\n <div id=\"dg-save-locally\">\n\n <input id=\"dg-local-storage\" type=\"checkbox\"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id=\"dg-local-explain\">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>";
|
|
1390
|
+
var ControllerFactory = function ControllerFactory(object, property) {
|
|
1391
|
+
var initialValue = object[property];
|
|
1392
|
+
if (Common.isArray(arguments[2]) || Common.isObject(arguments[2])) return new OptionController(object, property, arguments[2]);
|
|
1393
|
+
if (Common.isNumber(initialValue)) {
|
|
1394
|
+
if (Common.isNumber(arguments[2]) && Common.isNumber(arguments[3])) {
|
|
1395
|
+
if (Common.isNumber(arguments[4])) return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]);
|
|
1396
|
+
return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
|
|
1397
|
+
}
|
|
1398
|
+
if (Common.isNumber(arguments[4])) return new NumberControllerBox(object, property, {
|
|
1399
|
+
min: arguments[2],
|
|
1400
|
+
max: arguments[3],
|
|
1401
|
+
step: arguments[4]
|
|
1402
|
+
});
|
|
1403
|
+
return new NumberControllerBox(object, property, {
|
|
1404
|
+
min: arguments[2],
|
|
1405
|
+
max: arguments[3]
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
if (Common.isString(initialValue)) return new StringController(object, property);
|
|
1409
|
+
if (Common.isFunction(initialValue)) return new FunctionController(object, property, "");
|
|
1410
|
+
if (Common.isBoolean(initialValue)) return new BooleanController(object, property);
|
|
1411
|
+
return null;
|
|
1412
|
+
};
|
|
1413
|
+
function requestAnimationFrame(callback) {
|
|
1414
|
+
setTimeout(callback, 1e3 / 60);
|
|
1415
|
+
}
|
|
1416
|
+
var requestAnimationFrame$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || requestAnimationFrame;
|
|
1417
|
+
var CenteredDiv = function() {
|
|
1418
|
+
function CenteredDiv() {
|
|
1419
|
+
classCallCheck(this, CenteredDiv);
|
|
1420
|
+
this.backgroundElement = document.createElement("div");
|
|
1421
|
+
Common.extend(this.backgroundElement.style, {
|
|
1422
|
+
backgroundColor: "rgba(0,0,0,0.8)",
|
|
1423
|
+
top: 0,
|
|
1424
|
+
left: 0,
|
|
1425
|
+
display: "none",
|
|
1426
|
+
zIndex: "1000",
|
|
1427
|
+
opacity: 0,
|
|
1428
|
+
WebkitTransition: "opacity 0.2s linear",
|
|
1429
|
+
transition: "opacity 0.2s linear"
|
|
1430
|
+
});
|
|
1431
|
+
dom.makeFullscreen(this.backgroundElement);
|
|
1432
|
+
this.backgroundElement.style.position = "fixed";
|
|
1433
|
+
this.domElement = document.createElement("div");
|
|
1434
|
+
Common.extend(this.domElement.style, {
|
|
1435
|
+
position: "fixed",
|
|
1436
|
+
display: "none",
|
|
1437
|
+
zIndex: "1001",
|
|
1438
|
+
opacity: 0,
|
|
1439
|
+
WebkitTransition: "-webkit-transform 0.2s ease-out, opacity 0.2s linear",
|
|
1440
|
+
transition: "transform 0.2s ease-out, opacity 0.2s linear"
|
|
1441
|
+
});
|
|
1442
|
+
document.body.appendChild(this.backgroundElement);
|
|
1443
|
+
document.body.appendChild(this.domElement);
|
|
1444
|
+
var _this = this;
|
|
1445
|
+
dom.bind(this.backgroundElement, "click", function() {
|
|
1446
|
+
_this.hide();
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
createClass(CenteredDiv, [
|
|
1450
|
+
{
|
|
1451
|
+
key: "show",
|
|
1452
|
+
value: function show() {
|
|
1453
|
+
var _this = this;
|
|
1454
|
+
this.backgroundElement.style.display = "block";
|
|
1455
|
+
this.domElement.style.display = "block";
|
|
1456
|
+
this.domElement.style.opacity = 0;
|
|
1457
|
+
this.domElement.style.webkitTransform = "scale(1.1)";
|
|
1458
|
+
this.layout();
|
|
1459
|
+
Common.defer(function() {
|
|
1460
|
+
_this.backgroundElement.style.opacity = 1;
|
|
1461
|
+
_this.domElement.style.opacity = 1;
|
|
1462
|
+
_this.domElement.style.webkitTransform = "scale(1)";
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
key: "hide",
|
|
1468
|
+
value: function hide() {
|
|
1469
|
+
var _this = this;
|
|
1470
|
+
var hide = function hide() {
|
|
1471
|
+
_this.domElement.style.display = "none";
|
|
1472
|
+
_this.backgroundElement.style.display = "none";
|
|
1473
|
+
dom.unbind(_this.domElement, "webkitTransitionEnd", hide);
|
|
1474
|
+
dom.unbind(_this.domElement, "transitionend", hide);
|
|
1475
|
+
dom.unbind(_this.domElement, "oTransitionEnd", hide);
|
|
1476
|
+
};
|
|
1477
|
+
dom.bind(this.domElement, "webkitTransitionEnd", hide);
|
|
1478
|
+
dom.bind(this.domElement, "transitionend", hide);
|
|
1479
|
+
dom.bind(this.domElement, "oTransitionEnd", hide);
|
|
1480
|
+
this.backgroundElement.style.opacity = 0;
|
|
1481
|
+
this.domElement.style.opacity = 0;
|
|
1482
|
+
this.domElement.style.webkitTransform = "scale(1.1)";
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
key: "layout",
|
|
1487
|
+
value: function layout() {
|
|
1488
|
+
this.domElement.style.left = window.innerWidth / 2 - dom.getWidth(this.domElement) / 2 + "px";
|
|
1489
|
+
this.domElement.style.top = window.innerHeight / 2 - dom.getHeight(this.domElement) / 2 + "px";
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
]);
|
|
1493
|
+
return CenteredDiv;
|
|
1494
|
+
}();
|
|
1495
|
+
var styleSheet = ___$insertStyle(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");
|
|
1496
|
+
css.inject(styleSheet);
|
|
1497
|
+
var CSS_NAMESPACE = "dg";
|
|
1498
|
+
var HIDE_KEY_CODE = 72;
|
|
1499
|
+
var CLOSE_BUTTON_HEIGHT = 20;
|
|
1500
|
+
var DEFAULT_DEFAULT_PRESET_NAME = "Default";
|
|
1501
|
+
var SUPPORTS_LOCAL_STORAGE = function() {
|
|
1502
|
+
try {
|
|
1503
|
+
return !!window.localStorage;
|
|
1504
|
+
} catch (e) {
|
|
1505
|
+
return false;
|
|
1506
|
+
}
|
|
1507
|
+
}();
|
|
1508
|
+
var SAVE_DIALOGUE = void 0;
|
|
1509
|
+
var autoPlaceVirgin = true;
|
|
1510
|
+
var autoPlaceContainer = void 0;
|
|
1511
|
+
var hide = false;
|
|
1512
|
+
var hideableGuis = [];
|
|
1513
|
+
var GUI = function GUI(pars) {
|
|
1514
|
+
var _this = this;
|
|
1515
|
+
var params = pars || {};
|
|
1516
|
+
this.domElement = document.createElement("div");
|
|
1517
|
+
this.__ul = document.createElement("ul");
|
|
1518
|
+
this.domElement.appendChild(this.__ul);
|
|
1519
|
+
dom.addClass(this.domElement, CSS_NAMESPACE);
|
|
1520
|
+
this.__folders = {};
|
|
1521
|
+
this.__controllers = [];
|
|
1522
|
+
this.__rememberedObjects = [];
|
|
1523
|
+
this.__rememberedObjectIndecesToControllers = [];
|
|
1524
|
+
this.__listening = [];
|
|
1525
|
+
params = Common.defaults(params, {
|
|
1526
|
+
closeOnTop: false,
|
|
1527
|
+
autoPlace: true,
|
|
1528
|
+
width: GUI.DEFAULT_WIDTH
|
|
1529
|
+
});
|
|
1530
|
+
params = Common.defaults(params, {
|
|
1531
|
+
resizable: params.autoPlace,
|
|
1532
|
+
hideable: params.autoPlace
|
|
1533
|
+
});
|
|
1534
|
+
if (!Common.isUndefined(params.load)) {
|
|
1535
|
+
if (params.preset) params.load.preset = params.preset;
|
|
1536
|
+
} else params.load = { preset: DEFAULT_DEFAULT_PRESET_NAME };
|
|
1537
|
+
if (Common.isUndefined(params.parent) && params.hideable) hideableGuis.push(this);
|
|
1538
|
+
params.resizable = Common.isUndefined(params.parent) && params.resizable;
|
|
1539
|
+
if (params.autoPlace && Common.isUndefined(params.scrollable)) params.scrollable = true;
|
|
1540
|
+
var useLocalStorage = SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(this, "isLocal")) === "true";
|
|
1541
|
+
var saveToLocalStorage = void 0;
|
|
1542
|
+
var titleRow = void 0;
|
|
1543
|
+
Object.defineProperties(this, {
|
|
1544
|
+
parent: { get: function get$$1() {
|
|
1545
|
+
return params.parent;
|
|
1546
|
+
} },
|
|
1547
|
+
scrollable: { get: function get$$1() {
|
|
1548
|
+
return params.scrollable;
|
|
1549
|
+
} },
|
|
1550
|
+
autoPlace: { get: function get$$1() {
|
|
1551
|
+
return params.autoPlace;
|
|
1552
|
+
} },
|
|
1553
|
+
closeOnTop: { get: function get$$1() {
|
|
1554
|
+
return params.closeOnTop;
|
|
1555
|
+
} },
|
|
1556
|
+
preset: {
|
|
1557
|
+
get: function get$$1() {
|
|
1558
|
+
if (_this.parent) return _this.getRoot().preset;
|
|
1559
|
+
return params.load.preset;
|
|
1560
|
+
},
|
|
1561
|
+
set: function set$$1(v) {
|
|
1562
|
+
if (_this.parent) _this.getRoot().preset = v;
|
|
1563
|
+
else params.load.preset = v;
|
|
1564
|
+
setPresetSelectIndex(this);
|
|
1565
|
+
_this.revert();
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
width: {
|
|
1569
|
+
get: function get$$1() {
|
|
1570
|
+
return params.width;
|
|
1571
|
+
},
|
|
1572
|
+
set: function set$$1(v) {
|
|
1573
|
+
params.width = v;
|
|
1574
|
+
setWidth(_this, v);
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
name: {
|
|
1578
|
+
get: function get$$1() {
|
|
1579
|
+
return params.name;
|
|
1580
|
+
},
|
|
1581
|
+
set: function set$$1(v) {
|
|
1582
|
+
params.name = v;
|
|
1583
|
+
if (titleRow) titleRow.innerHTML = params.name;
|
|
1584
|
+
}
|
|
1585
|
+
},
|
|
1586
|
+
closed: {
|
|
1587
|
+
get: function get$$1() {
|
|
1588
|
+
return params.closed;
|
|
1589
|
+
},
|
|
1590
|
+
set: function set$$1(v) {
|
|
1591
|
+
params.closed = v;
|
|
1592
|
+
if (params.closed) dom.addClass(_this.__ul, GUI.CLASS_CLOSED);
|
|
1593
|
+
else dom.removeClass(_this.__ul, GUI.CLASS_CLOSED);
|
|
1594
|
+
this.onResize();
|
|
1595
|
+
if (_this.__closeButton) _this.__closeButton.innerHTML = v ? GUI.TEXT_OPEN : GUI.TEXT_CLOSED;
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
load: { get: function get$$1() {
|
|
1599
|
+
return params.load;
|
|
1600
|
+
} },
|
|
1601
|
+
useLocalStorage: {
|
|
1602
|
+
get: function get$$1() {
|
|
1603
|
+
return useLocalStorage;
|
|
1604
|
+
},
|
|
1605
|
+
set: function set$$1(bool) {
|
|
1606
|
+
if (SUPPORTS_LOCAL_STORAGE) {
|
|
1607
|
+
useLocalStorage = bool;
|
|
1608
|
+
if (bool) dom.bind(window, "unload", saveToLocalStorage);
|
|
1609
|
+
else dom.unbind(window, "unload", saveToLocalStorage);
|
|
1610
|
+
localStorage.setItem(getLocalStorageHash(_this, "isLocal"), bool);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
if (Common.isUndefined(params.parent)) {
|
|
1616
|
+
this.closed = params.closed || false;
|
|
1617
|
+
dom.addClass(this.domElement, GUI.CLASS_MAIN);
|
|
1618
|
+
dom.makeSelectable(this.domElement, false);
|
|
1619
|
+
if (SUPPORTS_LOCAL_STORAGE) {
|
|
1620
|
+
if (useLocalStorage) {
|
|
1621
|
+
_this.useLocalStorage = true;
|
|
1622
|
+
var savedGui = localStorage.getItem(getLocalStorageHash(this, "gui"));
|
|
1623
|
+
if (savedGui) params.load = JSON.parse(savedGui);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
this.__closeButton = document.createElement("div");
|
|
1627
|
+
this.__closeButton.innerHTML = GUI.TEXT_CLOSED;
|
|
1628
|
+
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BUTTON);
|
|
1629
|
+
if (params.closeOnTop) {
|
|
1630
|
+
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_TOP);
|
|
1631
|
+
this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0]);
|
|
1632
|
+
} else {
|
|
1633
|
+
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BOTTOM);
|
|
1634
|
+
this.domElement.appendChild(this.__closeButton);
|
|
1635
|
+
}
|
|
1636
|
+
dom.bind(this.__closeButton, "click", function() {
|
|
1637
|
+
_this.closed = !_this.closed;
|
|
1638
|
+
});
|
|
1639
|
+
} else {
|
|
1640
|
+
if (params.closed === void 0) params.closed = true;
|
|
1641
|
+
var titleRowName = document.createTextNode(params.name);
|
|
1642
|
+
dom.addClass(titleRowName, "controller-name");
|
|
1643
|
+
titleRow = addRow(_this, titleRowName);
|
|
1644
|
+
var onClickTitle = function onClickTitle(e) {
|
|
1645
|
+
e.preventDefault();
|
|
1646
|
+
_this.closed = !_this.closed;
|
|
1647
|
+
return false;
|
|
1648
|
+
};
|
|
1649
|
+
dom.addClass(this.__ul, GUI.CLASS_CLOSED);
|
|
1650
|
+
dom.addClass(titleRow, "title");
|
|
1651
|
+
dom.bind(titleRow, "click", onClickTitle);
|
|
1652
|
+
if (!params.closed) this.closed = false;
|
|
1653
|
+
}
|
|
1654
|
+
if (params.autoPlace) {
|
|
1655
|
+
if (Common.isUndefined(params.parent)) {
|
|
1656
|
+
if (autoPlaceVirgin) {
|
|
1657
|
+
autoPlaceContainer = document.createElement("div");
|
|
1658
|
+
dom.addClass(autoPlaceContainer, CSS_NAMESPACE);
|
|
1659
|
+
dom.addClass(autoPlaceContainer, GUI.CLASS_AUTO_PLACE_CONTAINER);
|
|
1660
|
+
document.body.appendChild(autoPlaceContainer);
|
|
1661
|
+
autoPlaceVirgin = false;
|
|
1662
|
+
}
|
|
1663
|
+
autoPlaceContainer.appendChild(this.domElement);
|
|
1664
|
+
dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE);
|
|
1665
|
+
}
|
|
1666
|
+
if (!this.parent) setWidth(_this, params.width);
|
|
1667
|
+
}
|
|
1668
|
+
this.__resizeHandler = function() {
|
|
1669
|
+
_this.onResizeDebounced();
|
|
1670
|
+
};
|
|
1671
|
+
dom.bind(window, "resize", this.__resizeHandler);
|
|
1672
|
+
dom.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler);
|
|
1673
|
+
dom.bind(this.__ul, "transitionend", this.__resizeHandler);
|
|
1674
|
+
dom.bind(this.__ul, "oTransitionEnd", this.__resizeHandler);
|
|
1675
|
+
this.onResize();
|
|
1676
|
+
if (params.resizable) addResizeHandle(this);
|
|
1677
|
+
saveToLocalStorage = function saveToLocalStorage() {
|
|
1678
|
+
if (SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(_this, "isLocal")) === "true") localStorage.setItem(getLocalStorageHash(_this, "gui"), JSON.stringify(_this.getSaveObject()));
|
|
1679
|
+
};
|
|
1680
|
+
this.saveToLocalStorageIfPossible = saveToLocalStorage;
|
|
1681
|
+
function resetWidth() {
|
|
1682
|
+
var root = _this.getRoot();
|
|
1683
|
+
root.width += 1;
|
|
1684
|
+
Common.defer(function() {
|
|
1685
|
+
root.width -= 1;
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
if (!params.parent) resetWidth();
|
|
1689
|
+
};
|
|
1690
|
+
GUI.toggleHide = function() {
|
|
1691
|
+
hide = !hide;
|
|
1692
|
+
Common.each(hideableGuis, function(gui) {
|
|
1693
|
+
gui.domElement.style.display = hide ? "none" : "";
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1696
|
+
GUI.CLASS_AUTO_PLACE = "a";
|
|
1697
|
+
GUI.CLASS_AUTO_PLACE_CONTAINER = "ac";
|
|
1698
|
+
GUI.CLASS_MAIN = "main";
|
|
1699
|
+
GUI.CLASS_CONTROLLER_ROW = "cr";
|
|
1700
|
+
GUI.CLASS_TOO_TALL = "taller-than-window";
|
|
1701
|
+
GUI.CLASS_CLOSED = "closed";
|
|
1702
|
+
GUI.CLASS_CLOSE_BUTTON = "close-button";
|
|
1703
|
+
GUI.CLASS_CLOSE_TOP = "close-top";
|
|
1704
|
+
GUI.CLASS_CLOSE_BOTTOM = "close-bottom";
|
|
1705
|
+
GUI.CLASS_DRAG = "drag";
|
|
1706
|
+
GUI.DEFAULT_WIDTH = 245;
|
|
1707
|
+
GUI.TEXT_CLOSED = "Close Controls";
|
|
1708
|
+
GUI.TEXT_OPEN = "Open Controls";
|
|
1709
|
+
GUI._keydownHandler = function(e) {
|
|
1710
|
+
if (document.activeElement.type !== "text" && (e.which === HIDE_KEY_CODE || e.keyCode === HIDE_KEY_CODE)) GUI.toggleHide();
|
|
1711
|
+
};
|
|
1712
|
+
dom.bind(window, "keydown", GUI._keydownHandler, false);
|
|
1713
|
+
Common.extend(GUI.prototype, {
|
|
1714
|
+
add: function add(object, property) {
|
|
1715
|
+
return _add(this, object, property, { factoryArgs: Array.prototype.slice.call(arguments, 2) });
|
|
1716
|
+
},
|
|
1717
|
+
addColor: function addColor(object, property) {
|
|
1718
|
+
return _add(this, object, property, { color: true });
|
|
1719
|
+
},
|
|
1720
|
+
remove: function remove(controller) {
|
|
1721
|
+
this.__ul.removeChild(controller.__li);
|
|
1722
|
+
this.__controllers.splice(this.__controllers.indexOf(controller), 1);
|
|
1723
|
+
var _this = this;
|
|
1724
|
+
Common.defer(function() {
|
|
1725
|
+
_this.onResize();
|
|
1726
|
+
});
|
|
1727
|
+
},
|
|
1728
|
+
destroy: function destroy() {
|
|
1729
|
+
if (this.parent) throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");
|
|
1730
|
+
if (this.autoPlace) autoPlaceContainer.removeChild(this.domElement);
|
|
1731
|
+
var _this = this;
|
|
1732
|
+
Common.each(this.__folders, function(subfolder) {
|
|
1733
|
+
_this.removeFolder(subfolder);
|
|
1734
|
+
});
|
|
1735
|
+
dom.unbind(window, "keydown", GUI._keydownHandler, false);
|
|
1736
|
+
removeListeners(this);
|
|
1737
|
+
},
|
|
1738
|
+
addFolder: function addFolder(name) {
|
|
1739
|
+
if (this.__folders[name] !== void 0) throw new Error("You already have a folder in this GUI by the name \"" + name + "\"");
|
|
1740
|
+
var newGuiParams = {
|
|
1741
|
+
name,
|
|
1742
|
+
parent: this
|
|
1743
|
+
};
|
|
1744
|
+
newGuiParams.autoPlace = this.autoPlace;
|
|
1745
|
+
if (this.load && this.load.folders && this.load.folders[name]) {
|
|
1746
|
+
newGuiParams.closed = this.load.folders[name].closed;
|
|
1747
|
+
newGuiParams.load = this.load.folders[name];
|
|
1748
|
+
}
|
|
1749
|
+
var gui = new GUI(newGuiParams);
|
|
1750
|
+
this.__folders[name] = gui;
|
|
1751
|
+
var li = addRow(this, gui.domElement);
|
|
1752
|
+
dom.addClass(li, "folder");
|
|
1753
|
+
return gui;
|
|
1754
|
+
},
|
|
1755
|
+
removeFolder: function removeFolder(folder) {
|
|
1756
|
+
this.__ul.removeChild(folder.domElement.parentElement);
|
|
1757
|
+
delete this.__folders[folder.name];
|
|
1758
|
+
if (this.load && this.load.folders && this.load.folders[folder.name]) delete this.load.folders[folder.name];
|
|
1759
|
+
removeListeners(folder);
|
|
1760
|
+
var _this = this;
|
|
1761
|
+
Common.each(folder.__folders, function(subfolder) {
|
|
1762
|
+
folder.removeFolder(subfolder);
|
|
1763
|
+
});
|
|
1764
|
+
Common.defer(function() {
|
|
1765
|
+
_this.onResize();
|
|
1766
|
+
});
|
|
1767
|
+
},
|
|
1768
|
+
open: function open() {
|
|
1769
|
+
this.closed = false;
|
|
1770
|
+
},
|
|
1771
|
+
close: function close() {
|
|
1772
|
+
this.closed = true;
|
|
1773
|
+
},
|
|
1774
|
+
hide: function hide() {
|
|
1775
|
+
this.domElement.style.display = "none";
|
|
1776
|
+
},
|
|
1777
|
+
show: function show() {
|
|
1778
|
+
this.domElement.style.display = "";
|
|
1779
|
+
},
|
|
1780
|
+
onResize: function onResize() {
|
|
1781
|
+
var root = this.getRoot();
|
|
1782
|
+
if (root.scrollable) {
|
|
1783
|
+
var top = dom.getOffset(root.__ul).top;
|
|
1784
|
+
var h = 0;
|
|
1785
|
+
Common.each(root.__ul.childNodes, function(node) {
|
|
1786
|
+
if (!(root.autoPlace && node === root.__save_row)) h += dom.getHeight(node);
|
|
1787
|
+
});
|
|
1788
|
+
if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) {
|
|
1789
|
+
dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
|
|
1790
|
+
root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + "px";
|
|
1791
|
+
} else {
|
|
1792
|
+
dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
|
|
1793
|
+
root.__ul.style.height = "auto";
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
if (root.__resize_handle) Common.defer(function() {
|
|
1797
|
+
root.__resize_handle.style.height = root.__ul.offsetHeight + "px";
|
|
1798
|
+
});
|
|
1799
|
+
if (root.__closeButton) root.__closeButton.style.width = root.width + "px";
|
|
1800
|
+
},
|
|
1801
|
+
onResizeDebounced: Common.debounce(function() {
|
|
1802
|
+
this.onResize();
|
|
1803
|
+
}, 50),
|
|
1804
|
+
remember: function remember() {
|
|
1805
|
+
if (Common.isUndefined(SAVE_DIALOGUE)) {
|
|
1806
|
+
SAVE_DIALOGUE = new CenteredDiv();
|
|
1807
|
+
SAVE_DIALOGUE.domElement.innerHTML = saveDialogContents;
|
|
1808
|
+
}
|
|
1809
|
+
if (this.parent) throw new Error("You can only call remember on a top level GUI.");
|
|
1810
|
+
var _this = this;
|
|
1811
|
+
Common.each(Array.prototype.slice.call(arguments), function(object) {
|
|
1812
|
+
if (_this.__rememberedObjects.length === 0) addSaveMenu(_this);
|
|
1813
|
+
if (_this.__rememberedObjects.indexOf(object) === -1) _this.__rememberedObjects.push(object);
|
|
1814
|
+
});
|
|
1815
|
+
if (this.autoPlace) setWidth(this, this.width);
|
|
1816
|
+
},
|
|
1817
|
+
getRoot: function getRoot() {
|
|
1818
|
+
var gui = this;
|
|
1819
|
+
while (gui.parent) gui = gui.parent;
|
|
1820
|
+
return gui;
|
|
1821
|
+
},
|
|
1822
|
+
getSaveObject: function getSaveObject() {
|
|
1823
|
+
var toReturn = this.load;
|
|
1824
|
+
toReturn.closed = this.closed;
|
|
1825
|
+
if (this.__rememberedObjects.length > 0) {
|
|
1826
|
+
toReturn.preset = this.preset;
|
|
1827
|
+
if (!toReturn.remembered) toReturn.remembered = {};
|
|
1828
|
+
toReturn.remembered[this.preset] = getCurrentPreset(this);
|
|
1829
|
+
}
|
|
1830
|
+
toReturn.folders = {};
|
|
1831
|
+
Common.each(this.__folders, function(element, key) {
|
|
1832
|
+
toReturn.folders[key] = element.getSaveObject();
|
|
1833
|
+
});
|
|
1834
|
+
return toReturn;
|
|
1835
|
+
},
|
|
1836
|
+
save: function save() {
|
|
1837
|
+
if (!this.load.remembered) this.load.remembered = {};
|
|
1838
|
+
this.load.remembered[this.preset] = getCurrentPreset(this);
|
|
1839
|
+
markPresetModified(this, false);
|
|
1840
|
+
this.saveToLocalStorageIfPossible();
|
|
1841
|
+
},
|
|
1842
|
+
saveAs: function saveAs(presetName) {
|
|
1843
|
+
if (!this.load.remembered) {
|
|
1844
|
+
this.load.remembered = {};
|
|
1845
|
+
this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME] = getCurrentPreset(this, true);
|
|
1846
|
+
}
|
|
1847
|
+
this.load.remembered[presetName] = getCurrentPreset(this);
|
|
1848
|
+
this.preset = presetName;
|
|
1849
|
+
addPresetOption(this, presetName, true);
|
|
1850
|
+
this.saveToLocalStorageIfPossible();
|
|
1851
|
+
},
|
|
1852
|
+
revert: function revert(gui) {
|
|
1853
|
+
Common.each(this.__controllers, function(controller) {
|
|
1854
|
+
if (!this.getRoot().load.remembered) controller.setValue(controller.initialValue);
|
|
1855
|
+
else recallSavedValue(gui || this.getRoot(), controller);
|
|
1856
|
+
if (controller.__onFinishChange) controller.__onFinishChange.call(controller, controller.getValue());
|
|
1857
|
+
}, this);
|
|
1858
|
+
Common.each(this.__folders, function(folder) {
|
|
1859
|
+
folder.revert(folder);
|
|
1860
|
+
});
|
|
1861
|
+
if (!gui) markPresetModified(this.getRoot(), false);
|
|
1862
|
+
},
|
|
1863
|
+
listen: function listen(controller) {
|
|
1864
|
+
var init = this.__listening.length === 0;
|
|
1865
|
+
this.__listening.push(controller);
|
|
1866
|
+
if (init) updateDisplays(this.__listening);
|
|
1867
|
+
},
|
|
1868
|
+
updateDisplay: function updateDisplay() {
|
|
1869
|
+
Common.each(this.__controllers, function(controller) {
|
|
1870
|
+
controller.updateDisplay();
|
|
1871
|
+
});
|
|
1872
|
+
Common.each(this.__folders, function(folder) {
|
|
1873
|
+
folder.updateDisplay();
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
function addRow(gui, newDom, liBefore) {
|
|
1878
|
+
var li = document.createElement("li");
|
|
1879
|
+
if (newDom) li.appendChild(newDom);
|
|
1880
|
+
if (liBefore) gui.__ul.insertBefore(li, liBefore);
|
|
1881
|
+
else gui.__ul.appendChild(li);
|
|
1882
|
+
gui.onResize();
|
|
1883
|
+
return li;
|
|
1884
|
+
}
|
|
1885
|
+
function removeListeners(gui) {
|
|
1886
|
+
dom.unbind(window, "resize", gui.__resizeHandler);
|
|
1887
|
+
if (gui.saveToLocalStorageIfPossible) dom.unbind(window, "unload", gui.saveToLocalStorageIfPossible);
|
|
1888
|
+
}
|
|
1889
|
+
function markPresetModified(gui, modified) {
|
|
1890
|
+
var opt = gui.__preset_select[gui.__preset_select.selectedIndex];
|
|
1891
|
+
if (modified) opt.innerHTML = opt.value + "*";
|
|
1892
|
+
else opt.innerHTML = opt.value;
|
|
1893
|
+
}
|
|
1894
|
+
function augmentController(gui, li, controller) {
|
|
1895
|
+
controller.__li = li;
|
|
1896
|
+
controller.__gui = gui;
|
|
1897
|
+
Common.extend(controller, {
|
|
1898
|
+
options: function options(_options) {
|
|
1899
|
+
if (arguments.length > 1) {
|
|
1900
|
+
var nextSibling = controller.__li.nextElementSibling;
|
|
1901
|
+
controller.remove();
|
|
1902
|
+
return _add(gui, controller.object, controller.property, {
|
|
1903
|
+
before: nextSibling,
|
|
1904
|
+
factoryArgs: [Common.toArray(arguments)]
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
if (Common.isArray(_options) || Common.isObject(_options)) {
|
|
1908
|
+
var _nextSibling = controller.__li.nextElementSibling;
|
|
1909
|
+
controller.remove();
|
|
1910
|
+
return _add(gui, controller.object, controller.property, {
|
|
1911
|
+
before: _nextSibling,
|
|
1912
|
+
factoryArgs: [_options]
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
},
|
|
1916
|
+
name: function name(_name) {
|
|
1917
|
+
controller.__li.firstElementChild.firstElementChild.innerHTML = _name;
|
|
1918
|
+
return controller;
|
|
1919
|
+
},
|
|
1920
|
+
listen: function listen() {
|
|
1921
|
+
controller.__gui.listen(controller);
|
|
1922
|
+
return controller;
|
|
1923
|
+
},
|
|
1924
|
+
remove: function remove() {
|
|
1925
|
+
controller.__gui.remove(controller);
|
|
1926
|
+
return controller;
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1929
|
+
if (controller instanceof NumberControllerSlider) {
|
|
1930
|
+
var box = new NumberControllerBox(controller.object, controller.property, {
|
|
1931
|
+
min: controller.__min,
|
|
1932
|
+
max: controller.__max,
|
|
1933
|
+
step: controller.__step
|
|
1934
|
+
});
|
|
1935
|
+
Common.each([
|
|
1936
|
+
"updateDisplay",
|
|
1937
|
+
"onChange",
|
|
1938
|
+
"onFinishChange",
|
|
1939
|
+
"step",
|
|
1940
|
+
"min",
|
|
1941
|
+
"max"
|
|
1942
|
+
], function(method) {
|
|
1943
|
+
var pc = controller[method];
|
|
1944
|
+
var pb = box[method];
|
|
1945
|
+
controller[method] = box[method] = function() {
|
|
1946
|
+
var args = Array.prototype.slice.call(arguments);
|
|
1947
|
+
pb.apply(box, args);
|
|
1948
|
+
return pc.apply(controller, args);
|
|
1949
|
+
};
|
|
1950
|
+
});
|
|
1951
|
+
dom.addClass(li, "has-slider");
|
|
1952
|
+
controller.domElement.insertBefore(box.domElement, controller.domElement.firstElementChild);
|
|
1953
|
+
} else if (controller instanceof NumberControllerBox) {
|
|
1954
|
+
var r = function r(returned) {
|
|
1955
|
+
if (Common.isNumber(controller.__min) && Common.isNumber(controller.__max)) {
|
|
1956
|
+
var oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
|
|
1957
|
+
var wasListening = controller.__gui.__listening.indexOf(controller) > -1;
|
|
1958
|
+
controller.remove();
|
|
1959
|
+
var newController = _add(gui, controller.object, controller.property, {
|
|
1960
|
+
before: controller.__li.nextElementSibling,
|
|
1961
|
+
factoryArgs: [
|
|
1962
|
+
controller.__min,
|
|
1963
|
+
controller.__max,
|
|
1964
|
+
controller.__step
|
|
1965
|
+
]
|
|
1966
|
+
});
|
|
1967
|
+
newController.name(oldName);
|
|
1968
|
+
if (wasListening) newController.listen();
|
|
1969
|
+
return newController;
|
|
1970
|
+
}
|
|
1971
|
+
return returned;
|
|
1972
|
+
};
|
|
1973
|
+
controller.min = Common.compose(r, controller.min);
|
|
1974
|
+
controller.max = Common.compose(r, controller.max);
|
|
1975
|
+
} else if (controller instanceof BooleanController) {
|
|
1976
|
+
dom.bind(li, "click", function() {
|
|
1977
|
+
dom.fakeEvent(controller.__checkbox, "click");
|
|
1978
|
+
});
|
|
1979
|
+
dom.bind(controller.__checkbox, "click", function(e) {
|
|
1980
|
+
e.stopPropagation();
|
|
1981
|
+
});
|
|
1982
|
+
} else if (controller instanceof FunctionController) {
|
|
1983
|
+
dom.bind(li, "click", function() {
|
|
1984
|
+
dom.fakeEvent(controller.__button, "click");
|
|
1985
|
+
});
|
|
1986
|
+
dom.bind(li, "mouseover", function() {
|
|
1987
|
+
dom.addClass(controller.__button, "hover");
|
|
1988
|
+
});
|
|
1989
|
+
dom.bind(li, "mouseout", function() {
|
|
1990
|
+
dom.removeClass(controller.__button, "hover");
|
|
1991
|
+
});
|
|
1992
|
+
} else if (controller instanceof ColorController) {
|
|
1993
|
+
dom.addClass(li, "color");
|
|
1994
|
+
controller.updateDisplay = Common.compose(function(val) {
|
|
1995
|
+
li.style.borderLeftColor = controller.__color.toString();
|
|
1996
|
+
return val;
|
|
1997
|
+
}, controller.updateDisplay);
|
|
1998
|
+
controller.updateDisplay();
|
|
1999
|
+
}
|
|
2000
|
+
controller.setValue = Common.compose(function(val) {
|
|
2001
|
+
if (gui.getRoot().__preset_select && controller.isModified()) markPresetModified(gui.getRoot(), true);
|
|
2002
|
+
return val;
|
|
2003
|
+
}, controller.setValue);
|
|
2004
|
+
}
|
|
2005
|
+
function recallSavedValue(gui, controller) {
|
|
2006
|
+
var root = gui.getRoot();
|
|
2007
|
+
var matchedIndex = root.__rememberedObjects.indexOf(controller.object);
|
|
2008
|
+
if (matchedIndex !== -1) {
|
|
2009
|
+
var controllerMap = root.__rememberedObjectIndecesToControllers[matchedIndex];
|
|
2010
|
+
if (controllerMap === void 0) {
|
|
2011
|
+
controllerMap = {};
|
|
2012
|
+
root.__rememberedObjectIndecesToControllers[matchedIndex] = controllerMap;
|
|
2013
|
+
}
|
|
2014
|
+
controllerMap[controller.property] = controller;
|
|
2015
|
+
if (root.load && root.load.remembered) {
|
|
2016
|
+
var presetMap = root.load.remembered;
|
|
2017
|
+
var preset = void 0;
|
|
2018
|
+
if (presetMap[gui.preset]) preset = presetMap[gui.preset];
|
|
2019
|
+
else if (presetMap[DEFAULT_DEFAULT_PRESET_NAME]) preset = presetMap[DEFAULT_DEFAULT_PRESET_NAME];
|
|
2020
|
+
else return;
|
|
2021
|
+
if (preset[matchedIndex] && preset[matchedIndex][controller.property] !== void 0) {
|
|
2022
|
+
var value = preset[matchedIndex][controller.property];
|
|
2023
|
+
controller.initialValue = value;
|
|
2024
|
+
controller.setValue(value);
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
function _add(gui, object, property, params) {
|
|
2030
|
+
if (object[property] === void 0) throw new Error("Object \"" + object + "\" has no property \"" + property + "\"");
|
|
2031
|
+
var controller = void 0;
|
|
2032
|
+
if (params.color) controller = new ColorController(object, property);
|
|
2033
|
+
else {
|
|
2034
|
+
var factoryArgs = [object, property].concat(params.factoryArgs);
|
|
2035
|
+
controller = ControllerFactory.apply(gui, factoryArgs);
|
|
2036
|
+
}
|
|
2037
|
+
if (params.before instanceof Controller) params.before = params.before.__li;
|
|
2038
|
+
recallSavedValue(gui, controller);
|
|
2039
|
+
dom.addClass(controller.domElement, "c");
|
|
2040
|
+
var name = document.createElement("span");
|
|
2041
|
+
dom.addClass(name, "property-name");
|
|
2042
|
+
name.innerHTML = controller.property;
|
|
2043
|
+
var container = document.createElement("div");
|
|
2044
|
+
container.appendChild(name);
|
|
2045
|
+
container.appendChild(controller.domElement);
|
|
2046
|
+
var li = addRow(gui, container, params.before);
|
|
2047
|
+
dom.addClass(li, GUI.CLASS_CONTROLLER_ROW);
|
|
2048
|
+
if (controller instanceof ColorController) dom.addClass(li, "color");
|
|
2049
|
+
else dom.addClass(li, _typeof(controller.getValue()));
|
|
2050
|
+
augmentController(gui, li, controller);
|
|
2051
|
+
gui.__controllers.push(controller);
|
|
2052
|
+
return controller;
|
|
2053
|
+
}
|
|
2054
|
+
function getLocalStorageHash(gui, key) {
|
|
2055
|
+
return document.location.href + "." + key;
|
|
2056
|
+
}
|
|
2057
|
+
function addPresetOption(gui, name, setSelected) {
|
|
2058
|
+
var opt = document.createElement("option");
|
|
2059
|
+
opt.innerHTML = name;
|
|
2060
|
+
opt.value = name;
|
|
2061
|
+
gui.__preset_select.appendChild(opt);
|
|
2062
|
+
if (setSelected) gui.__preset_select.selectedIndex = gui.__preset_select.length - 1;
|
|
2063
|
+
}
|
|
2064
|
+
function showHideExplain(gui, explain) {
|
|
2065
|
+
explain.style.display = gui.useLocalStorage ? "block" : "none";
|
|
2066
|
+
}
|
|
2067
|
+
function addSaveMenu(gui) {
|
|
2068
|
+
var div = gui.__save_row = document.createElement("li");
|
|
2069
|
+
dom.addClass(gui.domElement, "has-save");
|
|
2070
|
+
gui.__ul.insertBefore(div, gui.__ul.firstChild);
|
|
2071
|
+
dom.addClass(div, "save-row");
|
|
2072
|
+
var gears = document.createElement("span");
|
|
2073
|
+
gears.innerHTML = " ";
|
|
2074
|
+
dom.addClass(gears, "button gears");
|
|
2075
|
+
var button = document.createElement("span");
|
|
2076
|
+
button.innerHTML = "Save";
|
|
2077
|
+
dom.addClass(button, "button");
|
|
2078
|
+
dom.addClass(button, "save");
|
|
2079
|
+
var button2 = document.createElement("span");
|
|
2080
|
+
button2.innerHTML = "New";
|
|
2081
|
+
dom.addClass(button2, "button");
|
|
2082
|
+
dom.addClass(button2, "save-as");
|
|
2083
|
+
var button3 = document.createElement("span");
|
|
2084
|
+
button3.innerHTML = "Revert";
|
|
2085
|
+
dom.addClass(button3, "button");
|
|
2086
|
+
dom.addClass(button3, "revert");
|
|
2087
|
+
var select = gui.__preset_select = document.createElement("select");
|
|
2088
|
+
if (gui.load && gui.load.remembered) Common.each(gui.load.remembered, function(value, key) {
|
|
2089
|
+
addPresetOption(gui, key, key === gui.preset);
|
|
2090
|
+
});
|
|
2091
|
+
else addPresetOption(gui, DEFAULT_DEFAULT_PRESET_NAME, false);
|
|
2092
|
+
dom.bind(select, "change", function() {
|
|
2093
|
+
for (var index = 0; index < gui.__preset_select.length; index++) gui.__preset_select[index].innerHTML = gui.__preset_select[index].value;
|
|
2094
|
+
gui.preset = this.value;
|
|
2095
|
+
});
|
|
2096
|
+
div.appendChild(select);
|
|
2097
|
+
div.appendChild(gears);
|
|
2098
|
+
div.appendChild(button);
|
|
2099
|
+
div.appendChild(button2);
|
|
2100
|
+
div.appendChild(button3);
|
|
2101
|
+
if (SUPPORTS_LOCAL_STORAGE) {
|
|
2102
|
+
var explain = document.getElementById("dg-local-explain");
|
|
2103
|
+
var localStorageCheckBox = document.getElementById("dg-local-storage");
|
|
2104
|
+
var saveLocally = document.getElementById("dg-save-locally");
|
|
2105
|
+
saveLocally.style.display = "block";
|
|
2106
|
+
if (localStorage.getItem(getLocalStorageHash(gui, "isLocal")) === "true") localStorageCheckBox.setAttribute("checked", "checked");
|
|
2107
|
+
showHideExplain(gui, explain);
|
|
2108
|
+
dom.bind(localStorageCheckBox, "change", function() {
|
|
2109
|
+
gui.useLocalStorage = !gui.useLocalStorage;
|
|
2110
|
+
showHideExplain(gui, explain);
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
var newConstructorTextArea = document.getElementById("dg-new-constructor");
|
|
2114
|
+
dom.bind(newConstructorTextArea, "keydown", function(e) {
|
|
2115
|
+
if (e.metaKey && (e.which === 67 || e.keyCode === 67)) SAVE_DIALOGUE.hide();
|
|
2116
|
+
});
|
|
2117
|
+
dom.bind(gears, "click", function() {
|
|
2118
|
+
newConstructorTextArea.innerHTML = JSON.stringify(gui.getSaveObject(), void 0, 2);
|
|
2119
|
+
SAVE_DIALOGUE.show();
|
|
2120
|
+
newConstructorTextArea.focus();
|
|
2121
|
+
newConstructorTextArea.select();
|
|
2122
|
+
});
|
|
2123
|
+
dom.bind(button, "click", function() {
|
|
2124
|
+
gui.save();
|
|
2125
|
+
});
|
|
2126
|
+
dom.bind(button2, "click", function() {
|
|
2127
|
+
var presetName = prompt("Enter a new preset name.");
|
|
2128
|
+
if (presetName) gui.saveAs(presetName);
|
|
2129
|
+
});
|
|
2130
|
+
dom.bind(button3, "click", function() {
|
|
2131
|
+
gui.revert();
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
function addResizeHandle(gui) {
|
|
2135
|
+
var pmouseX = void 0;
|
|
2136
|
+
gui.__resize_handle = document.createElement("div");
|
|
2137
|
+
Common.extend(gui.__resize_handle.style, {
|
|
2138
|
+
width: "6px",
|
|
2139
|
+
marginLeft: "-3px",
|
|
2140
|
+
height: "200px",
|
|
2141
|
+
cursor: "ew-resize",
|
|
2142
|
+
position: "absolute"
|
|
2143
|
+
});
|
|
2144
|
+
function drag(e) {
|
|
2145
|
+
e.preventDefault();
|
|
2146
|
+
gui.width += pmouseX - e.clientX;
|
|
2147
|
+
gui.onResize();
|
|
2148
|
+
pmouseX = e.clientX;
|
|
2149
|
+
return false;
|
|
2150
|
+
}
|
|
2151
|
+
function dragStop() {
|
|
2152
|
+
dom.removeClass(gui.__closeButton, GUI.CLASS_DRAG);
|
|
2153
|
+
dom.unbind(window, "mousemove", drag);
|
|
2154
|
+
dom.unbind(window, "mouseup", dragStop);
|
|
2155
|
+
}
|
|
2156
|
+
function dragStart(e) {
|
|
2157
|
+
e.preventDefault();
|
|
2158
|
+
pmouseX = e.clientX;
|
|
2159
|
+
dom.addClass(gui.__closeButton, GUI.CLASS_DRAG);
|
|
2160
|
+
dom.bind(window, "mousemove", drag);
|
|
2161
|
+
dom.bind(window, "mouseup", dragStop);
|
|
2162
|
+
return false;
|
|
2163
|
+
}
|
|
2164
|
+
dom.bind(gui.__resize_handle, "mousedown", dragStart);
|
|
2165
|
+
dom.bind(gui.__closeButton, "mousedown", dragStart);
|
|
2166
|
+
gui.domElement.insertBefore(gui.__resize_handle, gui.domElement.firstElementChild);
|
|
2167
|
+
}
|
|
2168
|
+
function setWidth(gui, w) {
|
|
2169
|
+
gui.domElement.style.width = w + "px";
|
|
2170
|
+
if (gui.__save_row && gui.autoPlace) gui.__save_row.style.width = w + "px";
|
|
2171
|
+
if (gui.__closeButton) gui.__closeButton.style.width = w + "px";
|
|
2172
|
+
}
|
|
2173
|
+
function getCurrentPreset(gui, useInitialValues) {
|
|
2174
|
+
var toReturn = {};
|
|
2175
|
+
Common.each(gui.__rememberedObjects, function(val, index) {
|
|
2176
|
+
var savedValues = {};
|
|
2177
|
+
var controllerMap = gui.__rememberedObjectIndecesToControllers[index];
|
|
2178
|
+
Common.each(controllerMap, function(controller, property) {
|
|
2179
|
+
savedValues[property] = useInitialValues ? controller.initialValue : controller.getValue();
|
|
2180
|
+
});
|
|
2181
|
+
toReturn[index] = savedValues;
|
|
2182
|
+
});
|
|
2183
|
+
return toReturn;
|
|
2184
|
+
}
|
|
2185
|
+
function setPresetSelectIndex(gui) {
|
|
2186
|
+
for (var index = 0; index < gui.__preset_select.length; index++) if (gui.__preset_select[index].value === gui.preset) gui.__preset_select.selectedIndex = index;
|
|
2187
|
+
}
|
|
2188
|
+
function updateDisplays(controllerArray) {
|
|
2189
|
+
if (controllerArray.length !== 0) requestAnimationFrame$1.call(window, function() {
|
|
2190
|
+
updateDisplays(controllerArray);
|
|
2191
|
+
});
|
|
2192
|
+
Common.each(controllerArray, function(c) {
|
|
2193
|
+
c.updateDisplay();
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
var GUI$1 = GUI;
|
|
2197
|
+
//#endregion
|
|
2198
|
+
exports.GUI = GUI$1;
|