@finsweet/webflow-apps-utils 1.0.2 → 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.
Files changed (226) hide show
  1. package/README.md +162 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/providers/GlobalProvider.mdx +322 -0
  5. package/dist/providers/GlobalProvider.svelte +58 -0
  6. package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
  7. package/dist/providers/configuratorUtils.d.ts +37 -0
  8. package/dist/providers/configuratorUtils.js +219 -0
  9. package/dist/providers/globalContext.svelte.d.ts +18 -0
  10. package/dist/providers/globalContext.svelte.js +439 -0
  11. package/dist/providers/index.d.ts +5 -0
  12. package/dist/providers/index.js +7 -0
  13. package/dist/providers/types.d.ts +103 -0
  14. package/dist/providers/types.js +6 -0
  15. package/dist/router/README.md +2 -2
  16. package/dist/stores/index.d.ts +0 -1
  17. package/dist/stores/index.js +0 -1
  18. package/dist/types/webflow.d.ts +31 -47
  19. package/dist/ui/components/LoadingScreen.svelte +2 -1
  20. package/dist/ui/components/button/Button.svelte +1 -1
  21. package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
  22. package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
  23. package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
  24. package/dist/ui/components/button-group/index.d.ts +2 -0
  25. package/dist/ui/components/button-group/index.js +1 -0
  26. package/dist/ui/components/button-group/types.d.ts +32 -0
  27. package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
  28. package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
  29. package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
  30. package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
  31. package/dist/ui/components/checkbox/index.d.ts +2 -0
  32. package/dist/ui/components/checkbox/index.js +1 -0
  33. package/dist/ui/components/checkbox/types.d.ts +32 -0
  34. package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
  35. package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
  36. package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
  37. package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
  38. package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
  39. package/dist/ui/components/controlled-buttons/index.js +1 -0
  40. package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
  41. package/dist/ui/components/divider/Divider.stories.svelte +134 -0
  42. package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
  43. package/dist/ui/components/divider/Divider.svelte +30 -0
  44. package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
  45. package/dist/ui/components/divider/index.d.ts +2 -0
  46. package/dist/ui/components/divider/index.js +1 -0
  47. package/dist/ui/components/divider/types.d.ts +23 -0
  48. package/dist/ui/components/divider/types.js +1 -0
  49. package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
  50. package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
  51. package/dist/ui/components/iframe/Iframe.svelte +75 -0
  52. package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
  53. package/dist/ui/components/iframe/index.d.ts +2 -0
  54. package/dist/ui/components/iframe/index.js +1 -0
  55. package/dist/ui/components/iframe/types.d.ts +38 -0
  56. package/dist/ui/components/iframe/types.js +1 -0
  57. package/dist/ui/components/index.d.ts +12 -39
  58. package/dist/ui/components/index.js +12 -39
  59. package/dist/ui/components/input/Input.stories.d.ts +24 -0
  60. package/dist/ui/components/input/Input.stories.js +98 -0
  61. package/dist/ui/components/input/Input.svelte +321 -80
  62. package/dist/ui/components/input/types.d.ts +27 -1
  63. package/dist/ui/components/layout/Layout.stories.svelte +3 -3
  64. package/dist/ui/components/layout/Layout.svelte +3 -5
  65. package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
  66. package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +34 -22
  67. package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
  68. package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +3 -3
  69. package/dist/ui/components/layout/examples/index.d.ts +2 -0
  70. package/dist/ui/components/layout/examples/index.js +2 -0
  71. package/dist/ui/components/layout/index.d.ts +2 -1
  72. package/dist/ui/components/layout/index.js +2 -1
  73. package/dist/ui/components/modal/Example.svelte +320 -0
  74. package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
  75. package/dist/ui/components/modal/Modal.stories.svelte +18 -0
  76. package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
  77. package/dist/ui/components/modal/Modal.svelte +490 -0
  78. package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
  79. package/dist/ui/components/modal/index.d.ts +2 -0
  80. package/dist/ui/components/modal/index.js +1 -0
  81. package/dist/ui/components/modal/types.d.ts +75 -0
  82. package/dist/ui/components/modal/types.js +1 -0
  83. package/dist/ui/components/notification/Notification.stories.svelte +228 -0
  84. package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
  85. package/dist/ui/components/notification/Notification.svelte +289 -0
  86. package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
  87. package/dist/ui/components/notification/index.d.ts +2 -0
  88. package/dist/ui/components/notification/index.js +1 -0
  89. package/dist/ui/components/notification/types.d.ts +68 -0
  90. package/dist/ui/components/notification/types.js +1 -0
  91. package/dist/ui/components/section/Section.stories.svelte +263 -0
  92. package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
  93. package/dist/ui/components/section/Section.svelte +324 -0
  94. package/dist/ui/components/section/Section.svelte.d.ts +5 -0
  95. package/dist/ui/components/section/index.d.ts +2 -0
  96. package/dist/ui/components/section/index.js +1 -0
  97. package/dist/ui/components/section/types.d.ts +106 -0
  98. package/dist/ui/components/section/types.js +1 -0
  99. package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
  100. package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
  101. package/dist/ui/components/shared/index.d.ts +2 -0
  102. package/dist/ui/components/shared/index.js +2 -0
  103. package/dist/ui/index.css +33 -5
  104. package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
  105. package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
  106. package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
  107. package/dist/utils/api/clipboard/handlePaste.js +2 -6
  108. package/dist/utils/api/getAllAssets.d.ts +1 -2
  109. package/dist/utils/api/getAllAssets.js +1 -2
  110. package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
  111. package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
  112. package/dist/utils/api/index.d.ts +0 -1
  113. package/dist/utils/api/index.js +0 -1
  114. package/dist/utils/api/insertWithXSCP.d.ts +1 -2
  115. package/dist/utils/api/insertWithXSCP.js +1 -2
  116. package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
  117. package/dist/utils/auth/crossWindowLogin.js +3 -0
  118. package/dist/utils/auth/index.d.ts +9 -25
  119. package/dist/utils/auth/index.js +9 -25
  120. package/dist/utils/browser-storage/localStorage.d.ts +4 -12
  121. package/dist/utils/browser-storage/localStorage.js +4 -12
  122. package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
  123. package/dist/utils/browser-storage/sessionStorage.js +4 -12
  124. package/dist/utils/custom-code/api.d.ts +3 -7
  125. package/dist/utils/custom-code/api.js +3 -7
  126. package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
  127. package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
  128. package/dist/utils/helpers/goto.d.ts +1 -4
  129. package/dist/utils/helpers/goto.js +2 -7
  130. package/dist/utils/helpers/index.d.ts +1 -0
  131. package/dist/utils/helpers/index.js +1 -0
  132. package/dist/utils/helpers/noop.d.ts +1 -1
  133. package/dist/utils/helpers/noop.js +1 -1
  134. package/dist/utils/helpers/numbers.d.ts +4 -14
  135. package/dist/utils/helpers/numbers.js +4 -14
  136. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
  137. package/dist/utils/helpers/objectsToModuleExports.js +1 -3
  138. package/dist/utils/helpers/trimText.d.ts +1 -8
  139. package/dist/utils/helpers/trimText.js +1 -8
  140. package/dist/utils/index.d.ts +4 -0
  141. package/dist/utils/index.js +4 -0
  142. package/dist/utils/logger/index.d.ts +0 -2
  143. package/dist/utils/logger/index.js +0 -2
  144. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
  145. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
  146. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
  147. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
  148. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
  149. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
  150. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
  151. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
  152. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
  153. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
  154. package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
  155. package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
  156. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
  157. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
  158. package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
  159. package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
  160. package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
  161. package/dist/utils/webflow-canvas/getAllPages.js +3 -10
  162. package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
  163. package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
  164. package/dist/utils/webflow-canvas/index.d.ts +1 -0
  165. package/dist/utils/webflow-canvas/index.js +1 -0
  166. package/package.json +9 -2
  167. package/dist/stores/globalStore.d.ts +0 -10
  168. package/dist/stores/globalStore.js +0 -10
  169. package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
  170. package/dist/ui/components/Checkbox.svelte +0 -94
  171. package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
  172. package/dist/ui/components/Copy.svelte +0 -329
  173. package/dist/ui/components/Copy.svelte.d.ts +0 -35
  174. package/dist/ui/components/CustomModal.svelte +0 -192
  175. package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
  176. package/dist/ui/components/DisableInEditMode.svelte +0 -66
  177. package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
  178. package/dist/ui/components/Divider.svelte +0 -31
  179. package/dist/ui/components/Divider.svelte.d.ts +0 -31
  180. package/dist/ui/components/Header.svelte +0 -30
  181. package/dist/ui/components/Header.svelte.d.ts +0 -20
  182. package/dist/ui/components/Iframe.svelte +0 -89
  183. package/dist/ui/components/Iframe.svelte.d.ts +0 -40
  184. package/dist/ui/components/InjectComponent.svelte +0 -297
  185. package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
  186. package/dist/ui/components/Modal.svelte +0 -139
  187. package/dist/ui/components/Modal.svelte.d.ts +0 -42
  188. package/dist/ui/components/Navbar.svelte +0 -132
  189. package/dist/ui/components/Navbar.svelte.d.ts +0 -29
  190. package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
  191. package/dist/ui/components/Notification.svelte +0 -193
  192. package/dist/ui/components/Notification.svelte.d.ts +0 -64
  193. package/dist/ui/components/PlusMinusButton.svelte +0 -91
  194. package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
  195. package/dist/ui/components/PreviewBar.svelte +0 -40
  196. package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
  197. package/dist/ui/components/ScrollableContent.svelte +0 -18
  198. package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
  199. package/dist/ui/components/Section.svelte +0 -97
  200. package/dist/ui/components/Section.svelte.d.ts +0 -50
  201. package/dist/ui/components/Spacer.svelte +0 -9
  202. package/dist/ui/components/Spacer.svelte.d.ts +0 -22
  203. package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
  204. package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
  205. package/dist/ui/components/SpinnerUpDown.svelte +0 -194
  206. package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
  207. package/dist/ui/components/Tabs.svelte +0 -71
  208. package/dist/ui/components/Tabs.svelte.d.ts +0 -26
  209. package/dist/ui/components/ToggleItem.svelte +0 -29
  210. package/dist/ui/components/ToggleList.svelte +0 -57
  211. package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
  212. package/dist/ui/components/buttons/index.d.ts +0 -5
  213. package/dist/ui/components/buttons/index.js +0 -5
  214. package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
  215. package/dist/ui/components/clickable/Clickable.svelte +0 -93
  216. package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
  217. package/dist/ui/components/clickable/index.d.ts +0 -2
  218. package/dist/ui/components/clickable/index.js +0 -1
  219. package/dist/ui/components/clickable/types.d.ts +0 -17
  220. package/dist/utils/api/copyPaste/index.d.ts +0 -18
  221. /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
  222. /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
  223. /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
  224. /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
  225. /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
  226. /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Check if sessionStorage is available in the current environment.
