@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,200 @@
1
+ <script lang="ts">
2
+ import type { Router } from '../../router.svelte';
3
+
4
+ interface Props {
5
+ params: Record<string, string>;
6
+ location: {
7
+ pathname: string;
8
+ search: string;
9
+ hash?: string;
10
+ params: Record<string, string>;
11
+ };
12
+ router: Router;
13
+ }
14
+
15
+ let { params, location, router }: Props = $props();
16
+ </script>
17
+
18
+ <div class="home-page">
19
+ <div class="hero-section">
20
+ <h1>Welcome to Our Application</h1>
21
+ <p class="lead">
22
+ This is the home page demonstrating the custom Svelte 5 router implementation.
23
+ </p>
24
+
25
+ <div class="cta-buttons">
26
+ <button class="btn btn-primary" onclick={() => router.navigate('/about')}>
27
+ Learn More About Us
28
+ </button>
29
+ <button class="btn btn-secondary" onclick={() => router.navigate('/about/team')}>
30
+ Meet Our Team
31
+ </button>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="features-section">
36
+ <h2>Router Features</h2>
37
+ <div class="features-grid">
38
+ <div class="feature-card">
39
+ <h3>🚀 Svelte 5 Runes</h3>
40
+ <p>Built with modern Svelte 5 reactivity using $state, $derived, and $effect.</p>
41
+ </div>
42
+ <div class="feature-card">
43
+ <h3>🔗 Dynamic Routing</h3>
44
+ <p>Support for parameterized routes like <code>/about/:section</code>.</p>
45
+ </div>
46
+ <div class="feature-card">
47
+ <h3>📍 Active States</h3>
48
+ <p>Automatic active link detection with customizable CSS classes.</p>
49
+ </div>
50
+ <div class="feature-card">
51
+ <h3>🔄 History Management</h3>
52
+ <p>Built-in browser history support with back/forward navigation.</p>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="debug-section">
58
+ <h3>Route Debug Information</h3>
59
+ <div class="debug-info">
60
+ <p><strong>Current Path:</strong> {location?.pathname}</p>
61
+ <p><strong>Parameters:</strong> {JSON.stringify(params)}</p>
62
+ <p><strong>Search Query:</strong> {location?.search || 'None'}</p>
63
+ <p><strong>Hash:</strong> {location?.hash || 'None'}</p>
64
+ </div>
65
+ </div>
66
+ </div>
67
+
68
+ <style>
69
+ .home-page {
70
+ max-width: 100%;
71
+ }
72
+
73
+ .hero-section {
74
+ text-align: center;
75
+ margin-bottom: 3rem;
76
+ }
77
+
78
+ .hero-section h1 {
79
+ font-size: 2.5rem;
80
+ color: #2c3e50;
81
+ margin: 0 0 1rem 0;
82
+ font-weight: 600;
83
+ }
84
+
85
+ .lead {
86
+ font-size: 1.25rem;
87
+ color: #6c757d;
88
+ margin: 0 0 2rem 0;
89
+ line-height: 1.6;
90
+ }
91
+
92
+ .cta-buttons {
93
+ display: flex;
94
+ gap: 1rem;
95
+ justify-content: center;
96
+ flex-wrap: wrap;
97
+ }
98
+
99
+ .btn {
100
+ padding: 0.75rem 1.5rem;
101
+ border: none;
102
+ border-radius: 6px;
103
+ font-size: 1rem;
104
+ font-weight: 500;
105
+ cursor: pointer;
106
+ transition: all 0.2s ease;
107
+ text-decoration: none;
108
+ display: inline-block;
109
+ }
110
+
111
+ .btn-primary {
112
+ background: #007bff;
113
+ color: white;
114
+ }
115
+
116
+ .btn-primary:hover {
117
+ background: #0056b3;
118
+ transform: translateY(-1px);
119
+ }
120
+
121
+ .btn-secondary {
122
+ background: #6c757d;
123
+ color: white;
124
+ }
125
+
126
+ .btn-secondary:hover {
127
+ background: #545b62;
128
+ transform: translateY(-1px);
129
+ }
130
+
131
+ .features-section {
132
+ margin-bottom: 3rem;
133
+ }
134
+
135
+ .features-section h2 {
136
+ text-align: center;
137
+ color: #2c3e50;
138
+ margin-bottom: 2rem;
139
+ font-size: 2rem;
140
+ }
141
+
142
+ .features-grid {
143
+ display: grid;
144
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
145
+ gap: 1.5rem;
146
+ }
147
+
148
+ .feature-card {
149
+ padding: 1.5rem;
150
+ border: 1px solid #e1e5e9;
151
+ border-radius: 8px;
152
+ background: #f8f9fa;
153
+ text-align: center;
154
+ }
155
+
156
+ .feature-card h3 {
157
+ font-size: 1.25rem;
158
+ margin: 0 0 1rem 0;
159
+ color: #2c3e50;
160
+ }
161
+
162
+ .feature-card p {
163
+ margin: 0;
164
+ color: #6c757d;
165
+ line-height: 1.5;
166
+ }
167
+
168
+ .feature-card code {
169
+ background: #e9ecef;
170
+ padding: 0.2rem 0.4rem;
171
+ border-radius: 3px;
172
+ font-family: 'SFMono-Regular', Consolas, monospace;
173
+ font-size: 0.875rem;
174
+ color: #e83e8c;
175
+ }
176
+
177
+ .debug-section {
178
+ background: #f8f9fa;
179
+ border: 1px solid #e1e5e9;
180
+ border-radius: 8px;
181
+ padding: 1.5rem;
182
+ }
183
+
184
+ .debug-section h3 {
185
+ margin: 0 0 1rem 0;
186
+ color: #2c3e50;
187
+ font-size: 1.125rem;
188
+ }
189
+
190
+ .debug-info p {
191
+ margin: 0.5rem 0;
192
+ font-family: 'SFMono-Regular', Consolas, monospace;
193
+ font-size: 0.875rem;
194
+ color: #495057;
195
+ }
196
+
197
+ .debug-info strong {
198
+ color: #2c3e50;
199
+ }
200
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Router } from '../../router.svelte';
2
+ interface Props {
3
+ params: Record<string, string>;
4
+ location: {
5
+ pathname: string;
6
+ search: string;
7
+ hash?: string;
8
+ params: Record<string, string>;
9
+ };
10
+ router: Router;
11
+ }
12
+ declare const HomePage: import("svelte").Component<Props, {}, "">;
13
+ type HomePage = ReturnType<typeof HomePage>;
14
+ export default HomePage;
@@ -0,0 +1,307 @@
1
+ <script lang="ts">
2
+ import type { Router } from '../../router.svelte';
3
+
4
+ interface Props {
5
+ params: Record<string, string>;
6
+ location: {
7
+ pathname: string;
8
+ search: string;
9
+ hash?: string;
10
+ params: Record<string, string>;
11
+ url?: { href: string };
12
+ };
13
+ router: Router;
14
+ }
15
+
16
+ let { params, location, router }: Props = $props();
17
+ </script>
18
+
19
+ <div class="not-found-page">
20
+ <div class="error-content">
21
+ <div class="error-icon">🔍</div>
22
+ <h1>404 - Page Not Found</h1>
23
+ <p class="error-message">
24
+ Oops! The page you're looking for doesn't exist. It might have been moved, deleted, or you
25
+ entered the wrong URL.
26
+ </p>
27
+
28
+ <div class="error-details">
29
+ <p><strong>Requested path:</strong> <code>{location?.pathname}</code></p>
30
+ {#if location?.search}
31
+ <p><strong>Query string:</strong> <code>{location.search}</code></p>
32
+ {/if}
33
+ </div>
34
+
35
+ <div class="action-buttons">
36
+ <button class="btn btn-primary" onclick={() => router.navigate('/')}> 🏠 Go Home </button>
37
+ <button class="btn btn-secondary" onclick={() => router.back()}> ← Go Back </button>
38
+ <button class="btn btn-outline" onclick={() => router.navigate('/about')}>
39
+ 📖 About Us
40
+ </button>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="suggestions">
45
+ <h2>What can you do?</h2>
46
+ <div class="suggestions-grid">
47
+ <div class="suggestion-card">
48
+ <div class="suggestion-icon">🏠</div>
49
+ <h3>Go to Homepage</h3>
50
+ <p>Start fresh from our main page and explore our features.</p>
51
+ <button onclick={() => router.navigate('/')}> Visit Homepage </button>
52
+ </div>
53
+
54
+ <div class="suggestion-card">
55
+ <div class="suggestion-icon">👥</div>
56
+ <h3>Meet Our Team</h3>
57
+ <p>Learn about the people behind our amazing products.</p>
58
+ <button onclick={() => router.navigate('/about/team')}> View Team </button>
59
+ </div>
60
+
61
+ <div class="suggestion-card">
62
+ <div class="suggestion-icon">📈</div>
63
+ <h3>Our Story</h3>
64
+ <p>Discover how we became leaders in our industry.</p>
65
+ <button onclick={() => router.navigate('/about/history')}> Read Our History </button>
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="debug-section">
71
+ <h3>Route Debug Information</h3>
72
+ <div class="debug-info">
73
+ <p><strong>Current Path:</strong> {location?.pathname}</p>
74
+ <p><strong>Parameters:</strong> {JSON.stringify(params)}</p>
75
+ <p><strong>Search Query:</strong> {location?.search || 'None'}</p>
76
+ <p><strong>Hash:</strong> {location?.hash || 'None'}</p>
77
+ <p><strong>Full URL:</strong> {location?.url?.href || 'Unknown'}</p>
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ <style>
83
+ .not-found-page {
84
+ max-width: 100%;
85
+ text-align: center;
86
+ }
87
+
88
+ .error-content {
89
+ margin-bottom: 4rem;
90
+ }
91
+
92
+ .error-icon {
93
+ font-size: 5rem;
94
+ margin-bottom: 1rem;
95
+ opacity: 0.7;
96
+ }
97
+
98
+ .error-content h1 {
99
+ font-size: 3rem;
100
+ color: #e74c3c;
101
+ margin: 0 0 1rem 0;
102
+ font-weight: 600;
103
+ }
104
+
105
+ .error-message {
106
+ font-size: 1.25rem;
107
+ color: #6c757d;
108
+ margin: 0 0 2rem 0;
109
+ line-height: 1.6;
110
+ max-width: 600px;
111
+ margin-left: auto;
112
+ margin-right: auto;
113
+ }
114
+
115
+ .error-details {
116
+ background: #f8f9fa;
117
+ border: 1px solid #e1e5e9;
118
+ border-radius: 8px;
119
+ padding: 1.5rem;
120
+ margin: 2rem auto;
121
+ max-width: 500px;
122
+ text-align: left;
123
+ }
124
+
125
+ .error-details p {
126
+ margin: 0.5rem 0;
127
+ color: #495057;
128
+ font-size: 0.9rem;
129
+ }
130
+
131
+ .error-details code {
132
+ background: #e9ecef;
133
+ padding: 0.2rem 0.4rem;
134
+ border-radius: 3px;
135
+ font-family: 'SFMono-Regular', Consolas, monospace;
136
+ color: #e83e8c;
137
+ font-size: 0.875rem;
138
+ }
139
+
140
+ .action-buttons {
141
+ display: flex;
142
+ gap: 1rem;
143
+ justify-content: center;
144
+ flex-wrap: wrap;
145
+ margin-top: 2rem;
146
+ }
147
+
148
+ .btn {
149
+ padding: 0.75rem 1.5rem;
150
+ border: none;
151
+ border-radius: 6px;
152
+ font-size: 1rem;
153
+ font-weight: 500;
154
+ cursor: pointer;
155
+ transition: all 0.2s ease;
156
+ text-decoration: none;
157
+ display: inline-block;
158
+ }
159
+
160
+ .btn-primary {
161
+ background: #007bff;
162
+ color: white;
163
+ }
164
+
165
+ .btn-primary:hover {
166
+ background: #0056b3;
167
+ transform: translateY(-1px);
168
+ }
169
+
170
+ .btn-secondary {
171
+ background: #6c757d;
172
+ color: white;
173
+ }
174
+
175
+ .btn-secondary:hover {
176
+ background: #545b62;
177
+ transform: translateY(-1px);
178
+ }
179
+
180
+ .btn-outline {
181
+ background: transparent;
182
+ color: #007bff;
183
+ border: 2px solid #007bff;
184
+ }
185
+
186
+ .btn-outline:hover {
187
+ background: #007bff;
188
+ color: white;
189
+ transform: translateY(-1px);
190
+ }
191
+
192
+ .suggestions {
193
+ margin-bottom: 3rem;
194
+ }
195
+
196
+ .suggestions h2 {
197
+ color: #2c3e50;
198
+ margin-bottom: 2rem;
199
+ font-size: 2rem;
200
+ }
201
+
202
+ .suggestions-grid {
203
+ display: grid;
204
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
205
+ gap: 1.5rem;
206
+ text-align: center;
207
+ }
208
+
209
+ .suggestion-card {
210
+ padding: 2rem;
211
+ border: 1px solid #e1e5e9;
212
+ border-radius: 12px;
213
+ background: white;
214
+ transition: all 0.3s ease;
215
+ }
216
+
217
+ .suggestion-card:hover {
218
+ transform: translateY(-2px);
219
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
220
+ border-color: #007bff;
221
+ }
222
+
223
+ .suggestion-icon {
224
+ font-size: 2.5rem;
225
+ margin-bottom: 1rem;
226
+ }
227
+
228
+ .suggestion-card h3 {
229
+ font-size: 1.25rem;
230
+ color: #2c3e50;
231
+ margin: 0 0 1rem 0;
232
+ }
233
+
234
+ .suggestion-card p {
235
+ color: #6c757d;
236
+ margin: 0 0 1.5rem 0;
237
+ line-height: 1.5;
238
+ font-size: 0.9rem;
239
+ }
240
+
241
+ .suggestion-card button {
242
+ padding: 0.5rem 1rem;
243
+ border: 1px solid #007bff;
244
+ border-radius: 4px;
245
+ background: white;
246
+ color: #007bff;
247
+ cursor: pointer;
248
+ font-size: 0.875rem;
249
+ transition: all 0.2s ease;
250
+ }
251
+
252
+ .suggestion-card button:hover {
253
+ background: #007bff;
254
+ color: white;
255
+ }
256
+
257
+ .debug-section {
258
+ background: #f8f9fa;
259
+ border: 1px solid #e1e5e9;
260
+ border-radius: 8px;
261
+ padding: 1.5rem;
262
+ text-align: left;
263
+ max-width: 600px;
264
+ margin: 0 auto;
265
+ }
266
+
267
+ .debug-section h3 {
268
+ margin: 0 0 1rem 0;
269
+ color: #2c3e50;
270
+ font-size: 1.125rem;
271
+ text-align: center;
272
+ }
273
+
274
+ .debug-info p {
275
+ margin: 0.5rem 0;
276
+ font-family: 'SFMono-Regular', Consolas, monospace;
277
+ font-size: 0.875rem;
278
+ color: #495057;
279
+ }
280
+
281
+ .debug-info strong {
282
+ color: #2c3e50;
283
+ }
284
+
285
+ @media (max-width: 768px) {
286
+ .error-content h1 {
287
+ font-size: 2rem;
288
+ }
289
+
290
+ .error-icon {
291
+ font-size: 3rem;
292
+ }
293
+
294
+ .action-buttons {
295
+ flex-direction: column;
296
+ align-items: center;
297
+ }
298
+
299
+ .btn {
300
+ width: 200px;
301
+ }
302
+
303
+ .suggestions-grid {
304
+ grid-template-columns: 1fr;
305
+ }
306
+ }
307
+ </style>
@@ -0,0 +1,17 @@
1
+ import type { Router } from '../../router.svelte';
2
+ interface Props {
3
+ params: Record<string, string>;
4
+ location: {
5
+ pathname: string;
6
+ search: string;
7
+ hash?: string;
8
+ params: Record<string, string>;
9
+ url?: {
10
+ href: string;
11
+ };
12
+ };
13
+ router: Router;
14
+ }
15
+ declare const NotFoundPage: import("svelte").Component<Props, {}, "">;
16
+ type NotFoundPage = ReturnType<typeof NotFoundPage>;
17
+ export default NotFoundPage;
@@ -1,4 +1,4 @@
1
- import type { LocationInfo, RouteConfig, RouteParams, Router } from './index.svelte';
1
+ import type { LocationInfo, RouteConfig, RouteParams, Router } from './router.svelte';
2
2
  /**
3
3
  * Get the router instance from context
4
4
  */
@@ -26,7 +26,7 @@ export declare function useNavigating(): boolean;
26
26
  /**
27
27
  * Get reactive navigation history
28
28
  */
29
- export declare function useHistory(): import("./index.svelte").HistoryEntry[];
29
+ export declare function useHistory(): import("./router.svelte").HistoryEntry[];
30
30
  /**
31
31
  * Get a navigation function
32
32
  */
@@ -0,0 +1,3 @@
1
+ export * from './router.svelte';
2
+ export * from './hooks.svelte';
3
+ export * from './providers';
@@ -0,0 +1,3 @@
1
+ export * from './router.svelte';
2
+ export * from './hooks.svelte';
3
+ export * from './providers';
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, type Snippet } from 'svelte';
3
3
 
