@finsweet/webflow-apps-utils 1.0.3 → 1.0.5

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 (116) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/providers/GlobalProvider.stories.d.ts +5 -0
  4. package/dist/providers/GlobalProvider.stories.js +419 -0
  5. package/dist/providers/GlobalProviderDemo.svelte +266 -0
  6. package/dist/providers/GlobalProviderDemo.svelte.d.ts +3 -0
  7. package/dist/providers/configuratorUtils.d.ts +11 -14
  8. package/dist/providers/configuratorUtils.js +68 -115
  9. package/dist/providers/index.d.ts +1 -1
  10. package/dist/providers/index.js +1 -1
  11. package/dist/router/Router.stories.d.ts +6 -0
  12. package/dist/router/Router.stories.js +564 -0
  13. package/dist/router/examples/RouterExample.svelte +271 -0
  14. package/dist/router/examples/RouterExample.svelte.d.ts +18 -0
  15. package/dist/router/examples/index.d.ts +4 -0
  16. package/dist/router/examples/index.js +4 -0
  17. package/dist/router/examples/pages/AboutPage.svelte +568 -0
  18. package/dist/router/examples/pages/AboutPage.svelte.d.ts +13 -0
  19. package/dist/router/examples/pages/HomePage.svelte +200 -0
  20. package/dist/router/examples/pages/HomePage.svelte.d.ts +14 -0
  21. package/dist/router/examples/pages/NotFoundPage.svelte +307 -0
  22. package/dist/router/examples/pages/NotFoundPage.svelte.d.ts +17 -0
  23. package/dist/router/hooks.svelte.d.ts +2 -2
  24. package/dist/router/index.d.ts +3 -0
  25. package/dist/router/index.js +3 -0
  26. package/dist/router/{Link.svelte → providers/Link.svelte} +1 -1
  27. package/dist/router/{Route.svelte → providers/Route.svelte} +1 -1
  28. package/dist/router/{Route.svelte.d.ts → providers/Route.svelte.d.ts} +1 -1
  29. package/dist/router/{Router.svelte → providers/RouterProvider.svelte} +22 -5
  30. package/dist/router/{Router.svelte.d.ts → providers/RouterProvider.svelte.d.ts} +8 -4
  31. package/dist/router/providers/index.d.ts +3 -0
  32. package/dist/router/providers/index.js +3 -0
  33. package/dist/router/{index.svelte.d.ts → router.svelte.d.ts} +1 -3
  34. package/dist/router/{index.svelte.js → router.svelte.js} +1 -4
  35. package/dist/stores/forms/Form.stories.d.ts +5 -0
  36. package/dist/stores/forms/Form.stories.js +342 -0
  37. package/dist/stores/forms/FormDemo.svelte +545 -0
  38. package/dist/stores/forms/FormDemo.svelte.d.ts +18 -0
  39. package/dist/stores/forms.d.ts +41 -4
  40. package/dist/stores/forms.js +86 -32
  41. package/dist/types/customCode.d.ts +1 -1
  42. package/dist/types/window.d.ts +1 -0
  43. package/dist/ui/components/button/Button.svelte +1 -1
  44. package/dist/ui/components/copy-text/CopyText.stories.d.ts +70 -0
  45. package/dist/ui/components/copy-text/CopyText.stories.js +241 -0
  46. package/dist/ui/components/copy-text/CopyText.svelte +247 -0
  47. package/dist/ui/components/copy-text/CopyText.svelte.d.ts +4 -0
  48. package/dist/ui/components/copy-text/index.d.ts +2 -0
  49. package/dist/ui/components/copy-text/index.js +1 -0
  50. package/dist/ui/components/copy-text/types.d.ts +52 -0
  51. package/dist/ui/components/copy-text/types.js +1 -0
  52. package/dist/ui/components/index.d.ts +1 -0
  53. package/dist/ui/components/index.js +1 -0
  54. package/dist/ui/components/input/Input.stories.d.ts +9 -0
  55. package/dist/ui/components/input/Input.stories.js +78 -0
  56. package/dist/ui/components/input/Input.svelte +39 -3
  57. package/dist/ui/components/input/types.d.ts +6 -0
  58. package/dist/ui/components/layout/Layout.svelte +45 -64
  59. package/dist/ui/components/layout/Layout.svelte.d.ts +26 -3
  60. package/dist/ui/components/layout/examples/ExampleLayout.svelte +32 -27
  61. package/dist/ui/components/layout/index.d.ts +1 -1
  62. package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte +20 -0
  63. package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte.d.ts +7 -0
  64. package/dist/ui/components/layout/types.d.ts +1 -10
  65. package/dist/ui/components/notification/Notification.stories.svelte +12 -1
  66. package/dist/ui/components/notification/Notification.svelte +10 -5
  67. package/dist/ui/components/notification/Notification.svelte.d.ts +1 -1
  68. package/dist/ui/components/notification/types.d.ts +1 -1
  69. package/dist/ui/components/section/Section.svelte +8 -4
  70. package/dist/ui/components/section/types.d.ts +8 -0
  71. package/dist/ui/components/text/Text.stories.svelte +67 -1
  72. package/dist/ui/components/text/Text.svelte +209 -8
  73. package/dist/ui/components/text/types.d.ts +4 -0
  74. package/dist/ui/index.css +6 -2
  75. package/dist/utils/animations/factory.d.ts +7 -0
  76. package/dist/utils/animations/factory.js +101 -0
  77. package/dist/utils/animations/index.d.ts +7 -0
  78. package/dist/utils/animations/index.js +62 -0
  79. package/dist/utils/animations/types.d.ts +39 -0
  80. package/dist/utils/animations/types.js +1 -0
  81. package/dist/utils/custom-code/configs.d.ts +22 -0
  82. package/dist/utils/custom-code/configs.js +40 -0
  83. package/dist/utils/custom-code/index.d.ts +1 -0
  84. package/dist/utils/custom-code/index.js +1 -0
  85. package/dist/utils/diff-mapper/DiffMapper.stories.d.ts +5 -0
  86. package/dist/utils/diff-mapper/DiffMapper.stories.js +185 -0
  87. package/dist/utils/diff-mapper/DiffMapperDemo.svelte +351 -0
  88. package/dist/utils/diff-mapper/DiffMapperDemo.svelte.d.ts +18 -0
  89. package/dist/utils/diff-mapper/deepDiffMapper.d.ts +31 -0
  90. package/dist/utils/diff-mapper/deepDiffMapper.js +264 -0
  91. package/dist/utils/diff-mapper/index.d.ts +1 -0
  92. package/dist/utils/diff-mapper/index.js +1 -0
  93. package/dist/utils/helpers/capitalizeFirstLetter.d.ts +4 -0
  94. package/dist/utils/helpers/capitalizeFirstLetter.js +9 -0
  95. package/dist/utils/helpers/getTimeNow.d.ts +4 -0
  96. package/dist/utils/helpers/getTimeNow.js +8 -0
  97. package/dist/utils/helpers/index.d.ts +4 -0
  98. package/dist/utils/helpers/index.js +4 -0
  99. package/dist/utils/helpers/minifyCode.d.ts +10 -0
  100. package/dist/utils/helpers/minifyCode.js +73 -0
  101. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -1
  102. package/dist/utils/helpers/objectsToModuleExports.js +1 -0
  103. package/dist/utils/helpers/toHumanReadableList.d.ts +4 -0
  104. package/dist/utils/helpers/toHumanReadableList.js +11 -0
  105. package/dist/utils/index.d.ts +2 -0
  106. package/dist/utils/index.js +2 -0
  107. package/dist/utils/webflow-canvas/getAllChildren.d.ts +16 -0
  108. package/dist/utils/webflow-canvas/getAllChildren.js +65 -0
  109. package/dist/utils/webflow-canvas/getElementClassList.d.ts +9 -0
  110. package/dist/utils/webflow-canvas/getElementClassList.js +19 -0
  111. package/dist/utils/webflow-canvas/index.d.ts +2 -0
  112. package/dist/utils/webflow-canvas/index.js +2 -0
  113. package/package.json +6 -1
  114. package/dist/providers/GlobalProvider.mdx +0 -322
  115. package/dist/router/README.md +0 -397
  116. /package/dist/router/{Link.svelte.d.ts → providers/Link.svelte.d.ts} +0 -0
