@nascentdigital/funnel-ui 4.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tailwind.d.ts +201 -0
- package/dist/Tailwind.js +282 -0
- package/dist/client/app/AppContainer.d.ts +10 -0
- package/dist/client/app/AppContainer.js +22 -0
- package/dist/client/app/AppContext.d.ts +11 -0
- package/dist/client/app/AppContext.js +6 -0
- package/dist/client/app/AppPreview.d.ts +7 -0
- package/dist/client/app/AppPreview.js +51 -0
- package/dist/client/app/PageContainer.d.ts +8 -0
- package/dist/client/app/PageContainer.js +22 -0
- package/dist/client/app/index.d.ts +9 -0
- package/dist/client/app/index.js +25 -0
- package/dist/client/app/useAppConfig.d.ts +2 -0
- package/dist/client/app/useAppConfig.js +9 -0
- package/dist/client/app/useBrand.d.ts +9 -0
- package/dist/client/app/useBrand.js +17 -0
- package/dist/client/app/useLanguage.d.ts +2 -0
- package/dist/client/app/useLanguage.js +11 -0
- package/dist/client/app/usePageData.d.ts +2 -0
- package/dist/client/app/usePageData.js +25 -0
- package/dist/client/app/usePageUrl.d.ts +1 -0
- package/dist/client/app/usePageUrl.js +12 -0
- package/dist/client/app/useRegion.d.ts +1 -0
- package/dist/client/app/useRegion.js +10 -0
- package/dist/client/app/useSite.d.ts +2 -0
- package/dist/client/app/useSite.js +13 -0
- package/dist/client/atomic/AnimatedText.d.ts +12 -0
- package/dist/client/atomic/AnimatedText.js +90 -0
- package/dist/client/atomic/MaskedInput.d.ts +20 -0
- package/dist/client/atomic/MaskedInput.js +63 -0
- package/dist/client/atomic/index.d.ts +2 -0
- package/dist/client/atomic/index.js +18 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedPlayer.d.ts +36 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedPlayer.js +2 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedVideo.d.ts +13 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedVideo.js +22 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedVideoContainer.d.ts +7 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedVideoContainer.js +24 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedVideoContext.d.ts +8 -0
- package/dist/client/fields/EmbeddedVideo/EmbeddedVideoContext.js +11 -0
- package/dist/client/fields/EmbeddedVideo/index.d.ts +4 -0
- package/dist/client/fields/EmbeddedVideo/index.js +20 -0
- package/dist/client/fields/EmbeddedVideo/useEmbeddedPlayerProgress.d.ts +10 -0
- package/dist/client/fields/EmbeddedVideo/useEmbeddedPlayerProgress.js +66 -0
- package/dist/client/fields/EmbeddedVideo/useEmbeddedPlayerRef.d.ts +9 -0
- package/dist/client/fields/EmbeddedVideo/useEmbeddedPlayerRef.js +29 -0
- package/dist/client/fields/EmbeddedVideo/vimeo/VimeoPlayer.d.ts +63 -0
- package/dist/client/fields/EmbeddedVideo/vimeo/VimeoPlayer.js +326 -0
- package/dist/client/fields/EmbeddedVideo/vimeo/VimeoVideo.d.ts +13 -0
- package/dist/client/fields/EmbeddedVideo/vimeo/VimeoVideo.js +60 -0
- package/dist/client/fields/EmbeddedVideo/vimeo/index.d.ts +1 -0
- package/dist/client/fields/EmbeddedVideo/vimeo/index.js +17 -0
- package/dist/client/fields/EmbeddedVideo/youtube/YTApi.d.ts +92 -0
- package/dist/client/fields/EmbeddedVideo/youtube/YTApi.js +24 -0
- package/dist/client/fields/EmbeddedVideo/youtube/YoutubePlayer.d.ts +56 -0
- package/dist/client/fields/EmbeddedVideo/youtube/YoutubePlayer.js +288 -0
- package/dist/client/fields/EmbeddedVideo/youtube/YoutubeVideo.d.ts +13 -0
- package/dist/client/fields/EmbeddedVideo/youtube/YoutubeVideo.js +71 -0
- package/dist/client/fields/EmbeddedVideo/youtube/index.d.ts +3 -0
- package/dist/client/fields/EmbeddedVideo/youtube/index.js +19 -0
- package/dist/client/fields/LazyVideo.d.ts +8 -0
- package/dist/client/fields/LazyVideo.js +100 -0
- package/dist/client/fields/index.d.ts +2 -0
- package/dist/client/fields/index.js +18 -0
- package/dist/client/forms/Form.d.ts +13 -0
- package/dist/client/forms/Form.js +68 -0
- package/dist/client/forms/FormContext.d.ts +5 -0
- package/dist/client/forms/FormContext.js +6 -0
- package/dist/client/forms/fields/BooleanField.d.ts +16 -0
- package/dist/client/forms/fields/BooleanField.js +47 -0
- package/dist/client/forms/fields/EnumField.d.ts +20 -0
- package/dist/client/forms/fields/EnumField.js +65 -0
- package/dist/client/forms/fields/Field.d.ts +15 -0
- package/dist/client/forms/fields/Field.js +39 -0
- package/dist/client/forms/fields/FieldErrorController.d.ts +12 -0
- package/dist/client/forms/fields/FieldErrorController.js +13 -0
- package/dist/client/forms/fields/FieldLayout.d.ts +16 -0
- package/dist/client/forms/fields/FieldLayout.js +32 -0
- package/dist/client/forms/fields/TextField.d.ts +25 -0
- package/dist/client/forms/fields/TextField.js +178 -0
- package/dist/client/forms/fields/index.d.ts +2 -0
- package/dist/client/forms/fields/index.js +18 -0
- package/dist/client/forms/fields/useField.d.ts +2 -0
- package/dist/client/forms/fields/useField.js +26 -0
- package/dist/client/forms/index.d.ts +4 -0
- package/dist/client/forms/index.js +20 -0
- package/dist/client/forms/interactive/CheckboxField.d.ts +14 -0
- package/dist/client/forms/interactive/CheckboxField.js +19 -0
- package/dist/client/forms/interactive/RadioField.d.ts +12 -0
- package/dist/client/forms/interactive/RadioField.js +16 -0
- package/dist/client/forms/interactive/RadioGroupField.d.ts +12 -0
- package/dist/client/forms/interactive/RadioGroupField.js +10 -0
- package/dist/client/forms/interactive/SelectField.d.ts +17 -0
- package/dist/client/forms/interactive/SelectField.js +16 -0
- package/dist/client/forms/interactive/index.d.ts +4 -0
- package/dist/client/forms/interactive/index.js +20 -0
- package/dist/client/forms/useForm.d.ts +2 -0
- package/dist/client/forms/useForm.js +17 -0
- package/dist/client/forms/useTempFields.d.ts +7 -0
- package/dist/client/forms/useTempFields.js +54 -0
- package/dist/client/hooks/assets/index.d.ts +2 -0
- package/dist/client/hooks/assets/index.js +18 -0
- package/dist/client/hooks/assets/useImageProxy.d.ts +2 -0
- package/dist/client/hooks/assets/useImageProxy.js +43 -0
- package/dist/client/hooks/assets/useVideoProxy.d.ts +2 -0
- package/dist/client/hooks/assets/useVideoProxy.js +43 -0
- package/dist/client/hooks/breakpoint/BreakpointContainer.d.ts +9 -0
- package/dist/client/hooks/breakpoint/BreakpointContainer.js +39 -0
- package/dist/client/hooks/breakpoint/BreakpointContext.d.ts +7 -0
- package/dist/client/hooks/breakpoint/BreakpointContext.js +9 -0
- package/dist/client/hooks/breakpoint/index.d.ts +3 -0
- package/dist/client/hooks/breakpoint/index.js +19 -0
- package/dist/client/hooks/breakpoint/useCurrentBreakpoint.d.ts +2 -0
- package/dist/client/hooks/breakpoint/useCurrentBreakpoint.js +10 -0
- package/dist/client/hooks/index.d.ts +26 -0
- package/dist/client/hooks/index.js +42 -0
- package/dist/client/hooks/ui-lock/UILockContainer.d.ts +5 -0
- package/dist/client/hooks/ui-lock/UILockContainer.js +57 -0
- package/dist/client/hooks/ui-lock/UILockContext.d.ts +9 -0
- package/dist/client/hooks/ui-lock/UILockContext.js +6 -0
- package/dist/client/hooks/ui-lock/UILockRef.d.ts +36 -0
- package/dist/client/hooks/ui-lock/UILockRef.js +32 -0
- package/dist/client/hooks/ui-lock/index.d.ts +3 -0
- package/dist/client/hooks/ui-lock/index.js +19 -0
- package/dist/client/hooks/ui-lock/useUILock.d.ts +16 -0
- package/dist/client/hooks/ui-lock/useUILock.js +121 -0
- package/dist/client/hooks/useCounter.d.ts +11 -0
- package/dist/client/hooks/useCounter.js +57 -0
- package/dist/client/hooks/useCycle.d.ts +5 -0
- package/dist/client/hooks/useCycle.js +15 -0
- package/dist/client/hooks/useElementRect.d.ts +2 -0
- package/dist/client/hooks/useElementRect.js +63 -0
- package/dist/client/hooks/useElementScrolled.d.ts +17 -0
- package/dist/client/hooks/useElementScrolled.js +51 -0
- package/dist/client/hooks/useElementSelector.d.ts +2 -0
- package/dist/client/hooks/useElementSelector.js +160 -0
- package/dist/client/hooks/useElementSize.d.ts +2 -0
- package/dist/client/hooks/useElementSize.js +64 -0
- package/dist/client/hooks/useFindElements.d.ts +9 -0
- package/dist/client/hooks/useFindElements.js +147 -0
- package/dist/client/hooks/useInViewport.d.ts +16 -0
- package/dist/client/hooks/useInViewport.js +46 -0
- package/dist/client/hooks/useIsDesktop.d.ts +1 -0
- package/dist/client/hooks/useIsDesktop.js +22 -0
- package/dist/client/hooks/useKeyboardFocus.d.ts +7 -0
- package/dist/client/hooks/useKeyboardFocus.js +40 -0
- package/dist/client/hooks/useLatestValue.d.ts +1 -0
- package/dist/client/hooks/useLatestValue.js +21 -0
- package/dist/client/hooks/useLock.d.ts +13 -0
- package/dist/client/hooks/useLock.js +161 -0
- package/dist/client/hooks/useMixedResponsiveValue.d.ts +2 -0
- package/dist/client/hooks/useMixedResponsiveValue.js +20 -0
- package/dist/client/hooks/usePathname.d.ts +9 -0
- package/dist/client/hooks/usePathname.js +25 -0
- package/dist/client/hooks/useRefElement.d.ts +8 -0
- package/dist/client/hooks/useRefElement.js +34 -0
- package/dist/client/hooks/useRefresh.d.ts +2 -0
- package/dist/client/hooks/useRefresh.js +25 -0
- package/dist/client/hooks/useResizeObserver.d.ts +5 -0
- package/dist/client/hooks/useResizeObserver.js +179 -0
- package/dist/client/hooks/useResponsiveValue.d.ts +2 -0
- package/dist/client/hooks/useResponsiveValue.js +16 -0
- package/dist/client/hooks/useRouter.d.ts +20 -0
- package/dist/client/hooks/useRouter.js +49 -0
- package/dist/client/hooks/useSafeLayoutEffect.d.ts +2 -0
- package/dist/client/hooks/useSafeLayoutEffect.js +9 -0
- package/dist/client/hooks/useTouch.d.ts +2 -0
- package/dist/client/hooks/useTouch.js +10 -0
- package/dist/client/hooks/useViewportSize.d.ts +7 -0
- package/dist/client/hooks/useViewportSize.js +66 -0
- package/dist/client/hooks/useWindowScrolled.d.ts +8 -0
- package/dist/client/hooks/useWindowScrolled.js +52 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +25 -0
- package/dist/client/interaction/Carousel.d.ts +48 -0
- package/dist/client/interaction/Carousel.js +498 -0
- package/dist/client/interaction/ClickObserver.d.ts +19 -0
- package/dist/client/interaction/ClickObserver.js +76 -0
- package/dist/client/interaction/InfiniteScroller.d.ts +9 -0
- package/dist/client/interaction/InfiniteScroller.js +47 -0
- package/dist/client/interaction/Loader.d.ts +14 -0
- package/dist/client/interaction/Loader.js +74 -0
- package/dist/client/interaction/Marquee.d.ts +5 -0
- package/dist/client/interaction/Marquee.js +26 -0
- package/dist/client/interaction/Popup.d.ts +36 -0
- package/dist/client/interaction/Popup.js +244 -0
- package/dist/client/interaction/Tooltip.d.ts +16 -0
- package/dist/client/interaction/Tooltip.js +122 -0
- package/dist/client/interaction/UILevel.d.ts +1 -0
- package/dist/client/interaction/UILevel.js +2 -0
- package/dist/client/interaction/backdrop/BackdropContainer.d.ts +5 -0
- package/dist/client/interaction/backdrop/BackdropContainer.js +114 -0
- package/dist/client/interaction/backdrop/BackdropContext.d.ts +8 -0
- package/dist/client/interaction/backdrop/BackdropContext.js +6 -0
- package/dist/client/interaction/backdrop/BackdropEvent.d.ts +64 -0
- package/dist/client/interaction/backdrop/BackdropEvent.js +92 -0
- package/dist/client/interaction/backdrop/index.d.ts +4 -0
- package/dist/client/interaction/backdrop/index.js +20 -0
- package/dist/client/interaction/backdrop/useBackdrop.d.ts +13 -0
- package/dist/client/interaction/backdrop/useBackdrop.js +58 -0
- package/dist/client/interaction/backdrop/useBackdropClick.d.ts +2 -0
- package/dist/client/interaction/backdrop/useBackdropClick.js +21 -0
- package/dist/client/interaction/backdrop/useBackdropVisible.d.ts +1 -0
- package/dist/client/interaction/backdrop/useBackdropVisible.js +30 -0
- package/dist/client/interaction/focus/FocusArea.d.ts +10 -0
- package/dist/client/interaction/focus/FocusArea.js +38 -0
- package/dist/client/interaction/focus/FocusContext.d.ts +7 -0
- package/dist/client/interaction/focus/FocusContext.js +7 -0
- package/dist/client/interaction/focus/FocusController.d.ts +9 -0
- package/dist/client/interaction/focus/FocusController.js +40 -0
- package/dist/client/interaction/focus/FocusService.d.ts +20 -0
- package/dist/client/interaction/focus/FocusService.js +204 -0
- package/dist/client/interaction/focus/LinkedList.d.ts +18 -0
- package/dist/client/interaction/focus/LinkedList.js +122 -0
- package/dist/client/interaction/focus/index.d.ts +2 -0
- package/dist/client/interaction/focus/index.js +18 -0
- package/dist/client/interaction/focus/useFocusService.d.ts +2 -0
- package/dist/client/interaction/focus/useFocusService.js +14 -0
- package/dist/client/interaction/index.d.ts +12 -0
- package/dist/client/interaction/index.js +28 -0
- package/dist/client/interaction/modal/Modal.d.ts +29 -0
- package/dist/client/interaction/modal/Modal.js +136 -0
- package/dist/client/interaction/modal/ModalContainer.d.ts +5 -0
- package/dist/client/interaction/modal/ModalContainer.js +104 -0
- package/dist/client/interaction/modal/ModalContext.d.ts +8 -0
- package/dist/client/interaction/modal/ModalContext.js +6 -0
- package/dist/client/interaction/modal/ModalEvent.d.ts +39 -0
- package/dist/client/interaction/modal/ModalEvent.js +53 -0
- package/dist/client/interaction/modal/index.d.ts +2 -0
- package/dist/client/interaction/modal/index.js +18 -0
- package/dist/client/interaction/paginator/Paginator.d.ts +33 -0
- package/dist/client/interaction/paginator/Paginator.js +67 -0
- package/dist/client/interaction/paginator/index.d.ts +1 -0
- package/dist/client/interaction/paginator/index.js +17 -0
- package/dist/client/layouts/MasonaryLayout.d.ts +7 -0
- package/dist/client/layouts/MasonaryLayout.js +53 -0
- package/dist/client/layouts/index.d.ts +1 -0
- package/dist/client/layouts/index.js +17 -0
- package/dist/client/refs.d.ts +2 -0
- package/dist/client/refs.js +13 -0
- package/dist/client/transitions/Revelator.d.ts +42 -0
- package/dist/client/transitions/Revelator.js +60 -0
- package/dist/client/transitions/SideScroll.d.ts +14 -0
- package/dist/client/transitions/SideScroll.js +51 -0
- package/dist/client/transitions/StyleInViewport.d.ts +20 -0
- package/dist/client/transitions/StyleInViewport.js +66 -0
- package/dist/client/transitions/StyleSwitch.d.ts +297 -0
- package/dist/client/transitions/StyleSwitch.js +78 -0
- package/dist/client/transitions/index.d.ts +6 -0
- package/dist/client/transitions/index.js +22 -0
- package/dist/client/transitions/parallax/Parallax.d.ts +20 -0
- package/dist/client/transitions/parallax/Parallax.js +72 -0
- package/dist/client/transitions/parallax/ParallaxContext.d.ts +11 -0
- package/dist/client/transitions/parallax/ParallaxContext.js +6 -0
- package/dist/client/transitions/parallax/ParallaxItem.d.ts +14 -0
- package/dist/client/transitions/parallax/ParallaxItem.js +37 -0
- package/dist/client/transitions/parallax/ParallaxRemote.d.ts +29 -0
- package/dist/client/transitions/parallax/ParallaxRemote.js +136 -0
- package/dist/client/transitions/parallax/ParallaxUtils.d.ts +5 -0
- package/dist/client/transitions/parallax/ParallaxUtils.js +19 -0
- package/dist/client/transitions/parallax/index.d.ts +2 -0
- package/dist/client/transitions/parallax/index.js +18 -0
- package/dist/client/transitions/parallax/useDisableParallax.d.ts +4 -0
- package/dist/client/transitions/parallax/useDisableParallax.js +13 -0
- package/dist/client/transitions/parallax/useParallax.d.ts +2 -0
- package/dist/client/transitions/parallax/useParallax.js +18 -0
- package/dist/client/transitions/parallax/useTransforms.d.ts +34 -0
- package/dist/client/transitions/parallax/useTransforms.js +176 -0
- package/dist/client/transitions/reveal/Reveal.d.ts +14 -0
- package/dist/client/transitions/reveal/Reveal.js +75 -0
- package/dist/client/transitions/reveal/RevealAnimation.d.ts +17 -0
- package/dist/client/transitions/reveal/RevealAnimation.js +2 -0
- package/dist/client/transitions/reveal/RevealAnimator.d.ts +13 -0
- package/dist/client/transitions/reveal/RevealAnimator.js +41 -0
- package/dist/client/transitions/reveal/RevealController.d.ts +13 -0
- package/dist/client/transitions/reveal/RevealController.js +114 -0
- package/dist/client/transitions/reveal/RevealElementAnimator.d.ts +13 -0
- package/dist/client/transitions/reveal/RevealElementAnimator.js +65 -0
- package/dist/client/transitions/reveal/index.d.ts +2 -0
- package/dist/client/transitions/reveal/index.js +18 -0
- package/dist/client/utils/OnKey.d.ts +20 -0
- package/dist/client/utils/OnKey.js +33 -0
- package/dist/client/utils/SharedMutationObserver.d.ts +20 -0
- package/dist/client/utils/SharedMutationObserver.js +202 -0
- package/dist/client/utils/index.d.ts +2 -0
- package/dist/client/utils/index.js +18 -0
- package/dist/server/atomic/Markup.d.ts +14 -0
- package/dist/server/atomic/Markup.js +34 -0
- package/dist/server/atomic/NascentLogo.d.ts +6 -0
- package/dist/server/atomic/NascentLogo.js +9 -0
- package/dist/server/atomic/index.d.ts +2 -0
- package/dist/server/atomic/index.js +18 -0
- package/dist/server/blocks/Block.d.ts +16 -0
- package/dist/server/blocks/Block.js +92 -0
- package/dist/server/blocks/Clients.d.ts +33 -0
- package/dist/server/blocks/Clients.js +82 -0
- package/dist/server/blocks/Editorial.d.ts +33 -0
- package/dist/server/blocks/Editorial.js +80 -0
- package/dist/server/blocks/Form.d.ts +46 -0
- package/dist/server/blocks/Form.js +74 -0
- package/dist/server/blocks/FormMessage.d.ts +15 -0
- package/dist/server/blocks/FormMessage.js +37 -0
- package/dist/server/blocks/MediaLayout.d.ts +309 -0
- package/dist/server/blocks/MediaLayout.js +105 -0
- package/dist/server/blocks/Message.d.ts +76 -0
- package/dist/server/blocks/Message.js +352 -0
- package/dist/server/blocks/Outcome.d.ts +84 -0
- package/dist/server/blocks/Outcome.js +489 -0
- package/dist/server/blocks/OutcomeDetail.d.ts +303 -0
- package/dist/server/blocks/OutcomeDetail.js +63 -0
- package/dist/server/blocks/Projects.d.ts +43 -0
- package/dist/server/blocks/Projects.js +109 -0
- package/dist/server/blocks/Stat.d.ts +325 -0
- package/dist/server/blocks/Stat.js +107 -0
- package/dist/server/blocks/Stats.d.ts +36 -0
- package/dist/server/blocks/Stats.js +79 -0
- package/dist/server/blocks/Testimonial.d.ts +30 -0
- package/dist/server/blocks/Testimonial.js +68 -0
- package/dist/server/blocks/ValueProp.d.ts +43 -0
- package/dist/server/blocks/ValueProp.js +125 -0
- package/dist/server/blocks/index.d.ts +13 -0
- package/dist/server/blocks/index.js +29 -0
- package/dist/server/data/PrePaginator.d.ts +8 -0
- package/dist/server/data/PrePaginator.js +30 -0
- package/dist/server/data/index.d.ts +1 -0
- package/dist/server/data/index.js +17 -0
- package/dist/server/entities/Client.d.ts +327 -0
- package/dist/server/entities/Client.js +118 -0
- package/dist/server/entities/ClientBadge.d.ts +293 -0
- package/dist/server/entities/ClientBadge.js +37 -0
- package/dist/server/entities/Person.d.ts +314 -0
- package/dist/server/entities/Person.js +98 -0
- package/dist/server/entities/Project.d.ts +329 -0
- package/dist/server/entities/Project.js +112 -0
- package/dist/server/entities/UniqueSellingPoint.d.ts +327 -0
- package/dist/server/entities/UniqueSellingPoint.js +119 -0
- package/dist/server/entities/index.d.ts +6 -0
- package/dist/server/entities/index.js +22 -0
- package/dist/server/entities/previews/MessagePreview.d.ts +299 -0
- package/dist/server/entities/previews/MessagePreview.js +41 -0
- package/dist/server/entities/previews/PagePreview.d.ts +10 -0
- package/dist/server/entities/previews/PagePreview.js +42 -0
- package/dist/server/entities/previews/index.d.ts +2 -0
- package/dist/server/entities/previews/index.js +18 -0
- package/dist/server/fields/Caption.d.ts +13 -0
- package/dist/server/fields/Caption.js +45 -0
- package/dist/server/fields/Description.d.ts +13 -0
- package/dist/server/fields/Description.js +46 -0
- package/dist/server/fields/FreeFormContent.d.ts +17 -0
- package/dist/server/fields/FreeFormContent.js +43 -0
- package/dist/server/fields/Headline.d.ts +13 -0
- package/dist/server/fields/Headline.js +46 -0
- package/dist/server/fields/Icon.d.ts +10 -0
- package/dist/server/fields/Icon.js +39 -0
- package/dist/server/fields/Link.d.ts +16 -0
- package/dist/server/fields/Link.js +61 -0
- package/dist/server/fields/Quote.d.ts +13 -0
- package/dist/server/fields/Quote.js +46 -0
- package/dist/server/fields/RichText.d.ts +296 -0
- package/dist/server/fields/RichText.js +217 -0
- package/dist/server/fields/Title.d.ts +292 -0
- package/dist/server/fields/Title.js +38 -0
- package/dist/server/fields/Visual.d.ts +12 -0
- package/dist/server/fields/Visual.js +66 -0
- package/dist/server/fields/index.d.ts +10 -0
- package/dist/server/fields/index.js +26 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +25 -0
- package/dist/server/panels/BlockPanel.d.ts +14 -0
- package/dist/server/panels/BlockPanel.js +56 -0
- package/dist/server/panels/MessagePanel.d.ts +31 -0
- package/dist/server/panels/MessagePanel.js +81 -0
- package/dist/server/panels/VisualPanel.d.ts +36 -0
- package/dist/server/panels/VisualPanel.js +143 -0
- package/dist/server/panels/index.d.ts +3 -0
- package/dist/server/panels/index.js +19 -0
- package/dist/server/schema/Anchor.d.ts +7 -0
- package/dist/server/schema/Anchor.js +24 -0
- package/dist/server/schema/AspectRatio.d.ts +9 -0
- package/dist/server/schema/AspectRatio.js +43 -0
- package/dist/server/schema/BlockConfig.d.ts +56 -0
- package/dist/server/schema/BlockConfig.js +192 -0
- package/dist/server/schema/CollectionSchema.d.ts +4 -0
- package/dist/server/schema/CollectionSchema.js +15 -0
- package/dist/server/schema/ItemAlignment.d.ts +12 -0
- package/dist/server/schema/ItemAlignment.js +42 -0
- package/dist/server/schema/ItemPosition.d.ts +6 -0
- package/dist/server/schema/ItemPosition.js +25 -0
- package/dist/server/schema/ItemSize.d.ts +6 -0
- package/dist/server/schema/ItemSize.js +24 -0
- package/dist/server/schema/TextAlignment.d.ts +6 -0
- package/dist/server/schema/TextAlignment.js +22 -0
- package/dist/server/schema/index.d.ts +8 -0
- package/dist/server/schema/index.js +24 -0
- package/dist/server/sections/index.d.ts +1 -0
- package/dist/server/sections/index.js +17 -0
- package/dist/server/sections/renderSection.d.ts +6 -0
- package/dist/server/sections/renderSection.js +19 -0
- package/dist/server/transitions/Slide.d.ts +293 -0
- package/dist/server/transitions/Slide.js +31 -0
- package/dist/server/transitions/index.d.ts +3 -0
- package/dist/server/transitions/index.js +19 -0
- package/dist/styles/app/AppPreview.css +49 -0
- package/dist/styles/app/_index.css +1 -0
- package/dist/styles/base/_index.css +2 -0
- package/dist/styles/base/global.css +9 -0
- package/dist/styles/base/tailwind.css +3 -0
- package/dist/styles/blocks/Block-layout.css +244 -0
- package/dist/styles/blocks/Block-spacing.css +150 -0
- package/dist/styles/blocks/Block-theming.css +14 -0
- package/dist/styles/blocks/Clients.css +10 -0
- package/dist/styles/blocks/Editorial.css +133 -0
- package/dist/styles/blocks/Form.css +13 -0
- package/dist/styles/blocks/MediaLayout.css +215 -0
- package/dist/styles/blocks/Message.css +353 -0
- package/dist/styles/blocks/Outcome.css +83 -0
- package/dist/styles/blocks/Projects.css +18 -0
- package/dist/styles/blocks/Stat.css +45 -0
- package/dist/styles/blocks/Stats.css +38 -0
- package/dist/styles/blocks/Testimonial.css +323 -0
- package/dist/styles/blocks/ValueProp.css +135 -0
- package/dist/styles/blocks/_index.css +14 -0
- package/dist/styles/components/_index.css +3 -0
- package/dist/styles/components/container.css +58 -0
- package/dist/styles/components/divider.css +6 -0
- package/dist/styles/components/embed/VimeoPlayer.css +49 -0
- package/dist/styles/components/embed/YoutubePlayer.css +72 -0
- package/dist/styles/components/embed/_index.css +2 -0
- package/dist/styles/entities/Client.css +5 -0
- package/dist/styles/entities/ClientBadge.css +14 -0
- package/dist/styles/entities/Person.css +76 -0
- package/dist/styles/entities/Project.css +44 -0
- package/dist/styles/entities/UniqueSellingPoint.css +54 -0
- package/dist/styles/entities/_index.css +5 -0
- package/dist/styles/fields/Caption.css +23 -0
- package/dist/styles/fields/Description.css +23 -0
- package/dist/styles/fields/FreeFormContent.css +24 -0
- package/dist/styles/fields/Headline.css +38 -0
- package/dist/styles/fields/Icon.css +20 -0
- package/dist/styles/fields/LazyVideo.css +12 -0
- package/dist/styles/fields/Link.css +16 -0
- package/dist/styles/fields/Quote.css +48 -0
- package/dist/styles/fields/RichText.css +243 -0
- package/dist/styles/fields/Title.css +17 -0
- package/dist/styles/fields/Visual.css +27 -0
- package/dist/styles/fields/_index.css +11 -0
- package/dist/styles/index.css +9 -0
- package/dist/styles/layouts/MasonryLayout.css +24 -0
- package/dist/styles/layouts/_index.css +1 -0
- package/dist/styles/panels/MessagePanel.css +56 -0
- package/dist/styles/panels/VisualPanel.css +58 -0
- package/dist/styles/panels/_index.css +2 -0
- package/dist/styles/utilities/_index.css +7 -0
- package/dist/styles/utilities/ellipsis.css +7 -0
- package/dist/styles/utilities/fade.css +16 -0
- package/dist/styles/utilities/glass.css +8 -0
- package/dist/styles/utilities/interpolate.css +22 -0
- package/dist/styles/utilities/masks.css +18 -0
- package/dist/styles/utilities/stacked.css +24 -0
- package/dist/styles/utilities/text-gradient.css +37 -0
- package/dist/types/HTMLBlockElement.d.ts +6 -0
- package/dist/types/HTMLBlockElement.js +2 -0
- package/dist/types/HTMLElements.d.ts +129 -0
- package/dist/types/HTMLElements.js +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +18 -0
- package/package.json +73 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useFindElements = useFindElements;
|
|
5
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
// hook
|
|
8
|
+
function useFindElements(selector) {
|
|
9
|
+
// bind state + hooks
|
|
10
|
+
const [matches, setMatches] = (0, react_1.useState)([]);
|
|
11
|
+
const observer = SharedElementsObserver.instance;
|
|
12
|
+
// monitor for element changes
|
|
13
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
14
|
+
// bind selector (and return unsubscribe)
|
|
15
|
+
return observer.subscribe(selector, elements => setMatches(elements.slice()));
|
|
16
|
+
}, [observer, selector]);
|
|
17
|
+
// return element
|
|
18
|
+
return matches;
|
|
19
|
+
}
|
|
20
|
+
class SharedElementsObserver {
|
|
21
|
+
static get instance() {
|
|
22
|
+
// create if required
|
|
23
|
+
if (!SharedElementsObserver._instance) {
|
|
24
|
+
SharedElementsObserver._instance = new SharedElementsObserver();
|
|
25
|
+
}
|
|
26
|
+
// throw if we don't have the instance
|
|
27
|
+
const instance = SharedElementsObserver._instance;
|
|
28
|
+
if (!instance) {
|
|
29
|
+
throw new funnel_core_1.IllegalStateError('Unable to instantiate SharedElementsObserver');
|
|
30
|
+
}
|
|
31
|
+
// return instance
|
|
32
|
+
return instance;
|
|
33
|
+
}
|
|
34
|
+
constructor() {
|
|
35
|
+
// initialize instance
|
|
36
|
+
this._observations = new Map();
|
|
37
|
+
this._observer = typeof window === 'undefined'
|
|
38
|
+
? undefined
|
|
39
|
+
: new MutationObserver(mutations => this.onMutate(mutations));
|
|
40
|
+
}
|
|
41
|
+
subscribe(selector, onChange) {
|
|
42
|
+
// skip if there's no observer
|
|
43
|
+
const { _observer, _observations } = this;
|
|
44
|
+
if (!_observer) {
|
|
45
|
+
console.warn('[useFindElements/subscribe] attempt to subscribe before observer');
|
|
46
|
+
return funnel_core_1.Fn.NoOp;
|
|
47
|
+
}
|
|
48
|
+
// start observing if there are no active callbacks
|
|
49
|
+
if (_observations.size === 0) {
|
|
50
|
+
_observer.observe(document, { attributes: false, childList: true, subtree: true });
|
|
51
|
+
}
|
|
52
|
+
// get observation (or create it)
|
|
53
|
+
let observationGroup = _observations.get(selector);
|
|
54
|
+
if (!observationGroup) {
|
|
55
|
+
observationGroup = {
|
|
56
|
+
selector,
|
|
57
|
+
matches: document.querySelectorAll(selector).values().toArray().map(element => ({
|
|
58
|
+
id: funnel_core_1.Value.uuid(),
|
|
59
|
+
element: element
|
|
60
|
+
})),
|
|
61
|
+
subscribers: []
|
|
62
|
+
};
|
|
63
|
+
_observations.set(selector, observationGroup);
|
|
64
|
+
}
|
|
65
|
+
// add subscriber to list
|
|
66
|
+
const { matches, subscribers } = observationGroup;
|
|
67
|
+
const subscriber = {
|
|
68
|
+
id: funnel_core_1.Value.uuid(),
|
|
69
|
+
onChange
|
|
70
|
+
};
|
|
71
|
+
subscribers.push(subscriber);
|
|
72
|
+
// perform immediate callback
|
|
73
|
+
subscriber.onChange(matches);
|
|
74
|
+
// return unsubscribe
|
|
75
|
+
return () => this.unsubscribe(selector, subscriber.id);
|
|
76
|
+
}
|
|
77
|
+
unsubscribe(selector, subscriberId) {
|
|
78
|
+
// skip if there's no observer
|
|
79
|
+
const { _observer, _observations } = this;
|
|
80
|
+
if (!_observer) {
|
|
81
|
+
console.warn('[useFindElements/unsubscribe] cannot unsubscribe before init', selector);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// skip if it's not bound
|
|
85
|
+
const observationGroup = _observations.get(selector);
|
|
86
|
+
if (!observationGroup) {
|
|
87
|
+
console.warn('[useFindElements/unsubscribe] ignoring unbound subscribers:', selector);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// or remove list if it's the last one
|
|
91
|
+
const { subscribers } = observationGroup;
|
|
92
|
+
if (subscribers.length === 1) {
|
|
93
|
+
// prune entry
|
|
94
|
+
_observations.delete(selector);
|
|
95
|
+
// stop observer if there are no more entries
|
|
96
|
+
if (_observations.size === 0) {
|
|
97
|
+
_observer.disconnect();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// or just remove it
|
|
101
|
+
else {
|
|
102
|
+
observationGroup.subscribers = subscribers.filter(subscriber => subscriber.id !== subscriberId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
onMutate(mutations) {
|
|
106
|
+
// look for removed matches
|
|
107
|
+
const removedElements = mutations.flatMap(mutation => Array.from(mutation.removedNodes));
|
|
108
|
+
const observationGroups = this._observations.values().toArray();
|
|
109
|
+
if (removedElements.length > 0) {
|
|
110
|
+
observationGroups.forEach(observationGroup => {
|
|
111
|
+
// skip if there are no elements to prune
|
|
112
|
+
const { matches, subscribers } = observationGroup;
|
|
113
|
+
if (matches.length === 0) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
// clear any removed nodes
|
|
117
|
+
const prunedMatches = matches.filter(({ element }) => !removedElements.some(removedElement => removedElement === element || removedElement.contains(element)));
|
|
118
|
+
if (prunedMatches.length < matches.length) {
|
|
119
|
+
// update elements list
|
|
120
|
+
observationGroup.matches = prunedMatches;
|
|
121
|
+
// raise change
|
|
122
|
+
subscribers.forEach(subscriber => subscriber.onChange(prunedMatches));
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// look for added nodes
|
|
127
|
+
const addedElements = mutations.flatMap(mutation => Array.from(mutation.addedNodes));
|
|
128
|
+
if (addedElements.length > 0) {
|
|
129
|
+
observationGroups.forEach(({ selector, matches, subscribers }) => {
|
|
130
|
+
// find any matching elements
|
|
131
|
+
const newElements = addedElements
|
|
132
|
+
.flatMap(addedElement => addedElement.querySelectorAll(selector).values().toArray())
|
|
133
|
+
.filter(newElement => !matches.some(({ element }) => element === newElement));
|
|
134
|
+
// add new elements (if any)
|
|
135
|
+
if (newElements.length > 0) {
|
|
136
|
+
// track new elements
|
|
137
|
+
matches.push(...newElements.map(element => ({
|
|
138
|
+
id: funnel_core_1.Value.uuid(),
|
|
139
|
+
element
|
|
140
|
+
})));
|
|
141
|
+
// notify subscribers
|
|
142
|
+
subscribers.forEach(subscriber => subscriber.onChange(matches));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UseInViewOptions } from 'motion/react';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
export declare function useInViewport({ scrollerRef, targetRef, targetId, once, threshold, padding }: useInViewport.Options): (boolean | undefined)[];
|
|
4
|
+
export declare namespace useInViewport {
|
|
5
|
+
type Options = {
|
|
6
|
+
scrollerRef?: RefObject<HTMLElement | null>;
|
|
7
|
+
targetRef: RefObject<HTMLElement | null>;
|
|
8
|
+
targetId: string;
|
|
9
|
+
once?: boolean;
|
|
10
|
+
threshold?: Threshold;
|
|
11
|
+
padding?: Padding;
|
|
12
|
+
};
|
|
13
|
+
type Threshold = UseInViewOptions['amount'];
|
|
14
|
+
type PaddingValue = `${number}${'px' | '%'}`;
|
|
15
|
+
type Padding = `${PaddingValue}` | `${PaddingValue} ${PaddingValue}` | `${PaddingValue} ${PaddingValue} ${PaddingValue} ${PaddingValue}`;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useInViewport = useInViewport;
|
|
5
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
6
|
+
const react_1 = require("motion/react");
|
|
7
|
+
const react_2 = require("react");
|
|
8
|
+
// hook
|
|
9
|
+
function useInViewport({ scrollerRef, targetRef, targetId, once, threshold, padding }) {
|
|
10
|
+
// bind refs + hooks
|
|
11
|
+
const [initial, setInitial] = (0, react_2.useState)(true);
|
|
12
|
+
const [inViewport, setInViewport] = (0, react_2.useState)();
|
|
13
|
+
const initializedRef = (0, react_2.useRef)(false);
|
|
14
|
+
const visible = (0, react_1.useInView)(targetRef, {
|
|
15
|
+
root: scrollerRef,
|
|
16
|
+
once,
|
|
17
|
+
amount: threshold,
|
|
18
|
+
margin: padding
|
|
19
|
+
});
|
|
20
|
+
// animate on entry
|
|
21
|
+
(0, react_2.useLayoutEffect)(() => {
|
|
22
|
+
// skip if not bound
|
|
23
|
+
const element = document.getElementById(targetId);
|
|
24
|
+
if (!element) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// use DOM to calculate for initial render (avoids false negatives)
|
|
28
|
+
if (!initializedRef.current) {
|
|
29
|
+
// mark as initialized
|
|
30
|
+
initializedRef.current = true;
|
|
31
|
+
// check client is in viewport
|
|
32
|
+
const elementRect = funnel_core_1.Rect.fromRect(element.getBoundingClientRect());
|
|
33
|
+
const viewportRect = new funnel_core_1.Rect(0, 0, window.innerWidth || document.documentElement.clientWidth, window.innerHeight || document.documentElement.clientHeight);
|
|
34
|
+
const intersectsViewport = viewportRect.overlaps(elementRect);
|
|
35
|
+
// update state
|
|
36
|
+
setInViewport(intersectsViewport);
|
|
37
|
+
}
|
|
38
|
+
// or just update based on visibility
|
|
39
|
+
else {
|
|
40
|
+
setInViewport(visible);
|
|
41
|
+
setInitial(false);
|
|
42
|
+
}
|
|
43
|
+
}, [targetId, visible]);
|
|
44
|
+
// return visibility
|
|
45
|
+
return [inViewport, initial];
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsDesktop(): boolean | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsDesktop = useIsDesktop;
|
|
4
|
+
const breakpoint_1 = require("./breakpoint");
|
|
5
|
+
// hook
|
|
6
|
+
function useIsDesktop() {
|
|
7
|
+
// get current breakpoint
|
|
8
|
+
const breakpoint = (0, breakpoint_1.useCurrentBreakpoint)();
|
|
9
|
+
// skip if indeterminate
|
|
10
|
+
if (!breakpoint) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
// otherwise, return based on breakpoint
|
|
14
|
+
switch (breakpoint) {
|
|
15
|
+
case 'md':
|
|
16
|
+
case 'lg':
|
|
17
|
+
case 'xl':
|
|
18
|
+
return true;
|
|
19
|
+
default:
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useKeyboardFocus = useKeyboardFocus;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
// hook
|
|
6
|
+
function useKeyboardFocus(element) {
|
|
7
|
+
// create state
|
|
8
|
+
const [hasKeyboardFocus, setHasKeyboardFocus] = (0, react_1.useState)();
|
|
9
|
+
const [keyboardFocusElement, setKeyboardFocusElement] = (0, react_1.useState)();
|
|
10
|
+
// bind watcher (if ready/required)
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
// ignore if no element or we're not watching
|
|
13
|
+
if (!element) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// add listeners on mount
|
|
17
|
+
const onFocusIn = (e) => {
|
|
18
|
+
var _a;
|
|
19
|
+
setHasKeyboardFocus(true);
|
|
20
|
+
setKeyboardFocusElement((_a = e.target) !== null && _a !== void 0 ? _a : undefined);
|
|
21
|
+
};
|
|
22
|
+
const onFocusOut = () => {
|
|
23
|
+
setHasKeyboardFocus(false);
|
|
24
|
+
setKeyboardFocusElement(undefined);
|
|
25
|
+
};
|
|
26
|
+
element.addEventListener('focusin', onFocusIn);
|
|
27
|
+
element.addEventListener('focusout', onFocusOut);
|
|
28
|
+
// TODO: check children for focus
|
|
29
|
+
// remove listeners on unmount
|
|
30
|
+
return () => {
|
|
31
|
+
element.removeEventListener('focusin', onFocusIn);
|
|
32
|
+
element.removeEventListener('focusout', onFocusOut);
|
|
33
|
+
};
|
|
34
|
+
}, [element]);
|
|
35
|
+
// return state and setter
|
|
36
|
+
return {
|
|
37
|
+
hasKeyboardFocus,
|
|
38
|
+
keyboardFocusElement
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLatestValue<TValue>(value: TValue): TValue;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useLatestValue = useLatestValue;
|
|
5
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
// hook
|
|
8
|
+
function useLatestValue(value) {
|
|
9
|
+
// fetch prev value
|
|
10
|
+
const prevValueRef = (0, react_1.useRef)(value);
|
|
11
|
+
const prevValue = prevValueRef.current;
|
|
12
|
+
// return prev if it's unchanged
|
|
13
|
+
if (value === prevValue || funnel_core_1.Value.equals(value, prevValue)) {
|
|
14
|
+
return prevValue;
|
|
15
|
+
}
|
|
16
|
+
// or update and return the new value
|
|
17
|
+
else {
|
|
18
|
+
prevValueRef.current = value;
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tagged } from 'type-fest';
|
|
2
|
+
export interface Lock {
|
|
3
|
+
readonly status: Lock.Status;
|
|
4
|
+
readonly isLocked: boolean;
|
|
5
|
+
lock(): Promise<void>;
|
|
6
|
+
unlock(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace Lock {
|
|
9
|
+
type Id = Tagged<string, 'Lock.Id'>;
|
|
10
|
+
function Id(value: string): Id;
|
|
11
|
+
type Status = 'unlocked' | 'locked' | 'waiting' | 'disposed';
|
|
12
|
+
}
|
|
13
|
+
export declare function useLock(id: Lock.Id): Lock;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Lock = void 0;
|
|
4
|
+
exports.useLock = useLock;
|
|
5
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
var Lock;
|
|
8
|
+
(function (Lock) {
|
|
9
|
+
function Id(value) {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
Lock.Id = Id;
|
|
13
|
+
})(Lock || (exports.Lock = Lock = {}));
|
|
14
|
+
// hook
|
|
15
|
+
function useLock(id) {
|
|
16
|
+
// obtain lock
|
|
17
|
+
const lock = (0, react_1.useMemo)(() => LockCoordinator.resolve(id).obtainLock(), [id]);
|
|
18
|
+
// release lock on unmount (might clear context)
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
return () => LockCoordinator.resolve(id).releaseLock(lock);
|
|
21
|
+
}, [id, lock]);
|
|
22
|
+
// return lock
|
|
23
|
+
return lock;
|
|
24
|
+
}
|
|
25
|
+
class LockCoordinator {
|
|
26
|
+
constructor(id) {
|
|
27
|
+
this.id = id;
|
|
28
|
+
// initialize instance variables
|
|
29
|
+
this._locks = new Set();
|
|
30
|
+
this._lockDeferrals = [];
|
|
31
|
+
}
|
|
32
|
+
obtainLock() {
|
|
33
|
+
// create new lock
|
|
34
|
+
const lock = new LockImpl(this);
|
|
35
|
+
// bind it
|
|
36
|
+
const { id, _locks } = this;
|
|
37
|
+
_locks.add(lock);
|
|
38
|
+
console.debug(`[LockCoordinator/${id}/obtainLock] creating new lock:`, lock);
|
|
39
|
+
// return it
|
|
40
|
+
return lock;
|
|
41
|
+
}
|
|
42
|
+
releaseLock(lock) {
|
|
43
|
+
// remove it from the queue (if any)
|
|
44
|
+
const { id, _locks, _lockDeferrals } = this;
|
|
45
|
+
const queueIndex = _lockDeferrals.findIndex(lockDeferral => lockDeferral.lock === lock);
|
|
46
|
+
if (queueIndex >= 0) {
|
|
47
|
+
console.debug(`[LockCoordinator/${id}/releaseLock] removing lock from deferrals:`, lock);
|
|
48
|
+
_lockDeferrals.splice(queueIndex, 1);
|
|
49
|
+
}
|
|
50
|
+
// remove it from the lock set
|
|
51
|
+
_locks.delete(lock);
|
|
52
|
+
console.debug(`[LockCoordinator/${id}/releaseLock] releasing old lock:`, lock);
|
|
53
|
+
// destroy context if it's empty
|
|
54
|
+
if (_locks.size === 0) {
|
|
55
|
+
console.debug(`[LockCoordinator/${id}/releaseLock] destroying empty context`);
|
|
56
|
+
LockCoordinator._coordinators.delete(id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
getLockStatus(lock) {
|
|
60
|
+
// disposed if it's not bound
|
|
61
|
+
if (!this._locks.has(lock)) {
|
|
62
|
+
return 'disposed';
|
|
63
|
+
}
|
|
64
|
+
// locked if active
|
|
65
|
+
else if (this._activeLock === lock) {
|
|
66
|
+
return 'locked';
|
|
67
|
+
}
|
|
68
|
+
// waiting if queued
|
|
69
|
+
else if (this._lockDeferrals.some(lockDeferral => lockDeferral.lock === lock)) {
|
|
70
|
+
return 'waiting';
|
|
71
|
+
}
|
|
72
|
+
// otherwise, unlocked
|
|
73
|
+
else {
|
|
74
|
+
return 'unlocked';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
activateLock(lock) {
|
|
78
|
+
// throw if attempting to activate disposed lock
|
|
79
|
+
const { _locks, _lockDeferrals, _activeLock } = this;
|
|
80
|
+
if (!_locks.has(lock)) {
|
|
81
|
+
throw new funnel_core_1.InvalidOperationError('Attempt to lock disposed Lock instance');
|
|
82
|
+
}
|
|
83
|
+
// return immediately if there's no active lock (OR this lock is already it)
|
|
84
|
+
else if (!_activeLock || _activeLock === lock) {
|
|
85
|
+
// make lock active
|
|
86
|
+
this._activeLock = lock;
|
|
87
|
+
// return undefined (indicates there's no deferral)
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
// find deferral (or queue a new one)
|
|
91
|
+
let lockDeferral = _lockDeferrals.find(lockDeferral => lockDeferral.lock === lock);
|
|
92
|
+
if (!lockDeferral) {
|
|
93
|
+
// create deferral
|
|
94
|
+
lockDeferral = {
|
|
95
|
+
lock,
|
|
96
|
+
deferral: new funnel_core_1.Deferral()
|
|
97
|
+
};
|
|
98
|
+
// queue it
|
|
99
|
+
_lockDeferrals.push(lockDeferral);
|
|
100
|
+
}
|
|
101
|
+
// return deferral
|
|
102
|
+
return lockDeferral.deferral;
|
|
103
|
+
}
|
|
104
|
+
deactivateLock(lock) {
|
|
105
|
+
// throw if not active
|
|
106
|
+
const { _activeLock, _lockDeferrals } = this;
|
|
107
|
+
if (_activeLock !== lock) {
|
|
108
|
+
throw new funnel_core_1.InvalidOperationError('Attempt to unlock Lock that is not active');
|
|
109
|
+
}
|
|
110
|
+
// activate next deferred lock
|
|
111
|
+
else if (_lockDeferrals.length > 0) {
|
|
112
|
+
// remove deferral
|
|
113
|
+
const [lockDeferral] = _lockDeferrals.splice(0, 1);
|
|
114
|
+
// move lock to active
|
|
115
|
+
this._activeLock = lockDeferral.lock;
|
|
116
|
+
// resolve deferral
|
|
117
|
+
lockDeferral.deferral.resolve();
|
|
118
|
+
}
|
|
119
|
+
// otherwise, just clear active lock
|
|
120
|
+
else {
|
|
121
|
+
delete this._activeLock;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
static resolve(id) {
|
|
125
|
+
// get context (or create one)
|
|
126
|
+
const { _coordinators } = this;
|
|
127
|
+
let lockContext = _coordinators.get(id);
|
|
128
|
+
if (!lockContext) {
|
|
129
|
+
console.debug(`[LockCoordinator/${id}/releaseLock] creating new context`);
|
|
130
|
+
lockContext = new LockCoordinator(id);
|
|
131
|
+
_coordinators.set(id, lockContext);
|
|
132
|
+
}
|
|
133
|
+
// return context
|
|
134
|
+
return lockContext;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
LockCoordinator._coordinators = new Map();
|
|
138
|
+
// lock
|
|
139
|
+
class LockImpl {
|
|
140
|
+
constructor(_context) {
|
|
141
|
+
this._context = _context;
|
|
142
|
+
}
|
|
143
|
+
get isLocked() {
|
|
144
|
+
return this.status === 'locked';
|
|
145
|
+
}
|
|
146
|
+
get status() {
|
|
147
|
+
return this._context.getLockStatus(this);
|
|
148
|
+
}
|
|
149
|
+
async lock() {
|
|
150
|
+
// try to activate
|
|
151
|
+
const deferral = this._context.activateLock(this);
|
|
152
|
+
// await if there's a deferral
|
|
153
|
+
if (deferral) {
|
|
154
|
+
await deferral.promise;
|
|
155
|
+
}
|
|
156
|
+
// now we're locked
|
|
157
|
+
}
|
|
158
|
+
unlock() {
|
|
159
|
+
this._context.deactivateLock(this);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMixedResponsiveValue = useMixedResponsiveValue;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
const breakpoint_1 = require("./breakpoint");
|
|
6
|
+
// hook
|
|
7
|
+
function useMixedResponsiveValue(value) {
|
|
8
|
+
// get current breakpoint
|
|
9
|
+
const breakpoint = (0, breakpoint_1.useCurrentBreakpoint)();
|
|
10
|
+
// if value is not a responsive value, just return raw value
|
|
11
|
+
if (!funnel_core_1.ResponsiveValue.isResponsive(value)) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
// exit it if no current breakpoint
|
|
15
|
+
if (!breakpoint) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
// resolve value for current breakpoint
|
|
19
|
+
return funnel_core_1.ResponsiveValue.resolve(value, breakpoint);
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js `usePath()` wrapper to avoid mismatch with rewrites.
|
|
3
|
+
*
|
|
4
|
+
* This is to be used as a workaround for hydration errors when the pathname on the server does not match what is
|
|
5
|
+
* on the client.
|
|
6
|
+
*
|
|
7
|
+
* Source: https://nextjs.org/docs/app/api-reference/functions/use-pathname#avoid-hydration-mismatch-with-rewrites
|
|
8
|
+
*/
|
|
9
|
+
export declare function usePathname(): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePathname = usePathname;
|
|
4
|
+
const navigation_1 = require("next/navigation");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
/**
|
|
7
|
+
* Next.js `usePath()` wrapper to avoid mismatch with rewrites.
|
|
8
|
+
*
|
|
9
|
+
* This is to be used as a workaround for hydration errors when the pathname on the server does not match what is
|
|
10
|
+
* on the client.
|
|
11
|
+
*
|
|
12
|
+
* Source: https://nextjs.org/docs/app/api-reference/functions/use-pathname#avoid-hydration-mismatch-with-rewrites
|
|
13
|
+
*/
|
|
14
|
+
function usePathname() {
|
|
15
|
+
// get pathname from Next.js
|
|
16
|
+
const pathname = (0, navigation_1.usePathname)();
|
|
17
|
+
// state holds the browser pathname (defaults to '#' while its getting ready)
|
|
18
|
+
const [clientPathname, setClientPathname] = (0, react_1.useState)('#');
|
|
19
|
+
// update path name to be the pathname found in browser
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
setClientPathname(pathname);
|
|
22
|
+
}, [pathname]);
|
|
23
|
+
// return the client pathname that is found in browser
|
|
24
|
+
return clientPathname;
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Callback } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { SharedMutationObserver } from '../utils';
|
|
3
|
+
export declare function useRefElement<TElement extends HTMLElement = HTMLElement>({ watch }?: useRefElement.Options): [Callback<TElement | null>, TElement | null];
|
|
4
|
+
export declare namespace useRefElement {
|
|
5
|
+
type Options = {
|
|
6
|
+
watch?: SharedMutationObserver.Scope | SharedMutationObserver.Scope[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRefElement = useRefElement;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
// hook
|
|
7
|
+
function useRefElement({ watch = 'children' } = {}) {
|
|
8
|
+
// create state
|
|
9
|
+
const [, setUpdatedAt] = (0, react_1.useState)(0);
|
|
10
|
+
const [element, setElement] = (0, react_1.useState)(null);
|
|
11
|
+
// create ref callback function
|
|
12
|
+
const setRef = (0, react_1.useCallback)((node) => {
|
|
13
|
+
setElement(node);
|
|
14
|
+
}, []);
|
|
15
|
+
// bind watcher (if ready/required)
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
// ignore if no element or we're not watching
|
|
18
|
+
if (!element || !watch) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// watch element for changes
|
|
22
|
+
const watchScope = typeof watch === 'string'
|
|
23
|
+
? [watch]
|
|
24
|
+
: watch.length === 0
|
|
25
|
+
? ['children']
|
|
26
|
+
: watch;
|
|
27
|
+
const subscription = utils_1.SharedMutationObserver.instance.watch(element, watchScope)
|
|
28
|
+
.subscribe(change => setUpdatedAt(Date.now()));
|
|
29
|
+
// unsubscribe on unmount
|
|
30
|
+
return () => subscription.unsubscribe();
|
|
31
|
+
}, [element, watch]);
|
|
32
|
+
// return state and setter
|
|
33
|
+
return [setRef, element];
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRefresh = useRefresh;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const useTouch_1 = require("./useTouch");
|
|
8
|
+
// hook
|
|
9
|
+
function useRefresh(period) {
|
|
10
|
+
// bind state, memoize touch, and return it
|
|
11
|
+
const touch = (0, useTouch_1.useTouch)();
|
|
12
|
+
// bind timer
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
// for period to be at least 1s
|
|
15
|
+
let timeout = funnel_core_1.Duration.toMilliseconds(period);
|
|
16
|
+
if (timeout < 1000) {
|
|
17
|
+
console.warn('[useRefresh] period must be at lest 1s between refreshes - correcting');
|
|
18
|
+
timeout = 1000;
|
|
19
|
+
}
|
|
20
|
+
// setup interval
|
|
21
|
+
const subscription = (0, rxjs_1.interval)(timeout).subscribe(() => touch());
|
|
22
|
+
// destroy on unmount
|
|
23
|
+
return () => subscription.unsubscribe();
|
|
24
|
+
}, [touch, period]);
|
|
25
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function useResizeObserver<T extends Element>(target: React.RefObject<T> | React.ForwardedRef<T> | T | null, callback: useResizeObserver.Callback): ResizeObserver | undefined;
|
|
3
|
+
export declare namespace useResizeObserver {
|
|
4
|
+
type Callback = (entry: ResizeObserverEntry, observer: ResizeObserver) => any;
|
|
5
|
+
}
|