4
- import type { Router } from './index.svelte.js';
4
+ import type { Router } from '../router.svelte';
5
5
 
6
6
  interface Props {
7
7
  /** The path to navigate to */
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onMount, type Snippet } from 'svelte';
3
3
 
4
- import type { RouteConfig, Router } from './index.svelte.js';
4
+ import type { RouteConfig, Router } from '../router.svelte';
5
5
 
6
6
  interface Props {
7
7
  /** The path pattern for this route (supports parameters like :id) */
@@ -1,5 +1,5 @@
1
1
  import { type Snippet } from 'svelte';
2
- import type { Router } from './index.svelte.js';
2
+ import type { Router } from '../router.svelte';
3
3
  interface Props {
4
4
  /** The path pattern for this route (supports parameters like :id) */
5
5
  path: string;
@@ -1,13 +1,18 @@
1
1
  <script lang="ts">
2
2
  import { onDestroy, onMount, setContext, type Snippet } from 'svelte';
3
3
 
4
- import type { RouteConfig, Router } from './index.svelte';
4
+ import type { RouteConfig, Router } from '../router.svelte';
5
+ import { LoadingScreen } from '../../ui';
5
6
 
6
7
  interface Props {
7
8
  /** Router instance to use for routing */
8
9
  router: Router;
9
10
  /** Whether to automatically initialize the router */
10
11
  autoInit?: boolean;
12
+ /** Whether to show a loading screen */
13
+ loading?: boolean;
14
+ /** Message to display in the loading screen */
15
+ loadingMessage?: string;
11
16
  /** Children snippet */
12
17
  children?: Snippet<
13
18
  [
@@ -22,7 +27,13 @@
22
27
  >;
23
28
  }
24
29
 
25
- let { router, autoInit = true, children }: Props = $props();
30
+ let {
31
+ router,
32
+ autoInit = true,
33
+ loading = false,
34
+ loadingMessage = 'Loading...',
35
+ children
36
+ }: Props = $props();
26
37
 
27
38
  // Reactive state from router
28
39
  let currentRoute = $state<RouteConfig | null>(null);
@@ -51,7 +62,11 @@
51
62
  });
52
63
  </script>
53
64
 
54
- <div class="router-container" class:navigating={isNavigating}>
65
+ {#if loading}
66
+ <LoadingScreen active={loading} message={loadingMessage} position="fixed" />
67
+ {/if}
68
+
69
+ <div class="router-container" class:loading class:navigating={isNavigating}>
55
70
  {#if children}
56
71
  {@render children({ router, currentRoute, currentLocation, isNavigating })}
57
72
  {/if}
@@ -63,9 +78,11 @@
63
78
  height: 100%;
64
79
  }
65
80
 
66
- .router-container.navigating {
67
- /* Optional loading styles during navigation */
81
+ .router-container.navigating,
82
+ .router-container.loading {
68
83
  opacity: 0.9;
69
84
  transition: opacity 0.1s ease;
85
+ pointer-events: none;
86
+ cursor: wait;
70
87
  }
71
88
  </style>
@@ -1,10 +1,14 @@
1
1
  import { type Snippet } from 'svelte';
2
- import type { RouteConfig, Router } from './index.svelte';
2
+ import type { RouteConfig, Router } from '../router.svelte';
3
3
  interface Props {
4
4
  /** Router instance to use for routing */
5
5
  router: Router;
6
6
  /** Whether to automatically initialize the router */
7
7
  autoInit?: boolean;
8
+ /** Whether to show a loading screen */
9
+ loading?: boolean;
10
+ /** Message to display in the loading screen */
11
+ loadingMessage?: string;
8
12
  /** Children snippet */
9
13
  children?: Snippet<[
10
14
  {
@@ -15,6 +19,6 @@ interface Props {
15
19
  }
16
20
  ]>;
17
21
  }
18
- declare const Router: import("svelte").Component<Props, {}, "">;
19
- type Router = ReturnType<typeof Router>;
20
- export default Router;
22
+ declare const RouterProvider: import("svelte").Component<Props, {}, "">;
23
+ type RouterProvider = ReturnType<typeof RouterProvider>;
24
+ export default RouterProvider;
@@ -0,0 +1,3 @@
1
+ export { default as Link } from './Link.svelte';
2
+ export { default as Route } from './Route.svelte';
3
+ export { default as RouterProvider } from './RouterProvider.svelte';
@@ -0,0 +1,3 @@
1
+ export { default as Link } from './Link.svelte';
2
+ export { default as Route } from './Route.svelte';
3
+ export { default as RouterProvider } from './RouterProvider.svelte';
@@ -101,7 +101,5 @@ export declare function createRouter(config?: RouterConfig): Router;
101
101
  * Default router instance for convenience
102
102
  */
103
103
  export declare const router: Router;
104
- export { default as Link } from './Link.svelte';
105
- export { default as Route } from './Route.svelte';
106
- export { default as RouterComponent } from './Router.svelte';
107
104
  export * from './hooks.svelte.js';
105
+ export * from './providers/index.js';