@lessonkit/react 0.9.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -88
- package/block-catalog.v1.json +33 -1
- package/dist/index.cjs +585 -410
- package/dist/index.d.cts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.js +573 -379
- package/package.json +19 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import * as _lessonkit_core from '@lessonkit/core';
|
|
4
|
-
import {
|
|
5
|
-
export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost,
|
|
4
|
+
import { CourseId, TelemetryUser, TrackingClient, LessonkitPlugin, ProgressState, LessonId, TelemetryEventName, PluginHost, CheckId, BlockId } from '@lessonkit/core';
|
|
5
|
+
export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost, PluginRegistry, TelemetryPipelineSink, buildTelemetryEvent, createLessonkitRuntime, createPluginRegistry, createTelemetryPipeline, defineAssessmentPlugin, defineLifecyclePlugin, defineTelemetryPlugin } from '@lessonkit/core';
|
|
6
6
|
import { XAPITransport, XAPIClient } from '@lessonkit/xapi';
|
|
7
7
|
import { LessonkitThemeV1, ThemePresetName, PartialLessonkitThemeV1 } from '@lessonkit/themes';
|
|
8
8
|
export { ThemePresetName } from '@lessonkit/themes';
|
|
9
9
|
|
|
10
|
-
type ProgressState = {
|
|
11
|
-
activeLessonId?: LessonId;
|
|
12
|
-
completedLessonIds: ReadonlySet<LessonId>;
|
|
13
|
-
courseCompleted: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
10
|
type LessonkitConfig = {
|
|
17
11
|
courseId: CourseId;
|
|
18
12
|
session?: {
|
|
@@ -41,6 +35,10 @@ type LessonkitConfig = {
|
|
|
41
35
|
};
|
|
42
36
|
/** Framework plugins (analytics, LMS, assessment, interaction, AI). */
|
|
43
37
|
plugins?: LessonkitPlugin[];
|
|
38
|
+
/** Runtime implementation (`v2` headless runtime is default; set `"v1"` to opt out). */
|
|
39
|
+
runtimeVersion?: "v1" | "v2";
|
|
40
|
+
/** Optional custom telemetry pipeline sinks (used alongside tracking/xapi). */
|
|
41
|
+
sinks?: _lessonkit_core.TelemetryPipelineSink[];
|
|
44
42
|
};
|
|
45
43
|
|
|
46
44
|
type LessonkitRuntime = {
|
|
@@ -66,6 +64,8 @@ declare function LessonkitProvider(props: {
|
|
|
66
64
|
children: React.ReactNode;
|
|
67
65
|
}): react_jsx_runtime.JSX.Element;
|
|
68
66
|
|
|
67
|
+
/** @internal Reset module warnings between tests. */
|
|
68
|
+
declare function resetQuizWarningsForTests(): void;
|
|
69
69
|
declare function Course(props: {
|
|
70
70
|
title: string;
|
|
71
71
|
courseId: CourseId;
|
|
@@ -75,6 +75,8 @@ declare function Course(props: {
|
|
|
75
75
|
declare function Lesson(props: {
|
|
76
76
|
title: string;
|
|
77
77
|
lessonId: LessonId;
|
|
78
|
+
/** When false, unmount does not emit lesson_completed (for routed multi-pane layouts). Default true. */
|
|
79
|
+
autoCompleteOnUnmount?: boolean;
|
|
78
80
|
children: React.ReactNode;
|
|
79
81
|
}): react_jsx_runtime.JSX.Element;
|
|
80
82
|
declare function Scenario(props: {
|
|
@@ -84,6 +86,9 @@ declare function Scenario(props: {
|
|
|
84
86
|
declare function Reflection(props: {
|
|
85
87
|
blockId?: BlockId;
|
|
86
88
|
prompt?: string;
|
|
89
|
+
hint?: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
onChange?: (value: string) => void;
|
|
87
92
|
children?: React.ReactNode;
|
|
88
93
|
}): react_jsx_runtime.JSX.Element;
|
|
89
94
|
declare function KnowledgeCheck(props: {
|
|
@@ -100,20 +105,22 @@ declare function Quiz(props: {
|
|
|
100
105
|
answer: string;
|
|
101
106
|
passingScore?: number;
|
|
102
107
|
}): react_jsx_runtime.JSX.Element;
|
|
103
|
-
declare function ProgressTracker(
|
|
108
|
+
declare function ProgressTracker(props: {
|
|
109
|
+
totalLessons?: number;
|
|
110
|
+
}): react_jsx_runtime.JSX.Element;
|
|
104
111
|
|
|
105
112
|
declare function useLessonkit(): LessonkitRuntime;
|
|
106
|
-
declare function useProgress(): ProgressState;
|
|
113
|
+
declare function useProgress(): _lessonkit_core.ProgressState;
|
|
107
114
|
declare function useTracking(): {
|
|
108
115
|
track: (name: _lessonkit_core.TelemetryEventName, data?: unknown, opts?: {
|
|
109
|
-
lessonId?:
|
|
116
|
+
lessonId?: LessonId;
|
|
110
117
|
}) => void;
|
|
111
118
|
};
|
|
112
119
|
declare function useCompletion(): {
|
|
113
|
-
completeLesson: (lessonId:
|
|
120
|
+
completeLesson: (lessonId: LessonId) => void;
|
|
114
121
|
completeCourse: () => void;
|
|
115
122
|
};
|
|
116
|
-
declare function useQuizState(): {
|
|
123
|
+
declare function useQuizState(enclosingLessonId?: LessonId): {
|
|
117
124
|
answer: (opts: {
|
|
118
125
|
checkId: CheckId;
|
|
119
126
|
question: string;
|
|
@@ -186,4 +193,4 @@ declare const BLOCK_CATALOG: BlockCatalogEntry[];
|
|
|
186
193
|
declare function buildBlockCatalog(): BlockCatalogEntry[];
|
|
187
194
|
declare function getBlockCatalogEntry(type: string): BlockCatalogEntry | undefined;
|
|
188
195
|
|
|
189
|
-
export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
|
|
196
|
+
export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, resetQuizWarningsForTests, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import * as _lessonkit_core from '@lessonkit/core';
|
|
4
|
-
import {
|
|
5
|
-
export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost,
|
|
4
|
+
import { CourseId, TelemetryUser, TrackingClient, LessonkitPlugin, ProgressState, LessonId, TelemetryEventName, PluginHost, CheckId, BlockId } from '@lessonkit/core';
|
|
5
|
+
export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost, PluginRegistry, TelemetryPipelineSink, buildTelemetryEvent, createLessonkitRuntime, createPluginRegistry, createTelemetryPipeline, defineAssessmentPlugin, defineLifecyclePlugin, defineTelemetryPlugin } from '@lessonkit/core';
|
|
6
6
|
import { XAPITransport, XAPIClient } from '@lessonkit/xapi';
|
|
7
7
|
import { LessonkitThemeV1, ThemePresetName, PartialLessonkitThemeV1 } from '@lessonkit/themes';
|
|
8
8
|
export { ThemePresetName } from '@lessonkit/themes';
|
|
9
9
|
|
|
10
|
-
type ProgressState = {
|
|
11
|
-
activeLessonId?: LessonId;
|
|
12
|
-
completedLessonIds: ReadonlySet<LessonId>;
|
|
13
|
-
courseCompleted: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
10
|
type LessonkitConfig = {
|
|
17
11
|
courseId: CourseId;
|
|
18
12
|
session?: {
|
|
@@ -41,6 +35,10 @@ type LessonkitConfig = {
|
|
|
41
35
|
};
|
|
42
36
|
/** Framework plugins (analytics, LMS, assessment, interaction, AI). */
|
|
43
37
|
plugins?: LessonkitPlugin[];
|
|
38
|
+
/** Runtime implementation (`v2` headless runtime is default; set `"v1"` to opt out). */
|
|
39
|
+
runtimeVersion?: "v1" | "v2";
|
|
40
|
+
/** Optional custom telemetry pipeline sinks (used alongside tracking/xapi). */
|
|
41
|
+
sinks?: _lessonkit_core.TelemetryPipelineSink[];
|
|
44
42
|
};
|
|
45
43
|
|
|
46
44
|
type LessonkitRuntime = {
|
|
@@ -66,6 +64,8 @@ declare function LessonkitProvider(props: {
|
|
|
66
64
|
children: React.ReactNode;
|
|
67
65
|
}): react_jsx_runtime.JSX.Element;
|
|
68
66
|
|
|
67
|
+
/** @internal Reset module warnings between tests. */
|
|
68
|
+
declare function resetQuizWarningsForTests(): void;
|
|
69
69
|
declare function Course(props: {
|
|
70
70
|
title: string;
|
|
71
71
|
courseId: CourseId;
|
|
@@ -75,6 +75,8 @@ declare function Course(props: {
|
|
|
75
75
|
declare function Lesson(props: {
|
|
76
76
|
title: string;
|
|
77
77
|
lessonId: LessonId;
|
|
78
|
+
/** When false, unmount does not emit lesson_completed (for routed multi-pane layouts). Default true. */
|
|
79
|
+
autoCompleteOnUnmount?: boolean;
|
|
78
80
|
children: React.ReactNode;
|
|
79
81
|
}): react_jsx_runtime.JSX.Element;
|
|
80
82
|
declare function Scenario(props: {
|
|
@@ -84,6 +86,9 @@ declare function Scenario(props: {
|
|
|
84
86
|
declare function Reflection(props: {
|
|
85
87
|
blockId?: BlockId;
|
|
86
88
|
prompt?: string;
|
|
89
|
+
hint?: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
onChange?: (value: string) => void;
|
|
87
92
|
children?: React.ReactNode;
|
|
88
93
|
}): react_jsx_runtime.JSX.Element;
|
|
89
94
|
declare function KnowledgeCheck(props: {
|
|
@@ -100,20 +105,22 @@ declare function Quiz(props: {
|
|
|
100
105
|
answer: string;
|
|
101
106
|
passingScore?: number;
|
|
102
107
|
}): react_jsx_runtime.JSX.Element;
|
|
103
|
-
declare function ProgressTracker(
|
|
108
|
+
declare function ProgressTracker(props: {
|
|
109
|
+
totalLessons?: number;
|
|
110
|
+
}): react_jsx_runtime.JSX.Element;
|
|
104
111
|
|
|
105
112
|
declare function useLessonkit(): LessonkitRuntime;
|
|
106
|
-
declare function useProgress(): ProgressState;
|
|
113
|
+
declare function useProgress(): _lessonkit_core.ProgressState;
|
|
107
114
|
declare function useTracking(): {
|
|
108
115
|
track: (name: _lessonkit_core.TelemetryEventName, data?: unknown, opts?: {
|
|
109
|
-
lessonId?:
|
|
116
|
+
lessonId?: LessonId;
|
|
110
117
|
}) => void;
|
|
111
118
|
};
|
|
112
119
|
declare function useCompletion(): {
|
|
113
|
-
completeLesson: (lessonId:
|
|
120
|
+
completeLesson: (lessonId: LessonId) => void;
|
|
114
121
|
completeCourse: () => void;
|
|
115
122
|
};
|
|
116
|
-
declare function useQuizState(): {
|
|
123
|
+
declare function useQuizState(enclosingLessonId?: LessonId): {
|
|
117
124
|
answer: (opts: {
|
|
118
125
|
checkId: CheckId;
|
|
119
126
|
question: string;
|
|
@@ -186,4 +193,4 @@ declare const BLOCK_CATALOG: BlockCatalogEntry[];
|
|
|
186
193
|
declare function buildBlockCatalog(): BlockCatalogEntry[];
|
|
187
194
|
declare function getBlockCatalogEntry(type: string): BlockCatalogEntry | undefined;
|
|
188
195
|
|
|
189
|
-
export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
|
|
196
|
+
export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, resetQuizWarningsForTests, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
|