@contractspec/example.learning-journey-ui-gamified 0.0.0-canary-20260113170453

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 (71) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +57 -0
  2. package/.turbo/turbo-build.log +58 -0
  3. package/CHANGELOG.md +466 -0
  4. package/LICENSE +21 -0
  5. package/README.md +32 -0
  6. package/dist/GamifiedMiniApp.d.ts +17 -0
  7. package/dist/GamifiedMiniApp.d.ts.map +1 -0
  8. package/dist/GamifiedMiniApp.js +63 -0
  9. package/dist/GamifiedMiniApp.js.map +1 -0
  10. package/dist/components/DayCalendar.d.ts +16 -0
  11. package/dist/components/DayCalendar.d.ts.map +1 -0
  12. package/dist/components/DayCalendar.js +33 -0
  13. package/dist/components/DayCalendar.js.map +1 -0
  14. package/dist/components/FlashCard.d.ts +19 -0
  15. package/dist/components/FlashCard.d.ts.map +1 -0
  16. package/dist/components/FlashCard.js +80 -0
  17. package/dist/components/FlashCard.js.map +1 -0
  18. package/dist/components/MasteryRing.d.ts +18 -0
  19. package/dist/components/MasteryRing.d.ts.map +1 -0
  20. package/dist/components/MasteryRing.js +82 -0
  21. package/dist/components/MasteryRing.js.map +1 -0
  22. package/dist/components/index.d.ts +4 -0
  23. package/dist/components/index.js +5 -0
  24. package/dist/docs/index.d.ts +1 -0
  25. package/dist/docs/index.js +1 -0
  26. package/dist/docs/learning-journey-ui-gamified.docblock.d.ts +1 -0
  27. package/dist/docs/learning-journey-ui-gamified.docblock.js +20 -0
  28. package/dist/docs/learning-journey-ui-gamified.docblock.js.map +1 -0
  29. package/dist/example.d.ts +7 -0
  30. package/dist/example.d.ts.map +1 -0
  31. package/dist/example.js +42 -0
  32. package/dist/example.js.map +1 -0
  33. package/dist/index.d.ts +12 -0
  34. package/dist/index.js +14 -0
  35. package/dist/views/Overview.d.ts +15 -0
  36. package/dist/views/Overview.d.ts.map +1 -0
  37. package/dist/views/Overview.js +161 -0
  38. package/dist/views/Overview.js.map +1 -0
  39. package/dist/views/Progress.d.ts +11 -0
  40. package/dist/views/Progress.d.ts.map +1 -0
  41. package/dist/views/Progress.js +143 -0
  42. package/dist/views/Progress.js.map +1 -0
  43. package/dist/views/Steps.d.ts +12 -0
  44. package/dist/views/Steps.d.ts.map +1 -0
  45. package/dist/views/Steps.js +56 -0
  46. package/dist/views/Steps.js.map +1 -0
  47. package/dist/views/Timeline.d.ts +11 -0
  48. package/dist/views/Timeline.d.ts.map +1 -0
  49. package/dist/views/Timeline.js +133 -0
  50. package/dist/views/Timeline.js.map +1 -0
  51. package/dist/views/index.d.ts +5 -0
  52. package/dist/views/index.js +6 -0
  53. package/example.ts +1 -0
  54. package/package.json +76 -0
  55. package/src/GamifiedMiniApp.tsx +93 -0
  56. package/src/components/DayCalendar.tsx +53 -0
  57. package/src/components/FlashCard.tsx +100 -0
  58. package/src/components/MasteryRing.tsx +81 -0
  59. package/src/components/index.ts +3 -0
  60. package/src/docs/index.ts +1 -0
  61. package/src/docs/learning-journey-ui-gamified.docblock.ts +18 -0
  62. package/src/example.ts +31 -0
  63. package/src/index.ts +10 -0
  64. package/src/views/Overview.tsx +164 -0
  65. package/src/views/Progress.tsx +183 -0
  66. package/src/views/Steps.tsx +50 -0
  67. package/src/views/Timeline.tsx +197 -0
  68. package/src/views/index.ts +4 -0
  69. package/tsconfig.json +10 -0
  70. package/tsconfig.tsbuildinfo +1 -0
  71. package/tsdown.config.js +17 -0
