@contractspec/example.learning-journey-ui-gamified 3.7.6 → 3.7.7

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 (56) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/AGENTS.md +50 -25
  3. package/README.md +63 -20
  4. package/dist/GamifiedMiniApp.js +246 -246
  5. package/dist/browser/GamifiedMiniApp.js +246 -246
  6. package/dist/browser/components/DayCalendar.js +1 -1
  7. package/dist/browser/components/FlashCard.js +6 -6
  8. package/dist/browser/components/MasteryRing.js +1 -1
  9. package/dist/browser/components/index.js +100 -100
  10. package/dist/browser/index.js +247 -246
  11. package/dist/browser/views/Overview.js +16 -16
  12. package/dist/browser/views/Progress.js +7 -7
  13. package/dist/browser/views/Steps.js +8 -8
  14. package/dist/browser/views/Timeline.js +8 -8
  15. package/dist/browser/views/index.js +242 -242
  16. package/dist/components/DayCalendar.js +1 -1
  17. package/dist/components/FlashCard.js +6 -6
  18. package/dist/components/MasteryRing.js +1 -1
  19. package/dist/components/index.d.ts +1 -1
  20. package/dist/components/index.js +100 -100
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +247 -246
  23. package/dist/node/GamifiedMiniApp.js +246 -246
  24. package/dist/node/components/DayCalendar.js +1 -1
  25. package/dist/node/components/FlashCard.js +6 -6
  26. package/dist/node/components/MasteryRing.js +1 -1
  27. package/dist/node/components/index.js +100 -100
  28. package/dist/node/index.js +247 -246
  29. package/dist/node/views/Overview.js +16 -16
  30. package/dist/node/views/Progress.js +7 -7
  31. package/dist/node/views/Steps.js +8 -8
  32. package/dist/node/views/Timeline.js +8 -8
  33. package/dist/node/views/index.js +242 -242
  34. package/dist/views/Overview.js +16 -16
  35. package/dist/views/Progress.js +7 -7
  36. package/dist/views/Steps.js +8 -8
  37. package/dist/views/Timeline.js +8 -8
  38. package/dist/views/index.d.ts +1 -1
  39. package/dist/views/index.js +242 -242
  40. package/package.json +10 -10
  41. package/src/GamifiedMiniApp.tsx +70 -70
  42. package/src/components/DayCalendar.tsx +41 -41
  43. package/src/components/FlashCard.tsx +83 -83
  44. package/src/components/MasteryRing.tsx +64 -64
  45. package/src/components/index.ts +1 -1
  46. package/src/docs/learning-journey-ui-gamified.docblock.ts +11 -11
  47. package/src/example.ts +25 -25
  48. package/src/index.ts +5 -6
  49. package/src/learning-journey-ui-gamified.feature.ts +12 -12
  50. package/src/views/Overview.tsx +145 -145
  51. package/src/views/Progress.tsx +167 -167
  52. package/src/views/Steps.tsx +40 -40
  53. package/src/views/Timeline.tsx +177 -177
  54. package/src/views/index.ts +1 -1
  55. package/tsconfig.json +7 -8
  56. package/tsdown.config.js +7 -13
@@ -1,197 +1,197 @@
1
1
  'use client';
2
2
 
3
+ import type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';
3
4
  import {
4
- Card,
5
- CardContent,
6
- CardHeader,
7
- CardTitle,
5
+ Card,
6
+ CardContent,
7
+ CardHeader,
8
+ CardTitle,
8
9
  } from '@contractspec/lib.ui-kit-web/ui/card';
9
10
  import { DayCalendar } from '../components/DayCalendar';
10
- import type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';
11
11
 
