@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,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TaskExample Component
|
|
4
|
+
* Interactive collapsible task example with optional hint and solution sections
|
|
5
|
+
* Similar to Task component but:
|
|
6
|
+
* - Uses "Example N" numbering instead of "Task N"
|
|
7
|
+
* - Does NOT persist completion state to localStorage
|
|
8
|
+
* - Animations work but state is not saved
|
|
9
|
+
* - Not included in task registry (no progress tracking)
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.default = TaskExample;
|
|
49
|
+
const react_1 = __importStar(require("react"));
|
|
50
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
51
|
+
const DocTaskCounterProvider_1 = require("../DocTaskCounterProvider");
|
|
52
|
+
const icons_1 = require("../../utils/icons");
|
|
53
|
+
const styles_module_css_1 = __importDefault(require("../Task/styles.module.css")); // Reuse Task styles
|
|
54
|
+
function TaskExample({ name, children }) {
|
|
55
|
+
// Get auto-incremented example number
|
|
56
|
+
const exampleNumber = (0, DocTaskCounterProvider_1.useTaskExampleNumber)();
|
|
57
|
+
// Local state only (no persistence)
|
|
58
|
+
const [isCompleted, setIsCompleted] = (0, react_1.useState)(false);
|
|
59
|
+
const [isExpanded, setIsExpanded] = (0, react_1.useState)(true);
|
|
60
|
+
const [showHint, setShowHint] = (0, react_1.useState)(false);
|
|
61
|
+
const [showSolution, setShowSolution] = (0, react_1.useState)(false);
|
|
62
|
+
const [isAnimatingCompletion, setIsAnimatingCompletion] = (0, react_1.useState)(false);
|
|
63
|
+
const [isRemovingCheckmark, setIsRemovingCheckmark] = (0, react_1.useState)(false);
|
|
64
|
+
const [isCollapsingHint, setIsCollapsingHint] = (0, react_1.useState)(false);
|
|
65
|
+
const [isCollapsingSolution, setIsCollapsingSolution] = (0, react_1.useState)(false);
|
|
66
|
+
const [isSwitchingPanels, setIsSwitchingPanels] = (0, react_1.useState)(false);
|
|
67
|
+
const [isCollapsingBody, setIsCollapsingBody] = (0, react_1.useState)(false);
|
|
68
|
+
const [panelSpacerHeight, setPanelSpacerHeight] = (0, react_1.useState)(0);
|
|
69
|
+
// Refs for measuring panel heights
|
|
70
|
+
const hintRef = (0, react_1.useRef)(null);
|
|
71
|
+
const solutionRef = (0, react_1.useRef)(null);
|
|
72
|
+
// Track previous completion state
|
|
73
|
+
const prevIsCompleted = (0, react_1.useRef)(isCompleted);
|
|
74
|
+
// Detect when completion state changes
|
|
75
|
+
(0, react_1.useEffect)(() => {
|
|
76
|
+
if (prevIsCompleted.current !== isCompleted) {
|
|
77
|
+
// When task becomes completed
|
|
78
|
+
if (isCompleted && !prevIsCompleted.current) {
|
|
79
|
+
setIsAnimatingCompletion(true);
|
|
80
|
+
setIsRemovingCheckmark(false);
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
setIsAnimatingCompletion(false);
|
|
83
|
+
}, 600);
|
|
84
|
+
}
|
|
85
|
+
// When task is uncompleted (undo)
|
|
86
|
+
if (!isCompleted && prevIsCompleted.current) {
|
|
87
|
+
setIsRemovingCheckmark(true);
|
|
88
|
+
}
|
|
89
|
+
prevIsCompleted.current = isCompleted;
|
|
90
|
+
}
|
|
91
|
+
}, [isCompleted]);
|
|
92
|
+
// Measure panel heights and update spacer
|
|
93
|
+
(0, react_1.useEffect)(() => {
|
|
94
|
+
const updateSpacerHeight = () => {
|
|
95
|
+
if (showHint && hintRef.current) {
|
|
96
|
+
setPanelSpacerHeight(hintRef.current.offsetHeight);
|
|
97
|
+
}
|
|
98
|
+
else if (showSolution && solutionRef.current) {
|
|
99
|
+
setPanelSpacerHeight(solutionRef.current.offsetHeight);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
setPanelSpacerHeight(0);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
// Update immediately
|
|
106
|
+
updateSpacerHeight();
|
|
107
|
+
// Also update on window resize (for responsive content)
|
|
108
|
+
window.addEventListener('resize', updateSpacerHeight);
|
|
109
|
+
return () => window.removeEventListener('resize', updateSpacerHeight);
|
|
110
|
+
}, [showHint, showSolution]);
|
|
111
|
+
const toggleExpanded = () => {
|
|
112
|
+
// When collapsing, start animation then remove from DOM
|
|
113
|
+
if (isExpanded) {
|
|
114
|
+
setIsCollapsingBody(true);
|
|
115
|
+
setShowHint(false);
|
|
116
|
+
setShowSolution(false);
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
setIsExpanded(false);
|
|
119
|
+
setIsCollapsingBody(false);
|
|
120
|
+
}, 300); // Match animation duration
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// When expanding, add to DOM immediately
|
|
124
|
+
setIsExpanded(true);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const toggleCompleted = () => {
|
|
128
|
+
// Toggle completion state locally (no persistence)
|
|
129
|
+
setIsCompleted(!isCompleted);
|
|
130
|
+
};
|
|
131
|
+
const toggleHint = () => {
|
|
132
|
+
if (showHint) {
|
|
133
|
+
// Closing hint
|
|
134
|
+
setIsCollapsingHint(true);
|
|
135
|
+
setIsSwitchingPanels(false);
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
setShowHint(false);
|
|
138
|
+
setIsCollapsingHint(false);
|
|
139
|
+
}, 300);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Opening hint
|
|
143
|
+
if (showSolution) {
|
|
144
|
+
// Switching from solution to hint
|
|
145
|
+
setIsSwitchingPanels(true);
|
|
146
|
+
setIsCollapsingSolution(true);
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
setShowSolution(false);
|
|
149
|
+
setIsCollapsingSolution(false);
|
|
150
|
+
// Delay before showing hint panel
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
setShowHint(true);
|
|
153
|
+
}, 25);
|
|
154
|
+
}, 300);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
setIsSwitchingPanels(false);
|
|
158
|
+
setShowHint(true);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const toggleSolution = () => {
|
|
163
|
+
if (showSolution) {
|
|
164
|
+
// Closing solution
|
|
165
|
+
setIsCollapsingSolution(true);
|
|
166
|
+
setIsSwitchingPanels(false);
|
|
167
|
+
setTimeout(() => {
|
|
168
|
+
setShowSolution(false);
|
|
169
|
+
setIsCollapsingSolution(false);
|
|
170
|
+
}, 300);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// Opening solution
|
|
174
|
+
if (showHint) {
|
|
175
|
+
// Switching from hint to solution
|
|
176
|
+
setIsSwitchingPanels(true);
|
|
177
|
+
setIsCollapsingHint(true);
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
setShowHint(false);
|
|
180
|
+
setIsCollapsingHint(false);
|
|
181
|
+
// Delay before showing solution panel
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
setShowSolution(true);
|
|
184
|
+
}, 25);
|
|
185
|
+
}, 300);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
setIsSwitchingPanels(false);
|
|
189
|
+
setShowSolution(true);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
// Extract child components
|
|
194
|
+
let textComponent = null;
|
|
195
|
+
let hintComponent = null;
|
|
196
|
+
let solutionComponent = null;
|
|
197
|
+
react_1.default.Children.forEach(children, (child) => {
|
|
198
|
+
if (!react_1.default.isValidElement(child))
|
|
199
|
+
return;
|
|
200
|
+
const childType = child.type?.displayName || child.type?.name;
|
|
201
|
+
if (childType === 'Text') {
|
|
202
|
+
textComponent = child;
|
|
203
|
+
}
|
|
204
|
+
else if (childType === 'Hint') {
|
|
205
|
+
hintComponent = child;
|
|
206
|
+
}
|
|
207
|
+
else if (childType === 'Solution') {
|
|
208
|
+
solutionComponent = child;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
// Build task identifier badge
|
|
212
|
+
const taskBadge = `Example ${exampleNumber}`;
|
|
213
|
+
return (react_1.default.createElement("div", { className: (0, clsx_1.default)(styles_module_css_1.default.taskContainer, isCompleted && styles_module_css_1.default.taskCompleted, isAnimatingCompletion && styles_module_css_1.default.taskCompletedAnimating) },
|
|
214
|
+
react_1.default.createElement("div", { className: styles_module_css_1.default.taskHeader, onClick: toggleExpanded },
|
|
215
|
+
react_1.default.createElement("div", { className: styles_module_css_1.default.taskHeaderLeft },
|
|
216
|
+
react_1.default.createElement("span", { className: styles_module_css_1.default.taskBadge }, taskBadge),
|
|
217
|
+
react_1.default.createElement("h3", { className: styles_module_css_1.default.taskName },
|
|
218
|
+
name,
|
|
219
|
+
react_1.default.createElement("span", { className: (0, clsx_1.default)(styles_module_css_1.default.checkmark, isCompleted && !isAnimatingCompletion && !isRemovingCheckmark && styles_module_css_1.default.checkmarkVisible, isAnimatingCompletion && styles_module_css_1.default.checkmarkAnimating, isRemovingCheckmark && styles_module_css_1.default.checkmarkRemoving) }, icons_1.CHECKMARK_CIRCLE_FILL_ICON))),
|
|
220
|
+
react_1.default.createElement("button", { type: "button", className: styles_module_css_1.default.expandButton, "aria-expanded": isExpanded, "aria-label": isExpanded ? 'Collapse task' : 'Expand task' },
|
|
221
|
+
react_1.default.createElement("span", { className: (0, clsx_1.default)(styles_module_css_1.default.chevron, !isExpanded && styles_module_css_1.default.chevronCollapsed) }, icons_1.CHEVRON_DOWN_ICON))),
|
|
222
|
+
(isExpanded || isCollapsingBody) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
223
|
+
react_1.default.createElement("div", { className: (0, clsx_1.default)(styles_module_css_1.default.taskBody, isCollapsingBody && styles_module_css_1.default.taskBodyCollapsing) }, textComponent),
|
|
224
|
+
react_1.default.createElement("div", { className: (0, clsx_1.default)(styles_module_css_1.default.taskFooter, isCollapsingBody && styles_module_css_1.default.taskFooterCollapsing) },
|
|
225
|
+
react_1.default.createElement("div", { className: styles_module_css_1.default.taskActions },
|
|
226
|
+
hintComponent && (react_1.default.createElement("button", { type: "button", className: (0, clsx_1.default)(styles_module_css_1.default.taskButton, styles_module_css_1.default.hintButton, showHint && styles_module_css_1.default.active), onClick: (e) => {
|
|
227
|
+
e.stopPropagation();
|
|
228
|
+
toggleHint();
|
|
229
|
+
} }, "Hint")),
|
|
230
|
+
solutionComponent && (react_1.default.createElement("button", { type: "button", className: (0, clsx_1.default)(styles_module_css_1.default.taskButton, styles_module_css_1.default.solutionButton, showSolution && styles_module_css_1.default.active), onClick: (e) => {
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
toggleSolution();
|
|
233
|
+
} }, "Solution"))),
|
|
234
|
+
react_1.default.createElement("button", { type: "button", className: (0, clsx_1.default)(styles_module_css_1.default.taskButton, styles_module_css_1.default.completeButton, isCompleted && styles_module_css_1.default.completedButton), onClick: (e) => {
|
|
235
|
+
e.stopPropagation();
|
|
236
|
+
toggleCompleted();
|
|
237
|
+
} }, isCompleted ? 'Undo Task' : 'Mark as Done')),
|
|
238
|
+
(hintComponent || solutionComponent) && (react_1.default.createElement("div", { className: styles_module_css_1.default.panelWrapper, style: {
|
|
239
|
+
marginBottom: panelSpacerHeight > 0 ? '1rem' : 0,
|
|
240
|
+
transition: 'margin-bottom 0.3s ease-out'
|
|
241
|
+
} },
|
|
242
|
+
react_1.default.createElement("div", { className: styles_module_css_1.default.panelSpacer, style: {
|
|
243
|
+
height: panelSpacerHeight > 0 ? `${panelSpacerHeight}px` : 0,
|
|
244
|
+
transition: 'height 0.3s ease-out'
|
|
245
|
+
} }),
|
|
246
|
+
hintComponent && (react_1.default.createElement("div", { ref: hintRef, className: (0, clsx_1.default)(styles_module_css_1.default.panelContainer, styles_module_css_1.default.panelAbsolute, (showHint || isCollapsingHint) && styles_module_css_1.default.panelVisible, showHint && !isCollapsingHint && !isSwitchingPanels && styles_module_css_1.default.panelContainerExpanding, showHint && !isCollapsingHint && isSwitchingPanels && styles_module_css_1.default.hintPanelContainerExpandingSwitching, isCollapsingHint && !isSwitchingPanels && styles_module_css_1.default.panelContainerCollapsing, isCollapsingHint && isSwitchingPanels && styles_module_css_1.default.hintPanelContainerCollapsingSwitching) }, hintComponent)),
|
|
247
|
+
solutionComponent && (react_1.default.createElement("div", { ref: solutionRef, className: (0, clsx_1.default)(styles_module_css_1.default.panelContainer, styles_module_css_1.default.panelAbsolute, (showSolution || isCollapsingSolution) && styles_module_css_1.default.panelVisible, showSolution && !isCollapsingSolution && !isSwitchingPanels && styles_module_css_1.default.panelContainerExpanding, showSolution && !isCollapsingSolution && isSwitchingPanels && styles_module_css_1.default.solutionPanelContainerExpandingSwitching, isCollapsingSolution && !isSwitchingPanels && styles_module_css_1.default.panelContainerCollapsing, isCollapsingSolution && isSwitchingPanels && styles_module_css_1.default.solutionPanelContainerCollapsingSwitching) }, solutionComponent))))))));
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/theme/TaskExample/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaH,8BAsTC;AAjUD,+CAA8F;AAC9F,gDAAwB;AACxB,sEAAiE;AACjE,6CAAkF;AAClF,kFAA+C,CAAC,oBAAoB;AAOpE,SAAwB,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAoB;IACtE,sCAAsC;IACtC,MAAM,aAAa,GAAG,IAAA,6CAAoB,GAAE,CAAC;IAE7C,oCAAoC;IACpC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC1E,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACtE,MAAM,CAAC,gBA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AM,CAAC,yCAAyC,CAC9F,IAEA,iBAAiB,CACd,CACP,CACG,CACP,CACA,CACJ,CACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# TaskPlaceholder Component
|
|
2
|
+
|
|
3
|
+
A standalone task component designed for use outside of doc pages, such as landing pages, home pages, or any standalone MDX pages where you want to showcase the task UI.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`TaskPlaceholder` is a fully-featured task component that looks and behaves identically to the regular `Task` component, but without requiring:
|
|
8
|
+
- TaskProvider context
|
|
9
|
+
- DocTaskCounterProvider context
|
|
10
|
+
- Being placed inside a docs directory
|
|
11
|
+
- Task registry or progress tracking
|
|
12
|
+
|
|
13
|
+
This makes it perfect for demonstrations, examples, or creating task-like interfaces on any page in your Docusaurus site.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Standalone** - Works anywhere, no provider context needed
|
|
18
|
+
- **Auto-collapse support** - Respects global auto-collapse toggle
|
|
19
|
+
- **Custom badges** - Default "Demo N" numbering or custom badge text
|
|
20
|
+
- **Full animations** - All the same animations as Task/TaskExample
|
|
21
|
+
- **MDX support** - Use markdown content with Text, Hint, and Solution
|
|
22
|
+
- **Reuses styling** - Identical look and feel to Task components
|
|
23
|
+
- **Ephemeral state** - Completion state resets on page refresh
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Basic Example
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import TaskPlaceholder from '@theme/TaskPlaceholder';
|
|
31
|
+
import Text from '@theme/Task/Text';
|
|
32
|
+
import Hint from '@theme/Task/Hint';
|
|
33
|
+
import Solution from '@theme/Task/Solution';
|
|
34
|
+
|
|
35
|
+
<TaskPlaceholder title="Example Task">
|
|
36
|
+
<Text>
|
|
37
|
+
This is the main task description. You can use **markdown** formatting here.
|
|
38
|
+
|
|
39
|
+
- Create a new file
|
|
40
|
+
- Add some code
|
|
41
|
+
- Test your changes
|
|
42
|
+
</Text>
|
|
43
|
+
<Hint>
|
|
44
|
+
Try looking at the documentation for help!
|
|
45
|
+
</Hint>
|
|
46
|
+
<Solution>
|
|
47
|
+
Here's the complete solution with code examples:
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
console.log('Hello, World!');
|
|
51
|
+
```
|
|
52
|
+
</Solution>
|
|
53
|
+
</TaskPlaceholder>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### With Custom Badge
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
<TaskPlaceholder title="Custom Badge Example" badge="Step 1">
|
|
60
|
+
<Text>
|
|
61
|
+
This task shows a custom badge instead of auto-numbered "Demo N".
|
|
62
|
+
</Text>
|
|
63
|
+
</TaskPlaceholder>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Minimal Example (No Hint/Solution)
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
<TaskPlaceholder title="Simple Task">
|
|
70
|
+
<Text>
|
|
71
|
+
Just the basics - no hint or solution needed.
|
|
72
|
+
</Text>
|
|
73
|
+
</TaskPlaceholder>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Props API
|
|
77
|
+
|
|
78
|
+
### TaskPlaceholder
|
|
79
|
+
|
|
80
|
+
| Prop | Type | Required | Default | Description |
|
|
81
|
+
|------|------|----------|---------|-------------|
|
|
82
|
+
| `title` | `string` | Yes | - | The title/name of the task displayed in the header |
|
|
83
|
+
| `badge` | `string` | No | `"Demo N"` | Custom badge text. If omitted, auto-increments as "Demo 1", "Demo 2", etc. |
|
|
84
|
+
| `children` | `ReactNode` | No | - | Task content including Text, Hint, and Solution components |
|
|
85
|
+
|
|
86
|
+
### Child Components
|
|
87
|
+
|
|
88
|
+
TaskPlaceholder supports the same child components as regular Task:
|
|
89
|
+
|
|
90
|
+
- **`<Text>`** - Main task description/instructions
|
|
91
|
+
- **`<Hint>`** - Optional hint panel (collapsible)
|
|
92
|
+
- **`<Solution>`** - Optional solution panel (collapsible)
|
|
93
|
+
|
|
94
|
+
These are the same components used by `@theme/Task` - see their documentation for details.
|
|
95
|
+
|
|
96
|
+
## Behavior
|
|
97
|
+
|
|
98
|
+
### Auto-Collapse Integration
|
|
99
|
+
|
|
100
|
+
TaskPlaceholder respects the global auto-collapse setting:
|
|
101
|
+
- Reads from `localStorage` key `autoCollapseCompletedTasks`
|
|
102
|
+
- Listens to changes from the navbar toggle
|
|
103
|
+
- Works across tabs via storage events
|
|
104
|
+
- When enabled, completed tasks automatically collapse after animation
|
|
105
|
+
|
|
106
|
+
### Completion State
|
|
107
|
+
|
|
108
|
+
Unlike regular `Task` components:
|
|
109
|
+
- Completion state is **ephemeral** (not saved to localStorage)
|
|
110
|
+
- State resets on page refresh/navigation
|
|
111
|
+
- No impact on task progression tracking
|
|
112
|
+
- Perfect for demonstrations and examples
|
|
113
|
+
|
|
114
|
+
### Auto-Numbering
|
|
115
|
+
|
|
116
|
+
The demo counter increments globally across all TaskPlaceholder instances on a page:
|
|
117
|
+
- First instance: "Demo 1"
|
|
118
|
+
- Second instance: "Demo 2"
|
|
119
|
+
- And so on...
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TaskPlaceholder Component
|
|
3
|
+
* A standalone task component for use outside of doc pages (e.g., landing pages, standalone pages)
|
|
4
|
+
*
|
|
5
|
+
* Key differences from Task/TaskExample:
|
|
6
|
+
* - No dependency on TaskProvider or DocTaskCounterProvider
|
|
7
|
+
* - Can be used anywhere (not just in docs)
|
|
8
|
+
* - Custom badge text with auto-increment fallback
|
|
9
|
+
* - Respects global auto-collapse setting from localStorage
|
|
10
|
+
* - Ephemeral completion state (not persisted)
|
|
11
|
+
* - Supports MDX content with Hint and Solution components
|
|
12
|
+
*/
|
|
13
|
+
import { type ReactNode, type ReactElement } from 'react';
|
|
14
|
+
export interface TaskPlaceholderProps {
|
|
15
|
+
/** The title/name of the task */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Optional custom badge text. If not provided, auto-increments as "Demo 1", "Demo 2", etc. */
|
|
18
|
+
badge?: string;
|
|
19
|
+
/** Task content including Text, Hint, and Solution components */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export default function TaskPlaceholder({ title, badge, children }: TaskPlaceholderProps): ReactElement;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/TaskPlaceholder/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAc,EAAE,KAAK,SAAS,EAAY,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;AAM9F,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAKD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,YAAY,CAsWtG"}
|