@sp-days-framework/docusaurus-plugin-interactive-tasks 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/LICENSE +21 -0
- package/README.md +339 -0
- package/lib/contexts/DocTaskCounterContext.d.ts +15 -0
- package/lib/contexts/DocTaskCounterContext.d.ts.map +1 -0
- package/lib/contexts/DocTaskCounterContext.js +7 -0
- package/lib/contexts/DocTaskCounterContext.js.map +1 -0
- package/lib/contexts/TaskContext.d.ts +72 -0
- package/lib/contexts/TaskContext.d.ts.map +1 -0
- package/lib/contexts/TaskContext.js +6 -0
- package/lib/contexts/TaskContext.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +59 -0
- package/lib/index.js.map +1 -0
- package/lib/plugin/TaskRegistryPlugin.d.ts +27 -0
- package/lib/plugin/TaskRegistryPlugin.d.ts.map +1 -0
- package/lib/plugin/TaskRegistryPlugin.js +328 -0
- package/lib/plugin/TaskRegistryPlugin.js.map +1 -0
- package/lib/plugin/remarkTaskDirective.d.ts +29 -0
- package/lib/plugin/remarkTaskDirective.d.ts.map +1 -0
- package/lib/plugin/remarkTaskDirective.js +277 -0
- package/lib/plugin/remarkTaskDirective.js.map +1 -0
- package/lib/theme/DocRoot/Layout/index.d.ts +14 -0
- package/lib/theme/DocRoot/Layout/index.d.ts.map +1 -0
- package/lib/theme/DocRoot/Layout/index.js +27 -0
- package/lib/theme/DocRoot/Layout/index.js.map +1 -0
- package/lib/theme/DocRoot/index.d.ts +22 -0
- package/lib/theme/DocRoot/index.d.ts.map +1 -0
- package/lib/theme/DocRoot/index.js +33 -0
- package/lib/theme/DocRoot/index.js.map +1 -0
- package/lib/theme/DocSidebar/Desktop/CollapseButton/index.d.ts +4 -0
- package/lib/theme/DocSidebar/Desktop/CollapseButton/index.d.ts.map +1 -0
- package/lib/theme/DocSidebar/Desktop/CollapseButton/index.js +24 -0
- package/lib/theme/DocSidebar/Desktop/CollapseButton/index.js.map +1 -0
- package/lib/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +40 -0
- package/lib/theme/DocSidebar/Desktop/Content/index.d.ts +4 -0
- package/lib/theme/DocSidebar/Desktop/Content/index.d.ts.map +1 -0
- package/lib/theme/DocSidebar/Desktop/Content/index.js +67 -0
- package/lib/theme/DocSidebar/Desktop/Content/index.js.map +1 -0
- package/lib/theme/DocSidebar/Desktop/Content/styles.module.css +16 -0
- package/lib/theme/DocSidebar/Desktop/index.d.ts +6 -0
- package/lib/theme/DocSidebar/Desktop/index.d.ts.map +1 -0
- package/lib/theme/DocSidebar/Desktop/index.js +21 -0
- package/lib/theme/DocSidebar/Desktop/index.js.map +1 -0
- package/lib/theme/DocSidebar/Desktop/styles.module.css +37 -0
- package/lib/theme/DocSidebar/Mobile/index.d.ts +6 -0
- package/lib/theme/DocSidebar/Mobile/index.d.ts.map +1 -0
- package/lib/theme/DocSidebar/Mobile/index.js +29 -0
- package/lib/theme/DocSidebar/Mobile/index.js.map +1 -0
- package/lib/theme/DocSidebar/index.d.ts +4 -0
- package/lib/theme/DocSidebar/index.d.ts.map +1 -0
- package/lib/theme/DocSidebar/index.js +21 -0
- package/lib/theme/DocSidebar/index.js.map +1 -0
- package/lib/theme/DocSidebarItem/Category/index.d.ts +4 -0
- package/lib/theme/DocSidebarItem/Category/index.d.ts.map +1 -0
- package/lib/theme/DocSidebarItem/Category/index.js +316 -0
- package/lib/theme/DocSidebarItem/Category/index.js.map +1 -0
- package/lib/theme/DocSidebarItem/Category/styles.module.css +187 -0
- package/lib/theme/DocSidebarItem/Html/index.d.ts +4 -0
- package/lib/theme/DocSidebarItem/Html/index.d.ts.map +1 -0
- package/lib/theme/DocSidebarItem/Html/index.js +17 -0
- package/lib/theme/DocSidebarItem/Html/index.js.map +1 -0
- package/lib/theme/DocSidebarItem/Html/styles.module.css +6 -0
- package/lib/theme/DocSidebarItem/Link/index.d.ts +6 -0
- package/lib/theme/DocSidebarItem/Link/index.d.ts.map +1 -0
- package/lib/theme/DocSidebarItem/Link/index.js +149 -0
- package/lib/theme/DocSidebarItem/Link/index.js.map +1 -0
- package/lib/theme/DocSidebarItem/Link/styles.module.css +197 -0
- package/lib/theme/DocSidebarItem/index.d.ts +4 -0
- package/lib/theme/DocSidebarItem/index.d.ts.map +1 -0
- package/lib/theme/DocSidebarItem/index.js +22 -0
- package/lib/theme/DocSidebarItem/index.js.map +1 -0
- package/lib/theme/DocSidebarItems/index.d.ts +6 -0
- package/lib/theme/DocSidebarItems/index.d.ts.map +1 -0
- package/lib/theme/DocSidebarItems/index.js +48 -0
- package/lib/theme/DocSidebarItems/index.js.map +1 -0
- package/lib/theme/DocTaskCounterProvider/index.d.ts +20 -0
- package/lib/theme/DocTaskCounterProvider/index.d.ts.map +1 -0
- package/lib/theme/DocTaskCounterProvider/index.js +105 -0
- package/lib/theme/DocTaskCounterProvider/index.js.map +1 -0
- package/lib/theme/MDXComponents.d.ts +19 -0
- package/lib/theme/MDXComponents.d.ts.map +1 -0
- package/lib/theme/MDXComponents.js +52 -0
- package/lib/theme/MDXComponents.js.map +1 -0
- package/lib/theme/Root.d.ts +9 -0
- package/lib/theme/Root.d.ts.map +1 -0
- package/lib/theme/Root.js +105 -0
- package/lib/theme/Root.js.map +1 -0
- package/lib/theme/Task/Hint/index.d.ts +14 -0
- package/lib/theme/Task/Hint/index.d.ts.map +1 -0
- package/lib/theme/Task/Hint/index.js +23 -0
- package/lib/theme/Task/Hint/index.js.map +1 -0
- package/lib/theme/Task/Hint/styles.module.css +72 -0
- package/lib/theme/Task/Solution/index.d.ts +14 -0
- package/lib/theme/Task/Solution/index.d.ts.map +1 -0
- package/lib/theme/Task/Solution/index.js +23 -0
- package/lib/theme/Task/Solution/index.js.map +1 -0
- package/lib/theme/Task/Solution/styles.module.css +71 -0
- package/lib/theme/Task/Text/index.d.ts +14 -0
- package/lib/theme/Task/Text/index.d.ts.map +1 -0
- package/lib/theme/Task/Text/index.js +18 -0
- package/lib/theme/Task/Text/index.js.map +1 -0
- package/lib/theme/Task/Text/styles.module.css +39 -0
- package/lib/theme/Task/index.d.ts +11 -0
- package/lib/theme/Task/index.d.ts.map +1 -0
- package/lib/theme/Task/index.js +286 -0
- package/lib/theme/Task/index.js.map +1 -0
- package/lib/theme/Task/styles.module.css +529 -0
- package/lib/theme/TaskAutoHideToggle/index.d.ts +10 -0
- package/lib/theme/TaskAutoHideToggle/index.d.ts.map +1 -0
- package/lib/theme/TaskAutoHideToggle/index.js +79 -0
- package/lib/theme/TaskAutoHideToggle/index.js.map +1 -0
- package/lib/theme/TaskAutoHideToggle/styles.module.css +41 -0
- package/lib/theme/TaskExample/index.d.ts +16 -0
- package/lib/theme/TaskExample/index.d.ts.map +1 -0
- package/lib/theme/TaskExample/index.js +249 -0
- package/lib/theme/TaskExample/index.js.map +1 -0
- package/lib/theme/TaskPlaceholder/README.md +119 -0
- package/lib/theme/TaskPlaceholder/index.d.ts +23 -0
- package/lib/theme/TaskPlaceholder/index.d.ts.map +1 -0
- package/lib/theme/TaskPlaceholder/index.js +293 -0
- package/lib/theme/TaskPlaceholder/index.js.map +1 -0
- package/lib/theme/TaskProgression/index.d.ts +11 -0
- package/lib/theme/TaskProgression/index.d.ts.map +1 -0
- package/lib/theme/TaskProgression/index.js +131 -0
- package/lib/theme/TaskProgression/index.js.map +1 -0
- package/lib/theme/TaskProgression/styles.module.css +162 -0
- package/lib/theme/TaskProgressionOverview/index.d.ts +10 -0
- package/lib/theme/TaskProgressionOverview/index.d.ts.map +1 -0
- package/lib/theme/TaskProgressionOverview/index.js +123 -0
- package/lib/theme/TaskProgressionOverview/index.js.map +1 -0
- package/lib/theme/TaskProgressionOverview/styles.module.css +159 -0
- package/lib/theme/TaskProvider/index.d.ts +15 -0
- package/lib/theme/TaskProvider/index.d.ts.map +1 -0
- package/lib/theme/TaskProvider/index.js +134 -0
- package/lib/theme/TaskProvider/index.js.map +1 -0
- package/lib/utils/badgeStyles.d.ts +29 -0
- package/lib/utils/badgeStyles.d.ts.map +1 -0
- package/lib/utils/badgeStyles.js +60 -0
- package/lib/utils/badgeStyles.js.map +1 -0
- package/lib/utils/icons.d.ts +38 -0
- package/lib/utils/icons.d.ts.map +1 -0
- package/lib/utils/icons.js +53 -0
- package/lib/utils/icons.js.map +1 -0
- package/lib/utils/logger.d.ts +38 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/utils/logger.js +72 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/storage.d.ts +33 -0
- package/lib/utils/storage.d.ts.map +1 -0
- package/lib/utils/storage.js +105 -0
- package/lib/utils/storage.js.map +1 -0
- package/lib/utils/useDocTaskStats.d.ts +58 -0
- package/lib/utils/useDocTaskStats.d.ts.map +1 -0
- package/lib/utils/useDocTaskStats.js +206 -0
- package/lib/utils/useDocTaskStats.js.map +1 -0
- package/lib/utils/usePluginId.d.ts +24 -0
- package/lib/utils/usePluginId.d.ts.map +1 -0
- package/lib/utils/usePluginId.js +61 -0
- package/lib/utils/usePluginId.js.map +1 -0
- package/lib/utils/useResolveDocPath.d.ts +33 -0
- package/lib/utils/useResolveDocPath.d.ts.map +1 -0
- package/lib/utils/useResolveDocPath.js +122 -0
- package/lib/utils/useResolveDocPath.js.map +1 -0
- package/lib/utils/useTaskBadgeAnimation.d.ts +16 -0
- package/lib/utils/useTaskBadgeAnimation.d.ts.map +1 -0
- package/lib/utils/useTaskBadgeAnimation.js +51 -0
- package/lib/utils/useTaskBadgeAnimation.js.map +1 -0
- package/lib/validateThemeConfig.d.ts +8 -0
- package/lib/validateThemeConfig.d.ts.map +1 -0
- package/lib/validateThemeConfig.js +15 -0
- package/lib/validateThemeConfig.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for resolving document paths to docId
|
|
3
|
+
* Supports absolute paths, relative paths, and current page (.)
|
|
4
|
+
*/
|
|
5
|
+
export interface ResolvedDocPath {
|
|
6
|
+
docId: string;
|
|
7
|
+
pluginId: string;
|
|
8
|
+
error: null;
|
|
9
|
+
}
|
|
10
|
+
export interface ResolvedDocPathError {
|
|
11
|
+
docId: null;
|
|
12
|
+
pluginId: null;
|
|
13
|
+
error: "path-not-found" | "no-tasks" | "invalid-path";
|
|
14
|
+
errorMessage: string;
|
|
15
|
+
}
|
|
16
|
+
export type ResolvedDocPathResult = ResolvedDocPath | ResolvedDocPathError;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a path to a docId using the task registry
|
|
19
|
+
*
|
|
20
|
+
* @param path - Path to resolve (e.g., "/docs/module1.mdx", "./module2.mdx", ".")
|
|
21
|
+
* @param pluginId - Optional plugin ID (defaults to "default")
|
|
22
|
+
* @returns Resolved docId and pluginId, or error information
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const result = useResolveDocPath("/docs/module1.mdx");
|
|
26
|
+
* if (result.error) {
|
|
27
|
+
* console.warn(result.errorMessage);
|
|
28
|
+
* } else {
|
|
29
|
+
* const stats = useDocTaskStats(result.docId, result.pluginId);
|
|
30
|
+
* }
|
|
31
|
+
*/
|
|
32
|
+
export declare function useResolveDocPath(path: string, pluginId?: string): ResolvedDocPathResult;
|
|
33
|
+
//# sourceMappingURL=useResolveDocPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolveDocPath.d.ts","sourceRoot":"","sources":["../../src/utils/useResolveDocPath.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,gBAAgB,GAAG,UAAU,GAAG,cAAc,CAAC;IACtD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAAkB,GAC3B,qBAAqB,CA8GvB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for resolving document paths to docId
|
|
4
|
+
* Supports absolute paths, relative paths, and current page (.)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useResolveDocPath = useResolveDocPath;
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const client_1 = require("@docusaurus/plugin-content-docs/client");
|
|
10
|
+
const TaskProvider_1 = require("../theme/TaskProvider");
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a path to a docId using the task registry
|
|
13
|
+
*
|
|
14
|
+
* @param path - Path to resolve (e.g., "/docs/module1.mdx", "./module2.mdx", ".")
|
|
15
|
+
* @param pluginId - Optional plugin ID (defaults to "default")
|
|
16
|
+
* @returns Resolved docId and pluginId, or error information
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const result = useResolveDocPath("/docs/module1.mdx");
|
|
20
|
+
* if (result.error) {
|
|
21
|
+
* console.warn(result.errorMessage);
|
|
22
|
+
* } else {
|
|
23
|
+
* const stats = useDocTaskStats(result.docId, result.pluginId);
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
function useResolveDocPath(path, pluginId = "default") {
|
|
27
|
+
const { metadata } = (0, client_1.useDoc)();
|
|
28
|
+
const { taskRegistry } = (0, TaskProvider_1.useTaskContext)();
|
|
29
|
+
return (0, react_1.useMemo)(() => {
|
|
30
|
+
// Registry not loaded - this is expected during initial mount
|
|
31
|
+
// Return a loading state and wait for registry to load
|
|
32
|
+
if (!taskRegistry) {
|
|
33
|
+
return {
|
|
34
|
+
docId: null,
|
|
35
|
+
pluginId: null,
|
|
36
|
+
error: "invalid-path",
|
|
37
|
+
errorMessage: "Task registry loading...",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Handle current page reference
|
|
41
|
+
if (path === ".") {
|
|
42
|
+
const currentDocId = metadata.id;
|
|
43
|
+
const currentPluginId = metadata.pluginId || pluginId;
|
|
44
|
+
const docKey = `${currentPluginId}/${currentDocId}`;
|
|
45
|
+
const docInfo = taskRegistry.docPages[docKey];
|
|
46
|
+
if (!docInfo) {
|
|
47
|
+
return {
|
|
48
|
+
docId: null,
|
|
49
|
+
pluginId: null,
|
|
50
|
+
error: "no-tasks",
|
|
51
|
+
errorMessage: `Current page "${currentDocId}" has no tasks`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
docId: currentDocId,
|
|
56
|
+
pluginId: currentPluginId,
|
|
57
|
+
error: null,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Normalize the path - remove @site prefix if present
|
|
61
|
+
let normalizedPath = path.replace(/^@site\//, "");
|
|
62
|
+
// Handle relative paths
|
|
63
|
+
if (!normalizedPath.startsWith("/")) {
|
|
64
|
+
// Get current doc's source directory
|
|
65
|
+
const currentSource = metadata.source?.replace(/^@site\//, "") || "";
|
|
66
|
+
const currentDir = currentSource.substring(0, currentSource.lastIndexOf("/"));
|
|
67
|
+
// Resolve relative path using proper path resolution
|
|
68
|
+
// Split path into segments and resolve . and .. references
|
|
69
|
+
const currentSegments = currentDir
|
|
70
|
+
? currentDir.split("/").filter(Boolean)
|
|
71
|
+
: [];
|
|
72
|
+
const pathSegments = normalizedPath.split("/").filter(Boolean);
|
|
73
|
+
// Build resolved path
|
|
74
|
+
const resolvedSegments = [...currentSegments];
|
|
75
|
+
for (const segment of pathSegments) {
|
|
76
|
+
if (segment === ".") {
|
|
77
|
+
// Current directory - skip
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
else if (segment === "..") {
|
|
81
|
+
// Parent directory - go up one level
|
|
82
|
+
if (resolvedSegments.length > 0) {
|
|
83
|
+
resolvedSegments.pop();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Normal segment - add to path
|
|
88
|
+
resolvedSegments.push(segment);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Join segments back into path
|
|
92
|
+
normalizedPath = "/" + resolvedSegments.join("/");
|
|
93
|
+
}
|
|
94
|
+
// Ensure path starts with /
|
|
95
|
+
if (!normalizedPath.startsWith("/")) {
|
|
96
|
+
normalizedPath = `/${normalizedPath}`;
|
|
97
|
+
}
|
|
98
|
+
// Clean up double slashes
|
|
99
|
+
normalizedPath = normalizedPath.replace(/\/+/g, "/");
|
|
100
|
+
// Search through all docs in the registry to find matching source
|
|
101
|
+
for (const [docKey, docInfo] of Object.entries(taskRegistry.docPages)) {
|
|
102
|
+
// Get the source path without @site prefix
|
|
103
|
+
const docSource = docInfo.source.replace(/^@site/, "");
|
|
104
|
+
// Check if paths match
|
|
105
|
+
if (docSource === normalizedPath) {
|
|
106
|
+
return {
|
|
107
|
+
docId: docInfo.id,
|
|
108
|
+
pluginId: docInfo.pluginId,
|
|
109
|
+
error: null,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Path not found in any doc with tasks
|
|
114
|
+
return {
|
|
115
|
+
docId: null,
|
|
116
|
+
pluginId: null,
|
|
117
|
+
error: "path-not-found",
|
|
118
|
+
errorMessage: `No document with tasks found at path "${path}"`,
|
|
119
|
+
};
|
|
120
|
+
}, [path, pluginId, metadata, taskRegistry]);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=useResolveDocPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolveDocPath.js","sourceRoot":"","sources":["../../src/utils/useResolveDocPath.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAoCH,8CAiHC;AAnJD,iCAAgC;AAChC,mEAAg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QACxC,CAAC;QAED,0BAA0B;QAC1B,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAErD,kEAAkE;QAClE,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtE,2CAA2C;YAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAEvD,uBAAuB;YACvB,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;gBACjC,OAAO;oBACL,KAAK,EAAE,OAAO,CAAC,EAAE;oBACjB,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;QACH,CAAC;QAED,uCAAuC;QACvC,OAAO;YACL,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,gBAAyB;YAChC,YAAY,EAAE,yCAAyC,IAAI,GAAG;SAC/D,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for tracking badge completion animations using sessionStorage
|
|
3
|
+
* Ensures completion animation only plays once per session
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Custom hook to track whether a badge has already been animated this session
|
|
7
|
+
*
|
|
8
|
+
* @param pluginId - The docs plugin instance ID
|
|
9
|
+
* @param docId - The document ID or category identifier
|
|
10
|
+
* @returns Object with hasAnimated flag and markAsAnimated function
|
|
11
|
+
*/
|
|
12
|
+
export declare function useTaskBadgeAnimation(pluginId: string, docId: string | undefined): {
|
|
13
|
+
hasAnimated: boolean;
|
|
14
|
+
markAsAnimated: () => void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useTaskBadgeAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTaskBadgeAnimation.d.ts","sourceRoot":"","sources":["../../src/utils/useTaskBadgeAnimation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAoCA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hook for tracking badge completion animations using sessionStorage
|
|
4
|
+
* Ensures completion animation only plays once per session
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useTaskBadgeAnimation = useTaskBadgeAnimation;
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
/**
|
|
10
|
+
* Custom hook to track whether a badge has already been animated this session
|
|
11
|
+
*
|
|
12
|
+
* @param pluginId - The docs plugin instance ID
|
|
13
|
+
* @param docId - The document ID or category identifier
|
|
14
|
+
* @returns Object with hasAnimated flag and markAsAnimated function
|
|
15
|
+
*/
|
|
16
|
+
function useTaskBadgeAnimation(pluginId, docId) {
|
|
17
|
+
const [hasAnimated, setHasAnimated] = (0, react_1.useState)(false);
|
|
18
|
+
// Build storage key
|
|
19
|
+
const storageKey = docId ? `task-badge-animated-${pluginId}-${docId}` : null;
|
|
20
|
+
// Check if already animated on mount
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
if (!storageKey)
|
|
23
|
+
return;
|
|
24
|
+
try {
|
|
25
|
+
const animated = sessionStorage.getItem(storageKey);
|
|
26
|
+
setHasAnimated(animated === 'true');
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
// sessionStorage might not be available (SSR, privacy mode, etc.)
|
|
30
|
+
setHasAnimated(false);
|
|
31
|
+
}
|
|
32
|
+
}, [storageKey]);
|
|
33
|
+
// Mark as animated
|
|
34
|
+
const markAsAnimated = (0, react_1.useCallback)(() => {
|
|
35
|
+
if (!storageKey)
|
|
36
|
+
return;
|
|
37
|
+
try {
|
|
38
|
+
sessionStorage.setItem(storageKey, 'true');
|
|
39
|
+
setHasAnimated(true);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
// Silently fail if sessionStorage is not available
|
|
43
|
+
setHasAnimated(true);
|
|
44
|
+
}
|
|
45
|
+
}, [storageKey]);
|
|
46
|
+
return {
|
|
47
|
+
hasAnimated,
|
|
48
|
+
markAsAnimated,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=useTaskBadgeAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTaskBadgeAnimation.js","sourceRoot":"","sources":["../../src/utils/useTaskBadgeAnimation.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAWH,sDA0CC;AAnDD,iCAAyD;AAEzD;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,QAAgB,EAChB,KAAyB;IAKzB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAEtD,oBAAoB;IACpB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,uBAAuB,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAE7E,qCAAqC;IACrC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACpD,cAAc,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kEAAkE;YAClE,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,mBAAmB;IACnB,MAAM,cAAc,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACtC,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,IAAI,CAAC;YACH,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YAC3C,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mDAAmD;YACnD,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO;QACL,WAAW;QACX,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin configuration validation
|
|
3
|
+
*/
|
|
4
|
+
import { Joi } from "@docusaurus/utils-validation";
|
|
5
|
+
import type { ThemeConfig, ThemeConfigValidationContext } from "@docusaurus/types";
|
|
6
|
+
export declare const Schema: Joi.ObjectSchema<any>;
|
|
7
|
+
export declare function validateThemeConfig({ validate, themeConfig, }: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig;
|
|
8
|
+
//# sourceMappingURL=validateThemeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateThemeConfig.d.ts","sourceRoot":"","sources":["../src/validateThemeConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,EACV,WAAW,EACX,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;AAI3B,eAAO,MAAM,MAAM,uBAA2B,CAAC;AAE/C,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,WAAW,GACZ,EAAE,4BAA4B,CAAC,WAAW,CAAC,GAAG,WAAW,CAEzD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin configuration validation
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Schema = void 0;
|
|
7
|
+
exports.validateThemeConfig = validateThemeConfig;
|
|
8
|
+
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
9
|
+
// We don't need to validate navbar items here since Docusaurus
|
|
10
|
+
// will handle that through the ComponentTypes registration
|
|
11
|
+
exports.Schema = utils_validation_1.Joi.object({}).unknown();
|
|
12
|
+
function validateThemeConfig({ validate, themeConfig, }) {
|
|
13
|
+
return validate(exports.Schema, themeConfig);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=validateThemeConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateThemeConfig.js","sourceRoot":"","sources":["../src/validateThemeConfig.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAYH,kDAKC;AAfD,mEAAmD;AAMnD,+DAA+D;AAC/D,2DAA2D;AAC9C,QAAA,MAAM,GAAG,sBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAE/C,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,WAAW,GAC+B;IAC1C,OAAO,QAAQ,CAAC,cAAM,EAAE,WAAW,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sp-days-framework/docusaurus-plugin-interactive-tasks",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Docusaurus plugin for interactive task components with progress tracking",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/helse-sorost/sp-days-framework",
|
|
8
|
+
"directory": "docusaurus-plugin-interactive-tasks"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"docusaurus",
|
|
12
|
+
"docusaurus-plugin",
|
|
13
|
+
"tasks",
|
|
14
|
+
"interactive",
|
|
15
|
+
"training",
|
|
16
|
+
"progress"
|
|
17
|
+
],
|
|
18
|
+
"author": "SP-Days Framework",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"main": "lib/index.js",
|
|
21
|
+
"types": "lib/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"lib/**/*",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"require": "./lib/index.js",
|
|
30
|
+
"import": "./lib/index.js",
|
|
31
|
+
"types": "./lib/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./lib/theme/*": "./lib/theme/*",
|
|
34
|
+
"./lib/plugin/*": "./lib/plugin/*"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "rm -rf lib && tsc && node ./copyUntypedFiles.js",
|
|
41
|
+
"watch": "npm-run-all -c -p copy:watch build:watch",
|
|
42
|
+
"build:watch": "tsc --watch",
|
|
43
|
+
"copy:watch": "node ./copyUntypedFiles.js --watch",
|
|
44
|
+
"swizzle": "docusaurus swizzle"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@docusaurus/core": "^3.9.2",
|
|
48
|
+
"@docusaurus/logger": "^3.9.2",
|
|
49
|
+
"@docusaurus/plugin-content-docs": "^3.9.2",
|
|
50
|
+
"@docusaurus/preset-classic": "^3.9.2",
|
|
51
|
+
"@docusaurus/theme-common": "^3.9.2",
|
|
52
|
+
"@docusaurus/theme-translations": "^3.9.2",
|
|
53
|
+
"@docusaurus/utils-validation": "^3.9.2",
|
|
54
|
+
"clsx": "^2.0.0",
|
|
55
|
+
"fs-extra": "^11.1.1",
|
|
56
|
+
"gray-matter": "^4.0.3",
|
|
57
|
+
"remark-mdx": "^3.1.1",
|
|
58
|
+
"remark-parse": "^11.0.0",
|
|
59
|
+
"tslib": "^2.6.0",
|
|
60
|
+
"unified": "^11.0.5"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@docusaurus/plugin-content-docs": "^3.9.2",
|
|
64
|
+
"@docusaurus/types": "^3.0.0",
|
|
65
|
+
"@types/fs-extra": "^11.0.1",
|
|
66
|
+
"@types/js-yaml": "^4.0.9",
|
|
67
|
+
"@types/node": "^24.9.1",
|
|
68
|
+
"@types/react": "^18.0.0 || ^19.0.0",
|
|
69
|
+
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
70
|
+
"@types/webpack": "^5.28.5",
|
|
71
|
+
"chokidar": "^3.5.3",
|
|
72
|
+
"npm-run-all": "^4.1.5",
|
|
73
|
+
"typescript": "^5.0.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
77
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
78
|
+
},
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=18.0"
|
|
81
|
+
}
|
|
82
|
+
}
|