@wix/editor-react-components 1.2153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -0
- package/dist/site/components/AccordionComponent/AccordionContainer.d.ts +4 -0
- package/dist/site/components/AccordionComponent/AccordionItem.d.ts +12 -0
- package/dist/site/components/AccordionComponent/component.d.ts +3 -0
- package/dist/site/components/AccordionComponent/component.js +2530 -0
- package/dist/site/components/AccordionComponent/component.preview.d.ts +4 -0
- package/dist/site/components/AccordionComponent/constants.d.ts +72 -0
- package/dist/site/components/AccordionComponent/css.css +47 -0
- package/dist/site/components/AccordionComponent/hooks.d.ts +5 -0
- package/dist/site/components/AccordionComponent/index.d.ts +2 -0
- package/dist/site/components/AccordionComponent/index.js +6 -0
- package/dist/site/components/AccordionComponent/manifest.d.ts +5 -0
- package/dist/site/components/AccordionComponent/manifest.js +361 -0
- package/dist/site/components/AccordionComponent/manifestConfigs/iconPositionConfig.d.ts +16 -0
- package/dist/site/components/AccordionComponent/types.d.ts +49 -0
- package/dist/site/components/AccordionComponent/utils.d.ts +4 -0
- package/dist/site/components/AnimatedIcon/AnimatedIcon.d.ts +5 -0
- package/dist/site/components/AnimatedIcon/AnimatedIcon.semanticClassNames.d.ts +4 -0
- package/dist/site/components/AnimatedIcon/component.d.ts +4 -0
- package/dist/site/components/AnimatedIcon/component.js +13 -0
- package/dist/site/components/AnimatedIcon/components/AnimatedSvg.d.ts +4 -0
- package/dist/site/components/AnimatedIcon/constants.d.ts +84 -0
- package/dist/site/components/AnimatedIcon/css.css +19 -0
- package/dist/site/components/AnimatedIcon/index.d.ts +2 -0
- package/dist/site/components/AnimatedIcon/index.js +6 -0
- package/dist/site/components/AnimatedIcon/manifest.d.ts +5 -0
- package/dist/site/components/AnimatedIcon/manifest.js +157 -0
- package/dist/site/components/AnimatedIcon/panels/AnimatedIconPanelWrapper.d.ts +4 -0
- package/dist/site/components/AnimatedIcon/panels/IconCreationPanel/BackButton.d.ts +7 -0
- package/dist/site/components/AnimatedIcon/panels/IconCreationPanel/Footer.d.ts +7 -0
- package/dist/site/components/AnimatedIcon/panels/IconCreationPanel/IconCreationPanel.d.ts +8 -0
- package/dist/site/components/AnimatedIcon/panels/IconCreationPanel/IconSelector.d.ts +11 -0
- package/dist/site/components/AnimatedIcon/panels/IconCreationPanel/PreviewSection.d.ts +13 -0
- package/dist/site/components/AnimatedIcon/panels/IconCreationPanel/Title.d.ts +7 -0
- package/dist/site/components/AnimatedIcon/panels/components/AnimatedIconCreationSection.d.ts +10 -0
- package/dist/site/components/AnimatedIcon/panels/components/DurationSection.d.ts +11 -0
- package/dist/site/components/AnimatedIcon/panels/components/IconTypeSection.d.ts +10 -0
- package/dist/site/components/AnimatedIcon/panels/components/SvgDisplaySection.d.ts +12 -0
- package/dist/site/components/AnimatedIcon/panels/constants.d.ts +15 -0
- package/dist/site/components/AnimatedIcon/panels/dataHooks.d.ts +16 -0
- package/dist/site/components/AnimatedIcon/panels/extension.d.ts +4 -0
- package/dist/site/components/AnimatedIcon/panels/panel.d.ts +3 -0
- package/dist/site/components/AnimatedIcon/panels/translations/consts.d.ts +20 -0
- package/dist/site/components/AnimatedIcon/panels/utils.d.ts +32 -0
- package/dist/site/components/AnimatedIcon/types.d.ts +27 -0
- package/dist/site/components/AnimatedIcon/useDefaultHoverBehavior.d.ts +7 -0
- package/dist/site/components/AnimatedIcon/utils.d.ts +1 -0
- package/dist/site/components/AudioPlayer/AudioPlayer.d.ts +4 -0
- package/dist/site/components/AudioPlayer/component.d.ts +4 -0
- package/dist/site/components/AudioPlayer/component.js +4757 -0
- package/dist/site/components/AudioPlayer/component.preview.d.ts +3 -0
- package/dist/site/components/AudioPlayer/components/PlayButton.d.ts +3 -0
- package/dist/site/components/AudioPlayer/components/ProgressSlider.d.ts +3 -0
- package/dist/site/components/AudioPlayer/components/VolumeControls.d.ts +3 -0
- package/dist/site/components/AudioPlayer/constants.d.ts +87 -0
- package/dist/site/components/AudioPlayer/css.css +217 -0
- package/dist/site/components/AudioPlayer/hooks/useAudioPlayer.d.ts +13 -0
- package/dist/site/components/AudioPlayer/icons/SoundOff.d.ts +2 -0
- package/dist/site/components/AudioPlayer/icons/SoundOn.d.ts +2 -0
- package/dist/site/components/AudioPlayer/index.d.ts +2 -0
- package/dist/site/components/AudioPlayer/index.js +6 -0
- package/dist/site/components/AudioPlayer/manifest.d.ts +5 -0
- package/dist/site/components/AudioPlayer/manifest.js +314 -0
- package/dist/site/components/AudioPlayer/manifestConfigs/controlsConfig.d.ts +63 -0
- package/dist/site/components/AudioPlayer/manifestConfigs/coverMediaConfig.d.ts +25 -0
- package/dist/site/components/AudioPlayer/types.d.ts +46 -0
- package/dist/site/components/AudioPlayer/utils/getAudioLoadUrlForPlayerInstance.d.ts +1 -0
- package/dist/site/components/AudioPlayer/utils.d.ts +1 -0
- package/dist/site/components/BoxContainer/component.d.ts +3 -0
- package/dist/site/components/BoxContainer/component.js +44 -0
- package/dist/site/components/BoxContainer/constants.d.ts +13 -0
- package/dist/site/components/BoxContainer/css.css +3 -0
- package/dist/site/components/BoxContainer/index.d.ts +2 -0
- package/dist/site/components/BoxContainer/index.js +6 -0
- package/dist/site/components/BoxContainer/manifest.d.ts +5 -0
- package/dist/site/components/BoxContainer/manifest.js +121 -0
- package/dist/site/components/BoxContainer/types.d.ts +34 -0
- package/dist/site/components/Breadcrumbs/BreadcrumbItem.d.ts +3 -0
- package/dist/site/components/Breadcrumbs/EllipsisItem.d.ts +3 -0
- package/dist/site/components/Breadcrumbs/Separator.d.ts +2 -0
- package/dist/site/components/Breadcrumbs/component.d.ts +5 -0
- package/dist/site/components/Breadcrumbs/component.js +1672 -0
- package/dist/site/components/Breadcrumbs/component.preview.d.ts +3 -0
- package/dist/site/components/Breadcrumbs/constants.d.ts +95 -0
- package/dist/site/components/Breadcrumbs/css.css +170 -0
- package/dist/site/components/Breadcrumbs/index.d.ts +2 -0
- package/dist/site/components/Breadcrumbs/index.js +6 -0
- package/dist/site/components/Breadcrumbs/manifest.d.ts +5 -0
- package/dist/site/components/Breadcrumbs/manifest.js +380 -0
- package/dist/site/components/Breadcrumbs/types.d.ts +40 -0
- package/dist/site/components/Breadcrumbs/useBreadcrumbItems.d.ts +4 -0
- package/dist/site/components/Breadcrumbs/useCollapsedRange.d.ts +3 -0
- package/dist/site/components/Breadcrumbs/useSeoService.d.ts +2 -0
- package/dist/site/components/Breadcrumbs/utils.d.ts +3 -0
- package/dist/site/components/Button/Button.corvid.types.d.ts +34 -0
- package/dist/site/components/Button/Button.d.ts +5 -0
- package/dist/site/components/Button/Button.types.d.ts +76 -0
- package/dist/site/components/Button/component.d.ts +4 -0
- package/dist/site/components/Button/component.js +5 -0
- package/dist/site/components/Button/component.preview.d.ts +3 -0
- package/dist/site/components/Button/components/AnimatedButtonIcon.d.ts +4 -0
- package/dist/site/components/Button/constants.d.ts +66 -0
- package/dist/site/components/Button/css.css +150 -0
- package/dist/site/components/Button/hooks/index.d.ts +4 -0
- package/dist/site/components/Button/hooks/useButtonA11y.d.ts +71 -0
- package/dist/site/components/Button/hooks/useButtonEventHandlers.d.ts +27 -0
- package/dist/site/components/Button/hooks/useHoverState.d.ts +7 -0
- package/dist/site/components/Button/hooks/useIconAnimation.d.ts +6 -0
- package/dist/site/components/Button/index.d.ts +2 -0
- package/dist/site/components/Button/index.js +6 -0
- package/dist/site/components/Button/manifest.d.ts +5 -0
- package/dist/site/components/Button/manifest.js +340 -0
- package/dist/site/components/Button/sdk.d.ts +10 -0
- package/dist/site/components/Button/sdk.js +417 -0
- package/dist/site/components/CollapsibleText/CollapsibleText.d.ts +3 -0
- package/dist/site/components/CollapsibleText/ExpandControl.d.ts +13 -0
- package/dist/site/components/CollapsibleText/component.d.ts +2 -0
- package/dist/site/components/CollapsibleText/component.js +227 -0
- package/dist/site/components/CollapsibleText/component.preview.d.ts +4 -0
- package/dist/site/components/CollapsibleText/constants.d.ts +65 -0
- package/dist/site/components/CollapsibleText/css.css +273 -0
- package/dist/site/components/CollapsibleText/index.d.ts +2 -0
- package/dist/site/components/CollapsibleText/index.js +6 -0
- package/dist/site/components/CollapsibleText/manifest/manifestClasses.d.ts +5 -0
- package/dist/site/components/CollapsibleText/manifest.d.ts +5 -0
- package/dist/site/components/CollapsibleText/manifest.js +243 -0
- package/dist/site/components/CollapsibleText/sdk.d.ts +14 -0
- package/dist/site/components/CollapsibleText/sdk.js +80 -0
- package/dist/site/components/CollapsibleText/types.d.ts +37 -0
- package/dist/site/components/CollapsibleText/useReinitializeState.d.ts +2 -0
- package/dist/site/components/CollapsibleText/utils.d.ts +5 -0
- package/dist/site/components/GoogleMap/GoogleMap.d.ts +8 -0
- package/dist/site/components/GoogleMap/GoogleMap.types.d.ts +131 -0
- package/dist/site/components/GoogleMap/component.d.ts +2 -0
- package/dist/site/components/GoogleMap/component.js +1925 -0
- package/dist/site/components/GoogleMap/components/GoogleMapMarker.d.ts +4 -0
- package/dist/site/components/GoogleMap/components/GoogleMapReact.d.ts +66 -0
- package/dist/site/components/GoogleMap/components/GoogleMapReactInteractiveMap.d.ts +34 -0
- package/dist/site/components/GoogleMap/consts.d.ts +171 -0
- package/dist/site/components/GoogleMap/css.css +372 -0
- package/dist/site/components/GoogleMap/hooks/useGoogleMapProps.d.ts +13 -0
- package/dist/site/components/GoogleMap/index.d.ts +2 -0
- package/dist/site/components/GoogleMap/index.js +6 -0
- package/dist/site/components/GoogleMap/manifest.d.ts +5 -0
- package/dist/site/components/GoogleMap/manifest.js +240 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/components/LocationForm.d.ts +2 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/components/LocationsList.d.ts +2 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/context/ManageLocationsContext.d.ts +8 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/extension.d.ts +4 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/hooks/useLocationForm.d.ts +25 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/hooks/useSuccessAnimation.d.ts +6 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/panel.d.ts +3 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/translations/consts.d.ts +18 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/types.d.ts +22 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/utils/address-utils.d.ts +7 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/utils/component-props-utils.d.ts +26 -0
- package/dist/site/components/GoogleMap/panels/ManageLocations/utils/form-utils.d.ts +21 -0
- package/dist/site/components/GoogleMap/utils/imperativeMethods.d.ts +2 -0
- package/dist/site/components/GoogleMap/utils/mapUtils.d.ts +11 -0
- package/dist/site/components/GoogleMap/utils/sdkMethods.d.ts +27 -0
- package/dist/site/components/HTMLComponent/HTMLComponent.types.d.ts +52 -0
- package/dist/site/components/HTMLComponent/component.d.ts +6 -0
- package/dist/site/components/HTMLComponent/component.js +295 -0
- package/dist/site/components/HTMLComponent/component.preview.d.ts +5 -0
- package/dist/site/components/HTMLComponent/components/EmptyState.d.ts +3 -0
- package/dist/site/components/HTMLComponent/components/HTMLComponent.d.ts +17 -0
- package/dist/site/components/HTMLComponent/constants.d.ts +6 -0
- package/dist/site/components/HTMLComponent/css.css +348 -0
- package/dist/site/components/HTMLComponent/hooks/index.d.ts +2 -0
- package/dist/site/components/HTMLComponent/hooks/useHTMLComponentProps.d.ts +20 -0
- package/dist/site/components/HTMLComponent/index.d.ts +2 -0
- package/dist/site/components/HTMLComponent/index.js +6 -0
- package/dist/site/components/HTMLComponent/manifest.d.ts +5 -0
- package/dist/site/components/HTMLComponent/manifest.js +217 -0
- package/dist/site/components/HTMLComponent/panels/components/CookieConsentField.d.ts +14 -0
- package/dist/site/components/HTMLComponent/panels/components/ExternalUrlContent.d.ts +14 -0
- package/dist/site/components/HTMLComponent/panels/components/HtmlCodeContent.d.ts +13 -0
- package/dist/site/components/HTMLComponent/panels/components/SourceTypeContent.d.ts +18 -0
- package/dist/site/components/HTMLComponent/panels/components/SourceTypeSelector.d.ts +14 -0
- package/dist/site/components/HTMLComponent/panels/components/TitleField.d.ts +15 -0
- package/dist/site/components/HTMLComponent/panels/components/index.d.ts +6 -0
- package/dist/site/components/HTMLComponent/panels/constants.d.ts +91 -0
- package/dist/site/components/HTMLComponent/panels/extension.d.ts +4 -0
- package/dist/site/components/HTMLComponent/panels/hooks.d.ts +24 -0
- package/dist/site/components/HTMLComponent/panels/panel.d.ts +3 -0
- package/dist/site/components/HTMLComponent/panels/test-utils.d.ts +18 -0
- package/dist/site/components/HTMLComponent/panels/translations/consts.d.ts +21 -0
- package/dist/site/components/HTMLComponent/panels/utils.d.ts +7 -0
- package/dist/site/components/HTMLComponent/sdk.d.ts +5 -0
- package/dist/site/components/HTMLComponent/sdk.js +69 -0
- package/dist/site/components/HTMLComponent/utils.d.ts +1 -0
- package/dist/site/components/HipaaIcon/HipaaBadgeSvg.d.ts +3 -0
- package/dist/site/components/HipaaIcon/HipaaIcon.types.d.ts +9 -0
- package/dist/site/components/HipaaIcon/component.d.ts +4 -0
- package/dist/site/components/HipaaIcon/component.js +165 -0
- package/dist/site/components/HipaaIcon/component.preview.d.ts +5 -0
- package/dist/site/components/HipaaIcon/constants.d.ts +26 -0
- package/dist/site/components/HipaaIcon/css.css +44 -0
- package/dist/site/components/HipaaIcon/index.d.ts +2 -0
- package/dist/site/components/HipaaIcon/index.js +6 -0
- package/dist/site/components/HipaaIcon/manifest.d.ts +5 -0
- package/dist/site/components/HipaaIcon/manifest.js +89 -0
- package/dist/site/components/HipaaIcon/panels/hipaaSettings/extension.d.ts +4 -0
- package/dist/site/components/HipaaIcon/panels/hipaaSettings/panel.d.ts +3 -0
- package/dist/site/components/HipaaIcon/panels/hipaaSettings/translations/consts.d.ts +6 -0
- package/dist/site/components/HipaaIcon/sdk.d.ts +3 -0
- package/dist/site/components/HipaaIcon/sdk.js +12 -0
- package/dist/site/components/HipaaIcon/utils.d.ts +2 -0
- package/dist/site/components/Image3/Image3.types.d.ts +29 -0
- package/dist/site/components/Image3/component.d.ts +5 -0
- package/dist/site/components/Image3/component.js +197 -0
- package/dist/site/components/Image3/component.preview.d.ts +5 -0
- package/dist/site/components/Image3/css.css +63 -0
- package/dist/site/components/Image3/index.d.ts +2 -0
- package/dist/site/components/Image3/index.js +6 -0
- package/dist/site/components/Image3/manifest.d.ts +5 -0
- package/dist/site/components/Image3/manifest.js +197 -0
- package/dist/site/components/Image3/previewManifestOverrides.d.ts +4 -0
- package/dist/site/components/Image3/sdk.d.ts +5 -0
- package/dist/site/components/Image3/sdk.js +105 -0
- package/dist/site/components/LegacyAppWidget/component.d.ts +10 -0
- package/dist/site/components/LegacyAppWidget/component.js +46 -0
- package/dist/site/components/LegacyAppWidget/components/AppWidget.types.d.ts +11 -0
- package/dist/site/components/LegacyAppWidget/components/ResponsiveAppWidget.d.ts +4 -0
- package/dist/site/components/LegacyAppWidget/css.css +3 -0
- package/dist/site/components/LegacyAppWidget/index.d.ts +2 -0
- package/dist/site/components/LegacyAppWidget/index.js +6 -0
- package/dist/site/components/LegacyAppWidget/manifest.d.ts +5 -0
- package/dist/site/components/LegacyAppWidget/manifest.js +42 -0
- package/dist/site/components/LegacyContainer/Container.corvid.d.ts +5 -0
- package/dist/site/components/LegacyContainer/component.d.ts +13 -0
- package/dist/site/components/LegacyContainer/component.js +40 -0
- package/dist/site/components/LegacyContainer/components/Container.semanticClassNames.d.ts +4 -0
- package/dist/site/components/LegacyContainer/components/Container.shared.constants.d.ts +6 -0
- package/dist/site/components/LegacyContainer/components/Container.types.d.ts +77 -0
- package/dist/site/components/LegacyContainer/components/Repeater.semanticClassNames.d.ts +5 -0
- package/dist/site/components/LegacyContainer/components/ResponsiveBox.d.ts +4 -0
- package/dist/site/components/LegacyContainer/components/ResponsiveBoxSkin.d.ts +4 -0
- package/dist/site/components/LegacyContainer/css.css +53 -0
- package/dist/site/components/LegacyContainer/index.d.ts +2 -0
- package/dist/site/components/LegacyContainer/index.js +6 -0
- package/dist/site/components/LegacyContainer/manifest.d.ts +5 -0
- package/dist/site/components/LegacyContainer/manifest.js +45 -0
- package/dist/site/components/LegacyContainer/sdk.d.ts +3 -0
- package/dist/site/components/LegacyContainer/sdk.js +85 -0
- package/dist/site/components/LegacyMultiStateBox/LegacyMultiStateBox.types.d.ts +15 -0
- package/dist/site/components/LegacyMultiStateBox/component.d.ts +4 -0
- package/dist/site/components/LegacyMultiStateBox/component.js +131 -0
- package/dist/site/components/LegacyMultiStateBox/components/MultiStateBox.d.ts +4 -0
- package/dist/site/components/LegacyMultiStateBox/css.css +53 -0
- package/dist/site/components/LegacyMultiStateBox/hooks/index.d.ts +2 -0
- package/dist/site/components/LegacyMultiStateBox/hooks/useDidUpdate.d.ts +1 -0
- package/dist/site/components/LegacyMultiStateBox/hooks/useMSBStates.d.ts +10 -0
- package/dist/site/components/LegacyMultiStateBox/index.d.ts +2 -0
- package/dist/site/components/LegacyMultiStateBox/index.js +6 -0
- package/dist/site/components/LegacyMultiStateBox/manifest.d.ts +5 -0
- package/dist/site/components/LegacyMultiStateBox/manifest.js +48 -0
- package/dist/site/components/LegacyMultiStateBox/sdk.d.ts +6 -0
- package/dist/site/components/LegacyMultiStateBox/sdk.js +164 -0
- package/dist/site/components/Line/Line.semanticClassNames.d.ts +4 -0
- package/dist/site/components/Line/component.d.ts +24 -0
- package/dist/site/components/Line/component.js +60 -0
- package/dist/site/components/Line/component.preview.d.ts +3 -0
- package/dist/site/components/Line/constants.d.ts +102 -0
- package/dist/site/components/Line/css.css +60 -0
- package/dist/site/components/Line/index.d.ts +2 -0
- package/dist/site/components/Line/index.js +6 -0
- package/dist/site/components/Line/manifest.d.ts +5 -0
- package/dist/site/components/Line/manifest.js +799 -0
- package/dist/site/components/Line/manifestConfigs/shapeConfig.d.ts +17 -0
- package/dist/site/components/Line/manifestConfigs/typeConfig.d.ts +16 -0
- package/dist/site/components/Line/panels/format/extension.d.ts +4 -0
- package/dist/site/components/Line/panels/format/panel.d.ts +3 -0
- package/dist/site/components/Line/panels/format/translations/consts.d.ts +7 -0
- package/dist/site/components/LinkBar/LinkBar.d.ts +5 -0
- package/dist/site/components/LinkBar/component.d.ts +2 -0
- package/dist/site/components/LinkBar/component.js +93 -0
- package/dist/site/components/LinkBar/constants.d.ts +57 -0
- package/dist/site/components/LinkBar/css.css +46 -0
- package/dist/site/components/LinkBar/index.d.ts +2 -0
- package/dist/site/components/LinkBar/index.js +6 -0
- package/dist/site/components/LinkBar/manifest.d.ts +5 -0
- package/dist/site/components/LinkBar/manifest.js +230 -0
- package/dist/site/components/LinkBar/panels/orientation/constants.d.ts +5 -0
- package/dist/site/components/LinkBar/panels/orientation/extension.d.ts +4 -0
- package/dist/site/components/LinkBar/panels/orientation/panel.d.ts +3 -0
- package/dist/site/components/LinkBar/panels/orientation/test-utils.d.ts +5 -0
- package/dist/site/components/LinkBar/panels/orientation/translations/consts.d.ts +7 -0
- package/dist/site/components/LinkBar/types.d.ts +23 -0
- package/dist/site/components/Logo/Logo.d.ts +5 -0
- package/dist/site/components/Logo/Logo.semanticClassNames.d.ts +3 -0
- package/dist/site/components/Logo/Logo.types.d.ts +12 -0
- package/dist/site/components/Logo/component.d.ts +2 -0
- package/dist/site/components/Logo/component.js +155 -0
- package/dist/site/components/Logo/constants.d.ts +38 -0
- package/dist/site/components/Logo/css.css +46 -0
- package/dist/site/components/Logo/hooks/index.d.ts +1 -0
- package/dist/site/components/Logo/hooks/useSiteColors.d.ts +5 -0
- package/dist/site/components/Logo/index.d.ts +2 -0
- package/dist/site/components/Logo/index.js +6 -0
- package/dist/site/components/Logo/manifest.d.ts +5 -0
- package/dist/site/components/Logo/manifest.js +103 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/EmptyPanelState.d.ts +15 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/LogoActions.d.ts +18 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/LogoBackgroundRemovalActions.d.ts +17 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/LogoBackgroundRemovalButton.d.ts +8 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/LogoPreview.d.ts +12 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/StatusComponents.d.ts +27 -0
- package/dist/site/components/Logo/panels/customizeLogo/components/index.d.ts +5 -0
- package/dist/site/components/Logo/panels/customizeLogo/extension.d.ts +4 -0
- package/dist/site/components/Logo/panels/customizeLogo/handlers.d.ts +12 -0
- package/dist/site/components/Logo/panels/customizeLogo/hooks.d.ts +2 -0
- package/dist/site/components/Logo/panels/customizeLogo/panel.d.ts +3 -0
- package/dist/site/components/Logo/panels/customizeLogo/translations/consts.d.ts +39 -0
- package/dist/site/components/Logo/panels/customizeLogo/types.d.ts +32 -0
- package/dist/site/components/Logo/panels/customizeLogo/utils.d.ts +105 -0
- package/dist/site/components/Logo/sdk.d.ts +5 -0
- package/dist/site/components/Logo/sdk.js +122 -0
- package/dist/site/components/Lottie/component.d.ts +4 -0
- package/dist/site/components/Lottie/component.js +17219 -0
- package/dist/site/components/Lottie/component.preview.d.ts +5 -0
- package/dist/site/components/Lottie/components/LottieAnimation.d.ts +5 -0
- package/dist/site/components/Lottie/constants.d.ts +78 -0
- package/dist/site/components/Lottie/css.css +187 -0
- package/dist/site/components/Lottie/hooks/useLottie.d.ts +19 -0
- package/dist/site/components/Lottie/index.d.ts +2 -0
- package/dist/site/components/Lottie/index.js +6 -0
- package/dist/site/components/Lottie/manifest.d.ts +5 -0
- package/dist/site/components/Lottie/manifest.js +192 -0
- package/dist/site/components/Lottie/types.d.ts +37 -0
- package/dist/site/components/Menu/Menu.types.d.ts +141 -0
- package/dist/site/components/Menu/animations.d.ts +132 -0
- package/dist/site/components/Menu/component.d.ts +5 -0
- package/dist/site/components/Menu/component.js +2285 -0
- package/dist/site/components/Menu/component.preview.d.ts +11 -0
- package/dist/site/components/Menu/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/site/components/Menu/components/Dropdown/DropdownWrapper.d.ts +11 -0
- package/dist/site/components/Menu/components/Dropdown/index.d.ts +1 -0
- package/dist/site/components/Menu/components/Hamburger/Hamburger.d.ts +3 -0
- package/dist/site/components/Menu/components/Hamburger/index.d.ts +1 -0
- package/dist/site/components/Menu/components/MenuContent/MenuContent.d.ts +4 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/MenuItem.d.ts +3 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/MenuItemDropdownIcon.d.ts +15 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/MenuItemLabel.d.ts +14 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/updateDropdownDomStyles.d.ts +4 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/useAnimationState.d.ts +24 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/useDropdown.d.ts +16 -0
- package/dist/site/components/Menu/components/MenuContent/MenuItem/utils.d.ts +26 -0
- package/dist/site/components/Menu/components/MenuContent/Scroll/scrollTo.d.ts +1 -0
- package/dist/site/components/Menu/components/MenuContent/Scroll/useScroll.d.ts +9 -0
- package/dist/site/components/Menu/components/MenuContent/Scroll/utils.d.ts +7 -0
- package/dist/site/components/Menu/components/MenuContent/ScrollButton/ScrollButton.d.ts +4 -0
- package/dist/site/components/Menu/components/MenuContent/ScrollControls/ScrollControls.d.ts +3 -0
- package/dist/site/components/Menu/components/MenuContent/assets/DropdownIcon.d.ts +2 -0
- package/dist/site/components/Menu/components/Navbar/Navbar.d.ts +3 -0
- package/dist/site/components/Menu/components/Navbar/index.d.ts +1 -0
- package/dist/site/components/Menu/components/Submenu/Submenu.d.ts +4 -0
- package/dist/site/components/Menu/components/Submenu/constants.d.ts +9 -0
- package/dist/site/components/Menu/components/Submenu/types.d.ts +22 -0
- package/dist/site/components/Menu/constants.d.ts +330 -0
- package/dist/site/components/Menu/contexts/DropdownContext.d.ts +7 -0
- package/dist/site/components/Menu/contexts/MenuContext.d.ts +24 -0
- package/dist/site/components/Menu/contexts/MenuItemContext.d.ts +16 -0
- package/dist/site/components/Menu/css.css +1077 -0
- package/dist/site/components/Menu/index.d.ts +2 -0
- package/dist/site/components/Menu/index.js +6 -0
- package/dist/site/components/Menu/manifest.d.ts +5 -0
- package/dist/site/components/Menu/manifest.js +1395 -0
- package/dist/site/components/Menu/manifestConfigs/dropdownConfig.d.ts +250 -0
- package/dist/site/components/Menu/manifestConfigs/dropdownItemConfig.d.ts +2 -0
- package/dist/site/components/Menu/manifestConfigs/dropdownSubItemConfig.d.ts +2 -0
- package/dist/site/components/Menu/manifestConfigs/hamburgerButtonConfig.d.ts +3 -0
- package/dist/site/components/Menu/manifestConfigs/hamburgerMenuConfig.d.ts +2 -0
- package/dist/site/components/Menu/manifestConfigs/index.d.ts +5 -0
- package/dist/site/components/Menu/manifestConfigs/itemConfig.d.ts +2 -0
- package/dist/site/components/Menu/manifestConfigs/navbarConfig.d.ts +2 -0
- package/dist/site/components/Menu/manifestConfigs/overrides/hamburgerMenuConfig.d.ts +7 -0
- package/dist/site/components/Menu/manifestConfigs/overrides/horizontalHugNavbarConfig.d.ts +13 -0
- package/dist/site/components/Menu/manifestConfigs/overrides/horizontalScrollNavbarConfig.d.ts +14 -0
- package/dist/site/components/Menu/manifestConfigs/overrides/verticalNavbarConfig.d.ts +12 -0
- package/dist/site/components/Menu/manifestConfigs/scrollButtonConfig.d.ts +2 -0
- package/dist/site/components/Menu/menuItems.d.ts +4 -0
- package/dist/site/components/Menu/panels/format/constants.d.ts +20 -0
- package/dist/site/components/Menu/panels/format/extension.d.ts +4 -0
- package/dist/site/components/Menu/panels/format/formatPanelTypes.d.ts +11 -0
- package/dist/site/components/Menu/panels/format/options.d.ts +50 -0
- package/dist/site/components/Menu/panels/format/panel.d.ts +3 -0
- package/dist/site/components/Menu/panels/format/presets.d.ts +2 -0
- package/dist/site/components/Menu/panels/format/test-utils.d.ts +5 -0
- package/dist/site/components/Menu/panels/format/translations/consts.d.ts +15 -0
- package/dist/site/components/Menu/sdk.d.ts +3 -0
- package/dist/site/components/Menu/sdk.js +886 -0
- package/dist/site/components/Menu/sdkUtils/errors.d.ts +36 -0
- package/dist/site/components/Menu/sdkUtils/menuUtils.d.ts +17 -0
- package/dist/site/components/Menu/sdkUtils/transformers.d.ts +3 -0
- package/dist/site/components/Menu/sdkUtils/validators/validateMenuItemsDepth.d.ts +2 -0
- package/dist/site/components/Menu/sdkUtils/validators/validateMenuItemsId.d.ts +2 -0
- package/dist/site/components/Menu/sdkUtils/validators/validateMenuItemsTarget.d.ts +2 -0
- package/dist/site/components/Menu/semanticClassNames.d.ts +20 -0
- package/dist/site/components/Menu/utils.d.ts +21 -0
- package/dist/site/components/MultiStateBox/component.d.ts +4 -0
- package/dist/site/components/MultiStateBox/component.js +103 -0
- package/dist/site/components/MultiStateBox/component.preview.d.ts +3 -0
- package/dist/site/components/MultiStateBox/constants.d.ts +17 -0
- package/dist/site/components/MultiStateBox/css.css +13 -0
- package/dist/site/components/MultiStateBox/index.d.ts +2 -0
- package/dist/site/components/MultiStateBox/index.js +6 -0
- package/dist/site/components/MultiStateBox/manifest.d.ts +5 -0
- package/dist/site/components/MultiStateBox/manifest.js +123 -0
- package/dist/site/components/MultiStateBox/types.d.ts +13 -0
- package/dist/site/components/MultiStateBox/utils.d.ts +3 -0
- package/dist/site/components/ProgressBar/ProgressBar.d.ts +20 -0
- package/dist/site/components/ProgressBar/component.d.ts +2 -0
- package/dist/site/components/ProgressBar/component.js +103 -0
- package/dist/site/components/ProgressBar/constants.d.ts +30 -0
- package/dist/site/components/ProgressBar/css.css +43 -0
- package/dist/site/components/ProgressBar/index.d.ts +2 -0
- package/dist/site/components/ProgressBar/index.js +6 -0
- package/dist/site/components/ProgressBar/manifest.d.ts +5 -0
- package/dist/site/components/ProgressBar/manifest.js +149 -0
- package/dist/site/components/ProgressBar/sdk.d.ts +5 -0
- package/dist/site/components/ProgressBar/sdk.js +54 -0
- package/dist/site/components/ProgressBar/utils.d.ts +1 -0
- package/dist/site/components/Repeater/ItemSkeleton.d.ts +2 -0
- package/dist/site/components/Repeater/LiveAnnouncer.d.ts +11 -0
- package/dist/site/components/Repeater/LoadMoreButton.d.ts +8 -0
- package/dist/site/components/Repeater/component.d.ts +5 -0
- package/dist/site/components/Repeater/component.js +498 -0
- package/dist/site/components/Repeater/component.preview.d.ts +5 -0
- package/dist/site/components/Repeater/constants.d.ts +83 -0
- package/dist/site/components/Repeater/css.css +166 -0
- package/dist/site/components/Repeater/hooks/useItemsPerRow.d.ts +2 -0
- package/dist/site/components/Repeater/hooks/useLoadMoreObserver.d.ts +7 -0
- package/dist/site/components/Repeater/index.d.ts +2 -0
- package/dist/site/components/Repeater/index.js +6 -0
- package/dist/site/components/Repeater/manifest.d.ts +5 -0
- package/dist/site/components/Repeater/manifest.js +522 -0
- package/dist/site/components/Repeater/panels/format/extension.d.ts +4 -0
- package/dist/site/components/Repeater/panels/format/panel.d.ts +3 -0
- package/dist/site/components/Repeater/panels/format/translations/consts.d.ts +13 -0
- package/dist/site/components/Repeater/types.d.ts +20 -0
- package/dist/site/components/ShareButtons/Checkmark.d.ts +3 -0
- package/dist/site/components/ShareButtons/CopyButtonIcon.d.ts +4 -0
- package/dist/site/components/ShareButtons/CopyButtonWrapper.d.ts +4 -0
- package/dist/site/components/ShareButtons/ShareButton.d.ts +4 -0
- package/dist/site/components/ShareButtons/ShareButtonIcon.d.ts +4 -0
- package/dist/site/components/ShareButtons/ShareButtons.d.ts +5 -0
- package/dist/site/components/ShareButtons/ShareButtons.types.d.ts +42 -0
- package/dist/site/components/ShareButtons/component.d.ts +4 -0
- package/dist/site/components/ShareButtons/component.js +485 -0
- package/dist/site/components/ShareButtons/component.preview.d.ts +4 -0
- package/dist/site/components/ShareButtons/constants.d.ts +156 -0
- package/dist/site/components/ShareButtons/css.css +150 -0
- package/dist/site/components/ShareButtons/index.d.ts +2 -0
- package/dist/site/components/ShareButtons/index.js +6 -0
- package/dist/site/components/ShareButtons/manifest.d.ts +5 -0
- package/dist/site/components/ShareButtons/manifest.js +356 -0
- package/dist/site/components/ShareButtons/panels/format/constants.d.ts +12 -0
- package/dist/site/components/ShareButtons/panels/format/extension.d.ts +4 -0
- package/dist/site/components/ShareButtons/panels/format/panel.d.ts +3 -0
- package/dist/site/components/ShareButtons/panels/manage/ButtonActions.d.ts +9 -0
- package/dist/site/components/ShareButtons/panels/manage/ButtonItem.d.ts +8 -0
- package/dist/site/components/ShareButtons/panels/manage/ButtonManagementContext.d.ts +27 -0
- package/dist/site/components/ShareButtons/panels/manage/EditModeControls.d.ts +9 -0
- package/dist/site/components/ShareButtons/panels/manage/constants.d.ts +61 -0
- package/dist/site/components/ShareButtons/panels/manage/extension.d.ts +4 -0
- package/dist/site/components/ShareButtons/panels/manage/hooks/useNavigationMode.d.ts +5 -0
- package/dist/site/components/ShareButtons/panels/manage/panel.d.ts +3 -0
- package/dist/site/components/ShareButtons/panels/manage/test-utils.d.ts +7 -0
- package/dist/site/components/ShareButtons/panels/manage/types.d.ts +10 -0
- package/dist/site/components/ShareButtons/panels/translations/consts.d.ts +26 -0
- package/dist/site/components/ShareButtons/utils.d.ts +106 -0
- package/dist/site/components/SiteLogo/SiteLogo.semanticClassNames.d.ts +3 -0
- package/dist/site/components/SiteLogo/SiteLogo.types.d.ts +24 -0
- package/dist/site/components/SiteLogo/component.d.ts +3 -0
- package/dist/site/components/SiteLogo/component.js +68 -0
- package/dist/site/components/SiteLogo/component.preview.d.ts +10 -0
- package/dist/site/components/SiteLogo/css.css +137 -0
- package/dist/site/components/SiteLogo/index.d.ts +2 -0
- package/dist/site/components/SiteLogo/index.js +6 -0
- package/dist/site/components/SiteLogo/manifest.d.ts +5 -0
- package/dist/site/components/SiteLogo/manifest.js +199 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/LogoColorPanel.d.ts +9 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/ResetLogoColorsButton.d.ts +10 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/bi.d.ts +13 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/extension.d.ts +4 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/panel.d.ts +3 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/translations.d.ts +11 -0
- package/dist/site/components/SiteLogo/panels/customizeLogo/utils.d.ts +6 -0
- package/dist/site/components/Slideshow/NavigationButtons.d.ts +14 -0
- package/dist/site/components/Slideshow/PauseButton.d.ts +14 -0
- package/dist/site/components/Slideshow/SlideIndicators.d.ts +16 -0
- package/dist/site/components/Slideshow/Slideshow.d.ts +46 -0
- package/dist/site/components/Slideshow/Slideshow.semanticClassNames.d.ts +8 -0
- package/dist/site/components/Slideshow/assets/PauseIcon.d.ts +2 -0
- package/dist/site/components/Slideshow/assets/PlayIcon.d.ts +2 -0
- package/dist/site/components/Slideshow/component.d.ts +2 -0
- package/dist/site/components/Slideshow/component.js +740 -0
- package/dist/site/components/Slideshow/component.preview.d.ts +5 -0
- package/dist/site/components/Slideshow/constants.d.ts +136 -0
- package/dist/site/components/Slideshow/css.css +587 -0
- package/dist/site/components/Slideshow/index.d.ts +2 -0
- package/dist/site/components/Slideshow/index.js +6 -0
- package/dist/site/components/Slideshow/manifest.d.ts +5 -0
- package/dist/site/components/Slideshow/manifest.js +898 -0
- package/dist/site/components/Slideshow/manifestConfigs/navigationButtons.d.ts +2 -0
- package/dist/site/components/Slideshow/manifestConfigs/slideIndicators.d.ts +2 -0
- package/dist/site/components/Slideshow/sdk.d.ts +2 -0
- package/dist/site/components/Slideshow/sdk.js +5 -0
- package/dist/site/components/Slideshow/types.d.ts +4 -0
- package/dist/site/components/Slideshow/useActiveSlideTracker.d.ts +17 -0
- package/dist/site/components/Slideshow/useSlideIndicators.d.ts +17 -0
- package/dist/site/components/SlotsPlaceholder/SlotsPlaceholder.types.d.ts +7 -0
- package/dist/site/components/SlotsPlaceholder/component.d.ts +4 -0
- package/dist/site/components/SlotsPlaceholder/component.js +32 -0
- package/dist/site/components/SlotsPlaceholder/css.css +9 -0
- package/dist/site/components/SlotsPlaceholder/index.d.ts +2 -0
- package/dist/site/components/SlotsPlaceholder/index.js +6 -0
- package/dist/site/components/SlotsPlaceholder/manifest.d.ts +5 -0
- package/dist/site/components/SlotsPlaceholder/manifest.js +69 -0
- package/dist/site/components/SlotsPlaceholder/sdk.d.ts +2 -0
- package/dist/site/components/SlotsPlaceholder/sdk.js +87 -0
- package/dist/site/components/SlotsPlaceholder/slotsPlaceholderCompFactory.d.ts +2 -0
- package/dist/site/components/SocialPlayerFacebook/SocialPlayerFacebook.semanticClassNames.d.ts +5 -0
- package/dist/site/components/SocialPlayerFacebook/SocialPlayerFacebook.types.d.ts +3 -0
- package/dist/site/components/SocialPlayerFacebook/component.d.ts +3 -0
- package/dist/site/components/SocialPlayerFacebook/component.js +83 -0
- package/dist/site/components/SocialPlayerFacebook/component.preview.d.ts +5 -0
- package/dist/site/components/SocialPlayerFacebook/components/SocialPlayerFacebook.d.ts +4 -0
- package/dist/site/components/SocialPlayerFacebook/components/SocialPlayerFacebook.utils.d.ts +6 -0
- package/dist/site/components/SocialPlayerFacebook/constants.d.ts +1 -0
- package/dist/site/components/SocialPlayerFacebook/css.css +40 -0
- package/dist/site/components/SocialPlayerFacebook/index.d.ts +2 -0
- package/dist/site/components/SocialPlayerFacebook/index.js +6 -0
- package/dist/site/components/SocialPlayerFacebook/manifest.d.ts +5 -0
- package/dist/site/components/SocialPlayerFacebook/manifest.js +147 -0
- package/dist/site/components/SocialPlayerFacebook/panels/settings/extension.d.ts +4 -0
- package/dist/site/components/SocialPlayerFacebook/panels/settings/panel.d.ts +3 -0
- package/dist/site/components/SocialPlayerFacebook/sdk.d.ts +5 -0
- package/dist/site/components/SocialPlayerFacebook/sdk.js +45 -0
- package/dist/site/components/SocialPlayerInstagram/SocialPlayerInstagram.semanticClassNames.d.ts +5 -0
- package/dist/site/components/SocialPlayerInstagram/SocialPlayerInstagram.types.d.ts +3 -0
- package/dist/site/components/SocialPlayerInstagram/component.d.ts +3 -0
- package/dist/site/components/SocialPlayerInstagram/component.js +80 -0
- package/dist/site/components/SocialPlayerInstagram/component.preview.d.ts +5 -0
- package/dist/site/components/SocialPlayerInstagram/components/SocialPlayerInstagram.d.ts +4 -0
- package/dist/site/components/SocialPlayerInstagram/components/SocialPlayerInstagram.utils.d.ts +1 -0
- package/dist/site/components/SocialPlayerInstagram/constants.d.ts +6 -0
- package/dist/site/components/SocialPlayerInstagram/css.css +33 -0
- package/dist/site/components/SocialPlayerInstagram/index.d.ts +2 -0
- package/dist/site/components/SocialPlayerInstagram/index.js +6 -0
- package/dist/site/components/SocialPlayerInstagram/manifest.d.ts +5 -0
- package/dist/site/components/SocialPlayerInstagram/manifest.js +149 -0
- package/dist/site/components/SocialPlayerInstagram/panels/settings/extension.d.ts +4 -0
- package/dist/site/components/SocialPlayerInstagram/panels/settings/panel.d.ts +3 -0
- package/dist/site/components/SocialPlayerInstagram/sdk.d.ts +5 -0
- package/dist/site/components/SocialPlayerInstagram/sdk.js +33 -0
- package/dist/site/components/SocialPlayerShared/SocialPlayersShared.types.d.ts +22 -0
- package/dist/site/components/SocialPlayerShared/panels/settings/SocialPlayerSettingsPanel.d.ts +9 -0
- package/dist/site/components/SocialPlayerShared/panels/settings/translations.d.ts +5 -0
- package/dist/site/components/SocialPlayerShared/previewManifestOverrides.d.ts +4 -0
- package/dist/site/components/SocialPlayerShared/utils.d.ts +2 -0
- package/dist/site/components/SocialPlayerSnapchat/SocialPlayerSnapchat.semanticClassNames.d.ts +4 -0
- package/dist/site/components/SocialPlayerSnapchat/SocialPlayerSnapchat.types.d.ts +3 -0
- package/dist/site/components/SocialPlayerSnapchat/component.d.ts +3 -0
- package/dist/site/components/SocialPlayerSnapchat/component.js +115 -0
- package/dist/site/components/SocialPlayerSnapchat/component.preview.d.ts +5 -0
- package/dist/site/components/SocialPlayerSnapchat/components/SocialPlayerSnapchat.d.ts +4 -0
- package/dist/site/components/SocialPlayerSnapchat/components/getEmbedUrl.d.ts +1 -0
- package/dist/site/components/SocialPlayerSnapchat/constants.d.ts +7 -0
- package/dist/site/components/SocialPlayerSnapchat/css.css +33 -0
- package/dist/site/components/SocialPlayerSnapchat/index.d.ts +2 -0
- package/dist/site/components/SocialPlayerSnapchat/index.js +6 -0
- package/dist/site/components/SocialPlayerSnapchat/manifest.d.ts +5 -0
- package/dist/site/components/SocialPlayerSnapchat/manifest.js +149 -0
- package/dist/site/components/SocialPlayerSnapchat/panels/settings/extension.d.ts +4 -0
- package/dist/site/components/SocialPlayerSnapchat/panels/settings/panel.d.ts +3 -0
- package/dist/site/components/SocialPlayerSnapchat/sdk.d.ts +5 -0
- package/dist/site/components/SocialPlayerSnapchat/sdk.js +39 -0
- package/dist/site/components/SocialPlayerTikTok/SocialPlayerTikTok.semanticClassNames.d.ts +4 -0
- package/dist/site/components/SocialPlayerTikTok/SocialPlayerTikTok.types.d.ts +3 -0
- package/dist/site/components/SocialPlayerTikTok/component.d.ts +3 -0
- package/dist/site/components/SocialPlayerTikTok/component.js +214 -0
- package/dist/site/components/SocialPlayerTikTok/component.preview.d.ts +9 -0
- package/dist/site/components/SocialPlayerTikTok/components/SocialPlayerTikTok.d.ts +4 -0
- package/dist/site/components/SocialPlayerTikTok/components/SocialPlayerTikTok.utils.d.ts +12 -0
- package/dist/site/components/SocialPlayerTikTok/components/hooks/useTikTokPlayerApi.d.ts +11 -0
- package/dist/site/components/SocialPlayerTikTok/components/hooks/useTikTokPlayerApi.types.d.ts +17 -0
- package/dist/site/components/SocialPlayerTikTok/components/hooks/useTikTokPlayerApi.utils.d.ts +2 -0
- package/dist/site/components/SocialPlayerTikTok/constants.d.ts +6 -0
- package/dist/site/components/SocialPlayerTikTok/css.css +32 -0
- package/dist/site/components/SocialPlayerTikTok/index.d.ts +2 -0
- package/dist/site/components/SocialPlayerTikTok/index.js +6 -0
- package/dist/site/components/SocialPlayerTikTok/manifest.d.ts +5 -0
- package/dist/site/components/SocialPlayerTikTok/manifest.js +181 -0
- package/dist/site/components/SocialPlayerTikTok/panels/settings/extension.d.ts +4 -0
- package/dist/site/components/SocialPlayerTikTok/panels/settings/panel.d.ts +3 -0
- package/dist/site/components/SocialPlayerTikTok/sdk.d.ts +5 -0
- package/dist/site/components/SocialPlayerTikTok/sdk.js +75 -0
- package/dist/site/components/SocialPlayerVimeo/SocialPlayerVimeo.semanticClassNames.d.ts +4 -0
- package/dist/site/components/SocialPlayerVimeo/SocialPlayerVimeo.types.d.ts +3 -0
- package/dist/site/components/SocialPlayerVimeo/component.d.ts +3 -0
- package/dist/site/components/SocialPlayerVimeo/component.js +3224 -0
- package/dist/site/components/SocialPlayerVimeo/component.preview.d.ts +9 -0
- package/dist/site/components/SocialPlayerVimeo/components/SocialPlayerVimeo.d.ts +4 -0
- package/dist/site/components/SocialPlayerVimeo/components/hooks/useVimeoPlayer.d.ts +11 -0
- package/dist/site/components/SocialPlayerVimeo/constants.d.ts +2 -0
- package/dist/site/components/SocialPlayerVimeo/css.css +43 -0
- package/dist/site/components/SocialPlayerVimeo/index.d.ts +2 -0
- package/dist/site/components/SocialPlayerVimeo/index.js +6 -0
- package/dist/site/components/SocialPlayerVimeo/manifest.d.ts +5 -0
- package/dist/site/components/SocialPlayerVimeo/manifest.js +184 -0
- package/dist/site/components/SocialPlayerVimeo/panels/settings/extension.d.ts +4 -0
- package/dist/site/components/SocialPlayerVimeo/panels/settings/panel.d.ts +3 -0
- package/dist/site/components/SocialPlayerVimeo/sdk.d.ts +5 -0
- package/dist/site/components/SocialPlayerVimeo/sdk.js +69 -0
- package/dist/site/components/SocialPlayerYoutube/SocialPlayerYoutube.semanticClassNames.d.ts +4 -0
- package/dist/site/components/SocialPlayerYoutube/component.d.ts +3 -0
- package/dist/site/components/SocialPlayerYoutube/component.js +211 -0
- package/dist/site/components/SocialPlayerYoutube/component.preview.d.ts +9 -0
- package/dist/site/components/SocialPlayerYoutube/components/SocialPlayerYoutube.d.ts +5 -0
- package/dist/site/components/SocialPlayerYoutube/components/hooks/useYoutubeIframe.d.ts +14 -0
- package/dist/site/components/SocialPlayerYoutube/components/utils/getIframeUrl.d.ts +2 -0
- package/dist/site/components/SocialPlayerYoutube/components/utils/parseYoutubeUrl.d.ts +5 -0
- package/dist/site/components/SocialPlayerYoutube/constants.d.ts +23 -0
- package/dist/site/components/SocialPlayerYoutube/css.css +39 -0
- package/dist/site/components/SocialPlayerYoutube/index.d.ts +2 -0
- package/dist/site/components/SocialPlayerYoutube/index.js +6 -0
- package/dist/site/components/SocialPlayerYoutube/manifest.d.ts +5 -0
- package/dist/site/components/SocialPlayerYoutube/manifest.js +180 -0
- package/dist/site/components/SocialPlayerYoutube/panels/settings/extension.d.ts +4 -0
- package/dist/site/components/SocialPlayerYoutube/panels/settings/panel.d.ts +3 -0
- package/dist/site/components/SocialPlayerYoutube/sdk.d.ts +5 -0
- package/dist/site/components/SocialPlayerYoutube/sdk.js +75 -0
- package/dist/site/components/SvgImage/SvgImage.types.d.ts +50 -0
- package/dist/site/components/SvgImage/component.d.ts +3 -0
- package/dist/site/components/SvgImage/component.js +43 -0
- package/dist/site/components/SvgImage/component.preview.d.ts +10 -0
- package/dist/site/components/SvgImage/components/SvgImageBase.d.ts +4 -0
- package/dist/site/components/SvgImage/components/SvgImageTint.d.ts +6 -0
- package/dist/site/components/SvgImage/components/semanticClassNames.d.ts +4 -0
- package/dist/site/components/SvgImage/css.css +74 -0
- package/dist/site/components/SvgImage/index.d.ts +2 -0
- package/dist/site/components/SvgImage/index.js +6 -0
- package/dist/site/components/SvgImage/manifest.d.ts +5 -0
- package/dist/site/components/SvgImage/manifest.js +219 -0
- package/dist/site/components/SvgImage/panels/svgColors/Shape/index.d.ts +8 -0
- package/dist/site/components/SvgImage/panels/svgColors/Ugc/index.d.ts +7 -0
- package/dist/site/components/SvgImage/panels/svgColors/VectorArt/index.d.ts +9 -0
- package/dist/site/components/SvgImage/panels/svgColors/common/OpacitySlider.d.ts +7 -0
- package/dist/site/components/SvgImage/panels/svgColors/common/ResetColorsButton.d.ts +7 -0
- package/dist/site/components/SvgImage/panels/svgColors/extension.d.ts +4 -0
- package/dist/site/components/SvgImage/panels/svgColors/panel.d.ts +3 -0
- package/dist/site/components/SvgImage/panels/svgColors/translations/consts.d.ts +8 -0
- package/dist/site/components/SvgImage/panels/svgColors/utils.d.ts +9 -0
- package/dist/site/components/SvgImage/sdk.d.ts +6 -0
- package/dist/site/components/SvgImage/sdk.js +47 -0
- package/dist/site/components/SvgImage/utils.d.ts +13 -0
- package/dist/site/components/Tabs/Tabs.d.ts +34 -0
- package/dist/site/components/Tabs/component.d.ts +1 -0
- package/dist/site/components/Tabs/component.js +532 -0
- package/dist/site/components/Tabs/component.preview.d.ts +5 -0
- package/dist/site/components/Tabs/components/ScrollControls/ScrollControls.d.ts +11 -0
- package/dist/site/components/Tabs/constants.d.ts +28 -0
- package/dist/site/components/Tabs/css.css +286 -0
- package/dist/site/components/Tabs/hooks/useOverflowBehavior.d.ts +1 -0
- package/dist/site/components/Tabs/hooks/useResolvedDirection.d.ts +2 -0
- package/dist/site/components/Tabs/hooks/useTabsKeyboardNavigation.d.ts +16 -0
- package/dist/site/components/Tabs/hooks/useTabsScroll.d.ts +16 -0
- package/dist/site/components/Tabs/hooks/useTabsTransition.d.ts +10 -0
- package/dist/site/components/Tabs/index.d.ts +2 -0
- package/dist/site/components/Tabs/index.js +6 -0
- package/dist/site/components/Tabs/manifest.d.ts +5 -0
- package/dist/site/components/Tabs/manifest.js +668 -0
- package/dist/site/components/Tabs/utils/createTabsA11yIds.d.ts +8 -0
- package/dist/site/components/Tabs/utils/scrollTabs.d.ts +4 -0
- package/dist/site/components/TestComp/TestComp.d.ts +59 -0
- package/dist/site/components/TestComp/TestComp.semanticClassNames.d.ts +7 -0
- package/dist/site/components/TestComp/component.d.ts +3 -0
- package/dist/site/components/TestComp/component.js +205 -0
- package/dist/site/components/TestComp/constants.d.ts +20 -0
- package/dist/site/components/TestComp/css.css +208 -0
- package/dist/site/components/TestComp/index.d.ts +2 -0
- package/dist/site/components/TestComp/index.js +6 -0
- package/dist/site/components/TestComp/manifest.d.ts +5 -0
- package/dist/site/components/TestComp/manifest.js +606 -0
- package/dist/site/components/TextEffects3d/component.d.ts +5 -0
- package/dist/site/components/TextEffects3d/component.js +76 -0
- package/dist/site/components/TextEffects3d/components/TextEffects3d.d.ts +5 -0
- package/dist/site/components/TextEffects3d/constants.d.ts +56 -0
- package/dist/site/components/TextEffects3d/css.css +2393 -0
- package/dist/site/components/TextEffects3d/index.d.ts +2 -0
- package/dist/site/components/TextEffects3d/index.js +6 -0
- package/dist/site/components/TextEffects3d/manifest.d.ts +5 -0
- package/dist/site/components/TextEffects3d/manifest.js +115 -0
- package/dist/site/components/TextEffects3d/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffects3d/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsBauhaus/component.d.ts +5 -0
- package/dist/site/components/TextEffectsBauhaus/component.js +78 -0
- package/dist/site/components/TextEffectsBauhaus/components/TextEffectsBauhaus.d.ts +5 -0
- package/dist/site/components/TextEffectsBauhaus/constants.d.ts +52 -0
- package/dist/site/components/TextEffectsBauhaus/css.css +2416 -0
- package/dist/site/components/TextEffectsBauhaus/index.d.ts +2 -0
- package/dist/site/components/TextEffectsBauhaus/index.js +6 -0
- package/dist/site/components/TextEffectsBauhaus/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsBauhaus/manifest.js +114 -0
- package/dist/site/components/TextEffectsBauhaus/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsBauhaus/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsGlass/TextEffectsGlass.types.d.ts +1 -0
- package/dist/site/components/TextEffectsGlass/component.d.ts +5 -0
- package/dist/site/components/TextEffectsGlass/component.js +119 -0
- package/dist/site/components/TextEffectsGlass/components/TextEffectsGlass.d.ts +5 -0
- package/dist/site/components/TextEffectsGlass/constants.d.ts +58 -0
- package/dist/site/components/TextEffectsGlass/css.css +2414 -0
- package/dist/site/components/TextEffectsGlass/index.d.ts +2 -0
- package/dist/site/components/TextEffectsGlass/index.js +6 -0
- package/dist/site/components/TextEffectsGlass/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsGlass/manifest.js +117 -0
- package/dist/site/components/TextEffectsGlass/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsGlass/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsGlitch/component.d.ts +5 -0
- package/dist/site/components/TextEffectsGlitch/component.js +72 -0
- package/dist/site/components/TextEffectsGlitch/components/TextEffectsGlitch.d.ts +5 -0
- package/dist/site/components/TextEffectsGlitch/constants.d.ts +54 -0
- package/dist/site/components/TextEffectsGlitch/css.css +2476 -0
- package/dist/site/components/TextEffectsGlitch/index.d.ts +2 -0
- package/dist/site/components/TextEffectsGlitch/index.js +6 -0
- package/dist/site/components/TextEffectsGlitch/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsGlitch/manifest.js +149 -0
- package/dist/site/components/TextEffectsGlitch/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsGlitch/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsLetterPress/component.d.ts +5 -0
- package/dist/site/components/TextEffectsLetterPress/component.js +86 -0
- package/dist/site/components/TextEffectsLetterPress/components/TextEffectsLetterPress.d.ts +5 -0
- package/dist/site/components/TextEffectsLetterPress/constants.d.ts +50 -0
- package/dist/site/components/TextEffectsLetterPress/css.css +2415 -0
- package/dist/site/components/TextEffectsLetterPress/index.d.ts +2 -0
- package/dist/site/components/TextEffectsLetterPress/index.js +6 -0
- package/dist/site/components/TextEffectsLetterPress/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsLetterPress/manifest.js +104 -0
- package/dist/site/components/TextEffectsLetterPress/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsLetterPress/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsMatrix/component.d.ts +5 -0
- package/dist/site/components/TextEffectsMatrix/component.js +83 -0
- package/dist/site/components/TextEffectsMatrix/components/TextEffectsMatrix.d.ts +5 -0
- package/dist/site/components/TextEffectsMatrix/constants.d.ts +52 -0
- package/dist/site/components/TextEffectsMatrix/css.css +2428 -0
- package/dist/site/components/TextEffectsMatrix/index.d.ts +2 -0
- package/dist/site/components/TextEffectsMatrix/index.js +6 -0
- package/dist/site/components/TextEffectsMatrix/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsMatrix/manifest.js +140 -0
- package/dist/site/components/TextEffectsMatrix/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsMatrix/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsNeonSign/component.d.ts +5 -0
- package/dist/site/components/TextEffectsNeonSign/component.js +69 -0
- package/dist/site/components/TextEffectsNeonSign/components/TextEffectsNeonSign.d.ts +5 -0
- package/dist/site/components/TextEffectsNeonSign/constants.d.ts +52 -0
- package/dist/site/components/TextEffectsNeonSign/css.css +2453 -0
- package/dist/site/components/TextEffectsNeonSign/index.d.ts +2 -0
- package/dist/site/components/TextEffectsNeonSign/index.js +6 -0
- package/dist/site/components/TextEffectsNeonSign/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsNeonSign/manifest.js +133 -0
- package/dist/site/components/TextEffectsNeonSign/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsNeonSign/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsNoisy/component.d.ts +5 -0
- package/dist/site/components/TextEffectsNoisy/component.js +92 -0
- package/dist/site/components/TextEffectsNoisy/components/TextEffectsNoisy.d.ts +5 -0
- package/dist/site/components/TextEffectsNoisy/constants.d.ts +53 -0
- package/dist/site/components/TextEffectsNoisy/css.css +2381 -0
- package/dist/site/components/TextEffectsNoisy/index.d.ts +2 -0
- package/dist/site/components/TextEffectsNoisy/index.js +6 -0
- package/dist/site/components/TextEffectsNoisy/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsNoisy/manifest.js +90 -0
- package/dist/site/components/TextEffectsNoisy/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsNoisy/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsOutlineOut/component.d.ts +5 -0
- package/dist/site/components/TextEffectsOutlineOut/component.js +141 -0
- package/dist/site/components/TextEffectsOutlineOut/components/TextEffectsOutlineOut.d.ts +5 -0
- package/dist/site/components/TextEffectsOutlineOut/constants.d.ts +55 -0
- package/dist/site/components/TextEffectsOutlineOut/css.css +2409 -0
- package/dist/site/components/TextEffectsOutlineOut/index.d.ts +2 -0
- package/dist/site/components/TextEffectsOutlineOut/index.js +6 -0
- package/dist/site/components/TextEffectsOutlineOut/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsOutlineOut/manifest.js +195 -0
- package/dist/site/components/TextEffectsOutlineOut/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsOutlineOut/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsRetro/component.d.ts +5 -0
- package/dist/site/components/TextEffectsRetro/component.js +107 -0
- package/dist/site/components/TextEffectsRetro/components/TextEffectsRetro.d.ts +5 -0
- package/dist/site/components/TextEffectsRetro/constants.d.ts +56 -0
- package/dist/site/components/TextEffectsRetro/css.css +2514 -0
- package/dist/site/components/TextEffectsRetro/index.d.ts +2 -0
- package/dist/site/components/TextEffectsRetro/index.js +6 -0
- package/dist/site/components/TextEffectsRetro/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsRetro/manifest.js +156 -0
- package/dist/site/components/TextEffectsRetro/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsRetro/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsShared/Link.d.ts +1 -0
- package/dist/site/components/TextEffectsShared/TextEffectsShared.semanticClassNames.d.ts +4 -0
- package/dist/site/components/TextEffectsShared/TextEffectsShared.types.d.ts +52 -0
- package/dist/site/components/TextEffectsShared/components/TextEffectsShared.d.ts +4 -0
- package/dist/site/components/TextEffectsShared/components/patterns/PatternLine.d.ts +7 -0
- package/dist/site/components/TextEffectsShared/components/patterns/PatternUnit.d.ts +11 -0
- package/dist/site/components/TextEffectsShared/components/patterns/Patterns.d.ts +14 -0
- package/dist/site/components/TextEffectsShared/components/patterns/index.d.ts +4 -0
- package/dist/site/components/TextEffectsShared/components/patterns/usePatterns.d.ts +14 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/index.d.ts +2 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/index.d.ts +2 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/parseGrapheme.d.ts +58 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/parseWord.d.ts +77 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/types.d.ts +22 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/utils/constants.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/utils/isVisibleSegment.d.ts +1 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/utils/level-utils.d.ts +2 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/utils/text-splitting.d.ts +1 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/character-analysis.d.ts +11 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/character-mirroring.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/flattening.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/neutral-resolution.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/run-grouping.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/run-reordering.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/word-directionality.d.ts +8 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/parsers/word-parsing-phases/word-segmentation.d.ts +12 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/stringParser.d.ts +7 -0
- package/dist/site/components/TextEffectsShared/components/stringParser/types.d.ts +18 -0
- package/dist/site/components/TextEffectsShared/components/useUniqueSvg.d.ts +5 -0
- package/dist/site/components/TextEffectsShared/constants.d.ts +211 -0
- package/dist/site/components/TextEffectsShared/manifestBase.d.ts +107 -0
- package/dist/site/components/TextEffectsShared/patterns/PatternsPanel.d.ts +3 -0
- package/dist/site/components/TextEffectsShared/patterns/PatternsSection.d.ts +4 -0
- package/dist/site/components/TextEffectsShared/patterns/patterns.config.d.ts +17 -0
- package/dist/site/components/TextEffectsShared/patterns/patterns.constants.d.ts +58 -0
- package/dist/site/components/TextEffectsShared/patterns/patterns.types.d.ts +96 -0
- package/dist/site/components/TextEffectsShared/patterns/translations/consts.d.ts +25 -0
- package/dist/site/components/TextEffectsShared/patterns/usePatternsDataService.d.ts +33 -0
- package/dist/site/components/TextEffectsShared/utils.d.ts +4 -0
- package/dist/site/components/TextEffectsShook/component.d.ts +5 -0
- package/dist/site/components/TextEffectsShook/component.js +135 -0
- package/dist/site/components/TextEffectsShook/components/TextEffectsShook.d.ts +5 -0
- package/dist/site/components/TextEffectsShook/constants.d.ts +68 -0
- package/dist/site/components/TextEffectsShook/css.css +2489 -0
- package/dist/site/components/TextEffectsShook/index.d.ts +2 -0
- package/dist/site/components/TextEffectsShook/index.js +6 -0
- package/dist/site/components/TextEffectsShook/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsShook/manifest.js +140 -0
- package/dist/site/components/TextEffectsShook/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsShook/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsSticker/component.d.ts +5 -0
- package/dist/site/components/TextEffectsSticker/component.js +86 -0
- package/dist/site/components/TextEffectsSticker/components/TextEffectsSticker.d.ts +5 -0
- package/dist/site/components/TextEffectsSticker/constants.d.ts +57 -0
- package/dist/site/components/TextEffectsSticker/css.css +2429 -0
- package/dist/site/components/TextEffectsSticker/index.d.ts +2 -0
- package/dist/site/components/TextEffectsSticker/index.js +6 -0
- package/dist/site/components/TextEffectsSticker/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsSticker/manifest.js +169 -0
- package/dist/site/components/TextEffectsSticker/panels/patterns/extension.d.ts +4 -0
- package/dist/site/components/TextEffectsSticker/panels/patterns/panel.d.ts +2 -0
- package/dist/site/components/TextEffectsStriped/component.d.ts +5 -0
- package/dist/site/components/TextEffectsStriped/component.js +58 -0
- package/dist/site/components/TextEffectsStriped/components/TextEffectsStriped.d.ts +5 -0
- package/dist/site/components/TextEffectsStriped/constants.d.ts +55 -0
- package/dist/site/components/TextEffectsStriped/css.css +117 -0
- package/dist/site/components/TextEffectsStriped/index.d.ts +2 -0
- package/dist/site/components/TextEffectsStriped/index.js +6 -0
- package/dist/site/components/TextEffectsStriped/manifest.d.ts +5 -0
- package/dist/site/components/TextEffectsStriped/manifest.js +125 -0
- package/dist/site/components/TextInput/TextInput.d.ts +8 -0
- package/dist/site/components/TextInput/TextInput.types.d.ts +108 -0
- package/dist/site/components/TextInput/TextInput.viewer.constants.d.ts +24 -0
- package/dist/site/components/TextInput/component.d.ts +1 -0
- package/dist/site/components/TextInput/component.js +1164 -0
- package/dist/site/components/TextInput/constants.d.ts +52 -0
- package/dist/site/components/TextInput/css.css +168 -0
- package/dist/site/components/TextInput/index.d.ts +2 -0
- package/dist/site/components/TextInput/index.js +6 -0
- package/dist/site/components/TextInput/manifest.d.ts +5 -0
- package/dist/site/components/TextInput/manifest.js +503 -0
- package/dist/site/components/TextInput/sdk.d.ts +4 -0
- package/dist/site/components/TextInput/sdk.js +92 -0
- package/dist/site/components/TextInput/utils.d.ts +9 -0
- package/dist/site/components/TextMarquee/TextMarquee.semanticClassNames.d.ts +5 -0
- package/dist/site/components/TextMarquee/TextMarquee.types.d.ts +53 -0
- package/dist/site/components/TextMarquee/component.d.ts +5 -0
- package/dist/site/components/TextMarquee/component.js +410 -0
- package/dist/site/components/TextMarquee/component.preview.d.ts +5 -0
- package/dist/site/components/TextMarquee/components/DomStoreSvg.d.ts +5 -0
- package/dist/site/components/TextMarquee/components/PlayPauseButton.d.ts +11 -0
- package/dist/site/components/TextMarquee/components/TextMarquee.d.ts +4 -0
- package/dist/site/components/TextMarquee/components/constants.d.ts +6 -0
- package/dist/site/components/TextMarquee/consts.d.ts +24 -0
- package/dist/site/components/TextMarquee/css.css +171 -0
- package/dist/site/components/TextMarquee/index.d.ts +2 -0
- package/dist/site/components/TextMarquee/index.js +6 -0
- package/dist/site/components/TextMarquee/manifest.d.ts +5 -0
- package/dist/site/components/TextMarquee/manifest.js +181 -0
- package/dist/site/components/TextMarquee/panels/SeparatorPanel/index.d.ts +11 -0
- package/dist/site/components/TextMarquee/panels/SeparatorPanel/translations/consts.d.ts +12 -0
- package/dist/site/components/TextMarquee/panels/bi/events.d.ts +4 -0
- package/dist/site/components/TextMarquee/panels/bi/utils.d.ts +7 -0
- package/dist/site/components/TextMarquee/panels/common/ColorAndOpacityPicker.d.ts +11 -0
- package/dist/site/components/TextMarquee/panels/common/ShapeSizeSlider.d.ts +10 -0
- package/dist/site/components/TextMarquee/panels/common/SvgMediaPicker.d.ts +12 -0
- package/dist/site/components/TextMarquee/panels/common/types.d.ts +23 -0
- package/dist/site/components/TextMarquee/panels/extension.d.ts +4 -0
- package/dist/site/components/TextMarquee/panels/panel.d.ts +3 -0
- package/dist/site/components/TextMarquee/sdk.d.ts +30 -0
- package/dist/site/components/TextMarquee/sdk.js +87 -0
- package/dist/site/components/TextMarquee/utils.d.ts +1 -0
- package/dist/site/components/TransparentVideo/TransparentVideo.types.d.ts +49 -0
- package/dist/site/components/TransparentVideo/assets/MutedIcon.d.ts +2 -0
- package/dist/site/components/TransparentVideo/assets/NoneThumbnailIcon.d.ts +2 -0
- package/dist/site/components/TransparentVideo/assets/PauseIcon.d.ts +2 -0
- package/dist/site/components/TransparentVideo/assets/PlayIcon.d.ts +2 -0
- package/dist/site/components/TransparentVideo/assets/UnMutedIcon.d.ts +2 -0
- package/dist/site/components/TransparentVideo/component.d.ts +4 -0
- package/dist/site/components/TransparentVideo/component.js +3613 -0
- package/dist/site/components/TransparentVideo/component.preview.d.ts +5 -0
- package/dist/site/components/TransparentVideo/css.css +112 -0
- package/dist/site/components/TransparentVideo/index.d.ts +2 -0
- package/dist/site/components/TransparentVideo/index.js +6 -0
- package/dist/site/components/TransparentVideo/kampos/transparent-video.d.ts +29 -0
- package/dist/site/components/TransparentVideo/kampos/transparentVideoUtils.d.ts +29 -0
- package/dist/site/components/TransparentVideo/manifest.d.ts +5 -0
- package/dist/site/components/TransparentVideo/manifest.js +204 -0
- package/dist/site/components/TransparentVideo/panels/PanelViewCustom.d.ts +12 -0
- package/dist/site/components/TransparentVideo/panels/PanelViewPresets.d.ts +17 -0
- package/dist/site/components/TransparentVideo/panels/RangeInput.d.ts +13 -0
- package/dist/site/components/TransparentVideo/panels/bi/utils.d.ts +2 -0
- package/dist/site/components/TransparentVideo/panels/extension.d.ts +4 -0
- package/dist/site/components/TransparentVideo/panels/panel.d.ts +3 -0
- package/dist/site/components/TransparentVideo/panels/presets.d.ts +3 -0
- package/dist/site/components/TransparentVideo/panels/translation.d.ts +22 -0
- package/dist/site/components/TransparentVideo/svgFilters/svgFilters.d.ts +8 -0
- package/dist/site/components/TransparentVideo/svgFilters/svgFiltersParts.d.ts +16 -0
- package/dist/site/components/TransparentVideo/svgFilters/svgFiltersTemplates.d.ts +6 -0
- package/dist/site/components/TransparentVideo/svgFilters/svgPresets.d.ts +6 -0
- package/dist/site/components/TransparentVideo/svgFilters/typing.d.ts +67 -0
- package/dist/site/components/TransparentVideo/transparentVideoPoster.d.ts +9 -0
- package/dist/site/components/TransparentVideo/useTransparentVideo.d.ts +25 -0
- package/dist/site/components/TransparentVideo/utils.d.ts +8 -0
- package/dist/site/components/VideoUpload/VideoUpload.semanticClassNames.d.ts +5 -0
- package/dist/site/components/VideoUpload/VideoUpload.types.d.ts +38 -0
- package/dist/site/components/VideoUpload/VideoUpload.utils.d.ts +17 -0
- package/dist/site/components/VideoUpload/component.d.ts +3 -0
- package/dist/site/components/VideoUpload/component.js +2274 -0
- package/dist/site/components/VideoUpload/component.preview.d.ts +9 -0
- package/dist/site/components/VideoUpload/components/VideoUpload.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/CheckmarkIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/FullscreenIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/PauseIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/PictureInPictureIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/PlayButtonIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/PlayIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/PlaybackIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/VolumeLoudIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/VolumeMutedIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/assets/VolumeQuiteIcon.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/components/FullscreenToggle/FullscreenToggle.d.ts +9 -0
- package/dist/site/components/VideoUpload/components/components/PictureInPictureToggle/PictureInPictureToggle.d.ts +8 -0
- package/dist/site/components/VideoUpload/components/components/PlayToggle/PlayToggle.d.ts +9 -0
- package/dist/site/components/VideoUpload/components/components/PlaybackControls/PlaybackControls.d.ts +27 -0
- package/dist/site/components/VideoUpload/components/components/PlaybackRate/PlaybackRate.d.ts +8 -0
- package/dist/site/components/VideoUpload/components/components/Popover/Popover.d.ts +13 -0
- package/dist/site/components/VideoUpload/components/components/ProgressBar/ProgressBar.d.ts +11 -0
- package/dist/site/components/VideoUpload/components/components/ProgressBar/ProgressBar.utils.d.ts +13 -0
- package/dist/site/components/VideoUpload/components/components/ProgressBar/index.d.ts +1 -0
- package/dist/site/components/VideoUpload/components/components/Slider/Slider.d.ts +24 -0
- package/dist/site/components/VideoUpload/components/components/Spinner/Spinner.d.ts +4 -0
- package/dist/site/components/VideoUpload/components/components/TimeDisplay/TimeDisplay.d.ts +7 -0
- package/dist/site/components/VideoUpload/components/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/site/components/VideoUpload/components/components/VolumeControl/VolumeControl.d.ts +10 -0
- package/dist/site/components/VideoUpload/components/components/VolumeSlider/VolumeSlider.d.ts +7 -0
- package/dist/site/components/VideoUpload/components/hooks/index.d.ts +1 -0
- package/dist/site/components/VideoUpload/components/hooks/useBuffer.d.ts +10 -0
- package/dist/site/components/VideoUpload/components/hooks/useElementsVisibility.d.ts +14 -0
- package/dist/site/components/VideoUpload/components/hooks/useFullscreen.d.ts +8 -0
- package/dist/site/components/VideoUpload/components/hooks/useKeyboardShortcuts.d.ts +17 -0
- package/dist/site/components/VideoUpload/components/hooks/usePictureInPicture.d.ts +8 -0
- package/dist/site/components/VideoUpload/components/hooks/usePlayback.d.ts +12 -0
- package/dist/site/components/VideoUpload/components/hooks/usePlaybackSettings.d.ts +5 -0
- package/dist/site/components/VideoUpload/components/hooks/useTimingTrap.d.ts +11 -0
- package/dist/site/components/VideoUpload/components/hooks/useVideoPlayer.d.ts +78 -0
- package/dist/site/components/VideoUpload/components/hooks/useVolume.d.ts +11 -0
- package/dist/site/components/VideoUpload/constants.d.ts +9 -0
- package/dist/site/components/VideoUpload/css.css +492 -0
- package/dist/site/components/VideoUpload/index.d.ts +2 -0
- package/dist/site/components/VideoUpload/index.js +6 -0
- package/dist/site/components/VideoUpload/manifest.d.ts +5 -0
- package/dist/site/components/VideoUpload/manifest.js +204 -0
- package/dist/site/components/VideoUpload/panels/CoverImagePanel/index.d.ts +3 -0
- package/dist/site/components/VideoUpload/panels/CoverImagePanel/translations/consts.d.ts +6 -0
- package/dist/site/components/VideoUpload/panels/common/PosterGrid.d.ts +12 -0
- package/dist/site/components/VideoUpload/panels/common/PosterSlot.d.ts +11 -0
- package/dist/site/components/VideoUpload/panels/common/posterHandlers.d.ts +9 -0
- package/dist/site/components/VideoUpload/panels/common/test-utils.d.ts +15 -0
- package/dist/site/components/VideoUpload/panels/common/types.d.ts +30 -0
- package/dist/site/components/VideoUpload/panels/common/usePosterData.d.ts +5 -0
- package/dist/site/components/VideoUpload/panels/common/utils.d.ts +46 -0
- package/dist/site/components/VideoUpload/panels/extension.d.ts +4 -0
- package/dist/site/components/VideoUpload/panels/panel.d.ts +2 -0
- package/dist/site/components/VideoUpload/sdk.d.ts +4 -0
- package/dist/site/components/VideoUpload/sdk.js +761 -0
- package/dist/site/components/WRichText/WRichText.semanticClassNames.d.ts +5 -0
- package/dist/site/components/WRichText/WRichText.types.d.ts +48 -0
- package/dist/site/components/WRichText/component.d.ts +4 -0
- package/dist/site/components/WRichText/component.js +224 -0
- package/dist/site/components/WRichText/components/WRichText.d.ts +4 -0
- package/dist/site/components/WRichText/components/providers/usePopupLinkEvents/index.d.ts +6 -0
- package/dist/site/components/WRichText/constants.d.ts +11 -0
- package/dist/site/components/WRichText/css.css +407 -0
- package/dist/site/components/WRichText/index.d.ts +2 -0
- package/dist/site/components/WRichText/index.js +6 -0
- package/dist/site/components/WRichText/manifest.d.ts +5 -0
- package/dist/site/components/WRichText/manifest.js +165 -0
- package/dist/site/components/WRichText/sdk.d.ts +5 -0
- package/dist/site/components/WRichText/sdk.js +581 -0
- package/dist/site/components/WRichText/utils/applyTransformationForGetHtml.d.ts +8 -0
- package/dist/site/components/WRichText/utils/convertLinkProperties.d.ts +2 -0
- package/dist/site/components/WRichText/utils/decodeHtmlEntities.d.ts +2 -0
- package/dist/site/components/WRichText/utils/escape.d.ts +28 -0
- package/dist/site/components/WRichText/utils/flow.d.ts +1 -0
- package/dist/site/components/WRichText/utils/htmlEntitiesMap.d.ts +29 -0
- package/dist/site/components/WRichText/utils/htmlParser.d.ts +15 -0
- package/dist/site/components/WRichText/utils/index.d.ts +9 -0
- package/dist/site/components/WRichText/utils/insertIntoDOMNode.d.ts +11 -0
- package/dist/site/components/WRichText/utils/namedReferenceRegex.d.ts +2 -0
- package/dist/site/components/WRichText/utils/numericEntitiesMap.d.ts +31 -0
- package/dist/site/components/WRichText/utils/removeWixGuard.d.ts +1 -0
- package/dist/site/components/WRichText/utils/stripImpliedLinks.d.ts +1 -0
- package/dist/site/components/WRichText/utils/unescape.d.ts +19 -0
- package/dist/site/components/chunks/AnimatedIcon.js +155 -0
- package/dist/site/components/chunks/Button.js +328 -0
- package/dist/site/components/chunks/Button.types.js +7 -0
- package/dist/site/components/chunks/Group.js +1317 -0
- package/dist/site/components/chunks/I18nProvider.js +95 -0
- package/dist/site/components/chunks/Image.js +159 -0
- package/dist/site/components/chunks/Link.js +127 -0
- package/dist/site/components/chunks/LinkSdk.js +31 -0
- package/dist/site/components/chunks/Patterns.js +1243 -0
- package/dist/site/components/chunks/ResponsiveBox.js +150 -0
- package/dist/site/components/chunks/ResponsiveContainer.js +77 -0
- package/dist/site/components/chunks/Slideshow.semanticClassNames.js +144 -0
- package/dist/site/components/chunks/SvgImageTint.js +201 -0
- package/dist/site/components/chunks/TextEffectsShared.js +112 -0
- package/dist/site/components/chunks/TransparentVideo.types.js +32 -0
- package/dist/site/components/chunks/Video.js +477 -0
- package/dist/site/components/chunks/_commonjsHelpers.js +8 -0
- package/dist/site/components/chunks/a11y.js +120 -0
- package/dist/site/components/chunks/a11ySdk.js +18 -0
- package/dist/site/components/chunks/assert.js +73 -0
- package/dist/site/components/chunks/basePropsSDKFactory.js +41 -0
- package/dist/site/components/chunks/childrenPropsSDKFactory.js +10 -0
- package/dist/site/components/chunks/chunk-JPMZBG44.js +5592 -0
- package/dist/site/components/chunks/classNames.js +17 -0
- package/dist/site/components/chunks/clsx.js +14 -0
- package/dist/site/components/chunks/composeSDKFactories.js +29 -0
- package/dist/site/components/chunks/constants.js +19 -0
- package/dist/site/components/chunks/constants10.js +26 -0
- package/dist/site/components/chunks/constants11.js +24 -0
- package/dist/site/components/chunks/constants12.js +28 -0
- package/dist/site/components/chunks/constants13.js +31 -0
- package/dist/site/components/chunks/constants14.js +26 -0
- package/dist/site/components/chunks/constants15.js +28 -0
- package/dist/site/components/chunks/constants16.js +24 -0
- package/dist/site/components/chunks/constants17.js +59 -0
- package/dist/site/components/chunks/constants18.js +61 -0
- package/dist/site/components/chunks/constants19.js +310 -0
- package/dist/site/components/chunks/constants2.js +22 -0
- package/dist/site/components/chunks/constants20.js +48 -0
- package/dist/site/components/chunks/constants21.js +37 -0
- package/dist/site/components/chunks/constants22.js +22 -0
- package/dist/site/components/chunks/constants23.js +408 -0
- package/dist/site/components/chunks/constants24.js +88 -0
- package/dist/site/components/chunks/constants25.js +23 -0
- package/dist/site/components/chunks/constants26.js +54 -0
- package/dist/site/components/chunks/constants27.js +33 -0
- package/dist/site/components/chunks/constants28.js +15 -0
- package/dist/site/components/chunks/constants29.js +69 -0
- package/dist/site/components/chunks/constants3.js +31 -0
- package/dist/site/components/chunks/constants30.js +87 -0
- package/dist/site/components/chunks/constants31.js +91 -0
- package/dist/site/components/chunks/constants32.js +72 -0
- package/dist/site/components/chunks/constants4.js +31 -0
- package/dist/site/components/chunks/constants5.js +30 -0
- package/dist/site/components/chunks/constants6.js +30 -0
- package/dist/site/components/chunks/constants7.js +73 -0
- package/dist/site/components/chunks/constants8.js +28 -0
- package/dist/site/components/chunks/constants9.js +26 -0
- package/dist/site/components/chunks/consts.js +98 -0
- package/dist/site/components/chunks/corvidEvents.js +666 -0
- package/dist/site/components/chunks/createCorvidModel.js +767 -0
- package/dist/site/components/chunks/customElementInit.js +644 -0
- package/dist/site/components/chunks/dataUtils.js +39 -0
- package/dist/site/components/chunks/direction.module.js +7 -0
- package/dist/site/components/chunks/elementPropsSDKFactory.js +984 -0
- package/dist/site/components/chunks/elementSdk.js +29 -0
- package/dist/site/components/chunks/filterDOMProps.js +479 -0
- package/dist/site/components/chunks/hls.js +31861 -0
- package/dist/site/components/chunks/index.js +54 -0
- package/dist/site/components/chunks/index10.js +54 -0
- package/dist/site/components/chunks/index11.js +16 -0
- package/dist/site/components/chunks/index12.js +6 -0
- package/dist/site/components/chunks/index2.js +5 -0
- package/dist/site/components/chunks/index3.js +1465 -0
- package/dist/site/components/chunks/index4.js +2372 -0
- package/dist/site/components/chunks/index5.js +16 -0
- package/dist/site/components/chunks/index6.js +15 -0
- package/dist/site/components/chunks/index7.js +24 -0
- package/dist/site/components/chunks/index8.js +69 -0
- package/dist/site/components/chunks/index9.js +2023 -0
- package/dist/site/components/chunks/isObjectLike.js +119 -0
- package/dist/site/components/chunks/manifest.js +8 -0
- package/dist/site/components/chunks/manifestBase.js +152 -0
- package/dist/site/components/chunks/manifestSdkMixins.js +80 -0
- package/dist/site/components/chunks/mediaSrcHandler.js +324 -0
- package/dist/site/components/chunks/messages.js +419 -0
- package/dist/site/components/chunks/parseHtml.js +11 -0
- package/dist/site/components/chunks/parseSvg.js +12 -0
- package/dist/site/components/chunks/performanceUtils.js +33 -0
- package/dist/site/components/chunks/presetWrapper.module.js +7 -0
- package/dist/site/components/chunks/reporters.js +12 -0
- package/dist/site/components/chunks/sanitizeHTML.js +1381 -0
- package/dist/site/components/chunks/specs.js +4 -0
- package/dist/site/components/chunks/stylePropsSDKFactory.js +828 -0
- package/dist/site/components/chunks/svg.js +98 -0
- package/dist/site/components/chunks/types.impl.js +2934 -0
- package/dist/site/components/chunks/useConsentPolicyProps.js +2356 -0
- package/dist/site/components/chunks/useResizeObserver.js +22 -0
- package/dist/site/components/chunks/useUniqueSvg.js +48 -0
- package/dist/site/components/chunks/utils.js +11 -0
- package/dist/site/components/chunks/utils2.js +302 -0
- package/dist/site/components/extensions.d.ts +6 -0
- package/dist/site/components/extensions.js +587 -0
- package/package.json +187 -0
|
@@ -0,0 +1,3613 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useRef, useState, useEffect, useMemo, useCallback } from "react";
|
|
3
|
+
import { F as FilterEffectType, V as VideoStartType, a as VideoEndType, b as VideoPlayingState } from "../chunks/TransparentVideo.types.js";
|
|
4
|
+
import { S as STATIC_MEDIA_URL } from "../chunks/index3.js";
|
|
5
|
+
import { c as clsx } from "../chunks/clsx.js";
|
|
6
|
+
import { V as Video } from "../chunks/Video.js";
|
|
7
|
+
import { p as parse } from "../chunks/index4.js";
|
|
8
|
+
function getSepia(amount) {
|
|
9
|
+
return `${0.393 + 0.607 * (1 - amount)} ${0.769 - 0.769 * (1 - amount)} ${0.189 - 0.189 * (1 - amount)} 0 0
|
|
10
|
+
${0.349 - 0.349 * (1 - amount)} ${0.686 + 0.314 * (1 - amount)} ${0.168 - 0.168 * (1 - amount)} 0 0
|
|
11
|
+
${0.272 - 0.272 * (1 - amount)} ${0.534 - 0.534 * (1 - amount)} ${0.131 + 0.869 * (1 - amount)} 0 0
|
|
12
|
+
0 0 0 1 0`;
|
|
13
|
+
}
|
|
14
|
+
function getContrast(amount) {
|
|
15
|
+
return `<feFuncR type="linear" slope="${amount}" intercept="${Math.round((-0.5 * amount + 0.5) * 100) / 100}"/>
|
|
16
|
+
<feFuncG type="linear" slope="${amount}" intercept="${Math.round((-0.5 * amount + 0.5) * 100) / 100}"/>
|
|
17
|
+
<feFuncB type="linear" slope="${amount}" intercept="${Math.round((-0.5 * amount + 0.5) * 100) / 100}"/>`;
|
|
18
|
+
}
|
|
19
|
+
function getBrightness(amount) {
|
|
20
|
+
return `<feFuncR type="linear" slope="${amount}" /><feFuncG type="linear" slope="${amount}" /><feFuncB type="linear" slope="${amount}" />`;
|
|
21
|
+
}
|
|
22
|
+
function getTint(color2) {
|
|
23
|
+
return `${1 - color2.r} 0 0 0 ${color2.r} ${1 - color2.g} 0 0 0 ${color2.g} ${1 - color2.b} 0 0 0 ${color2.b} 0 0 0 1 0`;
|
|
24
|
+
}
|
|
25
|
+
function getLumaMatrix(whiteParams, blackParams) {
|
|
26
|
+
return `${whiteParams.r} 0 0 0 ${blackParams.r}
|
|
27
|
+
${whiteParams.g} 1 0 0 ${blackParams.g}
|
|
28
|
+
${whiteParams.b} 0 1 0 ${blackParams.b}
|
|
29
|
+
0 0 0 1 0`;
|
|
30
|
+
}
|
|
31
|
+
function getColor(color2, opacity = 1) {
|
|
32
|
+
return `0 0 0 0 ${color2.r}
|
|
33
|
+
0 0 0 0 ${color2.g}
|
|
34
|
+
0 0 0 0 ${color2.b}
|
|
35
|
+
0 0 0 ${opacity} 0`;
|
|
36
|
+
}
|
|
37
|
+
function getDoutone(light, dark) {
|
|
38
|
+
const r_diff = light.r - dark.r;
|
|
39
|
+
const g_diff = light.g - dark.g;
|
|
40
|
+
const b_diff = light.b - dark.b;
|
|
41
|
+
return `${r_diff} 0 0 0 ${dark.r} ${g_diff} 0 0 0 ${dark.g} ${b_diff} 0 0 0 ${dark.b} 0 0 0 1 0`;
|
|
42
|
+
}
|
|
43
|
+
function getAlpha(amount) {
|
|
44
|
+
return `<feFuncA type="linear" slope="${amount}" />`;
|
|
45
|
+
}
|
|
46
|
+
function hexToRgb(hex) {
|
|
47
|
+
const [, r, g, b] = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
48
|
+
return {
|
|
49
|
+
r: parseInt(r, 16),
|
|
50
|
+
g: parseInt(g, 16),
|
|
51
|
+
b: parseInt(b, 16)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function hex2RgbNorm(hex) {
|
|
55
|
+
const { r, g, b } = hexToRgb(hex);
|
|
56
|
+
return {
|
|
57
|
+
r: r / 255,
|
|
58
|
+
g: g / 255,
|
|
59
|
+
b: b / 255
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function attrToString(key, value) {
|
|
63
|
+
return value || value === 0 ? `${key}="${value}"` : "";
|
|
64
|
+
}
|
|
65
|
+
function attrsObjectToString(attrs) {
|
|
66
|
+
return Object.keys(attrs).map((key) => attrToString(key, attrs[key])).join(" ");
|
|
67
|
+
}
|
|
68
|
+
function filterWrapperTemplate({ id, content, attrs = {} }) {
|
|
69
|
+
return `<filter id="${id}" color-interpolation-filters="sRGB" ${attrsObjectToString(attrs)}>
|
|
70
|
+
<feComponentTransfer result="srcRGB"/>
|
|
71
|
+
${content}
|
|
72
|
+
<feComponentTransfer/>
|
|
73
|
+
</filter>`;
|
|
74
|
+
}
|
|
75
|
+
function identity({ inAttr }) {
|
|
76
|
+
return `<feColorMatrix ${attrToString("in", inAttr)}/>`;
|
|
77
|
+
}
|
|
78
|
+
function contrast({ value }) {
|
|
79
|
+
return `<feComponentTransfer>${getContrast(value)}</feComponentTransfer>`;
|
|
80
|
+
}
|
|
81
|
+
function brightness({ value, result }) {
|
|
82
|
+
return `<feComponentTransfer ${attrToString("result", result)}>${getBrightness(value)}</feComponentTransfer>`;
|
|
83
|
+
}
|
|
84
|
+
function saturation({ value, inAttr, result }) {
|
|
85
|
+
return `<feColorMatrix type="saturate" values="${value}" ${inAttr ? `in="${inAttr}"` : ""}${result ? `result="${result}"` : ""}/>`;
|
|
86
|
+
}
|
|
87
|
+
function sepia({ value }) {
|
|
88
|
+
return `<feColorMatrix type="matrix" values="${getSepia(value)}"/>`;
|
|
89
|
+
}
|
|
90
|
+
function hue({ value }) {
|
|
91
|
+
return `<feColorMatrix type="hueRotate" values="${value}"/>`;
|
|
92
|
+
}
|
|
93
|
+
function color({ value, inAttr, result }) {
|
|
94
|
+
const hexColor = typeof value === "string" ? value : value.color;
|
|
95
|
+
const opacity = typeof value === "object" && typeof value.opacity !== "undefined" ? value.opacity : 1;
|
|
96
|
+
return `<feColorMatrix type="matrix" values="${getColor(hex2RgbNorm(hexColor), opacity)}" ${inAttr ? `in="${inAttr}"` : ""}${result ? `result="${result}"` : ""}/>`;
|
|
97
|
+
}
|
|
98
|
+
function tint({ value }) {
|
|
99
|
+
return `<feColorMatrix type="matrix" values="${getTint(hex2RgbNorm(value))}"/>`;
|
|
100
|
+
}
|
|
101
|
+
function blur({ value, inAttr }) {
|
|
102
|
+
return `<feGaussianBlur stdDeviation="${value}" ${inAttr ? `in="${inAttr}"` : ""}/>`;
|
|
103
|
+
}
|
|
104
|
+
function alpha({ value, inAttr, result }) {
|
|
105
|
+
return `<feComponentTransfer ${attrToString("in", inAttr)} ${attrToString("result", result)}>${getAlpha(
|
|
106
|
+
value
|
|
107
|
+
)}</feComponentTransfer>`;
|
|
108
|
+
}
|
|
109
|
+
function offset({ value, inAttr, result }) {
|
|
110
|
+
return `<feOffset dx="${value.x}" dy="${value.y}" ${inAttr ? `in="${inAttr}"` : ""}${result ? `result="${result}"` : ""}/>`;
|
|
111
|
+
}
|
|
112
|
+
function blend$1({ value, inAttr, in2Attr, result }) {
|
|
113
|
+
return `<feBlend mode="${value}" in="${inAttr}" in2="${in2Attr}" ${attrToString("result", result)}/>`;
|
|
114
|
+
}
|
|
115
|
+
function composite({ value, inAttr, in2Attr, result }) {
|
|
116
|
+
return `<feComposite operator="${value}" in="${inAttr}" in2="${in2Attr}" ${attrToString("result", result)}/>`;
|
|
117
|
+
}
|
|
118
|
+
function duotone$1({ value: { dark, light }, inAttr, result }) {
|
|
119
|
+
return `${saturation({ value: 0 })}
|
|
120
|
+
<feColorMatrix type="matrix" values="${getDoutone(hex2RgbNorm(light), hex2RgbNorm(dark))}" ${inAttr ? `in="${inAttr}"` : ""}${result ? `result="${result}"` : ""}/>`;
|
|
121
|
+
}
|
|
122
|
+
function luma({ value: { dark, light }, result }) {
|
|
123
|
+
return `<feColorMatrix type="matrix" values="${getLumaMatrix(light, dark)}" ${result ? `result="${result}"` : ""}/>`;
|
|
124
|
+
}
|
|
125
|
+
function shadow({ value: { blurRadius, mergeGraphic, ...rest } }) {
|
|
126
|
+
return `${blur({ value: blurRadius, inAttr: "SourceAlpha" })}
|
|
127
|
+
${offset({ value: rest })}
|
|
128
|
+
${color({ value: rest })}
|
|
129
|
+
${mergeGraphic ? `<feMerge>
|
|
130
|
+
<feMergeNode/>
|
|
131
|
+
<feMergeNode in="SourceGraphic"/>
|
|
132
|
+
</feMerge>` : ""}`;
|
|
133
|
+
}
|
|
134
|
+
const filterComponentTempaltesWithNumber = {
|
|
135
|
+
blur,
|
|
136
|
+
saturation,
|
|
137
|
+
contrast,
|
|
138
|
+
brightness,
|
|
139
|
+
sepia,
|
|
140
|
+
hue,
|
|
141
|
+
alpha
|
|
142
|
+
};
|
|
143
|
+
const filterComponentTempaltesWithString = {
|
|
144
|
+
blend: blend$1,
|
|
145
|
+
color,
|
|
146
|
+
composite,
|
|
147
|
+
tint
|
|
148
|
+
};
|
|
149
|
+
const filterComponentTempaltes = {
|
|
150
|
+
duotone: duotone$1,
|
|
151
|
+
shadow,
|
|
152
|
+
color,
|
|
153
|
+
offset
|
|
154
|
+
};
|
|
155
|
+
function getFilterValue(key, value, overrides) {
|
|
156
|
+
if (key === "duotone") {
|
|
157
|
+
return {
|
|
158
|
+
light: "duotoneLight" in overrides && overrides.duotoneLight || value.light,
|
|
159
|
+
dark: "duotoneDark" in overrides && overrides.duotoneDark || value.dark
|
|
160
|
+
};
|
|
161
|
+
} else if (key in overrides) {
|
|
162
|
+
return overrides[key];
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
function interpolate(id, filterDefinition, overrides, attrs) {
|
|
167
|
+
const content = filterDefinition.map((effect) => {
|
|
168
|
+
const { key, value } = effect;
|
|
169
|
+
const filterValue = getFilterValue(key, value, overrides);
|
|
170
|
+
const arg = { ...effect, value: filterValue };
|
|
171
|
+
if (typeof filterValue === "number") {
|
|
172
|
+
return filterComponentTempaltesWithNumber[key](
|
|
173
|
+
arg
|
|
174
|
+
);
|
|
175
|
+
} else if (typeof filterValue === "string") {
|
|
176
|
+
return filterComponentTempaltesWithString[key](
|
|
177
|
+
arg
|
|
178
|
+
);
|
|
179
|
+
} else if (key === "luma") {
|
|
180
|
+
return luma(arg);
|
|
181
|
+
} else if (key === "identity") {
|
|
182
|
+
return identity(arg);
|
|
183
|
+
} else {
|
|
184
|
+
return filterComponentTempaltes[key](
|
|
185
|
+
arg
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}).join("\n");
|
|
189
|
+
return filterWrapperTemplate({ id, content, attrs });
|
|
190
|
+
}
|
|
191
|
+
const filterPresets = {
|
|
192
|
+
normal: [{ key: "identity", inAttr: "SourceGraphic" }],
|
|
193
|
+
ink: [
|
|
194
|
+
{ key: "sepia", value: 0.3 },
|
|
195
|
+
{ key: "contrast", value: 1.5 },
|
|
196
|
+
{ key: "brightness", value: 1.1 },
|
|
197
|
+
{ key: "saturation", value: 0 }
|
|
198
|
+
],
|
|
199
|
+
kennedy: [
|
|
200
|
+
{ key: "saturation", value: 0 },
|
|
201
|
+
{ key: "contrast", value: 1.1 },
|
|
202
|
+
{ key: "brightness", value: 0.9 }
|
|
203
|
+
],
|
|
204
|
+
feathered: [
|
|
205
|
+
{ key: "saturation", value: 0.2 },
|
|
206
|
+
{ key: "contrast", value: 0.85 },
|
|
207
|
+
{ key: "brightness", value: 0.9 },
|
|
208
|
+
{ key: "tint", value: "#171212" }
|
|
209
|
+
],
|
|
210
|
+
blur: [{ key: "blur", value: 2 }],
|
|
211
|
+
whistler: [
|
|
212
|
+
{
|
|
213
|
+
key: "color",
|
|
214
|
+
value: "#ffffff",
|
|
215
|
+
inAttr: "SourceGraphic",
|
|
216
|
+
result: "color"
|
|
217
|
+
},
|
|
218
|
+
{ key: "alpha", value: 0.4, inAttr: "color", result: "flood_alpha" },
|
|
219
|
+
{ key: "blur", value: 1.8, inAttr: "srcRGB" },
|
|
220
|
+
{ key: "alpha", value: 0.6, result: "blur_alpha" },
|
|
221
|
+
{
|
|
222
|
+
key: "blend",
|
|
223
|
+
value: "normal",
|
|
224
|
+
inAttr: "blur_alpha",
|
|
225
|
+
in2Attr: "srcRGB",
|
|
226
|
+
result: "source_blur"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
key: "blend",
|
|
230
|
+
value: "overlay",
|
|
231
|
+
inAttr: "flood_alpha",
|
|
232
|
+
in2Attr: "source_blur"
|
|
233
|
+
},
|
|
234
|
+
{ key: "brightness", value: 1.1 },
|
|
235
|
+
{ key: "contrast", value: 0.9 },
|
|
236
|
+
{ key: "saturation", value: 0.6 }
|
|
237
|
+
],
|
|
238
|
+
"3d": [
|
|
239
|
+
{ key: "color", value: "#00ffff", inAttr: "srcRGB", result: "color1" },
|
|
240
|
+
{
|
|
241
|
+
key: "blend",
|
|
242
|
+
value: "lighten",
|
|
243
|
+
inAttr: "color1",
|
|
244
|
+
in2Attr: "srcRGB",
|
|
245
|
+
result: "image_color1"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: "offset",
|
|
249
|
+
value: { x: -3, y: 0 },
|
|
250
|
+
inAttr: "image_color1",
|
|
251
|
+
result: "image_color1_offset"
|
|
252
|
+
},
|
|
253
|
+
{ key: "color", value: "#ff0000", inAttr: "srcRGB", result: "color2" },
|
|
254
|
+
{
|
|
255
|
+
key: "blend",
|
|
256
|
+
value: "lighten",
|
|
257
|
+
inAttr: "color2",
|
|
258
|
+
in2Attr: "srcRGB",
|
|
259
|
+
result: "image_color2"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
key: "offset",
|
|
263
|
+
value: { x: 3, y: 0 },
|
|
264
|
+
inAttr: "image_color2",
|
|
265
|
+
result: "image_color2_offset"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
key: "blend",
|
|
269
|
+
value: "darken",
|
|
270
|
+
inAttr: "image_color1_offset",
|
|
271
|
+
in2Attr: "image_color2_offset"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
blueray: [
|
|
275
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
276
|
+
{
|
|
277
|
+
key: "color",
|
|
278
|
+
value: "#1b00ff",
|
|
279
|
+
inAttr: "SourceGraphic",
|
|
280
|
+
result: "color"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
key: "blend",
|
|
284
|
+
value: "multiply",
|
|
285
|
+
inAttr: "color",
|
|
286
|
+
in2Attr: "grayscale"
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
lighten: [
|
|
290
|
+
{ key: "color", value: "#ffffff", inAttr: "srcRGB", result: "color" },
|
|
291
|
+
{ key: "alpha", value: 0.46, inAttr: "color", result: "color_alpha" },
|
|
292
|
+
{
|
|
293
|
+
key: "composite",
|
|
294
|
+
value: "over",
|
|
295
|
+
inAttr: "color_alpha",
|
|
296
|
+
in2Attr: "srcRGB"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
darken: [
|
|
300
|
+
{ key: "brightness", value: 0.4, result: "brightness" },
|
|
301
|
+
{
|
|
302
|
+
key: "blend",
|
|
303
|
+
value: "darken",
|
|
304
|
+
inAttr: "brightness",
|
|
305
|
+
in2Attr: "SourceGraphic"
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
pinkrinse: [
|
|
309
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
310
|
+
{
|
|
311
|
+
key: "color",
|
|
312
|
+
value: "#9a1a77",
|
|
313
|
+
inAttr: "SourceGraphic",
|
|
314
|
+
result: "color"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
key: "blend",
|
|
318
|
+
value: "multiply",
|
|
319
|
+
inAttr: "grayscale",
|
|
320
|
+
in2Attr: "color"
|
|
321
|
+
}
|
|
322
|
+
],
|
|
323
|
+
redrum: [
|
|
324
|
+
{ key: "contrast", value: 0.75 },
|
|
325
|
+
{ key: "brightness", value: 1.2 },
|
|
326
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
327
|
+
{
|
|
328
|
+
key: "color",
|
|
329
|
+
value: "#f26552",
|
|
330
|
+
inAttr: "SourceGraphic",
|
|
331
|
+
result: "color"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
key: "blend",
|
|
335
|
+
value: "multiply",
|
|
336
|
+
inAttr: "grayscale",
|
|
337
|
+
in2Attr: "color"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
greenwash: [
|
|
341
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
342
|
+
{
|
|
343
|
+
key: "color",
|
|
344
|
+
value: "#1c9784",
|
|
345
|
+
inAttr: "SourceGraphic",
|
|
346
|
+
result: "color"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
key: "blend",
|
|
350
|
+
value: "multiply",
|
|
351
|
+
inAttr: "color",
|
|
352
|
+
in2Attr: "grayscale"
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
yellowstreak: [
|
|
356
|
+
{ key: "contrast", value: 2 },
|
|
357
|
+
{ key: "brightness", value: 1.1 },
|
|
358
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
359
|
+
{ key: "color", value: "#ffd200", result: "color" },
|
|
360
|
+
{
|
|
361
|
+
key: "blend",
|
|
362
|
+
value: "multiply",
|
|
363
|
+
inAttr: "grayscale",
|
|
364
|
+
in2Attr: "color"
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
neonsky: [
|
|
368
|
+
{ key: "contrast", value: 0.8 },
|
|
369
|
+
{ key: "duotone", value: { dark: "#800033", light: "#fff200" } },
|
|
370
|
+
{
|
|
371
|
+
key: "luma",
|
|
372
|
+
value: {
|
|
373
|
+
dark: { r: 0, g: -0.1, b: 0 },
|
|
374
|
+
light: { r: 1.2, g: 0, b: 0 }
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
seaweed: [{ key: "duotone", value: { dark: "#0b00e9", light: "#00d980" } }],
|
|
379
|
+
soledad: [
|
|
380
|
+
{ key: "brightness", value: 1.1 },
|
|
381
|
+
{ key: "contrast", value: 0.9 },
|
|
382
|
+
{ key: "saturation", value: 0.8, result: "saturation" },
|
|
383
|
+
{
|
|
384
|
+
key: "color",
|
|
385
|
+
value: "#fce8d3",
|
|
386
|
+
inAttr: "SourceGraphic",
|
|
387
|
+
result: "color1"
|
|
388
|
+
},
|
|
389
|
+
{ key: "alpha", value: 0.15, inAttr: "color1", result: "color_alpha" },
|
|
390
|
+
{
|
|
391
|
+
key: "blend",
|
|
392
|
+
value: "multiply",
|
|
393
|
+
inAttr: "color_alpha",
|
|
394
|
+
in2Attr: "saturation",
|
|
395
|
+
result: "source"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
key: "color",
|
|
399
|
+
value: "#fc9f1a",
|
|
400
|
+
inAttr: "SourceGraphic",
|
|
401
|
+
result: "color2"
|
|
402
|
+
},
|
|
403
|
+
{ key: "alpha", value: 0.23, inAttr: "color2", result: "color_alpha2" },
|
|
404
|
+
{
|
|
405
|
+
key: "blend",
|
|
406
|
+
value: "multiply",
|
|
407
|
+
inAttr: "color_alpha2",
|
|
408
|
+
in2Attr: "source"
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
sangria: [
|
|
412
|
+
{ key: "brightness", value: 0.95 },
|
|
413
|
+
{ key: "contrast", value: 1.35 },
|
|
414
|
+
{ key: "saturation", value: 0.5, result: "saturation" },
|
|
415
|
+
{
|
|
416
|
+
key: "color",
|
|
417
|
+
value: "#c712e2",
|
|
418
|
+
inAttr: "SourceGraphic",
|
|
419
|
+
result: "color"
|
|
420
|
+
},
|
|
421
|
+
{ key: "alpha", value: 0.08, inAttr: "color", result: "color_alpha" },
|
|
422
|
+
{
|
|
423
|
+
key: "blend",
|
|
424
|
+
value: "multiply",
|
|
425
|
+
inAttr: "color_alpha",
|
|
426
|
+
in2Attr: "saturation",
|
|
427
|
+
result: "source"
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
malibu: [
|
|
431
|
+
{ key: "contrast", value: 0.8 },
|
|
432
|
+
{ key: "duotone", value: { dark: "#0045d6", light: "#ffdbc0" } }
|
|
433
|
+
],
|
|
434
|
+
candyfloss: [
|
|
435
|
+
{ key: "contrast", value: 0.8 },
|
|
436
|
+
{ key: "duotone", value: { dark: "#ff0000", light: "#ff9bff" } }
|
|
437
|
+
],
|
|
438
|
+
elmo: [
|
|
439
|
+
{ key: "contrast", value: 0.8 },
|
|
440
|
+
{ key: "duotone", value: { dark: "#ff0000", light: "#cadccc" } }
|
|
441
|
+
],
|
|
442
|
+
unicorn: [
|
|
443
|
+
{ key: "contrast", value: 0.8 },
|
|
444
|
+
{ key: "duotone", value: { dark: "#409ca5", light: "#dfb1bd" } }
|
|
445
|
+
],
|
|
446
|
+
kerouac: [{ key: "duotone", value: { dark: "#37312e", light: "#b5a8a2" } }],
|
|
447
|
+
koolaid: [{ key: "duotone", value: { dark: "#5f00ad", light: "#fdcec1" } }],
|
|
448
|
+
hydra: [{ key: "duotone", value: { dark: "#f72b3e", light: "#ffeced" } }],
|
|
449
|
+
pixie: [{ key: "duotone", value: { dark: "#85d3de", light: "#ffe1d5" } }],
|
|
450
|
+
nightrain: [{ key: "duotone", value: { dark: "#2f3c6d", light: "#8e96b5" } }],
|
|
451
|
+
bauhaus: [{ key: "duotone", value: { dark: "#002787", light: "#e8e8e8" } }],
|
|
452
|
+
neptune: [{ key: "duotone", value: { dark: "#0a7eff", light: "#e5defa" } }],
|
|
453
|
+
orca: [
|
|
454
|
+
{ key: "saturation", value: 0.2 },
|
|
455
|
+
{ key: "contrast", value: 0.85 },
|
|
456
|
+
{ key: "brightness", value: 0.9 },
|
|
457
|
+
{ key: "tint", value: "#2b524c" }
|
|
458
|
+
],
|
|
459
|
+
manhattan: [
|
|
460
|
+
{ key: "saturation", value: 0.2 },
|
|
461
|
+
{ key: "contrast", value: 0.85 },
|
|
462
|
+
{ key: "brightness", value: 0.9 },
|
|
463
|
+
{ key: "tint", value: "#211c0f" }
|
|
464
|
+
],
|
|
465
|
+
goldie: [
|
|
466
|
+
{ key: "saturation", value: 0.2 },
|
|
467
|
+
{ key: "contrast", value: 0.85 },
|
|
468
|
+
{ key: "brightness", value: 0.9 },
|
|
469
|
+
{ key: "tint", value: "#a6966e" }
|
|
470
|
+
],
|
|
471
|
+
flamingo: [
|
|
472
|
+
{ key: "saturation", value: 0.2 },
|
|
473
|
+
{ key: "contrast", value: 0.85 },
|
|
474
|
+
{ key: "brightness", value: 0.9 },
|
|
475
|
+
{ key: "tint", value: "#ff4283" }
|
|
476
|
+
],
|
|
477
|
+
faded: [
|
|
478
|
+
{ key: "saturation", value: 0.2 },
|
|
479
|
+
{ key: "contrast", value: 0.85 },
|
|
480
|
+
{ key: "brightness", value: 0.9 },
|
|
481
|
+
{ key: "tint", value: "#dcdddc" }
|
|
482
|
+
],
|
|
483
|
+
gotham: [
|
|
484
|
+
{ key: "brightness", value: 0.95 },
|
|
485
|
+
{ key: "contrast", value: 1.35 },
|
|
486
|
+
{ key: "saturation", value: 0.5, result: "saturation" },
|
|
487
|
+
{
|
|
488
|
+
key: "color",
|
|
489
|
+
value: "#93676f",
|
|
490
|
+
inAttr: "SourceGraphic",
|
|
491
|
+
result: "color"
|
|
492
|
+
},
|
|
493
|
+
{ key: "alpha", value: 0.08, inAttr: "color", result: "color_alpha" },
|
|
494
|
+
{
|
|
495
|
+
key: "blend",
|
|
496
|
+
value: "multiply",
|
|
497
|
+
inAttr: "color_alpha",
|
|
498
|
+
in2Attr: "saturation",
|
|
499
|
+
result: "source"
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
hulk: [
|
|
503
|
+
{ key: "contrast", value: 0.75 },
|
|
504
|
+
{ key: "brightness", value: 1.2 },
|
|
505
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
506
|
+
{
|
|
507
|
+
key: "color",
|
|
508
|
+
value: "#b5c900",
|
|
509
|
+
inAttr: "SourceGraphic",
|
|
510
|
+
result: "color"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
key: "blend",
|
|
514
|
+
value: "multiply",
|
|
515
|
+
inAttr: "grayscale",
|
|
516
|
+
in2Attr: "color"
|
|
517
|
+
}
|
|
518
|
+
],
|
|
519
|
+
midnight: [
|
|
520
|
+
{ key: "contrast", value: 0.75 },
|
|
521
|
+
{ key: "brightness", value: 1.2 },
|
|
522
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
523
|
+
{
|
|
524
|
+
key: "color",
|
|
525
|
+
value: "#00254b",
|
|
526
|
+
inAttr: "SourceGraphic",
|
|
527
|
+
result: "color"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
key: "blend",
|
|
531
|
+
value: "multiply",
|
|
532
|
+
inAttr: "grayscale",
|
|
533
|
+
in2Attr: "color"
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
lucille: [
|
|
537
|
+
{ key: "contrast", value: 0.75 },
|
|
538
|
+
{ key: "brightness", value: 1.2 },
|
|
539
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
540
|
+
{
|
|
541
|
+
key: "color",
|
|
542
|
+
value: "#d60000",
|
|
543
|
+
inAttr: "SourceGraphic",
|
|
544
|
+
result: "color"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
key: "blend",
|
|
548
|
+
value: "multiply",
|
|
549
|
+
inAttr: "grayscale",
|
|
550
|
+
in2Attr: "color"
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
organic: [
|
|
554
|
+
{ key: "contrast", value: 0.75 },
|
|
555
|
+
{ key: "brightness", value: 1.2 },
|
|
556
|
+
{ key: "saturation", value: 0, result: "grayscale" },
|
|
557
|
+
{
|
|
558
|
+
key: "color",
|
|
559
|
+
value: "#debda5",
|
|
560
|
+
inAttr: "SourceGraphic",
|
|
561
|
+
result: "color"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
key: "blend",
|
|
565
|
+
value: "multiply",
|
|
566
|
+
inAttr: "grayscale",
|
|
567
|
+
in2Attr: "color"
|
|
568
|
+
}
|
|
569
|
+
],
|
|
570
|
+
grayscale: [
|
|
571
|
+
{ key: "brightness", value: 1 },
|
|
572
|
+
{ key: "contrast", value: 1 },
|
|
573
|
+
{ key: "duotone", value: { dark: "#000000", light: "#ffffff" } }
|
|
574
|
+
],
|
|
575
|
+
tvDuotone: [
|
|
576
|
+
{ key: "brightness", value: 0.9 },
|
|
577
|
+
{ key: "contrast", value: 1.5 },
|
|
578
|
+
{ key: "duotone", value: { dark: "@color_23", light: "@color_18" } }
|
|
579
|
+
],
|
|
580
|
+
tvMonotoneDark: [
|
|
581
|
+
{ key: "brightness", value: 1.2 },
|
|
582
|
+
{ key: "contrast", value: 1 },
|
|
583
|
+
{ key: "duotone", value: { dark: "#000000", light: "@color_8" } }
|
|
584
|
+
],
|
|
585
|
+
tvMonotoneLight: [
|
|
586
|
+
{ key: "brightness", value: 1 },
|
|
587
|
+
{ key: "contrast", value: 1 },
|
|
588
|
+
{ key: "duotone", value: { dark: "@color_8", light: "#ffffff" } }
|
|
589
|
+
],
|
|
590
|
+
tvHue: [
|
|
591
|
+
{ key: "hue", value: -60 },
|
|
592
|
+
{ key: "saturation", value: 1 }
|
|
593
|
+
]
|
|
594
|
+
};
|
|
595
|
+
function getFilter(id, name, overrides, attrs) {
|
|
596
|
+
const filter = filterPresets[name] || [];
|
|
597
|
+
return interpolate(id, filter, overrides || {}, attrs);
|
|
598
|
+
}
|
|
599
|
+
const getFilterEffectString = (id, filterEffect) => {
|
|
600
|
+
if (!filterEffect) return "";
|
|
601
|
+
return getFilter(id, `${filterEffect.effectType}`, {
|
|
602
|
+
...filterEffect
|
|
603
|
+
}, {});
|
|
604
|
+
};
|
|
605
|
+
const removeMediaPrefix = (uri) => {
|
|
606
|
+
if (uri.startsWith("media/")) {
|
|
607
|
+
return uri.replace(/^media\//, "");
|
|
608
|
+
}
|
|
609
|
+
if (uri.startsWith("/media/")) {
|
|
610
|
+
return uri.replace(/^\/media\//, "");
|
|
611
|
+
}
|
|
612
|
+
return uri;
|
|
613
|
+
};
|
|
614
|
+
const formatPosterUrl = (uri, width, height) => {
|
|
615
|
+
if (!uri) {
|
|
616
|
+
return void 0;
|
|
617
|
+
}
|
|
618
|
+
if (uri.startsWith("http")) {
|
|
619
|
+
return uri;
|
|
620
|
+
}
|
|
621
|
+
const normalizedUri = removeMediaPrefix(uri);
|
|
622
|
+
return `${STATIC_MEDIA_URL}${normalizedUri}`;
|
|
623
|
+
};
|
|
624
|
+
const SVG_FILTER_ID_PREFIX = "svg_filter_";
|
|
625
|
+
const replaceCompIdPlaceholder = (str, compId) => str.replace(/<%= compId %>/g, compId);
|
|
626
|
+
const getActiveFilterEffect = (props) => {
|
|
627
|
+
return props.filterEffectRecolorVideo ? getFilterEffectData(props) : void 0;
|
|
628
|
+
};
|
|
629
|
+
const sanitizeString = (value) => value == null ? void 0 : value.replace(/[<>]/g, "");
|
|
630
|
+
const getFilterEffectData = (props) => {
|
|
631
|
+
const effectTypeObj = {
|
|
632
|
+
effectType: props.effectType,
|
|
633
|
+
isCustom: props.isCustom
|
|
634
|
+
};
|
|
635
|
+
if (props.effectType === FilterEffectType.tvHue) {
|
|
636
|
+
effectTypeObj.hue = props == null ? void 0 : props.hue;
|
|
637
|
+
effectTypeObj.saturation = props == null ? void 0 : props.saturation;
|
|
638
|
+
} else {
|
|
639
|
+
effectTypeObj.duotoneDark = sanitizeString(props == null ? void 0 : props.duotoneDark);
|
|
640
|
+
effectTypeObj.duotoneLight = sanitizeString(props == null ? void 0 : props.duotoneLight);
|
|
641
|
+
effectTypeObj.brightness = props.brightness;
|
|
642
|
+
effectTypeObj.contrast = props.contrast;
|
|
643
|
+
}
|
|
644
|
+
return effectTypeObj;
|
|
645
|
+
};
|
|
646
|
+
const closeSelfClosingSvgTags = (svg) => {
|
|
647
|
+
return svg.replace(
|
|
648
|
+
/<([a-zA-Z][\w:-]*)([^>]*)\/>/g,
|
|
649
|
+
"<$1$2></$1>"
|
|
650
|
+
);
|
|
651
|
+
};
|
|
652
|
+
function alphaMask({ isLuminance = false } = {}) {
|
|
653
|
+
return {
|
|
654
|
+
vertex: {
|
|
655
|
+
attribute: {
|
|
656
|
+
a_alphaMaskTexCoord: "vec2"
|
|
657
|
+
},
|
|
658
|
+
main: `
|
|
659
|
+
v_alphaMaskTexCoord = a_alphaMaskTexCoord;`
|
|
660
|
+
},
|
|
661
|
+
fragment: {
|
|
662
|
+
uniform: {
|
|
663
|
+
u_alphaMaskEnabled: "bool",
|
|
664
|
+
u_alphaMaskIsLuminance: "bool",
|
|
665
|
+
u_mask: "sampler2D"
|
|
666
|
+
},
|
|
667
|
+
main: `
|
|
668
|
+
if (u_alphaMaskEnabled) {
|
|
669
|
+
vec4 alphaMaskPixel = texture2D(u_mask, v_alphaMaskTexCoord);
|
|
670
|
+
|
|
671
|
+
if (u_alphaMaskIsLuminance) {
|
|
672
|
+
alpha *= dot(lumcoeff, alphaMaskPixel.rgb) * alphaMaskPixel.a;
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
alpha *= alphaMaskPixel.a;
|
|
676
|
+
}
|
|
677
|
+
}`
|
|
678
|
+
},
|
|
679
|
+
get disabled() {
|
|
680
|
+
return !this.uniforms[0].data[0];
|
|
681
|
+
},
|
|
682
|
+
set disabled(b) {
|
|
683
|
+
this.uniforms[0].data[0] = +!b;
|
|
684
|
+
},
|
|
685
|
+
get mask() {
|
|
686
|
+
return this.textures[0].data;
|
|
687
|
+
},
|
|
688
|
+
set mask(img) {
|
|
689
|
+
this.textures[0].data = img;
|
|
690
|
+
},
|
|
691
|
+
get isLuminance() {
|
|
692
|
+
return !!this.uniforms[2].data[0];
|
|
693
|
+
},
|
|
694
|
+
set isLuminance(toggle) {
|
|
695
|
+
this.uniforms[2].data[0] = +toggle;
|
|
696
|
+
this.textures[0].format = toggle ? "RGBA" : "ALPHA";
|
|
697
|
+
},
|
|
698
|
+
varying: {
|
|
699
|
+
v_alphaMaskTexCoord: "vec2"
|
|
700
|
+
},
|
|
701
|
+
uniforms: [
|
|
702
|
+
{
|
|
703
|
+
name: "u_alphaMaskEnabled",
|
|
704
|
+
type: "i",
|
|
705
|
+
data: [1]
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
name: "u_mask",
|
|
709
|
+
type: "i",
|
|
710
|
+
data: [1]
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
name: "u_alphaMaskIsLuminance",
|
|
714
|
+
type: "i",
|
|
715
|
+
data: [+!!isLuminance]
|
|
716
|
+
}
|
|
717
|
+
],
|
|
718
|
+
attributes: [
|
|
719
|
+
{
|
|
720
|
+
name: "a_alphaMaskTexCoord",
|
|
721
|
+
extends: "a_texCoord"
|
|
722
|
+
}
|
|
723
|
+
],
|
|
724
|
+
textures: [
|
|
725
|
+
{
|
|
726
|
+
format: isLuminance ? "RGBA" : "ALPHA"
|
|
727
|
+
}
|
|
728
|
+
]
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
function deformation({
|
|
732
|
+
radius,
|
|
733
|
+
wrap = WRAP_METHODS$1.WRAP,
|
|
734
|
+
deformation: deformation2 = DEFORMATION_METHODS.NONE
|
|
735
|
+
} = {}) {
|
|
736
|
+
const dataRadius = radius || 0;
|
|
737
|
+
return {
|
|
738
|
+
fragment: {
|
|
739
|
+
uniform: {
|
|
740
|
+
u_deformationEnabled: "bool",
|
|
741
|
+
u_radius: "float"
|
|
742
|
+
},
|
|
743
|
+
source: `
|
|
744
|
+
float _aspectRatio = u_resolution.x / u_resolution.y;
|
|
745
|
+
vec2 _position = u_mouse;
|
|
746
|
+
vec2 diff = sourceCoord - _position;
|
|
747
|
+
float dist = diff.x * diff.x * _aspectRatio * _aspectRatio + diff.y * diff.y;
|
|
748
|
+
float r = sqrt(dist);
|
|
749
|
+
bool isInsideDeformation = dist < u_radius * u_radius;
|
|
750
|
+
|
|
751
|
+
if (u_deformationEnabled) {
|
|
752
|
+
if (isInsideDeformation) {
|
|
753
|
+
vec2 dispVec = diff;
|
|
754
|
+
float a = atan(diff.y, diff.x);
|
|
755
|
+
${deformation2}
|
|
756
|
+
dispVec = dispVec + _position;
|
|
757
|
+
${wrap}
|
|
758
|
+
sourceCoord = dispVec;
|
|
759
|
+
}
|
|
760
|
+
}`
|
|
761
|
+
// main: `
|
|
762
|
+
// if (isInsideDeformation) {
|
|
763
|
+
// color = mix(color, texture2D(u_source, v_texCoord).rgb, vec3(pow(r / u_radius, 4.0)));
|
|
764
|
+
// }`,
|
|
765
|
+
},
|
|
766
|
+
get disabled() {
|
|
767
|
+
return !this.uniforms[0].data[0];
|
|
768
|
+
},
|
|
769
|
+
set disabled(b) {
|
|
770
|
+
this.uniforms[0].data[0] = +!b;
|
|
771
|
+
},
|
|
772
|
+
get radius() {
|
|
773
|
+
return this.uniforms[1].data[0];
|
|
774
|
+
},
|
|
775
|
+
set radius(r) {
|
|
776
|
+
if (typeof r !== "undefined") this.uniforms[1].data[0] = r;
|
|
777
|
+
},
|
|
778
|
+
uniforms: [
|
|
779
|
+
{
|
|
780
|
+
name: "u_deformationEnabled",
|
|
781
|
+
type: "i",
|
|
782
|
+
data: [1]
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
name: "u_radius",
|
|
786
|
+
type: "f",
|
|
787
|
+
data: [dataRadius]
|
|
788
|
+
}
|
|
789
|
+
]
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
const WRAP_METHODS$1 = {
|
|
793
|
+
CLAMP: `dispVec = clamp(dispVec, 0.0, 1.0);`,
|
|
794
|
+
DISCARD: `if (dispVec.x < 0.0 || dispVec.x > 1.0 || dispVec.y > 1.0 || dispVec.y < 0.0) { discard; }`,
|
|
795
|
+
WRAP: `dispVec = mod(dispVec, 1.0);`
|
|
796
|
+
};
|
|
797
|
+
deformation.CLAMP = WRAP_METHODS$1.CLAMP;
|
|
798
|
+
deformation.DISCARD = WRAP_METHODS$1.DISCARD;
|
|
799
|
+
deformation.WRAP = WRAP_METHODS$1.WRAP;
|
|
800
|
+
const DEFORMATION_METHODS = {
|
|
801
|
+
NONE: ``,
|
|
802
|
+
TUNNEL: `dispVec = vec2(dispVec.x * cos(r + r) - dispVec.y * sin(r + r), dispVec.y * cos(r + r) + dispVec.x * sin(r + r));`,
|
|
803
|
+
SOMETHING: `dispVec = vec2(0.3 / (10.0 * r + dispVec.x), 0.5 * a / PI);`,
|
|
804
|
+
SOMETHING2: `dispVec = vec2(0.02 * dispVec.y + 0.03 * cos(a) / r, 0.02 * dispVec.x + 0.03 * sin(a) / r);`,
|
|
805
|
+
INVERT: `dispVec = dispVec * -1.0;`,
|
|
806
|
+
SCALE: `dispVec = dispVec * 0.75;`,
|
|
807
|
+
MAGNIFY: `dispVec = dispVec * (pow(2.0, r / u_radius) - 1.0);`,
|
|
808
|
+
UNMAGNIFY: `dispVec = dispVec * (pow(2.0, min(u_radius / r, 4.0)));`
|
|
809
|
+
};
|
|
810
|
+
deformation.NONE = DEFORMATION_METHODS.NONE;
|
|
811
|
+
deformation.TUNNEL = DEFORMATION_METHODS.TUNNEL;
|
|
812
|
+
deformation.SOMETHING = DEFORMATION_METHODS.SOMETHING;
|
|
813
|
+
deformation.SOMETHING2 = DEFORMATION_METHODS.SOMETHING2;
|
|
814
|
+
deformation.INVERT = DEFORMATION_METHODS.INVERT;
|
|
815
|
+
deformation.SCALE = DEFORMATION_METHODS.SCALE;
|
|
816
|
+
deformation.MAGNIFY = DEFORMATION_METHODS.MAGNIFY;
|
|
817
|
+
deformation.UNMAGNIFY = DEFORMATION_METHODS.UNMAGNIFY;
|
|
818
|
+
const MODES_AUX = {
|
|
819
|
+
blend_luminosity: `float blend_luminosity (vec3 c) {
|
|
820
|
+
return dot(c, blendLum);
|
|
821
|
+
}`,
|
|
822
|
+
blend_saturation: `float blend_saturation (vec3 c) {
|
|
823
|
+
return max(max(c.r, c.g), c.b) - min(min(c.r, c.g), c.b);
|
|
824
|
+
}`,
|
|
825
|
+
blend_set_luminosity: `vec3 blend_clip_color (vec3 c) {
|
|
826
|
+
float l = blend_luminosity(c);
|
|
827
|
+
float cMin = min(min(c.r, c.g), c.b);
|
|
828
|
+
float cMax = max(max(c.r, c.g), c.b);
|
|
829
|
+
|
|
830
|
+
if (cMin < 0.0)
|
|
831
|
+
return l + (((c - l) * l) / (l - cMin));
|
|
832
|
+
if (cMax > 1.0)
|
|
833
|
+
return l + (((c - l) * (1.0 - l)) / (cMax - l));
|
|
834
|
+
|
|
835
|
+
return c;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
vec3 blend_set_luminosity (vec3 c, float l) {
|
|
839
|
+
vec3 delta = vec3(l - blend_luminosity(c));
|
|
840
|
+
|
|
841
|
+
return blend_clip_color(vec3(c.rgb + delta.rgb));
|
|
842
|
+
}`,
|
|
843
|
+
blend_set_saturation: `
|
|
844
|
+
float getBlendMid (vec3 c) {
|
|
845
|
+
float bigger = max(c.r, c.g);
|
|
846
|
+
|
|
847
|
+
if (bigger < c.b) {
|
|
848
|
+
return bigger;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
float smaller = min(c.r, c.g);
|
|
852
|
+
|
|
853
|
+
if (c.b < smaller) {
|
|
854
|
+
return smaller;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
return c.b;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
vec3 blend_set_saturation (vec3 c, float s) {
|
|
861
|
+
if (s == 0.0) return vec3(0.0);
|
|
862
|
+
|
|
863
|
+
float cMax = max(max(c.r, c.g), c.b);
|
|
864
|
+
float cMid = getBlendMid(c);
|
|
865
|
+
float cMin = min(min(c.r, c.g), c.b);
|
|
866
|
+
float r, g, b;
|
|
867
|
+
|
|
868
|
+
cMid = (((cMid - cMin) * s) / (cMax - cMin));
|
|
869
|
+
cMax = s;
|
|
870
|
+
cMin = 0.0;
|
|
871
|
+
|
|
872
|
+
if (c.r > c.g) {
|
|
873
|
+
// r > g
|
|
874
|
+
if (c.b > c.r) {
|
|
875
|
+
// g < r < b
|
|
876
|
+
g = cMin;
|
|
877
|
+
r = cMid;
|
|
878
|
+
b = cMax;
|
|
879
|
+
}
|
|
880
|
+
else if (c.g > c.b) {
|
|
881
|
+
// b < g < r
|
|
882
|
+
b = cMin;
|
|
883
|
+
g = cMid;
|
|
884
|
+
r = cMax;
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
// g < b < r
|
|
888
|
+
g = cMin;
|
|
889
|
+
b = cMid;
|
|
890
|
+
r = cMax;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
// g > r
|
|
894
|
+
else if (c.g > c.b) {
|
|
895
|
+
// g > b
|
|
896
|
+
if (c.b > c.r) {
|
|
897
|
+
// r < b < g
|
|
898
|
+
r = cMin;
|
|
899
|
+
b = cMid;
|
|
900
|
+
g = cMax;
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
// b < r < g
|
|
904
|
+
b = cMin;
|
|
905
|
+
r = cMid;
|
|
906
|
+
g = cMax;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
// r < g < b
|
|
911
|
+
r = cMin;
|
|
912
|
+
g = cMid;
|
|
913
|
+
b = cMax;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
return vec3(r, g, b);
|
|
917
|
+
}`
|
|
918
|
+
};
|
|
919
|
+
const MODES_CONSTANT = {
|
|
920
|
+
normal: "",
|
|
921
|
+
multiply: "",
|
|
922
|
+
screen: "",
|
|
923
|
+
overlay: `float blend_overlay (float b, float c) {
|
|
924
|
+
if (b <= 0.5)
|
|
925
|
+
return 2.0 * b * c;
|
|
926
|
+
else
|
|
927
|
+
return 1.0 - 2.0 * ((1.0 - b) * (1.0 - c));
|
|
928
|
+
}`,
|
|
929
|
+
darken: "",
|
|
930
|
+
lighten: "",
|
|
931
|
+
colorDodge: `float blend_colorDodge (float b, float c) {
|
|
932
|
+
if (b == 0.0)
|
|
933
|
+
return 0.0;
|
|
934
|
+
else if (c == 1.0)
|
|
935
|
+
return 1.0;
|
|
936
|
+
else
|
|
937
|
+
return min(1.0, b / (1.0 - c));
|
|
938
|
+
}`,
|
|
939
|
+
colorBurn: `float blend_colorBurn (float b, float c) {
|
|
940
|
+
if (b == 1.0) {
|
|
941
|
+
return 1.0;
|
|
942
|
+
}
|
|
943
|
+
else if (c == 0.0) {
|
|
944
|
+
return 0.0;
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
return 1.0 - min(1.0, (1.0 - b) / c);
|
|
948
|
+
}
|
|
949
|
+
}`,
|
|
950
|
+
hardLight: `float blend_hardLight (float b, float c) {
|
|
951
|
+
if (c <= 0.5) {
|
|
952
|
+
return 2.0 * b * c;
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
return 1.0 - 2.0 * ((1.0 - b) * (1.0 - c));
|
|
956
|
+
}
|
|
957
|
+
}`,
|
|
958
|
+
softLight: `float blend_softLight (float b, float c) {
|
|
959
|
+
if (c <= 0.5) {
|
|
960
|
+
return b - (1.0 - 2.0 * c) * b * (1.0 - b);
|
|
961
|
+
}
|
|
962
|
+
else {
|
|
963
|
+
float d;
|
|
964
|
+
|
|
965
|
+
if (b <= 0.25) {
|
|
966
|
+
d = ((16.0 * b - 12.0) * b + 4.0) * b;
|
|
967
|
+
}
|
|
968
|
+
else {
|
|
969
|
+
d = sqrt(b);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
return b + (2.0 * c - 1.0) * (d - b);
|
|
973
|
+
}
|
|
974
|
+
}`,
|
|
975
|
+
difference: `float blend_difference (float b, float c) {
|
|
976
|
+
return abs(b - c);
|
|
977
|
+
}`,
|
|
978
|
+
exclusion: `float blend_exclusion (float b, float c) {
|
|
979
|
+
return b + c - 2.0 * b * c;
|
|
980
|
+
}`,
|
|
981
|
+
hue: `${MODES_AUX.blend_luminosity}
|
|
982
|
+
${MODES_AUX.blend_saturation}
|
|
983
|
+
${MODES_AUX.blend_set_saturation}
|
|
984
|
+
${MODES_AUX.blend_set_luminosity}`,
|
|
985
|
+
saturation: `${MODES_AUX.blend_luminosity}
|
|
986
|
+
${MODES_AUX.blend_saturation}
|
|
987
|
+
${MODES_AUX.blend_set_saturation}
|
|
988
|
+
${MODES_AUX.blend_set_luminosity}`,
|
|
989
|
+
color: `${MODES_AUX.blend_luminosity}
|
|
990
|
+
${MODES_AUX.blend_set_luminosity}`,
|
|
991
|
+
luminosity: `${MODES_AUX.blend_luminosity}
|
|
992
|
+
${MODES_AUX.blend_set_luminosity}`
|
|
993
|
+
};
|
|
994
|
+
function generateBlendVector(name) {
|
|
995
|
+
return `vec3(${name}(backdrop.r, source.r), ${name}(backdrop.g, source.g), ${name}(backdrop.b, source.b))`;
|
|
996
|
+
}
|
|
997
|
+
const MODES_MAIN = {
|
|
998
|
+
normal: "source",
|
|
999
|
+
multiply: "source * backdrop",
|
|
1000
|
+
screen: "backdrop + source - backdrop * source",
|
|
1001
|
+
overlay: generateBlendVector("blend_overlay"),
|
|
1002
|
+
darken: generateBlendVector("min"),
|
|
1003
|
+
lighten: generateBlendVector("max"),
|
|
1004
|
+
colorDodge: generateBlendVector("blend_colorDodge"),
|
|
1005
|
+
colorBurn: generateBlendVector("blend_colorBurn"),
|
|
1006
|
+
hardLight: generateBlendVector("blend_hardLight"),
|
|
1007
|
+
softLight: generateBlendVector("blend_softLight"),
|
|
1008
|
+
difference: generateBlendVector("blend_difference"),
|
|
1009
|
+
exclusion: generateBlendVector("blend_exclusion"),
|
|
1010
|
+
hue: "blend_set_luminosity(blend_set_saturation(source, blend_saturation(backdrop)), blend_luminosity(backdrop))",
|
|
1011
|
+
saturation: "blend_set_luminosity(blend_set_saturation(backdrop, blend_saturation(source)), blend_luminosity(backdrop))",
|
|
1012
|
+
color: "blend_set_luminosity(source, blend_luminosity(backdrop))",
|
|
1013
|
+
luminosity: "blend_set_luminosity(backdrop, blend_luminosity(source))"
|
|
1014
|
+
};
|
|
1015
|
+
function blend({
|
|
1016
|
+
mode = "normal",
|
|
1017
|
+
color: color2 = [0, 0, 0, 1]
|
|
1018
|
+
} = {}) {
|
|
1019
|
+
return {
|
|
1020
|
+
vertex: {
|
|
1021
|
+
attribute: {
|
|
1022
|
+
a_blendImageTexCoord: "vec2"
|
|
1023
|
+
},
|
|
1024
|
+
main: `
|
|
1025
|
+
v_blendImageTexCoord = a_blendImageTexCoord;`
|
|
1026
|
+
},
|
|
1027
|
+
fragment: {
|
|
1028
|
+
uniform: {
|
|
1029
|
+
u_blendEnabled: "bool",
|
|
1030
|
+
u_blendColorEnabled: "bool",
|
|
1031
|
+
u_blendImageEnabled: "bool",
|
|
1032
|
+
u_blendColor: "vec4",
|
|
1033
|
+
u_blendImage: "sampler2D"
|
|
1034
|
+
},
|
|
1035
|
+
constant: `const vec3 blendLum = vec3(0.3, 0.59, 0.11);
|
|
1036
|
+
${MODES_CONSTANT[mode]}`,
|
|
1037
|
+
main: `
|
|
1038
|
+
if (u_blendEnabled) {
|
|
1039
|
+
vec3 backdrop = vec3(0.0);
|
|
1040
|
+
float backdropAlpha = 1.0;
|
|
1041
|
+
|
|
1042
|
+
if (u_blendColorEnabled) {
|
|
1043
|
+
backdrop = u_blendColor.rgb;
|
|
1044
|
+
backdropAlpha = u_blendColor.a;
|
|
1045
|
+
}
|
|
1046
|
+
if (u_blendImageEnabled) {
|
|
1047
|
+
vec4 blendBackdropPixel = texture2D(u_blendImage, v_blendImageTexCoord);
|
|
1048
|
+
if (u_blendColorEnabled) {
|
|
1049
|
+
vec3 source = blendBackdropPixel.rgb;
|
|
1050
|
+
float sourceAlpha = blendBackdropPixel.a;
|
|
1051
|
+
backdrop = (1.0 - backdropAlpha) * source + backdropAlpha * clamp(${MODES_MAIN[mode]}, 0.0, 1.0);
|
|
1052
|
+
backdropAlpha = sourceAlpha + backdropAlpha * (1.0 - sourceAlpha);
|
|
1053
|
+
}
|
|
1054
|
+
else {
|
|
1055
|
+
backdrop = blendBackdropPixel.rgb;
|
|
1056
|
+
backdropAlpha = blendBackdropPixel.a;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
vec3 source = vec3(color.rgb);
|
|
1060
|
+
color = (1.0 - backdropAlpha) * source + backdropAlpha * clamp(${MODES_MAIN[mode]}, 0.0, 1.0);
|
|
1061
|
+
alpha = alpha + backdropAlpha * (1.0 - alpha);
|
|
1062
|
+
}`
|
|
1063
|
+
},
|
|
1064
|
+
get color() {
|
|
1065
|
+
return this.uniforms[1].data.slice(0);
|
|
1066
|
+
},
|
|
1067
|
+
set color(l) {
|
|
1068
|
+
if (!l || !l.length) {
|
|
1069
|
+
this.uniforms[2].data[0] = 0;
|
|
1070
|
+
} else {
|
|
1071
|
+
this.uniforms[2].data[0] = 1;
|
|
1072
|
+
l.forEach((c, i) => {
|
|
1073
|
+
if (!Number.isNaN(c)) {
|
|
1074
|
+
this.uniforms[1].data[i] = c;
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
get image() {
|
|
1080
|
+
return this.textures[0].data;
|
|
1081
|
+
},
|
|
1082
|
+
set image(img) {
|
|
1083
|
+
if (img) {
|
|
1084
|
+
this.uniforms[4].data[0] = 1;
|
|
1085
|
+
this.textures[0].data = img;
|
|
1086
|
+
} else {
|
|
1087
|
+
this.uniforms[4].data[0] = 0;
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
get disabled() {
|
|
1091
|
+
return !this.uniforms[0].data[0];
|
|
1092
|
+
},
|
|
1093
|
+
set disabled(b) {
|
|
1094
|
+
this.uniforms[0].data[0] = +!b;
|
|
1095
|
+
},
|
|
1096
|
+
varying: {
|
|
1097
|
+
v_blendImageTexCoord: "vec2"
|
|
1098
|
+
},
|
|
1099
|
+
uniforms: [
|
|
1100
|
+
{
|
|
1101
|
+
name: "u_blendEnabled",
|
|
1102
|
+
type: "i",
|
|
1103
|
+
data: [1]
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
name: "u_blendColor",
|
|
1107
|
+
type: "f",
|
|
1108
|
+
data: color2
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
name: "u_blendColorEnabled",
|
|
1112
|
+
type: "i",
|
|
1113
|
+
data: [1]
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
name: "u_blendImage",
|
|
1117
|
+
type: "i",
|
|
1118
|
+
data: [1]
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
name: "u_blendImageEnabled",
|
|
1122
|
+
type: "i",
|
|
1123
|
+
data: [0]
|
|
1124
|
+
}
|
|
1125
|
+
],
|
|
1126
|
+
attributes: [
|
|
1127
|
+
{
|
|
1128
|
+
name: "a_blendImageTexCoord",
|
|
1129
|
+
extends: "a_texCoord"
|
|
1130
|
+
}
|
|
1131
|
+
],
|
|
1132
|
+
textures: [
|
|
1133
|
+
{
|
|
1134
|
+
format: "RGBA"
|
|
1135
|
+
}
|
|
1136
|
+
]
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function brightnessContrast({ brightness: brightness2 = 1, contrast: contrast2 = 1 } = {}) {
|
|
1140
|
+
return {
|
|
1141
|
+
fragment: {
|
|
1142
|
+
uniform: {
|
|
1143
|
+
u_brEnabled: "bool",
|
|
1144
|
+
u_ctEnabled: "bool",
|
|
1145
|
+
u_contrast: "float",
|
|
1146
|
+
u_brightness: "float"
|
|
1147
|
+
},
|
|
1148
|
+
constant: "const vec3 half3 = vec3(0.5);",
|
|
1149
|
+
main: `
|
|
1150
|
+
if (u_brEnabled) {
|
|
1151
|
+
color *= u_brightness;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
if (u_ctEnabled) {
|
|
1155
|
+
color = (color - half3) * u_contrast + half3;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
color = clamp(color, 0.0, 1.0);`
|
|
1159
|
+
},
|
|
1160
|
+
get brightness() {
|
|
1161
|
+
return this.uniforms[2].data[0];
|
|
1162
|
+
},
|
|
1163
|
+
set brightness(value) {
|
|
1164
|
+
this.uniforms[2].data[0] = parseFloat(Math.max(0, value));
|
|
1165
|
+
},
|
|
1166
|
+
get contrast() {
|
|
1167
|
+
return this.uniforms[3].data[0];
|
|
1168
|
+
},
|
|
1169
|
+
set contrast(value) {
|
|
1170
|
+
this.uniforms[3].data[0] = parseFloat(Math.max(0, value));
|
|
1171
|
+
},
|
|
1172
|
+
get brightnessDisabled() {
|
|
1173
|
+
return !this.uniforms[0].data[0];
|
|
1174
|
+
},
|
|
1175
|
+
set brightnessDisabled(toggle) {
|
|
1176
|
+
this.uniforms[0].data[0] = +!toggle;
|
|
1177
|
+
},
|
|
1178
|
+
get contrastDisabled() {
|
|
1179
|
+
return !this.uniforms[1].data[0];
|
|
1180
|
+
},
|
|
1181
|
+
set contrastDisabled(toggle) {
|
|
1182
|
+
this.uniforms[1].data[0] = +!toggle;
|
|
1183
|
+
},
|
|
1184
|
+
uniforms: [
|
|
1185
|
+
{
|
|
1186
|
+
name: "u_brEnabled",
|
|
1187
|
+
type: "i",
|
|
1188
|
+
data: [1]
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
name: "u_ctEnabled",
|
|
1192
|
+
type: "i",
|
|
1193
|
+
data: [1]
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
name: "u_brightness",
|
|
1197
|
+
type: "f",
|
|
1198
|
+
data: [brightness2]
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
name: "u_contrast",
|
|
1202
|
+
type: "f",
|
|
1203
|
+
data: [contrast2]
|
|
1204
|
+
}
|
|
1205
|
+
]
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function hueSaturation({ hue: hue2 = 0, saturation: saturation2 = 1 } = {}) {
|
|
1209
|
+
return {
|
|
1210
|
+
vertex: {
|
|
1211
|
+
uniform: {
|
|
1212
|
+
u_hue: "float",
|
|
1213
|
+
u_saturation: "float"
|
|
1214
|
+
},
|
|
1215
|
+
// for implementation see: https://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement
|
|
1216
|
+
constant: `
|
|
1217
|
+
const mat3 lummat = mat3(
|
|
1218
|
+
lumcoeff,
|
|
1219
|
+
lumcoeff,
|
|
1220
|
+
lumcoeff
|
|
1221
|
+
);
|
|
1222
|
+
const mat3 cosmat = mat3(
|
|
1223
|
+
vec3(0.787, -0.715, -0.072),
|
|
1224
|
+
vec3(-0.213, 0.285, -0.072),
|
|
1225
|
+
vec3(-0.213, -0.715, 0.928)
|
|
1226
|
+
);
|
|
1227
|
+
const mat3 sinmat = mat3(
|
|
1228
|
+
vec3(-0.213, -0.715, 0.928),
|
|
1229
|
+
vec3(0.143, 0.140, -0.283),
|
|
1230
|
+
vec3(-0.787, 0.715, 0.072)
|
|
1231
|
+
);
|
|
1232
|
+
const mat3 satmat = mat3(
|
|
1233
|
+
vec3(0.787, -0.715, -0.072),
|
|
1234
|
+
vec3(-0.213, 0.285, -0.072),
|
|
1235
|
+
vec3(-0.213, -0.715, 0.928)
|
|
1236
|
+
);`,
|
|
1237
|
+
main: `
|
|
1238
|
+
float angle = (u_hue / 180.0) * 3.14159265358979323846264;
|
|
1239
|
+
v_hueRotation = lummat + cos(angle) * cosmat + sin(angle) * sinmat;
|
|
1240
|
+
v_saturation = lummat + satmat * u_saturation;`
|
|
1241
|
+
},
|
|
1242
|
+
fragment: {
|
|
1243
|
+
uniform: {
|
|
1244
|
+
u_hueEnabled: "bool",
|
|
1245
|
+
u_satEnabled: "bool",
|
|
1246
|
+
u_hue: "float",
|
|
1247
|
+
u_saturation: "float"
|
|
1248
|
+
},
|
|
1249
|
+
main: `
|
|
1250
|
+
if (u_hueEnabled) {
|
|
1251
|
+
color = vec3(
|
|
1252
|
+
dot(color, v_hueRotation[0]),
|
|
1253
|
+
dot(color, v_hueRotation[1]),
|
|
1254
|
+
dot(color, v_hueRotation[2])
|
|
1255
|
+
);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
if (u_satEnabled) {
|
|
1259
|
+
color = vec3(
|
|
1260
|
+
dot(color, v_saturation[0]),
|
|
1261
|
+
dot(color, v_saturation[1]),
|
|
1262
|
+
dot(color, v_saturation[2])
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
color = clamp(color, 0.0, 1.0);`
|
|
1267
|
+
},
|
|
1268
|
+
varying: {
|
|
1269
|
+
v_hueRotation: "mat3",
|
|
1270
|
+
v_saturation: "mat3"
|
|
1271
|
+
},
|
|
1272
|
+
get hue() {
|
|
1273
|
+
return this.uniforms[2].data[0];
|
|
1274
|
+
},
|
|
1275
|
+
set hue(h) {
|
|
1276
|
+
this.uniforms[2].data[0] = parseFloat(h);
|
|
1277
|
+
},
|
|
1278
|
+
get saturation() {
|
|
1279
|
+
return this.uniforms[3].data[0];
|
|
1280
|
+
},
|
|
1281
|
+
set saturation(s) {
|
|
1282
|
+
this.uniforms[3].data[0] = parseFloat(Math.max(0, s));
|
|
1283
|
+
},
|
|
1284
|
+
get hueDisabled() {
|
|
1285
|
+
return !this.uniforms[0].data[0];
|
|
1286
|
+
},
|
|
1287
|
+
set hueDisabled(b) {
|
|
1288
|
+
this.uniforms[0].data[0] = +!b;
|
|
1289
|
+
},
|
|
1290
|
+
get saturationDisabled() {
|
|
1291
|
+
return !this.uniforms[1].data[0];
|
|
1292
|
+
},
|
|
1293
|
+
set saturationDisabled(b) {
|
|
1294
|
+
this.uniforms[1].data[0] = +!b;
|
|
1295
|
+
},
|
|
1296
|
+
uniforms: [
|
|
1297
|
+
{
|
|
1298
|
+
name: "u_hueEnabled",
|
|
1299
|
+
type: "i",
|
|
1300
|
+
data: [1]
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
name: "u_satEnabled",
|
|
1304
|
+
type: "i",
|
|
1305
|
+
data: [1]
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
name: "u_hue",
|
|
1309
|
+
type: "f",
|
|
1310
|
+
data: [hue2]
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
name: "u_saturation",
|
|
1314
|
+
type: "f",
|
|
1315
|
+
data: [saturation2]
|
|
1316
|
+
}
|
|
1317
|
+
]
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function duotone({
|
|
1321
|
+
dark = [0.7411764706, 0.0431372549, 0.568627451, 1],
|
|
1322
|
+
light = [0.9882352941, 0.7333333333, 0.05098039216, 1]
|
|
1323
|
+
} = {}) {
|
|
1324
|
+
return {
|
|
1325
|
+
fragment: {
|
|
1326
|
+
uniform: {
|
|
1327
|
+
u_duotoneEnabled: "bool",
|
|
1328
|
+
u_light: "vec4",
|
|
1329
|
+
u_dark: "vec4"
|
|
1330
|
+
},
|
|
1331
|
+
main: `
|
|
1332
|
+
if (u_duotoneEnabled) {
|
|
1333
|
+
vec3 gray = vec3(dot(lumcoeff, color));
|
|
1334
|
+
color = mix(u_dark.rgb, u_light.rgb, gray);
|
|
1335
|
+
}`
|
|
1336
|
+
},
|
|
1337
|
+
get light() {
|
|
1338
|
+
return this.uniforms[1].data.slice(0);
|
|
1339
|
+
},
|
|
1340
|
+
set light(l) {
|
|
1341
|
+
l.forEach((c, i) => {
|
|
1342
|
+
if (!Number.isNaN(c)) {
|
|
1343
|
+
this.uniforms[1].data[i] = c;
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
},
|
|
1347
|
+
get dark() {
|
|
1348
|
+
return this.uniforms[2].data.slice(0);
|
|
1349
|
+
},
|
|
1350
|
+
set dark(d) {
|
|
1351
|
+
d.forEach((c, i) => {
|
|
1352
|
+
if (!Number.isNaN(c)) {
|
|
1353
|
+
this.uniforms[2].data[i] = c;
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
},
|
|
1357
|
+
get disabled() {
|
|
1358
|
+
return !this.uniforms[0].data[0];
|
|
1359
|
+
},
|
|
1360
|
+
set disabled(b) {
|
|
1361
|
+
this.uniforms[0].data[0] = +!b;
|
|
1362
|
+
},
|
|
1363
|
+
uniforms: [
|
|
1364
|
+
{
|
|
1365
|
+
name: "u_duotoneEnabled",
|
|
1366
|
+
type: "i",
|
|
1367
|
+
data: [1]
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
name: "u_light",
|
|
1371
|
+
type: "f",
|
|
1372
|
+
data: light
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
name: "u_dark",
|
|
1376
|
+
type: "f",
|
|
1377
|
+
data: dark
|
|
1378
|
+
}
|
|
1379
|
+
]
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
function displacement({ wrap = WRAP_METHODS.CLAMP, input = INPUT_METHODS.TEXTURE, scale, enableBlueChannel } = {}) {
|
|
1383
|
+
const { x: sx, y: sy } = scale || { x: 0, y: 0 };
|
|
1384
|
+
return {
|
|
1385
|
+
vertex: {
|
|
1386
|
+
attribute: {
|
|
1387
|
+
a_displacementMapTexCoord: "vec2"
|
|
1388
|
+
},
|
|
1389
|
+
main: `
|
|
1390
|
+
v_displacementMapTexCoord = a_displacementMapTexCoord;`
|
|
1391
|
+
},
|
|
1392
|
+
fragment: {
|
|
1393
|
+
uniform: {
|
|
1394
|
+
u_displacementEnabled: "bool",
|
|
1395
|
+
u_enableBlueChannel: "bool",
|
|
1396
|
+
u_dispMap: "sampler2D",
|
|
1397
|
+
u_dispScale: "vec2"
|
|
1398
|
+
},
|
|
1399
|
+
source: `
|
|
1400
|
+
if (u_displacementEnabled) {
|
|
1401
|
+
${input}
|
|
1402
|
+
vec2 dispVec = vec2(sourceCoord.x + (u_dispScale.x + dispIntensity) * dispPosition.r, sourceCoord.y + (u_dispScale.y + dispIntensity) * dispPosition.g);
|
|
1403
|
+
${wrap}
|
|
1404
|
+
sourceCoord = dispVec;
|
|
1405
|
+
}`
|
|
1406
|
+
},
|
|
1407
|
+
get disabled() {
|
|
1408
|
+
return !this.uniforms[0].data[0];
|
|
1409
|
+
},
|
|
1410
|
+
set disabled(b) {
|
|
1411
|
+
this.uniforms[0].data[0] = +!b;
|
|
1412
|
+
},
|
|
1413
|
+
get scale() {
|
|
1414
|
+
const [x, y] = this.uniforms[2].data;
|
|
1415
|
+
return { x, y };
|
|
1416
|
+
},
|
|
1417
|
+
set scale({ x, y }) {
|
|
1418
|
+
if (typeof x !== "undefined") this.uniforms[2].data[0] = x;
|
|
1419
|
+
if (typeof y !== "undefined") this.uniforms[2].data[1] = y;
|
|
1420
|
+
},
|
|
1421
|
+
get map() {
|
|
1422
|
+
return this.textures[0].data;
|
|
1423
|
+
},
|
|
1424
|
+
set map(img) {
|
|
1425
|
+
this.textures[0].data = img;
|
|
1426
|
+
},
|
|
1427
|
+
get enableBlueChannel() {
|
|
1428
|
+
return this.uniforms[3].data[0];
|
|
1429
|
+
},
|
|
1430
|
+
set enableBlueChannel(b) {
|
|
1431
|
+
this.uniforms[3].data[0] = +b;
|
|
1432
|
+
},
|
|
1433
|
+
varying: {
|
|
1434
|
+
v_displacementMapTexCoord: "vec2"
|
|
1435
|
+
},
|
|
1436
|
+
uniforms: [
|
|
1437
|
+
{
|
|
1438
|
+
name: "u_displacementEnabled",
|
|
1439
|
+
type: "i",
|
|
1440
|
+
data: [1]
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
name: "u_dispMap",
|
|
1444
|
+
type: "i",
|
|
1445
|
+
data: [1]
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
name: "u_dispScale",
|
|
1449
|
+
type: "f",
|
|
1450
|
+
data: [sx, sy]
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
name: "u_enableBlueChannel",
|
|
1454
|
+
type: "i",
|
|
1455
|
+
data: [+enableBlueChannel]
|
|
1456
|
+
}
|
|
1457
|
+
],
|
|
1458
|
+
attributes: [
|
|
1459
|
+
{
|
|
1460
|
+
name: "a_displacementMapTexCoord",
|
|
1461
|
+
extends: "a_texCoord"
|
|
1462
|
+
}
|
|
1463
|
+
],
|
|
1464
|
+
textures: [
|
|
1465
|
+
{
|
|
1466
|
+
format: "RGB"
|
|
1467
|
+
}
|
|
1468
|
+
]
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
const INPUT_METHODS = {
|
|
1472
|
+
TEXTURE: `vec3 dispMap = texture2D(u_dispMap, v_displacementMapTexCoord).rgb;
|
|
1473
|
+
vec2 dispPosition = dispMap.rg - 0.5;
|
|
1474
|
+
float dispIntensity = u_enableBlueChannel ? dispMap.b : 0.0;`,
|
|
1475
|
+
TURBULENCE: `vec3 dispMap = vec3(turbulenceValue);
|
|
1476
|
+
vec2 dispPosition = dispMap.rg - 0.5;
|
|
1477
|
+
float dispIntensity = u_enableBlueChannel ? dispMap.b : 0.0;`
|
|
1478
|
+
};
|
|
1479
|
+
const WRAP_METHODS = {
|
|
1480
|
+
CLAMP: `dispVec = clamp(dispVec, 0.0, 1.0);`,
|
|
1481
|
+
DISCARD: `if (dispVec.x < 0.0 || dispVec.x > 1.0 || dispVec.y > 1.0 || dispVec.y < 0.0) { discard; }`,
|
|
1482
|
+
WRAP: `dispVec = mod(dispVec, 1.0);`
|
|
1483
|
+
};
|
|
1484
|
+
displacement.TEXTURE = INPUT_METHODS.TEXTURE;
|
|
1485
|
+
displacement.TURBULENCE = INPUT_METHODS.TURBULENCE;
|
|
1486
|
+
displacement.CLAMP = WRAP_METHODS.CLAMP;
|
|
1487
|
+
displacement.DISCARD = WRAP_METHODS.DISCARD;
|
|
1488
|
+
displacement.WRAP = WRAP_METHODS.WRAP;
|
|
1489
|
+
function channelSplit({
|
|
1490
|
+
offsetRed = { x: 0.01, y: 0.01 },
|
|
1491
|
+
offsetGreen = { x: -0.01, y: -0.01 },
|
|
1492
|
+
offsetBlue = { x: -0.01, y: -0.01 },
|
|
1493
|
+
offsetInputR = "u_channelOffsetR",
|
|
1494
|
+
offsetInputG = "u_channelOffsetG",
|
|
1495
|
+
offsetInputB = "u_channelOffsetB",
|
|
1496
|
+
boundsOffsetFactor = (boundsOffset) => "1.0"
|
|
1497
|
+
} = {}) {
|
|
1498
|
+
return {
|
|
1499
|
+
fragment: {
|
|
1500
|
+
uniform: {
|
|
1501
|
+
u_channelSplitEnabled: "bool",
|
|
1502
|
+
u_channelOffsetR: "vec2",
|
|
1503
|
+
u_channelOffsetG: "vec2",
|
|
1504
|
+
u_channelOffsetB: "vec2"
|
|
1505
|
+
},
|
|
1506
|
+
main: `
|
|
1507
|
+
if (u_channelSplitEnabled) {
|
|
1508
|
+
vec2 _splitOffsetR = ${offsetInputR};
|
|
1509
|
+
vec2 _splitOffsetG = ${offsetInputG};
|
|
1510
|
+
vec2 _splitOffsetB = ${offsetInputB};
|
|
1511
|
+
vec2 redSample = sourceCoord + _splitOffsetR;
|
|
1512
|
+
vec2 greenSample = sourceCoord + _splitOffsetG;
|
|
1513
|
+
vec2 blueSample = sourceCoord + _splitOffsetB;
|
|
1514
|
+
float redBoundsOffset = min(0.0, min(min(redSample.x, redSample.y), min(1.0 - redSample.x, 1.0 - redSample.y)));
|
|
1515
|
+
float greenBoundsOffset = min(0.0, min(min(greenSample.x, greenSample.y), min(1.0 - greenSample.x, 1.0 - greenSample.y)));
|
|
1516
|
+
float blueBoundsOffset = min(0.0, min(min(blueSample.x, blueSample.y), min(1.0 - blueSample.x, 1.0 - blueSample.y)));
|
|
1517
|
+
float redSplit = texture2D(u_source, sourceCoord + _splitOffsetR).r * ${boundsOffsetFactor(
|
|
1518
|
+
"redBoundsOffset"
|
|
1519
|
+
)};
|
|
1520
|
+
float greenSplit = texture2D(u_source, sourceCoord + _splitOffsetG).g * ${boundsOffsetFactor(
|
|
1521
|
+
"greenBoundsOffset"
|
|
1522
|
+
)};
|
|
1523
|
+
float blueSplit = texture2D(u_source, sourceCoord + _splitOffsetB).b * ${boundsOffsetFactor(
|
|
1524
|
+
"blueBoundsOffset"
|
|
1525
|
+
)};
|
|
1526
|
+
color = vec3(redSplit, greenSplit, blueSplit);
|
|
1527
|
+
}`
|
|
1528
|
+
},
|
|
1529
|
+
get disabled() {
|
|
1530
|
+
return !this.uniforms[0].data[0];
|
|
1531
|
+
},
|
|
1532
|
+
set disabled(b) {
|
|
1533
|
+
this.uniforms[0].data[0] = +!b;
|
|
1534
|
+
},
|
|
1535
|
+
get red() {
|
|
1536
|
+
const [x, y] = this.uniforms[1].data;
|
|
1537
|
+
return { x, y };
|
|
1538
|
+
},
|
|
1539
|
+
set red({ x, y }) {
|
|
1540
|
+
if (typeof x !== "undefined") this.uniforms[1].data[0] = x;
|
|
1541
|
+
if (typeof y !== "undefined") this.uniforms[1].data[1] = y;
|
|
1542
|
+
},
|
|
1543
|
+
get green() {
|
|
1544
|
+
const [x, y] = this.uniforms[2].data;
|
|
1545
|
+
return { x, y };
|
|
1546
|
+
},
|
|
1547
|
+
set green({ x, y }) {
|
|
1548
|
+
if (typeof x !== "undefined") this.uniforms[2].data[0] = x;
|
|
1549
|
+
if (typeof y !== "undefined") this.uniforms[2].data[1] = y;
|
|
1550
|
+
},
|
|
1551
|
+
get blue() {
|
|
1552
|
+
const [x, y] = this.uniforms[3].data;
|
|
1553
|
+
return { x, y };
|
|
1554
|
+
},
|
|
1555
|
+
set blue({ x, y }) {
|
|
1556
|
+
if (typeof x !== "undefined") this.uniforms[3].data[0] = x;
|
|
1557
|
+
if (typeof y !== "undefined") this.uniforms[3].data[1] = y;
|
|
1558
|
+
},
|
|
1559
|
+
uniforms: [
|
|
1560
|
+
{
|
|
1561
|
+
name: "u_channelSplitEnabled",
|
|
1562
|
+
type: "i",
|
|
1563
|
+
data: [1]
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
name: "u_channelOffsetR",
|
|
1567
|
+
type: "f",
|
|
1568
|
+
data: [offsetRed.x, offsetRed.y]
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
name: "u_channelOffsetG",
|
|
1572
|
+
type: "f",
|
|
1573
|
+
data: [offsetGreen.x, offsetGreen.y]
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
name: "u_channelOffsetB",
|
|
1577
|
+
type: "f",
|
|
1578
|
+
data: [offsetBlue.x, offsetBlue.y]
|
|
1579
|
+
}
|
|
1580
|
+
]
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
function kaleidoscope({ segments = 6, offset: offset2, rotation = 0 } = {}) {
|
|
1584
|
+
const { x: offsetX, y: offsetY } = offset2 || { x: 0, y: 0 };
|
|
1585
|
+
return {
|
|
1586
|
+
fragment: {
|
|
1587
|
+
uniform: {
|
|
1588
|
+
u_kaleidoscopeEnabled: "bool",
|
|
1589
|
+
u_segments: "float",
|
|
1590
|
+
u_offset: "vec2",
|
|
1591
|
+
u_rotation: "float"
|
|
1592
|
+
},
|
|
1593
|
+
source: `
|
|
1594
|
+
if (u_kaleidoscopeEnabled && u_segments > 0.0) {
|
|
1595
|
+
vec2 centered = v_texCoord - 0.5;
|
|
1596
|
+
float r = length(centered);
|
|
1597
|
+
float theta = atan(centered.y, centered.x);
|
|
1598
|
+
theta = mod(theta, 2.0 * PI / u_segments) + radians(u_rotation);
|
|
1599
|
+
theta = abs(theta - PI / u_segments) - PI / u_segments;
|
|
1600
|
+
vec2 newCoords = r * vec2(cos(theta), sin(theta)) + 0.5;
|
|
1601
|
+
sourceCoord = newCoords - u_offset;
|
|
1602
|
+
// mirrored repeat
|
|
1603
|
+
sourceCoord = mod(sourceCoord, 1.0) * (mod(sourceCoord - 1.0, 2.0) - mod(sourceCoord, 1.0)) + mod(-sourceCoord, 1.0) * (mod(sourceCoord, 2.0) - mod(sourceCoord, 1.0));
|
|
1604
|
+
}`
|
|
1605
|
+
},
|
|
1606
|
+
get segments() {
|
|
1607
|
+
return this.uniforms[1].data[0];
|
|
1608
|
+
},
|
|
1609
|
+
set segments(n) {
|
|
1610
|
+
this.uniforms[1].data[0] = +n;
|
|
1611
|
+
},
|
|
1612
|
+
get offset() {
|
|
1613
|
+
const [x, y] = this.uniforms[2].data;
|
|
1614
|
+
return { x, y };
|
|
1615
|
+
},
|
|
1616
|
+
set offset({ x, y }) {
|
|
1617
|
+
if (typeof x !== "undefined") this.uniforms[2].data[0] = x;
|
|
1618
|
+
if (typeof y !== "undefined") this.uniforms[2].data[1] = y;
|
|
1619
|
+
},
|
|
1620
|
+
get rotation() {
|
|
1621
|
+
return this.uniforms[3].data[0];
|
|
1622
|
+
},
|
|
1623
|
+
set rotation(r) {
|
|
1624
|
+
this.uniforms[3].data[0] = r;
|
|
1625
|
+
},
|
|
1626
|
+
get disabled() {
|
|
1627
|
+
return !this.uniforms[0].data[0];
|
|
1628
|
+
},
|
|
1629
|
+
set disabled(b) {
|
|
1630
|
+
this.uniforms[0].data[0] = +!b;
|
|
1631
|
+
},
|
|
1632
|
+
uniforms: [
|
|
1633
|
+
{
|
|
1634
|
+
name: "u_kaleidoscopeEnabled",
|
|
1635
|
+
type: "i",
|
|
1636
|
+
data: [1]
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
name: "u_segments",
|
|
1640
|
+
type: "f",
|
|
1641
|
+
data: [segments]
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
name: "u_offset",
|
|
1645
|
+
type: "f",
|
|
1646
|
+
data: [offsetX, offsetY]
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
name: "u_rotation",
|
|
1650
|
+
type: "f",
|
|
1651
|
+
data: [rotation]
|
|
1652
|
+
}
|
|
1653
|
+
]
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
function slitScan({
|
|
1657
|
+
noise,
|
|
1658
|
+
time = 0,
|
|
1659
|
+
intensity = 0.1,
|
|
1660
|
+
frequency = 2,
|
|
1661
|
+
direction = "x",
|
|
1662
|
+
offsetInput = ""
|
|
1663
|
+
}) {
|
|
1664
|
+
const isHorizontal = direction === "x";
|
|
1665
|
+
const noiseFragPart = `(gl_FragCoord.${direction} / u_resolution.${direction}${offsetInput ? `+ ${offsetInput}` : ""}) * u_frequency`;
|
|
1666
|
+
const noiseTimePart = "u_time * 0.0001";
|
|
1667
|
+
return {
|
|
1668
|
+
fragment: {
|
|
1669
|
+
uniform: {
|
|
1670
|
+
u_slitScanEnabled: "bool",
|
|
1671
|
+
u_intensity: "float",
|
|
1672
|
+
u_frequency: "float",
|
|
1673
|
+
u_time: "float",
|
|
1674
|
+
u_horizontal: "bool"
|
|
1675
|
+
},
|
|
1676
|
+
constant: noise,
|
|
1677
|
+
source: `
|
|
1678
|
+
if (u_slitScanEnabled) {
|
|
1679
|
+
float noiseValue = noise(vec2(${isHorizontal ? noiseFragPart : noiseTimePart}, ${isHorizontal ? noiseTimePart : noiseFragPart}));
|
|
1680
|
+
float source_ = sourceCoord.${direction} + noiseValue * u_intensity;
|
|
1681
|
+
float mirrored_ = mod(source_, 1.0) * (mod(source_ - 1.0, 2.0) - mod(source_, 1.0)) + mod(-source_, 1.0) * (mod(source_, 2.0) - mod(source_, 1.0));
|
|
1682
|
+
sourceCoord = ${isHorizontal ? "vec2(mirrored_, sourceCoord.y)" : "vec2(sourceCoord.x, mirrored_)"};
|
|
1683
|
+
}`
|
|
1684
|
+
},
|
|
1685
|
+
get disabled() {
|
|
1686
|
+
return !this.uniforms[0].data[0];
|
|
1687
|
+
},
|
|
1688
|
+
set disabled(b) {
|
|
1689
|
+
this.uniforms[0].data[0] = +!b;
|
|
1690
|
+
},
|
|
1691
|
+
get intensity() {
|
|
1692
|
+
return this.uniforms[1].data[0];
|
|
1693
|
+
},
|
|
1694
|
+
set intensity(i) {
|
|
1695
|
+
this.uniforms[1].data[0] = i;
|
|
1696
|
+
},
|
|
1697
|
+
get frequency() {
|
|
1698
|
+
return this.uniforms[2].data[0];
|
|
1699
|
+
},
|
|
1700
|
+
set frequency(f) {
|
|
1701
|
+
this.uniforms[2].data[0] = f;
|
|
1702
|
+
},
|
|
1703
|
+
get time() {
|
|
1704
|
+
return this.uniforms[3].data[0];
|
|
1705
|
+
},
|
|
1706
|
+
set time(t) {
|
|
1707
|
+
this.uniforms[3].data[0] = t;
|
|
1708
|
+
},
|
|
1709
|
+
uniforms: [
|
|
1710
|
+
{
|
|
1711
|
+
name: "u_slitScanEnabled",
|
|
1712
|
+
type: "i",
|
|
1713
|
+
data: [1]
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
name: "u_intensity",
|
|
1717
|
+
type: "f",
|
|
1718
|
+
data: [intensity]
|
|
1719
|
+
},
|
|
1720
|
+
{
|
|
1721
|
+
name: "u_frequency",
|
|
1722
|
+
type: "f",
|
|
1723
|
+
data: [frequency]
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
name: "u_time",
|
|
1727
|
+
type: "f",
|
|
1728
|
+
data: [time]
|
|
1729
|
+
}
|
|
1730
|
+
]
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
function turbulence({
|
|
1734
|
+
noise,
|
|
1735
|
+
output = OUTPUT_TYPES.COLOR,
|
|
1736
|
+
frequency,
|
|
1737
|
+
octaves = 1,
|
|
1738
|
+
isFractal = false,
|
|
1739
|
+
time = 0,
|
|
1740
|
+
input = INPUT_TYPES.FRAGCOORD_XY_TIME
|
|
1741
|
+
}) {
|
|
1742
|
+
const { x: fx, y: fy } = frequency || { x: 0, y: 0 };
|
|
1743
|
+
return {
|
|
1744
|
+
fragment: {
|
|
1745
|
+
uniform: {
|
|
1746
|
+
u_turbulenceEnabled: "bool",
|
|
1747
|
+
u_turbulenceFrequency: "vec2",
|
|
1748
|
+
u_turbulenceOctaves: "int",
|
|
1749
|
+
u_isFractal: "bool",
|
|
1750
|
+
u_time: "float"
|
|
1751
|
+
},
|
|
1752
|
+
constant: `
|
|
1753
|
+
${noise}
|
|
1754
|
+
|
|
1755
|
+
const int MAX_OCTAVES = 9;
|
|
1756
|
+
|
|
1757
|
+
float turbulence (vec3 seed, vec2 frequency, int numOctaves, bool isFractal) {
|
|
1758
|
+
float sum = 0.0;
|
|
1759
|
+
vec3 position = vec3(0.0);
|
|
1760
|
+
position.x = seed.x * frequency.x;
|
|
1761
|
+
position.y = seed.y * frequency.y;
|
|
1762
|
+
position.z = seed.z;
|
|
1763
|
+
float ratio = 1.0;
|
|
1764
|
+
|
|
1765
|
+
for (int octave = 0; octave <= MAX_OCTAVES; octave++) {
|
|
1766
|
+
if (octave > numOctaves) {
|
|
1767
|
+
break;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
if (isFractal) {
|
|
1771
|
+
sum += noise(position) / ratio;
|
|
1772
|
+
}
|
|
1773
|
+
else {
|
|
1774
|
+
sum += abs(noise(position)) / ratio;
|
|
1775
|
+
}
|
|
1776
|
+
position.x *= 2.0;
|
|
1777
|
+
position.y *= 2.0;
|
|
1778
|
+
ratio *= 2.0;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
if (isFractal) {
|
|
1782
|
+
sum = (sum + 1.0) / 2.0;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
return clamp(sum, 0.0, 1.0);
|
|
1786
|
+
}`,
|
|
1787
|
+
source: `
|
|
1788
|
+
${input || ""}
|
|
1789
|
+
float turbulenceValue = turbulence(turbulenceSeed, u_turbulenceFrequency, u_turbulenceOctaves, u_isFractal);`,
|
|
1790
|
+
main: `
|
|
1791
|
+
${output || ""}`
|
|
1792
|
+
},
|
|
1793
|
+
get frequency() {
|
|
1794
|
+
const [x, y] = this.uniforms[0].data;
|
|
1795
|
+
return { x, y };
|
|
1796
|
+
},
|
|
1797
|
+
set frequency({ x, y }) {
|
|
1798
|
+
if (typeof x !== "undefined") this.uniforms[0].data[0] = x;
|
|
1799
|
+
if (typeof y !== "undefined") this.uniforms[0].data[1] = y;
|
|
1800
|
+
},
|
|
1801
|
+
get octaves() {
|
|
1802
|
+
return this.uniforms[1].data[0];
|
|
1803
|
+
},
|
|
1804
|
+
set octaves(value) {
|
|
1805
|
+
this.uniforms[1].data[0] = Math.max(0, parseInt(value));
|
|
1806
|
+
},
|
|
1807
|
+
get isFractal() {
|
|
1808
|
+
return !!this.uniforms[2].data[0];
|
|
1809
|
+
},
|
|
1810
|
+
set isFractal(toggle) {
|
|
1811
|
+
this.uniforms[2].data[0] = +toggle;
|
|
1812
|
+
},
|
|
1813
|
+
get time() {
|
|
1814
|
+
return this.uniforms[3].data[0];
|
|
1815
|
+
},
|
|
1816
|
+
set time(value) {
|
|
1817
|
+
this.uniforms[3].data[0] = Math.max(0, parseFloat(value));
|
|
1818
|
+
},
|
|
1819
|
+
uniforms: [
|
|
1820
|
+
{
|
|
1821
|
+
name: "u_turbulenceFrequency",
|
|
1822
|
+
type: "f",
|
|
1823
|
+
data: [fx, fy]
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
name: "u_turbulenceOctaves",
|
|
1827
|
+
type: "i",
|
|
1828
|
+
data: [octaves]
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
name: "u_isFractal",
|
|
1832
|
+
type: "i",
|
|
1833
|
+
data: [+!!isFractal]
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
name: "u_time",
|
|
1837
|
+
type: "f",
|
|
1838
|
+
data: [time]
|
|
1839
|
+
}
|
|
1840
|
+
]
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
const OUTPUT_TYPES = {
|
|
1844
|
+
COLOR: "color = vec3(turbulenceValue);",
|
|
1845
|
+
ALPHA: "alpha = turbulenceValue;"
|
|
1846
|
+
};
|
|
1847
|
+
const INPUT_TYPES = {
|
|
1848
|
+
FRAGCOORD_XY_TIME: "vec3 turbulenceSeed = vec3(gl_FragCoord.xy, u_time * 0.0001);",
|
|
1849
|
+
FRAGCOORD_XYZ: "vec3 turbulenceSeed = vec3(gl_FragCoord.xyz);",
|
|
1850
|
+
FRAGCOORD_XY_MOUSE_TIME: "vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, u_time * 0.0001);",
|
|
1851
|
+
FRAGCOORD_XY_MOUSE_Z: "vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, gl_FragCoord.z);"
|
|
1852
|
+
};
|
|
1853
|
+
turbulence.COLOR = OUTPUT_TYPES.COLOR;
|
|
1854
|
+
turbulence.ALPHA = OUTPUT_TYPES.ALPHA;
|
|
1855
|
+
turbulence.FRAGCOORD_XY_TIME = INPUT_TYPES.FRAGCOORD_XY_TIME;
|
|
1856
|
+
turbulence.FRAGCOORD_XYZ = INPUT_TYPES.FRAGCOORD_XYZ;
|
|
1857
|
+
turbulence.FRAGCOORD_XY_MOUSE_TIME = INPUT_TYPES.FRAGCOORD_XY_MOUSE_TIME;
|
|
1858
|
+
turbulence.FRAGCOORD_XY_MOUSE_Z = INPUT_TYPES.FRAGCOORD_XY_MOUSE_Z;
|
|
1859
|
+
function flowmapGridDisplacement({
|
|
1860
|
+
aspectRatio = 16 / 9,
|
|
1861
|
+
intensity = 0.01,
|
|
1862
|
+
enableChannelSplit = true
|
|
1863
|
+
} = {}) {
|
|
1864
|
+
return {
|
|
1865
|
+
fragment: {
|
|
1866
|
+
constant: `
|
|
1867
|
+
vec2 coverUvs(float aspectRatio, vec2 containerRes) {
|
|
1868
|
+
float containerAspectX = containerRes.x/containerRes.y;
|
|
1869
|
+
float containerAspectY = containerRes.y/containerRes.x;
|
|
1870
|
+
|
|
1871
|
+
vec2 ratio = vec2(
|
|
1872
|
+
min(containerAspectX / aspectRatio, 1.0),
|
|
1873
|
+
min(containerAspectY * aspectRatio, 1.0)
|
|
1874
|
+
);
|
|
1875
|
+
|
|
1876
|
+
vec2 newUvs = vec2(
|
|
1877
|
+
v_texCoord.x * ratio.x + (1.0 - ratio.x) * 0.5,
|
|
1878
|
+
v_texCoord.y * ratio.y + (1.0 - ratio.y) * 0.5
|
|
1879
|
+
);
|
|
1880
|
+
|
|
1881
|
+
return newUvs;
|
|
1882
|
+
}`,
|
|
1883
|
+
uniform: {
|
|
1884
|
+
u_FBOMap: "sampler2D",
|
|
1885
|
+
u_aspectRatio: "float",
|
|
1886
|
+
u_displacementIntensity: "float",
|
|
1887
|
+
u_enableChannelSplit: "bool"
|
|
1888
|
+
},
|
|
1889
|
+
source: `
|
|
1890
|
+
vec2 griUvs = coverUvs(u_aspectRatio, u_resolution);
|
|
1891
|
+
vec4 displacement = texture2D(u_FBOMap, griUvs);
|
|
1892
|
+
|
|
1893
|
+
sourceCoord -= displacement.rg * u_displacementIntensity * 1.5;`,
|
|
1894
|
+
main: `
|
|
1895
|
+
if (u_enableChannelSplit) {
|
|
1896
|
+
vec2 redUvs = sourceCoord;
|
|
1897
|
+
vec2 blueUvs = sourceCoord;
|
|
1898
|
+
vec2 greenUvs = sourceCoord;
|
|
1899
|
+
|
|
1900
|
+
vec2 shift = displacement.rg * 0.001;
|
|
1901
|
+
|
|
1902
|
+
float displacementScale = length(displacement.rg);
|
|
1903
|
+
displacementScale = clamp(displacementScale, 0., 2.);
|
|
1904
|
+
|
|
1905
|
+
float redScale = 1. + displacementScale * 0.25;
|
|
1906
|
+
redUvs += shift * redScale;
|
|
1907
|
+
|
|
1908
|
+
float greenScale = 1. + displacementScale * 2.;
|
|
1909
|
+
greenUvs += shift * greenScale;
|
|
1910
|
+
|
|
1911
|
+
float blueScale = 1. + displacementScale * 1.5;
|
|
1912
|
+
blueUvs += shift * blueScale;
|
|
1913
|
+
|
|
1914
|
+
float red = texture2D(u_source, redUvs).r;
|
|
1915
|
+
float blue = texture2D(u_source, blueUvs).b;
|
|
1916
|
+
float green = texture2D(u_source, greenUvs).g;
|
|
1917
|
+
|
|
1918
|
+
color = vec3(red, green, blue);
|
|
1919
|
+
}`
|
|
1920
|
+
},
|
|
1921
|
+
set aspectRatio(ar) {
|
|
1922
|
+
this.uniforms[1].data[0] = ar;
|
|
1923
|
+
},
|
|
1924
|
+
set intensity(i) {
|
|
1925
|
+
this.uniforms[2].data[0] = i;
|
|
1926
|
+
},
|
|
1927
|
+
set enableChannelSplit(b) {
|
|
1928
|
+
this.uniforms[3].data[0] = b;
|
|
1929
|
+
},
|
|
1930
|
+
uniforms: [
|
|
1931
|
+
{
|
|
1932
|
+
name: "u_FBOMap",
|
|
1933
|
+
type: "i",
|
|
1934
|
+
data: [1]
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
name: "u_aspectRatio",
|
|
1938
|
+
type: "f",
|
|
1939
|
+
data: [aspectRatio]
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
name: "u_displacementIntensity",
|
|
1943
|
+
type: "f",
|
|
1944
|
+
data: [intensity]
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
name: "u_enableChannelSplit",
|
|
1948
|
+
type: "i",
|
|
1949
|
+
data: [+enableChannelSplit]
|
|
1950
|
+
}
|
|
1951
|
+
]
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
const LUMA_COEFFICIENT = "const vec3 lumcoeff = vec3(0.2125, 0.7154, 0.0721);";
|
|
1955
|
+
const MATH_PI = `const float PI = ${Math.PI};`;
|
|
1956
|
+
const DEBUG = false;
|
|
1957
|
+
const vertexSimpleTemplate = ({
|
|
1958
|
+
uniform = "",
|
|
1959
|
+
attribute = "",
|
|
1960
|
+
varying = "",
|
|
1961
|
+
constant = "",
|
|
1962
|
+
main = ""
|
|
1963
|
+
}) => `
|
|
1964
|
+
precision highp float;
|
|
1965
|
+
${uniform}
|
|
1966
|
+
${attribute}
|
|
1967
|
+
attribute vec2 a_position;
|
|
1968
|
+
${varying}
|
|
1969
|
+
|
|
1970
|
+
${LUMA_COEFFICIENT}
|
|
1971
|
+
${MATH_PI}
|
|
1972
|
+
${constant}
|
|
1973
|
+
void main() {
|
|
1974
|
+
${main}
|
|
1975
|
+
gl_Position = vec4(a_position.xy, 0.0, 1.0);
|
|
1976
|
+
}`;
|
|
1977
|
+
const vertexMediaTemplate = ({
|
|
1978
|
+
uniform = "",
|
|
1979
|
+
attribute = "",
|
|
1980
|
+
varying = "",
|
|
1981
|
+
constant = "",
|
|
1982
|
+
main = ""
|
|
1983
|
+
}) => `
|
|
1984
|
+
precision highp float;
|
|
1985
|
+
${uniform}
|
|
1986
|
+
${attribute}
|
|
1987
|
+
attribute vec2 a_texCoord;
|
|
1988
|
+
attribute vec2 a_position;
|
|
1989
|
+
${varying}
|
|
1990
|
+
varying vec2 v_texCoord;
|
|
1991
|
+
|
|
1992
|
+
${LUMA_COEFFICIENT}
|
|
1993
|
+
${MATH_PI}
|
|
1994
|
+
${constant}
|
|
1995
|
+
void main() {
|
|
1996
|
+
v_texCoord = a_texCoord;
|
|
1997
|
+
${main}
|
|
1998
|
+
gl_Position = vec4(a_position.xy, 0.0, 1.0);
|
|
1999
|
+
}`;
|
|
2000
|
+
const fragmentSimpleTemplate = ({
|
|
2001
|
+
uniform = "",
|
|
2002
|
+
varying = "",
|
|
2003
|
+
constant = "",
|
|
2004
|
+
main = "",
|
|
2005
|
+
source = ""
|
|
2006
|
+
}) => `
|
|
2007
|
+
precision highp float;
|
|
2008
|
+
${varying}
|
|
2009
|
+
${uniform}
|
|
2010
|
+
|
|
2011
|
+
${LUMA_COEFFICIENT}
|
|
2012
|
+
${MATH_PI}
|
|
2013
|
+
${constant}
|
|
2014
|
+
void main() {
|
|
2015
|
+
${source}
|
|
2016
|
+
vec3 color = vec3(0.0);
|
|
2017
|
+
float alpha = 1.0;
|
|
2018
|
+
${main}
|
|
2019
|
+
gl_FragColor = vec4(color, 1.0) * alpha;
|
|
2020
|
+
}`;
|
|
2021
|
+
const fragmentMediaTemplate = ({
|
|
2022
|
+
uniform = "",
|
|
2023
|
+
varying = "",
|
|
2024
|
+
constant = "",
|
|
2025
|
+
main = "",
|
|
2026
|
+
source = ""
|
|
2027
|
+
}) => `
|
|
2028
|
+
precision highp float;
|
|
2029
|
+
${varying}
|
|
2030
|
+
varying vec2 v_texCoord;
|
|
2031
|
+
${uniform}
|
|
2032
|
+
uniform sampler2D u_source;
|
|
2033
|
+
|
|
2034
|
+
${LUMA_COEFFICIENT}
|
|
2035
|
+
${MATH_PI}
|
|
2036
|
+
${constant}
|
|
2037
|
+
void main() {
|
|
2038
|
+
vec2 sourceCoord = v_texCoord;
|
|
2039
|
+
${source}
|
|
2040
|
+
vec4 pixel = texture2D(u_source, sourceCoord);
|
|
2041
|
+
vec3 color = pixel.rgb;
|
|
2042
|
+
float alpha = pixel.a;
|
|
2043
|
+
${main}
|
|
2044
|
+
gl_FragColor = vec4(color, 1.0) * alpha;
|
|
2045
|
+
}`;
|
|
2046
|
+
const TEXTURE_WRAP = {
|
|
2047
|
+
stretch: "CLAMP_TO_EDGE",
|
|
2048
|
+
repeat: "REPEAT",
|
|
2049
|
+
mirror: "MIRRORED_REPEAT"
|
|
2050
|
+
};
|
|
2051
|
+
const SHADER_ERROR_TYPES = {
|
|
2052
|
+
vertex: "VERTEX",
|
|
2053
|
+
fragment: "FRAGMENT"
|
|
2054
|
+
};
|
|
2055
|
+
function init({ gl, plane, effects: effects2, dimensions, noSource, fbo }) {
|
|
2056
|
+
const hasFBO = !!fbo;
|
|
2057
|
+
const programData = _initProgram(gl, plane, effects2, hasFBO, noSource);
|
|
2058
|
+
let fboData;
|
|
2059
|
+
if (hasFBO) {
|
|
2060
|
+
fboData = _initFBOProgram(gl, plane, fbo);
|
|
2061
|
+
}
|
|
2062
|
+
return { gl, data: programData, dimensions: dimensions || {}, fboData };
|
|
2063
|
+
}
|
|
2064
|
+
let WEBGL_CONTEXT_SUPPORTED = false;
|
|
2065
|
+
function getWebGLContext(canvas2) {
|
|
2066
|
+
let context;
|
|
2067
|
+
const config = {
|
|
2068
|
+
preserveDrawingBuffer: false,
|
|
2069
|
+
// should improve performance - https://stackoverflow.com/questions/27746091/preservedrawingbuffer-false-is-it-worth-the-effort
|
|
2070
|
+
antialias: false,
|
|
2071
|
+
// should improve performance
|
|
2072
|
+
depth: false,
|
|
2073
|
+
// turn off for explicitness - and in some cases perf boost
|
|
2074
|
+
stencil: false
|
|
2075
|
+
// turn off for explicitness - and in some cases perf boost
|
|
2076
|
+
};
|
|
2077
|
+
context = canvas2.getContext("webgl", config);
|
|
2078
|
+
if (context) {
|
|
2079
|
+
WEBGL_CONTEXT_SUPPORTED = true;
|
|
2080
|
+
} else if (!WEBGL_CONTEXT_SUPPORTED) {
|
|
2081
|
+
context = canvas2.getContext("experimental-webgl", config);
|
|
2082
|
+
} else {
|
|
2083
|
+
return null;
|
|
2084
|
+
}
|
|
2085
|
+
return context;
|
|
2086
|
+
}
|
|
2087
|
+
function resize(gl, dimensions) {
|
|
2088
|
+
const canvas2 = gl.canvas;
|
|
2089
|
+
const realToCSSPixels = 1;
|
|
2090
|
+
const { width, height } = dimensions || {};
|
|
2091
|
+
let displayWidth, displayHeight;
|
|
2092
|
+
if (width && height) {
|
|
2093
|
+
displayWidth = width;
|
|
2094
|
+
displayHeight = height;
|
|
2095
|
+
} else {
|
|
2096
|
+
displayWidth = Math.floor(canvas2.clientWidth * realToCSSPixels);
|
|
2097
|
+
displayHeight = Math.floor(canvas2.clientHeight * realToCSSPixels);
|
|
2098
|
+
}
|
|
2099
|
+
if (canvas2.width !== displayWidth || canvas2.height !== displayHeight) {
|
|
2100
|
+
canvas2.width = displayWidth;
|
|
2101
|
+
canvas2.height = displayHeight;
|
|
2102
|
+
}
|
|
2103
|
+
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
|
|
2104
|
+
}
|
|
2105
|
+
function draw(gl, plane = {}, media, data, fboData) {
|
|
2106
|
+
if (fboData) {
|
|
2107
|
+
drawFBO(gl, fboData);
|
|
2108
|
+
}
|
|
2109
|
+
const {
|
|
2110
|
+
program,
|
|
2111
|
+
source,
|
|
2112
|
+
attributes,
|
|
2113
|
+
uniforms,
|
|
2114
|
+
textures,
|
|
2115
|
+
extensions,
|
|
2116
|
+
vao
|
|
2117
|
+
} = data;
|
|
2118
|
+
const { xSegments = 1, ySegments = 1 } = plane;
|
|
2119
|
+
if (media && source && source.texture && (source.shouldUpdate || !source._sampled)) {
|
|
2120
|
+
source._sampled = true;
|
|
2121
|
+
gl.bindTexture(gl.TEXTURE_2D, source.texture);
|
|
2122
|
+
gl.texImage2D(
|
|
2123
|
+
gl.TEXTURE_2D,
|
|
2124
|
+
0,
|
|
2125
|
+
gl.RGBA,
|
|
2126
|
+
gl.RGBA,
|
|
2127
|
+
gl.UNSIGNED_BYTE,
|
|
2128
|
+
media
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
gl.useProgram(program);
|
|
2132
|
+
if (fboData) {
|
|
2133
|
+
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
|
|
2134
|
+
}
|
|
2135
|
+
if (vao) {
|
|
2136
|
+
extensions.vao.bindVertexArrayOES(vao);
|
|
2137
|
+
} else {
|
|
2138
|
+
_enableVertexAttributes(gl, attributes);
|
|
2139
|
+
}
|
|
2140
|
+
_setUniforms(gl, uniforms);
|
|
2141
|
+
let startTex = gl.TEXTURE0;
|
|
2142
|
+
if (fboData) {
|
|
2143
|
+
gl.activeTexture(startTex);
|
|
2144
|
+
gl.bindTexture(gl.TEXTURE_2D, fboData.oldInfo.texture);
|
|
2145
|
+
gl.uniform1i(gl.getUniformLocation(program, "u_FBOMap"), 0);
|
|
2146
|
+
startTex++;
|
|
2147
|
+
}
|
|
2148
|
+
if (source) {
|
|
2149
|
+
gl.activeTexture(startTex);
|
|
2150
|
+
gl.bindTexture(gl.TEXTURE_2D, source.texture);
|
|
2151
|
+
startTex++;
|
|
2152
|
+
}
|
|
2153
|
+
if (textures) {
|
|
2154
|
+
for (let i = 0; i < textures.length; i++) {
|
|
2155
|
+
gl.activeTexture(startTex + i);
|
|
2156
|
+
const tex = textures[i];
|
|
2157
|
+
gl.bindTexture(gl.TEXTURE_2D, tex.texture);
|
|
2158
|
+
if (tex.update) {
|
|
2159
|
+
gl.texImage2D(
|
|
2160
|
+
gl.TEXTURE_2D,
|
|
2161
|
+
0,
|
|
2162
|
+
gl[tex.format],
|
|
2163
|
+
gl[tex.format],
|
|
2164
|
+
gl.UNSIGNED_BYTE,
|
|
2165
|
+
tex.data
|
|
2166
|
+
);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6 * xSegments * ySegments);
|
|
2171
|
+
}
|
|
2172
|
+
function drawFBO(gl, fboData) {
|
|
2173
|
+
const { size, program, uniforms } = fboData;
|
|
2174
|
+
gl.useProgram(program);
|
|
2175
|
+
gl.viewport(0, 0, size, size);
|
|
2176
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fboData.newInfo.buffer);
|
|
2177
|
+
gl.bindTexture(gl.TEXTURE_2D, fboData.oldInfo.texture);
|
|
2178
|
+
_setUniforms(gl, uniforms);
|
|
2179
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
2180
|
+
{
|
|
2181
|
+
const temp = fboData.oldInfo;
|
|
2182
|
+
fboData.oldInfo = fboData.newInfo;
|
|
2183
|
+
fboData.newInfo = temp;
|
|
2184
|
+
}
|
|
2185
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
2186
|
+
}
|
|
2187
|
+
function destroy(gl, data) {
|
|
2188
|
+
const {
|
|
2189
|
+
program,
|
|
2190
|
+
vertexShader,
|
|
2191
|
+
fragmentShader,
|
|
2192
|
+
source,
|
|
2193
|
+
attributes,
|
|
2194
|
+
extensions,
|
|
2195
|
+
vao,
|
|
2196
|
+
oldInfo,
|
|
2197
|
+
newInfo
|
|
2198
|
+
} = data;
|
|
2199
|
+
(attributes || []).forEach((attr) => gl.deleteBuffer(attr.buffer));
|
|
2200
|
+
if (vao) extensions.vao.deleteVertexArrayOES(vao);
|
|
2201
|
+
if (source && source.texture) gl.deleteTexture(source.texture);
|
|
2202
|
+
if (oldInfo) {
|
|
2203
|
+
oldInfo.texture && gl.deleteTexture(oldInfo.texture);
|
|
2204
|
+
oldInfo.buffer && gl.deleteFramebuffer(oldInfo.buffer);
|
|
2205
|
+
}
|
|
2206
|
+
if (newInfo) {
|
|
2207
|
+
newInfo.texture && gl.deleteTexture(newInfo.texture);
|
|
2208
|
+
newInfo.buffer && gl.deleteFramebuffer(newInfo.buffer);
|
|
2209
|
+
}
|
|
2210
|
+
gl.deleteProgram(program);
|
|
2211
|
+
gl.deleteShader(vertexShader);
|
|
2212
|
+
gl.deleteShader(fragmentShader);
|
|
2213
|
+
}
|
|
2214
|
+
function _initProgram(gl, plane, effects2, hasFBO = false, noSource = false) {
|
|
2215
|
+
const source = noSource ? null : {
|
|
2216
|
+
texture: createTexture(gl).texture,
|
|
2217
|
+
buffer: null
|
|
2218
|
+
};
|
|
2219
|
+
if (source) {
|
|
2220
|
+
gl.bindTexture(gl.TEXTURE_2D, source.texture);
|
|
2221
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
2222
|
+
}
|
|
2223
|
+
const data = _mergeEffectsData(plane, effects2, hasFBO, noSource);
|
|
2224
|
+
const vertexSrc = _stringifyShaderSrc(
|
|
2225
|
+
data.vertex,
|
|
2226
|
+
noSource ? vertexSimpleTemplate : vertexMediaTemplate
|
|
2227
|
+
);
|
|
2228
|
+
const fragmentSrc = _stringifyShaderSrc(
|
|
2229
|
+
data.fragment,
|
|
2230
|
+
noSource ? fragmentSimpleTemplate : fragmentMediaTemplate
|
|
2231
|
+
);
|
|
2232
|
+
const { program, vertexShader, fragmentShader, error, type } = _getWebGLProgram(gl, vertexSrc, fragmentSrc);
|
|
2233
|
+
if (error || DEBUG) {
|
|
2234
|
+
logShaders(type, error, vertexSrc, fragmentSrc);
|
|
2235
|
+
}
|
|
2236
|
+
let vaoExt, vao;
|
|
2237
|
+
try {
|
|
2238
|
+
vaoExt = gl.getExtension("OES_vertex_array_object");
|
|
2239
|
+
vao = vaoExt.createVertexArrayOES();
|
|
2240
|
+
vaoExt.bindVertexArrayOES(vao);
|
|
2241
|
+
} catch (e) {
|
|
2242
|
+
}
|
|
2243
|
+
const attributes = _initVertexAttributes(gl, program, data.attributes);
|
|
2244
|
+
if (vao) {
|
|
2245
|
+
_enableVertexAttributes(gl, attributes);
|
|
2246
|
+
vaoExt.bindVertexArrayOES(null);
|
|
2247
|
+
}
|
|
2248
|
+
const uniforms = _initUniforms(gl, program, data.uniforms);
|
|
2249
|
+
return {
|
|
2250
|
+
extensions: {
|
|
2251
|
+
vao: vaoExt
|
|
2252
|
+
},
|
|
2253
|
+
program,
|
|
2254
|
+
vertexShader,
|
|
2255
|
+
fragmentShader,
|
|
2256
|
+
source,
|
|
2257
|
+
attributes,
|
|
2258
|
+
uniforms,
|
|
2259
|
+
textures: data.textures,
|
|
2260
|
+
vao
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
function _initFBOProgram(gl, plane, fbo) {
|
|
2264
|
+
const data = _mergeEffectsData(plane, fbo.effects, false, true);
|
|
2265
|
+
const vertexSrc = _stringifyShaderSrc(
|
|
2266
|
+
data.vertex,
|
|
2267
|
+
vertexSimpleTemplate
|
|
2268
|
+
);
|
|
2269
|
+
const fragmentSrc = _stringifyShaderSrc(
|
|
2270
|
+
data.fragment,
|
|
2271
|
+
fragmentSimpleTemplate
|
|
2272
|
+
);
|
|
2273
|
+
const { program, vertexShader, fragmentShader, error, type } = _getWebGLProgram(gl, vertexSrc, fragmentSrc);
|
|
2274
|
+
if (error || DEBUG) {
|
|
2275
|
+
logShaders(type, error, vertexSrc, fragmentSrc);
|
|
2276
|
+
}
|
|
2277
|
+
const uniforms = _initUniforms(gl, program, data.uniforms);
|
|
2278
|
+
const tex1 = _createFloatTexture(gl, { width: fbo.size, height: fbo.size }).texture;
|
|
2279
|
+
const tex2 = _createFloatTexture(gl, { width: fbo.size, height: fbo.size }).texture;
|
|
2280
|
+
const oldInfo = {
|
|
2281
|
+
buffer: _createFramebuffer(gl, tex1),
|
|
2282
|
+
texture: tex1
|
|
2283
|
+
};
|
|
2284
|
+
const newInfo = {
|
|
2285
|
+
buffer: _createFramebuffer(gl, tex2),
|
|
2286
|
+
texture: tex2
|
|
2287
|
+
};
|
|
2288
|
+
return {
|
|
2289
|
+
program,
|
|
2290
|
+
vertexShader,
|
|
2291
|
+
fragmentShader,
|
|
2292
|
+
uniforms,
|
|
2293
|
+
oldInfo,
|
|
2294
|
+
newInfo,
|
|
2295
|
+
size: fbo.size
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
function _mergeEffectsData(plane, effects2, hasFBO = false, noSource = false) {
|
|
2299
|
+
return effects2.reduce(
|
|
2300
|
+
(result, config) => {
|
|
2301
|
+
const {
|
|
2302
|
+
attributes = [],
|
|
2303
|
+
uniforms = [],
|
|
2304
|
+
textures = [],
|
|
2305
|
+
varying = {}
|
|
2306
|
+
} = config;
|
|
2307
|
+
const merge = (shader) => Object.keys(config[shader] || {}).forEach((key) => {
|
|
2308
|
+
if (key === "constant" || key === "main" || key === "source") {
|
|
2309
|
+
result[shader][key] += config[shader][key] + "\n";
|
|
2310
|
+
} else {
|
|
2311
|
+
result[shader][key] = {
|
|
2312
|
+
...result[shader][key],
|
|
2313
|
+
...config[shader][key]
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
});
|
|
2317
|
+
merge("vertex");
|
|
2318
|
+
merge("fragment");
|
|
2319
|
+
attributes.forEach((attribute) => {
|
|
2320
|
+
const found = result.attributes.some((attr) => {
|
|
2321
|
+
if (attr.name === attribute.name) {
|
|
2322
|
+
Object.assign(attr, attribute);
|
|
2323
|
+
return true;
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2326
|
+
if (!found) {
|
|
2327
|
+
result.attributes.push(attribute);
|
|
2328
|
+
}
|
|
2329
|
+
});
|
|
2330
|
+
result.attributes.forEach((attr) => {
|
|
2331
|
+
if (attr.extends) {
|
|
2332
|
+
const found = result.attributes.some((attrToExtend) => {
|
|
2333
|
+
if (attrToExtend.name === attr.extends) {
|
|
2334
|
+
Object.assign(attr, attrToExtend, {
|
|
2335
|
+
name: attr.name
|
|
2336
|
+
});
|
|
2337
|
+
return true;
|
|
2338
|
+
}
|
|
2339
|
+
});
|
|
2340
|
+
if (!found) {
|
|
2341
|
+
throw new Error(
|
|
2342
|
+
`Could not find attribute ${attr.extends} to extend`
|
|
2343
|
+
);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
});
|
|
2347
|
+
result.uniforms.push(...uniforms);
|
|
2348
|
+
result.textures.push(...textures);
|
|
2349
|
+
Object.assign(result.vertex.varying, varying);
|
|
2350
|
+
Object.assign(result.fragment.varying, varying);
|
|
2351
|
+
return result;
|
|
2352
|
+
},
|
|
2353
|
+
getEffectDefaults(plane, hasFBO, noSource)
|
|
2354
|
+
);
|
|
2355
|
+
}
|
|
2356
|
+
function _getPlaneCoords({ xEnd, yEnd, factor }, plane = {}) {
|
|
2357
|
+
const { xSegments = 1, ySegments = 1 } = plane;
|
|
2358
|
+
const result = [];
|
|
2359
|
+
for (let i = 0; i < xSegments; i++) {
|
|
2360
|
+
for (let j = 0; j < ySegments; j++) {
|
|
2361
|
+
result.push(
|
|
2362
|
+
xEnd * i / xSegments - factor,
|
|
2363
|
+
yEnd * j / ySegments - factor
|
|
2364
|
+
);
|
|
2365
|
+
result.push(
|
|
2366
|
+
xEnd * i / xSegments - factor,
|
|
2367
|
+
yEnd * (j + 1) / ySegments - factor
|
|
2368
|
+
);
|
|
2369
|
+
result.push(
|
|
2370
|
+
xEnd * (i + 1) / xSegments - factor,
|
|
2371
|
+
yEnd * j / ySegments - factor
|
|
2372
|
+
);
|
|
2373
|
+
result.push(
|
|
2374
|
+
xEnd * (i + 1) / xSegments - factor,
|
|
2375
|
+
yEnd * j / ySegments - factor
|
|
2376
|
+
);
|
|
2377
|
+
result.push(
|
|
2378
|
+
xEnd * i / xSegments - factor,
|
|
2379
|
+
yEnd * (j + 1) / ySegments - factor
|
|
2380
|
+
);
|
|
2381
|
+
result.push(
|
|
2382
|
+
xEnd * (i + 1) / xSegments - factor,
|
|
2383
|
+
yEnd * (j + 1) / ySegments - factor
|
|
2384
|
+
);
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
return result;
|
|
2388
|
+
}
|
|
2389
|
+
function getEffectDefaults(plane, hasFBO, noSource) {
|
|
2390
|
+
const uniforms = noSource ? [] : [
|
|
2391
|
+
{
|
|
2392
|
+
name: "u_source",
|
|
2393
|
+
type: "i",
|
|
2394
|
+
data: [hasFBO ? 1 : 0]
|
|
2395
|
+
}
|
|
2396
|
+
];
|
|
2397
|
+
const attributes = [
|
|
2398
|
+
{
|
|
2399
|
+
name: "a_position",
|
|
2400
|
+
data: new Float32Array(
|
|
2401
|
+
_getPlaneCoords({ xEnd: 2, yEnd: 2, factor: 1 }, plane)
|
|
2402
|
+
),
|
|
2403
|
+
size: 2,
|
|
2404
|
+
type: "FLOAT"
|
|
2405
|
+
}
|
|
2406
|
+
];
|
|
2407
|
+
if (!noSource) {
|
|
2408
|
+
attributes.push({
|
|
2409
|
+
name: "a_texCoord",
|
|
2410
|
+
data: new Float32Array(
|
|
2411
|
+
_getPlaneCoords({ xEnd: 1, yEnd: 1, factor: 0 }, plane)
|
|
2412
|
+
),
|
|
2413
|
+
size: 2,
|
|
2414
|
+
type: "FLOAT"
|
|
2415
|
+
});
|
|
2416
|
+
}
|
|
2417
|
+
return {
|
|
2418
|
+
vertex: {
|
|
2419
|
+
uniform: {},
|
|
2420
|
+
attribute: {},
|
|
2421
|
+
varying: {},
|
|
2422
|
+
constant: "",
|
|
2423
|
+
main: ""
|
|
2424
|
+
},
|
|
2425
|
+
fragment: {
|
|
2426
|
+
uniform: {},
|
|
2427
|
+
varying: {},
|
|
2428
|
+
constant: "",
|
|
2429
|
+
main: "",
|
|
2430
|
+
source: ""
|
|
2431
|
+
},
|
|
2432
|
+
attributes,
|
|
2433
|
+
uniforms,
|
|
2434
|
+
/*
|
|
2435
|
+
* Default textures
|
|
2436
|
+
*/
|
|
2437
|
+
textures: []
|
|
2438
|
+
};
|
|
2439
|
+
}
|
|
2440
|
+
function _stringifyShaderSrc(data, template) {
|
|
2441
|
+
const templateData = Object.entries(data).reduce((result, [key, value]) => {
|
|
2442
|
+
if (["uniform", "attribute", "varying"].includes(key)) {
|
|
2443
|
+
result[key] = Object.entries(value).reduce(
|
|
2444
|
+
(str, [name, type]) => str + `${key} ${type} ${name};
|
|
2445
|
+
`,
|
|
2446
|
+
""
|
|
2447
|
+
);
|
|
2448
|
+
} else {
|
|
2449
|
+
result[key] = value;
|
|
2450
|
+
}
|
|
2451
|
+
return result;
|
|
2452
|
+
}, {});
|
|
2453
|
+
return template(templateData);
|
|
2454
|
+
}
|
|
2455
|
+
function _getWebGLProgram(gl, vertexSrc, fragmentSrc) {
|
|
2456
|
+
const vertexShader = _createShader(gl, gl.VERTEX_SHADER, vertexSrc);
|
|
2457
|
+
const fragmentShader = _createShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);
|
|
2458
|
+
if (vertexShader.error) {
|
|
2459
|
+
return vertexShader;
|
|
2460
|
+
}
|
|
2461
|
+
if (fragmentShader.error) {
|
|
2462
|
+
return fragmentShader;
|
|
2463
|
+
}
|
|
2464
|
+
return _createProgram(gl, vertexShader, fragmentShader);
|
|
2465
|
+
}
|
|
2466
|
+
function _createProgram(gl, vertexShader, fragmentShader) {
|
|
2467
|
+
const program = gl.createProgram();
|
|
2468
|
+
gl.attachShader(program, vertexShader);
|
|
2469
|
+
gl.attachShader(program, fragmentShader);
|
|
2470
|
+
gl.linkProgram(program);
|
|
2471
|
+
const success = gl.getProgramParameter(program, gl.LINK_STATUS);
|
|
2472
|
+
if (success) {
|
|
2473
|
+
return { program, vertexShader, fragmentShader };
|
|
2474
|
+
}
|
|
2475
|
+
const exception = {
|
|
2476
|
+
error: gl.getProgramInfoLog(program),
|
|
2477
|
+
type: "program"
|
|
2478
|
+
};
|
|
2479
|
+
gl.deleteProgram(program);
|
|
2480
|
+
return exception;
|
|
2481
|
+
}
|
|
2482
|
+
function _createShader(gl, type, source) {
|
|
2483
|
+
const shader = gl.createShader(type);
|
|
2484
|
+
gl.shaderSource(shader, source);
|
|
2485
|
+
gl.compileShader(shader);
|
|
2486
|
+
const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
|
|
2487
|
+
if (success) {
|
|
2488
|
+
return shader;
|
|
2489
|
+
}
|
|
2490
|
+
const exception = {
|
|
2491
|
+
error: gl.getShaderInfoLog(shader),
|
|
2492
|
+
type: type === gl.VERTEX_SHADER ? SHADER_ERROR_TYPES.vertex : SHADER_ERROR_TYPES.fragment
|
|
2493
|
+
};
|
|
2494
|
+
gl.deleteShader(shader);
|
|
2495
|
+
return exception;
|
|
2496
|
+
}
|
|
2497
|
+
function createTexture(gl, {
|
|
2498
|
+
width = 1,
|
|
2499
|
+
height = 1,
|
|
2500
|
+
data = null,
|
|
2501
|
+
format = "RGBA",
|
|
2502
|
+
wrap = "stretch",
|
|
2503
|
+
filter = "LINEAR",
|
|
2504
|
+
textureType = "UNSIGNED_BYTE"
|
|
2505
|
+
} = {}) {
|
|
2506
|
+
const texture = gl.createTexture();
|
|
2507
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
2508
|
+
gl.texParameteri(
|
|
2509
|
+
gl.TEXTURE_2D,
|
|
2510
|
+
gl.TEXTURE_WRAP_S,
|
|
2511
|
+
gl[_getTextureWrap(wrap.x || wrap)]
|
|
2512
|
+
);
|
|
2513
|
+
gl.texParameteri(
|
|
2514
|
+
gl.TEXTURE_2D,
|
|
2515
|
+
gl.TEXTURE_WRAP_T,
|
|
2516
|
+
gl[_getTextureWrap(wrap.y || wrap)]
|
|
2517
|
+
);
|
|
2518
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl[filter]);
|
|
2519
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl[filter]);
|
|
2520
|
+
if (data) {
|
|
2521
|
+
gl.texImage2D(
|
|
2522
|
+
gl.TEXTURE_2D,
|
|
2523
|
+
0,
|
|
2524
|
+
gl[format],
|
|
2525
|
+
gl[format],
|
|
2526
|
+
gl[textureType],
|
|
2527
|
+
data
|
|
2528
|
+
);
|
|
2529
|
+
} else {
|
|
2530
|
+
gl.texImage2D(
|
|
2531
|
+
gl.TEXTURE_2D,
|
|
2532
|
+
0,
|
|
2533
|
+
gl[format],
|
|
2534
|
+
width,
|
|
2535
|
+
height,
|
|
2536
|
+
0,
|
|
2537
|
+
gl[format],
|
|
2538
|
+
gl[textureType],
|
|
2539
|
+
null
|
|
2540
|
+
);
|
|
2541
|
+
}
|
|
2542
|
+
return { texture, width, height, format };
|
|
2543
|
+
}
|
|
2544
|
+
function _createBuffer(gl, program, name, data) {
|
|
2545
|
+
const location = gl.getAttribLocation(program, name);
|
|
2546
|
+
const buffer = gl.createBuffer();
|
|
2547
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
2548
|
+
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
2549
|
+
return { location, buffer };
|
|
2550
|
+
}
|
|
2551
|
+
function _createFramebuffer(gl, tex) {
|
|
2552
|
+
const fb = gl.createFramebuffer();
|
|
2553
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
|
|
2554
|
+
gl.framebufferTexture2D(
|
|
2555
|
+
gl.FRAMEBUFFER,
|
|
2556
|
+
gl.COLOR_ATTACHMENT0,
|
|
2557
|
+
gl.TEXTURE_2D,
|
|
2558
|
+
tex,
|
|
2559
|
+
0
|
|
2560
|
+
);
|
|
2561
|
+
return fb;
|
|
2562
|
+
}
|
|
2563
|
+
function _initVertexAttributes(gl, program, data) {
|
|
2564
|
+
return (data || []).map((attr) => {
|
|
2565
|
+
const { location, buffer } = _createBuffer(
|
|
2566
|
+
gl,
|
|
2567
|
+
program,
|
|
2568
|
+
attr.name,
|
|
2569
|
+
attr.data
|
|
2570
|
+
);
|
|
2571
|
+
return {
|
|
2572
|
+
name: attr.name,
|
|
2573
|
+
location,
|
|
2574
|
+
buffer,
|
|
2575
|
+
type: attr.type,
|
|
2576
|
+
size: attr.size
|
|
2577
|
+
};
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
function _initUniforms(gl, program, uniforms) {
|
|
2581
|
+
return (uniforms || []).map((uniform) => {
|
|
2582
|
+
const location = gl.getUniformLocation(program, uniform.name);
|
|
2583
|
+
return {
|
|
2584
|
+
location,
|
|
2585
|
+
size: uniform.size || uniform.data.length,
|
|
2586
|
+
type: uniform.type,
|
|
2587
|
+
data: uniform.data
|
|
2588
|
+
};
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
function _setUniforms(gl, uniformData) {
|
|
2592
|
+
(uniformData || []).forEach((uniform) => {
|
|
2593
|
+
let { size, type, location, data } = uniform;
|
|
2594
|
+
if (type === "i") {
|
|
2595
|
+
data = new Int32Array(data);
|
|
2596
|
+
}
|
|
2597
|
+
gl[`uniform${size}${type}v`](location, data);
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
function _enableVertexAttributes(gl, attributes) {
|
|
2601
|
+
(attributes || []).forEach((attrib) => {
|
|
2602
|
+
const { location, buffer, size, type } = attrib;
|
|
2603
|
+
gl.enableVertexAttribArray(location);
|
|
2604
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
2605
|
+
gl.vertexAttribPointer(location, size, gl[type], false, 0, 0);
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
function _getTextureWrap(key) {
|
|
2609
|
+
return TEXTURE_WRAP[key] || TEXTURE_WRAP["stretch"];
|
|
2610
|
+
}
|
|
2611
|
+
function _createFloatTexture(gl, {
|
|
2612
|
+
width,
|
|
2613
|
+
height,
|
|
2614
|
+
data = null,
|
|
2615
|
+
format = "RGBA",
|
|
2616
|
+
wrap = "stretch",
|
|
2617
|
+
filter = "NEAREST"
|
|
2618
|
+
} = {}) {
|
|
2619
|
+
const ext = gl.getExtension("OES_texture_float");
|
|
2620
|
+
if (!ext) {
|
|
2621
|
+
throw new Error("OES_texture_float not supported");
|
|
2622
|
+
}
|
|
2623
|
+
return createTexture(gl, {
|
|
2624
|
+
width,
|
|
2625
|
+
height,
|
|
2626
|
+
data,
|
|
2627
|
+
format,
|
|
2628
|
+
wrap,
|
|
2629
|
+
filter,
|
|
2630
|
+
textureType: "FLOAT"
|
|
2631
|
+
});
|
|
2632
|
+
}
|
|
2633
|
+
function logShaders(type, error, vertexSrc, fragmentSrc) {
|
|
2634
|
+
function addLineNumbers(str) {
|
|
2635
|
+
return str.split("\n").map((line, i) => `${i + 1}: ${line}`).join("\n");
|
|
2636
|
+
}
|
|
2637
|
+
if (error) {
|
|
2638
|
+
throw new Error(
|
|
2639
|
+
`${type} error:: ${error}
|
|
2640
|
+
${addLineNumbers(type === SHADER_ERROR_TYPES.fragment ? fragmentSrc : vertexSrc)}`
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
class Kampos {
|
|
2645
|
+
/**
|
|
2646
|
+
* @constructor
|
|
2647
|
+
*/
|
|
2648
|
+
constructor(config) {
|
|
2649
|
+
if (!config || !config.target) {
|
|
2650
|
+
throw new Error("A target canvas was not provided");
|
|
2651
|
+
}
|
|
2652
|
+
if (Kampos.preventContextCreation)
|
|
2653
|
+
throw new Error("Context creation is prevented");
|
|
2654
|
+
this._contextCreationError = function() {
|
|
2655
|
+
Kampos.preventContextCreation = true;
|
|
2656
|
+
if (config && config.onContextCreationError) {
|
|
2657
|
+
config.onContextCreationError.call(this, config);
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
config.target.addEventListener(
|
|
2661
|
+
"webglcontextcreationerror",
|
|
2662
|
+
this._contextCreationError,
|
|
2663
|
+
false
|
|
2664
|
+
);
|
|
2665
|
+
const success = this.init(config);
|
|
2666
|
+
if (!success) throw new Error("Could not create context");
|
|
2667
|
+
this._restoreContext = (e) => {
|
|
2668
|
+
e && e.preventDefault();
|
|
2669
|
+
this.config.target.removeEventListener(
|
|
2670
|
+
"webglcontextrestored",
|
|
2671
|
+
this._restoreContext,
|
|
2672
|
+
true
|
|
2673
|
+
);
|
|
2674
|
+
const success2 = this.init();
|
|
2675
|
+
if (!success2) return false;
|
|
2676
|
+
if (this._source) {
|
|
2677
|
+
this.setSource(this._source);
|
|
2678
|
+
}
|
|
2679
|
+
delete this._source;
|
|
2680
|
+
if (config && config.onContextRestored) {
|
|
2681
|
+
config.onContextRestored.call(this, config);
|
|
2682
|
+
}
|
|
2683
|
+
return true;
|
|
2684
|
+
};
|
|
2685
|
+
this._loseContext = (e) => {
|
|
2686
|
+
e.preventDefault();
|
|
2687
|
+
if (this.gl && this.gl.isContextLost()) {
|
|
2688
|
+
this.lostContext = true;
|
|
2689
|
+
this.config.target.addEventListener(
|
|
2690
|
+
"webglcontextrestored",
|
|
2691
|
+
this._restoreContext,
|
|
2692
|
+
true
|
|
2693
|
+
);
|
|
2694
|
+
this.destroy(true);
|
|
2695
|
+
if (config && config.onContextLost) {
|
|
2696
|
+
config.onContextLost.call(this, config);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
};
|
|
2700
|
+
this.config.target.addEventListener(
|
|
2701
|
+
"webglcontextlost",
|
|
2702
|
+
this._loseContext,
|
|
2703
|
+
true
|
|
2704
|
+
);
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* Initializes a Kampos instance.
|
|
2708
|
+
* This is called inside the constructor,
|
|
2709
|
+
* but can be called again after effects have changed
|
|
2710
|
+
* or after {@link Kampos#destroy}.
|
|
2711
|
+
*
|
|
2712
|
+
* @param {kamposConfig} [config] defaults to `this.config`
|
|
2713
|
+
* @return {boolean} success whether initializing of the context and program were successful
|
|
2714
|
+
*/
|
|
2715
|
+
init(config) {
|
|
2716
|
+
config = config || this.config;
|
|
2717
|
+
let { target, plane, effects: effects2, ticker, noSource, fbo } = config;
|
|
2718
|
+
if (Kampos.preventContextCreation) return false;
|
|
2719
|
+
this.lostContext = false;
|
|
2720
|
+
let gl = getWebGLContext(target);
|
|
2721
|
+
if (!gl) return false;
|
|
2722
|
+
if (gl.isContextLost()) {
|
|
2723
|
+
const success = this.restoreContext();
|
|
2724
|
+
if (!success) return false;
|
|
2725
|
+
gl = getWebGLContext(this.config.target);
|
|
2726
|
+
if (!gl) return false;
|
|
2727
|
+
}
|
|
2728
|
+
const { x: xSegments = 1, y: ySegments = 1 } = plane && plane.segments ? typeof plane.segments === "object" ? plane.segments : { x: plane.segments, y: plane.segments } : {};
|
|
2729
|
+
this.plane = {
|
|
2730
|
+
xSegments,
|
|
2731
|
+
ySegments
|
|
2732
|
+
};
|
|
2733
|
+
const { data, fboData } = init({
|
|
2734
|
+
gl,
|
|
2735
|
+
plane: this.plane,
|
|
2736
|
+
effects: effects2,
|
|
2737
|
+
dimensions: this.dimensions,
|
|
2738
|
+
noSource,
|
|
2739
|
+
fbo
|
|
2740
|
+
});
|
|
2741
|
+
this.gl = gl;
|
|
2742
|
+
this.data = data;
|
|
2743
|
+
this.fboData = fboData;
|
|
2744
|
+
this.config = config;
|
|
2745
|
+
if (ticker) {
|
|
2746
|
+
this.ticker = ticker;
|
|
2747
|
+
ticker.add(this);
|
|
2748
|
+
}
|
|
2749
|
+
return true;
|
|
2750
|
+
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Set the source config.
|
|
2753
|
+
*
|
|
2754
|
+
* @param {ArrayBufferView|ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap|kamposSource} source
|
|
2755
|
+
* @param {boolean} [skipTextureCreation] defaults to `false`
|
|
2756
|
+
* @example
|
|
2757
|
+
* const media = document.querySelector('#video');
|
|
2758
|
+
* kampos.setSource(media);
|
|
2759
|
+
*/
|
|
2760
|
+
setSource(source, skipTextureCreation) {
|
|
2761
|
+
if (!source) return;
|
|
2762
|
+
if (this.lostContext) {
|
|
2763
|
+
const success = this.restoreContext();
|
|
2764
|
+
if (!success) return;
|
|
2765
|
+
}
|
|
2766
|
+
let media, width, height, shouldUpdate;
|
|
2767
|
+
if (Object.prototype.toString.call(source) === "[object Object]") {
|
|
2768
|
+
({ media, width, height, shouldUpdate } = source);
|
|
2769
|
+
} else {
|
|
2770
|
+
media = source;
|
|
2771
|
+
}
|
|
2772
|
+
const isVideo = media instanceof HTMLVideoElement;
|
|
2773
|
+
const isCanvas = media instanceof HTMLCanvasElement;
|
|
2774
|
+
if (width && height) {
|
|
2775
|
+
this.dimensions = { width, height };
|
|
2776
|
+
} else if (isVideo) {
|
|
2777
|
+
this.dimensions = { width: media.videoWidth, height: media.videoHeight };
|
|
2778
|
+
} else if (media.naturalWidth) {
|
|
2779
|
+
this.dimensions = { width: media.naturalWidth, height: media.naturalHeight };
|
|
2780
|
+
}
|
|
2781
|
+
if (source && !this.data.source) {
|
|
2782
|
+
this.data.source = source;
|
|
2783
|
+
}
|
|
2784
|
+
if (typeof shouldUpdate === "boolean") {
|
|
2785
|
+
this.data.source.shouldUpdate = shouldUpdate;
|
|
2786
|
+
} else {
|
|
2787
|
+
this.data.source.shouldUpdate = isVideo || isCanvas;
|
|
2788
|
+
}
|
|
2789
|
+
resize(this.gl, this.dimensions);
|
|
2790
|
+
if (!skipTextureCreation) {
|
|
2791
|
+
this._createTextures();
|
|
2792
|
+
}
|
|
2793
|
+
this.media = media || this.media;
|
|
2794
|
+
this.data.source._sampled = false;
|
|
2795
|
+
}
|
|
2796
|
+
/**
|
|
2797
|
+
* Draw current scene.
|
|
2798
|
+
*
|
|
2799
|
+
* @param {number} [time]
|
|
2800
|
+
*/
|
|
2801
|
+
draw(time) {
|
|
2802
|
+
if (this.lostContext) {
|
|
2803
|
+
const success = this.restoreContext();
|
|
2804
|
+
if (!success) return;
|
|
2805
|
+
}
|
|
2806
|
+
const cb = this.config.beforeDraw;
|
|
2807
|
+
if (cb && cb(time) === false) return;
|
|
2808
|
+
draw(this.gl, this.plane, this.media, this.data, this.fboData);
|
|
2809
|
+
if (this.config.afterDraw) {
|
|
2810
|
+
this.config.afterDraw(time);
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Starts the animation loop.
|
|
2815
|
+
*
|
|
2816
|
+
* If a {@link Ticker} is used, this instance will be added to that {@link Ticker}.
|
|
2817
|
+
*
|
|
2818
|
+
* @param {function} [beforeDraw] function to run before each draw call
|
|
2819
|
+
* @param {function} [afterDraw] function to run after each draw call
|
|
2820
|
+
*/
|
|
2821
|
+
play(beforeDraw, afterDraw) {
|
|
2822
|
+
if (typeof beforeDraw === "function") {
|
|
2823
|
+
this.config.beforeDraw = beforeDraw;
|
|
2824
|
+
}
|
|
2825
|
+
if (typeof afterDraw === "function") {
|
|
2826
|
+
this.config.afterDraw = afterDraw;
|
|
2827
|
+
}
|
|
2828
|
+
if (this.ticker) {
|
|
2829
|
+
if (this.animationFrameId) {
|
|
2830
|
+
this.stop();
|
|
2831
|
+
}
|
|
2832
|
+
if (!this.playing) {
|
|
2833
|
+
this.playing = true;
|
|
2834
|
+
this.ticker.add(this);
|
|
2835
|
+
}
|
|
2836
|
+
} else if (!this.animationFrameId) {
|
|
2837
|
+
const loop = (time) => {
|
|
2838
|
+
this.animationFrameId = window.requestAnimationFrame(loop);
|
|
2839
|
+
this.draw(time);
|
|
2840
|
+
};
|
|
2841
|
+
this.animationFrameId = window.requestAnimationFrame(loop);
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Stops the animation loop.
|
|
2846
|
+
*
|
|
2847
|
+
* If a {@link Ticker} is used, this instance will be removed from that {@link Ticker}.
|
|
2848
|
+
*/
|
|
2849
|
+
stop() {
|
|
2850
|
+
if (this.animationFrameId) {
|
|
2851
|
+
window.cancelAnimationFrame(this.animationFrameId);
|
|
2852
|
+
this.animationFrameId = null;
|
|
2853
|
+
}
|
|
2854
|
+
if (this.playing) {
|
|
2855
|
+
this.playing = false;
|
|
2856
|
+
this.ticker.remove(this);
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* Stops the animation loop and frees all resources.
|
|
2861
|
+
*
|
|
2862
|
+
* @param {boolean} [keepState] for internal use.
|
|
2863
|
+
*/
|
|
2864
|
+
destroy(keepState) {
|
|
2865
|
+
this.stop();
|
|
2866
|
+
if (this.gl && this.data) {
|
|
2867
|
+
destroy(this.gl, this.data);
|
|
2868
|
+
if (this.fboData) {
|
|
2869
|
+
destroy(this.gl, this.fboData);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
if (keepState) {
|
|
2873
|
+
const dims = this.dimensions || {};
|
|
2874
|
+
this._source = this._source || {
|
|
2875
|
+
media: this.media,
|
|
2876
|
+
width: dims.width,
|
|
2877
|
+
height: dims.height
|
|
2878
|
+
};
|
|
2879
|
+
} else {
|
|
2880
|
+
if (this.config) {
|
|
2881
|
+
this.config.target.removeEventListener(
|
|
2882
|
+
"webglcontextlost",
|
|
2883
|
+
this._loseContext,
|
|
2884
|
+
true
|
|
2885
|
+
);
|
|
2886
|
+
this.config.target.removeEventListener(
|
|
2887
|
+
"webglcontextcreationerror",
|
|
2888
|
+
this._contextCreationError,
|
|
2889
|
+
false
|
|
2890
|
+
);
|
|
2891
|
+
}
|
|
2892
|
+
this.config = null;
|
|
2893
|
+
this.dimensions = null;
|
|
2894
|
+
}
|
|
2895
|
+
this.gl = null;
|
|
2896
|
+
this.data = null;
|
|
2897
|
+
this.media = null;
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
* Restore a lost WebGL context fot the given target.
|
|
2901
|
+
* This will replace canvas DOM element with a fresh clone.
|
|
2902
|
+
*
|
|
2903
|
+
* @return {boolean} success whether forcing a context restore was successful
|
|
2904
|
+
*/
|
|
2905
|
+
restoreContext() {
|
|
2906
|
+
if (Kampos.preventContextCreation) return false;
|
|
2907
|
+
const canvas2 = this.config.target;
|
|
2908
|
+
const clone = this.config.target.cloneNode(true);
|
|
2909
|
+
const parent = canvas2.parentNode;
|
|
2910
|
+
if (parent) {
|
|
2911
|
+
parent.replaceChild(clone, canvas2);
|
|
2912
|
+
}
|
|
2913
|
+
this.config.target = clone;
|
|
2914
|
+
canvas2.removeEventListener("webglcontextlost", this._loseContext, true);
|
|
2915
|
+
canvas2.removeEventListener(
|
|
2916
|
+
"webglcontextrestored",
|
|
2917
|
+
this._restoreContext,
|
|
2918
|
+
true
|
|
2919
|
+
);
|
|
2920
|
+
canvas2.removeEventListener(
|
|
2921
|
+
"webglcontextcreationerror",
|
|
2922
|
+
this._contextCreationError,
|
|
2923
|
+
false
|
|
2924
|
+
);
|
|
2925
|
+
clone.addEventListener("webglcontextlost", this._loseContext, true);
|
|
2926
|
+
clone.addEventListener(
|
|
2927
|
+
"webglcontextcreationerror",
|
|
2928
|
+
this._contextCreationError,
|
|
2929
|
+
false
|
|
2930
|
+
);
|
|
2931
|
+
if (this.lostContext) {
|
|
2932
|
+
return this._restoreContext();
|
|
2933
|
+
}
|
|
2934
|
+
return true;
|
|
2935
|
+
}
|
|
2936
|
+
_createTextures() {
|
|
2937
|
+
this.data && this.data.textures.forEach((texture, i) => {
|
|
2938
|
+
const data = this.data.textures[i];
|
|
2939
|
+
data.texture = createTexture(this.gl, {
|
|
2940
|
+
width: this.dimensions.width,
|
|
2941
|
+
height: this.dimensions.height,
|
|
2942
|
+
format: texture.format,
|
|
2943
|
+
data: texture.data,
|
|
2944
|
+
wrap: texture.wrap
|
|
2945
|
+
}).texture;
|
|
2946
|
+
data.format = texture.format;
|
|
2947
|
+
data.update = texture.update;
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
const effects$1 = {
|
|
2952
|
+
alphaMask,
|
|
2953
|
+
blend,
|
|
2954
|
+
brightnessContrast,
|
|
2955
|
+
channelSplit,
|
|
2956
|
+
deformation,
|
|
2957
|
+
displacement,
|
|
2958
|
+
duotone,
|
|
2959
|
+
hueSaturation,
|
|
2960
|
+
kaleidoscope,
|
|
2961
|
+
turbulence,
|
|
2962
|
+
slitScan,
|
|
2963
|
+
flowmapGridDisplacement
|
|
2964
|
+
};
|
|
2965
|
+
function transparentVideo() {
|
|
2966
|
+
return {
|
|
2967
|
+
vertex: {
|
|
2968
|
+
uniform: {
|
|
2969
|
+
u_texOffset: "vec2"
|
|
2970
|
+
},
|
|
2971
|
+
main: "v_texAlphaCoord = v_texCoord + u_texOffset;"
|
|
2972
|
+
},
|
|
2973
|
+
fragment: {
|
|
2974
|
+
uniform: {
|
|
2975
|
+
u_tvEnabled: "bool"
|
|
2976
|
+
},
|
|
2977
|
+
main: `
|
|
2978
|
+
if (u_tvEnabled) {
|
|
2979
|
+
alpha *= dot(lumcoeff, texture2D(u_source, v_texAlphaCoord).rgb);
|
|
2980
|
+
|
|
2981
|
+
// transform alpha values from sRGB source to linearRGB - this cleans up the rim from the result
|
|
2982
|
+
float linear;
|
|
2983
|
+
if (alpha <= 0.04045) {
|
|
2984
|
+
linear = alpha / 12.92;
|
|
2985
|
+
}
|
|
2986
|
+
else {
|
|
2987
|
+
linear = pow((alpha + 0.055) / 1.055, 2.4);
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
alpha = linear;
|
|
2991
|
+
|
|
2992
|
+
if (alpha < 0.04) {
|
|
2993
|
+
alpha = 0.0;
|
|
2994
|
+
}
|
|
2995
|
+
else if (alpha > 0.96) {
|
|
2996
|
+
alpha = 1.0;
|
|
2997
|
+
}
|
|
2998
|
+
}`
|
|
2999
|
+
},
|
|
3000
|
+
get disabled() {
|
|
3001
|
+
return !this.uniforms[0].data[0];
|
|
3002
|
+
},
|
|
3003
|
+
set disabled(b) {
|
|
3004
|
+
this.uniforms[0].data[0] = +!b;
|
|
3005
|
+
},
|
|
3006
|
+
varying: {
|
|
3007
|
+
v_texAlphaCoord: "vec2"
|
|
3008
|
+
},
|
|
3009
|
+
uniforms: [
|
|
3010
|
+
{
|
|
3011
|
+
name: "u_tvEnabled",
|
|
3012
|
+
type: "i",
|
|
3013
|
+
data: [1]
|
|
3014
|
+
},
|
|
3015
|
+
{
|
|
3016
|
+
name: "u_texOffset",
|
|
3017
|
+
type: "f",
|
|
3018
|
+
data: [0, -0.5]
|
|
3019
|
+
}
|
|
3020
|
+
],
|
|
3021
|
+
attributes: [
|
|
3022
|
+
{
|
|
3023
|
+
name: "a_texCoord",
|
|
3024
|
+
data: new Float32Array([
|
|
3025
|
+
0,
|
|
3026
|
+
0.5,
|
|
3027
|
+
0,
|
|
3028
|
+
1,
|
|
3029
|
+
1,
|
|
3030
|
+
0.5,
|
|
3031
|
+
1,
|
|
3032
|
+
0.5,
|
|
3033
|
+
0,
|
|
3034
|
+
1,
|
|
3035
|
+
1,
|
|
3036
|
+
1
|
|
3037
|
+
]),
|
|
3038
|
+
size: 2,
|
|
3039
|
+
type: "FLOAT"
|
|
3040
|
+
}
|
|
3041
|
+
]
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
const effects = { ...effects$1, transparentVideo };
|
|
3045
|
+
Kampos.prototype.getRequestFrame = function getRequestFrame() {
|
|
3046
|
+
return "requestVideoFrameCallback" in HTMLVideoElement.prototype ? (fn) => {
|
|
3047
|
+
var _a;
|
|
3048
|
+
return (_a = this.media) == null ? void 0 : _a.requestVideoFrameCallback(fn);
|
|
3049
|
+
} : window.requestAnimationFrame;
|
|
3050
|
+
};
|
|
3051
|
+
Kampos.prototype.play = function play() {
|
|
3052
|
+
if (!this.animationFrameId) {
|
|
3053
|
+
const requestFrame = this.getRequestFrame();
|
|
3054
|
+
const loop = () => {
|
|
3055
|
+
const video = this.media;
|
|
3056
|
+
this.animationFrameId = requestFrame(loop);
|
|
3057
|
+
if (video && video.readyState >= video.HAVE_CURRENT_DATA && (!(video.paused || video.ended) || this._needsRedraw)) {
|
|
3058
|
+
this._needsRedraw = false;
|
|
3059
|
+
this.draw();
|
|
3060
|
+
}
|
|
3061
|
+
};
|
|
3062
|
+
this.animationFrameId = requestFrame(loop);
|
|
3063
|
+
}
|
|
3064
|
+
};
|
|
3065
|
+
const getVglSource = (media) => ({
|
|
3066
|
+
width: media && media.videoWidth || 0,
|
|
3067
|
+
height: media && media.videoHeight / 2 || 0,
|
|
3068
|
+
media
|
|
3069
|
+
});
|
|
3070
|
+
function hexToVec4(hex) {
|
|
3071
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
3072
|
+
return result ? [
|
|
3073
|
+
parseInt(result[1], 16) / 255,
|
|
3074
|
+
parseInt(result[2], 16) / 255,
|
|
3075
|
+
parseInt(result[3], 16) / 255,
|
|
3076
|
+
1
|
|
3077
|
+
] : hex;
|
|
3078
|
+
}
|
|
3079
|
+
const getKamposEffects = (prop = {}) => {
|
|
3080
|
+
const result = [effects.transparentVideo()];
|
|
3081
|
+
const hasBrightness = "brightness" in prop;
|
|
3082
|
+
const hasContrast = "contrast" in prop;
|
|
3083
|
+
if (hasBrightness || hasContrast) {
|
|
3084
|
+
const bc = effects.brightnessContrast();
|
|
3085
|
+
if (hasBrightness) {
|
|
3086
|
+
bc.brightness = prop.brightness;
|
|
3087
|
+
}
|
|
3088
|
+
if (hasContrast) {
|
|
3089
|
+
bc.contrast = prop.contrast;
|
|
3090
|
+
}
|
|
3091
|
+
result.push(bc);
|
|
3092
|
+
}
|
|
3093
|
+
if (prop.duotoneDark && prop.duotoneLight) {
|
|
3094
|
+
const dt = effects.duotone();
|
|
3095
|
+
dt.dark = hexToVec4(prop.duotoneDark);
|
|
3096
|
+
dt.light = hexToVec4(prop.duotoneLight);
|
|
3097
|
+
result.push(dt);
|
|
3098
|
+
}
|
|
3099
|
+
const hasHue = "hue" in prop;
|
|
3100
|
+
const hasSaturation = "saturation" in prop;
|
|
3101
|
+
if (hasHue || hasSaturation) {
|
|
3102
|
+
const hs = effects.hueSaturation();
|
|
3103
|
+
if (hasHue) {
|
|
3104
|
+
hs.hue = prop.hue;
|
|
3105
|
+
}
|
|
3106
|
+
if (hasSaturation) {
|
|
3107
|
+
hs.saturation = prop.saturation;
|
|
3108
|
+
}
|
|
3109
|
+
result.push(hs);
|
|
3110
|
+
}
|
|
3111
|
+
return result;
|
|
3112
|
+
};
|
|
3113
|
+
const isVideoReady = (video) => video.readyState >= video.HAVE_CURRENT_DATA;
|
|
3114
|
+
const MAX_CONTEXTS = 8;
|
|
3115
|
+
const COUNTER = {
|
|
3116
|
+
count: 0,
|
|
3117
|
+
set: /* @__PURE__ */ new Set(),
|
|
3118
|
+
add(ref) {
|
|
3119
|
+
if (COUNTER.set.has(ref)) {
|
|
3120
|
+
return true;
|
|
3121
|
+
}
|
|
3122
|
+
if (COUNTER.set.size < MAX_CONTEXTS) {
|
|
3123
|
+
COUNTER.set.add(ref);
|
|
3124
|
+
COUNTER.count = COUNTER.set.size;
|
|
3125
|
+
return true;
|
|
3126
|
+
}
|
|
3127
|
+
return false;
|
|
3128
|
+
},
|
|
3129
|
+
remove(ref) {
|
|
3130
|
+
COUNTER.set.delete(ref);
|
|
3131
|
+
COUNTER.count = COUNTER.set.size;
|
|
3132
|
+
}
|
|
3133
|
+
};
|
|
3134
|
+
const isBrowser = () => typeof window !== "undefined";
|
|
3135
|
+
let _contextManager = COUNTER;
|
|
3136
|
+
if (isBrowser()) {
|
|
3137
|
+
if (window.__wixWebGLContextManager__) {
|
|
3138
|
+
_contextManager = window.__wixWebGLContextManager__;
|
|
3139
|
+
} else {
|
|
3140
|
+
window.__wixWebGLContextManager__ = COUNTER;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
function tvControllerFactory({
|
|
3144
|
+
filterEffect,
|
|
3145
|
+
playerRef,
|
|
3146
|
+
videoRef,
|
|
3147
|
+
canvasRef,
|
|
3148
|
+
contextRef,
|
|
3149
|
+
kampos,
|
|
3150
|
+
setCanPlayTV
|
|
3151
|
+
}) {
|
|
3152
|
+
let inView = false;
|
|
3153
|
+
let posterRemoved = false;
|
|
3154
|
+
function handleSeeked() {
|
|
3155
|
+
if (!(videoRef.current && playerRef.current)) {
|
|
3156
|
+
return;
|
|
3157
|
+
}
|
|
3158
|
+
videoRef.current.removeEventListener("seeked", handleSeeked);
|
|
3159
|
+
playerRef.current.dataset.showCanvas = "";
|
|
3160
|
+
posterRemoved = true;
|
|
3161
|
+
}
|
|
3162
|
+
const controller = {
|
|
3163
|
+
initKampos() {
|
|
3164
|
+
try {
|
|
3165
|
+
kampos.current = new Kampos({
|
|
3166
|
+
target: canvasRef.current,
|
|
3167
|
+
effects: getKamposEffects(filterEffect || {}),
|
|
3168
|
+
onContextLost: () => {
|
|
3169
|
+
const video = kampos.current._source && kampos.current._source.media;
|
|
3170
|
+
if (video && (video.ended || video.paused)) {
|
|
3171
|
+
kampos.current._needsRedraw = true;
|
|
3172
|
+
}
|
|
3173
|
+
this.stopKampos();
|
|
3174
|
+
if (inView) {
|
|
3175
|
+
this.playKampos();
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
3179
|
+
kampos.current.hasContext = true;
|
|
3180
|
+
} catch (e) {
|
|
3181
|
+
_contextManager.remove(contextRef);
|
|
3182
|
+
setCanPlayTV(false);
|
|
3183
|
+
if (posterRemoved) {
|
|
3184
|
+
controller.showPoster();
|
|
3185
|
+
}
|
|
3186
|
+
return;
|
|
3187
|
+
}
|
|
3188
|
+
if (!videoRef.current) {
|
|
3189
|
+
return;
|
|
3190
|
+
}
|
|
3191
|
+
const mediaReadyHandler = () => {
|
|
3192
|
+
if (!videoRef.current) {
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
kampos.current.setSource(
|
|
3196
|
+
getVglSource(videoRef.current)
|
|
3197
|
+
);
|
|
3198
|
+
controller.playKampos();
|
|
3199
|
+
videoRef.current.removeEventListener(
|
|
3200
|
+
"loadeddata",
|
|
3201
|
+
mediaReadyHandler,
|
|
3202
|
+
false
|
|
3203
|
+
);
|
|
3204
|
+
};
|
|
3205
|
+
if (isVideoReady(videoRef.current)) {
|
|
3206
|
+
mediaReadyHandler();
|
|
3207
|
+
} else {
|
|
3208
|
+
videoRef.current.addEventListener(
|
|
3209
|
+
"loadeddata",
|
|
3210
|
+
mediaReadyHandler,
|
|
3211
|
+
false
|
|
3212
|
+
);
|
|
3213
|
+
}
|
|
3214
|
+
},
|
|
3215
|
+
playKampos() {
|
|
3216
|
+
if (!playerRef.current || !canvasRef.current) {
|
|
3217
|
+
return;
|
|
3218
|
+
}
|
|
3219
|
+
let hasContext;
|
|
3220
|
+
if (kampos.current) {
|
|
3221
|
+
hasContext = kampos.current.hasContext || _contextManager.add(contextRef);
|
|
3222
|
+
} else {
|
|
3223
|
+
hasContext = Kampos.preventContextCreation ? false : _contextManager.add(contextRef);
|
|
3224
|
+
}
|
|
3225
|
+
if (!hasContext) {
|
|
3226
|
+
if (posterRemoved) {
|
|
3227
|
+
controller.showPoster();
|
|
3228
|
+
}
|
|
3229
|
+
return;
|
|
3230
|
+
}
|
|
3231
|
+
if (!kampos.current || !kampos.current.config) {
|
|
3232
|
+
controller.initKampos();
|
|
3233
|
+
} else {
|
|
3234
|
+
if (kampos.current.lostContext) {
|
|
3235
|
+
kampos.current.restoreContext();
|
|
3236
|
+
}
|
|
3237
|
+
kampos.current.hasContext = true;
|
|
3238
|
+
kampos.current.play();
|
|
3239
|
+
if (!posterRemoved && kampos.current.media && isVideoReady(kampos.current.media) && "playing" in playerRef.current.dataset) {
|
|
3240
|
+
controller.removePoster();
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
},
|
|
3244
|
+
stopKampos() {
|
|
3245
|
+
_contextManager.remove(contextRef);
|
|
3246
|
+
kampos.current.hasContext = false;
|
|
3247
|
+
kampos.current.stop();
|
|
3248
|
+
},
|
|
3249
|
+
killKampos() {
|
|
3250
|
+
var _a;
|
|
3251
|
+
if (kampos.current) {
|
|
3252
|
+
controller.stopKampos();
|
|
3253
|
+
kampos.current.destroy();
|
|
3254
|
+
}
|
|
3255
|
+
(_a = videoRef.current) == null ? void 0 : _a.removeEventListener("seeked", handleSeeked);
|
|
3256
|
+
},
|
|
3257
|
+
removePoster() {
|
|
3258
|
+
const video = videoRef.current;
|
|
3259
|
+
const player = playerRef.current;
|
|
3260
|
+
if (posterRemoved || !(player && video && kampos.current)) {
|
|
3261
|
+
return;
|
|
3262
|
+
}
|
|
3263
|
+
if (video.paused || video.ended || kampos.current._needsRedraw) {
|
|
3264
|
+
kampos.current._needsRedraw = false;
|
|
3265
|
+
kampos.current.draw();
|
|
3266
|
+
}
|
|
3267
|
+
video.addEventListener("seeked", handleSeeked);
|
|
3268
|
+
video.currentTime = 0;
|
|
3269
|
+
},
|
|
3270
|
+
showPoster() {
|
|
3271
|
+
if (playerRef.current && videoRef.current) {
|
|
3272
|
+
delete playerRef.current.dataset.showCanvas;
|
|
3273
|
+
posterRemoved = false;
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
onViewEnter() {
|
|
3277
|
+
inView = true;
|
|
3278
|
+
controller.playKampos();
|
|
3279
|
+
},
|
|
3280
|
+
onViewLeave() {
|
|
3281
|
+
inView = false;
|
|
3282
|
+
if (kampos.current && kampos.current.hasContext) {
|
|
3283
|
+
controller.stopKampos();
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
};
|
|
3287
|
+
return controller;
|
|
3288
|
+
}
|
|
3289
|
+
function useTransparentVideo(props) {
|
|
3290
|
+
const {
|
|
3291
|
+
a11y,
|
|
3292
|
+
className,
|
|
3293
|
+
id,
|
|
3294
|
+
playbackRate = 1,
|
|
3295
|
+
video,
|
|
3296
|
+
videoStartType = VideoStartType.auto,
|
|
3297
|
+
videoEndType = VideoEndType.loop,
|
|
3298
|
+
showPoster = false,
|
|
3299
|
+
mute = true
|
|
3300
|
+
} = props;
|
|
3301
|
+
const playerRef = useRef(null);
|
|
3302
|
+
const videoRef = useRef(null);
|
|
3303
|
+
const canvasRef = useRef(null);
|
|
3304
|
+
const kamposRef = useRef(null);
|
|
3305
|
+
const contextRef = useRef({});
|
|
3306
|
+
const controllerRef = useRef(null);
|
|
3307
|
+
const initialFilterEffectRef = useRef(props.filterEffect);
|
|
3308
|
+
const [canPlayTransparentVideo, setCanPlayTransparentVideo] = useState(true);
|
|
3309
|
+
const [playingState, setPlayingState] = useState();
|
|
3310
|
+
const [isMuted, setIsMuted] = useState(videoStartType === VideoStartType.auto || mute);
|
|
3311
|
+
useEffect(() => {
|
|
3312
|
+
if (!canPlayTransparentVideo) {
|
|
3313
|
+
return;
|
|
3314
|
+
}
|
|
3315
|
+
if (!controllerRef.current) {
|
|
3316
|
+
controllerRef.current = tvControllerFactory({
|
|
3317
|
+
filterEffect: initialFilterEffectRef.current ?? void 0,
|
|
3318
|
+
playerRef,
|
|
3319
|
+
videoRef,
|
|
3320
|
+
canvasRef,
|
|
3321
|
+
contextRef,
|
|
3322
|
+
kampos: kamposRef,
|
|
3323
|
+
setCanPlayTV: setCanPlayTransparentVideo
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
const controller = controllerRef.current;
|
|
3327
|
+
const videoElement = videoRef.current;
|
|
3328
|
+
if (!controller || !videoElement) {
|
|
3329
|
+
return;
|
|
3330
|
+
}
|
|
3331
|
+
const handlePlay = () => {
|
|
3332
|
+
var _a;
|
|
3333
|
+
(_a = playerRef.current) == null ? void 0 : _a.setAttribute("data-playing", "");
|
|
3334
|
+
controller.removePoster();
|
|
3335
|
+
controller.onViewEnter();
|
|
3336
|
+
setPlayingState(VideoPlayingState.playing);
|
|
3337
|
+
};
|
|
3338
|
+
const handlePause = () => {
|
|
3339
|
+
var _a;
|
|
3340
|
+
(_a = playerRef.current) == null ? void 0 : _a.removeAttribute("data-playing");
|
|
3341
|
+
setPlayingState(VideoPlayingState.paused);
|
|
3342
|
+
};
|
|
3343
|
+
const handleEnded = () => {
|
|
3344
|
+
var _a;
|
|
3345
|
+
(_a = playerRef.current) == null ? void 0 : _a.removeAttribute("data-playing");
|
|
3346
|
+
controller.showPoster();
|
|
3347
|
+
setPlayingState(VideoPlayingState.ended);
|
|
3348
|
+
};
|
|
3349
|
+
controller.onViewEnter();
|
|
3350
|
+
videoElement.addEventListener("play", handlePlay);
|
|
3351
|
+
videoElement.addEventListener("pause", handlePause);
|
|
3352
|
+
videoElement.addEventListener("ended", handleEnded);
|
|
3353
|
+
return () => {
|
|
3354
|
+
videoElement.removeEventListener("play", handlePlay);
|
|
3355
|
+
videoElement.removeEventListener("pause", handlePause);
|
|
3356
|
+
videoElement.removeEventListener("ended", handleEnded);
|
|
3357
|
+
controller.killKampos();
|
|
3358
|
+
controllerRef.current = null;
|
|
3359
|
+
};
|
|
3360
|
+
}, [canPlayTransparentVideo]);
|
|
3361
|
+
const isPlaying = playingState === VideoPlayingState.playing;
|
|
3362
|
+
const shouldAutoplay = videoStartType === VideoStartType.auto;
|
|
3363
|
+
const shouldReplay = videoEndType !== VideoEndType.stop;
|
|
3364
|
+
const shouldDisplayPoster = showPoster || !isPlaying && playingState !== VideoPlayingState.paused;
|
|
3365
|
+
const shouldMuteVideo = isMuted || mute || shouldDisplayPoster;
|
|
3366
|
+
const shouldDisplayAudioToggle = !!(video && video.hasAudio && !mute);
|
|
3367
|
+
const shouldDisplayPlayButton = !!video && !(playingState === VideoPlayingState.ended && !shouldReplay);
|
|
3368
|
+
const posterFilterId = useMemo(() => `${SVG_FILTER_ID_PREFIX}${props.id}`, [props.id]);
|
|
3369
|
+
const onClickHandler = useCallback(() => {
|
|
3370
|
+
var _a, _b;
|
|
3371
|
+
if (playingState === VideoPlayingState.ended && !shouldReplay) {
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3374
|
+
if (isPlaying) {
|
|
3375
|
+
(_a = videoRef.current) == null ? void 0 : _a.pause();
|
|
3376
|
+
} else {
|
|
3377
|
+
(_b = videoRef.current) == null ? void 0 : _b.play();
|
|
3378
|
+
}
|
|
3379
|
+
}, [playingState, isPlaying, shouldReplay]);
|
|
3380
|
+
const onMouseEnterHandler = useCallback(() => {
|
|
3381
|
+
var _a;
|
|
3382
|
+
if (playingState === VideoPlayingState.ended && !shouldReplay) {
|
|
3383
|
+
return;
|
|
3384
|
+
}
|
|
3385
|
+
if (videoStartType === VideoStartType.hover) {
|
|
3386
|
+
(_a = videoRef.current) == null ? void 0 : _a.play();
|
|
3387
|
+
}
|
|
3388
|
+
}, [playingState, shouldReplay, videoStartType]);
|
|
3389
|
+
const onMouseOutHandler = useCallback(() => {
|
|
3390
|
+
var _a;
|
|
3391
|
+
if (videoStartType === VideoStartType.hover) {
|
|
3392
|
+
(_a = videoRef.current) == null ? void 0 : _a.pause();
|
|
3393
|
+
}
|
|
3394
|
+
}, [videoStartType]);
|
|
3395
|
+
const onAudioToggleClickHandler = useCallback((event) => {
|
|
3396
|
+
event.stopPropagation();
|
|
3397
|
+
setIsMuted((prev) => !prev);
|
|
3398
|
+
}, []);
|
|
3399
|
+
return {
|
|
3400
|
+
a11y,
|
|
3401
|
+
className,
|
|
3402
|
+
canvasRef,
|
|
3403
|
+
isMuted,
|
|
3404
|
+
isPlaying,
|
|
3405
|
+
id,
|
|
3406
|
+
shouldMuteVideo,
|
|
3407
|
+
onAudioToggleClickHandler,
|
|
3408
|
+
onClickHandler,
|
|
3409
|
+
onMouseEnterHandler,
|
|
3410
|
+
onMouseOutHandler,
|
|
3411
|
+
shouldAutoplay,
|
|
3412
|
+
playbackRate,
|
|
3413
|
+
playerRef,
|
|
3414
|
+
shouldDisplayPoster,
|
|
3415
|
+
video,
|
|
3416
|
+
videoEndType,
|
|
3417
|
+
videoRef,
|
|
3418
|
+
posterFilterId,
|
|
3419
|
+
shouldDisplayAudioToggle,
|
|
3420
|
+
shouldDisplayPlayButton
|
|
3421
|
+
};
|
|
3422
|
+
}
|
|
3423
|
+
const mainWrapper = "mainWrapper__gc4Bd";
|
|
3424
|
+
const canvas = "canvas__fJeLY";
|
|
3425
|
+
const audioToggle = "audioToggle__k2EqB";
|
|
3426
|
+
const playWrapper = "playWrapper__yH3ix";
|
|
3427
|
+
const videoWrapper = "videoWrapper__e-kgj";
|
|
3428
|
+
const hidden = "hidden__L52Wy";
|
|
3429
|
+
const poster = "poster__d1pI5";
|
|
3430
|
+
const isShown = "isShown__QBpcz";
|
|
3431
|
+
const filterEffectSvg = "filterEffectSvg__B9Lye";
|
|
3432
|
+
const styles = {
|
|
3433
|
+
mainWrapper,
|
|
3434
|
+
canvas,
|
|
3435
|
+
audioToggle,
|
|
3436
|
+
playWrapper,
|
|
3437
|
+
videoWrapper,
|
|
3438
|
+
hidden,
|
|
3439
|
+
poster,
|
|
3440
|
+
isShown,
|
|
3441
|
+
filterEffectSvg
|
|
3442
|
+
};
|
|
3443
|
+
const TransparentVideoPoster = React__default.memo(
|
|
3444
|
+
(props) => {
|
|
3445
|
+
var _a;
|
|
3446
|
+
const {
|
|
3447
|
+
containerId,
|
|
3448
|
+
posterFilterId,
|
|
3449
|
+
ariaLabel,
|
|
3450
|
+
posterUrl,
|
|
3451
|
+
filterEffectSvgString
|
|
3452
|
+
} = props;
|
|
3453
|
+
const posterId = (_a = posterUrl.split("/").at(-1)) == null ? void 0 : _a.split(".")[0];
|
|
3454
|
+
const instanceId = `poster-${posterId}_${containerId}`;
|
|
3455
|
+
const defsStr = filterEffectSvgString ? closeSelfClosingSvgTags(
|
|
3456
|
+
replaceCompIdPlaceholder(filterEffectSvgString, posterFilterId)
|
|
3457
|
+
) : "";
|
|
3458
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3459
|
+
/* @__PURE__ */ jsx(
|
|
3460
|
+
"img",
|
|
3461
|
+
{
|
|
3462
|
+
style: { filter: `url(#${posterFilterId})` },
|
|
3463
|
+
alt: ariaLabel,
|
|
3464
|
+
className: styles.poster,
|
|
3465
|
+
src: posterUrl,
|
|
3466
|
+
id: `img_${instanceId}`
|
|
3467
|
+
}
|
|
3468
|
+
),
|
|
3469
|
+
defsStr && /* @__PURE__ */ jsx("svg", { id: `svg_${instanceId}`, className: styles.filterEffectSvg, children: /* @__PURE__ */ jsx("defs", { children: parse(defsStr) }) })
|
|
3470
|
+
] });
|
|
3471
|
+
}
|
|
3472
|
+
);
|
|
3473
|
+
TransparentVideoPoster.displayName = "TransparentVideoPoster";
|
|
3474
|
+
const MutedIcon = () => /* @__PURE__ */ jsx("svg", { preserveAspectRatio: "xMidYMid meet", "data-bbox": "5.726 5.999 21.997 18.001", "data-type": "shape", xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", role: "presentation", "aria-hidden": "true", "aria-label": "", children: /* @__PURE__ */ jsxs("g", { children: [
|
|
3475
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { id: "b0f9f707-af61-4336-bcea-c2fee482e562_audioOff-comp-mneizzz18", height: "200%", width: "200%", y: "-50%", x: "-50%", children: [
|
|
3476
|
+
/* @__PURE__ */ jsx("feOffset", { result: "out-offset", in: "SourceAlpha" }),
|
|
3477
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { result: "out-blur", in: "out-offset", stdDeviation: "2" }),
|
|
3478
|
+
/* @__PURE__ */ jsx("feColorMatrix", { result: "out-matrix", in: "out-blur", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.40 0" }),
|
|
3479
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
3480
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "out-matrix" }),
|
|
3481
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
3482
|
+
] })
|
|
3483
|
+
] }) }),
|
|
3484
|
+
/* @__PURE__ */ jsx("path", { fill: "white", filter: "url(#b0f9f707-af61-4336-bcea-c2fee482e562_audioOff-comp-mneizzz18)", d: "M27.39 17.535a.478.478 0 0 1 .306.615v.001a.51.51 0 0 1-.641.292L6.074 12.471a.478.478 0 0 1-.325-.605.505.505 0 0 1 .661-.302l20.98 5.971zm-6.211.375c1.911-.377 1.812 2.001 1.813 2.001 0 1.273-.986 2.713-3.235 2.713-2.009 0-2.515-1.345-2.515-2.252 0-1.117.646-2.258 2.519-2.258.671-.001 1.095-.141 1.418-.204zm-8.427-1.643v.013h.001l-.005 5.007c0 1.273-.985 2.713-3.233 2.713C7.506 24 7 22.655 7 21.748c0-1.117.646-2.258 2.519-2.258 1.696 0 1.972-.427 1.972-1.319l.001-1.934a.513.513 0 0 1 .512-.477h.23c.285 0 .518.228.518.507zm-.537-4.642a.666.666 0 0 1-.506-.141.61.61 0 0 1-.22-.468l.006-2.86c0-.304.227-.562.535-.609l10.238-1.54a.629.629 0 0 1 .726.609L23 13.591c0 .013-.006.024-.007.036a.49.49 0 0 1-.094.248.516.516 0 0 1-.416.222h-.229a.51.51 0 0 1-.517-.505l-.004-3.479-9.518 1.512z" })
|
|
3485
|
+
] }) });
|
|
3486
|
+
const UnMutedIcon = () => /* @__PURE__ */ jsx("svg", { preserveAspectRatio: "xMidYMid meet", "data-bbox": "7 5.999 16 18.001", "data-type": "shape", xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", role: "presentation", "aria-hidden": "true", "aria-label": "", children: /* @__PURE__ */ jsxs("g", { children: [
|
|
3487
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { id: "4e358e3c-c4cc-411c-8da6-747bbbb99bfa_audioOn-comp-mneizzz18", height: "200%", width: "200%", y: "-50%", x: "-50%", children: [
|
|
3488
|
+
/* @__PURE__ */ jsx("feOffset", { result: "out-offset", in: "SourceAlpha" }),
|
|
3489
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { result: "out-blur", in: "out-offset", stdDeviation: "2" }),
|
|
3490
|
+
/* @__PURE__ */ jsx("feColorMatrix", { result: "out-matrix", in: "out-blur", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0" }),
|
|
3491
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
3492
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "out-matrix" }),
|
|
3493
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
3494
|
+
] })
|
|
3495
|
+
] }) }),
|
|
3496
|
+
/* @__PURE__ */ jsx(
|
|
3497
|
+
"path",
|
|
3498
|
+
{
|
|
3499
|
+
fill: "white",
|
|
3500
|
+
filter: "url(#4e358e3c-c4cc-411c-8da6-747bbbb99bfa_audioOn-comp-mneizzz18)",
|
|
3501
|
+
d: "M23 6.616a.625.625 0 0 0-.727-.609l-10.241 1.54a.62.62 0 0 0-.535.609l-.006 10.016c0 .892-.276 1.319-1.971 1.319C7.646 19.49 7 20.631 7 21.748 7 22.655 7.507 24 9.516 24c2.249 0 3.236-1.44 3.236-2.713l.006-9.719 8.98-1.454v6.87c-.045.763-.401 1.13-1.973 1.13-1.874 0-2.52 1.141-2.52 2.258 0 .907.507 2.252 2.516 2.252 2.249 0 3.236-1.44 3.236-2.713L23 6.616z"
|
|
3502
|
+
}
|
|
3503
|
+
)
|
|
3504
|
+
] }) });
|
|
3505
|
+
const PauseIcon = () => /* @__PURE__ */ jsxs("svg", { width: "64", height: "64", viewBox: "0 0 40 40", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3506
|
+
/* @__PURE__ */ jsx("rect", { x: "13", y: "10", width: "5", height: "20", "data-color": "1", fill: "white", "data-testid": "pause-rect" }),
|
|
3507
|
+
/* @__PURE__ */ jsx("rect", { x: "22", y: "10", width: "5", height: "20", "data-color": "1", fill: "white", "data-testid": "pause-rect" })
|
|
3508
|
+
] });
|
|
3509
|
+
const PlayIcon = () => /* @__PURE__ */ jsx(
|
|
3510
|
+
"svg",
|
|
3511
|
+
{
|
|
3512
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
3513
|
+
"data-bbox": "20 17.5 42 47",
|
|
3514
|
+
viewBox: "0 0 82 82",
|
|
3515
|
+
height: "64",
|
|
3516
|
+
width: "64",
|
|
3517
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3518
|
+
"data-type": "color",
|
|
3519
|
+
role: "presentation",
|
|
3520
|
+
"aria-hidden": "true",
|
|
3521
|
+
"aria-label": "",
|
|
3522
|
+
children: /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx("path", { d: "M20 64.5v-47L62 41 20 64.5z", fill: "white", "clip-rule": "evenodd", "fill-rule": "evenodd", "data-color": "1" }) })
|
|
3523
|
+
}
|
|
3524
|
+
);
|
|
3525
|
+
function TransparentVideo(props) {
|
|
3526
|
+
var _a;
|
|
3527
|
+
const filterEffects = getActiveFilterEffect(props);
|
|
3528
|
+
const {
|
|
3529
|
+
a11y,
|
|
3530
|
+
className,
|
|
3531
|
+
canvasRef,
|
|
3532
|
+
id,
|
|
3533
|
+
isMuted,
|
|
3534
|
+
isPlaying,
|
|
3535
|
+
shouldMuteVideo,
|
|
3536
|
+
onAudioToggleClickHandler,
|
|
3537
|
+
onClickHandler,
|
|
3538
|
+
onMouseEnterHandler,
|
|
3539
|
+
onMouseOutHandler,
|
|
3540
|
+
shouldAutoplay,
|
|
3541
|
+
playbackRate,
|
|
3542
|
+
playerRef,
|
|
3543
|
+
shouldDisplayPoster,
|
|
3544
|
+
video,
|
|
3545
|
+
videoEndType,
|
|
3546
|
+
videoRef,
|
|
3547
|
+
posterFilterId,
|
|
3548
|
+
shouldDisplayAudioToggle,
|
|
3549
|
+
shouldDisplayPlayButton
|
|
3550
|
+
} = useTransparentVideo({ ...props, filterEffect: filterEffects });
|
|
3551
|
+
const posterUri = (_a = video == null ? void 0 : video.poster) == null ? void 0 : _a.uri;
|
|
3552
|
+
const posterUrl = posterUri ? formatPosterUrl(posterUri) : "";
|
|
3553
|
+
return /* @__PURE__ */ jsxs(
|
|
3554
|
+
"div",
|
|
3555
|
+
{
|
|
3556
|
+
id,
|
|
3557
|
+
ref: playerRef,
|
|
3558
|
+
className: clsx(
|
|
3559
|
+
styles.mainWrapper,
|
|
3560
|
+
className,
|
|
3561
|
+
"wixui-transparent-video"
|
|
3562
|
+
),
|
|
3563
|
+
"data-has-alpha": "true",
|
|
3564
|
+
"data-playing": shouldAutoplay ? "" : void 0,
|
|
3565
|
+
onClick: onClickHandler,
|
|
3566
|
+
onMouseEnter: onMouseEnterHandler,
|
|
3567
|
+
onMouseLeave: onMouseOutHandler,
|
|
3568
|
+
children: [
|
|
3569
|
+
video && /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
3570
|
+
/* @__PURE__ */ jsx("div", { className: styles.videoWrapper, children: /* @__PURE__ */ jsx(
|
|
3571
|
+
Video,
|
|
3572
|
+
{
|
|
3573
|
+
id: `wix-video-${id}`,
|
|
3574
|
+
videoRef,
|
|
3575
|
+
videoMedia: { ...video, name: (a11y == null ? void 0 : a11y.ariaLabel) || video.name },
|
|
3576
|
+
muted: shouldMuteVideo,
|
|
3577
|
+
loop: videoEndType === VideoEndType.loop,
|
|
3578
|
+
autoplay: shouldAutoplay,
|
|
3579
|
+
qualityPolicy: "adaptive",
|
|
3580
|
+
playbackRate
|
|
3581
|
+
}
|
|
3582
|
+
) }),
|
|
3583
|
+
/* @__PURE__ */ jsx(
|
|
3584
|
+
"canvas",
|
|
3585
|
+
{
|
|
3586
|
+
id: `${id}-webglcanvas`,
|
|
3587
|
+
ref: canvasRef,
|
|
3588
|
+
className: clsx(styles.canvas, "webglcanvas", shouldDisplayPoster && styles.hidden),
|
|
3589
|
+
"aria-label": (a11y == null ? void 0 : a11y.ariaLabel) || "",
|
|
3590
|
+
role: "presentation",
|
|
3591
|
+
"data-testid": "canvas"
|
|
3592
|
+
}
|
|
3593
|
+
)
|
|
3594
|
+
] }),
|
|
3595
|
+
posterUrl && shouldDisplayPoster && /* @__PURE__ */ jsx(
|
|
3596
|
+
TransparentVideoPoster,
|
|
3597
|
+
{
|
|
3598
|
+
containerId: id,
|
|
3599
|
+
posterUrl,
|
|
3600
|
+
posterFilterId,
|
|
3601
|
+
filterEffectSvgString: getFilterEffectString(posterFilterId, filterEffects),
|
|
3602
|
+
ariaLabel: a11y == null ? void 0 : a11y.ariaLabel
|
|
3603
|
+
}
|
|
3604
|
+
),
|
|
3605
|
+
shouldDisplayAudioToggle && /* @__PURE__ */ jsx("div", { className: clsx(styles.audioToggle), onClick: onAudioToggleClickHandler, children: isMuted ? /* @__PURE__ */ jsx(MutedIcon, {}) : /* @__PURE__ */ jsx(UnMutedIcon, {}) }),
|
|
3606
|
+
shouldDisplayPlayButton && /* @__PURE__ */ jsx("div", { className: clsx(styles.playWrapper, { [styles.isShown]: !isPlaying }), children: isPlaying ? /* @__PURE__ */ jsx(PauseIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {}) })
|
|
3607
|
+
]
|
|
3608
|
+
}
|
|
3609
|
+
);
|
|
3610
|
+
}
|
|
3611
|
+
export {
|
|
3612
|
+
TransparentVideo as default
|
|
3613
|
+
};
|