@finsweet/webflow-apps-utils 1.0.1
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 +45 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/router/Link.svelte +166 -0
- package/dist/router/Link.svelte.d.ts +26 -0
- package/dist/router/README.md +397 -0
- package/dist/router/Route.svelte +82 -0
- package/dist/router/Route.svelte.d.ts +24 -0
- package/dist/router/Router.svelte +71 -0
- package/dist/router/Router.svelte.d.ts +20 -0
- package/dist/router/hooks.svelte.d.ts +77 -0
- package/dist/router/hooks.svelte.js +148 -0
- package/dist/router/index.svelte.d.ts +107 -0
- package/dist/router/index.svelte.js +400 -0
- package/dist/stores/breakpoints.d.ts +10 -0
- package/dist/stores/breakpoints.js +2 -0
- package/dist/stores/componentInjectErrors.d.ts +1 -0
- package/dist/stores/componentInjectErrors.js +2 -0
- package/dist/stores/forms.d.ts +110 -0
- package/dist/stores/forms.js +307 -0
- package/dist/stores/globalStore.d.ts +10 -0
- package/dist/stores/globalStore.js +10 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.js +7 -0
- package/dist/stores/router.d.ts +4 -0
- package/dist/stores/router.js +5 -0
- package/dist/stores/showConfirmActionModal.d.ts +1 -0
- package/dist/stores/showConfirmActionModal.js +2 -0
- package/dist/stores/siteInfo.d.ts +13 -0
- package/dist/stores/siteInfo.js +2 -0
- package/dist/types/auth.d.ts +40 -0
- package/dist/types/auth.js +1 -0
- package/dist/types/customCode.d.ts +16 -0
- package/dist/types/customCode.js +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/license.d.ts +5 -0
- package/dist/types/license.js +1 -0
- package/dist/types/webflow.d.ts +125 -0
- package/dist/types/webflow.js +1 -0
- package/dist/types/window.d.ts +14 -0
- package/dist/types/window.js +1 -0
- package/dist/ui/components/ButtonGroup.svelte +106 -0
- package/dist/ui/components/ButtonGroup.svelte.d.ts +28 -0
- package/dist/ui/components/Checkbox.svelte +94 -0
- package/dist/ui/components/Checkbox.svelte.d.ts +36 -0
- package/dist/ui/components/Copy.svelte +329 -0
- package/dist/ui/components/Copy.svelte.d.ts +35 -0
- package/dist/ui/components/CustomModal.svelte +192 -0
- package/dist/ui/components/CustomModal.svelte.d.ts +45 -0
- package/dist/ui/components/DisableInEditMode.svelte +66 -0
- package/dist/ui/components/DisableInEditMode.svelte.d.ts +33 -0
- package/dist/ui/components/Divider.svelte +31 -0
- package/dist/ui/components/Divider.svelte.d.ts +31 -0
- package/dist/ui/components/Header.svelte +30 -0
- package/dist/ui/components/Header.svelte.d.ts +20 -0
- package/dist/ui/components/Iframe.svelte +89 -0
- package/dist/ui/components/Iframe.svelte.d.ts +40 -0
- package/dist/ui/components/ImageUpload.svelte +213 -0
- package/dist/ui/components/ImageUpload.svelte.d.ts +42 -0
- package/dist/ui/components/InjectComponent.svelte +297 -0
- package/dist/ui/components/InjectComponent.svelte.d.ts +27 -0
- package/dist/ui/components/Loader.svelte +68 -0
- package/dist/ui/components/Loader.svelte.d.ts +24 -0
- package/dist/ui/components/LoadingScreen.svelte +71 -0
- package/dist/ui/components/LoadingScreen.svelte.d.ts +26 -0
- package/dist/ui/components/Modal.svelte +139 -0
- package/dist/ui/components/Modal.svelte.d.ts +42 -0
- package/dist/ui/components/Navbar.svelte +132 -0
- package/dist/ui/components/Navbar.svelte.d.ts +29 -0
- package/dist/ui/components/NoSettingsNeeded.svelte +31 -0
- package/dist/ui/components/NoSettingsNeeded.svelte.d.ts +18 -0
- package/dist/ui/components/Notification.svelte +193 -0
- package/dist/ui/components/Notification.svelte.d.ts +64 -0
- package/dist/ui/components/PlusMinusButton.svelte +91 -0
- package/dist/ui/components/PlusMinusButton.svelte.d.ts +22 -0
- package/dist/ui/components/PreviewBar.svelte +40 -0
- package/dist/ui/components/PreviewBar.svelte.d.ts +20 -0
- package/dist/ui/components/ScrollableContent.svelte +18 -0
- package/dist/ui/components/ScrollableContent.svelte.d.ts +31 -0
- package/dist/ui/components/Section.svelte +97 -0
- package/dist/ui/components/Section.svelte.d.ts +50 -0
- package/dist/ui/components/SelectBodyOrDivBlock.svelte +26 -0
- package/dist/ui/components/SelectBodyOrDivBlock.svelte.d.ts +26 -0
- package/dist/ui/components/Spacer.svelte +9 -0
- package/dist/ui/components/Spacer.svelte.d.ts +22 -0
- package/dist/ui/components/SpinnerPlusMinus.svelte +75 -0
- package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +23 -0
- package/dist/ui/components/SpinnerUpDown.svelte +194 -0
- package/dist/ui/components/SpinnerUpDown.svelte.d.ts +31 -0
- package/dist/ui/components/Tabs.svelte +71 -0
- package/dist/ui/components/Tabs.svelte.d.ts +26 -0
- package/dist/ui/components/ToggleItem.svelte +29 -0
- package/dist/ui/components/ToggleItem.svelte.d.ts +28 -0
- package/dist/ui/components/ToggleList.svelte +57 -0
- package/dist/ui/components/ToggleList.svelte.d.ts +39 -0
- package/dist/ui/components/breakpoints/BreakpointItem.svelte +84 -0
- package/dist/ui/components/breakpoints/BreakpointItem.svelte.d.ts +37 -0
- package/dist/ui/components/breakpoints/breakpointOptions.d.ts +12 -0
- package/dist/ui/components/breakpoints/breakpointOptions.js +38 -0
- package/dist/ui/components/breakpoints/index.d.ts +3 -0
- package/dist/ui/components/breakpoints/index.js +3 -0
- package/dist/ui/components/button/Button.stories.svelte +275 -0
- package/dist/ui/components/button/Button.stories.svelte.d.ts +27 -0
- package/dist/ui/components/button/Button.svelte +389 -0
- package/dist/ui/components/button/Button.svelte.d.ts +84 -0
- package/dist/ui/components/button/index.d.ts +2 -0
- package/dist/ui/components/button/index.js +1 -0
- package/dist/ui/components/button/types.d.ts +23 -0
- package/dist/ui/components/button/types.js +1 -0
- package/dist/ui/components/buttons/FooterButton.svelte +277 -0
- package/dist/ui/components/buttons/FooterButton.svelte.d.ts +10 -0
- package/dist/ui/components/buttons/index.d.ts +5 -0
- package/dist/ui/components/buttons/index.js +5 -0
- package/dist/ui/components/buttons/types.d.ts +28 -0
- package/dist/ui/components/buttons/types.js +1 -0
- package/dist/ui/components/clickable/Clickable.stories.svelte +213 -0
- package/dist/ui/components/clickable/Clickable.stories.svelte.d.ts +27 -0
- package/dist/ui/components/clickable/Clickable.svelte +93 -0
- package/dist/ui/components/clickable/Clickable.svelte.d.ts +4 -0
- package/dist/ui/components/clickable/index.d.ts +2 -0
- package/dist/ui/components/clickable/index.js +1 -0
- package/dist/ui/components/clickable/types.d.ts +17 -0
- package/dist/ui/components/clickable/types.js +1 -0
- package/dist/ui/components/index.d.ts +46 -0
- package/dist/ui/components/index.js +46 -0
- package/dist/ui/components/input/Input.stories.d.ts +109 -0
- package/dist/ui/components/input/Input.stories.js +337 -0
- package/dist/ui/components/input/Input.svelte +422 -0
- package/dist/ui/components/input/Input.svelte.d.ts +4 -0
- package/dist/ui/components/input/index.d.ts +2 -0
- package/dist/ui/components/input/index.js +1 -0
- package/dist/ui/components/input/types.d.ts +109 -0
- package/dist/ui/components/input/types.js +1 -0
- package/dist/ui/components/layout/ExampleLayout.svelte +538 -0
- package/dist/ui/components/layout/ExampleLayout.svelte.d.ts +3 -0
- package/dist/ui/components/layout/Layout.stories.svelte +24 -0
- package/dist/ui/components/layout/Layout.stories.svelte.d.ts +18 -0
- package/dist/ui/components/layout/Layout.svelte +551 -0
- package/dist/ui/components/layout/Layout.svelte.d.ts +30 -0
- package/dist/ui/components/layout/common/EditModeMessage.svelte +59 -0
- package/dist/ui/components/layout/common/EditModeMessage.svelte.d.ts +3 -0
- package/dist/ui/components/layout/common/index.d.ts +1 -0
- package/dist/ui/components/layout/common/index.js +1 -0
- package/dist/ui/components/layout/index.d.ts +3 -0
- package/dist/ui/components/layout/index.js +2 -0
- package/dist/ui/components/layout/types.d.ts +59 -0
- package/dist/ui/components/layout/types.js +1 -0
- package/dist/ui/components/select/Select.stories.d.ts +94 -0
- package/dist/ui/components/select/Select.stories.js +396 -0
- package/dist/ui/components/select/Select.svelte +705 -0
- package/dist/ui/components/select/Select.svelte.d.ts +11 -0
- package/dist/ui/components/select/index.d.ts +2 -0
- package/dist/ui/components/select/index.js +1 -0
- package/dist/ui/components/select/types.d.ts +94 -0
- package/dist/ui/components/select/types.js +1 -0
- package/dist/ui/components/switch/Switch.stories.d.ts +58 -0
- package/dist/ui/components/switch/Switch.stories.js +198 -0
- package/dist/ui/components/switch/Switch.svelte +220 -0
- package/dist/ui/components/switch/Switch.svelte.d.ts +4 -0
- package/dist/ui/components/switch/index.d.ts +2 -0
- package/dist/ui/components/switch/index.js +1 -0
- package/dist/ui/components/switch/types.d.ts +47 -0
- package/dist/ui/components/switch/types.js +1 -0
- package/dist/ui/components/text/README.md +73 -0
- package/dist/ui/components/text/Text.stories.svelte +203 -0
- package/dist/ui/components/text/Text.stories.svelte.d.ts +27 -0
- package/dist/ui/components/text/Text.svelte +778 -0
- package/dist/ui/components/text/Text.svelte.d.ts +8 -0
- package/dist/ui/components/text/index.d.ts +3 -0
- package/dist/ui/components/text/index.js +2 -0
- package/dist/ui/components/text/types.d.ts +46 -0
- package/dist/ui/components/text/types.js +1 -0
- package/dist/ui/components/tooltip/Tooltip.stories.svelte +128 -0
- package/dist/ui/components/tooltip/Tooltip.stories.svelte.d.ts +27 -0
- package/dist/ui/components/tooltip/Tooltip.svelte +463 -0
- package/dist/ui/components/tooltip/Tooltip.svelte.d.ts +7 -0
- package/dist/ui/components/tooltip/index.d.ts +2 -0
- package/dist/ui/components/tooltip/index.js +1 -0
- package/dist/ui/components/tooltip/types.d.ts +114 -0
- package/dist/ui/components/tooltip/types.js +1 -0
- package/dist/ui/icons/AccordionDownArrow.svelte +8 -0
- package/dist/ui/icons/AccordionDownArrow.svelte.d.ts +26 -0
- package/dist/ui/icons/AccordionUpArrow.svelte +8 -0
- package/dist/ui/icons/AccordionUpArrow.svelte.d.ts +26 -0
- package/dist/ui/icons/AccountIcon.svelte +14 -0
- package/dist/ui/icons/AccountIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ArrowIcon.svelte +6 -0
- package/dist/ui/icons/ArrowIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BackIcon.svelte +8 -0
- package/dist/ui/icons/BackIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BodyIcon.svelte +8 -0
- package/dist/ui/icons/BodyIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BookmarkIcon.svelte +13 -0
- package/dist/ui/icons/BookmarkIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BoxAddIcon.svelte +8 -0
- package/dist/ui/icons/BoxAddIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BrushIcon.svelte +10 -0
- package/dist/ui/icons/BrushIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BuilderEditIcon.svelte +12 -0
- package/dist/ui/icons/BuilderEditIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BuilderIcon.svelte +14 -0
- package/dist/ui/icons/BuilderIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CMSIcon.svelte +8 -0
- package/dist/ui/icons/CMSIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckCircleIcon.svelte +8 -0
- package/dist/ui/icons/CheckCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckCircleOutlinedIcon.svelte +15 -0
- package/dist/ui/icons/CheckCircleOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckIcon.svelte +9 -0
- package/dist/ui/icons/CheckIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckboxCheckedIcon.svelte +15 -0
- package/dist/ui/icons/CheckboxCheckedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ChevronIcon.svelte +8 -0
- package/dist/ui/icons/ChevronIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ChevronRightIcon.svelte +8 -0
- package/dist/ui/icons/ChevronRightIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CircleIcon.svelte +3 -0
- package/dist/ui/icons/CircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CloseCircleIcon.svelte +6 -0
- package/dist/ui/icons/CloseCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CloseIcon.svelte +8 -0
- package/dist/ui/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CodeIcon.svelte +8 -0
- package/dist/ui/icons/CodeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ComponentsIcon.svelte +7 -0
- package/dist/ui/icons/ComponentsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CookieIcon.svelte +15 -0
- package/dist/ui/icons/CookieIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CopyIcon.svelte +19 -0
- package/dist/ui/icons/CopyIcon.svelte.d.ts +20 -0
- package/dist/ui/icons/CrossIcon.svelte +4 -0
- package/dist/ui/icons/CrossIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/DOMElement.svelte +19 -0
- package/dist/ui/icons/DOMElement.svelte.d.ts +28 -0
- package/dist/ui/icons/DeleteIcon.svelte +8 -0
- package/dist/ui/icons/DeleteIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/DeleteOutlinedIcon.svelte +8 -0
- package/dist/ui/icons/DeleteOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/Desktop.svelte +19 -0
- package/dist/ui/icons/Desktop.svelte.d.ts +21 -0
- package/dist/ui/icons/DesktopWithStar.svelte +21 -0
- package/dist/ui/icons/DesktopWithStar.svelte.d.ts +21 -0
- package/dist/ui/icons/DivBlock.svelte +14 -0
- package/dist/ui/icons/DivBlock.svelte.d.ts +28 -0
- package/dist/ui/icons/EditIcon.svelte +15 -0
- package/dist/ui/icons/EditIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ExpertIcon.svelte +16 -0
- package/dist/ui/icons/ExpertIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/EyeCancelIcon.svelte +12 -0
- package/dist/ui/icons/EyeCancelIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/EyeIcon.svelte +12 -0
- package/dist/ui/icons/EyeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FavouriteIcon.svelte +6 -0
- package/dist/ui/icons/FavouriteIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FileUploadIcon.svelte +18 -0
- package/dist/ui/icons/FileUploadIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FilterIcon.svelte +8 -0
- package/dist/ui/icons/FilterIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FinsweetLibraryIcon.svelte +21 -0
- package/dist/ui/icons/FinsweetLibraryIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FinsweetLogoIcon.svelte +20 -0
- package/dist/ui/icons/FinsweetLogoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FolderIcon.svelte +6 -0
- package/dist/ui/icons/FolderIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FolderOutlinedIcon.svelte +8 -0
- package/dist/ui/icons/FolderOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FolderPlusIcon.svelte +10 -0
- package/dist/ui/icons/FolderPlusIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FreeComponentIcon.svelte +8 -0
- package/dist/ui/icons/FreeComponentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/GlobeIcon.svelte +14 -0
- package/dist/ui/icons/GlobeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HandPointUpIcon.svelte +9 -0
- package/dist/ui/icons/HandPointUpIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HeartIcon.svelte +8 -0
- package/dist/ui/icons/HeartIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HeartIconOutlined.svelte +8 -0
- package/dist/ui/icons/HeartIconOutlined.svelte.d.ts +26 -0
- package/dist/ui/icons/HelpAltIcon.svelte +23 -0
- package/dist/ui/icons/HelpAltIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HelpIcon.svelte +16 -0
- package/dist/ui/icons/HelpIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HomeIcon.svelte +8 -0
- package/dist/ui/icons/HomeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/InfoIcon.svelte +14 -0
- package/dist/ui/icons/InfoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ListIcon.svelte +18 -0
- package/dist/ui/icons/ListIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/LockIcon.svelte +13 -0
- package/dist/ui/icons/LockIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/MessageIcon.svelte +10 -0
- package/dist/ui/icons/MessageIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/MobileLandscape.svelte +20 -0
- package/dist/ui/icons/MobileLandscape.svelte.d.ts +21 -0
- package/dist/ui/icons/MobilePortrait.svelte +20 -0
- package/dist/ui/icons/MobilePortrait.svelte.d.ts +21 -0
- package/dist/ui/icons/NavigatorIcon.svelte +8 -0
- package/dist/ui/icons/NavigatorIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/OpenBookIcon.svelte +8 -0
- package/dist/ui/icons/OpenBookIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageDraftIcon.svelte +8 -0
- package/dist/ui/icons/PageDraftIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageIcon.svelte +9 -0
- package/dist/ui/icons/PageIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageLockedIcon.svelte +8 -0
- package/dist/ui/icons/PageLockedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageOutlinedIcon.svelte +8 -0
- package/dist/ui/icons/PageOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageSectionIcon.svelte +10 -0
- package/dist/ui/icons/PageSectionIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/Pencil.svelte +12 -0
- package/dist/ui/icons/Pencil.svelte.d.ts +20 -0
- package/dist/ui/icons/PencilOutlinedIcon.svelte +15 -0
- package/dist/ui/icons/PencilOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PinIcon.svelte +8 -0
- package/dist/ui/icons/PinIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PlayIcon.svelte +8 -0
- package/dist/ui/icons/PlayIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PlusIcon.svelte +8 -0
- package/dist/ui/icons/PlusIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PreviewEyeIcon.svelte +12 -0
- package/dist/ui/icons/PreviewEyeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ProfileIcon.svelte +12 -0
- package/dist/ui/icons/ProfileIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PublishCancelIcon.svelte +8 -0
- package/dist/ui/icons/PublishCancelIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PublishIcon.svelte +12 -0
- package/dist/ui/icons/PublishIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/RefreshIcon.svelte +10 -0
- package/dist/ui/icons/RefreshIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/RepairIcon.svelte +10 -0
- package/dist/ui/icons/RepairIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SaveIcon.svelte +14 -0
- package/dist/ui/icons/SaveIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SearchIcon.svelte +8 -0
- package/dist/ui/icons/SearchIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SelectIcon.svelte +7 -0
- package/dist/ui/icons/SelectIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SettingsIcon.svelte +8 -0
- package/dist/ui/icons/SettingsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SidebarToggleIcon.svelte +28 -0
- package/dist/ui/icons/SidebarToggleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SliderAppIcon.svelte +14 -0
- package/dist/ui/icons/SliderAppIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SquareCheckIcon.svelte +3 -0
- package/dist/ui/icons/SquareCheckIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/StarIcon.svelte +6 -0
- package/dist/ui/icons/StarIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/StarOutlinedIcon.svelte +6 -0
- package/dist/ui/icons/StarOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/StaticContentIcon.svelte +8 -0
- package/dist/ui/icons/StaticContentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SubtractIcon.svelte +9 -0
- package/dist/ui/icons/SubtractIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TabNewIcon.svelte +6 -0
- package/dist/ui/icons/TabNewIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TableAppIcon.svelte +19 -0
- package/dist/ui/icons/TableAppIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/Tablet.svelte +20 -0
- package/dist/ui/icons/Tablet.svelte.d.ts +21 -0
- package/dist/ui/icons/TabletPreview.svelte +20 -0
- package/dist/ui/icons/TabletPreview.svelte.d.ts +21 -0
- package/dist/ui/icons/TabsIcon.svelte +17 -0
- package/dist/ui/icons/TabsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ThreeDotsIcon.svelte +14 -0
- package/dist/ui/icons/ThreeDotsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TimesIcon.svelte +4 -0
- package/dist/ui/icons/TimesIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ToolTipInfoCircleIcon.svelte +11 -0
- package/dist/ui/icons/ToolTipInfoCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TooltipInfoCircleFilled.svelte +13 -0
- package/dist/ui/icons/TooltipInfoCircleFilled.svelte.d.ts +26 -0
- package/dist/ui/icons/TooltipInfoSquaredIcon.svelte +16 -0
- package/dist/ui/icons/TooltipInfoSquaredIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TriangleDownIcon.svelte +7 -0
- package/dist/ui/icons/TriangleDownIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TriangleDownIconToggle.svelte +21 -0
- package/dist/ui/icons/TriangleDownIconToggle.svelte.d.ts +20 -0
- package/dist/ui/icons/UndoIcon.svelte +6 -0
- package/dist/ui/icons/UndoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/UploadFileIcon.svelte +10 -0
- package/dist/ui/icons/UploadFileIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningCircleIcon.svelte +7 -0
- package/dist/ui/icons/WarningCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningCircleOutlineIcon.svelte +14 -0
- package/dist/ui/icons/WarningCircleOutlineIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningTriangleIcon.svelte +6 -0
- package/dist/ui/icons/WarningTriangleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningTriangleOutlineIcon.svelte +14 -0
- package/dist/ui/icons/WarningTriangleOutlineIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WebflowComponentIcon.svelte +14 -0
- package/dist/ui/icons/WebflowComponentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WebflowComponentOutlinedIcon.svelte +10 -0
- package/dist/ui/icons/WebflowComponentOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WebflowInsightsIcon.svelte +6 -0
- package/dist/ui/icons/WebflowInsightsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WizedLogoIcon.svelte +39 -0
- package/dist/ui/icons/WizedLogoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/XL.svelte +19 -0
- package/dist/ui/icons/XL.svelte.d.ts +21 -0
- package/dist/ui/icons/XXL.svelte +19 -0
- package/dist/ui/icons/XXL.svelte.d.ts +21 -0
- package/dist/ui/icons/XXXL.svelte +19 -0
- package/dist/ui/icons/XXXL.svelte.d.ts +21 -0
- package/dist/ui/icons/apps/FsConsentIcon.svelte +22 -0
- package/dist/ui/icons/apps/FsConsentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsCursorIcon.svelte +12 -0
- package/dist/ui/icons/apps/FsCursorIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsExampleIcon.svelte +10 -0
- package/dist/ui/icons/apps/FsExampleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsInstagramFeedIcon.svelte +27 -0
- package/dist/ui/icons/apps/FsInstagramFeedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsMarqueeIcon.svelte +13 -0
- package/dist/ui/icons/apps/FsMarqueeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsNumberCountIcon.svelte +46 -0
- package/dist/ui/icons/apps/FsNumberCountIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsSliderIcon.svelte +13 -0
- package/dist/ui/icons/apps/FsSliderIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsTablesIcon.svelte +19 -0
- package/dist/ui/icons/apps/FsTablesIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsTabsIcon.svelte +24 -0
- package/dist/ui/icons/apps/FsTabsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsTooltipIcon.svelte +12 -0
- package/dist/ui/icons/apps/FsTooltipIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsYouTubeFeedIcon.svelte +43 -0
- package/dist/ui/icons/apps/FsYouTubeFeedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/index.d.ts +15 -0
- package/dist/ui/icons/apps/index.js +15 -0
- package/dist/ui/icons/index.d.ts +120 -0
- package/dist/ui/icons/index.js +120 -0
- package/dist/ui/index.css +494 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/utils/api/checkIfAppModeIsDesign.d.ts +5 -0
- package/dist/utils/api/checkIfAppModeIsDesign.js +20 -0
- package/dist/utils/api/clipboard/handlePaste.d.ts +46 -0
- package/dist/utils/api/clipboard/handlePaste.js +53 -0
- package/dist/utils/api/clipboard/index.d.ts +1 -0
- package/dist/utils/api/clipboard/index.js +1 -0
- package/dist/utils/api/copyPaste/index.d.ts +18 -0
- package/dist/utils/api/copyPaste/index.js +1 -0
- package/dist/utils/api/getAllAssets.d.ts +12 -0
- package/dist/utils/api/getAllAssets.js +21 -0
- package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +9 -0
- package/dist/utils/api/getFinsweetComponentsEnvironment.js +70 -0
- package/dist/utils/api/index.d.ts +6 -0
- package/dist/utils/api/index.js +6 -0
- package/dist/utils/api/insertWithXSCP.d.ts +5 -0
- package/dist/utils/api/insertWithXSCP.js +13 -0
- package/dist/utils/auth/crossWindowLogin.d.ts +2 -0
- package/dist/utils/auth/crossWindowLogin.js +49 -0
- package/dist/utils/auth/index.d.ts +61 -0
- package/dist/utils/auth/index.js +196 -0
- package/dist/utils/browser-storage/index.d.ts +2 -0
- package/dist/utils/browser-storage/index.js +2 -0
- package/dist/utils/browser-storage/localStorage.d.ts +24 -0
- package/dist/utils/browser-storage/localStorage.js +56 -0
- package/dist/utils/browser-storage/sessionStorage.d.ts +24 -0
- package/dist/utils/browser-storage/sessionStorage.js +56 -0
- package/dist/utils/constants.d.ts +61 -0
- package/dist/utils/constants.js +73 -0
- package/dist/utils/custom-code/api.d.ts +17 -0
- package/dist/utils/custom-code/api.js +41 -0
- package/dist/utils/custom-code/index.d.ts +1 -0
- package/dist/utils/custom-code/index.js +1 -0
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +5 -0
- package/dist/utils/helpers/cleanupTooltipMessage.js +25 -0
- package/dist/utils/helpers/goto.d.ts +7 -0
- package/dist/utils/helpers/goto.js +35 -0
- package/dist/utils/helpers/index.d.ts +5 -0
- package/dist/utils/helpers/index.js +5 -0
- package/dist/utils/helpers/noop.d.ts +4 -0
- package/dist/utils/helpers/noop.js +7 -0
- package/dist/utils/helpers/numbers.d.ts +27 -0
- package/dist/utils/helpers/numbers.js +61 -0
- package/dist/utils/helpers/objectsToModuleExports.d.ts +9 -0
- package/dist/utils/helpers/objectsToModuleExports.js +13 -0
- package/dist/utils/helpers/trimText.d.ts +15 -0
- package/dist/utils/helpers/trimText.js +33 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger/index.d.ts +19 -0
- package/dist/utils/logger/index.js +41 -0
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +6 -0
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +19 -0
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +8 -0
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +21 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +7 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +25 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +6 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +26 -0
- package/dist/utils/webflow-canvas/attributes/index.d.ts +7 -0
- package/dist/utils/webflow-canvas/attributes/index.js +7 -0
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +7 -0
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +37 -0
- package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +10 -0
- package/dist/utils/webflow-canvas/attributes/setStyles.js +36 -0
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +11 -0
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +61 -0
- package/dist/utils/webflow-canvas/findInstanceElement.d.ts +32 -0
- package/dist/utils/webflow-canvas/findInstanceElement.js +144 -0
- package/dist/utils/webflow-canvas/getAllPages.d.ts +29 -0
- package/dist/utils/webflow-canvas/getAllPages.js +93 -0
- package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +7 -0
- package/dist/utils/webflow-canvas/getSiteStagingUrl.js +14 -0
- package/dist/utils/webflow-canvas/index.d.ts +3 -0
- package/dist/utils/webflow-canvas/index.js +3 -0
- package/package.json +107 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wized
|
|
3
|
+
*/
|
|
4
|
+
export const WIZED = 'wized';
|
|
5
|
+
export const WIZED_LEGACY = 'w-el';
|
|
6
|
+
export const WIZED_ELEMENTS_SITEMAPS = 'wized-elements-sitemaps';
|
|
7
|
+
export const WIZED_ATTRIBUTES_ENDPOINT = 'https://server.wized.com/v2/site/attributes';
|
|
8
|
+
export const WIZED_ATTRIBUTES_ENDPOINT_STAGING = 'https://ss.wized.com/v2/site/attributes';
|
|
9
|
+
export const WIZED_REVERSE_PROXY_URL = 'https://server.wized.com/v2/page/proxy?url=';
|
|
10
|
+
export const FINSWEET_REVERSE_PROXY_URL = 'https://api.finsweet.com/cors?url=';
|
|
11
|
+
export const WIZED_V2_SITE_CONFIGURATION_ENDPOINT = 'https://server.wized.com/v2/extensions/configuration';
|
|
12
|
+
export const WIZED_V2_SITE_CONFIGURATION_ENDPOINT_STAGING = 'https://ss.wized.com/v2/extensions/configuration';
|
|
13
|
+
export const FINSWEET_SUBSCRIPTIONS_ENDPOINT = 'https://accounts.finsweet.com/v1/subscriptions';
|
|
14
|
+
export const FINSWEET_SUBSCRIPTIONS_ENDPOINT_STAGING = 'https://test-accounts.finsweet.com/v1/subscriptions';
|
|
15
|
+
export const WIZED_PROD_SUBSCRIPTIONS_API = 'http://accounts.finsweet.com';
|
|
16
|
+
export const WIZED_DEV_SUBSCRIPTIONS_API = 'http://test-accounts.finsweet.com';
|
|
17
|
+
export const WIZED_PROD_SUBSCRIPTION_PAGE_URL = 'https://my.finsweet.com/subscriptions/create?product=finsweet-community';
|
|
18
|
+
export const WIZED_APP_CONFIGURATOR_STAGING = 'https://sa.wized.com/configurator';
|
|
19
|
+
export const WIZED_APP_CONFIGURATOR_PROD = 'https://app.wized.com/configurator';
|
|
20
|
+
/**
|
|
21
|
+
* Finsweet Components
|
|
22
|
+
*/
|
|
23
|
+
export const ACCOUNTS_API_PRODUCTION = 'https://accounts.finsweet.com/v1/components/verify?';
|
|
24
|
+
export const ACCOUNTS_API_DEV = 'https://test-accounts.finsweet.com/v1/components/verify?';
|
|
25
|
+
export const COMPONENTS_SUBSCRIPTIONS_ENDPOINT_DEV = 'https://test-my.finsweet.com/subscriptions/create';
|
|
26
|
+
export const COMPONENTS_SUBSCRIPTIONS_ENDPOINT_PROD = 'https://my.finsweet.com/subscriptions/create';
|
|
27
|
+
export const PROD_FINSWEEET_ACCOUNTS_ORIGIN = 'https://accounts.finsweet.com';
|
|
28
|
+
export const AUTH0_DOMAIN = 'finsweet.auth0.com';
|
|
29
|
+
export const AUTH0_CLIENT_ID = '5xTAnXb3mwUby3YGJRKJpVaNCMWqXtb1';
|
|
30
|
+
export const AUTH0_REDIRECT_URL = 'https://accounts.finsweet.com/v1/auth0/oauth2/fs-components';
|
|
31
|
+
export const AUTH0_SCOPE = 'openid profile email offline_access';
|
|
32
|
+
export const AUTH0_AUDIENCE = 'https://sso.finsweet.com';
|
|
33
|
+
export const AUTH0_LOGIN_URL = 'https://sso.finsweet.com/authorize';
|
|
34
|
+
/**
|
|
35
|
+
* Finsweet Components Server
|
|
36
|
+
*/
|
|
37
|
+
export const COMPONENTS_SERVER_DEV_ENDPOINT = 'https://fs-components-api-dev.finsweet.workers.dev/v1/';
|
|
38
|
+
export const COMPONENTS_SERVER_PROD_ENDPOINT = 'https://fs-components-api-prod.finsweet.workers.dev/v1/';
|
|
39
|
+
export const COMPONENTS_CORE_SCRIPT = 'https://cdn.jsdelivr.net/npm/@finsweet/fs-components@2/fs-components.js';
|
|
40
|
+
/**
|
|
41
|
+
* Finsweet Components Local
|
|
42
|
+
*/
|
|
43
|
+
export const COMPONENTS_SERVER_DEV_ENDPOINT_LOCAL = 'http://localhost:8787/v1/';
|
|
44
|
+
export const COMPONENTS_CORE_SCRIPT_LOCAL = 'http://localhost:3000/fs-components.js';
|
|
45
|
+
/**
|
|
46
|
+
* Finsweet Components Brand
|
|
47
|
+
*/
|
|
48
|
+
export const BRAND = {
|
|
49
|
+
FINSWEET: 'Finsweet',
|
|
50
|
+
COMPONENT: 'Component',
|
|
51
|
+
COMPONENTS: 'Components',
|
|
52
|
+
FULL: {
|
|
53
|
+
SINGULAR: 'Finsweet Component',
|
|
54
|
+
PLURAL: 'Finsweet Components'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Webflow App Origins
|
|
59
|
+
*/
|
|
60
|
+
export const FINSWEET_COMPONENTS_WEBFLOW_APP_ORIGINS = [
|
|
61
|
+
'http://localhost:1337',
|
|
62
|
+
'https://6544eda5f000985a163a8687.webflow-ext.com',
|
|
63
|
+
'https://64b2e4cfe025c96ef1c8baf4.webflow-ext.com',
|
|
64
|
+
'https://654d8ce9d9b49c7fd929a451.webflow-ext.com'
|
|
65
|
+
];
|
|
66
|
+
export const ACCEPTED_WEBFLOW_ELEMENTS_FOR_INSERTION = [
|
|
67
|
+
'Body',
|
|
68
|
+
'Block',
|
|
69
|
+
'DOM',
|
|
70
|
+
'Section',
|
|
71
|
+
'Container',
|
|
72
|
+
'BlockContainer'
|
|
73
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CustomCodeBlock } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A utility function for getting stored Custom Code based on id.
|
|
4
|
+
* @param {string} id - The Custom Code block ID identifier. If not provided, all stored configs will be returned.
|
|
5
|
+
* @returns {CustomCodeBlock | null} The stored configs, or null if not found.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCustomCode: (id?: string) => Promise<Array<CustomCodeBlock>>;
|
|
8
|
+
/**
|
|
9
|
+
* A utility function for setting a value in Custom Code.
|
|
10
|
+
* @param {CustomCodeBlock} customCodeBlock - The custom code block to be stored.
|
|
11
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
12
|
+
*/
|
|
13
|
+
export declare const setCustomCode: (customCodeBlock: Array<CustomCodeBlock>) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* A utility function for removing Custom Code block.
|
|
16
|
+
*/
|
|
17
|
+
export declare const removeCustomCode: () => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getLogger } from '../logger';
|
|
2
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
|
+
/**
|
|
4
|
+
* A utility function for getting stored Custom Code based on id.
|
|
5
|
+
* @param {string} id - The Custom Code block ID identifier. If not provided, all stored configs will be returned.
|
|
6
|
+
* @returns {CustomCodeBlock | null} The stored configs, or null if not found.
|
|
7
|
+
*/
|
|
8
|
+
export const getCustomCode = async (id) => {
|
|
9
|
+
//TODO: update this when typings are available plus any other place we have disabled this warning.
|
|
10
|
+
//@ts-expect-error - not available in typings for now
|
|
11
|
+
const customCodeBlock = (await webflow.getSiteCustomCode());
|
|
12
|
+
if (!customCodeBlock || customCodeBlock.length === 0)
|
|
13
|
+
return [];
|
|
14
|
+
if (!id)
|
|
15
|
+
return customCodeBlock;
|
|
16
|
+
const storedConfigs = customCodeBlock.filter((block) => block.id === id);
|
|
17
|
+
if (storedConfigs)
|
|
18
|
+
return storedConfigs;
|
|
19
|
+
return [];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A utility function for setting a value in Custom Code.
|
|
23
|
+
* @param {CustomCodeBlock} customCodeBlock - The custom code block to be stored.
|
|
24
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
25
|
+
*/
|
|
26
|
+
export const setCustomCode = async (customCodeBlock) => {
|
|
27
|
+
try {
|
|
28
|
+
//@ts-expect-error - not available in typings for now
|
|
29
|
+
await webflow.setSiteCustomCode(customCodeBlock);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
logger.error({}, 'Failed to save custom code block', error, customCodeBlock);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A utility function for removing Custom Code block.
|
|
37
|
+
*/
|
|
38
|
+
export const removeCustomCode = () => {
|
|
39
|
+
//TODO: implement when available
|
|
40
|
+
return true;
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle fullstop at the end of the message.
|
|
3
|
+
* @param message
|
|
4
|
+
*/
|
|
5
|
+
export const cleanupTooltipMessage = (message) => {
|
|
6
|
+
if (!message?.trim())
|
|
7
|
+
return message;
|
|
8
|
+
const trimmed = message.trim();
|
|
9
|
+
if (!trimmed)
|
|
10
|
+
return message;
|
|
11
|
+
// Check if there's any period anywhere in the text
|
|
12
|
+
const hasPeriod = trimmed.includes('.');
|
|
13
|
+
if (hasPeriod) {
|
|
14
|
+
// If there's a period somewhere, ensure it ends with a period
|
|
15
|
+
if (!trimmed.endsWith('.')) {
|
|
16
|
+
return trimmed + '.';
|
|
17
|
+
}
|
|
18
|
+
return trimmed;
|
|
19
|
+
}
|
|
20
|
+
// If there's no period anywhere, remove any trailing period
|
|
21
|
+
if (trimmed.endsWith('.')) {
|
|
22
|
+
return trimmed.slice(0, -1);
|
|
23
|
+
}
|
|
24
|
+
return trimmed;
|
|
25
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigate to a new path. This uses the current hash from the router store.
|
|
3
|
+
* It then users svelte-routing's navigate function to navigate to the new path.
|
|
4
|
+
* @param path - The path to navigate to. Defaults to '/'.
|
|
5
|
+
* @param state - The state to pass to the new path. Read more about state here: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
|
|
6
|
+
*/
|
|
7
|
+
export declare const goto: (path?: string, state?: Record<string, unknown>) => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { get } from 'svelte/store';
|
|
2
|
+
import { navigate } from 'svelte-routing';
|
|
3
|
+
import { routerStore } from '../../stores';
|
|
4
|
+
import { getLogger } from '../logger';
|
|
5
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
6
|
+
/**
|
|
7
|
+
* Normalize a URL path to ensure it starts with a single slash and is parsed correctly by the URL constructor.
|
|
8
|
+
* @param path
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const normalizeUrlPath = (path, hash) => {
|
|
12
|
+
const safePath = path.replace(/([^:]\/)\/+/g, '$1');
|
|
13
|
+
const parts = safePath.split(hash);
|
|
14
|
+
const prefix = parts[0];
|
|
15
|
+
const suffix = parts[parts.length - 1];
|
|
16
|
+
const final = prefix + hash + suffix;
|
|
17
|
+
const url = new URL(final, window.location.origin);
|
|
18
|
+
return url;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Navigate to a new path. This uses the current hash from the router store.
|
|
22
|
+
* It then users svelte-routing's navigate function to navigate to the new path.
|
|
23
|
+
* @param path - The path to navigate to. Defaults to '/'.
|
|
24
|
+
* @param state - The state to pass to the new path. Read more about state here: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
|
|
25
|
+
*/
|
|
26
|
+
export const goto = (path = '/', state = {}) => {
|
|
27
|
+
const { hash = '' } = get(routerStore);
|
|
28
|
+
if (!hash) {
|
|
29
|
+
logger.error({}, 'goto method found no router hash in the router store. Contact Finsweet support.');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const url = normalizeUrlPath(`/${hash}/${path}`, hash);
|
|
33
|
+
navigate(url.pathname, { state: { ...state } });
|
|
34
|
+
routerStore.update((state) => ({ ...state, url }));
|
|
35
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to a number, removing any invalid symbols like `$` or `,`.
|
|
3
|
+
* @param value A string number.
|
|
4
|
+
* @returns The valid number value.
|
|
5
|
+
*/
|
|
6
|
+
export declare const normalizeNumber: (value: string) => number | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Parses a numeric Attribute string.
|
|
9
|
+
* @param rawValue The raw string. Example: "20", "-25.3"...
|
|
10
|
+
* @param fallback A value to fall back to when the parsed value is not valid.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseNumericAttribute(rawValue: string | number | null | undefined, fallback: number): number;
|
|
13
|
+
export declare function parseNumericAttribute(rawValue: string | number | null | undefined, fallback?: number | null): number | null;
|
|
14
|
+
/**
|
|
15
|
+
* Calculates the amount of decimals that a float number has.
|
|
16
|
+
* @param value A number.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getDecimalPrecision: (value: number) => number;
|
|
19
|
+
/**
|
|
20
|
+
* Adjusts a numeric value to a step factor.
|
|
21
|
+
* @param value The numeric value to adjust.
|
|
22
|
+
* @param step The increment step.
|
|
23
|
+
* @param precision The step's decimal precision. If not provided, it will be calculated.
|
|
24
|
+
* @param minRange A minimum range value, used for offsetting.
|
|
25
|
+
* @returns The adjusted value.
|
|
26
|
+
*/
|
|
27
|
+
export declare const adjustValueToStep: (value: number, step: number, precision?: number, minRange?: number) => number;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to a number, removing any invalid symbols like `$` or `,`.
|
|
3
|
+
* @param value A string number.
|
|
4
|
+
* @returns The valid number value.
|
|
5
|
+
*/
|
|
6
|
+
export const normalizeNumber = (value) => {
|
|
7
|
+
if (!value)
|
|
8
|
+
return;
|
|
9
|
+
return parseFloat(value.replace(/[^0-9.-]+/g, ''));
|
|
10
|
+
};
|
|
11
|
+
export function parseNumericAttribute(rawValue, fallback) {
|
|
12
|
+
if (!rawValue)
|
|
13
|
+
return fallback ?? null;
|
|
14
|
+
const value = Number(rawValue);
|
|
15
|
+
if (!isNaN(value))
|
|
16
|
+
return value;
|
|
17
|
+
if (fallback)
|
|
18
|
+
return fallback;
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Calculates the amount of decimals that a float number has.
|
|
23
|
+
* @param value A number.
|
|
24
|
+
*/
|
|
25
|
+
export const getDecimalPrecision = (value) => {
|
|
26
|
+
if (!isFinite(value))
|
|
27
|
+
return 0;
|
|
28
|
+
let exponential = 1;
|
|
29
|
+
let precision = 0;
|
|
30
|
+
while (Math.round(value * exponential) / exponential !== value) {
|
|
31
|
+
exponential *= 10;
|
|
32
|
+
precision += 1;
|
|
33
|
+
}
|
|
34
|
+
return precision;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Ensures a decimal precision on a number.
|
|
38
|
+
* @param value The number to handle.
|
|
39
|
+
* @param precision The amount of decimals.
|
|
40
|
+
*/
|
|
41
|
+
const setDecimalPrecision = (value, precision) => {
|
|
42
|
+
const pow = Math.pow(10, precision);
|
|
43
|
+
return Math.round(value * pow) / pow;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Adjusts a numeric value to a step factor.
|
|
47
|
+
* @param value The numeric value to adjust.
|
|
48
|
+
* @param step The increment step.
|
|
49
|
+
* @param precision The step's decimal precision. If not provided, it will be calculated.
|
|
50
|
+
* @param minRange A minimum range value, used for offsetting.
|
|
51
|
+
* @returns The adjusted value.
|
|
52
|
+
*/
|
|
53
|
+
export const adjustValueToStep = (value, step, precision, minRange = 0) => {
|
|
54
|
+
precision ??= getDecimalPrecision(step);
|
|
55
|
+
const offset = minRange > 1 ? minRange % step : 0;
|
|
56
|
+
const remainder = value % step;
|
|
57
|
+
const floor = offset + value - remainder;
|
|
58
|
+
if (remainder > step / 2)
|
|
59
|
+
return setDecimalPrecision(floor + step, precision);
|
|
60
|
+
return setDecimalPrecision(floor, precision);
|
|
61
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an array of objects to a single string containing multiple module export statements.
|
|
3
|
+
* @param exportsArray - Array of objects with variable names and objects.
|
|
4
|
+
* @returns The combined module export string.
|
|
5
|
+
*/
|
|
6
|
+
export declare const objectsToModuleExports: (exportsArray: Array<{
|
|
7
|
+
moduleName: string;
|
|
8
|
+
data: object;
|
|
9
|
+
}>) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an array of objects to a single string containing multiple module export statements.
|
|
3
|
+
* @param exportsArray - Array of objects with variable names and objects.
|
|
4
|
+
* @returns The combined module export string.
|
|
5
|
+
*/
|
|
6
|
+
export const objectsToModuleExports = (exportsArray) => {
|
|
7
|
+
return exportsArray
|
|
8
|
+
.map(({ moduleName, data }) => {
|
|
9
|
+
const jsonString = JSON.stringify(data, null, 2);
|
|
10
|
+
return `export const ${moduleName} = ${jsonString};`;
|
|
11
|
+
})
|
|
12
|
+
.join('\n\n');
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trims the given text in the middle and adds ellipsis if it exceeds the specified maximum length.
|
|
3
|
+
*
|
|
4
|
+
* @param text - The input text to be trimmed.
|
|
5
|
+
* @param maxLength - The maximum length of the trimmed text. Default is 40.
|
|
6
|
+
* @returns The trimmed text with ellipsis in the middle, if applicable.
|
|
7
|
+
*/
|
|
8
|
+
export declare const trimText: (text: string, maxLength?: number) => string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Trims whitespaces and extra spaces in a given text.
|
|
11
|
+
*
|
|
12
|
+
* @param text - The input text to be trimmed.
|
|
13
|
+
* @returns The trimmed text with removed extra spaces.
|
|
14
|
+
*/
|
|
15
|
+
export declare const trimExtraSpaces: (text: string) => string | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trims the given text in the middle and adds ellipsis if it exceeds the specified maximum length.
|
|
3
|
+
*
|
|
4
|
+
* @param text - The input text to be trimmed.
|
|
5
|
+
* @param maxLength - The maximum length of the trimmed text. Default is 40.
|
|
6
|
+
* @returns The trimmed text with ellipsis in the middle, if applicable.
|
|
7
|
+
*/
|
|
8
|
+
export const trimText = (text, maxLength = 40) => {
|
|
9
|
+
if (!text)
|
|
10
|
+
return;
|
|
11
|
+
if (text.length <= maxLength) {
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
const mid = Math.floor(maxLength / 2);
|
|
15
|
+
const start = text.slice(0, mid - 1);
|
|
16
|
+
const end = text.slice(text.length - mid + 2);
|
|
17
|
+
return `${start}...${end}`;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Trims whitespaces and extra spaces in a given text.
|
|
21
|
+
*
|
|
22
|
+
* @param text - The input text to be trimmed.
|
|
23
|
+
* @returns The trimmed text with removed extra spaces.
|
|
24
|
+
*/
|
|
25
|
+
export const trimExtraSpaces = (text) => {
|
|
26
|
+
if (!text)
|
|
27
|
+
return;
|
|
28
|
+
// Remove leading and trailing whitespaces
|
|
29
|
+
const trimmedText = text.trim();
|
|
30
|
+
// Replace multiple consecutive spaces with a single space
|
|
31
|
+
const normalizedText = trimmedText.replace(/\s+/g, ' ');
|
|
32
|
+
return normalizedText;
|
|
33
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type PredefinedLoggerContext = 'finsweet-components' | 'webflow-apps-ui-utils' | 'fast-search' | 'fs-cmp';
|
|
2
|
+
export type LoggerContext = PredefinedLoggerContext | (string & Record<never, never>);
|
|
3
|
+
export interface LogData {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export type LogLevel = 'error' | 'warn' | 'info' | 'log' | 'debug';
|
|
7
|
+
export interface Logger {
|
|
8
|
+
error: (context: LogData, message: string, ...args: any[]) => void;
|
|
9
|
+
warn: (context: LogData, message: string, ...args: any[]) => void;
|
|
10
|
+
info: (context: LogData, message: string, ...args: any[]) => void;
|
|
11
|
+
log: (context: LogData, message: string, ...args: any[]) => void;
|
|
12
|
+
debug: (context: LogData, message: string, ...args: any[]) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a logger instance for the given context
|
|
16
|
+
* @param context - The context/identity for this logger instance
|
|
17
|
+
* @returns Logger instance with all log methods
|
|
18
|
+
*/
|
|
19
|
+
export declare function getLogger(context: LoggerContext): Logger;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { getFinsweetComponentsEnvironment } from '../api';
|
|
3
|
+
/**
|
|
4
|
+
* Create a logger instance for the given context
|
|
5
|
+
* @param context - The context/identity for this logger instance
|
|
6
|
+
* @returns Logger instance with all log methods
|
|
7
|
+
*/
|
|
8
|
+
export function getLogger(context) {
|
|
9
|
+
const createLogMethod = (level) => {
|
|
10
|
+
return (logContext, message, ...args) => {
|
|
11
|
+
const { development } = getFinsweetComponentsEnvironment();
|
|
12
|
+
if (development) {
|
|
13
|
+
const contextPrefix = `[${context}]`;
|
|
14
|
+
const consoleMethod = level === 'log' ? 'log' : level;
|
|
15
|
+
if (typeof console[consoleMethod] === 'function') {
|
|
16
|
+
console[consoleMethod](contextPrefix, message, logContext, ...args);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.log(contextPrefix, message, logContext, ...args);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// In production, show warnings in console
|
|
23
|
+
if (!development && level === 'warn') {
|
|
24
|
+
const contextPrefix = `[${context}]`;
|
|
25
|
+
console.warn(contextPrefix, message, logContext, ...args);
|
|
26
|
+
}
|
|
27
|
+
// In production, only send errors to LogRocket
|
|
28
|
+
if (!development && level === 'error') {
|
|
29
|
+
const contextPrefix = `[${context}]`;
|
|
30
|
+
console.error(contextPrefix, message, logContext, ...args);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
error: createLogMethod('error'),
|
|
36
|
+
warn: createLogMethod('warn'),
|
|
37
|
+
info: createLogMethod('info'),
|
|
38
|
+
log: createLogMethod('log'),
|
|
39
|
+
debug: createLogMethod('debug')
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getLogger } from '../../logger';
|
|
2
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves all custom attributes from a Webflow element.
|
|
5
|
+
* @param {AnyElement} params.element - The data object of the element.
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export const getAllWebflowElementAttributes = async (element) => {
|
|
9
|
+
try {
|
|
10
|
+
if (element?.customAttributes) {
|
|
11
|
+
return await element?.getAllCustomAttributes();
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
logger.error({}, 'Error in getAllWebflowElementAttributes:', error);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the instance names from an object
|
|
3
|
+
* @param obj - The object to get the instance names from
|
|
4
|
+
* @param component - The component key
|
|
5
|
+
* @param hasInstances - Whether the object has instances
|
|
6
|
+
* @returns The instance names
|
|
7
|
+
*/
|
|
8
|
+
export declare const getInstanceNamesFromObject: (obj: Record<string, any>, component: string, hasInstances?: boolean) => string[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/**
|
|
3
|
+
* Get the instance names from an object
|
|
4
|
+
* @param obj - The object to get the instance names from
|
|
5
|
+
* @param component - The component key
|
|
6
|
+
* @param hasInstances - Whether the object has instances
|
|
7
|
+
* @returns The instance names
|
|
8
|
+
*/
|
|
9
|
+
export const getInstanceNamesFromObject = (obj, component, hasInstances) => {
|
|
10
|
+
if (!obj || typeof obj !== 'object')
|
|
11
|
+
return [];
|
|
12
|
+
let target = obj;
|
|
13
|
+
if (hasInstances) {
|
|
14
|
+
target = obj?.instances || obj;
|
|
15
|
+
}
|
|
16
|
+
return Object.keys(target)
|
|
17
|
+
?.map((key) => {
|
|
18
|
+
return key;
|
|
19
|
+
})
|
|
20
|
+
?.filter(Boolean);
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the value of a custom attribute on a Webflow element.
|
|
3
|
+
* @param {AnyElement} params.element - The data object of the element.
|
|
4
|
+
* @param {String} params.attributeName - The name of the custom attribute to set.
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare const getWebflowElementAttribute: (element: AnyElement, attributeName: string) => Promise<string | null>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getLogger } from '../../logger';
|
|
2
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the value of a custom attribute on a Webflow element.
|
|
5
|
+
* @param {AnyElement} params.element - The data object of the element.
|
|
6
|
+
* @param {String} params.attributeName - The name of the custom attribute to set.
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export const getWebflowElementAttribute = async (element, attributeName) => {
|
|
10
|
+
try {
|
|
11
|
+
if (element?.customAttributes) {
|
|
12
|
+
return await element?.getCustomAttribute(attributeName);
|
|
13
|
+
}
|
|
14
|
+
// @ts-expect-error - getAttribute is not typed
|
|
15
|
+
if (element?.getAttribute) {
|
|
16
|
+
// @ts-expect-error - getAttribute is not typed
|
|
17
|
+
return await element?.getAttribute(attributeName);
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
logger.error({}, 'Error in getWebflowElementAttribute:', error);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the text content of the webflow element
|
|
3
|
+
* @param el
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export const getWebflowElementTextContent = async (selectedElement) => {
|
|
7
|
+
const textContent = [];
|
|
8
|
+
if (selectedElement?.textContent && selectedElement?.children) {
|
|
9
|
+
// Get Child Elements
|
|
10
|
+
const children = await selectedElement.getChildren();
|
|
11
|
+
// Filter string elements from children
|
|
12
|
+
const strings = children.filter((child) => child.type === 'String');
|
|
13
|
+
// Initialize an array to hold text content
|
|
14
|
+
// Loop over string elements to get text
|
|
15
|
+
for (const myString of strings) {
|
|
16
|
+
if (myString.type === 'String') {
|
|
17
|
+
const text = await myString.getText();
|
|
18
|
+
if (text)
|
|
19
|
+
textContent.push(text);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (textContent.length === 0)
|
|
24
|
+
return '';
|
|
25
|
+
return textContent.join(' ');
|
|
26
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './getAllWebflowElementAttributes';
|
|
2
|
+
export * from './getInstanceNamesFromObject';
|
|
3
|
+
export * from './getWebflowElementAttribute';
|
|
4
|
+
export * from './getWebflowElementTextContent';
|
|
5
|
+
export * from './removeWebflowElementAttribute';
|
|
6
|
+
export * from './setStyles';
|
|
7
|
+
export * from './setWebflowElementAttribute';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './getAllWebflowElementAttributes';
|
|
2
|
+
export * from './getInstanceNamesFromObject';
|
|
3
|
+
export * from './getWebflowElementAttribute';
|
|
4
|
+
export * from './getWebflowElementTextContent';
|
|
5
|
+
export * from './removeWebflowElementAttribute';
|
|
6
|
+
export * from './setStyles';
|
|
7
|
+
export * from './setWebflowElementAttribute';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the specified attribute from the DOMElement.
|
|
3
|
+
* @param {AnyElement} params.element - The data object of the element.
|
|
4
|
+
* @param {String} params.attributeName - The name of the custom attribute to remove.
|
|
5
|
+
* @param {Boolean} params.notify - Whether to show a notification after the attribute is removed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const removeWebflowElementAttribute: (element: AnyElement, attributeName: string, notify?: boolean) => Promise<null | undefined>;
|