@@ -0,0 +1,63 @@
1
+ 'use client';
2
+
3
+ import { Overview } from "./views/Overview.js";
4
+ import { Steps } from "./views/Steps.js";
5
+ import { Progress } from "./views/Progress.js";
6
+ import { Timeline } from "./views/Timeline.js";
7
+ import { useCallback, useState } from "react";
8
+ import { Card, CardContent } from "@contractspec/lib.ui-kit-web/ui/card";
9
+ import { ViewTabs, useLearningProgress } from "@contractspec/example.learning-journey-ui-shared";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+
12
+ //#region src/GamifiedMiniApp.tsx
13
+ function GamifiedMiniApp({ track, progress: externalProgress, onStepComplete: externalOnStepComplete, onViewChange, initialView = "overview" }) {
14
+ const [currentView, setCurrentView] = useState(initialView);
15
+ const { progress: internalProgress, completeStep: internalCompleteStep } = useLearningProgress(track);
16
+ const progress = externalProgress ?? internalProgress;
17
+ const handleViewChange = useCallback((view) => {
18
+ setCurrentView(view);
19
+ onViewChange?.(view);
20
+ }, [onViewChange]);
21
+ const handleStepComplete = useCallback((stepId) => {
22
+ if (externalOnStepComplete) externalOnStepComplete(stepId);
23
+ else internalCompleteStep(stepId);
24
+ }, [externalOnStepComplete, internalCompleteStep]);
25
+ const handleStartFromOverview = useCallback(() => {
26
+ setCurrentView("steps");
27
+ onViewChange?.("steps");
28
+ }, [onViewChange]);
29
+ const renderView = () => {
30
+ const viewProps = {
31
+ track,
32
+ progress,
33
+ onStepComplete: handleStepComplete
34
+ };
35
+ switch (currentView) {
36
+ case "overview": return /* @__PURE__ */ jsx(Overview, {
37
+ ...viewProps,
38
+ onStart: handleStartFromOverview
39
+ });
40
+ case "steps": return /* @__PURE__ */ jsx(Steps, { ...viewProps });
41
+ case "progress": return /* @__PURE__ */ jsx(Progress, { ...viewProps });
42
+ case "timeline": return /* @__PURE__ */ jsx(Timeline, { ...viewProps });
43
+ default: return /* @__PURE__ */ jsx(Overview, {
44
+ ...viewProps,
45
+ onStart: handleStartFromOverview
46
+ });
47
+ }
48
+ };
49
+ return /* @__PURE__ */ jsxs("div", {
50
+ className: "space-y-6",
51
+ children: [/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, {
52
+ className: "p-4",
53
+ children: /* @__PURE__ */ jsx(ViewTabs, {
54
+ currentView,
55
+ onViewChange: handleViewChange
56
+ })
57
+ }) }), renderView()]
58
+ });
59
+ }
60
+
61
+ //#endregion
62
+ export { GamifiedMiniApp };
63
+ //# sourceMappingURL=GamifiedMiniApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GamifiedMiniApp.js","names":[],"sources":["../src/GamifiedMiniApp.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from 'react';\nimport { Card, CardContent } from '@contractspec/lib.ui-kit-web/ui/card';\nimport {\n ViewTabs,\n useLearningProgress,\n type LearningView,\n type LearningMiniAppProps,\n} from '@contractspec/example.learning-journey-ui-shared';\nimport { Overview } from './views/Overview';\nimport { Steps } from './views/Steps';\nimport { Progress } from './views/Progress';\nimport { Timeline } from './views/Timeline';\n\ntype GamifiedMiniAppProps = Omit<LearningMiniAppProps, 'progress'> & {\n progress?: LearningMiniAppProps['progress'];\n};\n\nexport function GamifiedMiniApp({\n track,\n progress: externalProgress,\n onStepComplete: externalOnStepComplete,\n onViewChange,\n initialView = 'overview',\n}: GamifiedMiniAppProps) {\n const [currentView, setCurrentView] = useState<LearningView>(initialView);\n\n // Use internal progress if not provided externally\n const { progress: internalProgress, completeStep: internalCompleteStep } =\n useLearningProgress(track);\n\n const progress = externalProgress ?? internalProgress;\n\n const handleViewChange = useCallback(\n (view: LearningView) => {\n setCurrentView(view);\n onViewChange?.(view);\n },\n [onViewChange]\n );\n\n const handleStepComplete = useCallback(\n (stepId: string) => {\n if (externalOnStepComplete) {\n externalOnStepComplete(stepId);\n } else {\n internalCompleteStep(stepId);\n }\n },\n [externalOnStepComplete, internalCompleteStep]\n );\n\n const handleStartFromOverview = useCallback(() => {\n setCurrentView('steps');\n onViewChange?.('steps');\n }, [onViewChange]);\n\n const renderView = () => {\n const viewProps = {\n track,\n progress,\n onStepComplete: handleStepComplete,\n };\n\n switch (currentView) {\n case 'overview':\n return <Overview {...viewProps} onStart={handleStartFromOverview} />;\n case 'steps':\n return <Steps {...viewProps} />;\n case 'progress':\n return <Progress {...viewProps} />;\n case 'timeline':\n return <Timeline {...viewProps} />;\n default:\n return <Overview {...viewProps} onStart={handleStartFromOverview} />;\n }\n };\n\n return (\n <div className=\"space-y-6\">\n {/* Navigation */}\n <Card>\n <CardContent className=\"p-4\">\n <ViewTabs currentView={currentView} onViewChange={handleViewChange} />\n </CardContent>\n </Card>\n\n {/* Current View */}\n {renderView()}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAgB,gBAAgB,EAC9B,OACA,UAAU,kBACV,gBAAgB,wBAChB,cACA,cAAc,cACS;CACvB,MAAM,CAAC,aAAa,kBAAkB,SAAuB,YAAY;CAGzE,MAAM,EAAE,UAAU,kBAAkB,cAAc,yBAChD,oBAAoB,MAAM;CAE5B,MAAM,WAAW,oBAAoB;CAErC,MAAM,mBAAmB,aACtB,SAAuB;AACtB,iBAAe,KAAK;AACpB,iBAAe,KAAK;IAEtB,CAAC,aAAa,CACf;CAED,MAAM,qBAAqB,aACxB,WAAmB;AAClB,MAAI,uBACF,wBAAuB,OAAO;MAE9B,sBAAqB,OAAO;IAGhC,CAAC,wBAAwB,qBAAqB,CAC/C;CAED,MAAM,0BAA0B,kBAAkB;AAChD,iBAAe,QAAQ;AACvB,iBAAe,QAAQ;IACtB,CAAC,aAAa,CAAC;CAElB,MAAM,mBAAmB;EACvB,MAAM,YAAY;GAChB;GACA;GACA,gBAAgB;GACjB;AAED,UAAQ,aAAR;GACE,KAAK,WACH,QAAO,oBAAC;IAAS,GAAI;IAAW,SAAS;KAA2B;GACtE,KAAK,QACH,QAAO,oBAAC,SAAM,GAAI,YAAa;GACjC,KAAK,WACH,QAAO,oBAAC,YAAS,GAAI,YAAa;GACpC,KAAK,WACH,QAAO,oBAAC,YAAS,GAAI,YAAa;GACpC,QACE,QAAO,oBAAC;IAAS,GAAI;IAAW,SAAS;KAA2B;;;AAI1E,QACE,qBAAC;EAAI,WAAU;aAEb,oBAAC,kBACC,oBAAC;GAAY,WAAU;aACrB,oBAAC;IAAsB;IAAa,cAAc;KAAoB;IAC1D,GACT,EAGN,YAAY;GACT"}
@@ -0,0 +1,16 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/components/DayCalendar.d.ts
4
+ interface DayCalendarProps {
5
+ totalDays: number;
6
+ currentDay: number;
7
+ completedDays: number[];
8
+ }
9
+ declare function DayCalendar({
10
+ totalDays,
11
+ currentDay,
12
+ completedDays
13
+ }: DayCalendarProps): react_jsx_runtime0.JSX.Element;
14
+ //#endregion
15
+ export { DayCalendar };
16
+ //# sourceMappingURL=DayCalendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayCalendar.d.ts","names":[],"sources":["../../src/components/DayCalendar.tsx"],"sourcesContent":[],"mappings":";;;UAIU,gBAAA;;;EAAA,aAAA,EAAA,MAAgB,EAAA;AAM1B;AACE,iBADc,WAAA,CACd;EAAA,SAAA;EAAA,UAAA;EAAA;AAAA,CAAA,EAGC,gBAHD,CAAA,EAGiB,kBAAA,CAAA,GAAA,CAAA,OAHjB"}
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
5
+
6
+ //#region src/components/DayCalendar.tsx
7
+ function DayCalendar({ totalDays, currentDay, completedDays }) {
8
+ return /* @__PURE__ */ jsx("div", {
9
+ className: "grid grid-cols-7 gap-2",
10
+ children: Array.from({ length: totalDays }, (_, i) => i + 1).map((day) => {
11
+ const isCompleted = completedDays.includes(day);
12
+ const isCurrent = day === currentDay;
13
+ const isLocked = day > currentDay;
14
+ return /* @__PURE__ */ jsx("div", {
15
+ 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"),
16
+ children: isCompleted ? /* @__PURE__ */ jsx("span", {
17
+ className: "text-lg",
18
+ children: "✓"
19
+ }) : isLocked ? /* @__PURE__ */ jsx("span", {
20
+ className: "text-lg",
21
+ children: "🔒"
22
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
23
+ className: "text-muted-foreground text-xs",
24
+ children: "Day"
25
+ }), /* @__PURE__ */ jsx("span", { children: day })] })
26
+ }, day);
27
+ })
28
+ });
29
+ }
30
+
31
+ //#endregion
32
+ export { DayCalendar };
33
+ //# sourceMappingURL=DayCalendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayCalendar.js","names":[],"sources":["../../src/components/DayCalendar.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@contractspec/lib.ui-kit-web/ui/utils';\n\ninterface DayCalendarProps {\n totalDays: number;\n currentDay: number;\n completedDays: number[];\n}\n\nexport function DayCalendar({\n totalDays,\n currentDay,\n completedDays,\n}: DayCalendarProps) {\n const days = Array.from({ length: totalDays }, (_, i) => i + 1);\n\n return (\n <div className=\"grid grid-cols-7 gap-2\">\n {days.map((day) => {\n const isCompleted = completedDays.includes(day);\n const isCurrent = day === currentDay;\n const isLocked = day > currentDay;\n\n return (\n <div\n key={day}\n className={cn(\n 'flex h-12 w-12 flex-col items-center justify-center rounded-lg border text-sm font-medium transition-all',\n isCompleted && 'border-green-500 bg-green-500/10 text-green-500',\n isCurrent &&\n !isCompleted &&\n 'border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50',\n isLocked && 'border-muted bg-muted/50 text-muted-foreground',\n !isCompleted && !isCurrent && !isLocked && 'border-border bg-card'\n )}\n >\n {isCompleted ? (\n <span className=\"text-lg\">✓</span>\n ) : isLocked ? (\n <span className=\"text-lg\">🔒</span>\n ) : (\n <>\n <span className=\"text-muted-foreground text-xs\">Day</span>\n <span>{day}</span>\n </>\n )}\n </div>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;AAUA,SAAgB,YAAY,EAC1B,WACA,YACA,iBACmB;AAGnB,QACE,oBAAC;EAAI,WAAU;YAHJ,MAAM,KAAK,EAAE,QAAQ,WAAW,GAAG,GAAG,MAAM,IAAI,EAAE,CAIrD,KAAK,QAAQ;GACjB,MAAM,cAAc,cAAc,SAAS,IAAI;GAC/C,MAAM,YAAY,QAAQ;GAC1B,MAAM,WAAW,MAAM;AAEvB,UACE,oBAAC;IAEC,WAAW,GACT,4GACA,eAAe,mDACf,aACE,CAAC,eACD,gFACF,YAAY,kDACZ,CAAC,eAAe,CAAC,aAAa,CAAC,YAAY,wBAC5C;cAEA,cACC,oBAAC;KAAK,WAAU;eAAU;MAAQ,GAChC,WACF,oBAAC;KAAK,WAAU;eAAU;MAAS,GAEnC,4CACE,oBAAC;KAAK,WAAU;eAAgC;MAAU,EAC1D,oBAAC,oBAAM,MAAW,IACjB;MAnBA,IAqBD;IAER;GACE"}
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+ import { LearningJourneyStepSpec } from "@contractspec/module.learning-journey/track-spec";
3
+
4
+ //#region src/components/FlashCard.d.ts
5
+ interface FlashCardProps {
6
+ step: LearningJourneyStepSpec;
7
+ isCompleted: boolean;
8
+ isCurrent: boolean;
9
+ onComplete?: () => void;
10
+ }
11
+ declare function FlashCard({
12
+ step,
13
+ isCompleted,
14
+ isCurrent,
15
+ onComplete
16
+ }: FlashCardProps): react_jsx_runtime1.JSX.Element;
17
+ //#endregion
18
+ export { FlashCard };
19
+ //# sourceMappingURL=FlashCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlashCard.d.ts","names":[],"sources":["../../src/components/FlashCard.tsx"],"sourcesContent":[],"mappings":";;;;UAQU,cAAA;QACF;;EADE,SAAA,EAAA,OAAc;EAOR,UAAA,CAAA,EAAS,GAAA,GAAA,IAAA;;AAEvB,iBAFc,SAAA,CAEd;EAAA,IAAA;EAAA,WAAA;EAAA,SAAA;EAAA;AAAA,CAAA,EAGC,cAHD,CAAA,EAGe,kBAAA,CAAA,GAAA,CAAA,OAHf"}
@@ -0,0 +1,80 @@
1
+ 'use client';
2
+
3
+ import { useState } from "react";
4
+ import { Card, CardContent } from "@contractspec/lib.ui-kit-web/ui/card";
5
+ import { Button } from "@contractspec/lib.design-system";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
8
+
9
+ //#region src/components/FlashCard.tsx
10
+ function FlashCard({ step, isCompleted, isCurrent, onComplete }) {
11
+ const [isFlipped, setIsFlipped] = useState(false);
12
+ return /* @__PURE__ */ jsx(Card, {
13
+ className: cn("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-primary ring-2", isCompleted && "opacity-60"),
14
+ onClick: () => !isCompleted && setIsFlipped(!isFlipped),
15
+ children: /* @__PURE__ */ jsxs(CardContent, {
16
+ className: "p-6",
17
+ children: [/* @__PURE__ */ jsxs("div", {
18
+ className: cn("space-y-4 transition-opacity duration-200", isFlipped ? "opacity-0" : "opacity-100"),
19
+ children: [
20
+ /* @__PURE__ */ jsxs("div", {
21
+ className: "flex items-start justify-between",
22
+ children: [/* @__PURE__ */ jsxs("div", {
23
+ className: "flex-1",
24
+ children: [/* @__PURE__ */ jsx("h3", {
25
+ className: "text-lg font-semibold",
26
+ children: step.title
27
+ }), step.description && /* @__PURE__ */ jsx("p", {
28
+ className: "text-muted-foreground mt-1 text-sm",
29
+ children: step.description
30
+ })]
31
+ }), step.xpReward && /* @__PURE__ */ jsxs("span", {
32
+ className: "rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500",
33
+ children: [
34
+ "+",
35
+ step.xpReward,
36
+ " XP"
37
+ ]
38
+ })]
39
+ }),
40
+ isCompleted && /* @__PURE__ */ jsxs("div", {
41
+ className: "flex items-center gap-2 text-green-500",
42
+ children: [/* @__PURE__ */ jsx("span", { children: "✓" }), /* @__PURE__ */ jsx("span", {
43
+ className: "text-sm font-medium",
44
+ children: "Completed"
45
+ })]
46
+ }),
47
+ isCurrent && !isCompleted && /* @__PURE__ */ jsx("p", {
48
+ className: "text-muted-foreground text-xs",
49
+ children: "Tap to reveal action"
50
+ })
51
+ ]
52
+ }), isFlipped && !isCompleted && /* @__PURE__ */ jsxs("div", {
53
+ 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",
54
+ children: [/* @__PURE__ */ jsx("p", {
55
+ className: "text-center text-sm",
56
+ children: step.instructions ?? "Complete this step to earn XP"
57
+ }), /* @__PURE__ */ jsxs("div", {
58
+ className: "flex gap-2",
59
+ children: [/* @__PURE__ */ jsx(Button, {
60
+ variant: "outline",
61
+ size: "sm",
62
+ onClick: () => setIsFlipped(false),
63
+ children: "Back"
64
+ }), /* @__PURE__ */ jsx(Button, {
65
+ size: "sm",
66
+ onClick: (e) => {
67
+ e.stopPropagation();
68
+ onComplete?.();
69
+ },
70
+ children: "Mark Complete"
71
+ })]
72
+ })]
73
+ })]
74
+ })
75
+ });
76
+ }
77
+
78
+ //#endregion
79
+ export { FlashCard };
80
+ //# sourceMappingURL=FlashCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlashCard.js","names":[],"sources":["../../src/components/FlashCard.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Button } from '@contractspec/lib.design-system';\nimport { Card, CardContent } from '@contractspec/lib.ui-kit-web/ui/card';\nimport { cn } from '@contractspec/lib.ui-kit-web/ui/utils';\nimport type { LearningJourneyStepSpec } from '@contractspec/module.learning-journey/track-spec';\n\ninterface FlashCardProps {\n step: LearningJourneyStepSpec;\n isCompleted: boolean;\n isCurrent: boolean;\n onComplete?: () => void;\n}\n\nexport function FlashCard({\n step,\n isCompleted,\n isCurrent,\n onComplete,\n}: FlashCardProps) {\n const [isFlipped, setIsFlipped] = useState(false);\n\n return (\n <Card\n className={cn(\n 'relative cursor-pointer overflow-hidden transition-all duration-300',\n isCurrent && 'ring-primary ring-2',\n isCompleted && 'opacity-60'\n )}\n onClick={() => !isCompleted && setIsFlipped(!isFlipped)}\n >\n <CardContent className=\"p-6\">\n {/* Front of card */}\n <div\n className={cn(\n 'space-y-4 transition-opacity duration-200',\n isFlipped ? 'opacity-0' : 'opacity-100'\n )}\n >\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1\">\n <h3 className=\"text-lg font-semibold\">{step.title}</h3>\n {step.description && (\n <p className=\"text-muted-foreground mt-1 text-sm\">\n {step.description}\n </p>\n )}\n </div>\n {step.xpReward && (\n <span className=\"rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500\">\n +{step.xpReward} XP\n </span>\n )}\n </div>\n\n {isCompleted && (\n <div className=\"flex items-center gap-2 text-green-500\">\n <span>✓</span>\n <span className=\"text-sm font-medium\">Completed</span>\n </div>\n )}\n\n {isCurrent && !isCompleted && (\n <p className=\"text-muted-foreground text-xs\">\n Tap to reveal action\n </p>\n )}\n </div>\n\n {/* Back of card (action) */}\n {isFlipped && !isCompleted && (\n <div 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\">\n <p className=\"text-center text-sm\">\n {step.instructions ?? 'Complete this step to earn XP'}\n </p>\n <div className=\"flex gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setIsFlipped(false)}\n >\n Back\n </Button>\n <Button\n size=\"sm\"\n onClick={(e) => {\n e.stopPropagation();\n onComplete?.();\n }}\n >\n Mark Complete\n </Button>\n </div>\n </div>\n )}\n </CardContent>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,UAAU,EACxB,MACA,aACA,WACA,cACiB;CACjB,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;AAEjD,QACE,oBAAC;EACC,WAAW,GACT,uEACA,aAAa,uBACb,eAAe,aAChB;EACD,eAAe,CAAC,eAAe,aAAa,CAAC,UAAU;YAEvD,qBAAC;GAAY,WAAU;cAErB,qBAAC;IACC,WAAW,GACT,6CACA,YAAY,cAAc,cAC3B;;KAED,qBAAC;MAAI,WAAU;iBACb,qBAAC;OAAI,WAAU;kBACb,oBAAC;QAAG,WAAU;kBAAyB,KAAK;SAAW,EACtD,KAAK,eACJ,oBAAC;QAAE,WAAU;kBACV,KAAK;SACJ;QAEF,EACL,KAAK,YACJ,qBAAC;OAAK,WAAU;;QAA8E;QAC1F,KAAK;QAAS;;QACX;OAEL;KAEL,eACC,qBAAC;MAAI,WAAU;iBACb,oBAAC,oBAAK,MAAQ,EACd,oBAAC;OAAK,WAAU;iBAAsB;QAAgB;OAClD;KAGP,aAAa,CAAC,eACb,oBAAC;MAAE,WAAU;gBAAgC;OAEzC;;KAEF,EAGL,aAAa,CAAC,eACb,qBAAC;IAAI,WAAU;eACb,oBAAC;KAAE,WAAU;eACV,KAAK,gBAAgB;MACpB,EACJ,qBAAC;KAAI,WAAU;gBACb,oBAAC;MACC,SAAQ;MACR,MAAK;MACL,eAAe,aAAa,MAAM;gBACnC;OAEQ,EACT,oBAAC;MACC,MAAK;MACL,UAAU,MAAM;AACd,SAAE,iBAAiB;AACnB,qBAAc;;gBAEjB;OAEQ;MACL;KACF;IAEI;GACT"}
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+
3
+ //#region src/components/MasteryRing.d.ts
4
+ interface MasteryRingProps {
5
+ label: string;
6
+ percentage: number;
7
+ size?: 'sm' | 'md' | 'lg';
8
+ color?: 'green' | 'blue' | 'violet' | 'orange';
9
+ }
10
+ declare function MasteryRing({
11
+ label,
12
+ percentage,
13
+ size,
14
+ color
15
+ }: MasteryRingProps): react_jsx_runtime2.JSX.Element;
16
+ //#endregion
17
+ export { MasteryRing };
18
+ //# sourceMappingURL=MasteryRing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MasteryRing.d.ts","names":[],"sources":["../../src/components/MasteryRing.tsx"],"sourcesContent":[],"mappings":";;;UAIU,gBAAA;;;EAAA,IAAA,CAAA,EAAA,IAAA,GAAA,IAAA,GAAgB,IAAA;EAoBV,KAAA,CAAA,EAAA,OAAW,GAAA,MAAA,GAAA,QAAA,GAAA,QAAA;;AAEzB,iBAFc,WAAA,CAEd;EAAA,KAAA;EAAA,UAAA;EAAA,IAAA;EAAA;AAAA,CAAA,EAGC,gBAHD,CAAA,EAGiB,kBAAA,CAAA,GAAA,CAAA,OAHjB"}
@@ -0,0 +1,82 @@
1
+ 'use client';
2
+
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
5
+
6
+ //#region src/components/MasteryRing.tsx
7
+ const sizeStyles = {
8
+ sm: {
9
+ container: "h-16 w-16",
10
+ text: "text-xs",
11
+ ring: 48,
12
+ stroke: 4
13
+ },
14
+ md: {
15
+ container: "h-24 w-24",
16
+ text: "text-sm",
17
+ ring: 72,
18
+ stroke: 6
19
+ },
20
+ lg: {
21
+ container: "h-32 w-32",
22
+ text: "text-base",
23
+ ring: 96,
24
+ stroke: 8
25
+ }
26
+ };
27
+ const colorStyles = {
28
+ green: "stroke-green-500",
29
+ blue: "stroke-blue-500",
30
+ violet: "stroke-violet-500",
31
+ orange: "stroke-orange-500"
32
+ };
33
+ function MasteryRing({ label, percentage, size = "md", color = "violet" }) {
34
+ const styles = sizeStyles[size];
35
+ const radius = (styles.ring - styles.stroke) / 2;
36
+ const circumference = 2 * Math.PI * radius;
37
+ const strokeDashoffset = circumference - percentage / 100 * circumference;
38
+ return /* @__PURE__ */ jsxs("div", {
39
+ className: cn("relative flex flex-col items-center gap-1", styles.container),
40
+ children: [
41
+ /* @__PURE__ */ jsxs("svg", {
42
+ className: "absolute -rotate-90",
43
+ width: styles.ring,
44
+ height: styles.ring,
45
+ viewBox: `0 0 ${styles.ring} ${styles.ring}`,
46
+ children: [/* @__PURE__ */ jsx("circle", {
47
+ cx: styles.ring / 2,
48
+ cy: styles.ring / 2,
49
+ r: radius,
50
+ fill: "none",
51
+ strokeWidth: styles.stroke,
52
+ className: "stroke-muted"
53
+ }), /* @__PURE__ */ jsx("circle", {
54
+ cx: styles.ring / 2,
55
+ cy: styles.ring / 2,
56
+ r: radius,
57
+ fill: "none",
58
+ strokeWidth: styles.stroke,
59
+ strokeLinecap: "round",
60
+ strokeDasharray: circumference,
61
+ strokeDashoffset,
62
+ className: cn("transition-all duration-500", colorStyles[color])
63
+ })]
64
+ }),
65
+ /* @__PURE__ */ jsx("div", {
66
+ className: "flex h-full flex-col items-center justify-center",
67
+ children: /* @__PURE__ */ jsxs("span", {
68
+ className: cn("font-bold", styles.text),
69
+ children: [Math.round(percentage), "%"]
70
+ })
71
+ }),
72
+ /* @__PURE__ */ jsx("span", {
73
+ className: cn("text-muted-foreground mt-1 truncate", styles.text),
74
+ children: label
75
+ })
76
+ ]
77
+ });
78
+ }
79
+
80
+ //#endregion
81
+ export { MasteryRing };
82
+ //# sourceMappingURL=MasteryRing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MasteryRing.js","names":[],"sources":["../../src/components/MasteryRing.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@contractspec/lib.ui-kit-web/ui/utils';\n\ninterface MasteryRingProps {\n label: string;\n percentage: number;\n size?: 'sm' | 'md' | 'lg';\n color?: 'green' | 'blue' | 'violet' | 'orange';\n}\n\nconst sizeStyles = {\n sm: { container: 'h-16 w-16', text: 'text-xs', ring: 48, stroke: 4 },\n md: { container: 'h-24 w-24', text: 'text-sm', ring: 72, stroke: 6 },\n lg: { container: 'h-32 w-32', text: 'text-base', ring: 96, stroke: 8 },\n};\n\nconst colorStyles = {\n green: 'stroke-green-500',\n blue: 'stroke-blue-500',\n violet: 'stroke-violet-500',\n orange: 'stroke-orange-500',\n};\n\nexport function MasteryRing({\n label,\n percentage,\n size = 'md',\n color = 'violet',\n}: MasteryRingProps) {\n const styles = sizeStyles[size];\n const radius = (styles.ring - styles.stroke) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (percentage / 100) * circumference;\n\n return (\n <div\n className={cn(\n 'relative flex flex-col items-center gap-1',\n styles.container\n )}\n >\n <svg\n className=\"absolute -rotate-90\"\n width={styles.ring}\n height={styles.ring}\n viewBox={`0 0 ${styles.ring} ${styles.ring}`}\n >\n {/* Background ring */}\n <circle\n cx={styles.ring / 2}\n cy={styles.ring / 2}\n r={radius}\n fill=\"none\"\n strokeWidth={styles.stroke}\n className=\"stroke-muted\"\n />\n {/* Progress ring */}\n <circle\n cx={styles.ring / 2}\n cy={styles.ring / 2}\n r={radius}\n fill=\"none\"\n strokeWidth={styles.stroke}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={strokeDashoffset}\n className={cn('transition-all duration-500', colorStyles[color])}\n />\n </svg>\n <div className=\"flex h-full flex-col items-center justify-center\">\n <span className={cn('font-bold', styles.text)}>\n {Math.round(percentage)}%\n </span>\n </div>\n <span className={cn('text-muted-foreground mt-1 truncate', styles.text)}>\n {label}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;AAWA,MAAM,aAAa;CACjB,IAAI;EAAE,WAAW;EAAa,MAAM;EAAW,MAAM;EAAI,QAAQ;EAAG;CACpE,IAAI;EAAE,WAAW;EAAa,MAAM;EAAW,MAAM;EAAI,QAAQ;EAAG;CACpE,IAAI;EAAE,WAAW;EAAa,MAAM;EAAa,MAAM;EAAI,QAAQ;EAAG;CACvE;AAED,MAAM,cAAc;CAClB,OAAO;CACP,MAAM;CACN,QAAQ;CACR,QAAQ;CACT;AAED,SAAgB,YAAY,EAC1B,OACA,YACA,OAAO,MACP,QAAQ,YACW;CACnB,MAAM,SAAS,WAAW;CAC1B,MAAM,UAAU,OAAO,OAAO,OAAO,UAAU;CAC/C,MAAM,gBAAgB,IAAI,KAAK,KAAK;CACpC,MAAM,mBAAmB,gBAAiB,aAAa,MAAO;AAE9D,QACE,qBAAC;EACC,WAAW,GACT,6CACA,OAAO,UACR;;GAED,qBAAC;IACC,WAAU;IACV,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,SAAS,OAAO,OAAO,KAAK,GAAG,OAAO;eAGtC,oBAAC;KACC,IAAI,OAAO,OAAO;KAClB,IAAI,OAAO,OAAO;KAClB,GAAG;KACH,MAAK;KACL,aAAa,OAAO;KACpB,WAAU;MACV,EAEF,oBAAC;KACC,IAAI,OAAO,OAAO;KAClB,IAAI,OAAO,OAAO;KAClB,GAAG;KACH,MAAK;KACL,aAAa,OAAO;KACpB,eAAc;KACd,iBAAiB;KACC;KAClB,WAAW,GAAG,+BAA+B,YAAY,OAAO;MAChE;KACE;GACN,oBAAC;IAAI,WAAU;cACb,qBAAC;KAAK,WAAW,GAAG,aAAa,OAAO,KAAK;gBAC1C,KAAK,MAAM,WAAW,EAAC;MACnB;KACH;GACN,oBAAC;IAAK,WAAW,GAAG,uCAAuC,OAAO,KAAK;cACpE;KACI;;GACH"}
@@ -0,0 +1,4 @@
1
+ import { DayCalendar } from "./DayCalendar.js";
2
+ import { FlashCard } from "./FlashCard.js";
3
+ import { MasteryRing } from "./MasteryRing.js";
4
+ export { DayCalendar, FlashCard, MasteryRing };
@@ -0,0 +1,5 @@
1
+ import { FlashCard } from "./FlashCard.js";
2
+ import { MasteryRing } from "./MasteryRing.js";
3
+ import { DayCalendar } from "./DayCalendar.js";
4
+
5
+ export { DayCalendar, FlashCard, MasteryRing };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ import "./learning-journey-ui-gamified.docblock.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,20 @@
1
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/learning-journey-ui-gamified.docblock.ts
4
+ registerDocBlocks([{
5
+ id: "docs.examples.learning-journey-ui-gamified",
6
+ title: "Learning Journey UI — Gamified",
7
+ summary: "UI mini-app components for gamified learning: flashcards, mastery, streak/calendar.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/examples/learning-journey-ui-gamified",
11
+ tags: [
12
+ "learning",
13
+ "ui",
14
+ "gamified"
15
+ ],
16
+ body: `## Includes\n- Gamified mini-app shell\n- Views: overview, steps, progress, timeline\n- Components: flash card, mastery ring, day calendar\n\n## Notes\n- Compose with design system components.\n- Respect prefers-reduced-motion; keep tap targets large.`
17
+ }]);
18
+
19
+ //#endregion
20
+ //# sourceMappingURL=learning-journey-ui-gamified.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learning-journey-ui-gamified.docblock.js","names":[],"sources":["../../src/docs/learning-journey-ui-gamified.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.learning-journey-ui-gamified',\n title: 'Learning Journey UI — Gamified',\n summary:\n 'UI mini-app components for gamified learning: flashcards, mastery, streak/calendar.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/learning-journey-ui-gamified',\n tags: ['learning', 'ui', 'gamified'],\n body: `## Includes\\n- Gamified mini-app shell\\n- Views: overview, steps, progress, timeline\\n- Components: flash card, mastery ring, day calendar\\n\\n## Notes\\n- Compose with design system components.\\n- Respect prefers-reduced-motion; keep tap targets large.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AAiBA,kBAd2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAY;EAAM;EAAW;CACpC,MAAM;CACP,CACF,CAEwB"}
@@ -0,0 +1,7 @@
1
+ import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.d.ts
4
+ declare const example: _contractspec_lib_contracts0.ExampleSpec;
5
+ //#endregion
6
+ export { example as default };
7
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SA0BJ,4BAAA,CA1BW"}
@@ -0,0 +1,42 @@
1
+ import { defineExample } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.ts
4
+ const example = defineExample({
5
+ meta: {
6
+ key: "learning-journey-ui-gamified",
7
+ version: "1.0.0",
8
+ title: "Learning Journey UI — Gamified",
9
+ description: "UI mini-app for gamified learning: flashcards, mastery ring, calendar.",
10
+ kind: "ui",
11
+ visibility: "public",
12
+ stability: "experimental",
13
+ owners: ["@platform.core"],
14
+ tags: [
15
+ "learning",
16
+ "ui",
17
+ "gamified"
18
+ ]
19
+ },
20
+ docs: { rootDocId: "docs.examples.learning-journey-ui-gamified" },
21
+ entrypoints: {
22
+ packageName: "@contractspec/example.learning-journey-ui-gamified",
23
+ docs: "./docs"
24
+ },
25
+ surfaces: {
26
+ templates: true,
27
+ sandbox: {
28
+ enabled: true,
29
+ modes: ["playground", "markdown"]
30
+ },
31
+ studio: {
32
+ enabled: true,
33
+ installable: true
34
+ },
35
+ mcp: { enabled: true }
36
+ }
37
+ });
38
+ var example_default = example;
39
+
40
+ //#endregion
41
+ export { example_default as default };
42
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'learning-journey-ui-gamified',\n version: '1.0.0',\n title: 'Learning Journey UI — Gamified',\n description:\n 'UI mini-app for gamified learning: flashcards, mastery ring, calendar.',\n kind: 'ui',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['learning', 'ui', 'gamified'],\n },\n docs: {\n rootDocId: 'docs.examples.learning-journey-ui-gamified',\n },\n entrypoints: {\n packageName: '@contractspec/example.learning-journey-ui-gamified',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['playground', 'markdown'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAM;GAAW;EACrC;CACD,MAAM,EACJ,WAAW,8CACZ;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,cAAc,WAAW;GAAE;EAC7D,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
@@ -0,0 +1,12 @@
1
+ import { GamifiedMiniApp } from "./GamifiedMiniApp.js";
2
+ import { DayCalendar } from "./components/DayCalendar.js";
3
+ import { FlashCard } from "./components/FlashCard.js";
4
+ import { MasteryRing } from "./components/MasteryRing.js";
5
+ import "./components/index.js";
6
+ import example from "./example.js";
7
+ import { Overview } from "./views/Overview.js";
8
+ import { Steps } from "./views/Steps.js";
9
+ import { Progress } from "./views/Progress.js";
10
+ import { Timeline } from "./views/Timeline.js";
11
+ import "./views/index.js";
12
+ export { DayCalendar, FlashCard, GamifiedMiniApp, MasteryRing, Overview, Progress, Steps, Timeline, example };
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import { Overview } from "./views/Overview.js";
2
+ import { FlashCard } from "./components/FlashCard.js";
3
+ import { Steps } from "./views/Steps.js";
4
+ import { MasteryRing } from "./components/MasteryRing.js";
5
+ import { Progress } from "./views/Progress.js";
6
+ import { DayCalendar } from "./components/DayCalendar.js";
7
+ import { Timeline } from "./views/Timeline.js";
8
+ import { GamifiedMiniApp } from "./GamifiedMiniApp.js";
9
+ import example_default from "./example.js";
10
+ import "./views/index.js";
11
+ import "./components/index.js";
12
+ import "./docs/index.js";
13
+
14
+ export { DayCalendar, FlashCard, GamifiedMiniApp, MasteryRing, Overview, Progress, Steps, Timeline, example_default as example };
@@ -0,0 +1,15 @@
1
+ import { LearningViewProps } from "@contractspec/example.learning-journey-ui-shared";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
+
4
+ //#region src/views/Overview.d.ts
5
+ interface GamifiedOverviewProps extends LearningViewProps {
6
+ onStart?: () => void;
7
+ }
8
+ declare function Overview({
9
+ track,
10
+ progress,
11
+ onStart
12
+ }: GamifiedOverviewProps): react_jsx_runtime3.JSX.Element;
13
+ //#endregion
14
+ export { Overview };
15
+ //# sourceMappingURL=Overview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Overview.d.ts","names":[],"sources":["../../src/views/Overview.tsx"],"sourcesContent":[],"mappings":";;;;UAgBU,qBAAA,SAA8B;;;AAA9B,iBAIM,QAAA,CAJgB;EAAA,KAAQ;EAAA,QAAA;EAAA;AAAiB,CAAA,EAIF,qBAJE,CAAA,EAImB,kBAAA,CAAA,GAAA,CAAA,OAJnB"}