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

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 (57) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/AGENTS.md +50 -25
  3. package/CHANGELOG.md +32 -0
  4. package/README.md +63 -20
  5. package/dist/GamifiedMiniApp.js +246 -246
  6. package/dist/browser/GamifiedMiniApp.js +246 -246
  7. package/dist/browser/components/DayCalendar.js +1 -1
  8. package/dist/browser/components/FlashCard.js +6 -6
  9. package/dist/browser/components/MasteryRing.js +1 -1
  10. package/dist/browser/components/index.js +100 -100
  11. package/dist/browser/index.js +247 -246
  12. package/dist/browser/views/Overview.js +16 -16
  13. package/dist/browser/views/Progress.js +7 -7
  14. package/dist/browser/views/Steps.js +8 -8
  15. package/dist/browser/views/Timeline.js +8 -8
  16. package/dist/browser/views/index.js +242 -242
  17. package/dist/components/DayCalendar.js +1 -1
  18. package/dist/components/FlashCard.js +6 -6
  19. package/dist/components/MasteryRing.js +1 -1
  20. package/dist/components/index.d.ts +1 -1
  21. package/dist/components/index.js +100 -100
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +247 -246
  24. package/dist/node/GamifiedMiniApp.js +246 -246
  25. package/dist/node/components/DayCalendar.js +1 -1
  26. package/dist/node/components/FlashCard.js +6 -6
  27. package/dist/node/components/MasteryRing.js +1 -1
  28. package/dist/node/components/index.js +100 -100
  29. package/dist/node/index.js +247 -246
  30. package/dist/node/views/Overview.js +16 -16
  31. package/dist/node/views/Progress.js +7 -7
  32. package/dist/node/views/Steps.js +8 -8
  33. package/dist/node/views/Timeline.js +8 -8
  34. package/dist/node/views/index.js +242 -242
  35. package/dist/views/Overview.js +16 -16
  36. package/dist/views/Progress.js +7 -7
  37. package/dist/views/Steps.js +8 -8
  38. package/dist/views/Timeline.js +8 -8
  39. package/dist/views/index.d.ts +1 -1
  40. package/dist/views/index.js +242 -242
  41. package/package.json +12 -12
  42. package/src/GamifiedMiniApp.tsx +70 -70
  43. package/src/components/DayCalendar.tsx +41 -41
  44. package/src/components/FlashCard.tsx +83 -83
  45. package/src/components/MasteryRing.tsx +64 -64
  46. package/src/components/index.ts +1 -1
  47. package/src/docs/learning-journey-ui-gamified.docblock.ts +11 -11
  48. package/src/example.ts +25 -25
  49. package/src/index.ts +5 -6
  50. package/src/learning-journey-ui-gamified.feature.ts +12 -12
  51. package/src/views/Overview.tsx +145 -145
  52. package/src/views/Progress.tsx +167 -167
  53. package/src/views/Steps.tsx +40 -40
  54. package/src/views/Timeline.tsx +177 -177
  55. package/src/views/index.ts +1 -1
  56. package/tsconfig.json +7 -8
  57. package/tsdown.config.js +7 -13
