@contractspec/example.learning-journey-ui-onboarding 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 +494 -0
  4. package/LICENSE +21 -0
  5. package/README.md +35 -0
  6. package/dist/OnboardingMiniApp.d.ts +17 -0
  7. package/dist/OnboardingMiniApp.d.ts.map +1 -0
  8. package/dist/OnboardingMiniApp.js +63 -0
  9. package/dist/OnboardingMiniApp.js.map +1 -0
  10. package/dist/components/CodeSnippet.d.ts +16 -0
  11. package/dist/components/CodeSnippet.d.ts.map +1 -0
  12. package/dist/components/CodeSnippet.js +50 -0
  13. package/dist/components/CodeSnippet.js.map +1 -0
  14. package/dist/components/JourneyMap.d.ts +17 -0
  15. package/dist/components/JourneyMap.d.ts.map +1 -0
  16. package/dist/components/JourneyMap.js +49 -0
  17. package/dist/components/JourneyMap.js.map +1 -0
  18. package/dist/components/StepChecklist.d.ts +25 -0
  19. package/dist/components/StepChecklist.d.ts.map +1 -0
  20. package/dist/components/StepChecklist.js +80 -0
  21. package/dist/components/StepChecklist.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-onboarding.docblock.d.ts +1 -0
  27. package/dist/docs/learning-journey-ui-onboarding.docblock.js +20 -0
  28. package/dist/docs/learning-journey-ui-onboarding.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 +180 -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 +161 -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 +92 -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 +98 -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 +77 -0
  55. package/src/OnboardingMiniApp.tsx +93 -0
  56. package/src/components/CodeSnippet.tsx +56 -0
  57. package/src/components/JourneyMap.tsx +86 -0
  58. package/src/components/StepChecklist.tsx +136 -0
  59. package/src/components/index.ts +3 -0
  60. package/src/docs/index.ts +1 -0
  61. package/src/docs/learning-journey-ui-onboarding.docblock.ts +18 -0
  62. package/src/example.ts +31 -0
  63. package/src/index.ts +10 -0
  64. package/src/views/Overview.tsx +204 -0
  65. package/src/views/Progress.tsx +186 -0
  66. package/src/views/Steps.tsx +92 -0
  67. package/src/views/Timeline.tsx +141 -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 @@
