@getmicdrop/svelte-components 5.7.1 → 5.8.0

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 (46) hide show
  1. package/dist/components/Heading.svelte +2 -1
  2. package/dist/components/Heading.svelte.d.ts +1 -1
  3. package/dist/components/Heading.svelte.d.ts.map +1 -1
  4. package/dist/components/Layout/index.d.ts +0 -1
  5. package/dist/components/Layout/index.js +1 -1
  6. package/dist/components/Text.svelte +15 -2
  7. package/dist/components/Text.svelte.d.ts +2 -1
  8. package/dist/components/Text.svelte.d.ts.map +1 -1
  9. package/dist/patterns/layout/index.d.ts +0 -2
  10. package/dist/patterns/layout/index.js +3 -2
  11. package/dist/primitives/Checkbox/Checkbox.svelte +3 -3
  12. package/dist/stores/auth.js +8 -0
  13. package/dist/stores/auth.svelte.d.ts +39 -0
  14. package/dist/stores/auth.svelte.d.ts.map +1 -0
  15. package/dist/stores/auth.svelte.js +60 -0
  16. package/dist/stores/formDataStore.d.ts.map +1 -1
  17. package/dist/stores/formDataStore.js +8 -0
  18. package/dist/stores/formDataStore.svelte.d.ts +47 -0
  19. package/dist/stores/formDataStore.svelte.d.ts.map +1 -0
  20. package/dist/stores/formDataStore.svelte.js +84 -0
  21. package/dist/stores/formSave.d.ts.map +1 -1
  22. package/dist/stores/formSave.js +8 -0
  23. package/dist/stores/formSave.svelte.d.ts +33 -0
  24. package/dist/stores/formSave.svelte.d.ts.map +1 -0
  25. package/dist/stores/formSave.svelte.js +113 -0
  26. package/dist/stores/navigation.d.ts.map +1 -1
  27. package/dist/stores/navigation.js +8 -0
  28. package/dist/stores/navigation.svelte.d.ts +35 -0
  29. package/dist/stores/navigation.svelte.d.ts.map +1 -0
  30. package/dist/stores/navigation.svelte.js +69 -0
  31. package/package.json +8 -9
  32. package/dist/stores/auth.spec.d.ts +0 -2
  33. package/dist/stores/auth.spec.d.ts.map +0 -1
  34. package/dist/stores/auth.spec.js +0 -139
  35. package/dist/stores/createFormStore.spec.d.ts +0 -2
  36. package/dist/stores/createFormStore.spec.d.ts.map +0 -1
  37. package/dist/stores/createFormStore.spec.js +0 -540
  38. package/dist/stores/formDataStore.spec.d.ts +0 -2
  39. package/dist/stores/formDataStore.spec.d.ts.map +0 -1
  40. package/dist/stores/formDataStore.spec.js +0 -257
  41. package/dist/stores/formSave.spec.d.ts +0 -2
  42. package/dist/stores/formSave.spec.d.ts.map +0 -1
  43. package/dist/stores/formSave.spec.js +0 -296
  44. package/dist/stores/navigation.spec.d.ts +0 -2
  45. package/dist/stores/navigation.spec.d.ts.map +0 -1
  46. package/dist/stores/navigation.spec.js +0 -136
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Navigation store using Svelte 5 runes
3
+ * Tracks navigation state and page context
4
+ */
5
+ // State using Svelte 5 runes
6
+ let isSubPageState = $state(false);
7
+ let hideHeaderBackButtonState = $state(false);
8
+ let selectedVenueDataState = $state(null);
9
+ let isAnimatedNavigationState = $state(false);
10
+ /**
11
+ * Whether the current page is a sub-page (for header back button display)
12
+ */
13
+ export const isSubPage = {
14
+ get value() {
15
+ return isSubPageState;
16
+ },
17
+ set value(val) {
18
+ isSubPageState = val;
19
+ },
20
+ set(val) {
21
+ isSubPageState = val;
22
+ },
23
+ };
24
+ /**
25
+ * Pages can set this to true to hide the header back button
26
+ * (e.g., when they have their own)
27
+ */
28
+ export const hideHeaderBackButton = {
29
+ get value() {
30
+ return hideHeaderBackButtonState;
31
+ },
32
+ set value(val) {
33
+ hideHeaderBackButtonState = val;
34
+ },
35
+ set(val) {
36
+ hideHeaderBackButtonState = val;
37
+ },
38
+ };
39
+ /**
40
+ * Store venue data when navigating to calendar to avoid re-fetching
41
+ */
42
+ export const selectedVenueData = {
43
+ get value() {
44
+ return selectedVenueDataState;
45
+ },
46
+ set value(data) {
47
+ selectedVenueDataState = data;
48
+ },
49
+ set(data) {
50
+ selectedVenueDataState = data;
51
+ },
52
+ reset() {
53
+ selectedVenueDataState = null;
54
+ },
55
+ };
56
+ /**
57
+ * Flag to indicate we're doing an animated navigation (not a refresh/direct load)
58
+ */
59
+ export const isAnimatedNavigation = {
60
+ get value() {
61
+ return isAnimatedNavigationState;
62
+ },
63
+ set value(val) {
64
+ isAnimatedNavigationState = val;
65
+ },
66
+ set(val) {
67
+ isAnimatedNavigationState = val;
68
+ },
69
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmicdrop/svelte-components",
3
- "version": "5.7.1",
3
+ "version": "5.8.0",
4
4
  "description": "Shared component library for Micdrop applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -247,14 +247,15 @@
247
247
  "@storybook/addon-links": "^8.6.15",
248
248
  "@storybook/addon-svelte-csf": "^5.0.10",
249
249
  "@storybook/blocks": "^8.6.15",
250
- "@storybook/svelte": "^8.6.15",
251
- "@storybook/sveltekit": "^8.6.15",
250
+ "@storybook/svelte": "^10.1.11",
251
+ "@storybook/sveltekit": "^10.1.11",
252
252
  "@storybook/test": "^8.6.15",
253
253
  "@sveltejs/adapter-auto": "^3.2.2",
254
- "@sveltejs/kit": "^2.49.4",
254
+ "@sveltejs/kit": "^2.50.0",
255
255
  "@sveltejs/package": "^2.5.7",
256
- "@sveltejs/vite-plugin-svelte": "^5.1.1",
256
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
257
257
  "@tailwindcss/forms": "^0.5.11",
258
+ "@tailwindcss/vite": "^4.0.0",
258
259
  "@testing-library/jest-dom": "^6.4.6",
259
260
  "@testing-library/svelte": "^5.2.0",
260
261
  "@types/cookie": "^1.0.0",
@@ -263,7 +264,6 @@
263
264
  "@vitest/coverage-istanbul": "^4.0.16",
264
265
  "@vitest/coverage-v8": "^4.0.16",
265
266
  "@vitest/ui": "^4.0.16",
266
- "autoprefixer": "^10.4.19",
267
267
  "chromatic": "^13.3.4",
268
268
  "cypress": "^15.1.0",
269
269
  "eslint": "^9.7.0",
@@ -271,17 +271,16 @@
271
271
  "globals": "^17.0.0",
272
272
  "husky": "^9.1.7",
273
273
  "jsdom": "^24.1.1",
274
- "postcss": "^8.4.39",
275
274
  "prettier": "^3.3.3",
276
275
  "prettier-plugin-svelte": "^3.2.6",
277
276
  "start-server-and-test": "^2.0.13",
278
277
  "storybook": "^8.6.15",
279
278
  "svelte": "^5.46.1",
280
279
  "svelte-check": "^3.8.4",
281
- "tailwindcss": "^3.4.6",
280
+ "tailwindcss": "^4.0.0",
282
281
  "typescript": "^5.9.3",
283
282
  "typescript-eslint": "^8.52.0",
284
- "vite": "^6.4.1",
283
+ "vite": "^7.0.0",
285
284
  "vite-plugin-istanbul": "^7.2.1",
286
285
  "vitest": "^4.0.16"
287
286
  },
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=auth.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.spec.d.ts","sourceRoot":"","sources":["../../src/lib/stores/auth.spec.js"],"names":[],"mappings":""}
@@ -1,139 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { get } from 'svelte/store';
3
- import { auth, setAuthState, clearAuthState, initializeAuthState } from './auth';
4
-
5
- describe('auth store', () => {
6
- beforeEach(() => {
7
- // Reset auth state before each test
8
- clearAuthState();
9
- // Clear cookies
10
- Object.defineProperty(document, 'cookie', {
11
- writable: true,
12
- value: '',
13
- });
14
- });
15
-
16
- describe('initial state', () => {
17
- it('starts with isAuthenticated as false', () => {
18
- expect(get(auth).isAuthenticated).toBe(false);
19
- });
20
-
21
- it('starts with token as null', () => {
22
- expect(get(auth).token).toBe(null);
23
- });
24
-
25
- it('starts with userDetails as null', () => {
26
- expect(get(auth).userDetails).toBe(null);
27
- });
28
- });
29
-
30
- describe('setAuthState', () => {
31
- it('sets authentication state', () => {
32
- setAuthState({
33
- isAuthenticated: true,
34
- token: 'test-token',
35
- userDetails: { email: 'test@test.com' },
36
- });
37
-
38
- const state = get(auth);
39
- expect(state.isAuthenticated).toBe(true);
40
- expect(state.token).toBe('test-token');
41
- expect(state.userDetails).toEqual({ email: 'test@test.com' });
42
- });
43
-
44
- it('can update partial state', () => {
45
- setAuthState({ isAuthenticated: true, token: 'token1', userDetails: null });
46
- setAuthState({ isAuthenticated: true, token: 'token2', userDetails: { name: 'User' } });
47
-
48
- const state = get(auth);
49
- expect(state.token).toBe('token2');
50
- expect(state.userDetails).toEqual({ name: 'User' });
51
- });
52
- });
53
-
54
- describe('clearAuthState', () => {
55
- it('clears authentication state', () => {
56
- setAuthState({
57
- isAuthenticated: true,
58
- token: 'test-token',
59
- userDetails: { email: 'test@test.com' },
60
- });
61
-
62
- clearAuthState();
63
-
64
- const state = get(auth);
65
- expect(state.isAuthenticated).toBe(false);
66
- expect(state.token).toBe(null);
67
- expect(state.userDetails).toBe(null);
68
- });
69
- });
70
-
71
- describe('initializeAuthState', () => {
72
- it('does nothing when no performer_token cookie exists', () => {
73
- Object.defineProperty(document, 'cookie', {
74
- writable: true,
75
- value: '',
76
- });
77
-
78
- initializeAuthState();
79
-
80
- const state = get(auth);
81
- expect(state.isAuthenticated).toBe(false);
82
- });
83
-
84
- it('sets auth state from performer_token cookie', () => {
85
- Object.defineProperty(document, 'cookie', {
86
- writable: true,
87
- value: 'performer_token=my-token',
88
- });
89
-
90
- initializeAuthState();
91
-
92
- const state = get(auth);
93
- expect(state.isAuthenticated).toBe(true);
94
- expect(state.token).toBe('my-token');
95
- });
96
-
97
- it('parses userDetails cookie when present', () => {
98
- const userDetails = JSON.stringify({ email: 'test@test.com', firstName: 'Test' });
99
- Object.defineProperty(document, 'cookie', {
100
- writable: true,
101
- value: `performer_token=my-token; userDetails=${encodeURIComponent(userDetails)}`,
102
- });
103
-
104
- initializeAuthState();
105
-
106
- const state = get(auth);
107
- expect(state.userDetails).toEqual({ email: 'test@test.com', firstName: 'Test' });
108
- });
109
-
110
- it('handles missing userDetails cookie', () => {
111
- Object.defineProperty(document, 'cookie', {
112
- writable: true,
113
- value: 'performer_token=my-token',
114
- });
115
-
116
- initializeAuthState();
117
-
118
- const state = get(auth);
119
- expect(state.isAuthenticated).toBe(true);
120
- expect(state.userDetails).toBe(null);
121
- });
122
- });
123
-
124
- describe('store subscription', () => {
125
- it('can subscribe to auth changes', () => {
126
- const values = [];
127
- const unsubscribe = auth.subscribe((value) => {
128
- values.push(value.isAuthenticated);
129
- });
130
-
131
- setAuthState({ isAuthenticated: true, token: 'token', userDetails: null });
132
- clearAuthState();
133
-
134
- unsubscribe();
135
-
136
- expect(values).toEqual([false, true, false]);
137
- });
138
- });
139
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createFormStore.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createFormStore.spec.d.ts","sourceRoot":"","sources":["../../src/lib/stores/createFormStore.spec.js"],"names":[],"mappings":""}