@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.
Files changed (230) 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 +4 -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/icons/LineChartIcon.svelte +8 -0
  104. package/dist/ui/icons/LineChartIcon.svelte.d.ts +26 -0
  105. package/dist/ui/icons/index.d.ts +2 -1
  106. package/dist/ui/icons/index.js +2 -1
  107. package/dist/ui/index.css +33 -5
  108. package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
  109. package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
  110. package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
  111. package/dist/utils/api/clipboard/handlePaste.js +2 -6
  112. package/dist/utils/api/getAllAssets.d.ts +1 -2
  113. package/dist/utils/api/getAllAssets.js +1 -2
  114. package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
  115. package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
  116. package/dist/utils/api/index.d.ts +0 -1
  117. package/dist/utils/api/index.js +0 -1
  118. package/dist/utils/api/insertWithXSCP.d.ts +1 -2
  119. package/dist/utils/api/insertWithXSCP.js +1 -2
  120. package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
  121. package/dist/utils/auth/crossWindowLogin.js +3 -0
  122. package/dist/utils/auth/index.d.ts +9 -25
  123. package/dist/utils/auth/index.js +9 -25
  124. package/dist/utils/browser-storage/localStorage.d.ts +4 -12
  125. package/dist/utils/browser-storage/localStorage.js +4 -12
  126. package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
  127. package/dist/utils/browser-storage/sessionStorage.js +4 -12
  128. package/dist/utils/custom-code/api.d.ts +3 -7
  129. package/dist/utils/custom-code/api.js +3 -7
  130. package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
  131. package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
  132. package/dist/utils/helpers/goto.d.ts +1 -4
  133. package/dist/utils/helpers/goto.js +2 -7
  134. package/dist/utils/helpers/index.d.ts +1 -0
  135. package/dist/utils/helpers/index.js +1 -0
  136. package/dist/utils/helpers/noop.d.ts +1 -1
  137. package/dist/utils/helpers/noop.js +1 -1
  138. package/dist/utils/helpers/numbers.d.ts +4 -14
  139. package/dist/utils/helpers/numbers.js +4 -14
  140. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
  141. package/dist/utils/helpers/objectsToModuleExports.js +1 -3
  142. package/dist/utils/helpers/trimText.d.ts +1 -8
  143. package/dist/utils/helpers/trimText.js +1 -8
  144. package/dist/utils/index.d.ts +4 -0
  145. package/dist/utils/index.js +4 -0
  146. package/dist/utils/logger/index.d.ts +0 -2
  147. package/dist/utils/logger/index.js +0 -2
  148. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
  149. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
  150. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
  151. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
  152. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
  153. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
  154. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
  155. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
  156. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
  157. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
  158. package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
  159. package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
  160. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
  161. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
  162. package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
  163. package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
  164. package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
  165. package/dist/utils/webflow-canvas/getAllPages.js +3 -10
  166. package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
  167. package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
  168. package/dist/utils/webflow-canvas/index.d.ts +1 -0
  169. package/dist/utils/webflow-canvas/index.js +1 -0
  170. package/package.json +9 -2
  171. package/dist/stores/globalStore.d.ts +0 -10
  172. package/dist/stores/globalStore.js +0 -10
  173. package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
  174. package/dist/ui/components/Checkbox.svelte +0 -94
  175. package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
  176. package/dist/ui/components/Copy.svelte +0 -329
  177. package/dist/ui/components/Copy.svelte.d.ts +0 -35
  178. package/dist/ui/components/CustomModal.svelte +0 -192
  179. package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
  180. package/dist/ui/components/DisableInEditMode.svelte +0 -66
  181. package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
  182. package/dist/ui/components/Divider.svelte +0 -31
  183. package/dist/ui/components/Divider.svelte.d.ts +0 -31
  184. package/dist/ui/components/Header.svelte +0 -30
  185. package/dist/ui/components/Header.svelte.d.ts +0 -20
  186. package/dist/ui/components/Iframe.svelte +0 -89
  187. package/dist/ui/components/Iframe.svelte.d.ts +0 -40
  188. package/dist/ui/components/InjectComponent.svelte +0 -297
  189. package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
  190. package/dist/ui/components/Modal.svelte +0 -139
  191. package/dist/ui/components/Modal.svelte.d.ts +0 -42
  192. package/dist/ui/components/Navbar.svelte +0 -132
  193. package/dist/ui/components/Navbar.svelte.d.ts +0 -29
  194. package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
  195. package/dist/ui/components/Notification.svelte +0 -193
  196. package/dist/ui/components/Notification.svelte.d.ts +0 -64
  197. package/dist/ui/components/PlusMinusButton.svelte +0 -91
  198. package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
  199. package/dist/ui/components/PreviewBar.svelte +0 -40
  200. package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
  201. package/dist/ui/components/ScrollableContent.svelte +0 -18
  202. package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
  203. package/dist/ui/components/Section.svelte +0 -97
  204. package/dist/ui/components/Section.svelte.d.ts +0 -50
  205. package/dist/ui/components/Spacer.svelte +0 -9
  206. package/dist/ui/components/Spacer.svelte.d.ts +0 -22
  207. package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
  208. package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
  209. package/dist/ui/components/SpinnerUpDown.svelte +0 -194
  210. package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
  211. package/dist/ui/components/Tabs.svelte +0 -71
  212. package/dist/ui/components/Tabs.svelte.d.ts +0 -26
  213. package/dist/ui/components/ToggleItem.svelte +0 -29
  214. package/dist/ui/components/ToggleList.svelte +0 -57
  215. package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
  216. package/dist/ui/components/buttons/index.d.ts +0 -5
  217. package/dist/ui/components/buttons/index.js +0 -5
  218. package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
  219. package/dist/ui/components/clickable/Clickable.svelte +0 -93
  220. package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
  221. package/dist/ui/components/clickable/index.d.ts +0 -2
  222. package/dist/ui/components/clickable/index.js +0 -1
  223. package/dist/ui/components/clickable/types.d.ts +0 -17
  224. package/dist/utils/api/copyPaste/index.d.ts +0 -18
  225. /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
  226. /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
  227. /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
  228. /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
  229. /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
  230. /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
