@pareto-engineering/design-system 4.0.0-alpha.5 → 4.0.0-alpha.51
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/cjs/a/AnimatedBlobs/AnimatedBlobs.js +90 -0
- package/dist/cjs/a/AnimatedBlobs/index.js +13 -0
- package/dist/cjs/a/AnimatedBlobs/styles.scss +87 -0
- package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +60 -0
- package/dist/cjs/a/AnimatedGradient/index.js +13 -0
- package/dist/cjs/a/AnimatedGradient/styles.scss +14 -0
- package/dist/cjs/a/AnimatedGradient/webGIRenderer.js +528 -0
- package/dist/cjs/a/AppContext/ContextProvider.js +0 -2
- package/dist/cjs/a/AppContext/useTheme.js +0 -4
- package/dist/cjs/a/BlurOverlay/BlurOverlay.js +59 -0
- package/dist/cjs/a/BlurOverlay/index.js +13 -0
- package/dist/cjs/a/BlurOverlay/styles.scss +31 -0
- package/dist/cjs/a/ContentTree/ContentTree.js +10 -4
- package/dist/cjs/a/ContentTree/common/Tree/Tree.js +12 -5
- package/dist/cjs/a/ContentTree/styles.scss +34 -11
- package/dist/cjs/a/Conversation/Conversation.js +11 -16
- package/dist/cjs/a/Conversation/common/Message/Message.js +15 -12
- package/dist/cjs/a/Conversation/styles.scss +56 -124
- package/dist/cjs/a/DotInfo/DotInfo.js +1 -1
- package/dist/cjs/a/Figure/Figure.js +1 -1
- package/dist/cjs/a/HamburgerButton/HamburgerButton.js +1 -1
- package/dist/cjs/a/IconList/IconList.js +1 -1
- package/dist/cjs/a/IconList/common/Item/Item.js +1 -1
- package/dist/cjs/a/Label/Label.js +13 -5
- package/dist/cjs/a/Label/styles.scss +4 -4
- package/dist/cjs/a/LoadingCircle/LoadingCircle.js +1 -1
- package/dist/cjs/a/MetaCard/MetaCard.js +65 -0
- package/dist/cjs/a/MetaCard/index.js +13 -0
- package/dist/cjs/a/MetaCard/styles.scss +45 -0
- package/dist/cjs/a/People/People.js +1 -1
- package/dist/cjs/a/People/common/Person/Person.js +5 -5
- package/dist/cjs/a/People/styles.scss +10 -4
- package/dist/cjs/a/Popover/Popover.js +3 -3
- package/dist/cjs/a/Popover/styles.scss +1 -1
- package/dist/cjs/a/ProgressBar/ProgressBar.js +1 -1
- package/dist/cjs/a/Quote/Quote.js +1 -1
- package/dist/cjs/a/Removable/Removable.js +72 -0
- package/dist/cjs/a/Removable/index.js +13 -0
- package/dist/cjs/a/Removable/styles.scss +33 -0
- package/dist/cjs/a/SVG/SVG.js +1 -1
- package/dist/cjs/a/SnapScroller/SnapScroller.js +1 -1
- package/dist/cjs/a/SnapScroller/styles.scss +46 -10
- package/dist/cjs/a/Spinner/Spinner.js +1 -1
- package/dist/cjs/a/TextSteps/TextSteps.js +70 -0
- package/dist/cjs/a/TextSteps/index.js +13 -0
- package/dist/cjs/a/TextSteps/styles.scss +29 -0
- package/dist/cjs/a/Timestamp/Timestamp.js +1 -1
- package/dist/cjs/a/Tip/Tip.js +86 -0
- package/dist/cjs/a/Tip/index.js +13 -0
- package/dist/cjs/a/Tip/styles.scss +16 -0
- package/dist/cjs/a/index.js +50 -1
- package/dist/cjs/b/Button/Button.js +22 -9
- package/dist/cjs/b/Button/common/Group/Group.js +57 -0
- package/dist/cjs/b/Button/common/Group/index.js +13 -0
- package/dist/cjs/b/Button/common/Group/styles.scss +11 -0
- package/dist/cjs/b/Button/common/index.js +12 -0
- package/dist/cjs/b/Button/styles.scss +41 -11
- package/dist/cjs/b/Card/Card.js +74 -0
- package/dist/cjs/b/Card/common/Group/Group.js +73 -0
- package/dist/cjs/b/Card/common/Group/index.js +13 -0
- package/dist/cjs/b/Card/common/Group/styles.scss +35 -0
- package/dist/cjs/b/Card/common/Section/Section.js +59 -0
- package/dist/cjs/b/Card/common/Section/index.js +13 -0
- package/dist/cjs/b/Card/common/index.js +19 -0
- package/dist/cjs/b/Card/index.js +13 -0
- package/dist/cjs/b/Card/styles.scss +57 -0
- package/dist/cjs/b/Logo/Logo.js +1 -1
- package/dist/cjs/b/Page/Page.js +15 -5
- package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +12 -2
- package/dist/cjs/b/Page/common/Section/Section.js +13 -3
- package/dist/cjs/b/Page/styles.scss +25 -4
- package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +6 -2
- package/dist/cjs/b/SocialMediaButton/styles.scss +0 -14
- package/dist/cjs/b/ThemeSelector/ThemeSelector.js +17 -27
- package/dist/cjs/b/ThemeSelector/styles.scss +44 -6
- package/dist/cjs/b/Title/Title.js +1 -2
- package/dist/cjs/b/index.js +8 -1
- package/dist/cjs/c/ContentSlides/ContentSlides.js +1 -1
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +1 -3
- package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +0 -2
- package/dist/cjs/c/ContentSlides/styles.scss +2 -2
- package/dist/cjs/c/Modal/Modal.js +2 -2
- package/dist/cjs/c/Modal/common/ModalHeader/ModalHeader.js +1 -1
- package/dist/cjs/c/Modal/styles.scss +7 -12
- package/dist/cjs/c/Shortener/Shortener.js +1 -1
- package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +1 -1
- package/dist/cjs/f/FormInput/FormInput.js +13 -3
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Description/Description.js +6 -5
- package/dist/cjs/f/common/InputWrapper/InputWrapper.js +74 -0
- package/dist/cjs/f/common/InputWrapper/index.js +13 -0
- package/dist/cjs/f/common/InputWrapper/styles.scss +13 -0
- package/dist/cjs/f/common/Label/Label.js +19 -5
- package/dist/cjs/f/common/Label/styles.scss +8 -2
- package/dist/cjs/f/common/index.js +8 -1
- package/dist/cjs/f/fields/Checkbox/Checkbox.js +41 -11
- package/dist/cjs/f/fields/Checkbox/styles.scss +7 -8
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +56 -25
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +2 -2
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +52 -43
- package/dist/cjs/f/fields/EditorInput/EditorInput.js +222 -0
- package/dist/cjs/f/fields/EditorInput/common/Toolbar.js +257 -0
- package/dist/cjs/f/fields/EditorInput/common/TreeViewPlugin.js +19 -0
- package/dist/cjs/f/fields/EditorInput/common/index.js +20 -0
- package/dist/cjs/f/fields/EditorInput/index.js +13 -0
- package/dist/cjs/f/fields/EditorInput/styles.scss +147 -0
- package/dist/cjs/f/fields/LinkInput/LinkInput.js +164 -0
- package/dist/cjs/f/fields/LinkInput/index.js +13 -0
- package/dist/cjs/f/fields/LinkInput/styles.scss +89 -0
- package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +27 -3
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +36 -6
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +44 -17
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +1 -1
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +36 -26
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +64 -30
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +42 -20
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +5 -5
- package/dist/cjs/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +46 -16
- package/dist/cjs/f/fields/SelectInput/styles.scss +60 -26
- package/dist/cjs/f/fields/TextInput/TextInput.js +51 -18
- package/dist/cjs/f/fields/TextInput/styles.scss +56 -20
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +44 -23
- package/dist/cjs/f/fields/TextareaInput/styles.scss +42 -25
- package/dist/cjs/f/fields/index.js +15 -1
- package/dist/cjs/form.scss +1 -1
- package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +1 -1
- package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +1 -1
- package/dist/cjs/test/QueryLoader/QueryLoader.js +2 -0
- package/dist/es/a/AnimatedBlobs/AnimatedBlobs.js +82 -0
- package/dist/es/a/AnimatedBlobs/index.js +1 -0
- package/dist/es/a/AnimatedBlobs/styles.scss +87 -0
- package/dist/es/a/AnimatedGradient/AnimatedGradient.js +52 -0
- package/dist/es/a/AnimatedGradient/index.js +1 -0
- package/dist/es/a/AnimatedGradient/styles.scss +14 -0
- package/dist/es/a/AnimatedGradient/webGIRenderer.js +492 -0
- package/dist/es/a/AppContext/useTheme.js +0 -4
- package/dist/es/a/BlurOverlay/BlurOverlay.js +51 -0
- package/dist/es/a/BlurOverlay/index.js +2 -0
- package/dist/es/a/BlurOverlay/styles.scss +31 -0
- package/dist/es/a/ContentTree/ContentTree.js +9 -3
- package/dist/es/a/ContentTree/common/Tree/Tree.js +12 -5
- package/dist/es/a/ContentTree/styles.scss +34 -11
- package/dist/es/a/Conversation/Conversation.js +10 -15
- package/dist/es/a/Conversation/common/Message/Message.js +15 -12
- package/dist/es/a/Conversation/styles.scss +56 -124
- package/dist/es/a/Label/Label.js +12 -4
- package/dist/es/a/Label/styles.scss +4 -4
- package/dist/es/a/MetaCard/MetaCard.js +57 -0
- package/dist/es/a/MetaCard/index.js +1 -0
- package/dist/es/a/MetaCard/styles.scss +45 -0
- package/dist/es/a/People/common/Person/Person.js +5 -5
- package/dist/es/a/People/styles.scss +10 -4
- package/dist/es/a/Popover/Popover.js +2 -2
- package/dist/es/a/Popover/styles.scss +1 -1
- package/dist/es/a/Removable/Removable.js +64 -0
- package/dist/es/a/Removable/index.js +2 -0
- package/dist/es/a/Removable/styles.scss +33 -0
- package/dist/es/a/SnapScroller/styles.scss +46 -10
- package/dist/es/a/TextSteps/TextSteps.js +61 -0
- package/dist/es/a/TextSteps/index.js +1 -0
- package/dist/es/a/TextSteps/styles.scss +29 -0
- package/dist/es/a/Tip/Tip.js +78 -0
- package/dist/es/a/Tip/index.js +2 -0
- package/dist/es/a/Tip/styles.scss +16 -0
- package/dist/es/a/index.js +8 -1
- package/dist/es/b/Button/Button.js +22 -8
- package/dist/es/b/Button/common/Group/Group.js +49 -0
- package/dist/es/b/Button/common/Group/index.js +1 -0
- package/dist/es/b/Button/common/Group/styles.scss +11 -0
- package/dist/es/b/Button/common/index.js +1 -0
- package/dist/es/b/Button/styles.scss +41 -11
- package/dist/es/b/Card/Card.js +66 -0
- package/dist/es/b/Card/common/Group/Group.js +65 -0
- package/dist/es/b/Card/common/Group/index.js +1 -0
- package/dist/es/b/Card/common/Group/styles.scss +35 -0
- package/dist/es/b/Card/common/Section/Section.js +48 -0
- package/dist/es/b/Card/common/Section/index.js +1 -0
- package/dist/es/b/Card/common/index.js +2 -0
- package/dist/es/b/Card/index.js +1 -0
- package/dist/es/b/Card/styles.scss +57 -0
- package/dist/es/b/Page/Page.js +14 -3
- package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +12 -2
- package/dist/es/b/Page/common/Section/Section.js +12 -2
- package/dist/es/b/Page/styles.scss +25 -4
- package/dist/es/b/SocialMediaButton/SocialMediaButton.js +5 -1
- package/dist/es/b/SocialMediaButton/styles.scss +0 -14
- package/dist/es/b/ThemeSelector/ThemeSelector.js +16 -27
- package/dist/es/b/ThemeSelector/styles.scss +44 -6
- package/dist/es/b/index.js +2 -1
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +1 -1
- package/dist/es/c/ContentSlides/styles.scss +2 -2
- package/dist/es/c/Modal/Modal.js +1 -1
- package/dist/es/c/Modal/common/ModalHeader/ModalHeader.js +1 -1
- package/dist/es/c/Modal/styles.scss +7 -12
- package/dist/es/f/FormInput/FormInput.js +13 -1
- package/dist/es/f/common/Description/Description.js +5 -4
- package/dist/es/f/common/InputWrapper/InputWrapper.js +66 -0
- package/dist/es/f/common/InputWrapper/index.js +2 -0
- package/dist/es/f/common/InputWrapper/styles.scss +13 -0
- package/dist/es/f/common/Label/Label.js +18 -4
- package/dist/es/f/common/Label/styles.scss +8 -2
- package/dist/es/f/common/index.js +2 -1
- package/dist/es/f/fields/Checkbox/Checkbox.js +41 -11
- package/dist/es/f/fields/Checkbox/styles.scss +7 -8
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +56 -25
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +52 -43
- package/dist/es/f/fields/EditorInput/EditorInput.js +217 -0
- package/dist/es/f/fields/EditorInput/common/Toolbar.js +246 -0
- package/dist/es/f/fields/EditorInput/common/TreeViewPlugin.js +11 -0
- package/dist/es/f/fields/EditorInput/common/index.js +2 -0
- package/dist/es/f/fields/EditorInput/index.js +2 -0
- package/dist/es/f/fields/EditorInput/styles.scss +147 -0
- package/dist/es/f/fields/LinkInput/LinkInput.js +156 -0
- package/dist/es/f/fields/LinkInput/index.js +2 -0
- package/dist/es/f/fields/LinkInput/styles.scss +89 -0
- package/dist/es/f/fields/QueryChoices/QueryChoices.js +26 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +35 -5
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +43 -16
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +35 -25
- package/dist/es/f/fields/QueryCombobox/styles.scss +64 -30
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +42 -20
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +4 -4
- package/dist/es/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/es/f/fields/SelectInput/SelectInput.js +46 -16
- package/dist/es/f/fields/SelectInput/styles.scss +60 -26
- package/dist/es/f/fields/TextInput/TextInput.js +51 -18
- package/dist/es/f/fields/TextInput/styles.scss +56 -20
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +44 -23
- package/dist/es/f/fields/TextareaInput/styles.scss +42 -25
- package/dist/es/f/fields/index.js +3 -1
- package/dist/es/form.scss +1 -1
- package/package.json +18 -15
- package/src/stories/a/AppContext.stories.jsx +4 -2
- package/src/stories/a/BlurOverlay.stories.jsx +39 -0
- package/src/stories/a/Conversation.stories.jsx +11 -42
- package/src/stories/a/MetaCard.stories.jsx +35 -0
- package/src/stories/a/People.stories.jsx +22 -2
- package/src/stories/a/Quote.stories.jsx +1 -1
- package/src/stories/a/Removable.stories.jsx +22 -0
- package/src/stories/a/SnapScroller.stories.jsx +2 -2
- package/src/stories/a/Spinner.stories.jsx +1 -1
- package/src/stories/a/TextSteps.stories.jsx +19 -0
- package/src/stories/a/Tip.stories.jsx +29 -0
- package/src/stories/b/{Button.stories.jsx → Button/Button.stories.jsx} +18 -0
- package/src/stories/b/Button/Group.stories.jsx +35 -0
- package/src/stories/b/Card/Card.stories.jsx +59 -0
- package/src/stories/b/Card/Group.stories.jsx +59 -0
- package/src/stories/b/Page.stories.jsx +19 -3
- package/src/stories/b/SocialMediaButton.stories.jsx +4 -2
- package/src/stories/b/ThemeSelector.stories.jsx +1 -5
- package/src/stories/b/Title.stories.jsx +1 -1
- package/src/stories/c/ContentSlides.stories.jsx +1 -1
- package/src/stories/colors.js +22 -28
- package/src/stories/f/Checkbox.stories.jsx +22 -7
- package/src/stories/f/ChoicesInput.stories.jsx +21 -7
- package/src/stories/f/EditorInput.stories.jsx +88 -0
- package/src/stories/f/LinkInput.stories.jsx +100 -0
- package/src/stories/f/QueryChoices.stories.jsx +20 -4
- package/src/stories/f/QueryCombobox.stories.jsx +25 -13
- package/src/stories/f/QuerySelect.stories.jsx +20 -5
- package/src/stories/f/RatingsInput.stories.jsx +16 -2
- package/src/stories/f/SelectInput.stories.jsx +27 -5
- package/src/stories/f/TextInput.stories.jsx +33 -12
- package/src/stories/f/TextareaInput.stories.jsx +16 -2
- package/src/ui/a/AnimatedBlobs/AnimatedBlobs.jsx +102 -0
- package/src/ui/a/AnimatedBlobs/index.js +1 -0
- package/src/ui/a/AnimatedBlobs/styles.scss +87 -0
- package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +73 -0
- package/src/ui/a/AnimatedGradient/index.js +1 -0
- package/src/ui/a/AnimatedGradient/styles.scss +14 -0
- package/src/ui/a/AnimatedGradient/webGIRenderer.js +541 -0
- package/src/ui/a/AppContext/useTheme.js +0 -4
- package/src/ui/a/BlurOverlay/BlurOverlay.jsx +75 -0
- package/src/ui/a/BlurOverlay/index.js +2 -0
- package/src/ui/a/BlurOverlay/styles.scss +31 -0
- package/src/ui/a/ContentTree/ContentTree.jsx +8 -4
- package/src/ui/a/ContentTree/common/Tree/Tree.jsx +19 -7
- package/src/ui/a/ContentTree/styles.scss +34 -11
- package/src/ui/a/Conversation/Conversation.jsx +14 -18
- package/src/ui/a/Conversation/common/Message/Message.jsx +18 -11
- package/src/ui/a/Conversation/styles.scss +56 -124
- package/src/ui/a/Label/Label.jsx +11 -2
- package/src/ui/a/Label/styles.scss +4 -4
- package/src/ui/a/MetaCard/MetaCard.jsx +81 -0
- package/src/ui/a/MetaCard/index.js +1 -0
- package/src/ui/a/MetaCard/styles.scss +45 -0
- package/src/ui/a/People/common/Person/Person.jsx +5 -5
- package/src/ui/a/People/styles.scss +10 -4
- package/src/ui/a/Popover/Popover.jsx +2 -2
- package/src/ui/a/Popover/styles.scss +1 -1
- package/src/ui/a/Removable/Removable.jsx +85 -0
- package/src/ui/a/Removable/index.js +2 -0
- package/src/ui/a/Removable/styles.scss +33 -0
- package/src/ui/a/SnapScroller/styles.scss +46 -10
- package/src/ui/a/TextSteps/TextSteps.jsx +87 -0
- package/src/ui/a/TextSteps/index.js +1 -0
- package/src/ui/a/TextSteps/styles.scss +29 -0
- package/src/ui/a/Tip/Tip.jsx +105 -0
- package/src/ui/a/Tip/index.js +2 -0
- package/src/ui/a/Tip/styles.scss +16 -0
- package/src/ui/a/index.js +7 -0
- package/src/ui/b/Button/Button.jsx +28 -8
- package/src/ui/b/Button/common/Group/Group.jsx +71 -0
- package/src/ui/b/Button/common/Group/index.js +1 -0
- package/src/ui/b/Button/common/Group/styles.scss +11 -0
- package/src/ui/b/Button/common/index.js +1 -0
- package/src/ui/b/Button/styles.scss +41 -11
- package/src/ui/b/Card/Card.jsx +94 -0
- package/src/ui/b/Card/common/Group/Group.jsx +91 -0
- package/src/ui/b/Card/common/Group/index.js +1 -0
- package/src/ui/b/Card/common/Group/styles.scss +35 -0
- package/src/ui/b/Card/common/Section/Section.jsx +70 -0
- package/src/ui/b/Card/common/Section/index.js +1 -0
- package/src/ui/b/Card/common/index.js +2 -0
- package/src/ui/b/Card/index.js +1 -0
- package/src/ui/b/Card/styles.scss +57 -0
- package/src/ui/b/Page/Page.jsx +11 -1
- package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +14 -3
- package/src/ui/b/Page/common/Section/Section.jsx +16 -1
- package/src/ui/b/Page/styles.scss +25 -4
- package/src/ui/b/SocialMediaButton/SocialMediaButton.jsx +5 -1
- package/src/ui/b/SocialMediaButton/styles.scss +0 -14
- package/src/ui/b/ThemeSelector/ThemeSelector.jsx +16 -29
- package/src/ui/b/ThemeSelector/styles.scss +44 -6
- package/src/ui/b/index.js +1 -0
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +1 -1
- package/src/ui/c/ContentSlides/styles.scss +2 -2
- package/src/ui/c/Modal/Modal.jsx +1 -1
- package/src/ui/c/Modal/common/ModalHeader/ModalHeader.jsx +1 -1
- package/src/ui/c/Modal/styles.scss +7 -12
- package/src/ui/f/FormInput/FormInput.jsx +23 -0
- package/src/ui/f/common/Description/Description.jsx +5 -4
- package/src/ui/f/common/InputWrapper/InputWrapper.jsx +89 -0
- package/src/ui/f/common/InputWrapper/index.js +2 -0
- package/src/ui/f/common/InputWrapper/styles.scss +13 -0
- package/src/ui/f/common/Label/Label.jsx +18 -2
- package/src/ui/f/common/Label/styles.scss +8 -2
- package/src/ui/f/common/index.js +1 -0
- package/src/ui/f/fields/Checkbox/Checkbox.jsx +65 -27
- package/src/ui/f/fields/Checkbox/styles.scss +7 -8
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +83 -48
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +10 -3
- package/src/ui/f/fields/ChoicesInput/styles.scss +52 -43
- package/src/ui/f/fields/EditorInput/EditorInput.jsx +272 -0
- package/src/ui/f/fields/EditorInput/common/Toolbar.jsx +356 -0
- package/src/ui/f/fields/EditorInput/common/TreeViewPlugin.jsx +16 -0
- package/src/ui/f/fields/EditorInput/common/index.jsx +2 -0
- package/src/ui/f/fields/EditorInput/index.js +2 -0
- package/src/ui/f/fields/EditorInput/styles.scss +147 -0
- package/src/ui/f/fields/LinkInput/LinkInput.jsx +197 -0
- package/src/ui/f/fields/LinkInput/index.js +2 -0
- package/src/ui/f/fields/LinkInput/styles.scss +89 -0
- package/src/ui/f/fields/QueryChoices/QueryChoices.jsx +28 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +37 -2
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +68 -38
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +81 -66
- package/src/ui/f/fields/QueryCombobox/styles.scss +64 -30
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +16 -1
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +55 -28
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +4 -4
- package/src/ui/f/fields/RatingsInput/styles.scss +6 -13
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +88 -49
- package/src/ui/f/fields/SelectInput/styles.scss +60 -26
- package/src/ui/f/fields/TextInput/TextInput.jsx +71 -34
- package/src/ui/f/fields/TextInput/styles.scss +56 -20
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +65 -43
- package/src/ui/f/fields/TextareaInput/styles.scss +42 -25
- package/src/ui/f/fields/index.js +2 -0
- package/src/ui/form.scss +1 -1
- package/tests/__snapshots__/Storyshots.test.js.snap +14253 -5695
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/*
|
|
3
|
+
* Stripe WebGl Gradient Animation
|
|
4
|
+
* All Credits to Stripe.com
|
|
5
|
+
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and
|
|
6
|
+
* commented out for now.
|
|
7
|
+
* https://kevinhufnagl.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Converting colors to proper format
|
|
11
|
+
function normalizeColor(hexCode) {
|
|
12
|
+
return [(hexCode >> 16 & 255) / 255, (hexCode >> 8 & 255) / 255, (255 & hexCode) / 255];
|
|
13
|
+
}
|
|
14
|
+
['SCREEN', 'LINEAR_LIGHT'].reduce((hexCode, t, n) => Object.assign(hexCode, {
|
|
15
|
+
[t]: n
|
|
16
|
+
}), {});
|
|
17
|
+
|
|
18
|
+
// Essential functionality of WebGl
|
|
19
|
+
// t = width
|
|
20
|
+
// n = height
|
|
21
|
+
class MiniGl {
|
|
22
|
+
constructor(canvas, width, height, debug = false) {
|
|
23
|
+
const _miniGl = this;
|
|
24
|
+
const debug_output = document.location.search.toLowerCase().indexOf('debug=webgl') !== -1;
|
|
25
|
+
_miniGl.canvas = canvas, _miniGl.gl = _miniGl.canvas.getContext('webgl', {
|
|
26
|
+
antialias: true
|
|
27
|
+
}), _miniGl.meshes = [];
|
|
28
|
+
const context = _miniGl.gl;
|
|
29
|
+
width && height && this.setSize(width, height), _miniGl.lastDebugMsg, _miniGl.debug = debug && debug_output ? function (e) {
|
|
30
|
+
const t = new Date();
|
|
31
|
+
t - _miniGl.lastDebugMsg > 1e3 && console.log('---'), console.log(`${t.toLocaleTimeString() + Array(Math.max(0, 32 - e.length)).join(' ') + e}: `, ...Array.from(arguments).slice(1)), _miniGl.lastDebugMsg = t;
|
|
32
|
+
} : () => {}, Object.defineProperties(_miniGl, {
|
|
33
|
+
Material: {
|
|
34
|
+
enumerable: false,
|
|
35
|
+
value: class {
|
|
36
|
+
constructor(vertexShaders, fragments, uniforms = {}) {
|
|
37
|
+
const material = this;
|
|
38
|
+
function getShaderByType(type, source) {
|
|
39
|
+
const shader = context.createShader(type);
|
|
40
|
+
return context.shaderSource(shader, source), context.compileShader(shader), context.getShaderParameter(shader, context.COMPILE_STATUS) || console.error(context.getShaderInfoLog(shader)), _miniGl.debug('Material.compileShaderSource', {
|
|
41
|
+
source
|
|
42
|
+
}), shader;
|
|
43
|
+
}
|
|
44
|
+
function getUniformVariableDeclarations(uniforms, type) {
|
|
45
|
+
return Object.entries(uniforms).map(([uniform, value]) => value.getDeclaration(uniform, type)).join('\n');
|
|
46
|
+
}
|
|
47
|
+
material.uniforms = uniforms, material.uniformInstances = [];
|
|
48
|
+
const prefix = '\n precision highp float;\n ';
|
|
49
|
+
material.vertexSource = `\n ${prefix}\n attribute vec4 position;\n attribute vec2 uv;\n attribute vec2 uvNorm;\n ${getUniformVariableDeclarations(_miniGl.commonUniforms, 'vertex')}\n ${getUniformVariableDeclarations(uniforms, 'vertex')}\n ${vertexShaders}\n `, material.Source = `\n ${prefix}\n ${getUniformVariableDeclarations(_miniGl.commonUniforms, 'fragment')}\n ${getUniformVariableDeclarations(uniforms, 'fragment')}\n ${fragments}\n `, material.vertexShader = getShaderByType(context.VERTEX_SHADER, material.vertexSource), material.fragmentShader = getShaderByType(context.FRAGMENT_SHADER, material.Source), material.program = context.createProgram(), context.attachShader(material.program, material.vertexShader), context.attachShader(material.program, material.fragmentShader), context.linkProgram(material.program), context.getProgramParameter(material.program, context.LINK_STATUS) || console.error(context.getProgramInfoLog(material.program)), context.useProgram(material.program), material.attachUniforms(void 0, _miniGl.commonUniforms), material.attachUniforms(void 0, material.uniforms);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// t = uniform
|
|
53
|
+
attachUniforms(name, uniforms) {
|
|
54
|
+
// n = material
|
|
55
|
+
const material = this;
|
|
56
|
+
void 0 === name ? Object.entries(uniforms).forEach(([name, uniform]) => {
|
|
57
|
+
material.attachUniforms(name, uniform);
|
|
58
|
+
}) : uniforms.type == 'array' ? uniforms.value.forEach((uniform, i) => material.attachUniforms(`${name}[${i}]`, uniform)) : uniforms.type == 'struct' ? Object.entries(uniforms.value).forEach(([uniform, i]) => material.attachUniforms(`${name}.${uniform}`, i)) : (_miniGl.debug('Material.attachUniforms', {
|
|
59
|
+
name,
|
|
60
|
+
uniform: uniforms
|
|
61
|
+
}), material.uniformInstances.push({
|
|
62
|
+
uniform: uniforms,
|
|
63
|
+
location: context.getUniformLocation(material.program, name)
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
Uniform: {
|
|
69
|
+
enumerable: !1,
|
|
70
|
+
value: class {
|
|
71
|
+
constructor(e) {
|
|
72
|
+
this.type = 'float', Object.assign(this, e);
|
|
73
|
+
this.typeFn = {
|
|
74
|
+
float: '1f',
|
|
75
|
+
int: '1i',
|
|
76
|
+
vec2: '2fv',
|
|
77
|
+
vec3: '3fv',
|
|
78
|
+
vec4: '4fv',
|
|
79
|
+
mat4: 'Matrix4fv'
|
|
80
|
+
}[this.type] || '1f', this.update();
|
|
81
|
+
}
|
|
82
|
+
update(value) {
|
|
83
|
+
void 0 !== this.value && context[`uniform${this.typeFn}`](value, this.typeFn.indexOf('Matrix') === 0 ? this.transpose : this.value, this.typeFn.indexOf('Matrix') === 0 ? this.value : null);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// e - name
|
|
87
|
+
// t - type
|
|
88
|
+
// n - length
|
|
89
|
+
getDeclaration(name, type, length) {
|
|
90
|
+
const uniform = this;
|
|
91
|
+
if (uniform.excludeFrom !== type) {
|
|
92
|
+
if (uniform.type === 'array') return `${uniform.value[0].getDeclaration(name, type, uniform.value.length)}\nconst int ${name}_length = ${uniform.value.length};`;
|
|
93
|
+
if (uniform.type === 'struct') {
|
|
94
|
+
let name_no_prefix = name.replace('u_', '');
|
|
95
|
+
return name_no_prefix = name_no_prefix.charAt(0).toUpperCase() + name_no_prefix.slice(1), `uniform struct ${name_no_prefix}
|
|
96
|
+
{\n${Object.entries(uniform.value).map(([name, uniform]) => uniform.getDeclaration(name, type).replace(/^uniform/, '')).join('')}\n} ${name}${length > 0 ? `[${length}]` : ''};`;
|
|
97
|
+
}
|
|
98
|
+
return `uniform ${uniform.type} ${name}${length > 0 ? `[${length}]` : ''};`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
PlaneGeometry: {
|
|
104
|
+
enumerable: !1,
|
|
105
|
+
value: class {
|
|
106
|
+
constructor(width, height, n, i, orientation) {
|
|
107
|
+
context.createBuffer(), this.attributes = {
|
|
108
|
+
position: new _miniGl.Attribute({
|
|
109
|
+
target: context.ARRAY_BUFFER,
|
|
110
|
+
size: 3
|
|
111
|
+
}),
|
|
112
|
+
uv: new _miniGl.Attribute({
|
|
113
|
+
target: context.ARRAY_BUFFER,
|
|
114
|
+
size: 2
|
|
115
|
+
}),
|
|
116
|
+
uvNorm: new _miniGl.Attribute({
|
|
117
|
+
target: context.ARRAY_BUFFER,
|
|
118
|
+
size: 2
|
|
119
|
+
}),
|
|
120
|
+
index: new _miniGl.Attribute({
|
|
121
|
+
target: context.ELEMENT_ARRAY_BUFFER,
|
|
122
|
+
size: 3,
|
|
123
|
+
type: context.UNSIGNED_SHORT
|
|
124
|
+
})
|
|
125
|
+
}, this.setTopology(n, i), this.setSize(width, height, orientation);
|
|
126
|
+
}
|
|
127
|
+
setTopology(e = 1, t = 1) {
|
|
128
|
+
const n = this;
|
|
129
|
+
n.xSegCount = e, n.ySegCount = t, n.vertexCount = (n.xSegCount + 1) * (n.ySegCount + 1), n.quadCount = n.xSegCount * n.ySegCount * 2, n.attributes.uv.values = new Float32Array(2 * n.vertexCount), n.attributes.uvNorm.values = new Float32Array(2 * n.vertexCount), n.attributes.index.values = new Uint16Array(3 * n.quadCount);
|
|
130
|
+
for (let e = 0; e <= n.ySegCount; e++) {
|
|
131
|
+
for (let t = 0; t <= n.xSegCount; t++) {
|
|
132
|
+
const i = e * (n.xSegCount + 1) + t;
|
|
133
|
+
if (n.attributes.uv.values[2 * i] = t / n.xSegCount, n.attributes.uv.values[2 * i + 1] = 1 - e / n.ySegCount, n.attributes.uvNorm.values[2 * i] = t / n.xSegCount * 2 - 1, n.attributes.uvNorm.values[2 * i + 1] = 1 - e / n.ySegCount * 2, t < n.xSegCount && e < n.ySegCount) {
|
|
134
|
+
const s = e * n.xSegCount + t;
|
|
135
|
+
n.attributes.index.values[6 * s] = i, n.attributes.index.values[6 * s + 1] = i + 1 + n.xSegCount, n.attributes.index.values[6 * s + 2] = i + 1, n.attributes.index.values[6 * s + 3] = i + 1, n.attributes.index.values[6 * s + 4] = i + 1 + n.xSegCount, n.attributes.index.values[6 * s + 5] = i + 2 + n.xSegCount;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
n.attributes.uv.update(), n.attributes.uvNorm.update(), n.attributes.index.update(), _miniGl.debug('Geometry.setTopology', {
|
|
140
|
+
uv: n.attributes.uv,
|
|
141
|
+
uvNorm: n.attributes.uvNorm,
|
|
142
|
+
index: n.attributes.index
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
setSize(width = 1, height = 1, orientation = 'xz') {
|
|
146
|
+
const geometry = this;
|
|
147
|
+
geometry.width = width, geometry.height = height, geometry.orientation = orientation, geometry.attributes.position.values && geometry.attributes.position.values.length === 3 * geometry.vertexCount || (geometry.attributes.position.values = new Float32Array(3 * geometry.vertexCount));
|
|
148
|
+
const o = width / -2;
|
|
149
|
+
const r = height / -2;
|
|
150
|
+
const segment_width = width / geometry.xSegCount;
|
|
151
|
+
const segment_height = height / geometry.ySegCount;
|
|
152
|
+
for (let yIndex = 0; yIndex <= geometry.ySegCount; yIndex++) {
|
|
153
|
+
const t = r + yIndex * segment_height;
|
|
154
|
+
for (let xIndex = 0; xIndex <= geometry.xSegCount; xIndex++) {
|
|
155
|
+
const r = o + xIndex * segment_width;
|
|
156
|
+
const l = yIndex * (geometry.xSegCount + 1) + xIndex;
|
|
157
|
+
geometry.attributes.position.values[3 * l + 'xyz'.indexOf(orientation[0])] = r, geometry.attributes.position.values[3 * l + 'xyz'.indexOf(orientation[1])] = -t;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
geometry.attributes.position.update(), _miniGl.debug('Geometry.setSize', {
|
|
161
|
+
position: geometry.attributes.position
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
Mesh: {
|
|
167
|
+
enumerable: !1,
|
|
168
|
+
value: class {
|
|
169
|
+
constructor(geometry, material) {
|
|
170
|
+
const mesh = this;
|
|
171
|
+
mesh.geometry = geometry, mesh.material = material, mesh.wireframe = !1, mesh.attributeInstances = [], Object.entries(mesh.geometry.attributes).forEach(([e, attribute]) => {
|
|
172
|
+
mesh.attributeInstances.push({
|
|
173
|
+
attribute,
|
|
174
|
+
location: attribute.attach(e, mesh.material.program)
|
|
175
|
+
});
|
|
176
|
+
}), _miniGl.meshes.push(mesh), _miniGl.debug('Mesh.constructor', {
|
|
177
|
+
mesh
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
draw() {
|
|
181
|
+
context.useProgram(this.material.program), this.material.uniformInstances.forEach(({
|
|
182
|
+
uniform: e,
|
|
183
|
+
location: t
|
|
184
|
+
}) => e.update(t)), this.attributeInstances.forEach(({
|
|
185
|
+
attribute: e,
|
|
186
|
+
location: t
|
|
187
|
+
}) => e.use(t)), context.drawElements(this.wireframe ? context.LINES : context.TRIANGLES, this.geometry.attributes.index.values.length, context.UNSIGNED_SHORT, 0);
|
|
188
|
+
}
|
|
189
|
+
remove() {
|
|
190
|
+
_miniGl.meshes = _miniGl.meshes.filter(e => e != this);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
Attribute: {
|
|
195
|
+
enumerable: !1,
|
|
196
|
+
value: class {
|
|
197
|
+
constructor(e) {
|
|
198
|
+
this.type = context.FLOAT, this.normalized = !1, this.buffer = context.createBuffer(), Object.assign(this, e), this.update();
|
|
199
|
+
}
|
|
200
|
+
update() {
|
|
201
|
+
void 0 !== this.values && (context.bindBuffer(this.target, this.buffer), context.bufferData(this.target, this.values, context.STATIC_DRAW));
|
|
202
|
+
}
|
|
203
|
+
attach(e, t) {
|
|
204
|
+
const n = context.getAttribLocation(t, e);
|
|
205
|
+
return this.target === context.ARRAY_BUFFER && (context.enableVertexAttribArray(n), context.vertexAttribPointer(n, this.size, this.type, this.normalized, 0, 0)), n;
|
|
206
|
+
}
|
|
207
|
+
use(e) {
|
|
208
|
+
context.bindBuffer(this.target, this.buffer), this.target === context.ARRAY_BUFFER && (context.enableVertexAttribArray(e), context.vertexAttribPointer(e, this.size, this.type, this.normalized, 0, 0));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const a = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
214
|
+
_miniGl.commonUniforms = {
|
|
215
|
+
projectionMatrix: new _miniGl.Uniform({
|
|
216
|
+
type: 'mat4',
|
|
217
|
+
value: a
|
|
218
|
+
}),
|
|
219
|
+
modelViewMatrix: new _miniGl.Uniform({
|
|
220
|
+
type: 'mat4',
|
|
221
|
+
value: a
|
|
222
|
+
}),
|
|
223
|
+
resolution: new _miniGl.Uniform({
|
|
224
|
+
type: 'vec2',
|
|
225
|
+
value: [1, 1]
|
|
226
|
+
}),
|
|
227
|
+
aspectRatio: new _miniGl.Uniform({
|
|
228
|
+
type: 'float',
|
|
229
|
+
value: 1
|
|
230
|
+
})
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
setSize(e = 640, t = 480) {
|
|
234
|
+
this.width = e, this.height = t, this.canvas.width = e, this.canvas.height = t, this.gl.viewport(0, 0, e, t), this.commonUniforms.resolution.value = [e, t], this.commonUniforms.aspectRatio.value = e / t, this.debug('MiniGL.setSize', {
|
|
235
|
+
width: e,
|
|
236
|
+
height: t
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// left, right, top, bottom, near, far
|
|
241
|
+
setOrthographicCamera(e = 0, t = 0, n = 0, i = -2e3, s = 2e3) {
|
|
242
|
+
this.commonUniforms.projectionMatrix.value = [2 / this.width, 0, 0, 0, 0, 2 / this.height, 0, 0, 0, 0, 2 / (i - s), 0, e, t, n, 1], this.debug('setOrthographicCamera', this.commonUniforms.projectionMatrix.value);
|
|
243
|
+
}
|
|
244
|
+
render() {
|
|
245
|
+
this.gl.clearColor(0, 0, 0, 0), this.gl.clearDepth(1), this.meshes.forEach(e => e.draw());
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Sets initial properties
|
|
250
|
+
function e(object, propertyName, val) {
|
|
251
|
+
return propertyName in object ? Object.defineProperty(object, propertyName, {
|
|
252
|
+
value: val,
|
|
253
|
+
enumerable: !0,
|
|
254
|
+
configurable: !0,
|
|
255
|
+
writable: !0
|
|
256
|
+
}) : object[propertyName] = val, object;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Gradient object
|
|
260
|
+
class Gradient {
|
|
261
|
+
constructor(...t) {
|
|
262
|
+
e(this, 'el', void 0), e(this, 'cssVarRetries', 0), e(this, 'maxCssVarRetries', 200), e(this, 'angle', 0), e(this, 'isLoadedClass', !1), e(this, 'isScrolling', !1), /* e(this, "isStatic", o.disableAmbientAnimations()), */e(this, 'scrollingTimeout', void 0), e(this, 'scrollingRefreshDelay', 200), e(this, 'isIntersecting', !1), e(this, 'shaderFiles', void 0), e(this, 'vertexShader', void 0), e(this, 'sectionColors', void 0), e(this, 'computedCanvasStyle', void 0), e(this, 'conf', void 0), e(this, 'uniforms', void 0), e(this, 't', 1253106), e(this, 'last', 0), e(this, 'width', void 0), e(this, 'minWidth', 1111), e(this, 'height', 600), e(this, 'xSegCount', void 0), e(this, 'ySegCount', void 0), e(this, 'mesh', void 0), e(this, 'material', void 0), e(this, 'geometry', void 0), e(this, 'minigl', void 0), e(this, 'scrollObserver', void 0), e(this, 'amp', 320), e(this, 'seed', 5), e(this, 'freqX', 14e-5), e(this, 'freqY', 29e-5), e(this, 'freqDelta', 1e-5), e(this, 'activeColors', [1, 1, 1, 1]), e(this, 'isMetaKey', !1), e(this, 'isGradientLegendVisible', !1), e(this, 'isMouseDown', !1), e(this, 'handleScroll', () => {
|
|
263
|
+
clearTimeout(this.scrollingTimeout), this.scrollingTimeout = setTimeout(this.handleScrollEnd, this.scrollingRefreshDelay), this.isGradientLegendVisible && this.hideGradientLegend(), this.conf.playing && (this.isScrolling = !0, this.pause());
|
|
264
|
+
}), e(this, 'handleScrollEnd', () => {
|
|
265
|
+
this.isScrolling = !1, this.isIntersecting && this.play();
|
|
266
|
+
}), e(this, 'resize', () => {
|
|
267
|
+
this.width = window.innerWidth, this.minigl.setSize(this.width, this.height), this.minigl.setOrthographicCamera(), this.xSegCount = Math.ceil(this.width * this.conf.density[0]), this.ySegCount = Math.ceil(this.height * this.conf.density[1]), this.mesh.geometry.setTopology(this.xSegCount, this.ySegCount), this.mesh.geometry.setSize(this.width, this.height), this.mesh.material.uniforms.u_shadow_power.value = this.width < 600 ? 5 : 6;
|
|
268
|
+
}), e(this, 'handleMouseDown', e => {
|
|
269
|
+
this.isGradientLegendVisible && (this.isMetaKey = e.metaKey, this.isMouseDown = !0, !1 === this.conf.playing && requestAnimationFrame(this.animate));
|
|
270
|
+
}), e(this, 'handleMouseUp', () => {
|
|
271
|
+
this.isMouseDown = !1;
|
|
272
|
+
}), e(this, 'animate', e => {
|
|
273
|
+
if (!this.shouldSkipFrame(e) || this.isMouseDown) {
|
|
274
|
+
if (this.t += Math.min(e - this.last, 1e3 / 15), this.last = e, this.isMouseDown) {
|
|
275
|
+
let e = 160;
|
|
276
|
+
this.isMetaKey && (e = -160), this.t += e;
|
|
277
|
+
}
|
|
278
|
+
this.mesh.material.uniforms.u_time.value = this.t, this.minigl.render();
|
|
279
|
+
}
|
|
280
|
+
if (this.last !== 0 && this.isStatic) return this.minigl.render(), void this.disconnect();
|
|
281
|
+
( /* this.isIntersecting && */this.conf.playing || this.isMouseDown) && requestAnimationFrame(this.animate);
|
|
282
|
+
}), e(this, 'addIsLoadedClass', () => {
|
|
283
|
+
/* this.isIntersecting && */!this.isLoadedClass && (this.isLoadedClass = !0, this.el.classList.add('isLoaded'), setTimeout(() => {
|
|
284
|
+
this.el.parentElement.classList.add('isLoaded');
|
|
285
|
+
}, 3e3));
|
|
286
|
+
}), e(this, 'pause', () => {
|
|
287
|
+
this.conf.playing = false;
|
|
288
|
+
}), e(this, 'play', () => {
|
|
289
|
+
requestAnimationFrame(this.animate), this.conf.playing = true;
|
|
290
|
+
}), e(this, 'initGradient', selector => {
|
|
291
|
+
this.el = document.querySelector(selector);
|
|
292
|
+
this.connect();
|
|
293
|
+
return this;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
async connect() {
|
|
297
|
+
this.shaderFiles = {
|
|
298
|
+
vertex: 'varying vec3 v_color;\n\nvoid main() {\n float time = u_time * u_global.noiseSpeed;\n\n vec2 noiseCoord = resolution * uvNorm * u_global.noiseFreq;\n\n vec2 st = 1. - uvNorm.xy;\n\n //\n // Tilting the plane\n //\n\n // Front-to-back tilt\n float tilt = resolution.y / 2.0 * uvNorm.y;\n\n // Left-to-right angle\n float incline = resolution.x * uvNorm.x / 2.0 * u_vertDeform.incline;\n\n // Up-down shift to offset incline\n float offset = resolution.x / 2.0 * u_vertDeform.incline * mix(u_vertDeform.offsetBottom, u_vertDeform.offsetTop, uv.y);\n\n //\n // Vertex noise\n //\n\n float noise = snoise(vec3(\n noiseCoord.x * u_vertDeform.noiseFreq.x + time * u_vertDeform.noiseFlow,\n noiseCoord.y * u_vertDeform.noiseFreq.y,\n time * u_vertDeform.noiseSpeed + u_vertDeform.noiseSeed\n )) * u_vertDeform.noiseAmp;\n\n // Fade noise to zero at edges\n noise *= 1.0 - pow(abs(uvNorm.y), 2.0);\n\n // Clamp to 0\n noise = max(0.0, noise);\n\n vec3 pos = vec3(\n position.x,\n position.y + tilt + incline + noise - offset,\n position.z\n );\n\n //\n // Vertex color, to be passed to fragment shader\n //\n\n if (u_active_colors[0] == 1.) {\n v_color = u_baseColor;\n }\n\n for (int i = 0; i < u_waveLayers_length; i++) {\n if (u_active_colors[i + 1] == 1.) {\n WaveLayers layer = u_waveLayers[i];\n\n float noise = smoothstep(\n layer.noiseFloor,\n layer.noiseCeil,\n snoise(vec3(\n noiseCoord.x * layer.noiseFreq.x + time * layer.noiseFlow,\n noiseCoord.y * layer.noiseFreq.y,\n time * layer.noiseSpeed + layer.noiseSeed\n )) / 2.0 + 0.5\n );\n\n v_color = blendNormal(v_color, layer.color, pow(noise, 4.));\n }\n }\n\n //\n // Finish\n //\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n}',
|
|
299
|
+
noise: '//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n// First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n// Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n// Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n// Gradients: 7x7 points over a square, mapped onto an octahedron.\n// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n//Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n// Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n}',
|
|
300
|
+
blend: '//\n// https://github.com/jamieowen/glsl-blend\n//\n\n// Normal\n\nvec3 blendNormal(vec3 base, vec3 blend) {\n\treturn blend;\n}\n\nvec3 blendNormal(vec3 base, vec3 blend, float opacity) {\n\treturn (blendNormal(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Screen\n\nfloat blendScreen(float base, float blend) {\n\treturn 1.0-((1.0-base)*(1.0-blend));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend) {\n\treturn vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend, float opacity) {\n\treturn (blendScreen(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Multiply\n\nvec3 blendMultiply(vec3 base, vec3 blend) {\n\treturn base*blend;\n}\n\nvec3 blendMultiply(vec3 base, vec3 blend, float opacity) {\n\treturn (blendMultiply(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Overlay\n\nfloat blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend, float opacity) {\n\treturn (blendOverlay(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Hard light\n\nvec3 blendHardLight(vec3 base, vec3 blend) {\n\treturn blendOverlay(blend,base);\n}\n\nvec3 blendHardLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Soft light\n\nfloat blendSoftLight(float base, float blend) {\n\treturn (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend) {\n\treturn vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Color dodge\n\nfloat blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend) {\n\treturn vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b));\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Color burn\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend) {\n\treturn vec3(blendColorBurn(base.r,blend.r),blendColorBurn(base.g,blend.g),blendColorBurn(base.b,blend.b));\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Vivid Light\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend) {\n\treturn vec3(blendVividLight(base.r,blend.r),blendVividLight(base.g,blend.g),blendVividLight(base.b,blend.b));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendVividLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Lighten\n\nfloat blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\n\nvec3 blendLighten(vec3 base, vec3 blend) {\n\treturn vec3(blendLighten(base.r,blend.r),blendLighten(base.g,blend.g),blendLighten(base.b,blend.b));\n}\n\nvec3 blendLighten(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLighten(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear burn\n\nfloat blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendSubtract\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear dodge\n\nfloat blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendAdd\n\treturn min(base+blend,vec3(1.0));\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear light\n\nfloat blendLinearLight(float base, float blend) {\n\treturn blend<0.5?blendLinearBurn(base,(2.0*blend)):blendLinearDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend) {\n\treturn vec3(blendLinearLight(base.r,blend.r),blendLinearLight(base.g,blend.g),blendLinearLight(base.b,blend.b));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearLight(base, blend) * opacity + base * (1.0 - opacity));\n}',
|
|
301
|
+
fragment: 'varying vec3 v_color;\n\nvoid main() {\n vec3 color = v_color;\n if (u_darken_top == 1.0) {\n vec2 st = gl_FragCoord.xy/resolution.xy;\n color.g -= pow(st.y + sin(-12.0) * st.x, u_shadow_power) * 0.4;\n }\n gl_FragColor = vec4(color, 1.0);\n}'
|
|
302
|
+
}, this.conf = {
|
|
303
|
+
presetName: '',
|
|
304
|
+
wireframe: false,
|
|
305
|
+
density: [0.06, 0.16],
|
|
306
|
+
zoom: 1,
|
|
307
|
+
rotation: 0,
|
|
308
|
+
playing: true
|
|
309
|
+
}, document.querySelectorAll('canvas').length < 1 ? console.log('DID NOT LOAD HERO STRIPE CANVAS') : (this.minigl = new MiniGl(this.el, null, null, !0), requestAnimationFrame(() => {
|
|
310
|
+
this.el && (this.computedCanvasStyle = getComputedStyle(this.el), this.waitForCssVars());
|
|
311
|
+
})
|
|
312
|
+
/*
|
|
313
|
+
this.scrollObserver = await s.create(.1, !1),
|
|
314
|
+
this.scrollObserver.observe(this.el),
|
|
315
|
+
this.scrollObserver.onSeparate(() => {
|
|
316
|
+
window.removeEventListener("scroll", this.handleScroll), window.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("mouseup", this.handleMouseUp), window.removeEventListener("keydown", this.handleKeyDown), this.isIntersecting = !1, this.conf.playing && this.pause()
|
|
317
|
+
}),
|
|
318
|
+
this.scrollObserver.onIntersect(() => {
|
|
319
|
+
window.addEventListener("scroll", this.handleScroll), window.addEventListener("mousedown", this.handleMouseDown), window.addEventListener("mouseup", this.handleMouseUp), window.addEventListener("keydown", this.handleKeyDown), this.isIntersecting = !0, this.addIsLoadedClass(), this.play()
|
|
320
|
+
}) */);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
disconnect() {
|
|
324
|
+
this.scrollObserver && (window.removeEventListener('scroll', this.handleScroll), window.removeEventListener('mousedown', this.handleMouseDown), window.removeEventListener('mouseup', this.handleMouseUp), window.removeEventListener('keydown', this.handleKeyDown), this.scrollObserver.disconnect()), window.removeEventListener('resize', this.resize);
|
|
325
|
+
}
|
|
326
|
+
initMaterial() {
|
|
327
|
+
this.uniforms = {
|
|
328
|
+
u_time: new this.minigl.Uniform({
|
|
329
|
+
value: 0
|
|
330
|
+
}),
|
|
331
|
+
u_shadow_power: new this.minigl.Uniform({
|
|
332
|
+
value: 5
|
|
333
|
+
}),
|
|
334
|
+
u_darken_top: new this.minigl.Uniform({
|
|
335
|
+
value: this.el.dataset.jsDarkenTop === '' ? 1 : 0
|
|
336
|
+
}),
|
|
337
|
+
u_active_colors: new this.minigl.Uniform({
|
|
338
|
+
value: this.activeColors,
|
|
339
|
+
type: 'vec4'
|
|
340
|
+
}),
|
|
341
|
+
u_global: new this.minigl.Uniform({
|
|
342
|
+
value: {
|
|
343
|
+
noiseFreq: new this.minigl.Uniform({
|
|
344
|
+
value: [this.freqX, this.freqY],
|
|
345
|
+
type: 'vec2'
|
|
346
|
+
}),
|
|
347
|
+
noiseSpeed: new this.minigl.Uniform({
|
|
348
|
+
value: 5e-6
|
|
349
|
+
})
|
|
350
|
+
},
|
|
351
|
+
type: 'struct'
|
|
352
|
+
}),
|
|
353
|
+
u_vertDeform: new this.minigl.Uniform({
|
|
354
|
+
value: {
|
|
355
|
+
incline: new this.minigl.Uniform({
|
|
356
|
+
value: Math.sin(this.angle) / Math.cos(this.angle)
|
|
357
|
+
}),
|
|
358
|
+
offsetTop: new this.minigl.Uniform({
|
|
359
|
+
value: -0.5
|
|
360
|
+
}),
|
|
361
|
+
offsetBottom: new this.minigl.Uniform({
|
|
362
|
+
value: -0.5
|
|
363
|
+
}),
|
|
364
|
+
noiseFreq: new this.minigl.Uniform({
|
|
365
|
+
value: [3, 4],
|
|
366
|
+
type: 'vec2'
|
|
367
|
+
}),
|
|
368
|
+
noiseAmp: new this.minigl.Uniform({
|
|
369
|
+
value: this.amp
|
|
370
|
+
}),
|
|
371
|
+
noiseSpeed: new this.minigl.Uniform({
|
|
372
|
+
value: 10
|
|
373
|
+
}),
|
|
374
|
+
noiseFlow: new this.minigl.Uniform({
|
|
375
|
+
value: 3
|
|
376
|
+
}),
|
|
377
|
+
noiseSeed: new this.minigl.Uniform({
|
|
378
|
+
value: this.seed
|
|
379
|
+
})
|
|
380
|
+
},
|
|
381
|
+
type: 'struct',
|
|
382
|
+
excludeFrom: 'fragment'
|
|
383
|
+
}),
|
|
384
|
+
u_baseColor: new this.minigl.Uniform({
|
|
385
|
+
value: this.sectionColors[0],
|
|
386
|
+
type: 'vec3',
|
|
387
|
+
excludeFrom: 'fragment'
|
|
388
|
+
}),
|
|
389
|
+
u_waveLayers: new this.minigl.Uniform({
|
|
390
|
+
value: [],
|
|
391
|
+
excludeFrom: 'fragment',
|
|
392
|
+
type: 'array'
|
|
393
|
+
})
|
|
394
|
+
};
|
|
395
|
+
for (let e = 1; e < this.sectionColors.length; e += 1) {
|
|
396
|
+
this.uniforms.u_waveLayers.value.push(new this.minigl.Uniform({
|
|
397
|
+
value: {
|
|
398
|
+
color: new this.minigl.Uniform({
|
|
399
|
+
value: this.sectionColors[e],
|
|
400
|
+
type: 'vec3'
|
|
401
|
+
}),
|
|
402
|
+
noiseFreq: new this.minigl.Uniform({
|
|
403
|
+
value: [2 + e / this.sectionColors.length, 3 + e / this.sectionColors.length],
|
|
404
|
+
type: 'vec2'
|
|
405
|
+
}),
|
|
406
|
+
noiseSpeed: new this.minigl.Uniform({
|
|
407
|
+
value: 11 + 0.3 * e
|
|
408
|
+
}),
|
|
409
|
+
noiseFlow: new this.minigl.Uniform({
|
|
410
|
+
value: 6.5 + 0.3 * e
|
|
411
|
+
}),
|
|
412
|
+
noiseSeed: new this.minigl.Uniform({
|
|
413
|
+
value: this.seed + 10 * e
|
|
414
|
+
}),
|
|
415
|
+
noiseFloor: new this.minigl.Uniform({
|
|
416
|
+
value: 0.1
|
|
417
|
+
}),
|
|
418
|
+
noiseCeil: new this.minigl.Uniform({
|
|
419
|
+
value: 0.63 + 0.07 * e
|
|
420
|
+
})
|
|
421
|
+
},
|
|
422
|
+
type: 'struct'
|
|
423
|
+
}));
|
|
424
|
+
}
|
|
425
|
+
return this.vertexShader = [this.shaderFiles.noise, this.shaderFiles.blend, this.shaderFiles.vertex].join('\n\n'), new this.minigl.Material(this.vertexShader, this.shaderFiles.fragment, this.uniforms);
|
|
426
|
+
}
|
|
427
|
+
initMesh() {
|
|
428
|
+
this.material = this.initMaterial(), this.geometry = new this.minigl.PlaneGeometry(), this.mesh = new this.minigl.Mesh(this.geometry, this.material);
|
|
429
|
+
}
|
|
430
|
+
shouldSkipFrame(e) {
|
|
431
|
+
return !!window.document.hidden || !this.conf.playing || parseInt(e, 10) % 2 == 0 || void 0;
|
|
432
|
+
}
|
|
433
|
+
updateFrequency(e) {
|
|
434
|
+
this.freqX += e, this.freqY += e;
|
|
435
|
+
}
|
|
436
|
+
toggleColor(index) {
|
|
437
|
+
this.activeColors[index] = this.activeColors[index] === 0 ? 1 : 0;
|
|
438
|
+
}
|
|
439
|
+
showGradientLegend() {
|
|
440
|
+
this.width > this.minWidth && (this.isGradientLegendVisible = !0, document.body.classList.add('isGradientLegendVisible'));
|
|
441
|
+
}
|
|
442
|
+
hideGradientLegend() {
|
|
443
|
+
this.isGradientLegendVisible = !1, document.body.classList.remove('isGradientLegendVisible');
|
|
444
|
+
}
|
|
445
|
+
init() {
|
|
446
|
+
this.initGradientColors(), this.initMesh(), this.resize(), requestAnimationFrame(this.animate), window.addEventListener('resize', this.resize);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/*
|
|
450
|
+
* Waiting for the css variables to become available, usually on page load before we can continue.
|
|
451
|
+
* Using default colors assigned below if no variables have been found after maxCssVarRetries
|
|
452
|
+
*/
|
|
453
|
+
waitForCssVars() {
|
|
454
|
+
if (this.computedCanvasStyle && this.computedCanvasStyle.getPropertyValue('--gradient-color-1').indexOf('#') !== -1) this.init(), this.addIsLoadedClass();else {
|
|
455
|
+
if (this.cssVarRetries += 1, this.cssVarRetries > this.maxCssVarRetries) {
|
|
456
|
+
return this.sectionColors = [16711680, 16711680, 16711935, 65280, 255], void this.init();
|
|
457
|
+
}
|
|
458
|
+
requestAnimationFrame(() => this.waitForCssVars());
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/*
|
|
463
|
+
* Initializes the four section colors by retrieving them from css variables.
|
|
464
|
+
*/
|
|
465
|
+
initGradientColors() {
|
|
466
|
+
this.sectionColors = ['--gradient-color-1', '--gradient-color-2', '--gradient-color-3', '--gradient-color-4'].map(cssPropertyName => {
|
|
467
|
+
let hex = this.computedCanvasStyle.getPropertyValue(cssPropertyName).trim();
|
|
468
|
+
// Check if shorthand hex value was used and double the length so the conversion in normalizeColor will work.
|
|
469
|
+
if (hex.length === 4) {
|
|
470
|
+
const hexTemp = hex.substr(1).split('').map(hexTemp => hexTemp + hexTemp).join('');
|
|
471
|
+
hex = `#${hexTemp}`;
|
|
472
|
+
}
|
|
473
|
+
return hex && `0x${hex.substr(1)}`;
|
|
474
|
+
}).filter(Boolean).map(normalizeColor);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/*
|
|
479
|
+
*Finally initializing the Gradient class, assigning a canvas to it and calling Gradient.connect() which initializes everything,
|
|
480
|
+
* Use Gradient.pause() and Gradient.play() for controls.
|
|
481
|
+
*
|
|
482
|
+
* Here are some default property values you can change anytime:
|
|
483
|
+
* Amplitude: Gradient.amp = 0
|
|
484
|
+
* Colors: Gradient.sectionColors (if you change colors, use normalizeColor(#hexValue)) before you assign it.
|
|
485
|
+
*
|
|
486
|
+
*
|
|
487
|
+
* Useful functions
|
|
488
|
+
* Gradient.toggleColor(index)
|
|
489
|
+
* Gradient.updateFrequency(freq)
|
|
490
|
+
*/
|
|
491
|
+
|
|
492
|
+
export { Gradient };
|
|
@@ -7,19 +7,15 @@ export default ((initialTheme, storageKey = 'theme') => {
|
|
|
7
7
|
const storage = window.localStorage;
|
|
8
8
|
if (isClient) {
|
|
9
9
|
const storedTheme = window.localStorage.getItem(storageKey);
|
|
10
|
-
// console.log(storedTheme, storedTheme != userTheme)
|
|
11
10
|
if (storedTheme && storedTheme !== userTheme) {
|
|
12
|
-
// console.warn('Theme load')
|
|
13
11
|
setPreferredTheme(storedTheme);
|
|
14
12
|
setUserTheme(storedTheme);
|
|
15
13
|
} else if (preferredTheme && preferredTheme.length && preferredTheme !== 'system') {
|
|
16
14
|
setUserTheme(preferredTheme);
|
|
17
15
|
storage.setItem(storageKey, preferredTheme);
|
|
18
|
-
// console.warn('theme change', preferredTheme)
|
|
19
16
|
} else {
|
|
20
17
|
setUserTheme(window.matchMedia('(prefers-color-scheme:dark)').matches ? 'dark' : 'light');
|
|
21
18
|
storage.removeItem(storageKey);
|
|
22
|
-
// console.warn('theme reset')
|
|
23
19
|
}
|
|
24
20
|
} else {
|
|
25
21
|
setUserTheme('light');
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.1.1-alpha.1 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useInsertionEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem/exports';
|
|
6
|
+
const baseClassName = styleNames.base;
|
|
7
|
+
const componentClassName = 'blur-overlay';
|
|
8
|
+
const BlurOverlay = ({
|
|
9
|
+
id,
|
|
10
|
+
className: userClassName,
|
|
11
|
+
style,
|
|
12
|
+
children,
|
|
13
|
+
blur
|
|
14
|
+
}) => {
|
|
15
|
+
useInsertionEffect(() => {
|
|
16
|
+
import("./styles.scss");
|
|
17
|
+
}, []);
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
id: id,
|
|
20
|
+
className: [baseClassName, componentClassName, userClassName, blur && styleNames.modifierActive].filter(e => e).join(' '),
|
|
21
|
+
style: style
|
|
22
|
+
}, children);
|
|
23
|
+
};
|
|
24
|
+
BlurOverlay.propTypes = {
|
|
25
|
+
/**
|
|
26
|
+
* The HTML id for this element
|
|
27
|
+
*/
|
|
28
|
+
id: PropTypes.string,
|
|
29
|
+
/**
|
|
30
|
+
* The HTML class names for this element
|
|
31
|
+
*/
|
|
32
|
+
className: PropTypes.string,
|
|
33
|
+
/**
|
|
34
|
+
* The React-written, css properties for this element.
|
|
35
|
+
*/
|
|
36
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
37
|
+
/**
|
|
38
|
+
* The children JSX
|
|
39
|
+
*/
|
|
40
|
+
children: PropTypes.node,
|
|
41
|
+
/**
|
|
42
|
+
* Boolean to toggle blur effect
|
|
43
|
+
*/
|
|
44
|
+
blur: PropTypes.bool
|
|
45
|
+
};
|
|
46
|
+
BlurOverlay.defaultProps = {
|
|
47
|
+
blur: true
|
|
48
|
+
// someProp:false
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default BlurOverlay;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.1.1-alpha.1 */
|
|
2
|
+
|
|
3
|
+
@use "@pareto-engineering/bem";
|
|
4
|
+
|
|
5
|
+
.#{bem.$base}.blur-overlay {
|
|
6
|
+
background: inherit;
|
|
7
|
+
left: 0;
|
|
8
|
+
position: fixed;
|
|
9
|
+
top: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
z-index: 3;
|
|
12
|
+
&.#{bem.$modifier-active} {
|
|
13
|
+
animation: blurAnimation .3s ease-in-out;
|
|
14
|
+
backdrop-filter: blur(5px);
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes blurAnimation {
|
|
20
|
+
0% {
|
|
21
|
+
transform: translateX(-100%);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
1% {
|
|
25
|
+
transform: translateX(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
100% {
|
|
29
|
+
transform: translateX(0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -17,7 +17,8 @@ const ContentTree = ({
|
|
|
17
17
|
className: userClassName,
|
|
18
18
|
style,
|
|
19
19
|
target,
|
|
20
|
-
selectors
|
|
20
|
+
selectors,
|
|
21
|
+
color
|
|
21
22
|
// ...otherProps
|
|
22
23
|
}) => {
|
|
23
24
|
useInsertionEffect(() => {
|
|
@@ -30,6 +31,7 @@ const ContentTree = ({
|
|
|
30
31
|
style: style
|
|
31
32
|
// {...otherProps}
|
|
32
33
|
}, /*#__PURE__*/React.createElement(Tree, {
|
|
34
|
+
color: color,
|
|
33
35
|
tree: contentTree
|
|
34
36
|
}));
|
|
35
37
|
};
|
|
@@ -54,8 +56,12 @@ ContentTree.propTypes = {
|
|
|
54
56
|
* The reference to the parent element.
|
|
55
57
|
*/
|
|
56
58
|
target: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
57
|
-
current: PropTypes.
|
|
58
|
-
})])
|
|
59
|
+
current: PropTypes.node
|
|
60
|
+
})]),
|
|
61
|
+
/**
|
|
62
|
+
* The color for the tree.
|
|
63
|
+
*/
|
|
64
|
+
color: PropTypes.string
|
|
59
65
|
};
|
|
60
66
|
ContentTree.defaultProps = {
|
|
61
67
|
selectors: ['h2', 'h3']
|