@finsweet/webflow-apps-utils 1.0.1 → 1.0.3
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 +162 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/providers/GlobalProvider.mdx +322 -0
- package/dist/providers/GlobalProvider.svelte +58 -0
- package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
- package/dist/providers/configuratorUtils.d.ts +37 -0
- package/dist/providers/configuratorUtils.js +219 -0
- package/dist/providers/globalContext.svelte.d.ts +18 -0
- package/dist/providers/globalContext.svelte.js +439 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/types.d.ts +103 -0
- package/dist/providers/types.js +6 -0
- package/dist/router/README.md +2 -2
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/types/webflow.d.ts +31 -47
- package/dist/ui/components/LoadingScreen.svelte +2 -1
- package/dist/ui/components/button/Button.svelte +4 -1
- package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
- package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
- package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
- package/dist/ui/components/button-group/index.d.ts +2 -0
- package/dist/ui/components/button-group/index.js +1 -0
- package/dist/ui/components/button-group/types.d.ts +32 -0
- package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
- package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
- package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
- package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
- package/dist/ui/components/checkbox/index.d.ts +2 -0
- package/dist/ui/components/checkbox/index.js +1 -0
- package/dist/ui/components/checkbox/types.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
- package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
- package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
- package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
- package/dist/ui/components/controlled-buttons/index.js +1 -0
- package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
- package/dist/ui/components/divider/Divider.stories.svelte +134 -0
- package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
- package/dist/ui/components/divider/Divider.svelte +30 -0
- package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
- package/dist/ui/components/divider/index.d.ts +2 -0
- package/dist/ui/components/divider/index.js +1 -0
- package/dist/ui/components/divider/types.d.ts +23 -0
- package/dist/ui/components/divider/types.js +1 -0
- package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
- package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
- package/dist/ui/components/iframe/Iframe.svelte +75 -0
- package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
- package/dist/ui/components/iframe/index.d.ts +2 -0
- package/dist/ui/components/iframe/index.js +1 -0
- package/dist/ui/components/iframe/types.d.ts +38 -0
- package/dist/ui/components/iframe/types.js +1 -0
- package/dist/ui/components/index.d.ts +12 -39
- package/dist/ui/components/index.js +12 -39
- package/dist/ui/components/input/Input.stories.d.ts +24 -0
- package/dist/ui/components/input/Input.stories.js +98 -0
- package/dist/ui/components/input/Input.svelte +321 -80
- package/dist/ui/components/input/types.d.ts +27 -1
- package/dist/ui/components/layout/Layout.stories.svelte +3 -3
- package/dist/ui/components/layout/Layout.svelte +3 -5
- package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
- package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +34 -22
- package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
- package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +3 -3
- package/dist/ui/components/layout/examples/index.d.ts +2 -0
- package/dist/ui/components/layout/examples/index.js +2 -0
- package/dist/ui/components/layout/index.d.ts +2 -1
- package/dist/ui/components/layout/index.js +2 -1
- package/dist/ui/components/modal/Example.svelte +320 -0
- package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
- package/dist/ui/components/modal/Modal.stories.svelte +18 -0
- package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
- package/dist/ui/components/modal/Modal.svelte +490 -0
- package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
- package/dist/ui/components/modal/index.d.ts +2 -0
- package/dist/ui/components/modal/index.js +1 -0
- package/dist/ui/components/modal/types.d.ts +75 -0
- package/dist/ui/components/modal/types.js +1 -0
- package/dist/ui/components/notification/Notification.stories.svelte +228 -0
- package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
- package/dist/ui/components/notification/Notification.svelte +289 -0
- package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
- package/dist/ui/components/notification/index.d.ts +2 -0
- package/dist/ui/components/notification/index.js +1 -0
- package/dist/ui/components/notification/types.d.ts +68 -0
- package/dist/ui/components/notification/types.js +1 -0
- package/dist/ui/components/section/Section.stories.svelte +263 -0
- package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
- package/dist/ui/components/section/Section.svelte +324 -0
- package/dist/ui/components/section/Section.svelte.d.ts +5 -0
- package/dist/ui/components/section/index.d.ts +2 -0
- package/dist/ui/components/section/index.js +1 -0
- package/dist/ui/components/section/types.d.ts +106 -0
- package/dist/ui/components/section/types.js +1 -0
- package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
- package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
- package/dist/ui/components/shared/index.d.ts +2 -0
- package/dist/ui/components/shared/index.js +2 -0
- package/dist/ui/icons/LineChartIcon.svelte +8 -0
- package/dist/ui/icons/LineChartIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/index.d.ts +2 -1
- package/dist/ui/icons/index.js +2 -1
- package/dist/ui/index.css +33 -5
- package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
- package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
- package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
- package/dist/utils/api/clipboard/handlePaste.js +2 -6
- package/dist/utils/api/getAllAssets.d.ts +1 -2
- package/dist/utils/api/getAllAssets.js +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
- package/dist/utils/api/index.d.ts +0 -1
- package/dist/utils/api/index.js +0 -1
- package/dist/utils/api/insertWithXSCP.d.ts +1 -2
- package/dist/utils/api/insertWithXSCP.js +1 -2
- package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
- package/dist/utils/auth/crossWindowLogin.js +3 -0
- package/dist/utils/auth/index.d.ts +9 -25
- package/dist/utils/auth/index.js +9 -25
- package/dist/utils/browser-storage/localStorage.d.ts +4 -12
- package/dist/utils/browser-storage/localStorage.js +4 -12
- package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
- package/dist/utils/browser-storage/sessionStorage.js +4 -12
- package/dist/utils/custom-code/api.d.ts +3 -7
- package/dist/utils/custom-code/api.js +3 -7
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
- package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
- package/dist/utils/helpers/goto.d.ts +1 -4
- package/dist/utils/helpers/goto.js +2 -7
- package/dist/utils/helpers/index.d.ts +1 -0
- package/dist/utils/helpers/index.js +1 -0
- package/dist/utils/helpers/noop.d.ts +1 -1
- package/dist/utils/helpers/noop.js +1 -1
- package/dist/utils/helpers/numbers.d.ts +4 -14
- package/dist/utils/helpers/numbers.js +4 -14
- package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
- package/dist/utils/helpers/objectsToModuleExports.js +1 -3
- package/dist/utils/helpers/trimText.d.ts +1 -8
- package/dist/utils/helpers/trimText.js +1 -8
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger/index.d.ts +0 -2
- package/dist/utils/logger/index.js +0 -2
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
- package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
- package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
- package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
- package/dist/utils/webflow-canvas/getAllPages.js +3 -10
- package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
- package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
- package/dist/utils/webflow-canvas/index.d.ts +1 -0
- package/dist/utils/webflow-canvas/index.js +1 -0
- package/package.json +9 -2
- package/dist/stores/globalStore.d.ts +0 -10
- package/dist/stores/globalStore.js +0 -10
- package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
- package/dist/ui/components/Checkbox.svelte +0 -94
- package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
- package/dist/ui/components/Copy.svelte +0 -329
- package/dist/ui/components/Copy.svelte.d.ts +0 -35
- package/dist/ui/components/CustomModal.svelte +0 -192
- package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
- package/dist/ui/components/DisableInEditMode.svelte +0 -66
- package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
- package/dist/ui/components/Divider.svelte +0 -31
- package/dist/ui/components/Divider.svelte.d.ts +0 -31
- package/dist/ui/components/Header.svelte +0 -30
- package/dist/ui/components/Header.svelte.d.ts +0 -20
- package/dist/ui/components/Iframe.svelte +0 -89
- package/dist/ui/components/Iframe.svelte.d.ts +0 -40
- package/dist/ui/components/InjectComponent.svelte +0 -297
- package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
- package/dist/ui/components/Modal.svelte +0 -139
- package/dist/ui/components/Modal.svelte.d.ts +0 -42
- package/dist/ui/components/Navbar.svelte +0 -132
- package/dist/ui/components/Navbar.svelte.d.ts +0 -29
- package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
- package/dist/ui/components/Notification.svelte +0 -193
- package/dist/ui/components/Notification.svelte.d.ts +0 -64
- package/dist/ui/components/PlusMinusButton.svelte +0 -91
- package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
- package/dist/ui/components/PreviewBar.svelte +0 -40
- package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
- package/dist/ui/components/ScrollableContent.svelte +0 -18
- package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
- package/dist/ui/components/Section.svelte +0 -97
- package/dist/ui/components/Section.svelte.d.ts +0 -50
- package/dist/ui/components/Spacer.svelte +0 -9
- package/dist/ui/components/Spacer.svelte.d.ts +0 -22
- package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
- package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
- package/dist/ui/components/SpinnerUpDown.svelte +0 -194
- package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
- package/dist/ui/components/Tabs.svelte +0 -71
- package/dist/ui/components/Tabs.svelte.d.ts +0 -26
- package/dist/ui/components/ToggleItem.svelte +0 -29
- package/dist/ui/components/ToggleList.svelte +0 -57
- package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
- package/dist/ui/components/buttons/index.d.ts +0 -5
- package/dist/ui/components/buttons/index.js +0 -5
- package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
- package/dist/ui/components/clickable/Clickable.svelte +0 -93
- package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
- package/dist/ui/components/clickable/index.d.ts +0 -2
- package/dist/ui/components/clickable/index.js +0 -1
- package/dist/ui/components/clickable/types.d.ts +0 -17
- package/dist/utils/api/copyPaste/index.d.ts +0 -18
- /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
- /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
- /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
- /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
- /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
- /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
|
@@ -9,21 +9,14 @@ export type PageWithProps = {
|
|
|
9
9
|
isPasswordProtected: boolean;
|
|
10
10
|
};
|
|
11
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
|
|
12
|
+
* Generates a slug for a page or folder.
|
|
15
13
|
*/
|
|
16
14
|
export declare const getPathname: (page: Page | Folder) => Promise<string>;
|
|
17
15
|
/**
|
|
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
|
|
16
|
+
* Returns a single page with all its properties.
|
|
22
17
|
*/
|
|
23
18
|
export declare const getPageMetadata: (page: Page) => Promise<PageWithProps>;
|
|
24
19
|
/**
|
|
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
|
|
20
|
+
* Returns all pages and folders from the Webflow project.
|
|
28
21
|
*/
|
|
29
22
|
export declare const getAllPages: (pagesAndFolders?: boolean, kind?: PageWithProps["kind"]) => Promise<PageWithProps[]>;
|
|
@@ -2,9 +2,7 @@ import { getLogger } from '../logger';
|
|
|
2
2
|
const logger = getLogger('webflow-apps-ui-utils');
|
|
3
3
|
let pageStagingUrl;
|
|
4
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
|
|
5
|
+
* Generates a slug for a page or folder.
|
|
8
6
|
*/
|
|
9
7
|
export const getPathname = async (page) => {
|
|
10
8
|
const parent = await page.getParent();
|
|
@@ -20,10 +18,7 @@ export const getPathname = async (page) => {
|
|
|
20
18
|
return fullSlug.startsWith('/') ? fullSlug : `/${fullSlug}`;
|
|
21
19
|
};
|
|
22
20
|
/**
|
|
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
|
|
21
|
+
* Returns a single page with all its properties.
|
|
27
22
|
*/
|
|
28
23
|
export const getPageMetadata = async (page) => {
|
|
29
24
|
if (!pageStagingUrl) {
|
|
@@ -55,9 +50,7 @@ export const getPageMetadata = async (page) => {
|
|
|
55
50
|
};
|
|
56
51
|
};
|
|
57
52
|
/**
|
|
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
|
|
53
|
+
* Returns all pages and folders from the Webflow project.
|
|
61
54
|
*/
|
|
62
55
|
export const getAllPages = async (pagesAndFolders, kind) => {
|
|
63
56
|
try {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns a valid
|
|
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}
|
|
2
|
+
* Returns a valid Webflow project staging URL.
|
|
6
3
|
*/
|
|
7
4
|
export declare const getSiteStagingUrl: (origin?: boolean, stagingName?: boolean) => Promise<string>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns a valid
|
|
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}
|
|
2
|
+
* Returns a valid Webflow project staging URL.
|
|
6
3
|
*/
|
|
7
4
|
export const getSiteStagingUrl = async (origin, stagingName) => {
|
|
8
5
|
const { shortName } = await webflow.getSiteInfo();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finsweet/webflow-apps-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Shared utilities for Webflow apps",
|
|
5
5
|
"homepage": "https://github.com/finsweet/webflow-apps-utils",
|
|
6
6
|
"repository": {
|
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
"@testing-library/svelte": "^5.2.4",
|
|
49
49
|
"@testing-library/user-event": "^14.6.1",
|
|
50
50
|
"@types/js-cookie": "^3.0.6",
|
|
51
|
+
"@types/lodash": "^4.17.18",
|
|
52
|
+
"@types/lodash-es": "^4.17.12",
|
|
53
|
+
"@types/lodash.isequal": "^4.5.8",
|
|
51
54
|
"@types/node": "^22",
|
|
52
55
|
"@vitest/browser": "3.2.3",
|
|
53
56
|
"@vitest/coverage-v8": "3.2.3",
|
|
@@ -78,8 +81,12 @@
|
|
|
78
81
|
"clipboard": "^2.0.11",
|
|
79
82
|
"js-cookie": "^3.0.5",
|
|
80
83
|
"just-debounce": "^1.1.0",
|
|
84
|
+
"lodash": "^4.17.21",
|
|
85
|
+
"lodash-es": "^4.17.21",
|
|
86
|
+
"lodash.isequal": "^4.5.0",
|
|
81
87
|
"logrocket": "^10.1.0",
|
|
82
|
-
"
|
|
88
|
+
"overlayscrollbars": "^2.11.4",
|
|
89
|
+
"overlayscrollbars-svelte": "^0.5.5",
|
|
83
90
|
"svelte-routing": "^2.13.0",
|
|
84
91
|
"swiper": "^11.2.8",
|
|
85
92
|
"uuid": "^11.1.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type GlobalStoreState = {
|
|
2
|
-
componentKey: string | null;
|
|
3
|
-
editMode: boolean;
|
|
4
|
-
state: Record<string, any> | null;
|
|
5
|
-
repairMode: boolean;
|
|
6
|
-
formKey: string | null;
|
|
7
|
-
formUpdateKey: string | null;
|
|
8
|
-
title: string | null;
|
|
9
|
-
};
|
|
10
|
-
export declare const globalStore: import("svelte/store").Writable<GlobalStoreState>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const ButtonGroup: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
id: string;
|
|
16
|
-
buttons?: {
|
|
17
|
-
name: string;
|
|
18
|
-
value: string;
|
|
19
|
-
}[];
|
|
20
|
-
selected: string;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
}, {
|
|
23
|
-
select: CustomEvent<string>;
|
|
24
|
-
} & {
|
|
25
|
-
[evt: string]: CustomEvent<any>;
|
|
26
|
-
}, {}, {}, string>;
|
|
27
|
-
type ButtonGroup = InstanceType<typeof ButtonGroup>;
|
|
28
|
-
export default ButtonGroup;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher } from 'svelte';
|
|
3
|
-
|
|
4
|
-
import { SquareCheckIcon } from '../icons';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is the value of the checkbox.
|
|
8
|
-
*/
|
|
9
|
-
export let value: boolean = false;
|
|
10
|
-
/**
|
|
11
|
-
* This means the checkbox is disabled.
|
|
12
|
-
*/
|
|
13
|
-
export let disabled: boolean = false;
|
|
14
|
-
/**
|
|
15
|
-
* This means you are using an external state to control the checkbox.
|
|
16
|
-
*/
|
|
17
|
-
export let preventChange: boolean = false;
|
|
18
|
-
/**
|
|
19
|
-
* This is the id of the checkbox.
|
|
20
|
-
*/
|
|
21
|
-
export let id: string = '';
|
|
22
|
-
/**
|
|
23
|
-
* This is the type of the checkbox. Defaults to `checkbox`.
|
|
24
|
-
*/
|
|
25
|
-
export let type: 'checkbox' | 'radio' = 'checkbox';
|
|
26
|
-
|
|
27
|
-
let checked: boolean = false;
|
|
28
|
-
const dispatch = createEventDispatcher<{
|
|
29
|
-
change: boolean;
|
|
30
|
-
}>();
|
|
31
|
-
|
|
32
|
-
// Ensure checked is always in sync with value
|
|
33
|
-
$: checked = value;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Handles click events on the toggle, dispatching the change.
|
|
37
|
-
*/
|
|
38
|
-
const handleClick = (): void => {
|
|
39
|
-
if (disabled || preventChange) return;
|
|
40
|
-
checked = !checked;
|
|
41
|
-
|
|
42
|
-
dispatch('change', checked);
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<div
|
|
47
|
-
class="custom-checkbox {type} {checked ? 'checked' : ''} {disabled ? 'disabled' : ''}"
|
|
48
|
-
on:click={handleClick}
|
|
49
|
-
on:keydown={() => {}}
|
|
50
|
-
role="checkbox"
|
|
51
|
-
tabindex="0"
|
|
52
|
-
aria-checked={`${checked}`}
|
|
53
|
-
{id}
|
|
54
|
-
>
|
|
55
|
-
{#if checked}
|
|
56
|
-
<SquareCheckIcon />
|
|
57
|
-
{/if}
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<style>
|
|
61
|
-
.custom-checkbox {
|
|
62
|
-
width: 16px;
|
|
63
|
-
height: 16px;
|
|
64
|
-
border-radius: 4px;
|
|
65
|
-
border: 2px solid #ffffff1a;
|
|
66
|
-
display: flex;
|
|
67
|
-
justify-content: center;
|
|
68
|
-
align-items: center;
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
}
|
|
71
|
-
.custom-checkbox.radio {
|
|
72
|
-
border-radius: 50%;
|
|
73
|
-
}
|
|
74
|
-
.custom-checkbox :global(svg) {
|
|
75
|
-
width: 16px;
|
|
76
|
-
height: 16px;
|
|
77
|
-
}
|
|
78
|
-
.custom-checkbox.checked {
|
|
79
|
-
color: white;
|
|
80
|
-
border: none;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.custom-checkbox.checked :global(svg) {
|
|
84
|
-
color: white;
|
|
85
|
-
background: #006acc;
|
|
86
|
-
border-radius: 4px;
|
|
87
|
-
}
|
|
88
|
-
.custom-checkbox.checked.radio :global(svg) {
|
|
89
|
-
border-radius: 50%;
|
|
90
|
-
}
|
|
91
|
-
.custom-checkbox.disabled {
|
|
92
|
-
cursor: not-allowed;
|
|
93
|
-
}
|
|
94
|
-
</style>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Checkbox: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
/**
|
|
16
|
-
* This is the value of the checkbox.
|
|
17
|
-
*/ value?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* This means the checkbox is disabled.
|
|
20
|
-
*/ disabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* This means you are using an external state to control the checkbox.
|
|
23
|
-
*/ preventChange?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* This is the id of the checkbox.
|
|
26
|
-
*/ id?: string;
|
|
27
|
-
/**
|
|
28
|
-
* This is the type of the checkbox. Defaults to `checkbox`.
|
|
29
|
-
*/ type?: "checkbox" | "radio";
|
|
30
|
-
}, {
|
|
31
|
-
change: CustomEvent<boolean>;
|
|
32
|
-
} & {
|
|
33
|
-
[evt: string]: CustomEvent<any>;
|
|
34
|
-
}, {}, {}, string>;
|
|
35
|
-
type Checkbox = InstanceType<typeof Checkbox>;
|
|
36
|
-
export default Checkbox;
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ClipboardJS from 'clipboard';
|
|
3
|
-
import { onDestroy } from 'svelte';
|
|
4
|
-
import { writable } from 'svelte/store';
|
|
5
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
-
|
|
7
|
-
import { trimExtraSpaces } from '../../utils/helpers';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
ArrowIcon,
|
|
11
|
-
CheckCircleOutlinedIcon,
|
|
12
|
-
CodeIcon,
|
|
13
|
-
CopyIcon,
|
|
14
|
-
EyeIcon,
|
|
15
|
-
WarningCircleOutlineIcon
|
|
16
|
-
} from '../icons';
|
|
17
|
-
|
|
18
|
-
export let heading;
|
|
19
|
-
export let upToDate = false;
|
|
20
|
-
export let hidden = false;
|
|
21
|
-
export let disabled = false;
|
|
22
|
-
export let raw = false;
|
|
23
|
-
export let scriptUpdated = false;
|
|
24
|
-
export let showHeader = true;
|
|
25
|
-
export let comment = '';
|
|
26
|
-
export let shortName = '';
|
|
27
|
-
export let leftSpacing = '0px';
|
|
28
|
-
export let title = 'Click to copy snippet';
|
|
29
|
-
export let showLink = false;
|
|
30
|
-
let snippetElement: HTMLElement;
|
|
31
|
-
let copied = writable<boolean>();
|
|
32
|
-
let notified = writable<boolean>(false);
|
|
33
|
-
|
|
34
|
-
export let content: string;
|
|
35
|
-
const id: string = uuidv4();
|
|
36
|
-
let isCooldown: boolean = false;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Notify the user with a cooldown
|
|
40
|
-
* @param type
|
|
41
|
-
* @param message
|
|
42
|
-
*/
|
|
43
|
-
const notifyWithCooldown = (type: 'Success' | 'Error', message: string) => {
|
|
44
|
-
if (!isCooldown) {
|
|
45
|
-
webflow.notify({ type, message });
|
|
46
|
-
notified.set(true);
|
|
47
|
-
isCooldown = true;
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
isCooldown = false;
|
|
50
|
-
}, 1000);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
let clipboard: ClipboardJS | null = null;
|
|
55
|
-
|
|
56
|
-
$: {
|
|
57
|
-
clipboard?.destroy();
|
|
58
|
-
if (snippetElement && !disabled) {
|
|
59
|
-
clipboard = new ClipboardJS(snippetElement, {
|
|
60
|
-
text: () => {
|
|
61
|
-
if (disabled) {
|
|
62
|
-
webflow?.notify({
|
|
63
|
-
type: 'Error',
|
|
64
|
-
message: 'Select a category before updating the script.'
|
|
65
|
-
});
|
|
66
|
-
return '';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (raw) {
|
|
70
|
-
if (comment) return `<!-- ${comment} -->\n${content}`;
|
|
71
|
-
|
|
72
|
-
return content;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const target = snippetElement?.querySelector<HTMLElement>('#text-content');
|
|
76
|
-
|
|
77
|
-
if (target) {
|
|
78
|
-
return target.innerText;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
webflow?.notify({
|
|
82
|
-
type: 'Error',
|
|
83
|
-
message: 'Failed to copy. Try again or contact Finsweet support.'
|
|
84
|
-
});
|
|
85
|
-
return '';
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
clipboard.on('success', (e: ClipboardJS.Event) => {
|
|
90
|
-
copied.set(true);
|
|
91
|
-
notifyWithCooldown('Success', 'Copied to clipboard!');
|
|
92
|
-
e.clearSelection();
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
$: if ($notified) {
|
|
98
|
-
setTimeout(() => notified.set(false), 2000);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
onDestroy(() => {
|
|
102
|
-
clipboard?.destroy();
|
|
103
|
-
});
|
|
104
|
-
</script>
|
|
105
|
-
|
|
106
|
-
{#if !hidden}
|
|
107
|
-
<div class="scripts scan-result" style={hidden ? 'display:none;' : ''}>
|
|
108
|
-
{#if showHeader}
|
|
109
|
-
<div class="info">
|
|
110
|
-
<div class="header {upToDate ? 'completed' : 'pending'}">
|
|
111
|
-
{#if upToDate}
|
|
112
|
-
<CheckCircleOutlinedIcon />
|
|
113
|
-
{:else}
|
|
114
|
-
<WarningCircleOutlineIcon />
|
|
115
|
-
{/if}
|
|
116
|
-
<div class="text-wrapper">
|
|
117
|
-
{#if raw}
|
|
118
|
-
<div class="instruction text">{heading}</div>
|
|
119
|
-
{:else}
|
|
120
|
-
<div class="instruction script">{@html heading}</div>
|
|
121
|
-
{/if}
|
|
122
|
-
<slot name="content" />
|
|
123
|
-
</div>
|
|
124
|
-
<!-- <div class="state">
|
|
125
|
-
<span class="status {upToDate || $copied ? 'success' : 'pending'}"
|
|
126
|
-
>{$copied ? 'Copied' : upToDate ? '' : 'Pending'}</span
|
|
127
|
-
>
|
|
128
|
-
</div> -->
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
{/if}
|
|
132
|
-
<div
|
|
133
|
-
class="copy {disabled ? 'disabled' : ''} {scriptUpdated ? 'script-snippet' : ''}"
|
|
134
|
-
bind:this={snippetElement}
|
|
135
|
-
on:keydown={() => {}}
|
|
136
|
-
tabindex="0"
|
|
137
|
-
role="button"
|
|
138
|
-
aria-label="Copy snippet"
|
|
139
|
-
{title}
|
|
140
|
-
style="{upToDate ? 'display:none' : ''} margin-left:{leftSpacing};"
|
|
141
|
-
>
|
|
142
|
-
<div class="content {disabled ? 'disabled' : ''} {id}" data-target="snippet">
|
|
143
|
-
<span id="text-content">
|
|
144
|
-
{raw ? content : (trimExtraSpaces(content) ?? '')}
|
|
145
|
-
</span>
|
|
146
|
-
</div>
|
|
147
|
-
<span class="icon">
|
|
148
|
-
{#if disabled}
|
|
149
|
-
<EyeIcon />
|
|
150
|
-
{:else}
|
|
151
|
-
<CopyIcon size={16} />
|
|
152
|
-
{/if}
|
|
153
|
-
</span>
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
<slot name="customCodeLinks" />
|
|
157
|
-
|
|
158
|
-
{#if (showLink || !upToDate) && !$$slots?.customCodeLinks}
|
|
159
|
-
<div class="settings-link" style="margin-left:{leftSpacing};">
|
|
160
|
-
<a
|
|
161
|
-
href={`https://webflow.com/dashboard/sites/${shortName}/code`}
|
|
162
|
-
target="_blank"
|
|
163
|
-
class="new-tab-link"><CodeIcon />Open Custom code in a new tab <ArrowIcon /></a
|
|
164
|
-
>
|
|
165
|
-
</div>
|
|
166
|
-
{/if}
|
|
167
|
-
</div>
|
|
168
|
-
{/if}
|
|
169
|
-
|
|
170
|
-
<style>
|
|
171
|
-
.settings-link {
|
|
172
|
-
display: flex;
|
|
173
|
-
align-self: stretch;
|
|
174
|
-
justify-content: start;
|
|
175
|
-
width: 100%;
|
|
176
|
-
}
|
|
177
|
-
.text-wrapper {
|
|
178
|
-
display: flex;
|
|
179
|
-
flex-direction: column;
|
|
180
|
-
gap: 4px;
|
|
181
|
-
}
|
|
182
|
-
.new-tab-link {
|
|
183
|
-
display: flex;
|
|
184
|
-
padding: 4px;
|
|
185
|
-
justify-content: center;
|
|
186
|
-
align-items: center;
|
|
187
|
-
gap: 2px;
|
|
188
|
-
text-decoration: none;
|
|
189
|
-
color: var(--blueText);
|
|
190
|
-
text-align: center;
|
|
191
|
-
font-family: Inter;
|
|
192
|
-
font-size: 11.5px;
|
|
193
|
-
font-style: normal;
|
|
194
|
-
font-weight: 400;
|
|
195
|
-
line-height: 16px;
|
|
196
|
-
letter-spacing: -0.115px;
|
|
197
|
-
}
|
|
198
|
-
.header {
|
|
199
|
-
display: flex;
|
|
200
|
-
gap: 10px;
|
|
201
|
-
align-items: start;
|
|
202
|
-
height: max-content;
|
|
203
|
-
}
|
|
204
|
-
.header.completed :global(svg) {
|
|
205
|
-
color: var(--green-green-text, #63d489);
|
|
206
|
-
}
|
|
207
|
-
.header.pending :global(svg) {
|
|
208
|
-
color: var(--yellow-yellow-text, #ffc700);
|
|
209
|
-
}
|
|
210
|
-
.status.pending {
|
|
211
|
-
color: var(--yellow-yellow-text, #ffc700);
|
|
212
|
-
}
|
|
213
|
-
.status.success {
|
|
214
|
-
color: var(--green-green-text, #63d489);
|
|
215
|
-
}
|
|
216
|
-
.status {
|
|
217
|
-
text-align: right;
|
|
218
|
-
}
|
|
219
|
-
.status,
|
|
220
|
-
.info {
|
|
221
|
-
font-family: Inter;
|
|
222
|
-
font-size: 11px;
|
|
223
|
-
font-style: normal;
|
|
224
|
-
font-weight: 400;
|
|
225
|
-
line-height: 16px;
|
|
226
|
-
}
|
|
227
|
-
.info {
|
|
228
|
-
display: flex;
|
|
229
|
-
justify-content: space-between;
|
|
230
|
-
width: 100%;
|
|
231
|
-
min-width: 290px;
|
|
232
|
-
align-items: center;
|
|
233
|
-
gap: 4px;
|
|
234
|
-
}
|
|
235
|
-
.info .instruction {
|
|
236
|
-
flex-grow: 1;
|
|
237
|
-
align-items: center;
|
|
238
|
-
display: flex;
|
|
239
|
-
height: 100%;
|
|
240
|
-
color: #fff;
|
|
241
|
-
font-family: Inter;
|
|
242
|
-
font-size: 12px;
|
|
243
|
-
font-style: normal;
|
|
244
|
-
font-weight: 500;
|
|
245
|
-
line-height: 16px;
|
|
246
|
-
}
|
|
247
|
-
/* .info .state {
|
|
248
|
-
flex-grow: 0;
|
|
249
|
-
flex-shrink: 0;
|
|
250
|
-
width: 45px;
|
|
251
|
-
} */
|
|
252
|
-
|
|
253
|
-
.copy.script-snippet {
|
|
254
|
-
margin-left: 25px;
|
|
255
|
-
}
|
|
256
|
-
.copy .content span {
|
|
257
|
-
display: flex;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.copy .content {
|
|
261
|
-
color: var(--text-text-1, #d9d9d9);
|
|
262
|
-
font-family: Inter;
|
|
263
|
-
font-size: 11px;
|
|
264
|
-
font-style: normal;
|
|
265
|
-
font-weight: 500;
|
|
266
|
-
line-height: 16px;
|
|
267
|
-
display: flex;
|
|
268
|
-
align-items: start;
|
|
269
|
-
align-self: stretch;
|
|
270
|
-
overflow: auto;
|
|
271
|
-
width: 100%;
|
|
272
|
-
white-space: pre-wrap;
|
|
273
|
-
word-wrap: break-word;
|
|
274
|
-
max-width: 600px;
|
|
275
|
-
min-height: max-content;
|
|
276
|
-
}
|
|
277
|
-
.copy .content.disabled {
|
|
278
|
-
cursor: not-allowed;
|
|
279
|
-
color: var(--text2);
|
|
280
|
-
flex: 1 0 0;
|
|
281
|
-
}
|
|
282
|
-
.scripts {
|
|
283
|
-
display: flex;
|
|
284
|
-
padding: var(--spacing-16, 16px);
|
|
285
|
-
flex-direction: column;
|
|
286
|
-
align-items: flex-start;
|
|
287
|
-
gap: 12px;
|
|
288
|
-
align-self: stretch;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.copy {
|
|
292
|
-
border-radius: 4px;
|
|
293
|
-
background: var(
|
|
294
|
-
--actionSecondaryBackground,
|
|
295
|
-
linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.1) 100%),
|
|
296
|
-
rgba(255, 255, 255, 0.08)
|
|
297
|
-
);
|
|
298
|
-
box-shadow:
|
|
299
|
-
0px 0.5px 0.5px 0px rgba(255, 255, 255, 0.12) inset,
|
|
300
|
-
0px 0.5px 1px 0px #000;
|
|
301
|
-
display: flex;
|
|
302
|
-
padding: 6px var(--Spacing-8, 8px);
|
|
303
|
-
align-items: flex-start;
|
|
304
|
-
gap: var(--Spacing-8, 8px);
|
|
305
|
-
align-self: stretch;
|
|
306
|
-
flex: 1 0 0;
|
|
307
|
-
color: var(--text2);
|
|
308
|
-
font-family: Inter;
|
|
309
|
-
font-size: 12px;
|
|
310
|
-
font-style: normal;
|
|
311
|
-
font-weight: 500;
|
|
312
|
-
line-height: 16px;
|
|
313
|
-
cursor: pointer;
|
|
314
|
-
justify-content: space-between;
|
|
315
|
-
flex-direction: row;
|
|
316
|
-
}
|
|
317
|
-
.copy span.icon {
|
|
318
|
-
height: 16px;
|
|
319
|
-
}
|
|
320
|
-
.copy.disabled {
|
|
321
|
-
background: none;
|
|
322
|
-
cursor: not-allowed;
|
|
323
|
-
color: var(--text2);
|
|
324
|
-
border-radius: var(--border-radius, 4px);
|
|
325
|
-
border: 1px solid var(--actionSecondaryBorder);
|
|
326
|
-
opacity: 0.75;
|
|
327
|
-
box-shadow: none;
|
|
328
|
-
}
|
|
329
|
-
</style>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Copy: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
heading: any;
|
|
16
|
-
upToDate?: boolean;
|
|
17
|
-
hidden?: boolean;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
raw?: boolean;
|
|
20
|
-
scriptUpdated?: boolean;
|
|
21
|
-
showHeader?: boolean;
|
|
22
|
-
comment?: string;
|
|
23
|
-
shortName?: string;
|
|
24
|
-
leftSpacing?: string;
|
|
25
|
-
title?: string;
|
|
26
|
-
showLink?: boolean;
|
|
27
|
-
content: string;
|
|
28
|
-
}, {
|
|
29
|
-
[evt: string]: CustomEvent<any>;
|
|
30
|
-
}, {
|
|
31
|
-
content: {};
|
|
32
|
-
customCodeLinks: {};
|
|
33
|
-
}, {}, string>;
|
|
34
|
-
type Copy = InstanceType<typeof Copy>;
|
|
35
|
-
export default Copy;
|