@@ -0,0 +1,271 @@
1
+ <script lang="ts">
2
+ import { onMount } from 'svelte';
3
+
4
+ import { Link, Route, RouterProvider } from '../providers';
5
+ import { createRouter } from '../router.svelte';
6
+ import AboutPage from './pages/AboutPage.svelte';
7
+ // Page Components
8
+ import HomePage from './pages/HomePage.svelte';
9
+ import NotFoundPage from './pages/NotFoundPage.svelte';
10
+
11
+ // Create router instance with configuration
12
+ const router = createRouter({
13
+ basePath: '',
14
+ hashMode: false,
15
+ fallbackRoute: '/',
16
+ autoInit: false
17
+ });
18
+
19
+ // Add routes
20
+ router.addRoutes([
21
+ { path: '/', component: HomePage, meta: { title: 'Home' } },
22
+ { path: '/about', component: AboutPage, meta: { title: 'About' } },
23
+ { path: '/about/:section', component: AboutPage, meta: { title: 'About Section' } },
24
+ { path: '*', component: NotFoundPage, meta: { title: 'Not Found' } }
25
+ ]);
26
+
27
+ onMount(() => {
28
+ router.init();
29
+ });
30
+ </script>
31
+
32
+ <div class="router-example">
33
+ <h2>Router Example</h2>
34
+ <p>This example demonstrates the Router component with navigation between pages.</p>
35
+
36
+ <RouterProvider {router}>
37
+ {#snippet children({ router, currentRoute, currentLocation, isNavigating })}
38
+ <div class="app-layout">
39
+ <!-- Navigation -->
40
+ <nav class="navigation">
41
+ <div class="nav-brand">
42
+ <h3>My App</h3>
43
+ </div>
44
+ <ul class="nav-links">
45
+ <li>
46
+ <Link to="/" exact activeClass="active">Home</Link>
47
+ </li>
48
+ <li>
49
+ <Link to="/about" activeClass="active">About</Link>
50
+ </li>
51
+ <li>
52
+ <Link to="/about/team" activeClass="active">About Team</Link>
53
+ </li>
54
+ <li>
55
+ <Link to="/contact" activeClass="active">Contact (404)</Link>
56
+ </li>
57
+ </ul>
58
+ </nav>
59
+
60
+ <!-- Loading indicator -->
61
+ {#if isNavigating}
62
+ <div class="loading-indicator">
63
+ <div class="spinner"></div>
64
+ Navigating...
65
+ </div>
66
+ {/if}
67
+
68
+ <!-- Route information display -->
69
+ <div class="route-info">
70
+ <strong>Current Route:</strong>
71
+ {currentLocation?.pathname || 'None'}<br />
72
+ <strong>Route Title:</strong>
73
+ {currentRoute?.meta?.title || 'Unknown'}<br />
74
+ <strong>Parameters:</strong>
75
+ {JSON.stringify(currentLocation?.params || {})}<br />
76
+ <strong>Query:</strong>
77
+ {currentLocation?.search || 'None'}
78
+ </div>
79
+
80
+ <!-- Main content area -->
81
+ <main class="main-content">
82
+ <!-- Home Route -->
83
+ <Route path="/">
84
+ {#snippet children({ params, location, router, isActive })}
85
+ {#if isActive}
86
+ <HomePage {params} {location} {router} />
87
+ {/if}
88
+ {/snippet}
89
+ </Route>
90
+
91
+ <!-- About Route (with optional section parameter) -->
92
+ <Route path="/about">
93
+ {#snippet children({ params, location, router, isActive })}
94
+ {#if isActive}
95
+ <AboutPage {params} {location} {router} />
96
+ {/if}
97
+ {/snippet}
98
+ </Route>
99
+
100
+ <!-- About with section parameter -->
101
+ <Route path="/about/:section">
102
+ {#snippet children({ params, location, router, isActive })}
103
+ {#if isActive}
104
+ <AboutPage {params} {location} {router} />
105
+ {/if}
106
+ {/snippet}
107
+ </Route>
108
+
109
+ <!-- Fallback route (404) -->
110
+ <Route path="*" exact={false}>
111
+ {#snippet children({ params, location, router, isActive })}
112
+ {#if isActive && !router.isActive('/') && !router.isActive('/about')}
113
+ <NotFoundPage {params} {location} {router} />
114
+ {/if}
115
+ {/snippet}
116
+ </Route>
117
+ </main>
118
+
119
+ <!-- Router controls -->
120
+ <div class="router-controls">
121
+ <h4>Router Controls</h4>
122
+ <div class="controls-grid">
123
+ <button onclick={() => router.navigate('/')}> Go Home </button>
124
+ <button onclick={() => router.navigate('/about')}> Go to About </button>
125
+ <button onclick={() => router.navigate('/about/team')}> Go to Team </button>
126
+ <button onclick={() => router.back()}> ← Back </button>
127
+ <button onclick={() => router.forward()}> Forward → </button>
128
+ <button onclick={() => router.navigate('/random-page')}> 404 Page </button>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ {/snippet}
133
+ </RouterProvider>
134
+ </div>
135
+
136
+ <style>
137
+ .router-example {
138
+ width: 100%;
139
+ max-width: 800px;
140
+ margin: 0 auto;
141
+ padding: 1rem;
142
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
143
+ }
144
+
145
+ .app-layout {
146
+ border: 1px solid #e1e5e9;
147
+ border-radius: 8px;
148
+ overflow: hidden;
149
+ background: white;
150
+ }
151
+
152
+ .navigation {
153
+ display: flex;
154
+ align-items: center;
155
+ justify-content: space-between;
156
+ padding: 1rem 1.5rem;
157
+ background: #f8f9fa;
158
+ border-bottom: 1px solid #e1e5e9;
159
+ }
160
+
161
+ .nav-brand h3 {
162
+ margin: 0;
163
+ color: #2c3e50;
164
+ }
165
+
166
+ .nav-links {
167
+ display: flex;
168
+ list-style: none;
169
+ margin: 0;
170
+ padding: 0;
171
+ gap: 1rem;
172
+ }
173
+
174
+ .nav-links :global(a) {
175
+ padding: 0.5rem 1rem;
176
+ text-decoration: none;
177
+ color: #6c757d;
178
+ border-radius: 4px;
179
+ transition: all 0.2s ease;
180
+ }
181
+
182
+ .nav-links :global(a:hover) {
183
+ background: #e9ecef;
184
+ color: #495057;
185
+ }
186
+
187
+ .nav-links :global(a.active) {
188
+ background: #007bff;
189
+ color: white;
190
+ }
191
+
192
+ .loading-indicator {
193
+ display: flex;
194
+ align-items: center;
195
+ gap: 0.5rem;
196
+ padding: 0.75rem 1.5rem;
197
+ background: #fff3cd;
198
+ border-bottom: 1px solid #ffeaa7;
199
+ color: #856404;
200
+ font-size: 0.875rem;
201
+ }
202
+
203
+ .spinner {
204
+ width: 16px;
205
+ height: 16px;
206
+ border: 2px solid #ffeaa7;
207
+ border-top: 2px solid #856404;
208
+ border-radius: 50%;
209
+ animation: spin 1s linear infinite;
210
+ }
211
+
212
+ @keyframes spin {
213
+ 0% {
214
+ transform: rotate(0deg);
215
+ }
216
+ 100% {
217
+ transform: rotate(360deg);
218
+ }
219
+ }
220
+
221
+ .route-info {
222
+ padding: 1rem 1.5rem;
223
+ background: #f8f9fa;
224
+ border-bottom: 1px solid #e1e5e9;
225
+ font-size: 0.875rem;
226
+ color: #6c757d;
227
+ line-height: 1.5;
228
+ }
229
+
230
+ .main-content {
231
+ min-height: 300px;
232
+ padding: 2rem 1.5rem;
233
+ }
234
+
235
+ .router-controls {
236
+ padding: 1.5rem;
237
+ background: #f8f9fa;
238
+ border-top: 1px solid #e1e5e9;
239
+ }
240
+
241
+ .router-controls h4 {
242
+ margin: 0 0 1rem 0;
243
+ color: #2c3e50;
244
+ }
245
+
246
+ .controls-grid {
247
+ display: grid;
248
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
249
+ gap: 0.5rem;
250
+ }
251
+
252
+ .controls-grid button {
253
+ padding: 0.5rem 1rem;
254
+ border: 1px solid #ddd;
255
+ border-radius: 4px;
256
+ background: white;
257
+ color: #495057;
258
+ cursor: pointer;
259
+ font-size: 0.875rem;
260
+ transition: all 0.2s ease;
261
+ }
262
+
263
+ .controls-grid button:hover {
264
+ background: #f8f9fa;
265
+ border-color: #adb5bd;
266
+ }
267
+
268
+ .controls-grid button:active {
269
+ background: #e9ecef;
270
+ }
271
+ </style>
@@ -0,0 +1,18 @@
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: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const RouterExample: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type RouterExample = InstanceType<typeof RouterExample>;
18
+ export default RouterExample;
@@ -0,0 +1,4 @@
1
+ export { default as RouterExample } from './RouterExample.svelte';
2
+ export { default as HomePage } from './pages/HomePage.svelte';
3
+ export { default as AboutPage } from './pages/AboutPage.svelte';
4
+ export { default as NotFoundPage } from './pages/NotFoundPage.svelte';
@@ -0,0 +1,4 @@
1
+ export { default as RouterExample } from './RouterExample.svelte';
2
+ export { default as HomePage } from './pages/HomePage.svelte';
3
+ export { default as AboutPage } from './pages/AboutPage.svelte';
4
+ export { default as NotFoundPage } from './pages/NotFoundPage.svelte';