3
- * @returns {boolean} True if sessionStorage is accessible, false otherwise.
2
+ * Checks if sessionStorage is available in the current environment.
4
3
  */
5
4
  import { getLogger } from '../logger';
6
5
  const logger = getLogger('webflow-apps-ui-utils');
@@ -18,9 +17,7 @@ export const isSessionStorageAvailable = () => {
18
17
  }
19
18
  };
20
19
  /**
21
- * A utility function for getting a value from sessionStorage.
22
- * @param {string} key - The key to retrieve the value for.
23
- * @returns {string | null} The value associated with the key, or null if not found or sessionStorage is not available.
20
+ * Gets a value from sessionStorage.
24
21
  */
25
22
  export const getSessionStorage = (key) => {
26
23
  if (isSessionStorageAvailable()) {
@@ -30,10 +27,7 @@ export const getSessionStorage = (key) => {
30
27
  return null;
31
28
  };
32
29
  /**
33
- * A utility function for setting a value in sessionStorage.
34
- * @param {string} key - The key to set the value for.
35
- * @param {string} value - The value to be stored.
36
- * @returns {boolean} True if the operation succeeded, false otherwise (or if sessionStorage is not available).
30
+ * Sets a value in sessionStorage.
37
31
  */
38
32
  export const setSessionStorage = (key, value) => {
39
33
  if (isSessionStorageAvailable()) {
@@ -43,9 +37,7 @@ export const setSessionStorage = (key, value) => {
43
37
  return false;
44
38
  };
45
39
  /**
46
- * A utility function for removing a value from sessionStorage.
47
- * @param key - The key to remove the value for.
48
- * @returns {boolean} True if the operation succeeded, false otherwise (or if sessionStorage is not available).
40
+ * Removes a value from sessionStorage.
49
41
  */
50
42
  export const removeSessionStorage = (key) => {
51
43
  if (isSessionStorageAvailable()) {
@@ -1,17 +1,13 @@
1
1
  import type { CustomCodeBlock } from '../../types';
2
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.
3
+ * Gets stored Custom Code blocks by ID or returns all if no ID provided.
6
4
  */
7
5
  export declare const getCustomCode: (id?: string) => Promise<Array<CustomCodeBlock>>;
8
6
  /**
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.
7
+ * Sets custom code blocks in the site.
12
8
  */
13
9
  export declare const setCustomCode: (customCodeBlock: Array<CustomCodeBlock>) => Promise<void>;
14
10
  /**
15
- * A utility function for removing Custom Code block.
11
+ * Removes a custom code block.
16
12
  */
17
13
  export declare const removeCustomCode: () => boolean;
@@ -1,9 +1,7 @@
1
1
  import { getLogger } from '../logger';
2
2
  const logger = getLogger('webflow-apps-ui-utils');
3
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.
4
+ * Gets stored Custom Code blocks by ID or returns all if no ID provided.
7
5
  */
8
6
  export const getCustomCode = async (id) => {
9
7
  //TODO: update this when typings are available plus any other place we have disabled this warning.
@@ -19,9 +17,7 @@ export const getCustomCode = async (id) => {
19
17
  return [];
20
18
  };
21
19
  /**
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.
20
+ * Sets custom code blocks in the site.
25
21
  */
26
22
  export const setCustomCode = async (customCodeBlock) => {
27
23
  try {
@@ -33,7 +29,7 @@ export const setCustomCode = async (customCodeBlock) => {
33
29
  }
34
30
  };
35
31
  /**
36
- * A utility function for removing Custom Code block.
32
+ * Removes a custom code block.
37
33
  */
38
34
  export const removeCustomCode = () => {
39
35
  //TODO: implement when available
@@ -1,5 +1,4 @@
1
1
  /**
2
- * Handle fullstop at the end of the message.
3
- * @param message
2
+ * Handles fullstop placement at the end of tooltip messages.
4
3
  */
5
4
  export declare const cleanupTooltipMessage: (message: string) => string;
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Handle fullstop at the end of the message.
3
- * @param message
2
+ * Handles fullstop placement at the end of tooltip messages.
4
3
  */
5
4
  export const cleanupTooltipMessage = (message) => {
6
5
  if (!message?.trim())
@@ -1,7 +1,4 @@
1
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
2
+ * Navigates to a new path using the router store hash.
6
3
  */
7
4
  export declare const goto: (path?: string, state?: Record<string, unknown>) => void;
@@ -4,9 +4,7 @@ import { routerStore } from '../../stores';
4
4
  import { getLogger } from '../logger';
5
5
  const logger = getLogger('webflow-apps-ui-utils');
6
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
7
+ * Normalizes a URL path to ensure proper formatting.
10
8
  */
11
9
  const normalizeUrlPath = (path, hash) => {
12
10
  const safePath = path.replace(/([^:]\/)\/+/g, '$1');
@@ -18,10 +16,7 @@ const normalizeUrlPath = (path, hash) => {
18
16
  return url;
19
17
  };
20
18
  /**
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
19
+ * Navigates to a new path using the router store hash.
25
20
  */
26
21
  export const goto = (path = '/', state = {}) => {
27
22
  const { hash = '' } = get(routerStore);
@@ -2,4 +2,5 @@ export * from './cleanupTooltipMessage';
2
2
  export * from './goto';
3
3
  export * from './noop';
4
4
  export * from './numbers';
5
+ export * from './objectsToModuleExports';
5
6
  export * from './trimText';
@@ -2,4 +2,5 @@ export * from './cleanupTooltipMessage';
2
2
  export * from './goto';
3
3
  export * from './noop';
4
4
  export * from './numbers';
5
+ export * from './objectsToModuleExports';
5
6
  export * from './trimText';
@@ -1,4 +1,4 @@
1
1
  /**
2
- * It literally does nothing.
2
+ * No-operation function that does nothing.
3
3
  */
4
4
  export declare const noop: (value?: unknown) => unknown;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * It literally does nothing.
2
+ * No-operation function that does nothing.
3
3
  */
4
4
  export const noop = (value) => {
5
5
  // No operation.
@@ -1,27 +1,17 @@
1
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.
2
+ * Converts a string to a number, removing invalid symbols.
5
3
  */
6
4
  export declare const normalizeNumber: (value: string) => number | undefined;
7
5
  /**
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.
6
+ * Parses a numeric attribute string with fallback support.
11
7
  */
12
8
  export declare function parseNumericAttribute(rawValue: string | number | null | undefined, fallback: number): number;
13
9
  export declare function parseNumericAttribute(rawValue: string | number | null | undefined, fallback?: number | null): number | null;
14
10
  /**
15
- * Calculates the amount of decimals that a float number has.
16
- * @param value A number.
11
+ * Calculates the number of decimal places in a float.
17
12
  */
18
13
  export declare const getDecimalPrecision: (value: number) => number;
19
14
  /**
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.
15
+ * Adjusts a numeric value to align with a step factor.
26
16
  */
27
17
  export declare const adjustValueToStep: (value: number, step: number, precision?: number, minRange?: number) => number;
@@ -1,7 +1,5 @@
1
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.
2
+ * Converts a string to a number, removing invalid symbols.
5
3
  */
6
4
  export const normalizeNumber = (value) => {
7
5
  if (!value)
@@ -19,8 +17,7 @@ export function parseNumericAttribute(rawValue, fallback) {
19
17
  return null;
20
18
  }
21
19
  /**
22
- * Calculates the amount of decimals that a float number has.
23
- * @param value A number.
20
+ * Calculates the number of decimal places in a float.
24
21
  */
25
22
  export const getDecimalPrecision = (value) => {
26
23
  if (!isFinite(value))
@@ -34,21 +31,14 @@ export const getDecimalPrecision = (value) => {
34
31
  return precision;
35
32
  };
36
33
  /**
37
- * Ensures a decimal precision on a number.
38
- * @param value The number to handle.
39
- * @param precision The amount of decimals.
34
+ * Ensures a specific decimal precision on a number.
40
35
  */
41
36
  const setDecimalPrecision = (value, precision) => {
42
37
  const pow = Math.pow(10, precision);
43
38
  return Math.round(value * pow) / pow;
44
39
  };
45
40
  /**
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.
41
+ * Adjusts a numeric value to align with a step factor.
52
42
  */
53
43
  export const adjustValueToStep = (value, step, precision, minRange = 0) => {
54
44
  precision ??= getDecimalPrecision(step);
@@ -1,7 +1,5 @@
1
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.
2
+ * Converts an array of objects to module export statements.
5
3
  */
6
4
  export declare const objectsToModuleExports: (exportsArray: Array<{
7
5
  moduleName: string;
@@ -1,7 +1,5 @@
1
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.
2
+ * Converts an array of objects to module export statements.
5
3
  */
6
4
  export const objectsToModuleExports = (exportsArray) => {
7
5
  return exportsArray
@@ -1,15 +1,8 @@
1
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.
2
+ * Trims text in the middle and adds ellipsis if it exceeds the maximum length.
7
3
  */
8
4
  export declare const trimText: (text: string, maxLength?: number) => string | undefined;
9
5
  /**
10
6
  * 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
7
  */
15
8
  export declare const trimExtraSpaces: (text: string) => string | undefined;
@@ -1,9 +1,5 @@
1
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.
2
+ * Trims text in the middle and adds ellipsis if it exceeds the maximum length.
7
3
  */
8
4
  export const trimText = (text, maxLength = 40) => {
9
5
  if (!text)
@@ -18,9 +14,6 @@ export const trimText = (text, maxLength = 40) => {
18
14
  };
19
15
  /**
20
16
  * 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
17
  */
25
18
  export const trimExtraSpaces = (text) => {
26
19
  if (!text)
@@ -1,4 +1,8 @@
1
+ export * from './api';
1
2
  export * from './auth';
3
+ export * from './browser-storage';
2
4
  export * from './constants';
5
+ export * from './custom-code';
3
6
  export * from './helpers';
4
7
  export * from './logger';
8
+ export * from './webflow-canvas';
@@ -1,4 +1,8 @@
1
+ export * from './api';
1
2
  export * from './auth';
3
+ export * from './browser-storage';
2
4
  export * from './constants';
5
+ export * from './custom-code';
3
6
  export * from './helpers';
4
7
  export * from './logger';
8
+ export * from './webflow-canvas';
@@ -13,7 +13,5 @@ export interface Logger {
13
13
  }
14
14
  /**
15
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
16
  */
19
17
  export declare function getLogger(context: LoggerContext): Logger;
@@ -2,8 +2,6 @@
2
2
  import { getFinsweetComponentsEnvironment } from '../api';
3
3
  /**
4
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
5
  */
8
6
  export function getLogger(context) {
9
7
  const createLogMethod = (level) => {
@@ -1,6 +1,4 @@
1
1
  /**
2
- * Retrieves all custom attributes from a Webflow element.
3
- * @param {AnyElement} params.element - The data object of the element.
4
- * @returns
2
+ * Gets all custom attributes from a Webflow element.
5
3
  */
6
4
  export declare const getAllWebflowElementAttributes: (element: AnyElement) => Promise<NamedValue[] | null>;
@@ -1,9 +1,7 @@
1
1
  import { getLogger } from '../../logger';
2
2
  const logger = getLogger('webflow-apps-ui-utils');
3
3
  /**
4
- * Retrieves all custom attributes from a Webflow element.
5
- * @param {AnyElement} params.element - The data object of the element.
6
- * @returns
4
+ * Gets all custom attributes from a Webflow element.
7
5
  */
8
6
  export const getAllWebflowElementAttributes = async (element) => {
9
7
  try {
@@ -1,8 +1,4 @@
1
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
2
+ * Gets instance names from an object based on component configuration.
7
3
  */
8
4
  export declare const getInstanceNamesFromObject: (obj: Record<string, any>, component: string, hasInstances?: boolean) => string[];
@@ -1,10 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
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
3
+ * Gets instance names from an object based on component configuration.
8
4
  */
9
5
  export const getInstanceNamesFromObject = (obj, component, hasInstances) => {
10
6
  if (!obj || typeof obj !== 'object')
@@ -1,7 +1,4 @@
1
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
2
+ * Gets the value of a custom attribute from a Webflow element.
6
3
  */
7
4
  export declare const getWebflowElementAttribute: (element: AnyElement, attributeName: string) => Promise<string | null>;
@@ -1,10 +1,7 @@
1
1
  import { getLogger } from '../../logger';
2
2
  const logger = getLogger('webflow-apps-ui-utils');
3
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
4
+ * Gets the value of a custom attribute from a Webflow element.
8
5
  */
9
6
  export const getWebflowElementAttribute = async (element, attributeName) => {
10
7
  try {
@@ -1,6 +1,4 @@
1
1
  /**
2
- * Get the text content of the webflow element
3
- * @param el
4
- * @returns
2
+ * Gets the text content of a Webflow element.
5
3
  */
6
4
  export declare const getWebflowElementTextContent: (selectedElement: AnyElement) => Promise<string>;
@@ -1,7 +1,5 @@
1
1
  /**
2
- * Get the text content of the webflow element
3
- * @param el
4
- * @returns
2
+ * Gets the text content of a Webflow element.
5
3
  */
6
4
  export const getWebflowElementTextContent = async (selectedElement) => {
7
5
  const textContent = [];
@@ -1,7 +1,4 @@
1
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.
2
+ * Removes a custom attribute from a Webflow element.
6
3
  */
7
4
  export declare const removeWebflowElementAttribute: (element: AnyElement, attributeName: string, notify?: boolean) => Promise<null | undefined>;
@@ -1,10 +1,7 @@
1
1
  import { getLogger } from '../../logger';
2
2
  const logger = getLogger('webflow-apps-ui-utils');
3
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.
4
+ * Removes a custom attribute from a Webflow element.
8
5
  */
9
6
  export const removeWebflowElementAttribute = async (element, attributeName, notify = true) => {
10
7
  try {
@@ -3,8 +3,6 @@ export interface StyleProps {
3
3
  style: PropertyMap;
4
4
  }
5
5
  /**
6
- * Create or Update style and apply it to the selected element
7
- * @param styles
8
- * @param element
6
+ * Creates or updates styles and applies them to the selected element.
9
7
  */
10
8
  export declare const setStyles: (styles: StyleProps[], element: AnyElement) => Promise<void>;
@@ -1,7 +1,5 @@
1
1
  /**
2
- * Create or Update style and apply it to the selected element
3
- * @param styles
4
- * @param element
2
+ * Creates or updates styles and applies them to the selected element.
5
3
  */
6
4
  export const setStyles = async (styles, element) => {
7
5
  const promises = styles.map(async ({ name, style }) => {
@@ -1,11 +1,4 @@
1
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
2
+ * Sets a custom attribute value on a Webflow element.
10
3
  */
11
4
  export declare const setWebflowElementAttribute: (element: AnyElement, attributeName: string, attributeValue: string, notify?: boolean) => Promise<void>;
@@ -2,14 +2,7 @@ import { getLogger } from '../../logger';
2
2
  import { getWebflowElementAttribute } from './getWebflowElementAttribute';
3
3
  const logger = getLogger('webflow-apps-ui-utils');
4
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
5
+ * Sets a custom attribute value on a Webflow element.
13
6
  */
14
7
  export const setWebflowElementAttribute = async (element, attributeName, attributeValue, notify = true) => {
15
8
  try {
@@ -47,11 +40,6 @@ export const setWebflowElementAttribute = async (element, attributeName, attribu
47
40
  };
48
41
  /**
49
42
  * 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
43
  */
56
44
  const checkAttribute = async (element, attributeName, attributeValue) => {
57
45
  const elementAttribute = await getWebflowElementAttribute(element, attributeName);
@@ -22,11 +22,5 @@ export interface FindElementByReferenceProps {
22
22
  }
23
23
  /**
24
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
25
  */
32
26
  export declare const findInstanceElement: ({ targetIndex, instance, component, allElements, signal, selectElement }: GetElementFromComponentProps) => Promise<ElementFromComponentMatch | null>;
@@ -3,7 +3,7 @@ import { getLogger } from '../logger';
3
3
  import { getWebflowElementAttribute } from './attributes';
4
4
  const logger = getLogger('utils');
5
5
  /**
6
- * Exit the current component
6
+ * Exits the current component context.
7
7
  */
8
8
  const exitComponent = async () => {
9
9
  try {
@@ -15,12 +15,6 @@ const exitComponent = async () => {
15
15
  };
16
16
  /**
17
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
18
  */
25
19
  export const findInstanceElement = async ({ targetIndex, instance, component, allElements, signal, selectElement = false }) => {
26
20
  if (signal?.aborted)
@@ -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 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}
2
+ * Returns a valid Webflow project staging URL.
6
3
  */
7
4
  export declare const getSiteStagingUrl: (origin?: boolean, stagingName?: boolean) => Promise<string>;