@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,37 @@
|
|
|
1
|
+
import { getLogger } from '../../logger';
|
|
2
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
|
+
/**
|
|
4
|
+
* Removes the specified attribute from the DOMElement.
|
|
5
|
+
* @param {AnyElement} params.element - The data object of the element.
|
|
6
|
+
* @param {String} params.attributeName - The name of the custom attribute to remove.
|
|
7
|
+
* @param {Boolean} params.notify - Whether to show a notification after the attribute is removed.
|
|
8
|
+
*/
|
|
9
|
+
export const removeWebflowElementAttribute = async (element, attributeName, notify = true) => {
|
|
10
|
+
try {
|
|
11
|
+
if (element?.customAttributes) {
|
|
12
|
+
element?.removeCustomAttribute(attributeName);
|
|
13
|
+
if (notify) {
|
|
14
|
+
webflow.notify({
|
|
15
|
+
type: 'Success',
|
|
16
|
+
message: `The attribute "${attributeName}" was removed successfully.`
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (element?.type === 'DOM') {
|
|
22
|
+
element?.removeAttribute(attributeName);
|
|
23
|
+
if (notify) {
|
|
24
|
+
webflow.notify({
|
|
25
|
+
type: 'Success',
|
|
26
|
+
message: `The attribute "${attributeName}" was removed successfully.`
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
logger.error({}, 'Error in removeWebflowElementAttribute:', error);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface StyleProps {
|
|
2
|
+
name: string;
|
|
3
|
+
style: PropertyMap;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create or Update style and apply it to the selected element
|
|
7
|
+
* @param styles
|
|
8
|
+
* @param element
|
|
9
|
+
*/
|
|
10
|
+
export declare const setStyles: (styles: StyleProps[], element: AnyElement) => Promise<void>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create or Update style and apply it to the selected element
|
|
3
|
+
* @param styles
|
|
4
|
+
* @param element
|
|
5
|
+
*/
|
|
6
|
+
export const setStyles = async (styles, element) => {
|
|
7
|
+
const promises = styles.map(async ({ name, style }) => {
|
|
8
|
+
if (!element?.styles)
|
|
9
|
+
return null;
|
|
10
|
+
const existingStyles = (await webflow.getAllStyles()) || [];
|
|
11
|
+
const filteredStyles = existingStyles?.filter((s) => !!s);
|
|
12
|
+
const matchPromises = filteredStyles.map(async (s) => {
|
|
13
|
+
const existingName = await s?.getName();
|
|
14
|
+
if (name === existingName) {
|
|
15
|
+
return s;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const match = (await Promise.all(matchPromises))?.find((s) => !!s) || null;
|
|
19
|
+
// Update existing style
|
|
20
|
+
if (match) {
|
|
21
|
+
// get existing props and update it
|
|
22
|
+
const existing = await match?.getProperties();
|
|
23
|
+
await match.setProperties({ ...existing, ...style });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// Create new style
|
|
27
|
+
const newStyle = await webflow.createStyle(name);
|
|
28
|
+
if (newStyle) {
|
|
29
|
+
// Set properties for the style
|
|
30
|
+
newStyle?.setProperties({ ...style });
|
|
31
|
+
// Add the new style and Apply style to selected element
|
|
32
|
+
await element?.setStyles([...filteredStyles, newStyle]);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
await Promise.all(promises);
|
|
36
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets the value of a custom attribute to a Webflow element.
|
|
3
|
+
* If the attribute already exists, it will not be updated by default.
|
|
4
|
+
* To update the attribute, the existing value must be different from the new value.
|
|
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
|
+
* @param {String} params.attributeValue - The value of the custom attribute to set.
|
|
8
|
+
* @param {Boolean} params.notify - Whether to show a notification after the attribute is removed.
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare const setWebflowElementAttribute: (element: AnyElement, attributeName: string, attributeValue: string, notify?: boolean) => Promise<void>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getLogger } from '../../logger';
|
|
2
|
+
import { getWebflowElementAttribute } from './getWebflowElementAttribute';
|
|
3
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
4
|
+
/**
|
|
5
|
+
* Sets the value of a custom attribute to a Webflow element.
|
|
6
|
+
* If the attribute already exists, it will not be updated by default.
|
|
7
|
+
* To update the attribute, the existing value must be different from the new value.
|
|
8
|
+
* @param {AnyElement} params.element - The data object of the element.
|
|
9
|
+
* @param {String} params.attributeName - The name of the custom attribute to set.
|
|
10
|
+
* @param {String} params.attributeValue - The value of the custom attribute to set.
|
|
11
|
+
* @param {Boolean} params.notify - Whether to show a notification after the attribute is removed.
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export const setWebflowElementAttribute = async (element, attributeName, attributeValue, notify = true) => {
|
|
15
|
+
try {
|
|
16
|
+
const attributeExists = await checkAttribute(element, attributeName, attributeValue);
|
|
17
|
+
if (attributeExists) {
|
|
18
|
+
logger.error({}, `Attribute ${attributeName}="${attributeValue}" already exists on the element. Exiting`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (element?.customAttributes) {
|
|
22
|
+
await element?.setCustomAttribute(attributeName, attributeValue);
|
|
23
|
+
if (notify) {
|
|
24
|
+
webflow.notify({
|
|
25
|
+
type: 'Success',
|
|
26
|
+
message: `Attribute ${attributeName}="${attributeValue}" has been updated successfully.`
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (element?.type === 'DOM') {
|
|
32
|
+
await element.setAttribute(attributeName, attributeValue);
|
|
33
|
+
if (notify) {
|
|
34
|
+
webflow.notify({
|
|
35
|
+
type: 'Success',
|
|
36
|
+
message: `Attribute ${attributeName}="${attributeValue}" has been updated successfully.`
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logger.error({}, 'Error in setWebflowElementAttribute:', error);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Checks if the specified attribute exists on a Webflow element and matches the provided value.
|
|
50
|
+
*
|
|
51
|
+
* @param {AnyElement} element - The Webflow element to check.
|
|
52
|
+
* @param {string} attributeName - The name of the attribute to find.
|
|
53
|
+
* @param {string} attributeValue - The value to compare against the found attribute.
|
|
54
|
+
* @return {boolean} - Returns true if the attribute exists and matches the provided value, otherwise false.
|
|
55
|
+
*/
|
|
56
|
+
const checkAttribute = async (element, attributeName, attributeValue) => {
|
|
57
|
+
const elementAttribute = await getWebflowElementAttribute(element, attributeName);
|
|
58
|
+
const attr = elementAttribute?.toLowerCase()?.trim();
|
|
59
|
+
const comparisonValue = attributeValue?.toLowerCase()?.trim();
|
|
60
|
+
return attr === comparisonValue;
|
|
61
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ElementFromComponentMatch {
|
|
2
|
+
element: AnyElement;
|
|
3
|
+
component: ComponentElement | null;
|
|
4
|
+
globalIndex: number;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface GetElementFromComponentProps {
|
|
8
|
+
targetIndex: number;
|
|
9
|
+
instance: string;
|
|
10
|
+
component: string;
|
|
11
|
+
allElements?: AnyElement[];
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
selectElement?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface FindElementByReferenceProps {
|
|
16
|
+
element: AnyElement;
|
|
17
|
+
allElements: AnyElement[];
|
|
18
|
+
attribute: {
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Searches for an instance inside or outside a component by its index.
|
|
25
|
+
* @param targetIndex - The index of the instance to get.
|
|
26
|
+
* @param instance - The instance to search for.
|
|
27
|
+
* @param allElements - The elements to search through.
|
|
28
|
+
* @param signal - AbortSignal for cancelling the operation.
|
|
29
|
+
* @param selectElement - Whether to select the element when found.
|
|
30
|
+
* @returns The element match with its component if applicable.
|
|
31
|
+
*/
|
|
32
|
+
export declare const findInstanceElement: ({ targetIndex, instance, component, allElements, signal, selectElement }: GetElementFromComponentProps) => Promise<ElementFromComponentMatch | null>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { noop } from '../helpers';
|
|
2
|
+
import { getLogger } from '../logger';
|
|
3
|
+
import { getWebflowElementAttribute } from './attributes';
|
|
4
|
+
const logger = getLogger('utils');
|
|
5
|
+
/**
|
|
6
|
+
* Exit the current component
|
|
7
|
+
*/
|
|
8
|
+
const exitComponent = async () => {
|
|
9
|
+
try {
|
|
10
|
+
await webflow.exitComponent();
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
noop(error);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Searches for an instance inside or outside a component by its index.
|
|
18
|
+
* @param targetIndex - The index of the instance to get.
|
|
19
|
+
* @param instance - The instance to search for.
|
|
20
|
+
* @param allElements - The elements to search through.
|
|
21
|
+
* @param signal - AbortSignal for cancelling the operation.
|
|
22
|
+
* @param selectElement - Whether to select the element when found.
|
|
23
|
+
* @returns The element match with its component if applicable.
|
|
24
|
+
*/
|
|
25
|
+
export const findInstanceElement = async ({ targetIndex, instance, component, allElements, signal, selectElement = false }) => {
|
|
26
|
+
if (signal?.aborted)
|
|
27
|
+
return null;
|
|
28
|
+
let attribute = {
|
|
29
|
+
name: '',
|
|
30
|
+
value: ''
|
|
31
|
+
};
|
|
32
|
+
if (component === 'consent') {
|
|
33
|
+
// for cookie consent, just selecting the banner should be enough
|
|
34
|
+
attribute = {
|
|
35
|
+
name: 'fs-consent-element',
|
|
36
|
+
value: 'banner'
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
attribute = {
|
|
41
|
+
name: `fs-${component}-instance`,
|
|
42
|
+
value: instance
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
// Ensure we start at the root level
|
|
47
|
+
await webflow.exitComponent();
|
|
48
|
+
if (signal?.aborted)
|
|
49
|
+
return null;
|
|
50
|
+
const all = allElements || (await webflow.getAllElements());
|
|
51
|
+
if (signal?.aborted)
|
|
52
|
+
return null;
|
|
53
|
+
let currentIndex = 0;
|
|
54
|
+
const componentInstancesMap = new Map();
|
|
55
|
+
for (const element of all) {
|
|
56
|
+
if (signal?.aborted) {
|
|
57
|
+
await exitComponent();
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
if (element.type === 'ComponentInstance') {
|
|
61
|
+
const component = await element.getComponent();
|
|
62
|
+
if (component) {
|
|
63
|
+
componentInstancesMap.set(element.id.toString(), component);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Check elements outside components first
|
|
67
|
+
const elementAttribute = await getWebflowElementAttribute(element, attribute.name);
|
|
68
|
+
if (signal?.aborted) {
|
|
69
|
+
await exitComponent();
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
if (elementAttribute === attribute.value) {
|
|
73
|
+
currentIndex += 1;
|
|
74
|
+
if (currentIndex === targetIndex) {
|
|
75
|
+
if (selectElement) {
|
|
76
|
+
await webflow.setSelectedElement(element);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
element,
|
|
80
|
+
component: null,
|
|
81
|
+
globalIndex: currentIndex,
|
|
82
|
+
selected: selectElement
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// If it's a component, we might need to enter it
|
|
87
|
+
if (element.type === 'ComponentInstance') {
|
|
88
|
+
const component = componentInstancesMap.get(element.id.toString());
|
|
89
|
+
if (!component)
|
|
90
|
+
continue;
|
|
91
|
+
await webflow.enterComponent(element);
|
|
92
|
+
// Check for cancellation after entering component
|
|
93
|
+
if (signal?.aborted) {
|
|
94
|
+
await exitComponent();
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const componentElements = await webflow.getAllElements();
|
|
98
|
+
// Check for cancellation after getting component elements
|
|
99
|
+
if (signal?.aborted) {
|
|
100
|
+
await exitComponent();
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
for (const innerElement of componentElements) {
|
|
104
|
+
// Check for cancellation in inner loop
|
|
105
|
+
if (signal?.aborted) {
|
|
106
|
+
await exitComponent();
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const innerAttribute = await getWebflowElementAttribute(innerElement, attribute.name);
|
|
110
|
+
// Check for cancellation after async operation
|
|
111
|
+
if (signal?.aborted) {
|
|
112
|
+
await exitComponent();
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (innerAttribute === attribute.value) {
|
|
116
|
+
currentIndex += 1;
|
|
117
|
+
if (currentIndex === targetIndex) {
|
|
118
|
+
if (selectElement) {
|
|
119
|
+
// We're already inside the component, so just select the element
|
|
120
|
+
await webflow.setSelectedElement(innerElement);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// Exit component if we're not selecting the element
|
|
124
|
+
await webflow.exitComponent();
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
element: innerElement,
|
|
128
|
+
component: element,
|
|
129
|
+
globalIndex: currentIndex,
|
|
130
|
+
selected: selectElement
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
await webflow.exitComponent();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
logger.error({}, 'Error in findInstanceInsideOrOutsideComponent:', error);
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type PageWithProps = {
|
|
2
|
+
slug: string;
|
|
3
|
+
page: Page | Folder;
|
|
4
|
+
parent: Folder | null;
|
|
5
|
+
name: string;
|
|
6
|
+
kind: 'static' | 'ecommerce' | 'cms' | 'userSystems' | 'utility' | 'staticTemplate';
|
|
7
|
+
url: URL;
|
|
8
|
+
isDraft: boolean;
|
|
9
|
+
isPasswordProtected: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Generates a slug for a page or folder
|
|
13
|
+
* @param page - The page or folder to generate a slug for
|
|
14
|
+
* @returns The slug for the page or folder
|
|
15
|
+
*/
|
|
16
|
+
export declare const getPathname: (page: Page | Folder) => Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a single page with all its properties
|
|
19
|
+
* @param page - The page to get
|
|
20
|
+
* @param stagingUrl - The staging URL
|
|
21
|
+
* @returns The page with all its properties
|
|
22
|
+
*/
|
|
23
|
+
export declare const getPageMetadata: (page: Page) => Promise<PageWithProps>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns all pages and folders from the Webflow project
|
|
26
|
+
* @param pagesAndFolders - If true, returns both pages and folders, else only pages
|
|
27
|
+
* @param kind - Filter pages by kind
|
|
28
|
+
*/
|
|
29
|
+
export declare const getAllPages: (pagesAndFolders?: boolean, kind?: PageWithProps["kind"]) => Promise<PageWithProps[]>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getLogger } from '../logger';
|
|
2
|
+
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
|
+
let pageStagingUrl;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a slug for a page or folder
|
|
6
|
+
* @param page - The page or folder to generate a slug for
|
|
7
|
+
* @returns The slug for the page or folder
|
|
8
|
+
*/
|
|
9
|
+
export const getPathname = async (page) => {
|
|
10
|
+
const parent = await page.getParent();
|
|
11
|
+
const slug = await page.getSlug();
|
|
12
|
+
let fullSlug;
|
|
13
|
+
if (parent) {
|
|
14
|
+
fullSlug = `${await getPathname(parent)}/${slug}`;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
fullSlug = slug;
|
|
18
|
+
}
|
|
19
|
+
// Ensure the slug starts with a forward slash
|
|
20
|
+
return fullSlug.startsWith('/') ? fullSlug : `/${fullSlug}`;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Returns a single page with all its properties
|
|
24
|
+
* @param page - The page to get
|
|
25
|
+
* @param stagingUrl - The staging URL
|
|
26
|
+
* @returns The page with all its properties
|
|
27
|
+
*/
|
|
28
|
+
export const getPageMetadata = async (page) => {
|
|
29
|
+
if (!pageStagingUrl) {
|
|
30
|
+
const { shortName } = await webflow.getSiteInfo();
|
|
31
|
+
pageStagingUrl = `https://${shortName}.webflow.io`;
|
|
32
|
+
}
|
|
33
|
+
const [fullPath, parent, name, kind, isDraft, isPasswordProtected, generatedPathname] = await Promise.all([
|
|
34
|
+
page?.getPublishPath(),
|
|
35
|
+
page?.getParent(),
|
|
36
|
+
page?.getName(),
|
|
37
|
+
page?.getKind(),
|
|
38
|
+
page?.isDraft(),
|
|
39
|
+
page?.isPasswordProtected(),
|
|
40
|
+
getPathname(page)
|
|
41
|
+
]);
|
|
42
|
+
// Create a full URL for the page
|
|
43
|
+
const fullUrl = new URL(pageStagingUrl);
|
|
44
|
+
if (fullPath)
|
|
45
|
+
fullUrl.pathname = generatedPathname;
|
|
46
|
+
return {
|
|
47
|
+
slug: generatedPathname,
|
|
48
|
+
page,
|
|
49
|
+
parent,
|
|
50
|
+
name: name || 'Homepage',
|
|
51
|
+
kind,
|
|
52
|
+
url: fullUrl,
|
|
53
|
+
isDraft,
|
|
54
|
+
isPasswordProtected
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Returns all pages and folders from the Webflow project
|
|
59
|
+
* @param pagesAndFolders - If true, returns both pages and folders, else only pages
|
|
60
|
+
* @param kind - Filter pages by kind
|
|
61
|
+
*/
|
|
62
|
+
export const getAllPages = async (pagesAndFolders, kind) => {
|
|
63
|
+
try {
|
|
64
|
+
const allPages = await webflow?.getAllPagesAndFolders();
|
|
65
|
+
const pagesWithPropsPromises = [];
|
|
66
|
+
if (allPages) {
|
|
67
|
+
for (const page of allPages) {
|
|
68
|
+
if (page.type === 'PageFolder')
|
|
69
|
+
continue;
|
|
70
|
+
pagesWithPropsPromises.push(getPageMetadata(page));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const list = await Promise.all(pagesWithPropsPromises);
|
|
74
|
+
if (list?.length === 0)
|
|
75
|
+
return [];
|
|
76
|
+
if (pagesAndFolders)
|
|
77
|
+
return list;
|
|
78
|
+
const pagesOnly = list.filter(({ page }) => {
|
|
79
|
+
if (page.type === 'Page')
|
|
80
|
+
return true;
|
|
81
|
+
return false;
|
|
82
|
+
});
|
|
83
|
+
// return pages that match the kind
|
|
84
|
+
if (kind) {
|
|
85
|
+
return pagesOnly.filter((page) => page.kind === kind);
|
|
86
|
+
}
|
|
87
|
+
return pagesOnly;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
logger.error({}, 'getAllPages failed with an error:', error);
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a valid webflow project staging URL.
|
|
3
|
+
* @param {boolean} origin - If true, returns the origin URL (without https:// and without trailing slash).
|
|
4
|
+
* @param {boolean} stagingName - If true, returns the staging name (without .webflow.io).
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export declare const getSiteStagingUrl: (origin?: boolean, stagingName?: boolean) => Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a valid webflow project staging URL.
|
|
3
|
+
* @param {boolean} origin - If true, returns the origin URL (without https:// and without trailing slash).
|
|
4
|
+
* @param {boolean} stagingName - If true, returns the staging name (without .webflow.io).
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export const getSiteStagingUrl = async (origin, stagingName) => {
|
|
8
|
+
const { shortName } = await webflow.getSiteInfo();
|
|
9
|
+
if (stagingName)
|
|
10
|
+
return shortName;
|
|
11
|
+
if (origin)
|
|
12
|
+
return `${shortName}.webflow.io`;
|
|
13
|
+
return `https://${shortName}.webflow.io`;
|
|
14
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@finsweet/webflow-apps-utils",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Shared utilities for Webflow apps",
|
|
5
|
+
"homepage": "https://github.com/finsweet/webflow-apps-utils",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/finsweet/webflow-apps-utils.git"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"!dist/**/*.test.*",
|
|
13
|
+
"!dist/**/*.spec.*"
|
|
14
|
+
],
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"**/*.css"
|
|
17
|
+
],
|
|
18
|
+
"svelte": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"svelte": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./index.css": "./dist/ui/index.css"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"svelte": "^5.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@changesets/changelog-git": "^0.1.14",
|
|
33
|
+
"@changesets/cli": "^2.27.1",
|
|
34
|
+
"@chromatic-com/storybook": "^4",
|
|
35
|
+
"@eslint/compat": "^1.2.5",
|
|
36
|
+
"@eslint/js": "^9.18.0",
|
|
37
|
+
"@playwright/test": "^1.49.1",
|
|
38
|
+
"@storybook/addon-a11y": "^9.0.10",
|
|
39
|
+
"@storybook/addon-docs": "^9.0.10",
|
|
40
|
+
"@storybook/addon-svelte-csf": "^5.0.3",
|
|
41
|
+
"@storybook/addon-vitest": "^9.0.10",
|
|
42
|
+
"@storybook/sveltekit": "^9.0.10",
|
|
43
|
+
"@sveltejs/adapter-auto": "^6.0.0",
|
|
44
|
+
"@sveltejs/kit": "^2.16.0",
|
|
45
|
+
"@sveltejs/package": "^2.0.0",
|
|
46
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
47
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
48
|
+
"@testing-library/svelte": "^5.2.4",
|
|
49
|
+
"@testing-library/user-event": "^14.6.1",
|
|
50
|
+
"@types/js-cookie": "^3.0.6",
|
|
51
|
+
"@types/node": "^22",
|
|
52
|
+
"@vitest/browser": "3.2.3",
|
|
53
|
+
"@vitest/coverage-v8": "3.2.3",
|
|
54
|
+
"@webflow/designer-extension-typings": "^2.0.12",
|
|
55
|
+
"eslint": "^9.18.0",
|
|
56
|
+
"eslint-config-prettier": "^10.0.1",
|
|
57
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
58
|
+
"eslint-plugin-storybook": "^9.0.10",
|
|
59
|
+
"eslint-plugin-svelte": "^3.0.0",
|
|
60
|
+
"globals": "^16.0.0",
|
|
61
|
+
"jsdom": "^26.0.0",
|
|
62
|
+
"prettier": "^3.4.2",
|
|
63
|
+
"prettier-plugin-svelte": "^3.3.3",
|
|
64
|
+
"publint": "^0.3.2",
|
|
65
|
+
"storybook": "^9.0.10",
|
|
66
|
+
"svelte": "^5.0.0",
|
|
67
|
+
"svelte-check": "^4.0.0",
|
|
68
|
+
"typescript": "^5.0.0",
|
|
69
|
+
"typescript-eslint": "^8.20.0",
|
|
70
|
+
"vite": "^6.2.6",
|
|
71
|
+
"vitest": "^3.2.3"
|
|
72
|
+
},
|
|
73
|
+
"keywords": [
|
|
74
|
+
"svelte"
|
|
75
|
+
],
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@floating-ui/dom": "^1.7.1",
|
|
78
|
+
"clipboard": "^2.0.11",
|
|
79
|
+
"js-cookie": "^3.0.5",
|
|
80
|
+
"just-debounce": "^1.1.0",
|
|
81
|
+
"logrocket": "^10.1.0",
|
|
82
|
+
"simplebar": "^6.3.1",
|
|
83
|
+
"svelte-routing": "^2.13.0",
|
|
84
|
+
"swiper": "^11.2.8",
|
|
85
|
+
"uuid": "^11.1.0",
|
|
86
|
+
"zod": "^3.25.64"
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"dev": "vite dev",
|
|
90
|
+
"build": "vite build && npm run prepack",
|
|
91
|
+
"preview": "vite preview",
|
|
92
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
93
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
94
|
+
"format": "prettier --write .",
|
|
95
|
+
"lint": "prettier --check ./src && eslint ./src",
|
|
96
|
+
"lint:fix": "eslint ./src --fix && prettier --write ./src",
|
|
97
|
+
"release": "changeset publish",
|
|
98
|
+
"test:unit": "vitest --run",
|
|
99
|
+
"test:unit:watch": "vitest",
|
|
100
|
+
"test:storybook": "vitest --run --project=storybook",
|
|
101
|
+
"test:storybook:watch": "vitest --project=storybook",
|
|
102
|
+
"test": "pnpm test:unit",
|
|
103
|
+
"test:e2e": "playwright test",
|
|
104
|
+
"storybook": "storybook dev -p 6006",
|
|
105
|
+
"build-storybook": "storybook build"
|
|
106
|
+
}
|
|
107
|
+
}
|