1
+ {"version":3,"file":"Timeline.js","names":[],"sources":["../../src/views/Timeline.tsx"],"sourcesContent":["'use client';\n\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from '@contractspec/lib.ui-kit-web/ui/card';\nimport { JourneyMap } from '../components/JourneyMap';\nimport type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';\n\nexport function Timeline({ track, progress }: LearningViewProps) {\n // Find current step\n const currentStepId =\n track.steps.find((s) => !progress.completedStepIds.includes(s.id))?.id ??\n null;\n\n return (\n <div className=\"space-y-6\">\n {/* Header */}\n <div className=\"text-center\">\n <h2 className=\"text-xl font-bold\">Your Learning Journey</h2>\n <p className=\"text-muted-foreground\">\n Follow the path through each surface and feature\n </p>\n </div>\n\n {/* Journey Map */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>🗺️</span>\n <span>Journey Map</span>\n </CardTitle>\n </CardHeader>\n <CardContent>\n <JourneyMap\n steps={track.steps}\n completedStepIds={progress.completedStepIds}\n currentStepId={currentStepId}\n />\n </CardContent>\n </Card>\n\n {/* Detailed Timeline */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>📍</span>\n <span>Step by Step</span>\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"relative\">\n {/* Vertical line */}\n <div className=\"bg-border absolute top-0 left-4 h-full w-0.5\" />\n\n {/* Steps */}\n <div className=\"space-y-6\">\n {track.steps.map((step, index) => {\n const isCompleted = progress.completedStepIds.includes(step.id);\n const isCurrent = step.id === currentStepId;\n const surface = (step.metadata?.surface as string) ?? 'general';\n\n return (\n <div key={step.id} className=\"relative flex gap-4 pl-2\">\n {/* Node */}\n <div\n className={`relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 transition-all ${\n isCompleted\n ? 'border-green-500 bg-green-500 text-white'\n : isCurrent\n ? 'border-blue-500 bg-blue-500 text-white ring-4 ring-blue-500/20'\n : 'border-border bg-background text-muted-foreground'\n }`}\n >\n {isCompleted ? '✓' : index + 1}\n </div>\n\n {/* Content */}\n <div className=\"flex-1 pb-2\">\n <div className=\"rounded-lg border p-4\">\n <div className=\"flex items-start justify-between gap-2\">\n <div>\n <div className=\"flex items-center gap-2\">\n <h4\n className={`font-semibold ${\n isCompleted\n ? 'text-green-500'\n : isCurrent\n ? 'text-blue-500'\n : 'text-foreground'\n }`}\n >\n {step.title}\n </h4>\n <span className=\"bg-muted text-muted-foreground rounded px-2 py-0.5 text-xs\">\n {surface}\n </span>\n </div>\n <p className=\"text-muted-foreground mt-1 text-sm\">\n {step.description}\n </p>\n </div>\n {step.xpReward && (\n <span\n className={`shrink-0 rounded-full px-2 py-1 text-xs font-semibold ${\n isCompleted\n ? 'bg-green-500/10 text-green-500'\n : 'bg-muted text-muted-foreground'\n }`}\n >\n +{step.xpReward} XP\n </span>\n )}\n </div>\n\n {/* Status */}\n <div className=\"mt-3 text-xs\">\n {isCompleted ? (\n <span className=\"text-green-500\">✓ Completed</span>\n ) : isCurrent ? (\n <span className=\"text-blue-500\">→ In Progress</span>\n ) : (\n <span className=\"text-muted-foreground\">\n ○ Not Started\n </span>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </CardContent>\n </Card>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAWA,SAAgB,SAAS,EAAE,OAAO,YAA+B;CAE/D,MAAM,gBACJ,MAAM,MAAM,MAAM,MAAM,CAAC,SAAS,iBAAiB,SAAS,EAAE,GAAG,CAAC,EAAE,MACpE;AAEF,QACE,qBAAC;EAAI,WAAU;;GAEb,qBAAC;IAAI,WAAU;eACb,oBAAC;KAAG,WAAU;eAAoB;MAA0B,EAC5D,oBAAC;KAAE,WAAU;eAAwB;MAEjC;KACA;GAGN,qBAAC,mBACC,oBAAC,wBACC,qBAAC;IAAU,WAAU;eACnB,oBAAC,oBAAK,QAAU,EAChB,oBAAC,oBAAK,gBAAkB;KACd,GACD,EACb,oBAAC,yBACC,oBAAC;IACC,OAAO,MAAM;IACb,kBAAkB,SAAS;IACZ;KACf,GACU,IACT;GAGP,qBAAC,mBACC,oBAAC,wBACC,qBAAC;IAAU,WAAU;eACnB,oBAAC,oBAAK,OAAS,EACf,oBAAC,oBAAK,iBAAmB;KACf,GACD,EACb,oBAAC,yBACC,qBAAC;IAAI,WAAU;eAEb,oBAAC,SAAI,WAAU,iDAAiD,EAGhE,oBAAC;KAAI,WAAU;eACZ,MAAM,MAAM,KAAK,MAAM,UAAU;MAChC,MAAM,cAAc,SAAS,iBAAiB,SAAS,KAAK,GAAG;MAC/D,MAAM,YAAY,KAAK,OAAO;MAC9B,MAAM,UAAW,KAAK,UAAU,WAAsB;AAEtD,aACE,qBAAC;OAAkB,WAAU;kBAE3B,oBAAC;QACC,WAAW,wGACT,cACI,6CACA,YACE,mEACA;kBAGP,cAAc,MAAM,QAAQ;SACzB,EAGN,oBAAC;QAAI,WAAU;kBACb,qBAAC;SAAI,WAAU;oBACb,qBAAC;UAAI,WAAU;qBACb,qBAAC,oBACC,qBAAC;WAAI,WAAU;sBACb,oBAAC;YACC,WAAW,iBACT,cACI,mBACA,YACE,kBACA;sBAGP,KAAK;aACH,EACL,oBAAC;YAAK,WAAU;sBACb;aACI;YACH,EACN,oBAAC;WAAE,WAAU;qBACV,KAAK;YACJ,IACA,EACL,KAAK,YACJ,qBAAC;WACC,WAAW,yDACT,cACI,mCACA;;YAEP;YACG,KAAK;YAAS;;YACX;WAEL,EAGN,oBAAC;UAAI,WAAU;oBACZ,cACC,oBAAC;WAAK,WAAU;qBAAiB;YAAkB,GACjD,YACF,oBAAC;WAAK,WAAU;qBAAgB;YAAoB,GAEpD,oBAAC;WAAK,WAAU;qBAAwB;YAEjC;WAEL;UACF;SACF;SAjEE,KAAK,GAkET;OAER;MACE;KACF,GACM,IACT;;GACH"}
@@ -0,0 +1,5 @@
1
+ import { Overview } from "./Overview.js";
2
+ import { Steps } from "./Steps.js";
3
+ import { Progress as ProgressView } from "./Progress.js";
4
+ import { Timeline } from "./Timeline.js";
5
+ export { Overview, ProgressView as Progress, Steps, Timeline };
@@ -0,0 +1,6 @@
1
+ import { Overview } from "./Overview.js";
2
+ import { Steps } from "./Steps.js";
3
+ import { Progress as ProgressView } from "./Progress.js";
4
+ import { Timeline } from "./Timeline.js";
5
+
6
+ export { Overview, ProgressView as Progress, Steps, Timeline };
package/example.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from './src/example';
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@contractspec/example.learning-journey-ui-onboarding",
3
+ "version": "0.0.0-canary-20260113170453",
4
+ "description": "Developer onboarding UI with checklists and journey maps.",
5
+ "type": "module",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./components": "./dist/components/index.js",
10
+ "./components/CodeSnippet": "./dist/components/CodeSnippet.js",
11
+ "./components/JourneyMap": "./dist/components/JourneyMap.js",
12
+ "./components/StepChecklist": "./dist/components/StepChecklist.js",
13
+ "./docs": "./dist/docs/index.js",
14
+ "./docs/learning-journey-ui-onboarding.docblock": "./dist/docs/learning-journey-ui-onboarding.docblock.js",
15
+ "./example": "./dist/example.js",
16
+ "./OnboardingMiniApp": "./dist/OnboardingMiniApp.js",
17
+ "./views": "./dist/views/index.js",
18
+ "./views/Overview": "./dist/views/Overview.js",
19
+ "./views/Progress": "./dist/views/Progress.js",
20
+ "./views/Steps": "./dist/views/Steps.js",
21
+ "./views/Timeline": "./dist/views/Timeline.js",
22
+ "./*": "./*"
23
+ },
24
+ "scripts": {
25
+ "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
26
+ "publish:pkg:canary": "bun publish:pkg --tag canary",
27
+ "build": "bun build:types && bun build:bundle",
28
+ "build:bundle": "tsdown",
29
+ "build:types": "tsc --noEmit",
30
+ "dev": "bun build:bundle --watch",
31
+ "clean": "rimraf dist .turbo",
32
+ "lint": "bun lint:fix",
33
+ "lint:fix": "eslint src --fix",
34
+ "lint:check": "eslint src",
35
+ "test": "bun test"
36
+ },
37
+ "dependencies": {
38
+ "@contractspec/lib.ui-kit-core": "0.0.0-canary-20260113170453",
39
+ "@contractspec/lib.contracts": "0.0.0-canary-20260113170453",
40
+ "@contractspec/example.learning-journey-ui-shared": "0.0.0-canary-20260113170453",
41
+ "@contractspec/example.learning-journey-studio-onboarding": "0.0.0-canary-20260113170453",
42
+ "@contractspec/example.learning-journey-platform-tour": "0.0.0-canary-20260113170453",
43
+ "@contractspec/module.learning-journey": "0.0.0-canary-20260113170453",
44
+ "@contractspec/lib.design-system": "0.0.0-canary-20260113170453",
45
+ "@contractspec/lib.ui-kit-web": "0.0.0-canary-20260113170453",
46
+ "react": "19.2.3"
47
+ },
48
+ "devDependencies": {
49
+ "@contractspec/tool.tsdown": "0.0.0-canary-20260113170453",
50
+ "@contractspec/tool.typescript": "0.0.0-canary-20260113170453",
51
+ "@types/react": "^19.2.8",
52
+ "tsdown": "^0.19.0",
53
+ "typescript": "^5.9.3"
54
+ },
55
+ "peerDependencies": {
56
+ "react": "^19.2.3"
57
+ },
58
+ "publishConfig": {
59
+ "exports": {
60
+ ".": "./dist/index.js",
61
+ "./example": "./dist/example.js",
62
+ "./docs": "./dist/docs/index.js",
63
+ "./views": "./dist/views/index.js",
64
+ "./components": "./dist/components/index.js",
65
+ "./*": "./*"
66
+ },
67
+ "registry": "https://registry.npmjs.org/",
68
+ "access": "public"
69
+ },
70
+ "license": "MIT",
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "https://github.com/lssm-tech/contractspec.git",
74
+ "directory": "packages/examples/learning-journey-ui-onboarding"
75
+ },
76
+ "homepage": "https://contractspec.io"
77
+ }
@@ -0,0 +1,93 @@
1
+ 'use client';
2
+
3
+ import { useState, useCallback } from 'react';
4
+ import { Card, CardContent } from '@contractspec/lib.ui-kit-web/ui/card';
5
+ import {
6
+ ViewTabs,
7
+ useLearningProgress,
8
+ type LearningView,
9
+ type LearningMiniAppProps,
10
+ } from '@contractspec/example.learning-journey-ui-shared';
11
+ import { Overview } from './views/Overview';
12
+ import { Steps } from './views/Steps';
13
+ import { Progress } from './views/Progress';
14
+ import { Timeline } from './views/Timeline';
15
+
16
+ type OnboardingMiniAppProps = Omit<LearningMiniAppProps, 'progress'> & {
17
+ progress?: LearningMiniAppProps['progress'];
18
+ };
19
+
20
+ export function OnboardingMiniApp({
21
+ track,
22
+ progress: externalProgress,
23
+ onStepComplete: externalOnStepComplete,
24
+ onViewChange,
25
+ initialView = 'overview',
26
+ }: OnboardingMiniAppProps) {
27
+ const [currentView, setCurrentView] = useState<LearningView>(initialView);
28
+
29
+ // Use internal progress if not provided externally
30
+ const { progress: internalProgress, completeStep: internalCompleteStep } =
31
+ useLearningProgress(track);
32
+
33
+ const progress = externalProgress ?? internalProgress;
34
+
35
+ const handleViewChange = useCallback(
36
+ (view: LearningView) => {
37
+ setCurrentView(view);
38
+ onViewChange?.(view);
39
+ },
40
+ [onViewChange]
41
+ );
42
+
43
+ const handleStepComplete = useCallback(
44
+ (stepId: string) => {
45
+ if (externalOnStepComplete) {
46
+ externalOnStepComplete(stepId);
47
+ } else {
48
+ internalCompleteStep(stepId);
49
+ }
50
+ },
51
+ [externalOnStepComplete, internalCompleteStep]
52
+ );
53
+
54
+ const handleStartFromOverview = useCallback(() => {
55
+ setCurrentView('steps');
56
+ onViewChange?.('steps');
57
+ }, [onViewChange]);
58
+
59
+ const renderView = () => {
60
+ const viewProps = {
61
+ track,
62
+ progress,
63
+ onStepComplete: handleStepComplete,
64
+ };
65
+
66
+ switch (currentView) {
67
+ case 'overview':
68
+ return <Overview {...viewProps} onStart={handleStartFromOverview} />;
69
+ case 'steps':
70
+ return <Steps {...viewProps} />;
71
+ case 'progress':
72
+ return <Progress {...viewProps} />;
73
+ case 'timeline':
74
+ return <Timeline {...viewProps} />;
75
+ default:
76
+ return <Overview {...viewProps} onStart={handleStartFromOverview} />;
77
+ }
78
+ };
79
+
80
+ return (
81
+ <div className="space-y-6">
82
+ {/* Navigation */}
83
+ <Card>
84
+ <CardContent className="p-4">
85
+ <ViewTabs currentView={currentView} onViewChange={handleViewChange} />
86
+ </CardContent>
87
+ </Card>
88
+
89
+ {/* Current View */}
90
+ {renderView()}
91
+ </div>
92
+ );
93
+ }
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import { Button } from '@contractspec/lib.design-system';
5
+
6
+ interface CodeSnippetProps {
7
+ code: string;
8
+ language?: string;
9
+ title?: string;
10
+ }
11
+
12
+ export function CodeSnippet({
13
+ code,
14
+ language = 'typescript',
15
+ title,
16
+ }: CodeSnippetProps) {
17
+ const [copied, setCopied] = useState(false);
18
+
19
+ const handleCopy = async () => {
20
+ await navigator.clipboard.writeText(code);
21
+ setCopied(true);
22
+ setTimeout(() => setCopied(false), 2000);
23
+ };
24
+
25
+ return (
26
+ <div className="bg-muted/50 overflow-hidden rounded-lg border">
27
+ {/* Header */}
28
+ <div className="bg-muted flex items-center justify-between border-b px-4 py-2">
29
+ <div className="flex items-center gap-2">
30
+ <span className="text-muted-foreground text-xs font-medium uppercase">
31
+ {language}
32
+ </span>
33
+ {title && (
34
+ <>
35
+ <span className="text-muted-foreground">•</span>
36
+ <span className="text-sm">{title}</span>
37
+ </>
38
+ )}
39
+ </div>
40
+ <Button
41
+ variant="ghost"
42
+ size="sm"
43
+ onClick={handleCopy}
44
+ className="h-7 text-xs"
45
+ >
46
+ {copied ? '✓ Copied' : 'Copy'}
47
+ </Button>
48
+ </div>
49
+
50
+ {/* Code */}
51
+ <pre className="overflow-x-auto p-4">
52
+ <code className="text-sm">{code}</code>
53
+ </pre>
54
+ </div>
55
+ );
56
+ }
@@ -0,0 +1,86 @@
1
+ 'use client';
2
+
3
+ import { cn } from '@contractspec/lib.ui-kit-web/ui/utils';
4
+ import type { LearningJourneyStepSpec } from '@contractspec/module.learning-journey/track-spec';
5
+
6
+ interface JourneyMapProps {
7
+ steps: LearningJourneyStepSpec[];
8
+ completedStepIds: string[];
9
+ currentStepId?: string | null;
10
+ }
11
+
12
+ const SURFACE_ICONS: Record<string, string> = {
13
+ templates: '📋',
14
+ 'spec-editor': '✏️',
15
+ regenerator: '🔄',
16
+ playground: '🎮',
17
+ evolution: '🤖',
18
+ dashboard: '📊',
19
+ settings: '⚙️',
20
+ default: '📍',
21
+ };
22
+
23
+ export function JourneyMap({
24
+ steps,
25
+ completedStepIds,
26
+ currentStepId,
27
+ }: JourneyMapProps) {
28
+ return (
29
+ <div className="relative overflow-x-auto pb-4">
30
+ <div className="flex min-w-max items-center gap-2">
31
+ {steps.map((step, index) => {
32
+ const isCompleted = completedStepIds.includes(step.id);
33
+ const isCurrent = step.id === currentStepId;
34
+ const surface = (step.metadata?.surface as string) ?? 'default';
35
+ const icon = SURFACE_ICONS[surface] ?? SURFACE_ICONS.default;
36
+
37
+ return (
38
+ <div key={step.id} className="flex items-center">
39
+ {/* Node */}
40
+ <div className="flex flex-col items-center gap-2">
41
+ <div
42
+ className={cn(
43
+ 'flex h-14 w-14 items-center justify-center rounded-2xl border-2 text-2xl transition-all',
44
+ isCompleted && 'border-green-500 bg-green-500/10',
45
+ isCurrent &&
46
+ !isCompleted &&
47
+ 'border-violet-500 bg-violet-500/10 ring-4 ring-violet-500/20',
48
+ !isCompleted && !isCurrent && 'border-muted bg-muted/50'
49
+ )}
50
+ >
51
+ {isCompleted ? '✓' : icon}
52
+ </div>
53
+ <div className="text-center">
54
+ <p
55
+ className={cn(
56
+ 'max-w-[100px] truncate text-xs font-medium',
57
+ isCompleted && 'text-green-500',
58
+ isCurrent && !isCompleted && 'text-violet-500',
59
+ !isCompleted && !isCurrent && 'text-muted-foreground'
60
+ )}
61
+ >
62
+ {step.title}
63
+ </p>
64
+ </div>
65
+ </div>
66
+
67
+ {/* Connector */}
68
+ {index < steps.length - 1 && (
69
+ <div
70
+ className={cn(
71
+ 'mx-2 h-1 w-8 rounded-full transition-colors',
72
+ completedStepIds.includes(steps[index + 1]?.id ?? '')
73
+ ? 'bg-green-500'
74
+ : isCompleted
75
+ ? 'bg-green-500/50'
76
+ : 'bg-muted'
77
+ )}
78
+ />
79
+ )}
80
+ </div>
81
+ );
82
+ })}
83
+ </div>
84
+ </div>
85
+ );
86
+ }
@@ -0,0 +1,136 @@
1
+ 'use client';
2
+
3
+ import { Button } from '@contractspec/lib.design-system';
4
+ import { cn } from '@contractspec/lib.ui-kit-core';
5
+ import type { LearningJourneyStepSpec } from '@contractspec/module.learning-journey/track-spec';
6
+
7
+ interface StepChecklistProps {
8
+ step: LearningJourneyStepSpec;
9
+ stepNumber: number;
10
+ isCompleted: boolean;
11
+ isCurrent: boolean;
12
+ isExpanded: boolean;
13
+ onToggle: () => void;
14
+ onComplete?: () => void;
15
+ }
16
+
17
+ export function StepChecklist({
18
+ step,
19
+ stepNumber,
20
+ isCompleted,
21
+ isCurrent,
22
+ isExpanded,
23
+ onToggle,
24
+ onComplete,
25
+ }: StepChecklistProps) {
26
+ return (
27
+ <div
28
+ className={cn(
29
+ 'rounded-xl border transition-all',
30
+ isCompleted && 'border-green-500/50 bg-green-500/5',
31
+ isCurrent && !isCompleted && 'border-violet-500 bg-violet-500/5',
32
+ !isCompleted && !isCurrent && 'border-border'
33
+ )}
34
+ >
35
+ {/* Header */}
36
+ <button
37
+ type="button"
38
+ className="flex w-full items-center gap-4 p-4 text-left"
39
+ onClick={onToggle}
40
+ >
41
+ {/* Checkbox/Number */}
42
+ <div
43
+ className={cn(
44
+ 'flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors',
45
+ isCompleted && 'border-green-500 bg-green-500 text-white',
46
+ isCurrent && !isCompleted && 'border-violet-500 text-violet-500',
47
+ !isCompleted &&
48
+ !isCurrent &&
49
+ 'border-muted-foreground text-muted-foreground'
50
+ )}
51
+ >
52
+ {isCompleted ? '✓' : stepNumber}
53
+ </div>
54
+
55
+ {/* Title & Description */}
56
+ <div className="min-w-0 flex-1">
57
+ <h4
58
+ className={cn(
59
+ 'font-semibold',
60
+ isCompleted && 'text-green-500',
61
+ isCurrent && !isCompleted && 'text-foreground',
62
+ !isCompleted && !isCurrent && 'text-muted-foreground'
63
+ )}
64
+ >
65
+ {step.title}
66
+ </h4>
67
+ {!isExpanded && step.description && (
68
+ <p className="text-muted-foreground truncate text-sm">
69
+ {step.description}
70
+ </p>
71
+ )}
72
+ </div>
73
+
74
+ {/* XP Badge */}
75
+ {step.xpReward && (
76
+ <span
77
+ className={cn(
78
+ 'shrink-0 rounded-full px-2 py-1 text-xs font-semibold',
79
+ isCompleted
80
+ ? 'bg-green-500/10 text-green-500'
81
+ : 'bg-muted text-muted-foreground'
82
+ )}
83
+ >
84
+ +{step.xpReward} XP
85
+ </span>
86
+ )}
87
+
88
+ {/* Expand indicator */}
89
+ <span
90
+ className={cn(
91
+ 'shrink-0 transition-transform',
92
+ isExpanded && 'rotate-180'
93
+ )}
94
+ >
95
+
96
+ </span>
97
+ </button>
98
+
99
+ {/* Expanded Content */}
100
+ {isExpanded && (
101
+ <div className="border-t px-4 py-4">
102
+ {step.description && (
103
+ <p className="text-muted-foreground mb-4">{step.description}</p>
104
+ )}
105
+
106
+ {step.instructions && (
107
+ <div className="bg-muted mb-4 rounded-lg p-4">
108
+ <p className="mb-2 text-sm font-medium">Instructions:</p>
109
+ <p className="text-muted-foreground text-sm">
110
+ {step.instructions}
111
+ </p>
112
+ </div>
113
+ )}
114
+
115
+ {/* Action buttons */}
116
+ <div className="flex flex-wrap gap-2">
117
+ {step.actionUrl && (
118
+ <Button
119
+ variant="outline"
120
+ size="sm"
121
+ onClick={() => window.open(step.actionUrl, '_blank')}
122
+ >
123
+ {step.actionLabel ?? 'Try it'}
124
+ </Button>
125
+ )}
126
+ {!isCompleted && (
127
+ <Button size="sm" onClick={onComplete}>
128
+ Mark as Complete
129
+ </Button>
130
+ )}
131
+ </div>
132
+ </div>
133
+ )}
134
+ </div>
135
+ );
136
+ }
@@ -0,0 +1,3 @@
1
+ export { StepChecklist } from './StepChecklist';
2
+ export { CodeSnippet } from './CodeSnippet';
3
+ export { JourneyMap } from './JourneyMap';
@@ -0,0 +1 @@
1
+ import './learning-journey-ui-onboarding.docblock';
@@ -0,0 +1,18 @@
1
+ import type { DocBlock } from '@contractspec/lib.contracts/docs';
2
+ import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
3
+
4
+ const blocks: DocBlock[] = [
5
+ {
6
+ id: 'docs.examples.learning-journey-ui-onboarding',
7
+ title: 'Learning Journey UI — Onboarding',
8
+ summary:
9
+ 'UI mini-app components for onboarding: checklists, snippets, and journey mapping.',
10
+ kind: 'reference',
11
+ visibility: 'public',
12
+ route: '/docs/examples/learning-journey-ui-onboarding',
13
+ tags: ['learning', 'ui', 'onboarding'],
14
+ body: `## Includes\n- Onboarding mini-app shell\n- Views: overview, steps, progress, timeline\n- Components: step checklist, code snippet, journey map\n\n## Notes\n- Compose with design system components.\n- Ensure accessible labels and keyboard navigation.`,
15
+ },
16
+ ];
17
+
18
+ registerDocBlocks(blocks);
package/src/example.ts ADDED
@@ -0,0 +1,31 @@
1
+ import { defineExample } from '@contractspec/lib.contracts';
2
+
3
+ const example = defineExample({
4
+ meta: {
5
+ key: 'learning-journey-ui-onboarding',
6
+ version: '1.0.0',
7
+ title: 'Learning Journey UI — Onboarding',
8
+ description:
9
+ 'UI mini-app for onboarding patterns: checklists, code snippets, journey map.',
10
+ kind: 'ui',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['learning', 'ui', 'onboarding'],
15
+ },
16
+ docs: {
17
+ rootDocId: 'docs.examples.learning-journey-ui-onboarding',
18
+ },
19
+ entrypoints: {
20
+ packageName: '@contractspec/example.learning-journey-ui-onboarding',
21
+ docs: './docs',
22
+ },
23
+ surfaces: {
24
+ templates: true,
25
+ sandbox: { enabled: true, modes: ['playground', 'markdown'] },
26
+ studio: { enabled: true, installable: true },
27
+ mcp: { enabled: true },
28
+ },
29
+ });
30
+
31
+ export default example;
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ // Main mini-app
2
+ export { OnboardingMiniApp } from './OnboardingMiniApp';
3
+
4
+ // Views
5
+ export { Overview, Steps, Progress, Timeline } from './views';
6
+
7
+ // Components
8
+ export { StepChecklist, CodeSnippet, JourneyMap } from './components';
9
+ export { default as example } from './example';
10
+ import './docs';