12
12
  export function Timeline({ track, progress }: LearningViewProps) {
13
- // Check if this is a quest with day unlocks
14
- const hasQuestDays = track.steps.some(
15
- (s) => s.availability?.unlockOnDay !== undefined
16
- );
13
+ // Check if this is a quest with day unlocks
14
+ const hasQuestDays = track.steps.some(
15
+ (s) => s.availability?.unlockOnDay !== undefined
16
+ );
17
17
 
18
- if (hasQuestDays) {
19
- // Quest-style calendar view
20
- const totalDays = Math.max(
21
- ...track.steps.map((s) => s.availability?.unlockOnDay ?? 1),
22
- 7
23
- );
18
+ if (hasQuestDays) {
19
+ // Quest-style calendar view
20
+ const totalDays = Math.max(
21
+ ...track.steps.map((s) => s.availability?.unlockOnDay ?? 1),
22
+ 7
23
+ );
24
24
 
25
- const completedDays = track.steps
26
- .filter((s) => progress.completedStepIds.includes(s.id))
27
- .map((s) => s.availability?.unlockOnDay ?? 1);
25
+ const completedDays = track.steps
26
+ .filter((s) => progress.completedStepIds.includes(s.id))
27
+ .map((s) => s.availability?.unlockOnDay ?? 1);
28
28
 
29
- // Current day is the first incomplete day
30
- const currentDay =
31
- track.steps.find((s) => !progress.completedStepIds.includes(s.id))
32
- ?.availability?.unlockOnDay ?? 1;
29
+ // Current day is the first incomplete day
30
+ const currentDay =
31
+ track.steps.find((s) => !progress.completedStepIds.includes(s.id))
32
+ ?.availability?.unlockOnDay ?? 1;
33
33
 
34
- return (
35
- <div className="space-y-6">
36
- {/* Header */}
37
- <div className="text-center">
38
- <h2 className="text-xl font-bold">{track.name}</h2>
39
- <p className="text-muted-foreground">
40
- Complete each day's challenge to progress
41
- </p>
42
- </div>
34
+ return (
35
+ <div className="space-y-6">
36
+ {/* Header */}
37
+ <div className="text-center">
38
+ <h2 className="font-bold text-xl">{track.name}</h2>
39
+ <p className="text-muted-foreground">
40
+ Complete each day's challenge to progress
41
+ </p>
42
+ </div>
43
43
 
44
- {/* Calendar Grid */}
45
- <Card>
46
- <CardHeader>
47
- <CardTitle className="flex items-center gap-2">
48
- <span>📅</span>
49
- <span>Your Journey</span>
50
- </CardTitle>
51
- </CardHeader>
52
- <CardContent className="flex justify-center">
53
- <DayCalendar
54
- totalDays={totalDays}
55
- currentDay={currentDay}
56
- completedDays={completedDays}
57
- />
58
- </CardContent>
59
- </Card>
44
+ {/* Calendar Grid */}
45
+ <Card>
46
+ <CardHeader>
47
+ <CardTitle className="flex items-center gap-2">
48
+ <span>📅</span>
49
+ <span>Your Journey</span>
50
+ </CardTitle>
51
+ </CardHeader>
52
+ <CardContent className="flex justify-center">
53
+ <DayCalendar
54
+ totalDays={totalDays}
55
+ currentDay={currentDay}
56
+ completedDays={completedDays}
57
+ />
58
+ </CardContent>
59
+ </Card>
60
60
 
61
- {/* Daily Steps */}
62
- <Card>
63
- <CardHeader>
64
- <CardTitle className="flex items-center gap-2">
65
- <span>📝</span>
66
- <span>Daily Challenges</span>
67
- </CardTitle>
68
- </CardHeader>
69
- <CardContent>
70
- <div className="space-y-3">
71
- {track.steps.map((step) => {
72
- const day = step.availability?.unlockOnDay ?? 1;
73
- const isCompleted = progress.completedStepIds.includes(step.id);
74
- const isLocked = day > currentDay;
61
+ {/* Daily Steps */}
62
+ <Card>
63
+ <CardHeader>
64
+ <CardTitle className="flex items-center gap-2">
65
+ <span>📝</span>
66
+ <span>Daily Challenges</span>
67
+ </CardTitle>
68
+ </CardHeader>
69
+ <CardContent>
70
+ <div className="space-y-3">
71
+ {track.steps.map((step) => {
72
+ const day = step.availability?.unlockOnDay ?? 1;
73
+ const isCompleted = progress.completedStepIds.includes(step.id);
74
+ const isLocked = day > currentDay;
75
75
 
76
- return (
77
- <div
78
- key={step.id}
79
- className={`flex items-start gap-4 rounded-lg border p-4 ${
80
- isLocked ? 'opacity-50' : ''
81
- }`}
82
- >
83
- <div className="bg-muted flex h-10 w-10 shrink-0 items-center justify-center rounded-lg font-semibold">
84
- {isCompleted ? '✓' : isLocked ? '🔒' : day}
85
- </div>
86
- <div className="flex-1">
87
- <h4 className="font-semibold">{step.title}</h4>
88
- <p className="text-muted-foreground text-sm">
89
- {step.description}
90
- </p>
91
- </div>
92
- {step.xpReward && (
93
- <span
94
- className={`text-sm font-medium ${
95
- isCompleted
96
- ? 'text-green-500'
97
- : 'text-muted-foreground'
98
- }`}
99
- >
100
- +{step.xpReward} XP
101
- </span>
102
- )}
103
- </div>
104
- );
105
- })}
106
- </div>
107
- </CardContent>
108
- </Card>
109
- </div>
110
- );
111
- }
76
+ return (
77
+ <div
78
+ key={step.id}
79
+ className={`flex items-start gap-4 rounded-lg border p-4 ${
80
+ isLocked ? 'opacity-50' : ''
81
+ }`}
82
+ >
83
+ <div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted font-semibold">
84
+ {isCompleted ? '✓' : isLocked ? '🔒' : day}
85
+ </div>
86
+ <div className="flex-1">
87
+ <h4 className="font-semibold">{step.title}</h4>
88
+ <p className="text-muted-foreground text-sm">
89
+ {step.description}
90
+ </p>
91
+ </div>
92
+ {step.xpReward && (
93
+ <span
94
+ className={`font-medium text-sm ${
95
+ isCompleted
96
+ ? 'text-green-500'
97
+ : 'text-muted-foreground'
98
+ }`}
99
+ >
100
+ +{step.xpReward} XP
101
+ </span>
102
+ )}
103
+ </div>
104
+ );
105
+ })}
106
+ </div>
107
+ </CardContent>
108
+ </Card>
109
+ </div>
110
+ );
111
+ }
112
112
 
113
- // Drill-style timeline (step order)
114
- return (
115
- <div className="space-y-6">
116
- {/* Header */}
117
- <div className="text-center">
118
- <h2 className="text-xl font-bold">Learning Path</h2>
119
- <p className="text-muted-foreground">
120
- Follow the steps to master this skill
121
- </p>
122
- </div>
113
+ // Drill-style timeline (step order)
114
+ return (
115
+ <div className="space-y-6">
116
+ {/* Header */}
117
+ <div className="text-center">
118
+ <h2 className="font-bold text-xl">Learning Path</h2>
119
+ <p className="text-muted-foreground">
120
+ Follow the steps to master this skill
121
+ </p>
122
+ </div>
123
123
 
124
- {/* Timeline */}
125
- <Card>
126
- <CardContent className="p-6">
127
- <div className="relative">
128
- {/* Vertical line */}
129
- <div className="bg-border absolute top-0 left-5 h-full w-0.5" />
124
+ {/* Timeline */}
125
+ <Card>
126
+ <CardContent className="p-6">
127
+ <div className="relative">
128
+ {/* Vertical line */}
129
+ <div className="absolute top-0 left-5 h-full w-0.5 bg-border" />
130
130
 
131
- {/* Steps */}
132
- <div className="space-y-6">
133
- {track.steps.map((step, index) => {
134
- const isCompleted = progress.completedStepIds.includes(step.id);
135
- const isCurrent =
136
- !isCompleted &&
137
- track.steps
138
- .slice(0, index)
139
- .every((s) => progress.completedStepIds.includes(s.id));
131
+ {/* Steps */}
132
+ <div className="space-y-6">
133
+ {track.steps.map((step, index) => {
134
+ const isCompleted = progress.completedStepIds.includes(step.id);
135
+ const isCurrent =
136
+ !isCompleted &&
137
+ track.steps
138
+ .slice(0, index)
139
+ .every((s) => progress.completedStepIds.includes(s.id));
140
140
 
141
- return (
142
- <div key={step.id} className="relative flex gap-4 pl-2">
143
- {/* Node */}
144
- <div
145
- className={`relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 ${
146
- isCompleted
147
- ? 'border-green-500 bg-green-500 text-white'
148
- : isCurrent
149
- ? 'border-violet-500 bg-violet-500 text-white'
150
- : 'border-border bg-background'
151
- }`}
152
- >
153
- {isCompleted ? '✓' : index + 1}
154
- </div>
141
+ return (
142
+ <div key={step.id} className="relative flex gap-4 pl-2">
143
+ {/* Node */}
144
+ <div
145
+ className={`relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 ${
146
+ isCompleted
147
+ ? 'border-green-500 bg-green-500 text-white'
148
+ : isCurrent
149
+ ? 'border-violet-500 bg-violet-500 text-white'
150
+ : 'border-border bg-background'
151
+ }`}
152
+ >
153
+ {isCompleted ? '✓' : index + 1}
154
+ </div>
155
155
 
156
- {/* Content */}
157
- <div className="flex-1 pb-4">
158
- <div className="flex items-start justify-between gap-2">
159
- <div>
160
- <h4
161
- className={`font-semibold ${
162
- isCompleted
163
- ? 'text-foreground'
164
- : isCurrent
165
- ? 'text-violet-500'
166
- : 'text-muted-foreground'
167
- }`}
168
- >
169
- {step.title}
170
- </h4>
171
- <p className="text-muted-foreground mt-1 text-sm">
172
- {step.description}
173
- </p>
174
- </div>
175
- {step.xpReward && (
176
- <span
177
- className={`shrink-0 rounded-full px-2 py-1 text-xs font-semibold ${
178
- isCompleted
179
- ? 'bg-green-500/10 text-green-500'
180
- : 'bg-muted text-muted-foreground'
181
- }`}
182
- >
183
- +{step.xpReward} XP
184
- </span>
185
- )}
186
- </div>
187
- </div>
188
- </div>
189
- );
190
- })}
191
- </div>
192
- </div>
193
- </CardContent>
194
- </Card>
195
- </div>
196
- );
156
+ {/* Content */}
157
+ <div className="flex-1 pb-4">
158
+ <div className="flex items-start justify-between gap-2">
159
+ <div>
160
+ <h4
161
+ className={`font-semibold ${
162
+ isCompleted
163
+ ? 'text-foreground'
164
+ : isCurrent
165
+ ? 'text-violet-500'
166
+ : 'text-muted-foreground'
167
+ }`}
168
+ >
169
+ {step.title}
170
+ </h4>
171
+ <p className="mt-1 text-muted-foreground text-sm">
172
+ {step.description}
173
+ </p>
174
+ </div>
175
+ {step.xpReward && (
176
+ <span
177
+ className={`shrink-0 rounded-full px-2 py-1 font-semibold text-xs ${
178
+ isCompleted
179
+ ? 'bg-green-500/10 text-green-500'
180
+ : 'bg-muted text-muted-foreground'
181
+ }`}
182
+ >
183
+ +{step.xpReward} XP
184
+ </span>
185
+ )}
186
+ </div>
187
+ </div>
188
+ </div>
189
+ );
190
+ })}
191
+ </div>
192
+ </div>
193
+ </CardContent>
194
+ </Card>
195
+ </div>
196
+ );
197
197
  }
@@ -1,4 +1,4 @@
1
1
  export { Overview } from './Overview';
2
- export { Steps } from './Steps';
3
2
  export { Progress } from './Progress';
3
+ export { Steps } from './Steps';
4
4
  export { Timeline } from './Timeline';
package/tsconfig.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
- "extends": "@contractspec/tool.typescript/react-library.json",
3
- "include": ["src"],
4
- "exclude": ["node_modules"],
5
- "compilerOptions": {
6
- "rootDir": "src",
7
- "outDir": "dist"
8
- }
2
+ "extends": "@contractspec/tool.typescript/react-library.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "rootDir": "src",
7
+ "outDir": "dist"
8
+ }
9
9
  }
10
-
package/tsdown.config.js CHANGED
@@ -1,16 +1,10 @@
1
- import { defineConfig, moduleLibrary, withDevExports } from '@contractspec/tool.bun';
1
+ import {
2
+ defineConfig,
3
+ moduleLibrary,
4
+ withDevExports,
5
+ } from '@contractspec/tool.bun';
2
6
 
3
7
  export default defineConfig(() => ({
4
- ...moduleLibrary,
5
- ...withDevExports,
8
+ ...moduleLibrary,
9
+ ...withDevExports,
6
10
  }));
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-