1
  import type { Placement } from '@floating-ui/dom';
2
2
  import type { Component } from 'svelte';
3
3
  /**
4
- * Individual button item properties
4
+ * Controlled button item properties
5
5
  */
6
- export interface ButtonItem {
7
- id?: 'main' | 'update-single' | 'update-all' | 'save';
6
+ export interface ControlledButtonItem {
7
+ id?: string;
8
8
  text: string;
9
9
  escapeValidation?: boolean;
10
10
  variant?: 'primary' | 'secondary' | 'cms';
@@ -13,7 +13,7 @@ export interface ButtonItem {
13
13
  type?: 'library' | 'component' | 'popup';
14
14
  onClick?: () => void;
15
15
  show?: boolean;
16
- popupButtons?: ButtonItem[];
16
+ popupButtons?: ControlledButtonItem[];
17
17
  popupTrigger?: 'click' | 'hover';
18
18
  icon?: Component;
19
19
  description?: string;
@@ -26,3 +26,10 @@ export interface ButtonItem {
26
26
  icon?: Component;
27
27
  };
28
28
  }
29
+ /**
30
+ * Controlled buttons props
31
+ */
32
+ export interface ControlledButtonsProps {
33
+ buttons: ControlledButtonItem[];
34
+ class?: string;
35
+ }
@@ -0,0 +1,134 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+
4
+ import Divider from './Divider.svelte';
5
+
6
+ const { Story } = defineMeta({
7
+ title: 'Ui/Divider',
8
+ component: Divider,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ layout: 'padded',
12
+ docs: {
13
+ description: {
14
+ component:
15
+ 'A simple divider component for creating visual separation between content sections. Supports customizable dimensions, colors, and orientation.'
16
+ }
17
+ }
18
+ },
19
+ argTypes: {
20
+ height: {
21
+ control: 'text',
22
+ description: 'Height of the divider',
23
+ table: {
24
+ defaultValue: { summary: '1px' }
25
+ }
26
+ },
27
+ width: {
28
+ control: 'text',
29
+ description: 'Width of the divider',
30
+ table: {
31
+ defaultValue: { summary: '100%' }
32
+ }
33
+ },
34
+ background: {
35
+ control: 'color',
36
+ description: 'Background color of the divider',
37
+ table: {
38
+ defaultValue: { summary: 'var(--border1)' }
39
+ }
40
+ },
41
+ rotate: {
42
+ control: 'boolean',
43
+ description: 'Rotates the divider 90 degrees for vertical orientation',
44
+ table: {
45
+ defaultValue: { summary: 'false' }
46
+ }
47
+ },
48
+ class: {
49
+ control: 'text',
50
+ description: 'Additional CSS classes to apply'
51
+ }
52
+ }
53
+ });
54
+ </script>
55
+
56
+ <!-- Basic variants -->
57
+ <Story name="Default" />
58
+
59
+ <Story
60
+ name="Thick"
61
+ args={{
62
+ height: '4px'
63
+ }}
64
+ />
65
+
66
+ <Story
67
+ name="Custom Color"
68
+ args={{
69
+ background: '#007bff',
70
+ height: '2px'
71
+ }}
72
+ />
73
+
74
+ <Story
75
+ name="Short Divider"
76
+ args={{
77
+ width: '50%',
78
+ height: '2px'
79
+ }}
80
+ />
81
+
82
+ <Story
83
+ name="Vertical"
84
+ args={{
85
+ rotate: true,
86
+ height: '100px',
87
+ width: '2px'
88
+ }}
89
+ />
90
+
91
+ <!-- Color variants -->
92
+ <Story
93
+ name="Success"
94
+ args={{
95
+ background: 'var(--greenIcon)',
96
+ height: '3px'
97
+ }}
98
+ />
99
+
100
+ <Story
101
+ name="Warning"
102
+ args={{
103
+ background: 'var(--yellowBorder)',
104
+ height: '3px'
105
+ }}
106
+ />
107
+
108
+ <Story
109
+ name="Error"
110
+ args={{
111
+ background: 'var(--redBorder)',
112
+ height: '3px'
113
+ }}
114
+ />
115
+
116
+ <!-- Complex example with content context -->
117
+ <Story name="In Content">
118
+ <div style="padding: 20px; background: var(--background1); border-radius: 8px;">
119
+ <p style="margin: 0 0 16px 0; color: var(--text1);">Content above divider</p>
120
+ <Divider height="1px" background="var(--border1)" />
121
+ <p style="margin: 16px 0 0 0; color: var(--text1);">Content below divider</p>
122
+ </div>
123
+ </Story>
124
+
125
+ <!-- Playground -->
126
+ <Story
127
+ name="Playground"
128
+ args={{
129
+ height: '2px',
130
+ width: '100%',
131
+ background: '#007bff',
132
+ rotate: false
133
+ }}
134
+ />
@@ -1,17 +1,17 @@
1
- export default Clickable;
2
- type Clickable = SvelteComponent<{
1
+ export default Divider;
2
+ type Divider = SvelteComponent<{
3
3
  [x: string]: never;
4
4
  }, {
5
5
  [evt: string]: CustomEvent<any>;
6
6
  }, {}> & {
7
7
  $$bindings?: string | undefined;
8
8
  };
9
- declare const Clickable: $$__sveltets_2_IsomorphicComponent<{
9
+ declare const Divider: $$__sveltets_2_IsomorphicComponent<{
10
10
  [x: string]: never;
11
11
  }, {
12
12
  [evt: string]: CustomEvent<any>;
13
13
  }, {}, {}, string>;
14
- import Clickable from './Clickable.svelte';
14
+ import Divider from './Divider.svelte';
15
15
  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> {
16
16
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
17
  $$bindings?: Bindings;
@@ -0,0 +1,30 @@
1
+ <script lang="ts">
2
+ import type { DividerProps } from './types.js';
3
+
4
+ let {
5
+ height = '1px',
6
+ width = '100%',
7
+ background = 'var(--border1)',
8
+ rotate = false,
9
+ class: className = '',
10
+ ...restProps
11
+ }: DividerProps = $props();
12
+
13
+ // Computed classes
14
+ let dividerClasses = $derived(`divider ${className}`.trim());
15
+
16
+ // Computed styles
17
+ let dividerStyles = $derived(
18
+ `height: ${height}; width: ${width}; background: ${background}; ${
19
+ rotate ? 'transform: rotate(180deg);' : ''
20
+ }`
21
+ );
22
+ </script>
23
+
24
+ <div class={dividerClasses} style={dividerStyles} data-testid="divider" {...restProps}></div>
25
+
26
+ <style>
27
+ .divider {
28
+ align-self: stretch;
29
+ }
30
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { DividerProps } from './types.js';
2
+ declare const Divider: import("svelte").Component<DividerProps, {}, "">;
3
+ type Divider = ReturnType<typeof Divider>;
4
+ export default Divider;
@@ -0,0 +1,2 @@
1
+ export { default as Divider } from './Divider.svelte';
2
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export { default as Divider } from './Divider.svelte';
@@ -0,0 +1,23 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface DividerProps extends HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * Height of the divider
5
+ */
6
+ height?: string;
7
+ /**
8
+ * Width of the divider
9
+ */
10
+ width?: string;
11
+ /**
12
+ * Background color of the divider
13
+ */
14
+ background?: string;
15
+ /**
16
+ * Orientation of the divider - when true, rotates the divider 90 degrees
17
+ */
18
+ rotate?: boolean;
19
+ /**
20
+ * Additional CSS classes to apply
21
+ */
22
+ class?: string;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,122 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+
4
+ import Iframe from './Iframe.svelte';
5
+
6
+ const { Story } = defineMeta({
7
+ title: 'Ui/Iframe',
8
+ component: Iframe,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ url: {
12
+ control: 'text',
13
+ description: 'The URL to load in the iframe'
14
+ },
15
+ title: {
16
+ control: 'text',
17
+ description: 'Accessible title for the iframe content'
18
+ },
19
+ width: {
20
+ control: 'text',
21
+ description: 'Width of the iframe'
22
+ },
23
+ height: {
24
+ control: 'text',
25
+ description: 'Height of the iframe'
26
+ },
27
+ useProxy: {
28
+ control: 'boolean',
29
+ description: 'Whether to use the Finsweet reverse proxy for CORS'
30
+ },
31
+ class: {
32
+ control: 'text',
33
+ description: 'Custom CSS class name'
34
+ },
35
+ id: {
36
+ control: 'text',
37
+ description: 'HTML id attribute'
38
+ },
39
+ onLoadSuccess: {
40
+ action: 'loadSuccess',
41
+ description: 'Called when iframe loads successfully'
42
+ },
43
+ onLoadError: {
44
+ action: 'loadError',
45
+ description: 'Called when iframe fails to load'
46
+ }
47
+ }
48
+ });
49
+ </script>
50
+
51
+ <Story
52
+ name="Default"
53
+ args={{
54
+ url: 'https://example.com',
55
+ title: 'Example Website',
56
+ width: '100%',
57
+ height: '400px'
58
+ }}
59
+ />
60
+
61
+ <Story
62
+ name="With Proxy"
63
+ args={{
64
+ url: 'https://httpbin.org/html',
65
+ title: 'HTTPBin HTML Page',
66
+ width: '100%',
67
+ height: '400px',
68
+ useProxy: true
69
+ }}
70
+ />
71
+
72
+ <Story
73
+ name="Without Proxy"
74
+ args={{
75
+ url: 'https://example.com',
76
+ title: 'Direct URL Load',
77
+ width: '100%',
78
+ height: '400px',
79
+ useProxy: false
80
+ }}
81
+ />
82
+
83
+ <Story
84
+ name="Custom Dimensions"
85
+ args={{
86
+ url: 'https://httpbin.org/html',
87
+ title: 'Custom Size Iframe',
88
+ width: '800px',
89
+ height: '600px'
90
+ }}
91
+ />
92
+
93
+ <Story
94
+ name="Small Iframe"
95
+ args={{
96
+ url: 'https://httpbin.org/html',
97
+ title: 'Small Iframe',
98
+ width: '400px',
99
+ height: '300px'
100
+ }}
101
+ />
102
+
103
+ <Story
104
+ name="With Custom Class"
105
+ args={{
106
+ url: 'https://httpbin.org/html',
107
+ title: 'Styled Iframe',
108
+ width: '100%',
109
+ height: '400px',
110
+ class: 'custom-styled-iframe'
111
+ }}
112
+ />
113
+
114
+ <Story
115
+ name="Responsive Iframe"
116
+ args={{
117
+ url: 'https://httpbin.org/html',
118
+ title: 'Responsive Iframe',
119
+ width: '100%',
120
+ height: '50vh'
121
+ }}
122
+ />
@@ -1,23 +1,22 @@
1
- export default ToggleItem;
2
- type ToggleItem = SvelteComponent<{
3
- title?: string | undefined;
4
- isActive?: boolean | undefined;
1
+ export default Iframe;
2
+ type Iframe = SvelteComponent<{
3
+ [x: string]: never;
5
4
  }, {
6
5
  [evt: string]: CustomEvent<any>;
7
6
  }, {}> & {
8
7
  $$bindings?: string | undefined;
9
8
  };
10
- declare const ToggleItem: $$__sveltets_2_IsomorphicComponent<{
11
- title?: string | undefined;
12
- isActive?: boolean | undefined;
9
+ declare const Iframe: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
13
11
  }, {
14
12
  [evt: string]: CustomEvent<any>;
15
13
  }, {}, {}, string>;
14
+ import Iframe from './Iframe.svelte';
16
15
  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> {
17
16
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
18
17
  $$bindings?: Bindings;
19
18
  } & Exports;
20
- (internal: unknown, props: Props & {
19
+ (internal: unknown, props: {
21
20
  $$events?: Events;
22
21
  $$slots?: Slots;
23
22
  }): Exports & {
@@ -0,0 +1,75 @@
1
+ <script lang="ts">
2
+ import { FINSWEET_REVERSE_PROXY_URL } from '../../../utils';
3
+
4
+ import type { IframeProps } from './types.js';
5
+
6
+ type Props = IframeProps;
7
+
8
+ let {
9
+ url,
10
+ title,
11
+ width = '100%',
12
+ height = '100%',
13
+ useProxy = true,
14
+ onLoadSuccess = () => {},
15
+ onLoadError = () => {},
16
+ class: className = '',
17
+ id,
18
+ ...restProps
19
+ }: Props = $props();
20
+
21
+ // Component state
22
+ let iframeElement: HTMLIFrameElement | undefined = $state();
23
+
24
+ // Derived computed src URL
25
+ let src = $derived(useProxy ? `${FINSWEET_REVERSE_PROXY_URL}${url}` : url);
26
+
27
+ // CSS classes
28
+ let iframeClasses = $derived(`iframe ${className}`.trim());
29
+
30
+ /**
31
+ * Handle the iframe load event
32
+ */
33
+ function handleLoad(): void {
34
+ if (!iframeElement?.contentDocument) {
35
+ onLoadError();
36
+ return;
37
+ }
38
+
39
+ const { contentDocument } = iframeElement;
40
+ const iframeTitle = contentDocument.title;
41
+ const { body } = contentDocument;
42
+
43
+ // Check for various error conditions
44
+ const hasNoContent = body.childNodes.length === 0;
45
+ const has404InTitle = iframeTitle.includes('404');
46
+ const has404InBody = body.outerHTML.includes('<span>404</span>');
47
+
48
+ if (hasNoContent || has404InTitle || has404InBody) {
49
+ onLoadError();
50
+ return;
51
+ }
52
+
53
+ onLoadSuccess();
54
+ }
55
+ </script>
56
+
57
+ <iframe
58
+ bind:this={iframeElement}
59
+ {id}
60
+ {title}
61
+ {src}
62
+ {width}
63
+ {height}
64
+ class={iframeClasses}
65
+ onload={handleLoad}
66
+ {...restProps}
67
+ ></iframe>
68
+
69
+ <style>
70
+ .iframe {
71
+ border: none;
72
+ border-radius: var(--border-radius-md, 4px);
73
+ background: var(--text2);
74
+ }
75
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { IframeProps } from './types.js';
2
+ declare const Iframe: import("svelte").Component<IframeProps, {}, "">;
3
+ type Iframe = ReturnType<typeof Iframe>;
4
+ export default Iframe;
@@ -0,0 +1,2 @@
1
+ export { default as Iframe } from './Iframe.svelte';
2
+ export type { IframeProps } from './types.js';
@@ -0,0 +1 @@
1
+ export { default as Iframe } from './Iframe.svelte';
@@ -0,0 +1,38 @@
1
+ import type { HTMLIframeAttributes } from 'svelte/elements';
2
+ export interface IframeProps extends Omit<HTMLIframeAttributes, 'src' | 'title' | 'onload'> {
3
+ /**
4
+ * The URL to load in the iframe
5
+ */
6
+ url: string;
7
+ /**
8
+ * Accessible title for the iframe content
9
+ */
10
+ title: string;
11
+ /**
12
+ * Width of the iframe
13
+ * @default '100%'
14
+ */
15
+ width?: string;
16
+ /**
17
+ * Height of the iframe
18
+ * @default '100%'
19
+ */
20
+ height?: string;
21
+ /**
22
+ * Whether to use the Finsweet reverse proxy for CORS
23
+ * @default true
24
+ */
25
+ useProxy?: boolean;
26
+ /**
27
+ * Event handler called when iframe loads successfully
28
+ */
29
+ onLoadSuccess?: () => void;
30
+ /**
31
+ * Event handler called when iframe fails to load
32
+ */
33
+ onLoadError?: () => void;
34
+ /**
35
+ * Custom CSS class name
36
+ */
37
+ class?: string;
38
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,46 +1,19 @@
1
- /**
2
- * All Re-usable Components
3
- */
4
- import BreakpointItem from './breakpoints/BreakpointItem.svelte';
5
- import ButtonGroup from './ButtonGroup.svelte';
6
- import Checkbox from './Checkbox.svelte';
7
- import { Clickable } from './clickable';
8
- import Copy from './Copy.svelte';
9
- import CustomModal from './CustomModal.svelte';
10
- import DisableInEditMode from './DisableInEditMode.svelte';
11
- import Divider from './Divider.svelte';
12
- import Header from './Header.svelte';
13
- import Iframe from './Iframe.svelte';
14
- import ImageUpload from './ImageUpload.svelte';
15
- import InjectComponent from './InjectComponent.svelte';
16
- import { Input } from './input';
17
- import { Layout } from './layout';
18
- import Loader from './Loader.svelte';
19
- import LoadingScreen from './LoadingScreen.svelte';
20
- import Modal from './Modal.svelte';
21
- import Navbar from './Navbar.svelte';
22
- import NoSettingsNeeded from './NoSettingsNeeded.svelte';
23
- import Notification from './Notification.svelte';
24
- import PreviewBar from './PreviewBar.svelte';
25
- import ScrollableContent from './ScrollableContent.svelte';
26
- import Section from './Section.svelte';
27
- import SelectBodyOrDivBlock from './SelectBodyOrDivBlock.svelte';
28
- import Spacer from './Spacer.svelte';
29
- import SpinnerPlusMinus from './SpinnerPlusMinus.svelte';
30
- import SpinnerUpDown from './SpinnerUpDown.svelte';
31
- import Switch from './switch/Switch.svelte';
32
- import Tabs from './Tabs.svelte';
33
- import { Text } from './text';
34
- import ToggleItem from './ToggleItem.svelte';
35
- import ToggleList from './ToggleList.svelte';
36
- import { Tooltip } from './tooltip';
37
- export { BreakpointItem, ButtonGroup, Checkbox, Clickable, Copy, CustomModal, DisableInEditMode, Notification, Divider, Header, Iframe, ImageUpload, InjectComponent, Layout, Loader, LoadingScreen, Modal, Navbar, NoSettingsNeeded, PreviewBar, ScrollableContent, Section, SelectBodyOrDivBlock, Spacer, SpinnerPlusMinus, SpinnerUpDown, Switch, Tabs, Text, ToggleItem, ToggleList, Tooltip, Input };
38
1
  export * from './breakpoints';
39
- export * from './clickable';
2
+ export * from './button';
3
+ export * from './button-group';
4
+ export * from './checkbox';
5
+ export * from './controlled-buttons';
6
+ export * from './divider';
7
+ export * from './iframe';
40
8
  export * from './input';
41
9
  export * from './layout';
10
+ export * from './modal';
11
+ export * from './notification';
12
+ export * from './section';
42
13
  export * from './select';
14
+ export * from './shared';
43
15
  export * from './switch';
44
16
  export * from './text';
45
17
  export * from './tooltip';
46
- export * from './buttons';
18
+ export { default as Loader } from './Loader.svelte';
19
+ export { default as LoadingScreen } from './LoadingScreen.svelte';
@@ -1,46 +1,19 @@
1
- /**
2
- * All Re-usable Components
3
- */
4
- import BreakpointItem from './breakpoints/BreakpointItem.svelte';
5
- import ButtonGroup from './ButtonGroup.svelte';
6
- import Checkbox from './Checkbox.svelte';
7
- import { Clickable } from './clickable';
8
- import Copy from './Copy.svelte';
9
- import CustomModal from './CustomModal.svelte';
10
- import DisableInEditMode from './DisableInEditMode.svelte';
11
- import Divider from './Divider.svelte';
12
- import Header from './Header.svelte';
13
- import Iframe from './Iframe.svelte';
14
- import ImageUpload from './ImageUpload.svelte';
15
- import InjectComponent from './InjectComponent.svelte';
16
- import { Input } from './input';
17
- import { Layout } from './layout';
18
- import Loader from './Loader.svelte';
19
- import LoadingScreen from './LoadingScreen.svelte';
20
- import Modal from './Modal.svelte';
21
- import Navbar from './Navbar.svelte';
22
- import NoSettingsNeeded from './NoSettingsNeeded.svelte';
23
- import Notification from './Notification.svelte';
24
- import PreviewBar from './PreviewBar.svelte';
25
- import ScrollableContent from './ScrollableContent.svelte';
26
- import Section from './Section.svelte';
27
- import SelectBodyOrDivBlock from './SelectBodyOrDivBlock.svelte';
28
- import Spacer from './Spacer.svelte';
29
- import SpinnerPlusMinus from './SpinnerPlusMinus.svelte';
30
- import SpinnerUpDown from './SpinnerUpDown.svelte';
31
- import Switch from './switch/Switch.svelte';
32
- import Tabs from './Tabs.svelte';
33
- import { Text } from './text';
34
- import ToggleItem from './ToggleItem.svelte';
35
- import ToggleList from './ToggleList.svelte';
36
- import { Tooltip } from './tooltip';
37
- export { BreakpointItem, ButtonGroup, Checkbox, Clickable, Copy, CustomModal, DisableInEditMode, Notification, Divider, Header, Iframe, ImageUpload, InjectComponent, Layout, Loader, LoadingScreen, Modal, Navbar, NoSettingsNeeded, PreviewBar, ScrollableContent, Section, SelectBodyOrDivBlock, Spacer, SpinnerPlusMinus, SpinnerUpDown, Switch, Tabs, Text, ToggleItem, ToggleList, Tooltip, Input };
38
1
  export * from './breakpoints';
39
- export * from './clickable';
2
+ export * from './button';
3
+ export * from './button-group';
4
+ export * from './checkbox';
5
+ export * from './controlled-buttons';
6
+ export * from './divider';
7
+ export * from './iframe';
40
8
  export * from './input';
41
9
  export * from './layout';
10
+ export * from './modal';
11
+ export * from './notification';
12
+ export * from './section';
42
13
  export * from './select';
14
+ export * from './shared';
43
15
  export * from './switch';
44
16
  export * from './text';
45
17
  export * from './tooltip';
46
- export * from './buttons';
18
+ export { default as Loader } from './Loader.svelte';
19
+ export { default as LoadingScreen } from './LoadingScreen.svelte';