@@ -16,7 +16,7 @@ function DayCalendar({
16
16
  const isCurrent = day === currentDay;
17
17
  const isLocked = day > currentDay;
18
18
  return /* @__PURE__ */ jsxDEV("div", {
19
- className: cn("flex h-12 w-12 flex-col items-center justify-center rounded-lg border text-sm font-medium transition-all", isCompleted && "border-green-500 bg-green-500/10 text-green-500", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50", isLocked && "border-muted bg-muted/50 text-muted-foreground", !isCompleted && !isCurrent && !isLocked && "border-border bg-card"),
19
+ className: cn("flex h-12 w-12 flex-col items-center justify-center rounded-lg border font-medium text-sm transition-all", isCompleted && "border-green-500 bg-green-500/10 text-green-500", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50", isLocked && "border-muted bg-muted/50 text-muted-foreground", !isCompleted && !isCurrent && !isLocked && "border-border bg-card"),
20
20
  children: isCompleted ? /* @__PURE__ */ jsxDEV("span", {
21
21
  className: "text-lg",
22
22
  children: "\u2713"
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  // src/components/FlashCard.tsx
3
- import { useState } from "react";
4
3
  import { Button } from "@contractspec/lib.design-system";
5
4
  import { Card, CardContent } from "@contractspec/lib.ui-kit-web/ui/card";
6
5
  import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
6
+ import { useState } from "react";
7
7
  import { jsxDEV } from "react/jsx-dev-runtime";
8
8
  "use client";
9
9
  function FlashCard({
@@ -14,7 +14,7 @@ function FlashCard({
14
14
  }) {
15
15
  const [isFlipped, setIsFlipped] = useState(false);
16
16
  return /* @__PURE__ */ jsxDEV(Card, {
17
- className: cn("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-primary ring-2", isCompleted && "opacity-60"),
17
+ className: cn("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-2 ring-primary", isCompleted && "opacity-60"),
18
18
  onClick: () => !isCompleted && setIsFlipped(!isFlipped),
19
19
  children: /* @__PURE__ */ jsxDEV(CardContent, {
20
20
  className: "p-6",
@@ -29,17 +29,17 @@ function FlashCard({
29
29
  className: "flex-1",
30
30
  children: [
31
31
  /* @__PURE__ */ jsxDEV("h3", {
32
- className: "text-lg font-semibold",
32
+ className: "font-semibold text-lg",
33
33
  children: step.title
34
34
  }, undefined, false, undefined, this),
35
35
  step.description && /* @__PURE__ */ jsxDEV("p", {
36
- className: "text-muted-foreground mt-1 text-sm",
36
+ className: "mt-1 text-muted-foreground text-sm",
37
37
  children: step.description
38
38
  }, undefined, false, undefined, this)
39
39
  ]
40
40
  }, undefined, true, undefined, this),
41
41
  step.xpReward && /* @__PURE__ */ jsxDEV("span", {
42
- className: "rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500",
42
+ className: "rounded-full bg-green-500/10 px-2 py-1 font-semibold text-green-500 text-xs",
43
43
  children: [
44
44
  "+",
45
45
  step.xpReward,
@@ -55,7 +55,7 @@ function FlashCard({
55
55
  children: "\u2713"
56
56
  }, undefined, false, undefined, this),
57
57
  /* @__PURE__ */ jsxDEV("span", {
58
- className: "text-sm font-medium",
58
+ className: "font-medium text-sm",
59
59
  children: "Completed"
60
60
  }, undefined, false, undefined, this)
61
61
  ]
@@ -65,7 +65,7 @@ function MasteryRing({
65
65
  }, undefined, true, undefined, this)
66
66
  }, undefined, false, undefined, this),
67
67
  /* @__PURE__ */ jsxDEV("span", {
68
- className: cn("text-muted-foreground mt-1 truncate", styles.text),
68
+ className: cn("mt-1 truncate text-muted-foreground", styles.text),
69
69
  children: label
70
70
  }, undefined, false, undefined, this)
71
71
  ]
@@ -1,3 +1,3 @@
1
+ export { DayCalendar } from './DayCalendar';
1
2
  export { FlashCard } from './FlashCard';
2
3
  export { MasteryRing } from './MasteryRing';
3
- export { DayCalendar } from './DayCalendar';
@@ -1,10 +1,83 @@
1
1
  // @bun
2
+ // src/components/MasteryRing.tsx
3
+ import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
4
+ import { jsxDEV } from "react/jsx-dev-runtime";
5
+ "use client";
6
+ var sizeStyles = {
7
+ sm: { container: "h-16 w-16", text: "text-xs", ring: 48, stroke: 4 },
8
+ md: { container: "h-24 w-24", text: "text-sm", ring: 72, stroke: 6 },
9
+ lg: { container: "h-32 w-32", text: "text-base", ring: 96, stroke: 8 }
10
+ };
11
+ var colorStyles = {
12
+ green: "stroke-green-500",
13
+ blue: "stroke-blue-500",
14
+ violet: "stroke-violet-500",
15
+ orange: "stroke-orange-500"
16
+ };
17
+ function MasteryRing({
18
+ label,
19
+ percentage,
20
+ size = "md",
21
+ color = "violet"
22
+ }) {
23
+ const styles = sizeStyles[size];
24
+ const radius = (styles.ring - styles.stroke) / 2;
25
+ const circumference = 2 * Math.PI * radius;
26
+ const strokeDashoffset = circumference - percentage / 100 * circumference;
27
+ return /* @__PURE__ */ jsxDEV("div", {
28
+ className: cn("relative flex flex-col items-center gap-1", styles.container),
29
+ children: [
30
+ /* @__PURE__ */ jsxDEV("svg", {
31
+ className: "absolute -rotate-90",
32
+ width: styles.ring,
33
+ height: styles.ring,
34
+ viewBox: `0 0 ${styles.ring} ${styles.ring}`,
35
+ children: [
36
+ /* @__PURE__ */ jsxDEV("circle", {
37
+ cx: styles.ring / 2,
38
+ cy: styles.ring / 2,
39
+ r: radius,
40
+ fill: "none",
41
+ strokeWidth: styles.stroke,
42
+ className: "stroke-muted"
43
+ }, undefined, false, undefined, this),
44
+ /* @__PURE__ */ jsxDEV("circle", {
45
+ cx: styles.ring / 2,
46
+ cy: styles.ring / 2,
47
+ r: radius,
48
+ fill: "none",
49
+ strokeWidth: styles.stroke,
50
+ strokeLinecap: "round",
51
+ strokeDasharray: circumference,
52
+ strokeDashoffset,
53
+ className: cn("transition-all duration-500", colorStyles[color])
54
+ }, undefined, false, undefined, this)
55
+ ]
56
+ }, undefined, true, undefined, this),
57
+ /* @__PURE__ */ jsxDEV("div", {
58
+ className: "flex h-full flex-col items-center justify-center",
59
+ children: /* @__PURE__ */ jsxDEV("span", {
60
+ className: cn("font-bold", styles.text),
61
+ children: [
62
+ Math.round(percentage),
63
+ "%"
64
+ ]
65
+ }, undefined, true, undefined, this)
66
+ }, undefined, false, undefined, this),
67
+ /* @__PURE__ */ jsxDEV("span", {
68
+ className: cn("mt-1 truncate text-muted-foreground", styles.text),
69
+ children: label
70
+ }, undefined, false, undefined, this)
71
+ ]
72
+ }, undefined, true, undefined, this);
73
+ }
74
+
2
75
  // src/components/FlashCard.tsx
3
- import { useState } from "react";
4
76
  import { Button } from "@contractspec/lib.design-system";
5
77
  import { Card, CardContent } from "@contractspec/lib.ui-kit-web/ui/card";
6
- import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
7
- import { jsxDEV } from "react/jsx-dev-runtime";
78
+ import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
79
+ import { useState } from "react";
80
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
8
81
  "use client";
9
82
  function FlashCard({
10
83
  step,
@@ -13,33 +86,33 @@ function FlashCard({
13
86
  onComplete
14
87
  }) {
15
88
  const [isFlipped, setIsFlipped] = useState(false);
16
- return /* @__PURE__ */ jsxDEV(Card, {
17
- className: cn("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-primary ring-2", isCompleted && "opacity-60"),
89
+ return /* @__PURE__ */ jsxDEV2(Card, {
90
+ className: cn2("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-2 ring-primary", isCompleted && "opacity-60"),
18
91
  onClick: () => !isCompleted && setIsFlipped(!isFlipped),
19
- children: /* @__PURE__ */ jsxDEV(CardContent, {
92
+ children: /* @__PURE__ */ jsxDEV2(CardContent, {
20
93
  className: "p-6",
21
94
  children: [
22
- /* @__PURE__ */ jsxDEV("div", {
23
- className: cn("space-y-4 transition-opacity duration-200", isFlipped ? "opacity-0" : "opacity-100"),
95
+ /* @__PURE__ */ jsxDEV2("div", {
96
+ className: cn2("space-y-4 transition-opacity duration-200", isFlipped ? "opacity-0" : "opacity-100"),
24
97
  children: [
25
- /* @__PURE__ */ jsxDEV("div", {
98
+ /* @__PURE__ */ jsxDEV2("div", {
26
99
  className: "flex items-start justify-between",
27
100
  children: [
28
- /* @__PURE__ */ jsxDEV("div", {
101
+ /* @__PURE__ */ jsxDEV2("div", {
29
102
  className: "flex-1",
30
103
  children: [
31
- /* @__PURE__ */ jsxDEV("h3", {
32
- className: "text-lg font-semibold",
104
+ /* @__PURE__ */ jsxDEV2("h3", {
105
+ className: "font-semibold text-lg",
33
106
  children: step.title
34
107
  }, undefined, false, undefined, this),
35
- step.description && /* @__PURE__ */ jsxDEV("p", {
36
- className: "text-muted-foreground mt-1 text-sm",
108
+ step.description && /* @__PURE__ */ jsxDEV2("p", {
109
+ className: "mt-1 text-muted-foreground text-sm",
37
110
  children: step.description
38
111
  }, undefined, false, undefined, this)
39
112
  ]
40
113
  }, undefined, true, undefined, this),
41
- step.xpReward && /* @__PURE__ */ jsxDEV("span", {
42
- className: "rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500",
114
+ step.xpReward && /* @__PURE__ */ jsxDEV2("span", {
115
+ className: "rounded-full bg-green-500/10 px-2 py-1 font-semibold text-green-500 text-xs",
43
116
  children: [
44
117
  "+",
45
118
  step.xpReward,
@@ -48,41 +121,41 @@ function FlashCard({
48
121
  }, undefined, true, undefined, this)
49
122
  ]
50
123
  }, undefined, true, undefined, this),
51
- isCompleted && /* @__PURE__ */ jsxDEV("div", {
124
+ isCompleted && /* @__PURE__ */ jsxDEV2("div", {
52
125
  className: "flex items-center gap-2 text-green-500",
53
126
  children: [
54
- /* @__PURE__ */ jsxDEV("span", {
127
+ /* @__PURE__ */ jsxDEV2("span", {
55
128
  children: "\u2713"
56
129
  }, undefined, false, undefined, this),
57
- /* @__PURE__ */ jsxDEV("span", {
58
- className: "text-sm font-medium",
130
+ /* @__PURE__ */ jsxDEV2("span", {
131
+ className: "font-medium text-sm",
59
132
  children: "Completed"
60
133
  }, undefined, false, undefined, this)
61
134
  ]
62
135
  }, undefined, true, undefined, this),
63
- isCurrent && !isCompleted && /* @__PURE__ */ jsxDEV("p", {
136
+ isCurrent && !isCompleted && /* @__PURE__ */ jsxDEV2("p", {
64
137
  className: "text-muted-foreground text-xs",
65
138
  children: "Tap to reveal action"
66
139
  }, undefined, false, undefined, this)
67
140
  ]
68
141
  }, undefined, true, undefined, this),
69
- isFlipped && !isCompleted && /* @__PURE__ */ jsxDEV("div", {
142
+ isFlipped && !isCompleted && /* @__PURE__ */ jsxDEV2("div", {
70
143
  className: "absolute inset-0 flex flex-col items-center justify-center gap-4 bg-gradient-to-br from-violet-500/10 to-violet-600/10 p-6",
71
144
  children: [
72
- /* @__PURE__ */ jsxDEV("p", {
145
+ /* @__PURE__ */ jsxDEV2("p", {
73
146
  className: "text-center text-sm",
74
147
  children: step.instructions ?? "Complete this step to earn XP"
75
148
  }, undefined, false, undefined, this),
76
- /* @__PURE__ */ jsxDEV("div", {
149
+ /* @__PURE__ */ jsxDEV2("div", {
77
150
  className: "flex gap-2",
78
151
  children: [
79
- /* @__PURE__ */ jsxDEV(Button, {
152
+ /* @__PURE__ */ jsxDEV2(Button, {
80
153
  variant: "outline",
81
154
  size: "sm",
82
155
  onClick: () => setIsFlipped(false),
83
156
  children: "Back"
84
157
  }, undefined, false, undefined, this),
85
- /* @__PURE__ */ jsxDEV(Button, {
158
+ /* @__PURE__ */ jsxDEV2(Button, {
86
159
  size: "sm",
87
160
  onClick: (e) => {
88
161
  e.stopPropagation();
@@ -99,79 +172,6 @@ function FlashCard({
99
172
  }, undefined, false, undefined, this);
100
173
  }
101
174
 
102
- // src/components/MasteryRing.tsx
103
- import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
104
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
105
- "use client";
106
- var sizeStyles = {
107
- sm: { container: "h-16 w-16", text: "text-xs", ring: 48, stroke: 4 },
108
- md: { container: "h-24 w-24", text: "text-sm", ring: 72, stroke: 6 },
109
- lg: { container: "h-32 w-32", text: "text-base", ring: 96, stroke: 8 }
110
- };
111
- var colorStyles = {
112
- green: "stroke-green-500",
113
- blue: "stroke-blue-500",
114
- violet: "stroke-violet-500",
115
- orange: "stroke-orange-500"
116
- };
117
- function MasteryRing({
118
- label,
119
- percentage,
120
- size = "md",
121
- color = "violet"
122
- }) {
123
- const styles = sizeStyles[size];
124
- const radius = (styles.ring - styles.stroke) / 2;
125
- const circumference = 2 * Math.PI * radius;
126
- const strokeDashoffset = circumference - percentage / 100 * circumference;
127
- return /* @__PURE__ */ jsxDEV2("div", {
128
- className: cn2("relative flex flex-col items-center gap-1", styles.container),
129
- children: [
130
- /* @__PURE__ */ jsxDEV2("svg", {
131
- className: "absolute -rotate-90",
132
- width: styles.ring,
133
- height: styles.ring,
134
- viewBox: `0 0 ${styles.ring} ${styles.ring}`,
135
- children: [
136
- /* @__PURE__ */ jsxDEV2("circle", {
137
- cx: styles.ring / 2,
138
- cy: styles.ring / 2,
139
- r: radius,
140
- fill: "none",
141
- strokeWidth: styles.stroke,
142
- className: "stroke-muted"
143
- }, undefined, false, undefined, this),
144
- /* @__PURE__ */ jsxDEV2("circle", {
145
- cx: styles.ring / 2,
146
- cy: styles.ring / 2,
147
- r: radius,
148
- fill: "none",
149
- strokeWidth: styles.stroke,
150
- strokeLinecap: "round",
151
- strokeDasharray: circumference,
152
- strokeDashoffset,
153
- className: cn2("transition-all duration-500", colorStyles[color])
154
- }, undefined, false, undefined, this)
155
- ]
156
- }, undefined, true, undefined, this),
157
- /* @__PURE__ */ jsxDEV2("div", {
158
- className: "flex h-full flex-col items-center justify-center",
159
- children: /* @__PURE__ */ jsxDEV2("span", {
160
- className: cn2("font-bold", styles.text),
161
- children: [
162
- Math.round(percentage),
163
- "%"
164
- ]
165
- }, undefined, true, undefined, this)
166
- }, undefined, false, undefined, this),
167
- /* @__PURE__ */ jsxDEV2("span", {
168
- className: cn2("text-muted-foreground mt-1 truncate", styles.text),
169
- children: label
170
- }, undefined, false, undefined, this)
171
- ]
172
- }, undefined, true, undefined, this);
173
- }
174
-
175
175
  // src/components/DayCalendar.tsx
176
176
  import { cn as cn3 } from "@contractspec/lib.ui-kit-web/ui/utils";
177
177
  import { jsxDEV as jsxDEV3, Fragment } from "react/jsx-dev-runtime";
@@ -189,7 +189,7 @@ function DayCalendar({
189
189
  const isCurrent = day === currentDay;
190
190
  const isLocked = day > currentDay;
191
191
  return /* @__PURE__ */ jsxDEV3("div", {
192
- className: cn3("flex h-12 w-12 flex-col items-center justify-center rounded-lg border text-sm font-medium transition-all", isCompleted && "border-green-500 bg-green-500/10 text-green-500", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50", isLocked && "border-muted bg-muted/50 text-muted-foreground", !isCompleted && !isCurrent && !isLocked && "border-border bg-card"),
192
+ className: cn3("flex h-12 w-12 flex-col items-center justify-center rounded-lg border font-medium text-sm transition-all", isCompleted && "border-green-500 bg-green-500/10 text-green-500", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50", isLocked && "border-muted bg-muted/50 text-muted-foreground", !isCompleted && !isCurrent && !isLocked && "border-border bg-card"),
193
193
  children: isCompleted ? /* @__PURE__ */ jsxDEV3("span", {
194
194
  className: "text-lg",
195
195
  children: "\u2713"
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ export { DayCalendar, FlashCard, MasteryRing } from './components';
2
+ export { default as example } from './example';
1
3
  export { GamifiedMiniApp } from './GamifiedMiniApp';
2
- export { Overview, Steps, Progress, Timeline } from './views';
3
- export { FlashCard, MasteryRing, DayCalendar } from './components';
4
4
  export * from './learning-journey-ui-gamified.feature';
5
- export { default as example } from './example';
5
+ export { Overview, Progress, Steps, Timeline } from './views';
6
6
  import './docs';